⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 protectover_load.c

📁 电力系统中的保护装置全部代码
💻 C
字号:
/********************************************************************************/
/*                                                                              */
/* 程序名:							                */
/*                                                                              */
/*      OVER_LOAD.C                               		                */
/*                                                                              */
/* 功能:	                  		                           		*/
/*                                                                              */
/*                                                                              */
/********************************************************************************/

#include        "BaseVariable.h" 
#include	"ProOver_Load.h"
/*****************************************/

///////////////////////////////////////////
////////////////保护初始化函数///////////////
///////////////////////////////////////////
REPORT		ZOVL_Report;
REPORT          *pOVREPORT = &ZOVL_Report;

VOID    OVER_LOAD_Initialize(PROTECT *ptr)
{
PROTECT         *pProtect;
SETTING         *pSets;
SOE             *pSoe;
VALUE           *pValue;
JUMPER          *pJumper;
REPORT          *pReport; 
int i;
// ----------------------------------------------------- // 
//保护结构体指针赋值
    pProtect = ptr; 
//保护缓冲区指针赋值
    pProtect->pro_jumper      =    Over_Load_jumper;
    pProtect->pro_setting     =    Over_Load_setting;		
    pProtect->pro_run_data    =    Over_Load_rundata;
//保护ID号
    pProtect->pro_id = PRO_Total_Protect;
//保护装置名
    pProtect->ppro_device_name = "WXH-821";     
//保护名
    pProtect->ppro_name = "过负荷保护";
    pJumper->pjum_alias    =    "GFH";
//跳闸位
    pProtect->pro_trip = 0x1;

//////模拟通道  
// ----------------------------------------------------- // 
//相电流                       	
    pProtect->pro_analog_channel[0]    =    PIa_Chn;
    pProtect->pro_analog_channel[1]    =    PIb_Chn;
    pProtect->pro_analog_channel[2]    =    PIc_Chn;
        
//////压板
// ----------------------------------------------------- // 
//压板个数
    pProtect->pro_jumper_number    =    0;
//指针赋值            
    pJumper    =    pProtect->pro_jumper;  
//ID号
    pJumper->pro_id     =    pProtect->pro_id;	
//序号
    pJumper->jum_id     =    pProtect->pro_jumper_number;                                         
//INF
    pJumper->jum_inf    =    177; 
//CONTROLINF
    pJumper->jum_ctrl   =    54;  //modify 6.11                                           
//压板名称
    pJumper->pjum_name     =    "过负荷投退";
    pJumper->pjum_alias    =    "GFH";    
//压板状态
    pJumper->jum_status    =    1;  
//赋值增量
    pJumper++;  
    pProtect->pro_jumper_number++;

//////定值 
// ----------------------------------------------------- // 
//定值个数                        
    pProtect->pro_setting_number = 0;
    pSets = pProtect->pro_setting;                       
   //------------------------------------------------// 
//电流      
    pSets->pro_id    =    pProtect->pro_id;       
    pSets->set_id    =    ++(pProtect->pro_setting_number);
    pSets->pset_name =    (CHAR *)strcpy(pSets->set_name,"过负荷电流");                                                 
    pSets->pset_alias          =    "Igfh";	                                                                               
    pSets->pset_dimension      =    "A";
    pSets->set_lower_limit     =    0.500;
    pSets->set_high_limit      =    100;
    pSets->set_calculate_style =    CHL_FOURIER1_;
    pSets->set_calculate_coefficient = CHL_CONSTANT_1; 
    for(i=0;i<SET_ZONE;i++)
    pSets->set_value_zone[i]   =    36.0*CHL_CONSTANT_1; 
    pSets++;
   //------------------------------------------------// 
//时限      
    pSets->pro_id    =    pProtect->pro_id;       
    pSets->set_id    =    ++(pProtect->pro_setting_number);
    pSets->pset_name =    (CHAR *)strcpy(pSets->set_name,"过负荷时间");                                                 
    pSets->pset_alias          =    "Tgfh";	                                                                           
    pSets->pset_dimension      =    "S";
    pSets->set_lower_limit     =    0.00;
    pSets->set_high_limit      =    600.0;
    pSets->set_calculate_style =    CHL_MUL_;
    pSets->set_calculate_coefficient = CHL_CONSTANT_1; 
    for(i=0;i<SET_ZONE;i++)
    pSets->set_value_zone[i]   =    10.0*CHL_CONSTANT_1;
    pSets++;                                                      
                                                       
//////保护投退控制字
// ----------------------------------------------------- // 	
    pSets->pro_id    =    pProtect->pro_id;       
    pSets->set_id    =    ++(pProtect->pro_setting_number);
    pSets->pset_name =    (CHAR *)strcpy(pSets->set_name,"跳闸控制字");
    pSets->pset_alias          =    "Gfht";                                                  
    pSets->pset_dimension      =    " ";
    pSets->set_lower_limit     =    0.00;
    pSets->set_high_limit      =    1.00;
    pSets->set_calculate_style =    MODE_;
    pSets->set_calculate_coefficient = CHL_CONSTANT_1;
    for(i=0;i<SET_ZONE;i++)
    pSets->set_value_zone[i]   =    1.0*CHL_CONSTANT_1; 
    pSets++;
    
//////实时参数
// ----------------------------------------------------- // 
    pProtect->pro_run_data_number    =    0;
    pValue    =    pProtect->pro_run_data;
   //------------------------------------------------//  
    pValue->value_index_number    =    ++(pProtect->pro_run_data_number); 	
    pValue->pvalue_name = (CHAR*)strcpy(pValue->value_name,"A相电流");       	                                  
    pValue->pvalue_alias    =    "Ia";	
    pValue->value_calculate_style =    CHL_FOURIER1_;  
    pValue->pvalue_dimension  	  =    "A";  
    pValue->value_calculate_coefficient = 1; 
    pValue->value_measure   =    0.0; 
    pValue++;
   //------------------------------------------------// 
    pValue->value_index_number	  =    ++(pProtect->pro_run_data_number); 
    pValue->pvalue_name = (CHAR*)strcpy(pValue->value_name,"B相电流");       	                                  
    pValue->pvalue_alias    =    "Ib";	
    pValue->value_calculate_style =    CHL_FOURIER1_;  
    pValue->pvalue_dimension      =    "A";  
    pValue->value_calculate_coefficient = 1; 
    pValue->value_measure   =    0.0;
    pValue++;
//------------------------------------------------//  
    pValue->value_index_number    =    ++(pProtect->pro_run_data_number);
    pValue->pvalue_name = (CHAR*)strcpy(pValue->value_name,"C相电流");        	                                  
    pValue->pvalue_alias    =    "Ic";	
    pValue->value_calculate_style =    CHL_FOURIER1_;  
    pValue->pvalue_dimension      =    "A";  
    pValue->value_calculate_coefficient = 1; 
    pValue->value_measure   =    0.0;
    pValue++;

//////报告
// ----------------------------------------------------- // 
    pReport = &ZOVL_Report;
    pReport->pro_report_flag = 2;
//SOE				    	
    pSoe = &pReport->pro_report_soe;            	  	
    pSoe->pSOE_name = "过负荷保护跳闸"; 
    pSoe->SOE_Inf = 230;
    pSoe->DPI = 2; 
//动作值
    pReport->pro_report_data_number = 0;
    pReport->pro_report_data = Over_Load_reportdata;
    pValue = pReport->pro_report_data;
   //------------------------------------------------// 
    pValue->pvalue_name = (CHAR *)strcpy(pValue->value_name,"A相动作电流");
    pValue->pvalue_alias          =    "Ia";
    pValue->value_calculate_style =    CHL_FOURIER1_;
    pValue->pvalue_dimension      =    "A";
    pValue->value_calculate_coefficient = CHL_FOURIER_CURRENT;
//    pValue->value_measure       =    Ia_Value;
    pValue->value_index_number    =    pReport->pro_report_data_number;
    pValue++; 
    pReport->pro_report_data_number++; 
    //------------------------------------------------//
    pValue->pvalue_name = (CHAR *)strcpy(pValue->value_name,"B相动作电流");
    pValue->pvalue_alias          =    "Ib";
    pValue->value_calculate_style =    CHL_FOURIER1_;
    pValue->pvalue_dimension      =    "A";
    pValue->value_calculate_coefficient = CHL_FOURIER_CURRENT;
//    pValue->value_measure       =    Ib_Value;
    pValue->value_index_number    =    pReport->pro_report_data_number;
    pValue++;
    pReport->pro_report_data_number++;   
    //------------------------------------------------// 
    pValue->pvalue_name = (CHAR *)strcpy(pValue->value_name,"C相动作电流");
    pValue->pvalue_alias          =    "Ic";
    pValue->value_calculate_style =    CHL_FOURIER1_;
    pValue->pvalue_dimension      =    "A";
    pValue->value_calculate_coefficient = CHL_FOURIER_CURRENT;
//    pValue->value_measure       =    Ic_Value;
    pValue->value_index_number    =    pReport->pro_report_data_number;
    pValue++; 
    pReport->pro_report_data_number++;
    //------------------------------------------------//
//报告通道
    //pReport->pro_channel_number = 1;

//////保护私用变量
// ----------------------------------------------------- //      
    pProtect->pro_startup_flag    =    0;
    pProtect->pro_pickup_flag     =    0;	
    pProtect->pro_reserve1    =    0; 
    pProtect->pro_reserve4    =    TMD_System_Clock;           
}

///////////////////////////////////////////
/////////////// 保护执行函数 ////////////////
///////////////////////////////////////////
extern	PROTECT	protect_Reclose;

void    OVER_LOAD_Routine(PROTECT *ptr)
{
PROTECT         *pProtect; 
SETTING         *pSets; 
SOE             *pSoe; 
VALUE           *pValue;
REPORT          *pReport = pOVREPORT;
JUMPER          *pJumper; 
TIME            *pTime;
INT             SetZoneNum;

float           Ia_Value,Ib_Value,Ic_Value;
float           Current_Set;
float           Time_Set;
float           Pick_Plunge;

UNSIGNED        *Charge_Flag;

// ----------------------------------------------------- // 

    pProtect = ptr;

//指针赋值
    Charge_Flag = &protect_Reclose.pro_reserve3;//充电标

//////取定值
// ----------------------------------------------------- // 
//定值区号
    SetZoneNum    =    iLONC_SetZoneNum;
    pSets         =    pProtect->pro_setting; 
   //------------------------------------------------//        
//电流          
    Current_Set   =    pSets->set_value_zone[SetZoneNum];
    pSets++;
//时间        
    Time_Set      =    pSets->set_value_zone[SetZoneNum];
    pSets++;
//跳闸压板
    Pick_Plunge   =    pSets->set_value_zone[SetZoneNum];
    pSets++;
    
    pProtect->pro_trip = Pick_Plunge;
//////实时数据
// ----------------------------------------------------- // 
//数据通道
    Ia_Value    =    AIChn[PIa_Chn].chl_value1;
    Ib_Value    =    AIChn[PIb_Chn].chl_value1;
    Ic_Value    =    AIChn[PIc_Chn].chl_value1;
//数据传递
    pValue      =    pProtect->pro_run_data;  
   //------------------------------------------------// 
//A相电流 
    pValue->value_measure    =    Ia_Value;
    pValue++;        
// B相电流 
    pValue->value_measure    =    Ib_Value;
    pValue++;           
// C相电流 
    pValue->value_measure    =    Ic_Value;
    pValue++; 

//////保护逻辑
// ----------------------------------------------------- // 

//压板指针
    pProtect->pro_jumper    =    Over_Load_jumper;
    pJumper    =    pProtect->pro_jumper; 

//保护退
    if(!pJumper->jum_status)				
    {
        ClearFlag(ptr); 
        return; 
    }

//电流元件
    if(Ia_Value < Current_Set && Ib_Value < Current_Set && Ic_Value < Current_Set)
    {
        NoStartup(ptr);
	pProtect->pro_reserve5 = TMD_System_Clock;
        return;
           
    }  
    
//去干扰
    if(EraseBurr(pProtect))
        return;
	
//启动
    if(StartPro(pProtect))
        return;

//时间元件
    if(TimeWait(pProtect,Time_Set)) 
        return;
                    
//动作元件

    pProtect->pro_reserve5 = TMD_System_Clock - pProtect->pro_reserve5;//相对时间
    pProtect->pro_pickup_flag = 1;

    if(Pick_Plunge)
    {
        *Charge_Flag = 0;
    }
       		    
//////报告
// ----------------------------------------------------- //
//    pReport = &ZOVL_Report;
//SOE		
    pSoe = &pReport->pro_report_soe; 
    pSoe->pSOE_name = "过负荷保护跳闸"; 
    strcpy(pSoe->SOE_name,pSoe->pSOE_name);
    pSoe->SOE_Inf = 230;
    pSoe->DPI = 2;  
   //------------------------------------------------//		    	
    pSoe->Relative_Time = pProtect->pro_reserve5;
    READ_DEC_TIME(&pSoe->Year);
//动作值
//    pReport->pro_report_data = Over_Load_reportdata;
    pValue = pReport->pro_report_data;
    pReport->pro_report_data_number    =    0;
   //------------------------------------------------// 
    pValue -> value_measure     =       Ia_Value;
    pValue++; 
    pReport->pro_report_data_number++;

    pValue -> value_measure     =       Ib_Value;
    pValue++;
    pReport->pro_report_data_number++;
    
    pValue -> value_measure     =       Ic_Value;
    pValue++; 
    pReport->pro_report_data_number++;
   //------------------------------------------------//
    if(!Pick_Plunge)
    { 
        pSoe->pSOE_name = "过负荷保护告警";
        strcpy(pSoe->SOE_name,pSoe->pSOE_name); 
        pSoe->SOE_Inf = 233;
        pSoe->DPI = 2;
        Signal(); 
    }
    else
    {
	Qdj();			//跳闸子程序
    	Tzj();
    }	        
    pReport->mmi_flag = MMIDISPLAY + MMIPICKUP;
    Fill_Report(pReport);

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -