优化udp通信代码,增加配电系统通信解析,增加能源系统状态定义

This commit is contained in:
zjk
2024-11-20 18:38:45 +08:00
parent 4693ce2619
commit eb2877f03f
9 changed files with 1123 additions and 153 deletions
+201
View File
@@ -0,0 +1,201 @@
#ifndef PMSYSVARIABLE_H
#define PMSYSVARIABLE_H
#pragma pack (1)
typedef struct ccuState
{
unsigned char currentWorkCondition;
unsigned char fcuState;
unsigned char fcuFaultLeve;
float powerLimit;
float totalPowerGeneration;
float ch4o;
float o2;
float fcuVoltage;
float fcuCurrent;
float o2Level;
float placeholder1;
float exchangerTemperature;
float fcuOutPower;
float fcuOutIns;
float fcuVoltageIns;
float fcuVoltagePower;
float fcuCurrentIns;
float fcuCurrentPower;
float h2Concentration1;
float h2Concentration2;
float o2Concentration1;
float o2Concentration2;
float ch4oConcentration1;
float ch4oConcentration2;
float backpressure1;
float backpressure2;
unsigned char flameDetection;
unsigned char fcuGZ_1L;
unsigned char fcuGZ_1H;
unsigned char fcuGZ_2L;
unsigned char fcuGZ_2H;
unsigned char fcuGZ_3L;
unsigned char fcuGZ_3H;
unsigned char insPosRelayState;
unsigned char insNegRelayState;
unsigned char powerPosRelayState;
unsigned char powerNegRelayState;
unsigned short insBatLimit;
unsigned short powerBatLimit;
unsigned char insBatSoc;
unsigned char powerBatSoc;
unsigned short insBatTotalElectricity;
unsigned short powerBatTotalElectricity;
unsigned short insBatCurrentElectricity;
unsigned short powerBatCurrentElectricity;
unsigned char insChargeState;
unsigned char powerChargeState;
unsigned short insLinkVoltage;
unsigned short insPackVoltage;
unsigned short insCurrent;
unsigned short insPosInsulationResistance;
unsigned short insNegInsulationResistance;
unsigned short powerLinkVoltage;
unsigned short powerPackVoltage;
unsigned short powerCurrent;
unsigned short powerPosInsulationResistance;
unsigned short powerNegInsulationResistance;
unsigned char insEmergencyStatusWord;
unsigned char powerEmergencyStatusWord;
unsigned char insAlarmIdentificationWord;
unsigned char powerAlarmIdentificationWord;
unsigned char insCurrentSocHold1;
unsigned char insCurrentSocHold2;
unsigned char insCurrentSocHold3;
unsigned char fcuCurrentToInsLimit1;
unsigned char fcuCurrentToinsLimit2;
unsigned char powerCurrentSocHold1;
unsigned char powerCurrentSocHold2;
unsigned char powerCurrentSocHold3;
unsigned char powerCurrentToInsLimit1;
unsigned char powerCurrentToinsLimit2;
float placeholder2;
float placeholder3;
float placeholder4;
float placeholder5;
} ccuState;
typedef struct disHighVolBusState
{
unsigned char fuelCellCircuitBreaker;
unsigned char powerLithiumBatteryCircuitBreaker;
unsigned char propulsionMotorCircuitBreaker;
unsigned char lithiumBatteryGroupInstrumentCircuitBreaker;
unsigned char dcDc5ModuleCircuitBreaker;
unsigned char bowHighVoltageDistributionBoxCircuitBreaker;
unsigned char sternFTDevice45CircuitBreaker;
unsigned char sternRudderSwitch1CircuitBreaker;
unsigned char sternRudderSwitch2CircuitBreaker;
unsigned char fbReservedCircuitBreaker;
unsigned char tyzReservedCircuitBreaker;
unsigned char reservedCircuitBreaker;
unsigned char busInsulationLow;
unsigned char busAInsulationHigh;
unsigned char lostPower;
unsigned char lostEmerPower;
unsigned short powerBusVoltage;
unsigned short dcDc5ModuleCurrent;
unsigned short powerBusCurrent;
unsigned short busbarAVoltage;
unsigned short propulsionMotorControlBoxCurrent;
unsigned short busbarACurrent;
unsigned short lithiumBatteryGroupMeterCurrent;
unsigned short bowHighVoltageDistributionBoxCurrent;
unsigned short sternFTDevice45Current;
unsigned short tyzReservedSwitchCurrent;
unsigned short sternRudderSwitch1Current;
unsigned short reservedCurrent1; // 改为 reservedCurrent1 以避免重名
unsigned short sternRudderSwitch2Current;
unsigned short reservedCurrent2; // 改为 reservedCurrent2 以避免重名
unsigned short fbReservedSwitchCurrent;
unsigned short reservedCurrent3; // 改为 reservedCurrent3 以避免重名
}disHighVolBusState;
typedef struct disHighAVolBusState
{
unsigned char bowFTDevice123CircuitBreaker;
unsigned char actuatorCircuitBreaker;
unsigned char mastSteeringGearControlBoxCircuitBreaker;
unsigned char xczCircuitBreaker;
unsigned char bowRudderControlBoxCircuitBreaker;
unsigned char openWaterCoverStartCylinderCircuitBreaker;
unsigned char instrumentPowerFailureSignal;
unsigned char emergencyPowerFailureSignal;
unsigned char waterIngressionAlarm;
unsigned short busbarBVoltage;
unsigned short busbarBCurrent;
unsigned short bowFTDevice123Current;
unsigned short actuatorCurrent;
unsigned short mastSteeringGearControlBoxCurrent;
unsigned short xczCurrent;
unsigned short bowRudderControlBoxCurrent;
unsigned short openWaterCoverStartCylinderCurrent;
}disHighAVolBusState;
typedef struct disHighBVolBusState
{
unsigned char lithiumBatteryGroupInstrumentCircuitBreaker;
unsigned char bowLowVoltageDistributionBoxCircuitBreaker;
unsigned char unit4InstrumentDC48VCircuitBreaker;
unsigned char dcC1DCDistributionPanelCircuitBreaker;
unsigned char reservedCircuitBreaker1; // 为了区分,添加了数字后缀
unsigned char reservedCircuitBreaker2; // 为了区分,添加了数字后缀
unsigned char emergencyLithiumBatteryGroup2CircuitBreaker;
unsigned char instrumentPowerFailureSignal;
unsigned char emergencyPowerFailureSignal;
unsigned char instrumentBusbarInsulationLow;
unsigned short instrumentBusbarVoltage;
unsigned short bowLowVoltageDistributionBoxCurrent;
unsigned short dcC1InstrumentDC48VCurrent;
unsigned short reservedCurrent1; // 为了区分,添加了数字后缀
unsigned short emergencyLithiumBatteryGroup2Current;
unsigned short lithiumBatteryGroupInstrumentCurrent;
unsigned short unit4InstrumentDC48VCurrent;
unsigned short reservedCurrent2; // 为了区分,添加了数字后缀
unsigned short emergency2BusbarVoltage;
unsigned short compositeEnergyManagementSystemEmergencyDC48VCurrent;
unsigned short fuelCellSecuritySystemEmergencyDC48VCurrent;
unsigned short plcControlPowerCurrent;
}disHighBVolBusState;
typedef struct disLowBusState
{
unsigned char unit1CircuitBreaker;
unsigned char unit2CircuitBreaker;
unsigned char unit3CircuitBreaker;
unsigned char unit5CircuitBreaker;
unsigned char bowPZDeviceCircuitBreaker;
unsigned char reservedCircuitBreaker1; // 为了区分,添加了数字后缀
unsigned char reservedCircuitBreaker2; // 为了区分,添加了数字后缀
unsigned char emergencyLithiumBatteryGroup1CircuitBreaker;
unsigned char powerFailureSignal;
unsigned char waterIngressionAlarm;
unsigned short instrumentBusbarVoltage;
unsigned short instrumentBusbarCurrent;
unsigned short unit1Current;
unsigned short unit2Current;
unsigned short unit3Current;
unsigned short unit5Current;
unsigned short bowPZDeviceCurrent;
unsigned short emergencyLithiumBatteryGroup1Current;
unsigned short emergency1BusbarVoltage;
}disLowBusState;
#pragma pack (0)
typedef struct pmState
{
ccuState ccustate;
disHighVolBusState bus1State;
disHighAVolBusState bus2State;
disHighBVolBusState bus3State;
disLowBusState bus4State;
} PmState;
#endif