应急联调完成

This commit is contained in:
zjk
2025-05-19 20:42:20 +08:00
parent baa2e395fa
commit fea319d3bf
35 changed files with 1188 additions and 558 deletions
+37 -109
View File
@@ -4,7 +4,7 @@
#include "string"
#include "json/json.h"
#include <bitset>
#include "../systemData.h"
class uPower_liBatStateMsg
{
private:
@@ -16,118 +16,46 @@ public:
std::string key = "uPower_liBatState_st";
std::string buildMsg(ccuState ccustate)
std::string buildMsg(SystemData data)
{
//TODO:根据最新协议修改
Json::Value lbs;
//构建动力锂电池状态报告
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insPosRelayState).name());
// lbs[VAR_TO_STR(insPosRelayState)+suffix] = m_pm->m_pmCurrentState.ccustate.insPosRelayState;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insNegRelayState).name());
// lbs[VAR_TO_STR(insNegRelayState)+suffix] = m_pm->m_pmCurrentState.ccustate.insNegRelayState;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerPosRelayState).name());
// lbs[VAR_TO_STR(powPosRelayState)+suffix] = m_pm->m_pmCurrentState.ccustate.powerPosRelayState;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerNegRelayState).name());
// lbs[VAR_TO_STR(powNegRelayState)+suffix] = m_pm->m_pmCurrentState.ccustate.powerNegRelayState;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insBatLimit).name());
// lbs[VAR_TO_STR(insBatLimit)+suffix] = m_pm->m_pmCurrentState.ccustate.insBatLimit;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerBatLimit).name());
// lbs[VAR_TO_STR(powerBatLimit)+suffix] = m_pm->m_pmCurrentState.ccustate.powerBatLimit;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insBatSoc).name());
// lbs[VAR_TO_STR(insBatSoc)+suffix] = m_pm->m_pmCurrentState.ccustate.insBatSoc;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerBatSoc).name());
// lbs[VAR_TO_STR(powBatSoc)+suffix] = m_pm->m_pmCurrentState.ccustate.powerBatSoc;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insBatTotalElectricity).name());
// lbs[VAR_TO_STR(insBatTotalElect)+suffix] = m_pm->m_pmCurrentState.ccustate.insBatTotalElectricity;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerBatTotalElectricity).name());
// lbs[VAR_TO_STR(powBatTotalElect)+suffix] = m_pm->m_pmCurrentState.ccustate.powerBatTotalElectricity;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insBatCurrentElectricity).name());
// lbs[VAR_TO_STR(insBatCurElect)+suffix] = m_pm->m_pmCurrentState.ccustate.insBatCurrentElectricity;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerBatCurrentElectricity).name());
// lbs[VAR_TO_STR(powBatCurElect)+suffix] = m_pm->m_pmCurrentState.ccustate.powerBatCurrentElectricity;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insChargeState).name());
// lbs[VAR_TO_STR(insChargeState)+suffix] = m_pm->m_pmCurrentState.ccustate.insChargeState;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerChargeState).name());
// lbs[VAR_TO_STR(powChargeState)+suffix] = m_pm->m_pmCurrentState.ccustate.powerChargeState;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insLinkVoltage).name());
// lbs[VAR_TO_STR(insLinkVol)+suffix] = m_pm->m_pmCurrentState.ccustate.insLinkVoltage;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insPackVoltage).name());
// lbs[VAR_TO_STR(insPackVol)+suffix] = m_pm->m_pmCurrentState.ccustate.insPackVoltage;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insCurrent).name());
// lbs[VAR_TO_STR(insCurrent)+suffix] = m_pm->m_pmCurrentState.ccustate.insCurrent;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insPosInsulationResistance).name());
// lbs[VAR_TO_STR(insPosRes)+suffix] = m_pm->m_pmCurrentState.ccustate.insPosInsulationResistance;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insNegInsulationResistance).name());
// lbs[VAR_TO_STR(insNegRes)+suffix] = m_pm->m_pmCurrentState.ccustate.insNegInsulationResistance;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerLinkVoltage).name());
// lbs[VAR_TO_STR(powLinkVol)+suffix] = m_pm->m_pmCurrentState.ccustate.powerLinkVoltage;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerPackVoltage).name());
// lbs[VAR_TO_STR(powerPackVol)+suffix] = m_pm->m_pmCurrentState.ccustate.powerPackVoltage;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerCurrent).name());
// lbs[VAR_TO_STR(powCur)+suffix] = m_pm->m_pmCurrentState.ccustate.powerCurrent;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerPosInsulationResistance).name());
// lbs[VAR_TO_STR(powPosRes)+suffix] = m_pm->m_pmCurrentState.ccustate.powerPosInsulationResistance;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerNegInsulationResistance).name());
// lbs[VAR_TO_STR(powNegRes)+suffix] = m_pm->m_pmCurrentState.ccustate.powerNegInsulationResistance;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insCurrentSocHold1).name());
// lbs[VAR_TO_STR(insCurSocHold1)+suffix] = m_pm->m_pmCurrentState.ccustate.insCurrentSocHold1;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insCurrentSocHold2).name());
// lbs[VAR_TO_STR(insCurSocHold2)+suffix] = m_pm->m_pmCurrentState.ccustate.insCurrentSocHold2;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insCurrentSocHold3).name());
// lbs[VAR_TO_STR(insCurSocHold3)+suffix] = m_pm->m_pmCurrentState.ccustate.insCurrentSocHold3;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.fcuCurrentToInsLimit1).name());
// lbs[VAR_TO_STR(fcuCurToInsLimit1)+suffix] = m_pm->m_pmCurrentState.ccustate.fcuCurrentToInsLimit1;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.fcuCurrentToinsLimit2).name());
// lbs[VAR_TO_STR(fcuCurToinsLimit2)+suffix] = m_pm->m_pmCurrentState.ccustate.fcuCurrentToinsLimit2;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerCurrentSocHold1).name());
// lbs[VAR_TO_STR(powCurSocHold1)+suffix] = m_pm->m_pmCurrentState.ccustate.powerCurrentSocHold1;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerCurrentSocHold2).name());
// lbs[VAR_TO_STR(powCurSocHold2)+suffix] = m_pm->m_pmCurrentState.ccustate.powerCurrentSocHold2;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerCurrentSocHold3).name());
// lbs[VAR_TO_STR(powCurSocHold3)+suffix] = m_pm->m_pmCurrentState.ccustate.powerCurrentSocHold3;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerCurrentToInsLimit1).name());
// lbs[VAR_TO_STR(powCurToInsLimit1)+suffix] = m_pm->m_pmCurrentState.ccustate.powerCurrentToInsLimit1;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerCurrentToinsLimit2).name());
// lbs[VAR_TO_STR(powCurToinsLimit2)+suffix] = m_pm->m_pmCurrentState.ccustate.powerCurrentToinsLimit2;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.insAlarmIdentificationWord).name());
// lbs[VAR_TO_STR(insfaultCode)+suffix] = m_pm->m_pmCurrentState.ccustate.insAlarmIdentificationWord;
// suffix = getTypeName(typeid(m_pm->m_pmCurrentState.ccustate.powerAlarmIdentificationWord).name());
// lbs[VAR_TO_STR(powfaultCode)+suffix] = m_pm->m_pmCurrentState.ccustate.powerAlarmIdentificationWord;
lbs["insBatCurElect_uint16"] = data.ins_current;
lbs["insBatLimit_uint16"] = data.ins_power_limit1;
lbs[ "insBatSoc_uint8"] = data.ins_soc;
lbs["insBatTotalElect_uint16"] = data.ins_total_energy;
lbs["insChargeState_uint8"] = data.ins_charge_status;
lbs["insCurSocHold1_uint8"] = 0; //备用
lbs["insCurSocHold2_uint8"] = 0; //备用
lbs["insCurSocHold3_uint8"] = 0; //备用
lbs["insCurrent_uint16"] = data.ins_current;
lbs[ "insLinkVol_uint16"] = data.ins_voltage_link;
lbs["insNegRelayState_uint8"] = 0;
lbs["insNegRes_uint16"] = data.ins_resistance_neg;
lbs[ "insPackVol_uint16"] = data.ins_voltage_pack;
lbs[ "insPosRelayState_uint8"] = 0;
lbs["insPosRes_uint16"] = data.ins_resistance_pos;
lbs["powBatCurElect_uint16"] = 0;
lbs["powBatSoc_uint8"] = data.dyn_soc;
lbs[ "powBatTotalElect_uint16"] = data.dyn_total_energy;
lbs["powChargeState_uint8"] = data.dyn_charge_status;
lbs["powCurSocHold1_uint8"] = 0; //备用
lbs["powCurSocHold2_uint8"] = 0; //备用
lbs["powCurSocHold3_uint8"] = 0; //备用
lbs["powCurToInsLimit1_uint8"] = data.dyn_power_limit1;
lbs["powCurToInsLimit2_uint8"] = data.dyn_power_limit2;
lbs["powCur_uint16"] = data.dyn_current;
lbs["powLinkVol_uint16"] = data.dyn_voltage_link;
lbs["powNegRelayState_uint8"] = 0;
lbs["powNegRes_uint16"] = data.dyn_resistance_neg;
lbs["powPosRelayState_uint8"] = 0;
lbs["powPosRes_uint16"] = data.dyn_resistance_pos;
lbs["powerBatLimit_uint16"] = 0; //备用
lbs["powerPackVol_uint16"] = data.dyn_voltage_pack;
lbs["powFaultCode_uint8"] = data.powfaultCode;
lbs["insFaultCode_uint8"] = data.insfaultCode;
Json::StreamWriterBuilder writerBuilder;
writerBuilder.settings_["indentation"] = "";
return Json::writeString(writerBuilder, lbs);