You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
1.8 KiB

3 months ago
#ifndef _EAU_H_
#define _EAU_H_
#include <stdint.h>
#include "./ccu.h"
#include "./config.h"
#pragma pack(2)
typedef union _EAU_STATUS__ {
uint16_t value;
struct {
//Bit0:设备电源状态
//(0:正常,1:故障)
uint16_t power_state :1;
//Bit1:通讯故障
//(0:正常,1:故障)
uint16_t err_connect :1;
//Bit2:设备自检故障
//(1:运行,0:待机)
uint16_t self_test :1;
//Bit3:A相 PT断线
//(1:故障,0:正常)
uint16_t a_pt_err :1;
//Bit4:B相 PT断线
//(1:故障,0:正常)
uint16_t b_pt_err :1;
//Bit5: C相 PT断线
//(1:报警,0:正常)
uint16_t c_pt_err :1;
//biti6-9: 备用
uint16_t bak0 :4;
//Bit10:DI_1状态
uint16_t di_1 :1;
//Bit11:DI_2状态
uint16_t di_2 :1;
//bit12-15: 备用
uint16_t bak1 :4;
}Bits;
}uEAUStatus;
typedef struct __EAU_AI__ {
//当前有功功率
int16_t active_power;
//当前无功功率
int16_t reactive_power;
//当前频率
uint16_t frequency;
//当前瞬时电压有效值
uint16_t transient_voltage;
//当前A相电压有效值
uint16_t effective_voltage_a;
//当前B相电压有效值
uint16_t effective_voltage_b;
//当前C相电压有效值
uint16_t effective_voltage_c;
//当前EAU状态
uEAUStatus status;
}sEAUAI;
typedef struct __EAU_AO__ {
uint64_t rtc_ms_conut;
}sEAUAO;
#pragma pack()
typedef struct __EAU__ {
sEAUConfig cfg;
uint16_t address ;
uint16_t status ;
int aiLength;
int aoLength;
sEAUAO sendToAo;
sEAUAO recvFromAo;
sEAUAI recvFromAi;
// EAU PCS编号数组(512位)
uint16_t pcs_id_table[32];
// EAU CCU编号数组(128位)
uint16_t ccu_id_table[8];
sCCU *ccu_head;
struct __EAU__ *next;
struct __EAU__ *prev;
}sEAU;
#endif