应急联调完成

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
+16 -16
View File
@@ -297,14 +297,14 @@ public:
// UNIT2
state.sideSonar = driver.sideSonar;
state.bowWaterInet1 = driver.bowWaterlnet1;
state.bowWaterInet2 = driver.bowWaterlnet2;
state.bowWaterInet3 = driver.bowWaterlnet3;
state.bowWaterInet4 = driver.bowWaterlnet4;
state.bowWaterInet5 = driver.bowWaterlnet5;
state.bowWaterInet6 = driver.bowWaterlnet6;
state.bowWaterInet7 = driver.bowWaterlnet7;
state.bowWaterInet8 = driver.bowWaterlnet8;
state.bowWaterInet1 = driver.bowWaterInet1;
state.bowWaterInet2 = driver.bowWaterInet2;
state.bowWaterInet3 = driver.bowWaterInet3;
state.bowWaterInet4 = driver.bowWaterInet4;
state.bowWaterInet5 = driver.bowWaterInet5;
state.bowWaterInet6 = driver.bowWaterInet6;
state.bowWaterInet7 = driver.bowWaterInet7;
state.bowWaterInet8 = driver.bowWaterInet8;
state.launchControler = driver.launchControler;
state.electSensor = driver.electSensor;
state.lowFreqSonar = driver.lowFreqSonar;
@@ -381,14 +381,14 @@ public:
// UNIT2
driver.sideSonar = state.sideSonar;
driver.bowWaterlnet1 = state.bowWaterInet1;
driver.bowWaterlnet2 = state.bowWaterInet2;
driver.bowWaterlnet3 = state.bowWaterInet3;
driver.bowWaterlnet4 = state.bowWaterInet4;
driver.bowWaterlnet5 = state.bowWaterInet5;
driver.bowWaterlnet6 = state.bowWaterInet6;
driver.bowWaterlnet7 = state.bowWaterInet7;
driver.bowWaterlnet8 = state.bowWaterInet8;
driver.bowWaterInet1 = state.bowWaterInet1;
driver.bowWaterInet2 = state.bowWaterInet2;
driver.bowWaterInet3 = state.bowWaterInet3;
driver.bowWaterInet4 = state.bowWaterInet4;
driver.bowWaterInet5 = state.bowWaterInet5;
driver.bowWaterInet6 = state.bowWaterInet6;
driver.bowWaterInet7 = state.bowWaterInet7;
driver.bowWaterInet8 = state.bowWaterInet8;
driver.launchControler = state.launchControler;
driver.electSensor = state.electSensor;
driver.lowFreqSonar = state.lowFreqSonar;
+8 -10
View File
@@ -5,7 +5,7 @@
#include "json/json.h"
#include <bitset>
#include "../pmSysvariable.h"
#include "../systemData.h"
class uPower_disSysStateMsg
{
private:
@@ -16,9 +16,8 @@ public:
~uPower_disSysStateMsg() {};
std::string key = "uPower_disSysState_st";
disSysBreakerList currentDisBreakerState;
std::string buildMsg(disSysBreakerList currentDisBreakerState)
std::string buildMsg(SystemData data,disSysBreakerList currentDisBreakerState)
{
//构建配电系统状态报告
Json::Value dis;
@@ -38,13 +37,12 @@ public:
dis["LVolBusBreaker_uint16"] = *(unsigned short*)pdis4;
//TODO: 构建配电系统故障码
// Json::Value faultCodeDis_array;
// for(auto val : m_pm->faultCode)
// {
// faultCodeDis_array.append(val);
// }
// dis[VAR_TO_STR(faultCode_array)] = faultCodeDis_array;
// 转化为json格式
Json::Value faultCodeDis_array = Json::Value(Json::arrayValue);
for(auto val : data.distributeFaultCode)
{
faultCodeDis_array.append(val);
}
dis["faultCode_array"] = faultCodeDis_array;
Json::StreamWriterBuilder writerBuilder;
writerBuilder.settings_["indentation"] = "";
+8 -8
View File
@@ -141,14 +141,14 @@ public:
state.actuatorState.openCloseMechanism4 = s.bowCover4;
state.actuatorState.openCloseMechanism5 = s.bowCover5;
state.actuatorState.openCloseMechanism6 = s.bowCover6;
state.actuatorState.openWaterMechanism1 = s.bowWaterlnet1;
state.actuatorState.openWaterMechanism2 = s.bowWaterlnet2;
state.actuatorState.openWaterMechanism3 = s.bowWaterlnet3;
state.actuatorState.openWaterMechanism4 = s.bowWaterlnet4;
state.actuatorState.openWaterMechanism5 = s.bowWaterlnet5;
state.actuatorState.openWaterMechanism6 = s.bowWaterlnet6;
state.actuatorState.openWaterMechanism7 = s.bowWaterlnet7;
state.actuatorState.openWaterMechanism8 = s.bowWaterlnet8;
state.actuatorState.openWaterMechanism1 = s.bowWaterInet1;
state.actuatorState.openWaterMechanism2 = s.bowWaterInet2;
state.actuatorState.openWaterMechanism3 = s.bowWaterInet3;
state.actuatorState.openWaterMechanism4 = s.bowWaterInet4;
state.actuatorState.openWaterMechanism5 = s.bowWaterInet5;
state.actuatorState.openWaterMechanism6 = s.bowWaterInet6;
state.actuatorState.openWaterMechanism7 = s.bowWaterInet7;
state.actuatorState.openWaterMechanism8 = s.bowWaterInet8;
// 运动状态赋值
state.motionState.sternRudder1 = s.sternRudderServo1;
+48 -94
View File
@@ -4,7 +4,7 @@
#include "string"
#include "json/json.h"
#include <bitset>
#include "../systemData.h"
class uPower_fcsStateMsg
{
private:
@@ -24,105 +24,59 @@ public:
unsigned int errorCode : 8; // 错误代码
} state;
std::string buildMsg(ccuState ccustate)
std::string buildMsg(SystemData data)
{
//TODO:根据最新协议修改
Json::Value fcs;
// suffix = getTypeName(typeid(ccustate.fcuState).name());
// fcs["fcuState"] = ccustate.fcuState;
// suffix = getTypeName(typeid(ccustate.fcuFaultLeve).name());
// fcs["fcuFaultLeve"] = ccustate.fcuFaultLeve;
// suffix = getTypeName(typeid(ccustate.powerLimit).name());
// fcs[VAR_TO_STR(powLimit)+suffix] = ccustate.powerLimit;
// suffix = getTypeName(typeid(ccustate.totalPowerGeneration).name());
// fcs[VAR_TO_STR(powerGen)+suffix] = ccustate.totalPowerGeneration;
// suffix = getTypeName(typeid(ccustate.ch4o).name());
// fcs[VAR_TO_STR(ch4o)+suffix] = ccustate.ch4o;
// suffix = getTypeName(typeid(ccustate.o2).name());
// fcs[VAR_TO_STR(o2)+suffix] = ccustate.o2;
// suffix = getTypeName(typeid(ccustate.fcuVoltage).name());
// fcs[VAR_TO_STR(fcuVol)+suffix] = ccustate.fcuVoltage;
// suffix = getTypeName(typeid(ccustate.fcuCurrent).name());
// fcs[VAR_TO_STR(fcuCur)+suffix] = ccustate.fcuCurrent;
// suffix = getTypeName(typeid(ccustate.o2Level).name());
// fcs[VAR_TO_STR(o2Level)+suffix] = ccustate.o2Level;
// suffix = getTypeName(typeid(ccustate.exchangerTemperature).name());
// fcs[VAR_TO_STR(excTemp)+suffix] = ccustate.exchangerTemperature;
// suffix = getTypeName(typeid(ccustate.fcuOutPower).name());
// fcs[VAR_TO_STR(fcuOutPower)+suffix] = ccustate.fcuOutPower;
// suffix = getTypeName(typeid(ccustate.fcuOutIns).name());
// fcs[VAR_TO_STR(fcuOutIns)+suffix] = ccustate.fcuOutIns;
// suffix = getTypeName(typeid(ccustate.fcuVoltageIns).name());
// fcs[VAR_TO_STR(fcuVolIns)+suffix] = ccustate.fcuVoltageIns;
// suffix = getTypeName(typeid(ccustate.fcuVoltagePower).name());
// fcs[VAR_TO_STR(fcuVolPower)+suffix] = ccustate.fcuVoltagePower;
// suffix = getTypeName(typeid(ccustate.fcuCurrentIns).name());
// fcs[VAR_TO_STR(fcuCurIns)+suffix] = ccustate.fcuCurrentIns;
// suffix = getTypeName(typeid(ccustate.fcuCurrentPower).name());
// fcs[VAR_TO_STR(fcuCurPower)+suffix] = ccustate.fcuCurrentPower;
// suffix = getTypeName(typeid(ccustate.h2Concentration1).name());
// fcs[VAR_TO_STR(h2Concent1)+suffix] = ccustate.h2Concentration1;
// suffix = getTypeName(typeid(ccustate.h2Concentration2).name());
// fcs[VAR_TO_STR(h2Concent2)+suffix] = ccustate.h2Concentration2;
// suffix = getTypeName(typeid(ccustate.o2Concentration1).name());
// fcs[VAR_TO_STR(o2Concent1)+suffix] = ccustate.o2Concentration1;
// suffix = getTypeName(typeid(ccustate.o2Concentration2).name());
// fcs[VAR_TO_STR(o2Concent2)+suffix] = ccustate.o2Concentration2;
// suffix = getTypeName(typeid(ccustate.ch4oConcentration1).name());
// fcs[VAR_TO_STR(ch4oConcent1)+suffix] = ccustate.ch4oConcentration1;
// suffix = getTypeName(typeid(ccustate.ch4oConcentration2).name());
// fcs[VAR_TO_STR(ch4oConcent2)+suffix] = ccustate.ch4oConcentration2;
// suffix = getTypeName(typeid(ccustate.backpressure1).name());
// fcs[VAR_TO_STR(backpressure1)+suffix] = ccustate.backpressure1;
// suffix = getTypeName(typeid(ccustate.backpressure2).name());
// fcs[VAR_TO_STR(backpressure2)+suffix] = ccustate.backpressure2;
// suffix = getTypeName(typeid(ccustate.flameDetection).name());
// fcs[VAR_TO_STR(flameDet)+suffix] = ccustate.flameDetection;
// unsigned short faultCode1;
// unsigned short faultCode2;
// unsigned short faultCode3;
// faultCode1 = (ccustate.fcuGZ_1H << 8) | ccustate.fcuGZ_1L;
// faultCode2 = (ccustate.fcuGZ_2H << 8) | ccustate.fcuGZ_2L;
// faultCode3 = (ccustate.fcuGZ_3H << 8) | 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;
fcs["backpressure1_fp32"] = data.cabin_pressure1;
fcs["backpressure2_fp32"] = data.cabin_pressure2;
// // 转化为json格式
// Json::Value root;
// root["fcsStatus"] = state.fcsStatus;
// root["outputPower"] = state.outputPower;
// root["temperature"] = state.temperature;
// root["errorCode"] = state.errorCode;
fcs["ch4oConcent1_fp32"] = data.ch3oh_concentration1;
fcs["ch4oConcent2_fp32"] = data.ch3oh_concentration2;
fcs["ch4o_fp32"] = 0.0; // 备用
fcs["excTemp_fp32"] = data.palladium_temp;
fcs["fcuCurIns_fp32"] = 0.0; //备用
fcs["fcuCurPower_fp32"] = 0.0; //备用
fcs["fcuCur_fp32"] = 0.0; //备用
fcs["fcuFaultLeve_uint8"] = data.fc_fault_level;
fcs["fcuOutIns_fp32"] = 0.0; //备用
fcs["fcuOutPower_fp32"] = 0.0; //备用
fcs["fcuState_uint8"] = data.fc_status;
fcs["fcuVolIns_fp32"] = 0.0; //备用
fcs["fcuVolPower_fp32"] = 0.0; //备用
fcs["fcuVol_fp32"] = 0.0; //备用
fcs["h2Concent1_fp32"] = data.h2_concentration1;
fcs["h2Concent2_fp32"] = data.h2_concentration2;
fcs[ "o2Concent1_fp32"] = data.o2_concentration1;
fcs["o2Concent2_fp32"] = data.o2_concentration2;
fcs["o2Level_fp32"] = 0.0; //备用
fcs["o2_fp32"] = 0.0; //备用
fcs["powLimit_fp32"] = data.output_power_limit;
fcs[ "powerGen_fp32"] = data.total_generation_power;
fcs["flameDet_uint8"] = data.flame_detector1;
fcs["faultCode1_uint16"] = data.fc_fault_level_1;
fcs["faultCode2_uint16"] = data.fc_fault_level_2;
fcs["faultCode3_uint16"] = data.fc_fault_level_3;
fcs["faultCode4_uint16"] = data.fc_fault_level_4;
Json::StreamWriterBuilder writerBuilder;
writerBuilder.settings_["indentation"] = "";
+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);
+2 -3
View File
@@ -32,15 +32,14 @@ public:
std::string buildMsg()
{
// 状态赋值
//1.构建系统状态报告
Json::Value pms;
pms["workCondition_uint"] = state.workCondition;
pms["currentMod_uint8"] = state.currentMod;
pms["powerState_uint8"] = state.powerState;
pms["faultLevel_uint8"] = state.faultLevel;
Json::Value faultCode_array;
Json::Value faultCode_array = Json::Value(Json::arrayValue);
for(auto val : state.faultCode)
{
faultCode_array.append(val);