📄 protectoc2_current.c
字号:
/********************************************************************************/
/* */
/* 程序名: */
/* */
/* OC_II_Direction.C */
/* */
/* 功能: */
/* */
/* */
/********************************************************************************/
#include "BaseVariable.h"
#include "ProOC_II_Direction.h"
///////////////////////////////////////////
///////////// 保护初始化函数 ////////////////
///////////////////////////////////////////
void OC_II_Direction_Initialize(PROTECT *ptr)
{
PROTECT *pProtect;
SETTING *pSets;
SOE *pSoe;
VALUE *pValue;
JUMPER *pJumper;
REPORT *pReport;
int i;
// ----------------------------------------------------- //
//保护结构体指针赋值
pProtect = ptr;
//保护缓冲区指针赋值
pProtect->pro_jumper = OC_II_jumper;
pProtect->pro_setting = OC_II_setting;
pProtect->pro_run_data = OC_II_rundata;
//保护ID号
pProtect->pro_id = PRO_Total_Protect;
//保护装置名
pProtect->ppro_device_name = "WXH-821";
//保护名
pProtect->ppro_name = "过流Ⅱ段保护";
//跳闸位
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 = 187;
//CONTROLINF
pJumper->jum_ctrl = 51;
//压板名称
pJumper->pjum_name = "过流Ⅱ段投退";
pJumper->pjum_alias = "GL2";
//压板状态
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 = "I2zd";
pSets->pset_dimension = "A";
pSets->set_lower_limit = 0.5;
pSets->set_high_limit = 100.0;
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] = 100.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 = "T2";
pSets->pset_dimension = "S";
pSets->set_lower_limit = 0.00;
pSets->set_high_limit = 100;
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] = 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 = &OC2_Report;
pReport->pro_report_flag = 2;
//SOE
pSoe = &pReport->pro_report_soe;
pSoe->pSOE_name = "过流Ⅱ段跳闸";
strcpy(pSoe->SOE_name,pSoe->pSOE_name);
pSoe->SOE_Inf = 95;
pSoe->DPI = 2;
//动作值
pReport->pro_report_data_number = 0;
pReport->pro_report_data = OC_II_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_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_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_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;
}
///////////////////////////////////////////
/////////////// 保护执行函数 ////////////////
///////////////////////////////////////////
VOID OC_II_Direction_Routine(PROTECT *ptr)
{
PROTECT *pProtect;
SETTING *pSets;
SOE *pSoe;
VALUE *pValue;
REPORT *pReport,Report;
JUMPER *pJumper;
TIME *pTime;
INT SetZoneNum;
float Ia_Value,Ib_Value,Ic_Value;
float Current_Set;
float Time_Set;
// ----------------------------------------------------- //
pProtect = ptr;
//////取定值
// ----------------------------------------------------- //
//定值区号
SetZoneNum = iLONC_SetZoneNum;
pSets = pProtect->pro_setting;
//电流
Current_Set = pSets->set_value_zone[SetZoneNum];
pSets++;
//时间
Time_Set = pSets->set_value_zone[SetZoneNum];
pSets++;
//////实时数据
// ----------------------------------------------------- //
//数据通道
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 = OC_II_jumper;
pJumper = pProtect->pro_jumper;
//保护退
if(!pJumper->jum_status)
{
ClearFlag(pProtect);
return;
}
//保护投
//电流元件
if(Ia_Value < Current_Set && Ib_Value < Current_Set && Ic_Value < Current_Set)
{
// NoStartup(pProtect);
ClearFlag(pProtect);
pProtect->pro_reserve5 = TMD_System_Clock;
return;
}
//去干扰
// if(EraseBurr(pProtect))
// return;
//启动
if(StartPro(pProtect))
return;
//时间元件
if(TimeWait(pProtect,Time_Set))
return;
//动作元件
pProtect->pro_pickup_flag = 1;
Qdj(); //跳闸子程序
Tzj();
pProtect->pro_reserve5 = TMD_System_Clock - pProtect->pro_reserve5;//相对时间
//报告
pReport = &OC2_Report;
//SOE
pSoe = &pReport->pro_report_soe;
//------------------------------------------------//
pSoe->Relative_Time = pProtect->pro_reserve5;
READ_DEC_TIME(&pSoe->Year);
// pSoe->Fault_Number = SOENumber++;
//------------------------------------------------//
//动作值
pValue = pReport->pro_report_data;
//------------------------------------------------//
pValue -> value_measure = Ia_Value;
pValue++;
pValue -> value_measure = Ib_Value;
pValue++;
pValue -> value_measure = Ic_Value;
pValue++;
//------------------------------------------------//
pReport->mmi_flag = MMIDISPLAY + MMIPICKUP;
Fill_Report(pReport);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -