#ifndef __GUI_H #define __GUI_H #include "time.h" #define LINE_TOTAL_NUM 4 //线路数量 #define ANALOG_CH_NUM 12 //AI、AO模拟量通道数 /*************上行数据*************************************************小核数据 -> 大核****************************************************************************/ //实时量 typedef struct { //三相电压 float Ua; //A相电压 float Ub; //B相电压 float Uc; //C相电压 //三相电流 float Ia; //A相电流 float Ib; //B相电流 float Ic; //C相电流 //有功功率 float Pa; float Pb; float Pc; float Pt; //总有功功率 //无功功率 float Qa; float Qb; float Qc; float Qt; //总无功功率 //视在功率 float Sa; float Sb; float Sc; float St; //总视在功率 //功率因数 float PFa; float PFb; float PFc; float PFt; //总功率因数 //线电压 float Uab; float Ubc; float Uca; //频率 float frq; }measure_unit_t; //B码对时,时间数据 typedef union { uint8_t b_code[6]; struct { uint8_t ascii_s_unit : 4; uint8_t ascii_s_ten : 4; uint8_t ascii_min_unit : 4; uint8_t ascii_min_ten : 4; uint8_t ascii_hour_unit : 4; uint8_t ascii_hour_ten : 4; uint8_t ascii_m_day_unit: 4; uint8_t ascii_m_day_ten : 4; uint8_t ascii_month_unit: 4; //4bit uint8_t ascii_month_ten : 4; //4bit uint8_t ascii_year_unit : 4; //4bit uint8_t ascii_year_ten : 4; //4bit }time; }b_code_t; //开入、开出 typedef struct { uint16_t in; //每一位对应一个通道状态 : 1 = 合, 0 = 分 uint16_t out; //每一位对应一个通道状态 : 1 = 合, 0 = 分 }d_io_t; //模拟量:AI AO typedef struct { float in[ANALOG_CH_NUM]; //模拟量输入 float out[ANALOG_CH_NUM]; //模拟量输出 }a_io_t; //事件 typedef struct { struct tm t; //事件发生时间 uint32_t ms; //事件发生的毫秒时刻 uint8_t evt; //类型:0 = 无事件, 1 = 事件发生 }event_t; //波形数据 typedef struct { uint32_t stamp; //时标 int16_t ch[8]; //4条线路波形数据时:8个通道:ua、ub、uc, ia、ib、ic、频率系数、开入量 //AI采集通道波形数据时 :8个通道对应各个输入点 }ch_data_t; //波形数据 typedef struct { uint8_t line_index; //线路号 : 0 ~ 3 = 4路电压电流采样数据,4 = AI采集数据 ch_data_t dot[64]; //64个点组成一个周波 }waveform_data_t; //小核数据 -> 大核 typedef struct { measure_unit_t measure_unit[LINE_TOTAL_NUM];//总共4条线路,按序排列 a_io_t d_io; //模拟量输入、输出 d_io_t a_io; //数字量,开入、开出 b_code_t b_code; //B码对时 event_t event[2]; //事件标志:event[0] = pt 断线, event[1] = CT断线 waveform_data_t waveform; //实时一周波数据 }gui_in_t; /********下行数据******************************************************大核数据 -> 小核****************************************************************************/ //界面任一参数修改,即将整个参数表更新下发一次 //串口参数设置 typedef struct { uint32_t baud_tate; //波特率 : 9600 115200(默认) uint8_t parity; //校验位 : 0 = 无校验, 1 = 奇校验, 2 = 偶校验 uint8_t data; //数据位 : 0 = 8位 uint8_t stop; //停止位 : 0 = 1位, 1 = 2位 uint8_t protocol; //通讯协议 :0 = 无协议,1 = modbus }com_param_t; //模拟通道参数值 typedef struct { uint8_t sig_type;//信号类型 : 0 = 4~20ma信号, 1 = 1~5V信号 uint8_t line_sub;//所属线路 : 1 = 线路1, 2 = 线路2, 3 =线路3, 4 = 线路4, 0 = 装置 uint8_t att; //类别 : 0 = UA, 1 = UB, 2 = UC, 3 = UAB, 4 = UBC, 5 = UCA, 6 = P, 7 = Q, 8 = F uint8_t u_limit; //上限值 : uint8_t d_limit; //下限值 : }analog_ch_param_t; //线路定值->开出设置 typedef struct { // uint8_t index; //线路号: 1 = 线路1, 2 = 线路2, 3 = 线路3, 4 = 线路4 uint8_t limit; //限值: uint8_t delay; //延时: [1 ~ 10秒] uint8_t out_num; //输出节点: [1 = 开出1、 2 = 开出2、...] uint8_t select; //投退: [0 = 不投, 1 = 投入] }line_param_t; typedef struct { line_param_t type[7]; //7个类别:电压,电流,差流, 功率,频率,PT断线,CT断线 }line_type_t; //AI 报警-> 开出设置 typedef struct { uint8_t u_limit; //上限值 : uint8_t d_limit; //下限值 : uint8_t delay; //延时: [1 ~ 10秒] uint8_t out_num; //输出节点: [1 = 开出1、 2 = 开出2、...] uint8_t select; //投退: [0 = 不投, 1 = 投入] }ai_alarm_param_t; //大核数据 -> 小核 //设置模拟量,数字量输出 typedef struct { struct tm t; //时间设置 d_io_t a_io; //数字量,开入、开出 com_param_t com_param[4]; //串口参数设置 line_type_t line_param[4]; //线路定值设置: 4路定值一起下发 analog_ch_param_t a_in_param[12]; //12路AI模拟输入通道设置 analog_ch_param_t a_out_param[12]; //12路AO模拟输出通道设置 ai_alarm_param_t ai_alarm_param[12];//12路AI模拟输入报警参数设置 }gui_out_t; #endif