增加了info字段,增加了上电检测,调整了绝缘电阻上报逻辑

This commit is contained in:
zjk
2026-02-09 14:48:58 +08:00
parent e5193bd7f7
commit 987d8b3ce0
51 changed files with 412 additions and 2289 deletions
+5 -11
View File
@@ -189,25 +189,19 @@ bool LowerCommManager::updatePoweSystemStates(){
if(!m_udpComm->m_qReceiveCcuStateBuffer.empty())
{
double time;
if(m_udpComm->popMsgFormQueue(time, m_CcuCurrentState));
if(m_udpComm->popMsgFormQueue(time, m_CcuCurrentState))
{
m_pm->m_pmCurrentState.ccustate = m_CcuCurrentState.data;
m_pm->m_db->insertData(m_pm->m_pmCurrentState.ccustate); //写入数据库
msg_CcuStateFbMsg_Update_time = time;
m_pm->m_systemData->updateSystemData(m_pm->m_pmCurrentState.ccustate);
m_pm->m_systemData->device_common_status.ccu_status.lastUpdateTime = m_pm->m_lowerCommManager->msg_CcuStateFbMsg_Update_time;
}
//DEBUG
//写入文件
// std::ofstream outFile("ccuState.txt", std::ios::app);
// coutMsg(m_CcuCurrentState, outFile);
// coutMsg(m_CcuCurrentState,std::cout);
}
if(!m_udpComm->m_qReceiveDisHighVolBusBuffer.empty())
{
double time;
if(m_udpComm->popMsgFormQueue(time, m_disHighVolBusCurrentState));
if(m_udpComm->popMsgFormQueue(time, m_disHighVolBusCurrentState))
{
// m_udpComm->popMsgFormQueue(time,m_disHighVolBusCurrentState);
m_pm->m_pmCurrentState.bus1State = m_disHighVolBusCurrentState.data;
@@ -238,7 +232,7 @@ bool LowerCommManager::updatePoweSystemStates(){
if(!m_udpComm->m_qReceiveDisHighAVolBusBuffer.empty())
{
double time;
if(m_udpComm->popMsgFormQueue(time,m_disHighAVolBusCurrentState));
if(m_udpComm->popMsgFormQueue(time,m_disHighAVolBusCurrentState))
{
m_pm->m_pmCurrentState.bus2State = m_disHighAVolBusCurrentState.data;
m_pm->m_db->insertData(m_pm->m_pmCurrentState.bus2State); //写入数据库
@@ -263,7 +257,7 @@ bool LowerCommManager::updatePoweSystemStates(){
if(!m_udpComm->m_qReceiveDisHighBVolBusBuffer.empty())
{
double time;
if(m_udpComm->popMsgFormQueue(time,m_disHighBVolBusCurrentState));
if(m_udpComm->popMsgFormQueue(time,m_disHighBVolBusCurrentState))
{
m_pm->m_pmCurrentState.bus3State = m_disHighBVolBusCurrentState.data;
m_pm->m_db->insertData(m_pm->m_pmCurrentState.bus3State); //写入数据库
@@ -287,7 +281,7 @@ bool LowerCommManager::updatePoweSystemStates(){
if(!m_udpComm->m_qReceiveDisLowBusBuffer.empty())
{
double time;
if(m_udpComm->popMsgFormQueue(time,m_disLowBusState));
if(m_udpComm->popMsgFormQueue(time,m_disLowBusState))
{
m_pm->m_pmCurrentState.bus4State = m_disLowBusState.data;
m_pm->m_db->insertData(m_pm->m_pmCurrentState.bus4State); //写入数据库
+2 -2
View File
@@ -65,7 +65,6 @@ PowerManger::PowerManger()
//初始化下位机通信
m_lowerCommManager = new LowerCommManager(this,IPORT,CCUPORT,CCUHOST);
m_lowerCommManager->initUdpComm();
m_lowerCommManager->startListenThread();
//初始化上位机通信
m_upperCommManager = new UpperCommManager(this);
@@ -73,7 +72,8 @@ PowerManger::PowerManger()
//初始化数据库
m_db = new SQLite("power_data.db");
m_db->createTable();
m_lowerCommManager->startListenThread();
//初始化http服务器
m_httpServer = new HttpServer(8090);
m_httpServer->setPowerManger(this);
+1
View File
@@ -49,6 +49,7 @@ void CruiseMode::entry() {
}
pm->workCondition = WorkCondition::CRUISE_MODE;
LOG_F(INFO, "进入巡航模式");
pm->m_systemData->setSystemInfo("INFO:已进入巡航模式");
}
// CruiseMode实现
+1
View File
@@ -40,6 +40,7 @@ void DJMode::entry() {
pm->m_lowerCommManager->operate_HVA_openWaterCoverStartCylinderCircuit_Breaker(1);
pm->workCondition = WorkCondition::DJ_MODE;
LOG_F(INFO, "进入DJ模式");
pm->m_systemData->setSystemInfo("INFO:已进入打击模式");
}
+1
View File
@@ -6,6 +6,7 @@ void FaultState::entry() {
if(pm->m_missionState.type == TaskType::THROW_LOAD)
{
LOG_F(INFO, "检测到抛载");
pm->m_systemData->setSystemInfo("ERROR:检测到抛载");
}
}
+1
View File
@@ -13,4 +13,5 @@ void FloatAdjust::entry() {
handleCuriseWork();
pm->workCondition = WorkCondition::BUOYANCY_ADJUST;
LOG_F(INFO, "进入浮调模式");
pm->m_systemData->setSystemInfo("INFO:已进入浮调模式");
}
+1
View File
@@ -6,6 +6,7 @@ void FloatDown::entry() {
handleCuriseWork();
pm->workCondition = WorkCondition::ASCEND_DESCEND;
LOG_F(INFO, "进入上浮下潜模式");
pm->m_systemData->setSystemInfo("INFO:已进入上浮下潜模式");
}
// FloatDown实现
+1
View File
@@ -6,6 +6,7 @@ void HighSpeedMode::entry() {
handleCuriseWork();
pm->workCondition = WorkCondition::HIGH_SPEED_MODE;
LOG_F(INFO, "进入高速模式");
pm->m_systemData->setSystemInfo("INFO:已经进入高速模式");
}
// HighSpeedMode实现
+1
View File
@@ -4,6 +4,7 @@
void InitState::entry() {
PowerManagerFsm::entry();
LOG_F(INFO, "进入初始化状态");
pm->m_systemData->setSystemInfo("INFO:已初始化");
pm->initControlCmd();
pm->m_lowerCommManager->operate_hold();
transit<StandbyState>();
+23 -1
View File
@@ -5,14 +5,18 @@ void Lifting::entry() {
pm->workCondition = WorkCondition::CHANING;
//1. 关闭所有水声设备
LOG_F(INFO,"前视声纳关机指令");
pm->m_systemData->setSystemInfo("INFO:发送前视声纳关机");
pm->sendNotification("uExternComm_frontSonarControl_cmd","0");
MOOSPause(10000);
pm->m_systemData->setSystemInfo("INFO:已发送前视声纳关机,等待10秒");
for(auto iter : underWterDevices)
{
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, static_cast<DeviceId::Type>(iter), 0);
pm->m_systemData->setSystemInfo("INFO:关闭所有水声设备");
}
//2. 关闭动力电设备
//2.1 断开所有艏部高压断路器
pm->m_systemData->setSystemInfo("INFO:正在断开所有高压断路器");
pm->m_lowerCommManager->operate_HVA_actuatorCircuit_Breaker(0);
MOOSPause(3);
pm->m_lowerCommManager->operate_HVA_bowFTDevice123Circuit_Breaker(0);
@@ -26,6 +30,21 @@ void Lifting::entry() {
pm->m_lowerCommManager->operate_HVA_xczCircuit_Breaker(0);
MOOSPause(3);
//2.2 断开所有艉部高压设备断路器
//检测电机去使能状态,5秒超时
auto startTime = std::chrono::steady_clock::now();
while(pm->m_thrustEnable == 1)
{
// 检查是否超时(5秒)
auto currentTime = std::chrono::steady_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::seconds>(currentTime - startTime);
if(elapsed.count() >= 5)
{
LOG_F(WARNING, "电机去使能超时(5秒)");
pm->m_systemData->setSystemInfo("ERROR:电机去使能超时(5秒)");
return;
}
MOOSPause(100);
}
pm->m_lowerCommManager->operate_HV_propulsionMotor_Breaker(0);
MOOSPause(3);
pm->m_lowerCommManager->operate_HV_sternFt45_Breaker(0);
@@ -57,6 +76,7 @@ void Lifting::entry() {
pm->m_lowerCommManager->operate_HV_powerLithiumBattery_Breaker(0);
//3. 关闭燃料电池
//4. 关闭动力锂电池
pm->m_systemData->setSystemInfo("INFO:正在关闭动力电");
MOOSPause(3);
{
int count=0;
@@ -67,12 +87,14 @@ void Lifting::entry() {
if(count>10)
{
LOG_F(INFO, "动力锂电池无下电反馈");
pm->m_systemData->setSystemInfo("ERROR:动力锂电池无下电反馈");
break;
}
count++;
}
}
LOG_F(INFO, "动力锂电池已下电");
// LOG_F(INFO, "动力锂电池已下电");
pm->m_systemData->setSystemInfo("INFO:起吊准备完成");
pm->workCondition = WorkCondition::LIFT_MODE;
LOG_F(INFO, "WorkCondition %d", pm->workCondition);
}
+47
View File
@@ -67,6 +67,20 @@ void PowerManagerFsm::handleCuriseWork()
//1. 开启动力电
//1.1 动力锂电池上电
pm->m_CcuColCmd.powerBatCmd = BatteryCommand::Start;
// 等待动力锂电池上电完成
int count=0;
while (!(pm->m_systemData->dyn_voltage_link > 500.0))
{
LOG_F(INFO,"动力锂电池上电中...");
MOOSPause(1000);
if(count>10)
{
LOG_F(INFO, "动力锂电池无上电反馈");
pm->m_systemData->setSystemInfo("ERROR:动力锂电池无上电反馈");
return;
}
count++;
}
//1.2 闭合动力电断路器
if(pm->m_systemData->power_bus_status.lithiumBatteryGroupInstrumentCircuitBreaker != 1)
{
@@ -168,6 +182,8 @@ void PowerManagerFsm::handleHydroacousticDeviceCmd(int id , int cmd)
if(pm->m_depth < OVER_DEPTH)
{
LOG_F(INFO, "水下设备操作上电保护 %d ", id);
string info = "ERROR:水下设备操作上电保护 " + DeviceId::toString((DeviceId::Type)id);
pm->m_systemData->setSystemInfo(info);
return;
}
}
@@ -178,6 +194,7 @@ void PowerManagerFsm::handleHydroacousticDeviceCmd(int id , int cmd)
{
LOG_F(INFO,"前视声纳关机指令");
pm->sendNotification("uExternComm_frontSonarControl_cmd","0");
pm->m_systemData->setSystemInfo("INFO:前视声纳关机指令");
MOOSPause(10000);
}
}
@@ -519,6 +536,7 @@ void PowerManagerFsm::handlePropulsionMotorCmd(int id, int cmd)
if(elapsed.count() >= 5)
{
LOG_F(WARNING, "电机去使能超时(5秒)");
pm->m_systemData->setSystemInfo("ERROR:电机去使能超时(5秒)");
return;
}
MOOSPause(100);
@@ -556,6 +574,7 @@ void PowerManagerFsm::handlePropulsionMotorCmd(int id, int cmd)
if(elapsed.count() >= 5)
{
LOG_F(WARNING, "电机去使能超时(5秒)");
pm->m_systemData->setSystemInfo("ERROR:电机去使能超时(5秒)");
return;
}
MOOSPause(100);
@@ -580,6 +599,7 @@ void PowerManagerFsm::handlePropulsionMotorCmd(int id, int cmd)
if(elapsed.count() >= 5)
{
LOG_F(WARNING, "电机去使能超时(5秒)");
pm->m_systemData->setSystemInfo("ERROR:电机去使能超时(5秒)");
return;
}
MOOSPause(100);
@@ -598,6 +618,7 @@ void PowerManagerFsm::handlePropulsionMotorCmd(int id, int cmd)
if(elapsed.count() >= 5)
{
LOG_F(WARNING, "电机去使能超时(5秒)");
pm->m_systemData->setSystemInfo("ERROR:电机去使能超时(5秒)");
return;
}
MOOSPause(100);
@@ -810,6 +831,7 @@ void PowerManagerFsm::handleSideSonarCmd(int id, int cmd)
if(pm->m_depth < OVER_DEPTH)
{
LOG_F(INFO, "水下设备操作上电保护 %d ", id);
pm->m_systemData->setSystemInfo("ERROR:水下设备操作上电保护");
return;
}
}
@@ -964,6 +986,7 @@ void PowerManagerFsm::react(DevCmdExt const &e)
if(pm->currentMod == PMMode::Normal)
{
LOG_F(INFO,"正常模式 : 操作禁止");
pm->m_systemData->setSystemInfo("ERROR:正常模式 : 禁止操作");
return;
}
handleNoPowerDeviceCmd(e.id , e.cmd); // 非水声仪表设备
@@ -2611,6 +2634,7 @@ void PowerManagerFsm::handelPowerCmd(){
case 0:
{
LOG_F(INFO, "收到上位机控制指令:关机");
pm->m_systemData->setSystemInfo("INFO:收到上位机控制指令:关机");
// MOOSPause(3);
// int count=0;
// while (!(pm->m_systemData->dyn_pos_relay_status == 0x02 && pm->m_systemData->dyn_neg_relay_status == 0x02))
@@ -2651,6 +2675,7 @@ void PowerManagerFsm::handelPowerCmd(){
if(elapsed.count() >= 5)
{
LOG_F(WARNING, "电机去使能超时(5秒)");
pm->m_systemData->setSystemInfo("ERROR:电机去使能超时(5秒)");
return;
}
MOOSPause(100);
@@ -2714,6 +2739,7 @@ void PowerManagerFsm::handelPowerCmd(){
if(count>10)
{
LOG_F(INFO, "动力锂电池无下电反馈");
pm->m_systemData->setSystemInfo("ERROR:动力锂电池无下电反馈");
break;
}
count++;
@@ -2722,6 +2748,7 @@ void PowerManagerFsm::handelPowerCmd(){
LOG_F(INFO, "动力锂电池已下电");
//3. 次级配电系统恢复待机
pm->m_driver.getSTANDBYTable(&pm->m_subDisSysCmd);
pm->m_systemData->setSystemInfo("INFO:次级配电系统恢复待机");
MOOSPause(3000);
//4. 执行锂电池关机指令
pm->m_CcuColCmd.insBatCmd = BatteryCommand::Stop;
@@ -2730,8 +2757,24 @@ void PowerManagerFsm::handelPowerCmd(){
case 1:
{
LOG_F(INFO, "收到上位机控制指令:动力电上电");
pm->m_systemData->setSystemInfo("INFO:收到上位机控制指令:动力电上电");
//1. 动力锂电池上电
pm->m_CcuColCmd.powerBatCmd = BatteryCommand::Start;
// 等待动力锂电池上电完成
int count=0;
while (!(pm->m_systemData->dyn_voltage_link > 500.0))
{
LOG_F(INFO,"动力锂电池上电中...");
MOOSPause(1000);
if(count>10)
{
LOG_F(INFO, "动力锂电池无上电反馈");
pm->m_systemData->setSystemInfo("ERROR:动力锂电池无上电反馈");
return;
}
count++;
}
LOG_F(INFO, "动力锂电池已上电");
//2. 闭合动力电断路器
pm->m_lowerCommManager->operate_HV_powerLithiumBattery_Breaker(1);
MOOSPause(3);
@@ -2748,6 +2791,7 @@ void PowerManagerFsm::handelPowerCmd(){
case 2:
{
LOG_F(INFO, "收到上位机控制指令:锂动力电上电");
pm->m_systemData->setSystemInfo("INFO:收到上位机控制指令:锂动力电上电");
//1. 闭合动力电断路器
pm->m_lowerCommManager->operate_HV_powerLithiumBattery_Breaker(1);
//2. 动力锂电池上电
@@ -2757,11 +2801,13 @@ void PowerManagerFsm::handelPowerCmd(){
case 3:
{
LOG_F(INFO, "收到上位机控制指令:燃料电池上电");
pm->m_systemData->setSystemInfo("INFO:收到上位机控制指令:燃料电池上电");
break;
}
case 4:
{
LOG_F(INFO, "收到上位机控制指令:锂动力电下电");
pm->m_systemData->setSystemInfo("INFO:收到上位机控制指令:锂动力电下电");
//1. 动力锂电池下电
pm->m_lowerCommManager->operate_HV_bowHighVoltageBox_Breaker(0);
MOOSPause(3);
@@ -2781,6 +2827,7 @@ void PowerManagerFsm::handelPowerCmd(){
if(count>10)
{
LOG_F(INFO, "动力锂电池无下电反馈");
pm->m_systemData->setSystemInfo("ERROR:动力锂电池无下电反馈");
break;
}
count++;
+1
View File
@@ -11,6 +11,7 @@ void RemoteControl::entry() {
PowerManagerFsm::entry();
pm->workCondition = WorkCondition::REMOTE_CONTROL;
LOG_F(INFO, "进入遥控工况");
pm->m_systemData->setSystemInfo("INFO:已经进入遥控工况");
}
+16
View File
@@ -11,10 +11,25 @@ void ShoreBasedReady::entry() {
PowerManagerFsm::entry();
pm->m_driver.getSHORE_BASED_READYable(&pm->m_subDisSysCmd);
pm->workCondition = WorkCondition::CHANING;
//依次接入执行机构动力电设备
//1. 开启动力电
//1.1 动力锂电池上电
pm->m_CcuColCmd.powerBatCmd = BatteryCommand::Start;
// 等待动力锂电池上电完成
int count=0;
while (!(pm->m_systemData->dyn_voltage_link > 500.0))
{
LOG_F(INFO,"动力锂电池上电中...");
MOOSPause(1000);
if(count>10)
{
LOG_F(INFO, "动力锂电池无上电反馈");
pm->m_systemData->setSystemInfo("ERROR:动力锂电池无上电反馈");
return;
}
count++;
}
//1.2 闭合动力电断路器
pm->m_lowerCommManager->operate_HV_powerLithiumBattery_Breaker(1);
MOOSPause(100);
@@ -89,4 +104,5 @@ void ShoreBasedReady::entry() {
pm->m_lowerCommManager->operate_HV_propulsionMotor_Breaker(1);
pm->workCondition = WorkCondition::SHORE_BASED_READY;
LOG_F(INFO, "进入岸基备航状态");
pm->m_systemData->setSystemInfo("INFO:已经进入岸基备航");
}
+1
View File
@@ -7,6 +7,7 @@ void StandbyState::entry() {
pm->m_driver.getSTANDBYTable(&pm->m_subDisSysCmd);
pm->m_lowerCommManager->operate_hold();
LOG_F(INFO, "WorkCondition %d", pm->workCondition);
pm->m_systemData->setSystemInfo("INFO:已经进入待机状态");
}
void StandbyState::react(StandbyEvent const &) {
transit<StandbyState>();
+1
View File
@@ -13,4 +13,5 @@ void SurfaceSurvey::entry() {
handleCuriseWork();
pm->workCondition = WorkCondition::SURFACE_RECON;
LOG_F(INFO, "进入水面侦查模式");
pm->m_systemData->setSystemInfo("INFO:已经进入水面侦查模式");
}
@@ -6,6 +6,7 @@ void UnderwaterSurvey::entry() {
handleCuriseWork();
pm->workCondition = WorkCondition::UNDERWATER_RECON;
LOG_F(INFO, "进入水下侦查模式");
pm->m_systemData->setSystemInfo("INFO:已经进入水下侦查模式");
}
+10
View File
@@ -6,11 +6,13 @@ void WaterBasedReady::entry() {
pm->workCondition = WorkCondition::CHANING;
PowerManagerFsm::handleCuriseWork();
//启动水声设备
pm->m_systemData->setSystemInfo("INFO:启动水声设备");
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::DVL, (unsigned char)EquipmentCommand::ON);
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::USBL, (unsigned char)EquipmentCommand::ON);
pm->m_upperCommManager->processPeriodicTasks();
pm->workCondition = WorkCondition::WATER_BASED_READY;
LOG_F(INFO, "进入水中备航状态");
pm->m_systemData->setSystemInfo("INFO:已经进入水中备航状态");
}
// WaterBasedReady实现
@@ -31,6 +33,8 @@ void WaterBasedReady::react(DevCmdExt const &e)
if(pm->m_depth < OVER_DEPTH)
{
LOG_F(INFO, "水下设备操作上电保护 %d ", id);
string info = "ERROR:水下设备操作上电保护 " + DeviceId::toString((DeviceId::Type)id);
pm->m_systemData->setSystemInfo(info);
return;
}
}
@@ -41,10 +45,14 @@ void WaterBasedReady::react(DevCmdExt const &e)
{
LOG_F(INFO,"前视声纳关机指令");
pm->sendNotification("uExternComm_frontSonarControl_cmd","0");
string info = "INFO:前视声纳关机指令";
pm->m_systemData->setSystemInfo(info);
MOOSPause(10000);
}
}
LOG_F(INFO, "水声设备操作: %s,%d, %d", DeviceId::toString((DeviceId::Type)id), id, cmd);
string info = "INFO:水声设备操作: " + DeviceId::toString((DeviceId::Type)id) + ", " + std::to_string(id) + ", " + std::to_string(cmd);
pm->m_systemData->setSystemInfo(info);
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, (DeviceId::Type)id, (unsigned char)cmd);
}
else
@@ -52,6 +60,8 @@ void WaterBasedReady::react(DevCmdExt const &e)
if(pm->currentMod == PMMode::Normal)
{
LOG_F(INFO,"正常模式:操作禁止");
string info = "ERROR:正常模式:操作禁止";
pm->m_systemData->setSystemInfo(info);
return;
}
else
+35 -4
View File
@@ -11,6 +11,10 @@ private:
SQLite* m_db;
std::set<unsigned int> sysFaultCodes;
mutable std::mutex sysFaultCodesMutex;
// 系统状态描述(线程安全)
std::string system_info = "INFO:能源系统启动";
mutable std::mutex systemInfoMutex;
public:
/**
* @brief 向系统故障码集合中插入一个故障码
@@ -52,6 +56,25 @@ public:
std::lock_guard<std::mutex> lock(sysFaultCodesMutex);
return sysFaultCodes;
}
/**
* @brief 设置系统状态描述信息(线程安全)
* @param info 要设置的系统状态描述
*/
void setSystemInfo(const std::string& info) {
std::lock_guard<std::mutex> lock(systemInfoMutex);
system_info = info;
}
/**
* @brief 获取系统状态描述信息(线程安全)
* @return std::string 系统状态描述
*/
std::string getSystemInfo() const {
std::lock_guard<std::mutex> lock(systemInfoMutex);
return system_info;
}
//燃料电池系统参数
uint8_t fc_mode; // 燃料电池系统运行模式:00H-无效, 01H-调试, 02H-自动, 03H-补给
uint8_t fc_status; // 燃料电池状态:00H-无效, 01H-初始化, ..., 0DH-维护完成
@@ -592,9 +615,9 @@ public:
};
~SystemData(){};
void updateCommonStatus(double time_out=10){
void updateCommonStatus(double time_out=30){
//更新时间
double currentTime = MOOSTime();
double currentTime = MOOSTime(false);
//判断是否超时
device_common_status.ccu_status.isTimeout = abs(currentTime - device_common_status.ccu_status.lastUpdateTime) > time_out;
device_common_status.dis_hv_c1.isTimeout = abs(currentTime - device_common_status.dis_hv_c1.lastUpdateTime) > time_out;
@@ -839,8 +862,16 @@ public:
std::lock_guard<std::mutex> lock(faultCodeMutex);
if(power_bus_status.emergencyPowerLossSignal == 1) disSysFaultCode.insert(37); else disSysFaultCode.erase(37);
if(power_bus_status.meterPowerLossSignal == 1) disSysFaultCode.insert(36); else disSysFaultCode.erase(36);
if(power_bus_status.aBusInsulationStatus == 1) disSysFaultCode.insert(35); else disSysFaultCode.erase(35);
if(power_bus_status.powerBusInsulationStatus == 1) disSysFaultCode.insert(34); else disSysFaultCode.erase(34);
if(power_bus_status.powerLithiumBatteryCircuitBreaker == 1)
{
if(power_bus_status.aBusInsulationStatus == 1) disSysFaultCode.insert(35);
if(power_bus_status.powerBusInsulationStatus == 1) disSysFaultCode.insert(34);
}
else
{
disSysFaultCode.erase(35);
disSysFaultCode.erase(34);
}
}
//温度
+6 -6
View File
@@ -177,7 +177,7 @@ bool udpComm::pushMsgToQueue(unsigned char *m)
{
if(m_qReceiveCcuStateBuffer.size()<QUENUE_SIZE)
{
double time = MOOSTime();
double time = MOOSTime(false);
m_qReceiveCcuStateBuffer.push(std::make_pair(time, s));
}
else
@@ -200,7 +200,7 @@ bool udpComm::pushMsgToQueue(unsigned char *m)
{
if(m_qReceiveCcuSetParmBuffer.size()<QUENUE_SIZE)
{
double time = MOOSTime();
double time = MOOSTime(false);
m_qReceiveCcuSetParmBuffer.push(std::make_pair(time, s));
}
else
@@ -223,7 +223,7 @@ bool udpComm::pushMsgToQueue(unsigned char *m)
{
if(m_qReceiveDisHighVolBusBuffer.size()<QUENUE_SIZE)
{
double time = MOOSTime();
double time = MOOSTime(false);
m_qReceiveDisHighVolBusBuffer.push(std::make_pair(time, s));
}
else
@@ -246,7 +246,7 @@ bool udpComm::pushMsgToQueue(unsigned char *m)
{
if(m_qReceiveDisHighAVolBusBuffer.size()<QUENUE_SIZE)
{
double time = MOOSTime();
double time = MOOSTime(false);
m_qReceiveDisHighAVolBusBuffer.push(std::make_pair(time, s));
}
else
@@ -269,7 +269,7 @@ bool udpComm::pushMsgToQueue(unsigned char *m)
{
if(m_qReceiveDisHighBVolBusBuffer.size()<QUENUE_SIZE)
{
double time = MOOSTime();
double time = MOOSTime(false);
m_qReceiveDisHighBVolBusBuffer.push(std::make_pair(time, s));
}
else
@@ -292,7 +292,7 @@ bool udpComm::pushMsgToQueue(unsigned char *m)
{
if(m_qReceiveDisLowBusBuffer.size()<QUENUE_SIZE)
{
double time = MOOSTime();
double time = MOOSTime(false);
m_qReceiveDisLowBusBuffer.push(std::make_pair(time, s));
}
else
+4 -1
View File
@@ -5,6 +5,7 @@
#include "json/json.h"
#include <bitset>
#include "../systemData.h"
class uPower_pmStateMsg
{
private:
@@ -49,7 +50,7 @@ public:
pms["faultLevel_uint8"] = data.getFaultCodeLevel();
Json::Value faultCode_array = Json::Value(Json::arrayValue);
//TODO:屏蔽所有故障
for(auto faultCode : data.getFaultCode())
{
faultCode_array.append(faultCode);
@@ -63,6 +64,8 @@ public:
pms["leakage_uint8"] = state.m_leakage;
pms["info_str"] = data.getSystemInfo();
// 转化为json格式
Json::StreamWriterBuilder writerBuilder;
writerBuilder.settings_["indentation"] = "";