📄 pt.c
字号:
/********************************************************************************/
/* */
/* 程序名: */
/* */
/* PT.C */
/* */
/* 功能: */
/* */
/* */
/********************************************************************************/
//PT断线标志 pProtect->pro_reserve1;
//相关保护投退 pProtect->pro_reserve2;
#include "BaseVariable.h"
#include "ProPT.h"
/*****************************************/
///////////////////////////////////////////
////////////////保护初始化函数///////////////
///////////////////////////////////////////
VOID PT_Initialize(PROTECT *ptr)
{
PROTECT *pProtect;
SETTING *pSets;
SOE *pSoe;
VALUE *pValue;
JUMPER *pJumper;
REPORT *pReport;
int i;
// ----------------------------------------------------- //
//保护结构体指针赋值
pProtect = ptr;
//保护缓冲区指针赋值
pProtect->pro_setting = PT_setting;
pProtect->pro_run_data = PT_rundata;
//保护ID号
pProtect->pro_id = PRO_Total_Protect;
//保护装置名
pProtect->ppro_device_name = "WXH-821";
//保护名
pProtect->ppro_name = "PT断线检测";
//跳闸位
pProtect->pro_trip = 0;
//////模拟通道
// ----------------------------------------------------- //
//相电流
pProtect->pro_analog_channel[0] = PIa_Chn;
pProtect->pro_analog_channel[1] = PIb_Chn;
pProtect->pro_analog_channel[2] = PIc_Chn;
//电压
pProtect->pro_analog_channel[3] = Ua_Chn;
pProtect->pro_analog_channel[4] = Ub_Chn;
pProtect->pro_analog_channel[5] = Uc_Chn;
//////压板
// ----------------------------------------------------- //
//压板个数
pProtect->pro_jumper_number = 0;
//////定值
// ----------------------------------------------------- //
//定值个数
pProtect->pro_setting_number = 0;
pSets = pProtect->pro_setting;
//------------------------------------------------//
//PT断线控制字
pSets->pro_id = pProtect->pro_id;
pSets->set_id = ++(pProtect->pro_setting_number);
pSets->pset_name = (CHAR *)strcpy(pSets->set_name,"PT断线投退");
pSets->pset_alias = "PT";
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++;
//------------------------------------------------//
pValue->value_index_number = ++(pProtect->pro_run_data_number);
pValue->pvalue_name =(CHAR *)strcpy(pValue -> value_name,"AB线电压");
pValue->pvalue_alias = "Uab";
pValue->value_calculate_style = CHL_FOURIER1_;
pValue->pvalue_dimension = "V";
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,"BC线电压");
pValue->pvalue_alias = "Ubc";
pValue->value_calculate_style = CHL_FOURIER1_;
pValue->pvalue_dimension = "V";
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,"CA线电压");
pValue->pvalue_alias = "Uca";
pValue->value_calculate_style = CHL_FOURIER1_;
pValue->pvalue_dimension = "V";
pValue->value_calculate_coefficient = 1;
pValue->value_measure = 0.0;
pValue++;
//////报告
// ----------------------------------------------------- //
pReport = &PT_Report;
pReport->pro_report_flag = 1;
//SOE
pSoe = &pReport->pro_report_soe;
pSoe->pSOE_name = "母线PT断线";
strcpy(pSoe->SOE_name,pSoe->pSOE_name);
pSoe->SOE_Inf = 38;
pSoe->DPI = 2;
//动作值
pReport->pro_report_data_number = 0;
pReport->pro_report_data = PT_reportdata;
pValue = pReport->pro_report_data;
//------------------------------------------------//
pValue->pvalue_name = (CHAR *)strcpy(pValue->value_name,"A相电压");
pValue->pvalue_alias = "Ua";
pValue->value_calculate_style = CHL_FOURIER1_;
pValue->pvalue_dimension = "V";
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 = "Ub";
pValue->value_calculate_style = CHL_FOURIER1_;
pValue->pvalue_dimension = "V";
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 = "Uc";
pValue->value_calculate_style = CHL_FOURIER1_;
pValue->pvalue_dimension = "V";
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;
// ----------------------------------------------------- //
pReport = &PTl_Report;
pReport->pro_report_flag = 1;
//SOE
pSoe = &pReport->pro_report_soe;
pSoe->pSOE_name = "线路PT断线";
strcpy(pSoe->SOE_name,pSoe->pSOE_name);
pSoe->SOE_Inf = 133;
pSoe->DPI = 2;
//动作值
pReport->pro_report_data_number = 0;
pReport->pro_report_data = PTl_reportdata;
pValue = pReport->pro_report_data;
//------------------------------------------------//
pValue->pvalue_name = (CHAR *)strcpy(pValue->value_name,"抽取电压");
pValue->pvalue_alias = "Ux";
pValue->value_calculate_style = CHL_MUL_;
pValue->pvalue_dimension = "V";
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_reserve3 = 0;
pProtect->pro_reserve4 = TMD_System_Clock;
}
///////////////////////////////////////////
/////////////// 保护执行函数 ////////////////
///////////////////////////////////////////
void PTl_Test(PROTECT *ptr);
extern float FSQRT(float REAL,float IMAG);
void PT_Routine(PROTECT *ptr)
{
PROTECT *pProtect;
SETTING *pSets;
SOE *pSoe;
VALUE *pValue;
REPORT *pReport;
TIME *pTime;
INT SetZoneNum;
float Ia_Value,Ib_Value,Ic_Value;
float Ua,Ub,Uc,Uar,Uai,Ubr,Ubi,Ucr,Uci,U12,U23,U31;
float PT_Plunge;
extern float Uab,Ubc,Uca;
UNSIGNED Phase,Line;
UNSIGNED *PTDXBZ,*XGBH;
// ----------------------------------------------------- //
pProtect = ptr;
//指针赋值
PTDXBZ = &pProtect->pro_reserve1;//PT断线标志
XGBH = &pProtect->pro_reserve2;//相关保护投退
//////取定值
// ----------------------------------------------------- //
//定值区号
SetZoneNum = iLONC_SetZoneNum;
pSets = pProtect->pro_setting;
//------------------------------------------------//
//PT断线投退
PT_Plunge = 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;
Ua = AIChn[Ua_Chn].chl_value1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -