#ifndef COMMON_H #define COMMON_H #include #include "list.h" #define AC_SINGLE_S_MAX_CHN_NUM 10 //单个控制板最大数量 #define AC_SINGLE_S_MAX_ADDRESS_NUM 16 //控制板最大数量 enum { ALARM_TYPE_POWER=0, ALARM_TYPE_SENSOR, ALARM_TYPE_NETWORK, ALARM_TYPE_OPRATION, ALARM_TYPE_RUNNING, }; //消息队列头结构体定义 enum { Msg_Ch_Ctrl=1, //通道控制 Msg_All_Ctrl=2, //整体控制 Msg_Threshold_Set=3, //阈值设置 Msg_Threshold_Update=4, //阈值更新 }; #pragma pack(push, 1) // 强制1字节对齐 typedef struct { long MsgType; //消息方向1:Qt->PDU 2:pdu->Qt int CtrlType; //控制类型 int nValue[2]; // double fValue[10]; }MsgData; #pragma pack(pop) // 恢复默认对齐 //地址部分 typedef struct { int id; int up; char ip[48]; char mac[24]; char desc[64]; }port_info_t; //电源部分 typedef struct { float voltage ;//电压 float current ;//电流 float power ;//功率 float freq ;//频率 float consumption ;//耗电量 float factor ;//功率因素 unsigned short status ;//开关状态 unsigned short NF_status ;//零线状态 int OperAllowFlag; //操作允许标志 port_info_t port; // }PowerInfo; //电源部分报警信息 typedef struct { bool w_voltage_up ;//电压上限报警 bool w_voltage_down ;//电压下限报警 bool w_current ;//电流上限报警 bool w_power ;//功率 bool w_consumption ;//耗电量 bool w_phase_lossA; // 缺相报警 bool w_phase_lossB; // 缺相报警 bool w_phase_lossC; // 缺相报警 }PowerWarningInfo; //超限管理表 typedef struct { int product_vol_upper_enable ;//电压上限使能 float product_vol_upper_threshold ;//电压上限值 int product_vol_over_upper_threshold_ctrl ;//电压超限动作 int product_vol_over_upper_threshold_ctrl_para ;//电压超限关联参数 int product_vol_lower_enable ;//电压下限使能 float product_vol_lower_threshold ;//电压下限值 int product_vol_over_lower_threshold_ctrl ;//电压超限动作 int product_vol_over_lower_threshold_ctrl_para ;//电压超限动作 int product_cur_upper_enable ;//电流下限使能 float product_cur_upper_threshold ;//电流下限值 float product_cur_lower_threshold; // int product_cur_over_upper_threshold_ctrl ;//电流超限动作 int product_cur_over_upper_threshold_ctrl_para ;//电流超限动作 int product_pwr_upper_enable ;//功率上限使能 float product_pwr_upper_threshold ;//功率上限值 int product_pwr_over_upper_threshold_ctrl ;//功率超限动作 int product_pwr_over_upper_threshold_ctrl_para ;//功率超限动作 int product_pwrcon_upper_enable ;//耗电量上限使能 float product_pwrcon_upper_threshold ;//耗电量上限值 int product_pwrcon_over_upper_threshold_ctrl ;//耗电量超限动作 int product_pwrcon_over_upper_threshold_ctrl_para ;//耗电量超限动作 }GlobalOverManager; typedef struct { int firingSortno; //启动序号 int closeSortno; //关闭序号 }_PowerSXManage_t; //电源通道管理总表(输入) typedef struct { int product_id ;//产品ID //20240225 add char product_saddr ;//modbus地址记录 char product_saddr_name[32] ;//输入名称 char product_saddr_type ;//输入类型 GlobalOverManager global_over_manager ;//超限管理 PowerInfo _PowerInfo[3]; //存储最新的数据(兼容三项输入) PowerWarningInfo _PowerWarninginfo[3]; //存储报警数据(兼容三项输入) time_t product_log_time; //存储最新时间 int product_MissingPH[3]; //缺相报警 }GlobalPowerInManger; //电源控制板计数 typedef struct { char product_saddr ;//modbus地址记录 int product_number; //数量 int product_type; //类型 PowerInfo _PowerInfo[AC_SINGLE_S_MAX_CHN_NUM]; //存储最新的数据 PowerWarningInfo _PowerWarninginfo[AC_SINGLE_S_MAX_CHN_NUM] ;//存储报警数据 struct list_head list; //存储具有的通道指针 GlobalPowerInManger _globalPowerInManger; //总输入数据 int nLeft_phType; //左半边相类型 int nRight_phType; //右半边相类型 }GlobalPowerCtrlBoard; #endif // COMMON_H