修复了配电系统校验码的问题
This commit is contained in:
@@ -76,12 +76,11 @@ bool LowerCommManager::initUdpComm(){
|
||||
return true;
|
||||
}
|
||||
void LowerCommManager::processPeriodicTasks() {
|
||||
// sendCcuCommand(m_pm->m_CcuColCmd);
|
||||
sendCcuCommand(m_pm->m_CcuColCmd);
|
||||
//延时5ms
|
||||
usleep(5000);
|
||||
// sendDisSysCommand(m_pm->m_targetDisBreakerState);
|
||||
m_udpComm->clearMsgQueue();
|
||||
|
||||
}
|
||||
|
||||
bool LowerCommManager::sendCcuCommand(const ccuColCmd cmd){
|
||||
@@ -706,7 +705,7 @@ bool LowerCommManager::operate_LVA_mergencyLithiumBatteryGroup1Circuit_Breaker(c
|
||||
// 仪表母线断路器操作函数
|
||||
bool LowerCommManager::operate_LV_lithiumBatteryGroupInstrumentCircuit_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"lithiumBatteryGroupInstrumentCircuitBreaker",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.lithiumBatteryGroupInstrumentCircuitBreaker = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.lithiumBatteryGroupInstrumentCircuitBreaker; }
|
||||
@@ -714,7 +713,7 @@ bool LowerCommManager::operate_LV_lithiumBatteryGroupInstrumentCircuit_Breaker(c
|
||||
}
|
||||
bool LowerCommManager::operate_LV_bowLowVoltageDistributionBoxCircuit_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"bowLowVoltageDistributionBoxCircuitBreaker",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.bowLowVoltageDistributionBoxCircuitBreaker = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.bowLowVoltageDistributionBoxCircuitBreaker; }
|
||||
@@ -722,7 +721,7 @@ bool LowerCommManager::operate_LV_bowLowVoltageDistributionBoxCircuit_Breaker(ch
|
||||
}
|
||||
bool LowerCommManager::operate_LV_unit4Dc48V_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"unit4InstrumentDC48VCircuitBreaker",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.unit4InstrumentDC48VCircuitBreaker = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.unit4InstrumentDC48VCircuitBreaker; }
|
||||
@@ -730,7 +729,7 @@ bool LowerCommManager::operate_LV_unit4Dc48V_Breaker(char opt){
|
||||
}
|
||||
bool LowerCommManager::operate_LV_dcC1Panel_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"dcC1DCDistributionPanelCircuitBreaker",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.dcC1DCDistributionPanelCircuitBreaker = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.dcC1DCDistributionPanelCircuitBreaker; }
|
||||
@@ -738,7 +737,7 @@ bool LowerCommManager::operate_LV_dcC1Panel_Breaker(char opt){
|
||||
}
|
||||
bool LowerCommManager::operate_LV_reservedCircuit1_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"reservedCircuitBreaker1",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.reservedCircuitBreaker1 = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.reservedCircuitBreaker1; }
|
||||
@@ -746,7 +745,7 @@ bool LowerCommManager::operate_LV_reservedCircuit1_Breaker(char opt){
|
||||
}
|
||||
bool LowerCommManager::operate_LV_reservedCircuit2_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"reservedCircuitBreaker2",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.reservedCircuitBreaker2 = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.reservedCircuitBreaker2; }
|
||||
@@ -754,7 +753,7 @@ bool LowerCommManager::operate_LV_reservedCircuit2_Breaker(char opt){
|
||||
}
|
||||
bool LowerCommManager::operate_LV_mergencyLithiumBatteryGroup2Circuit_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"emergencyLithiumBatteryGroup2CircuitBreaker",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.emergencyLithiumBatteryGroup2CircuitBreaker = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.emergencyLithiumBatteryGroup2CircuitBreaker; }
|
||||
@@ -771,31 +770,37 @@ bool LowerCommManager::operateBreakerGeneric(
|
||||
) {
|
||||
CmdT cmd{}; // 默认全零
|
||||
double t0 = MOOSTime();
|
||||
bool ok = false;
|
||||
LOG_F(INFO, "operate %s: opt=%d", name, opt);
|
||||
|
||||
// 第一次发包
|
||||
fillCmd(cmd);
|
||||
m_udpComm->sendDisSysCmd(cmd);
|
||||
MOOSPause(100);
|
||||
// 等待状态变更
|
||||
while ( readState() != getBreakerOption(opt) ) {
|
||||
while ( !ok ) {
|
||||
if( readState() == getBreakerOption(opt) )
|
||||
{
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
if (!m_udpComm->sendDisSysCmd(cmd)) {
|
||||
LOG_F(ERROR, "operate %s: sendDisSysCmd failed", name);
|
||||
return false;
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
if (MOOSTime() > t0 + 5) {
|
||||
if (MOOSTime() > t0 + 6) {
|
||||
LOG_F(ERROR, "operate %s: timeout", name);
|
||||
return false;
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
MOOSPause(1000);
|
||||
MOOSPause(200);
|
||||
}
|
||||
|
||||
// 清零再发三次
|
||||
//继电器复位
|
||||
CmdT clr{};
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
m_udpComm->sendDisSysCmd(clr);
|
||||
MOOSPause(100);
|
||||
MOOSPause(200);
|
||||
}
|
||||
return true;
|
||||
return ok;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user