增加了状态机代码
This commit is contained in:
@@ -33,6 +33,24 @@ PowerManger::PowerManger()
|
||||
soc = 0;
|
||||
sustainableTime = 0;
|
||||
faultCode.push_back(0);
|
||||
|
||||
|
||||
|
||||
//注册状态机
|
||||
m_fsm.RegisterState("PM_STATE", 1, m_state1);
|
||||
m_fsm.RegisterState("PM_STATE2", 2, m_state2);
|
||||
m_fsm.RegisterState("PM_STATE3", 3, m_state3);
|
||||
|
||||
m_fsm.RegisterHandleFunction(&m_state1,handleState1);
|
||||
m_fsm.RegisterHandleFunction(&m_state2,handleState2);
|
||||
m_fsm.RegisterHandleFunction(&m_state3,handleState3);
|
||||
|
||||
// 注册状态机转换条件
|
||||
// m_fsm.RegisterEvent()
|
||||
|
||||
// 初始化状态机
|
||||
m_pmState = m_state1;
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
@@ -89,6 +107,7 @@ bool PowerManger::OnConnectToServer()
|
||||
|
||||
bool PowerManger::Iterate()
|
||||
{
|
||||
m_fsm.run(m_pmState,this);
|
||||
AppCastingMOOSApp::Iterate();
|
||||
// 更新当前状态
|
||||
updatePmState();
|
||||
@@ -352,10 +371,10 @@ bool PowerManger::buildPowerSysReport()
|
||||
fcs[VAR_TO_STR(fcuFaultLeve)+suffix] = m_pmCurrentState.ccustate.fcuFaultLeve;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerLimit).name());
|
||||
fcs[VAR_TO_STR(powerLimit)+suffix] = m_pmCurrentState.ccustate.powerLimit;
|
||||
fcs[VAR_TO_STR(powLimit)+suffix] = m_pmCurrentState.ccustate.powerLimit;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.totalPowerGeneration).name());
|
||||
fcs[VAR_TO_STR(totalPowerGeneration)+suffix] = m_pmCurrentState.ccustate.totalPowerGeneration;
|
||||
fcs[VAR_TO_STR(powerGen)+suffix] = m_pmCurrentState.ccustate.totalPowerGeneration;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.ch4o).name());
|
||||
fcs[VAR_TO_STR(ch4o)+suffix] = m_pmCurrentState.ccustate.ch4o;
|
||||
@@ -364,16 +383,16 @@ bool PowerManger::buildPowerSysReport()
|
||||
fcs[VAR_TO_STR(o2)+suffix] = m_pmCurrentState.ccustate.o2;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.fcuVoltage).name());
|
||||
fcs[VAR_TO_STR(fcuVoltage)+suffix] = m_pmCurrentState.ccustate.fcuVoltage;
|
||||
fcs[VAR_TO_STR(fcuVol)+suffix] = m_pmCurrentState.ccustate.fcuVoltage;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.fcuCurrent).name());
|
||||
fcs[VAR_TO_STR(fcuCurrent)+suffix] = m_pmCurrentState.ccustate.fcuCurrent;
|
||||
fcs[VAR_TO_STR(fcuCur)+suffix] = m_pmCurrentState.ccustate.fcuCurrent;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.o2Level).name());
|
||||
fcs[VAR_TO_STR(o2Level)+suffix] = m_pmCurrentState.ccustate.o2Level;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.exchangerTemperature).name());
|
||||
fcs[VAR_TO_STR(exchangerTemperature)+suffix] = m_pmCurrentState.ccustate.exchangerTemperature;
|
||||
fcs[VAR_TO_STR(excTemp)+suffix] = m_pmCurrentState.ccustate.exchangerTemperature;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.fcuOutPower).name());
|
||||
fcs[VAR_TO_STR(fcuOutPower)+suffix] = m_pmCurrentState.ccustate.fcuOutPower;
|
||||
@@ -382,34 +401,34 @@ bool PowerManger::buildPowerSysReport()
|
||||
fcs[VAR_TO_STR(fcuOutIns)+suffix] = m_pmCurrentState.ccustate.fcuOutIns;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.fcuVoltageIns).name());
|
||||
fcs[VAR_TO_STR(fcuVoltageIns)+suffix] = m_pmCurrentState.ccustate.fcuVoltageIns;
|
||||
fcs[VAR_TO_STR(fcuVolIns)+suffix] = m_pmCurrentState.ccustate.fcuVoltageIns;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.fcuVoltagePower).name());
|
||||
fcs[VAR_TO_STR(fcuVoltagePower)+suffix] = m_pmCurrentState.ccustate.fcuVoltagePower;
|
||||
fcs[VAR_TO_STR(fcuVolPower)+suffix] = m_pmCurrentState.ccustate.fcuVoltagePower;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.fcuCurrentIns).name());
|
||||
fcs[VAR_TO_STR(fcuCurrentIns)+suffix] = m_pmCurrentState.ccustate.fcuCurrentIns;
|
||||
fcs[VAR_TO_STR(fcuCurIns)+suffix] = m_pmCurrentState.ccustate.fcuCurrentIns;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.fcuCurrentPower).name());
|
||||
fcs[VAR_TO_STR(fcuCurrentPower)+suffix] = m_pmCurrentState.ccustate.fcuCurrentPower;
|
||||
fcs[VAR_TO_STR(fcuCurPower)+suffix] = m_pmCurrentState.ccustate.fcuCurrentPower;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.h2Concentration1).name());
|
||||
fcs[VAR_TO_STR(h2Concentration1)+suffix] = m_pmCurrentState.ccustate.h2Concentration1;
|
||||
fcs[VAR_TO_STR(h2Concent1)+suffix] = m_pmCurrentState.ccustate.h2Concentration1;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.h2Concentration2).name());
|
||||
fcs[VAR_TO_STR(h2Concentration2)+suffix] = m_pmCurrentState.ccustate.h2Concentration2;
|
||||
fcs[VAR_TO_STR(h2Concent2)+suffix] = m_pmCurrentState.ccustate.h2Concentration2;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.o2Concentration1).name());
|
||||
fcs[VAR_TO_STR(o2Concentration1)+suffix] = m_pmCurrentState.ccustate.o2Concentration1;
|
||||
fcs[VAR_TO_STR(o2Concent1)+suffix] = m_pmCurrentState.ccustate.o2Concentration1;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.o2Concentration2).name());
|
||||
fcs[VAR_TO_STR(o2Concentration2)+suffix] = m_pmCurrentState.ccustate.o2Concentration2;
|
||||
fcs[VAR_TO_STR(o2Concent2)+suffix] = m_pmCurrentState.ccustate.o2Concentration2;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.ch4oConcentration1).name());
|
||||
fcs[VAR_TO_STR(ch4oConcentration1)+suffix] = m_pmCurrentState.ccustate.ch4oConcentration1;
|
||||
fcs[VAR_TO_STR(ch4oConcent1)+suffix] = m_pmCurrentState.ccustate.ch4oConcentration1;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.ch4oConcentration2).name());
|
||||
fcs[VAR_TO_STR(ch4oConcentration2)+suffix] = m_pmCurrentState.ccustate.ch4oConcentration2;
|
||||
fcs[VAR_TO_STR(ch4oConcent2)+suffix] = m_pmCurrentState.ccustate.ch4oConcentration2;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.backpressure1).name());
|
||||
fcs[VAR_TO_STR(backpressure1)+suffix] = m_pmCurrentState.ccustate.backpressure1;
|
||||
@@ -418,6 +437,27 @@ bool PowerManger::buildPowerSysReport()
|
||||
fcs[VAR_TO_STR(backpressure2)+suffix] = m_pmCurrentState.ccustate.backpressure2;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.flameDetection).name());
|
||||
fcs[VAR_TO_STR(flameDet)+suffix] = m_pmCurrentState.ccustate.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 short faultCode1;
|
||||
unsigned short faultCode2;
|
||||
unsigned short faultCode3;
|
||||
faultCode1 = (m_pmCurrentState.ccustate.fcuGZ_1H << 8) | m_pmCurrentState.ccustate.fcuGZ_1L;
|
||||
faultCode2 = (m_pmCurrentState.ccustate.fcuGZ_2H << 8) | m_pmCurrentState.ccustate.fcuGZ_2L;
|
||||
faultCode3 = (m_pmCurrentState.ccustate.fcuGZ_3H << 8) | m_pmCurrentState.ccustate.fcuGZ_3L;
|
||||
|
||||
suffix = getTypeName(typeid(faultCode1).name());
|
||||
fcs[VAR_TO_STR(faultCode1)+suffix] = faultCode1;
|
||||
suffix = getTypeName(typeid(faultCode2).name());
|
||||
fcs[VAR_TO_STR(faultCode2)+suffix] = faultCode2;
|
||||
suffix = getTypeName(typeid(faultCode3).name());
|
||||
fcs[VAR_TO_STR(faultCode3)+suffix] = faultCode3;
|
||||
|
||||
//4.构建动力锂电池状态报告
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insPosRelayState).name());
|
||||
@@ -427,10 +467,10 @@ bool PowerManger::buildPowerSysReport()
|
||||
lbs[VAR_TO_STR(insNegRelayState)+suffix] = m_pmCurrentState.ccustate.insNegRelayState;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerPosRelayState).name());
|
||||
lbs[VAR_TO_STR(powerPosRelayState)+suffix] = m_pmCurrentState.ccustate.powerPosRelayState;
|
||||
lbs[VAR_TO_STR(powPosRelayState)+suffix] = m_pmCurrentState.ccustate.powerPosRelayState;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerNegRelayState).name());
|
||||
lbs[VAR_TO_STR(powerNegRelayState)+suffix] = m_pmCurrentState.ccustate.powerNegRelayState;
|
||||
lbs[VAR_TO_STR(powNegRelayState)+suffix] = m_pmCurrentState.ccustate.powerNegRelayState;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insBatLimit).name());
|
||||
lbs[VAR_TO_STR(insBatLimit)+suffix] = m_pmCurrentState.ccustate.insBatLimit;
|
||||
@@ -442,86 +482,91 @@ bool PowerManger::buildPowerSysReport()
|
||||
lbs[VAR_TO_STR(insBatSoc)+suffix] = m_pmCurrentState.ccustate.insBatSoc;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerBatSoc).name());
|
||||
lbs[VAR_TO_STR(powerBatSoc)+suffix] = m_pmCurrentState.ccustate.powerBatSoc;
|
||||
lbs[VAR_TO_STR(powBatSoc)+suffix] = m_pmCurrentState.ccustate.powerBatSoc;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insBatTotalElectricity).name());
|
||||
lbs[VAR_TO_STR(insBatTotalElectricity)+suffix] = m_pmCurrentState.ccustate.insBatTotalElectricity;
|
||||
lbs[VAR_TO_STR(insBatTotalElect)+suffix] = m_pmCurrentState.ccustate.insBatTotalElectricity;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerBatTotalElectricity).name());
|
||||
lbs[VAR_TO_STR(powerBatTotalElectricity)+suffix] = m_pmCurrentState.ccustate.powerBatTotalElectricity;
|
||||
lbs[VAR_TO_STR(powBatTotalElect)+suffix] = m_pmCurrentState.ccustate.powerBatTotalElectricity;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insBatCurrentElectricity).name());
|
||||
lbs[VAR_TO_STR(insBatCurrentElectricity)+suffix] = m_pmCurrentState.ccustate.insBatCurrentElectricity;
|
||||
lbs[VAR_TO_STR(insBatCurElect)+suffix] = m_pmCurrentState.ccustate.insBatCurrentElectricity;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerBatCurrentElectricity).name());
|
||||
lbs[VAR_TO_STR(powerBatCurrentElectricity)+suffix] = m_pmCurrentState.ccustate.powerBatCurrentElectricity;
|
||||
lbs[VAR_TO_STR(powBatCurElect)+suffix] = m_pmCurrentState.ccustate.powerBatCurrentElectricity;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insChargeState).name());
|
||||
lbs[VAR_TO_STR(insChargeState)+suffix] = m_pmCurrentState.ccustate.insChargeState;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerChargeState).name());
|
||||
lbs[VAR_TO_STR(powerChargeState)+suffix] = m_pmCurrentState.ccustate.powerChargeState;
|
||||
lbs[VAR_TO_STR(powChargeState)+suffix] = m_pmCurrentState.ccustate.powerChargeState;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insLinkVoltage).name());
|
||||
lbs[VAR_TO_STR(insLinkVoltage)+suffix] = m_pmCurrentState.ccustate.insLinkVoltage;
|
||||
lbs[VAR_TO_STR(insLinkVol)+suffix] = m_pmCurrentState.ccustate.insLinkVoltage;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insPackVoltage).name());
|
||||
lbs[VAR_TO_STR(insPackVoltage)+suffix] = m_pmCurrentState.ccustate.insPackVoltage;
|
||||
lbs[VAR_TO_STR(insPackVol)+suffix] = m_pmCurrentState.ccustate.insPackVoltage;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insCurrent).name());
|
||||
lbs[VAR_TO_STR(insCurrent)+suffix] = m_pmCurrentState.ccustate.insCurrent;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insPosInsulationResistance).name());
|
||||
lbs[VAR_TO_STR(insPosInsulationResistance)+suffix] = m_pmCurrentState.ccustate.insPosInsulationResistance;
|
||||
lbs[VAR_TO_STR(insPosRes)+suffix] = m_pmCurrentState.ccustate.insPosInsulationResistance;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insNegInsulationResistance).name());
|
||||
lbs[VAR_TO_STR(insNegInsulationResistance)+suffix] = m_pmCurrentState.ccustate.insNegInsulationResistance;
|
||||
lbs[VAR_TO_STR(insNegRes)+suffix] = m_pmCurrentState.ccustate.insNegInsulationResistance;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerLinkVoltage).name());
|
||||
lbs[VAR_TO_STR(powerLinkVoltage)+suffix] = m_pmCurrentState.ccustate.powerLinkVoltage;
|
||||
lbs[VAR_TO_STR(powLinkVol)+suffix] = m_pmCurrentState.ccustate.powerLinkVoltage;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerPackVoltage).name());
|
||||
lbs[VAR_TO_STR(powerPackVoltage)+suffix] = m_pmCurrentState.ccustate.powerPackVoltage;
|
||||
lbs[VAR_TO_STR(powerPackVol)+suffix] = m_pmCurrentState.ccustate.powerPackVoltage;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerCurrent).name());
|
||||
lbs[VAR_TO_STR(powerCurrent)+suffix] = m_pmCurrentState.ccustate.powerCurrent;
|
||||
lbs[VAR_TO_STR(powCur)+suffix] = m_pmCurrentState.ccustate.powerCurrent;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerPosInsulationResistance).name());
|
||||
lbs[VAR_TO_STR(powerPosInsulationResistance)+suffix] = m_pmCurrentState.ccustate.powerPosInsulationResistance;
|
||||
lbs[VAR_TO_STR(powPosRes)+suffix] = m_pmCurrentState.ccustate.powerPosInsulationResistance;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerNegInsulationResistance).name());
|
||||
lbs[VAR_TO_STR(powerNegInsulationResistance)+suffix] = m_pmCurrentState.ccustate.powerNegInsulationResistance;
|
||||
lbs[VAR_TO_STR(powNegRes)+suffix] = m_pmCurrentState.ccustate.powerNegInsulationResistance;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insCurrentSocHold1).name());
|
||||
lbs[VAR_TO_STR(insCurrentSocHold1)+suffix] = m_pmCurrentState.ccustate.insCurrentSocHold1;
|
||||
lbs[VAR_TO_STR(insCurSocHold1)+suffix] = m_pmCurrentState.ccustate.insCurrentSocHold1;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insCurrentSocHold2).name());
|
||||
lbs[VAR_TO_STR(insCurrentSocHold2)+suffix] = m_pmCurrentState.ccustate.insCurrentSocHold2;
|
||||
lbs[VAR_TO_STR(insCurSocHold2)+suffix] = m_pmCurrentState.ccustate.insCurrentSocHold2;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insCurrentSocHold3).name());
|
||||
lbs[VAR_TO_STR(insCurrentSocHold3)+suffix] = m_pmCurrentState.ccustate.insCurrentSocHold3;
|
||||
lbs[VAR_TO_STR(insCurSocHold3)+suffix] = m_pmCurrentState.ccustate.insCurrentSocHold3;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.fcuCurrentToInsLimit1).name());
|
||||
lbs[VAR_TO_STR(fcuCurrentToInsLimit1)+suffix] = m_pmCurrentState.ccustate.fcuCurrentToInsLimit1;
|
||||
lbs[VAR_TO_STR(fcuCurToInsLimit1)+suffix] = m_pmCurrentState.ccustate.fcuCurrentToInsLimit1;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.fcuCurrentToinsLimit2).name());
|
||||
lbs[VAR_TO_STR(fcuCurrentToinsLimit2)+suffix] = m_pmCurrentState.ccustate.fcuCurrentToinsLimit2;
|
||||
lbs[VAR_TO_STR(fcuCurToinsLimit2)+suffix] = m_pmCurrentState.ccustate.fcuCurrentToinsLimit2;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerCurrentSocHold1).name());
|
||||
lbs[VAR_TO_STR(powerCurrentSocHold1)+suffix] = m_pmCurrentState.ccustate.powerCurrentSocHold1;
|
||||
lbs[VAR_TO_STR(powCurSocHold1)+suffix] = m_pmCurrentState.ccustate.powerCurrentSocHold1;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerCurrentSocHold2).name());
|
||||
lbs[VAR_TO_STR(powerCurrentSocHold2)+suffix] = m_pmCurrentState.ccustate.powerCurrentSocHold2;
|
||||
lbs[VAR_TO_STR(powCurSocHold2)+suffix] = m_pmCurrentState.ccustate.powerCurrentSocHold2;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerCurrentSocHold3).name());
|
||||
lbs[VAR_TO_STR(powerCurrentSocHold3)+suffix] = m_pmCurrentState.ccustate.powerCurrentSocHold3;
|
||||
lbs[VAR_TO_STR(powCurSocHold3)+suffix] = m_pmCurrentState.ccustate.powerCurrentSocHold3;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerCurrentToInsLimit1).name());
|
||||
lbs[VAR_TO_STR(powerCurrentToInsLimit1)+suffix] = m_pmCurrentState.ccustate.powerCurrentToInsLimit1;
|
||||
lbs[VAR_TO_STR(powCurToInsLimit1)+suffix] = m_pmCurrentState.ccustate.powerCurrentToInsLimit1;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerCurrentToinsLimit2).name());
|
||||
lbs[VAR_TO_STR(powerCurrentToinsLimit2)+suffix] = m_pmCurrentState.ccustate.powerCurrentToinsLimit2;
|
||||
|
||||
lbs[VAR_TO_STR(powCurToinsLimit2)+suffix] = m_pmCurrentState.ccustate.powerCurrentToinsLimit2;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.insAlarmIdentificationWord).name());
|
||||
lbs[VAR_TO_STR(insfaultCode)+suffix] = m_pmCurrentState.ccustate.insAlarmIdentificationWord;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.ccustate.powerAlarmIdentificationWord).name());
|
||||
lbs[VAR_TO_STR(powfaultCode)+suffix] = m_pmCurrentState.ccustate.powerAlarmIdentificationWord;
|
||||
|
||||
//5.构建配电系统状态报告
|
||||
|
||||
disBus1Breaker* pdis1=new disBus1Breaker;
|
||||
@@ -569,10 +614,10 @@ bool PowerManger::buildPowerSysReport()
|
||||
(m_pmCurrentState.bus4State.emergencyLithiumBatteryGroup1CircuitBreaker == BREAK_ON)? pdis4 -> emergencyLithiumBatteryGroup1CircuitBreaker = 1 : pdis4 -> emergencyLithiumBatteryGroup1CircuitBreaker = 0;
|
||||
pdis4 -> paceholder = 0;
|
||||
|
||||
dis["HightVoltageBusBreaker_uint16"] = *(unsigned short*) pdis1;
|
||||
dis["HightVoltageABusBreaker_unit16"] = *(unsigned short*) pdis2;
|
||||
dis["HightVoltageBBusBreaker_unit16"] = *(unsigned short*) pdis3;
|
||||
dis["LowVoltageBusBreaker_uint16"] = *(unsigned short*) pdis3;
|
||||
dis["HVolBusBreaker_uint16"] = *(unsigned short*) pdis1;
|
||||
dis["HVolABusBreaker_unit16"] = *(unsigned short*) pdis2;
|
||||
dis["HVolBBusBreaker_unit16"] = *(unsigned short*) pdis3;
|
||||
dis["LVolBusBreaker_uint16"] = *(unsigned short*) pdis3;
|
||||
|
||||
delete pdis1;
|
||||
delete pdis2;
|
||||
@@ -590,98 +635,98 @@ bool PowerManger::buildPowerSysReport()
|
||||
|
||||
Json::Value currentBusState;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.powerBusVoltage).name());
|
||||
currentBusState[VAR_TO_STR(HVBpowerBusVoltage)+suffix] = m_pmCurrentState.bus1State.powerBusVoltage;
|
||||
currentBusState[VAR_TO_STR(HVBpowerBusVol)+suffix] = m_pmCurrentState.bus1State.powerBusVoltage;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.dcDc5ModuleCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBdcDc5ModuleCurrent)+suffix] = m_pmCurrentState.bus1State.dcDc5ModuleCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBdcDc5Cur)+suffix] = m_pmCurrentState.bus1State.dcDc5ModuleCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.powerBusCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBpowerBusCurrent)+suffix] = m_pmCurrentState.bus1State.powerBusCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBpowerBusCur)+suffix] = m_pmCurrentState.bus1State.powerBusCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.busbarAVoltage).name());
|
||||
currentBusState[VAR_TO_STR(HVBbusbarAVoltage)+suffix] = m_pmCurrentState.bus1State.busbarAVoltage;
|
||||
currentBusState[VAR_TO_STR(HVBbusAVol)+suffix] = m_pmCurrentState.bus1State.busbarAVoltage;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.propulsionMotorControlBoxCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBpropulsionMotorControlBoxCurrent)+suffix] = m_pmCurrentState.bus1State.propulsionMotorControlBoxCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBmotorCur)+suffix] = m_pmCurrentState.bus1State.propulsionMotorControlBoxCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.busbarACurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBbusbarACurrent)+suffix] = m_pmCurrentState.bus1State.busbarACurrent;
|
||||
currentBusState[VAR_TO_STR(HVBbusACur)+suffix] = m_pmCurrentState.bus1State.busbarACurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.lithiumBatteryGroupMeterCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBlithiumBatteryGroupMeterCurrent)+suffix] = m_pmCurrentState.bus1State.lithiumBatteryGroupMeterCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBbatGroupCur)+suffix] = m_pmCurrentState.bus1State.lithiumBatteryGroupMeterCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.bowHighVoltageDistributionBoxCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBbowHighVoltageDistributionBoxCurrent)+suffix] = m_pmCurrentState.bus1State.bowHighVoltageDistributionBoxCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBbowHVolDisBoxCur)+suffix] = m_pmCurrentState.bus1State.bowHighVoltageDistributionBoxCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.sternFTDevice45Current).name());
|
||||
currentBusState[VAR_TO_STR(HVBsternFTDevice45Current)+suffix] = m_pmCurrentState.bus1State.sternFTDevice45Current;
|
||||
currentBusState[VAR_TO_STR(HVBFTDev45Cur)+suffix] = m_pmCurrentState.bus1State.sternFTDevice45Current;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.tyzReservedSwitchCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBtyzReservedSwitchCurrent)+suffix] = m_pmCurrentState.bus1State.tyzReservedSwitchCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBtyzCur)+suffix] = m_pmCurrentState.bus1State.tyzReservedSwitchCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.sternRudderSwitch1Current).name());
|
||||
currentBusState[VAR_TO_STR(HVBsternRudderSwitch1Current)+suffix] = m_pmCurrentState.bus1State.sternRudderSwitch1Current;
|
||||
currentBusState[VAR_TO_STR(HVBsternRud1Cur)+suffix] = m_pmCurrentState.bus1State.sternRudderSwitch1Current;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.reservedCurrent1).name());
|
||||
currentBusState[VAR_TO_STR(HVBreservedCurrent1)+suffix] = m_pmCurrentState.bus1State.reservedCurrent1;
|
||||
currentBusState[VAR_TO_STR(HVBreservedCur1)+suffix] = m_pmCurrentState.bus1State.reservedCurrent1;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.sternRudderSwitch2Current).name());
|
||||
currentBusState[VAR_TO_STR(HVBsternRudderSwitch2Current)+suffix] = m_pmCurrentState.bus1State.sternRudderSwitch2Current;
|
||||
currentBusState[VAR_TO_STR(HVBsternRud2Cur)+suffix] = m_pmCurrentState.bus1State.sternRudderSwitch2Current;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.reservedCurrent2).name());
|
||||
currentBusState[VAR_TO_STR(HVBreservedCurrent2)+suffix] = m_pmCurrentState.bus1State.reservedCurrent2;
|
||||
currentBusState[VAR_TO_STR(HVBreservedCur2)+suffix] = m_pmCurrentState.bus1State.reservedCurrent2;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.fbReservedSwitchCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBfbReservedSwitchCurrent)+suffix] = m_pmCurrentState.bus1State.fbReservedSwitchCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBfbCur)+suffix] = m_pmCurrentState.bus1State.fbReservedSwitchCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus1State.reservedCurrent3).name());
|
||||
currentBusState[VAR_TO_STR(HVBreservedCurrent3)+suffix] = m_pmCurrentState.bus1State.reservedCurrent3;
|
||||
currentBusState[VAR_TO_STR(HVBreservedCur3)+suffix] = m_pmCurrentState.bus1State.reservedCurrent3;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus2State.busbarBVoltage).name());
|
||||
currentBusState[VAR_TO_STR(HVABbusbarBVoltage)+suffix] = m_pmCurrentState.bus2State.busbarBVoltage;
|
||||
currentBusState[VAR_TO_STR(HVABbusBVol)+suffix] = m_pmCurrentState.bus2State.busbarBVoltage;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus2State.busbarBCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVABbusbarBCurrent)+suffix] = m_pmCurrentState.bus2State.busbarBCurrent;
|
||||
currentBusState[VAR_TO_STR(HVABbusBCur)+suffix] = m_pmCurrentState.bus2State.busbarBCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus2State.bowFTDevice123Current).name());
|
||||
currentBusState[VAR_TO_STR(HVABbowFTDevice123Current)+suffix] = m_pmCurrentState.bus2State.bowFTDevice123Current;
|
||||
currentBusState[VAR_TO_STR(HVABFTDev123Cur)+suffix] = m_pmCurrentState.bus2State.bowFTDevice123Current;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus2State.actuatorCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVABactuatorCurrent)+suffix] = m_pmCurrentState.bus2State.actuatorCurrent;
|
||||
currentBusState[VAR_TO_STR(HVABactCur)+suffix] = m_pmCurrentState.bus2State.actuatorCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus2State.mastSteeringGearControlBoxCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVABmastSteeringGearControlBoxCurrent)+suffix] = m_pmCurrentState.bus2State.mastSteeringGearControlBoxCurrent;
|
||||
currentBusState[VAR_TO_STR(HVABmastSteGeaCur)+suffix] = m_pmCurrentState.bus2State.mastSteeringGearControlBoxCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus2State.xczCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVABxczCurrent)+suffix] = m_pmCurrentState.bus2State.xczCurrent;
|
||||
currentBusState[VAR_TO_STR(HVABxczCur)+suffix] = m_pmCurrentState.bus2State.xczCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus2State.bowRudderControlBoxCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVABbowRudderControlBoxCurrent)+suffix] = m_pmCurrentState.bus2State.bowRudderControlBoxCurrent;
|
||||
currentBusState[VAR_TO_STR(HVABbowRudCur)+suffix] = m_pmCurrentState.bus2State.bowRudderControlBoxCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus2State.openWaterCoverStartCylinderCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVABopenWaterCoverStartCylinderCurrent)+suffix] = m_pmCurrentState.bus2State.openWaterCoverStartCylinderCurrent;
|
||||
currentBusState[VAR_TO_STR(HVABopenWaterCur)+suffix] = m_pmCurrentState.bus2State.openWaterCoverStartCylinderCurrent;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.instrumentBusbarVoltage).name());
|
||||
currentBusState[VAR_TO_STR(HVBBinstrumentBusbarVoltage)+suffix] = m_pmCurrentState.bus3State.instrumentBusbarVoltage;
|
||||
currentBusState[VAR_TO_STR(HVBBinsBusVol)+suffix] = m_pmCurrentState.bus3State.instrumentBusbarVoltage;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.bowLowVoltageDistributionBoxCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBBbowLowVoltageDistributionBoxCurrent)+suffix] = m_pmCurrentState.bus3State.bowLowVoltageDistributionBoxCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBBbowLowVolDisBoxCur)+suffix] = m_pmCurrentState.bus3State.bowLowVoltageDistributionBoxCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.dcC1InstrumentDC48VCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBBdcC1InstrumentDC48VCurrent)+suffix] = m_pmCurrentState.bus3State.dcC1InstrumentDC48VCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBBdcC1InsCur)+suffix] = m_pmCurrentState.bus3State.dcC1InstrumentDC48VCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.reservedCurrent1).name());
|
||||
currentBusState[VAR_TO_STR(HVBBreservedCurrent1)+suffix] = m_pmCurrentState.bus3State.reservedCurrent1;
|
||||
currentBusState[VAR_TO_STR(HVBBreservedCur1)+suffix] = m_pmCurrentState.bus3State.reservedCurrent1;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.emergencyLithiumBatteryGroup2Current).name());
|
||||
currentBusState[VAR_TO_STR(HVBBemergencyLithiumBatteryGroup2Current)+suffix] = m_pmCurrentState.bus3State.emergencyLithiumBatteryGroup2Current;
|
||||
currentBusState[VAR_TO_STR(HVBBemerBatCur)+suffix] = m_pmCurrentState.bus3State.emergencyLithiumBatteryGroup2Current;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.lithiumBatteryGroupInstrumentCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBBlithiumBatteryGroupInstrumentCurrent)+suffix] = m_pmCurrentState.bus3State.lithiumBatteryGroupInstrumentCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBBbatInsCur)+suffix] = m_pmCurrentState.bus3State.lithiumBatteryGroupInstrumentCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.unit4InstrumentDC48VCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBBunit4InstrumentDC48VCurrent)+suffix] = m_pmCurrentState.bus3State.unit4InstrumentDC48VCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBBunit4Cur)+suffix] = m_pmCurrentState.bus3State.unit4InstrumentDC48VCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.reservedCurrent2).name());
|
||||
currentBusState[VAR_TO_STR(HVBBreservedCurrent2)+suffix] = m_pmCurrentState.bus3State.reservedCurrent2;
|
||||
currentBusState[VAR_TO_STR(HVBBreservedCur2)+suffix] = m_pmCurrentState.bus3State.reservedCurrent2;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.emergency2BusbarVoltage).name());
|
||||
currentBusState[VAR_TO_STR(HVBBemergency2BusbarVoltage)+suffix] = m_pmCurrentState.bus3State.emergency2BusbarVoltage;
|
||||
currentBusState[VAR_TO_STR(HVBBemer2BusVol)+suffix] = m_pmCurrentState.bus3State.emergency2BusbarVoltage;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.compositeEnergyManagementSystemEmergencyDC48VCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBBcompositeEnergyManagementSystemEmergencyDC48VCurrent)+suffix] = m_pmCurrentState.bus3State.compositeEnergyManagementSystemEmergencyDC48VCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBBCCUCur)+suffix] = m_pmCurrentState.bus3State.compositeEnergyManagementSystemEmergencyDC48VCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.fuelCellSecuritySystemEmergencyDC48VCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBBfuelCellSecuritySystemEmergencyDC48VCurrent)+suffix] = m_pmCurrentState.bus3State.fuelCellSecuritySystemEmergencyDC48VCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBBFCSSecurSysCur)+suffix] = m_pmCurrentState.bus3State.fuelCellSecuritySystemEmergencyDC48VCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus3State.plcControlPowerCurrent).name());
|
||||
currentBusState[VAR_TO_STR(HVBBplcControlPowerCurrent)+suffix] = m_pmCurrentState.bus3State.plcControlPowerCurrent;
|
||||
currentBusState[VAR_TO_STR(HVBBplcCur)+suffix] = m_pmCurrentState.bus3State.plcControlPowerCurrent;
|
||||
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus4State.instrumentBusbarVoltage).name());
|
||||
currentBusState[VAR_TO_STR(LVBinstrumentBusbarVoltage)+suffix] = m_pmCurrentState.bus4State.instrumentBusbarVoltage;
|
||||
currentBusState[VAR_TO_STR(LVBinsBusVol)+suffix] = m_pmCurrentState.bus4State.instrumentBusbarVoltage;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus4State.instrumentBusbarCurrent).name());
|
||||
currentBusState[VAR_TO_STR(LVBBinstrumentBusbarCurrent)+suffix] = m_pmCurrentState.bus4State.instrumentBusbarCurrent;
|
||||
currentBusState[VAR_TO_STR(LVBBinsBusCur)+suffix] = m_pmCurrentState.bus4State.instrumentBusbarCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus4State.unit1Current).name());
|
||||
currentBusState[VAR_TO_STR(LVBBunit1Current)+suffix] = m_pmCurrentState.bus4State.unit1Current;
|
||||
currentBusState[VAR_TO_STR(LVBBunit1Cur)+suffix] = m_pmCurrentState.bus4State.unit1Current;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus4State.unit2Current).name());
|
||||
currentBusState[VAR_TO_STR(LVBBunit2Current)+suffix] = m_pmCurrentState.bus4State.unit2Current;
|
||||
currentBusState[VAR_TO_STR(LVBBunit2Cur)+suffix] = m_pmCurrentState.bus4State.unit2Current;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus4State.unit3Current).name());
|
||||
currentBusState[VAR_TO_STR(LVBBunit3Current)+suffix] = m_pmCurrentState.bus4State.unit3Current;
|
||||
currentBusState[VAR_TO_STR(LVBBunit3Cur)+suffix] = m_pmCurrentState.bus4State.unit3Current;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus4State.unit5Current).name());
|
||||
currentBusState[VAR_TO_STR(LVBBunit5Current)+suffix] = m_pmCurrentState.bus4State.unit5Current;
|
||||
currentBusState[VAR_TO_STR(LVBBunit5Cur)+suffix] = m_pmCurrentState.bus4State.unit5Current;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus4State.bowPZDeviceCurrent).name());
|
||||
currentBusState[VAR_TO_STR(LVBBbowPZDeviceCurrent)+suffix] = m_pmCurrentState.bus4State.bowPZDeviceCurrent;
|
||||
currentBusState[VAR_TO_STR(LVBBbowPZDevCur)+suffix] = m_pmCurrentState.bus4State.bowPZDeviceCurrent;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus4State.emergencyLithiumBatteryGroup1Current).name());
|
||||
currentBusState[VAR_TO_STR(LVBBemergencyLithiumBatteryGroup1Current)+suffix] = m_pmCurrentState.bus4State.emergencyLithiumBatteryGroup1Current;
|
||||
currentBusState[VAR_TO_STR(LVBBemerBatCur)+suffix] = m_pmCurrentState.bus4State.emergencyLithiumBatteryGroup1Current;
|
||||
suffix = getTypeName(typeid(m_pmCurrentState.bus4State.emergency1BusbarVoltage).name());
|
||||
currentBusState[VAR_TO_STR(LVBBemergency1BusbarVoltage)+suffix] = m_pmCurrentState.bus4State.emergency1BusbarVoltage;
|
||||
currentBusState[VAR_TO_STR(LVBBemerBusVol)+suffix] = m_pmCurrentState.bus4State.emergency1BusbarVoltage;
|
||||
|
||||
// dis["currentBusState"] = currentBusState;
|
||||
|
||||
@@ -733,4 +778,26 @@ bool PowerManger::saveStringToJsonFile(const string &strJson, const string &file
|
||||
std::cerr << "无法打开文件!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int PowerManger::handleState1(FSM_State &fsm,void* pData)
|
||||
{
|
||||
cout << fsm.name << endl;
|
||||
PowerManger* pm = (PowerManger*)pData;
|
||||
fsm = pm->m_fsm.getState("PM_STATE2");
|
||||
return 0;
|
||||
}
|
||||
int PowerManger::handleState2(FSM_State &fsm,void* pData)
|
||||
{
|
||||
cout << fsm.name << endl;
|
||||
PowerManger* pm = (PowerManger*)pData;
|
||||
fsm = pm->m_fsm.getState("PM_STATE3");
|
||||
return 0;
|
||||
}
|
||||
int PowerManger::handleState3(FSM_State &fsm,void* pData)
|
||||
{
|
||||
cout << fsm.name << endl;
|
||||
PowerManger* pm = (PowerManger*)pData;
|
||||
fsm = pm->m_fsm.getState("PM_STATE");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user