系修复了dcdc和冷却系统获取状态的bug,优化故障码变量

This commit is contained in:
zjk
2025-06-30 18:49:16 +08:00
parent 45fdc455e9
commit 16d4c25c77
11 changed files with 2525 additions and 224 deletions
+99 -14
View File
@@ -580,21 +580,106 @@ bool LowerCommManager::operate_HV_reserved_Breaker(char opt){
[&](){ return m_pm->m_pmCurrentState.bus1State.reservedCircuitBreaker; }
);
}
bool LowerCommManager::operate_HV_dcDc5_Breaker(char opt){
return operateBreakerGeneric<disHighVolBusCmd, char>(
"HV_dcDc5_Breaker",
opt,
[&](disHighVolBusCmd& c){ c.dcdc5Module = getBreakerOption(opt); },
[&](){ return m_pm->m_pmCurrentState.bus1State.dcDcFaultWord1&(0x02); }
);
// bool LowerCommManager::operate_HV_dcDc5_Breaker(char opt){
// return operateBreakerGeneric<disHighVolBusCmd, char>(
// "HV_dcDc5_Breaker",
// opt,
// [&](disHighVolBusCmd& c){ c.dcdc5Module = getBreakerOption(opt); },
// [&](){ return m_pm->m_pmCurrentState.bus1State.dcDcFaultWord1&(0x02); }
// );
// }
bool LowerCommManager::operate_HV_dcDc5_Breaker(char opt)
{
disHighVolBusCmd cmd{}; // 默认全零
double t0 = MOOSTime();
bool ok = false;
string name = "DCDC Module";
LOG_F(INFO, "operate %s: opt=%d", name, opt);
cmd.dcdc5Module = getBreakerOption(opt);
m_udpComm->sendDisSysCmd(cmd);
ok = m_pm->m_pmCurrentState.bus1State.dcDcFaultWord1&(0x02);
MOOSPause(100);
while ( !ok ) {
if( m_pm->m_pmCurrentState.bus1State.dcDcFaultWord1&(0x02) == 1 )
{
ok = true;
break;
}
if (!m_udpComm->sendDisSysCmd(cmd)) {
LOG_F(ERROR, "operate %s: sendDisSysCmd failed", name);
ok = false;
break;
}
if (MOOSTime() > t0 + 6) {
LOG_F(ERROR, "operate %s: timeout", name);
ok = false;
break;
}
MOOSPause(200);
}
//继电器复位
disHighVolBusCmd clr{};
for (int i = 0; i < 3; ++i)
{
m_udpComm->sendDisSysCmd(clr);
MOOSPause(200);
}
return ok;
}
bool LowerCommManager::operate_HV_coolingSystem_Breaker(char opt){
return operateBreakerGeneric<disHighVolBusCmd, char>(
"HV_coolingSystem_Breaker",
opt,
[&](disHighVolBusCmd& c){ c.coolingSystem = getBreakerOption(opt); },
[&](){ return m_pm->m_pmCurrentState.bus1State.dcDcFaultWord1&(0x20); }
);
// bool LowerCommManager::operate_HV_coolingSystem_Breaker(char opt){
// return operateBreakerGeneric<disHighVolBusCmd, char>(
// "HV_coolingSystem_Breaker",
// opt,
// [&](disHighVolBusCmd& c){ c.coolingSystem = getBreakerOption(opt); },
// [&](){ return (m_pm->m_pmCurrentState.bus1State.dcDcFaultWord1 & 0x20) ? 0x55 : 0xAA; }
// );
// }
bool LowerCommManager::operate_HV_coolingSystem_Breaker(char opt)
{
disHighVolBusCmd cmd{}; // 默认全零
double t0 = MOOSTime();
bool ok = false;
string name = "CoolingSystem";
LOG_F(INFO, "operate %s: opt=%d", name, opt);
cmd.coolingSystem = getBreakerOption(opt);
m_udpComm->sendDisSysCmd(cmd);
ok = m_pm->m_pmCurrentState.bus1State.dcDcFaultWord1 & 0x60;
MOOSPause(100);
while ( !ok ) {
if( m_pm->m_pmCurrentState.bus1State.dcDcFaultWord1 & 0x60 )
{
ok = true;
break;
}
if (!m_udpComm->sendDisSysCmd(cmd)) {
LOG_F(ERROR, "operate %s: sendDisSysCmd failed", name);
ok = false;
break;
}
if (MOOSTime() > t0 + 6) {
LOG_F(ERROR, "operate %s: timeout", name);
ok = false;
break;
}
MOOSPause(200);
}
//继电器复位
disHighVolBusCmd clr{};
for (int i = 0; i < 3; ++i)
{
m_udpComm->sendDisSysCmd(clr);
MOOSPause(200);
}
return ok;
}
// 高压汇流排断路器操作函数