增加了新的调试界面,优化了一些功能
This commit is contained in:
@@ -32,6 +32,7 @@ PowerManger::PowerManger()
|
||||
soc = 0;
|
||||
sustainableTime = 0;
|
||||
m_connected = false;
|
||||
m_faultNum = 0;
|
||||
faultCode.push_back(0);
|
||||
|
||||
//注册状态机
|
||||
@@ -783,15 +784,8 @@ bool PowerManger::saveStringToJsonFile(const string &strJson, const string &file
|
||||
//TODO:配电系统操作函数
|
||||
bool PowerManger::disSystemOperation(disBreaker optBreaker, disBreakerOpt)
|
||||
{
|
||||
// switch (disBreaker)
|
||||
// {
|
||||
// case bus1_fuelCellCircuitBreaker :
|
||||
// // send()
|
||||
// break;
|
||||
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int PowerManger::handleInite_s1(FSM_State &fsm, void* pData)
|
||||
@@ -814,9 +808,10 @@ int PowerManger::handleInite_s1(FSM_State &fsm, void* pData)
|
||||
if(dft > 10)
|
||||
{
|
||||
pm->m_pmState = pm->m_Fault_s99;
|
||||
pm->m_faultNum = 1; // 通信超时
|
||||
break;
|
||||
}
|
||||
string desp = "等待复合管控消息 : 超时 : " + to_string(10-dft);
|
||||
string desp = "等待复合管控消息 : " + to_string(10-dft);
|
||||
pm->printState(fsm,desp);
|
||||
usleep(1000000);
|
||||
}
|
||||
@@ -837,12 +832,49 @@ int PowerManger::handleInite_s1(FSM_State &fsm, void* pData)
|
||||
pm->m_pmState = pm->m_Fault_s99;
|
||||
}
|
||||
//3. 检查当前配电装置状态
|
||||
// 首先闭合应急电源开关
|
||||
//a. 断开高压母线的主要断路器
|
||||
//TODO 检查并配置当前配电装置状态
|
||||
disHighVolBusCmd a;
|
||||
a.fuelCellCircuitBreaker = DIS_BREAKER_OFF;
|
||||
a.propulsionMotorCircuitBreaker = DIS_BREAKER_OFF;
|
||||
a.bowHighVoltageDistributionBoxCircuitBreaker = DIS_BREAKER_OFF;
|
||||
a.tyzReservedCircuitBreaker = DIS_BREAKER_OFF;
|
||||
a.sternFTDevice45CircuitBreaker = DIS_BREAKER_OFF;
|
||||
a.sternRudderSwitch1CircuitBreaker = DIS_BREAKER_OFF;
|
||||
a.sternRudderSwitch2CircuitBreaker = DIS_BREAKER_OFF;
|
||||
a.reservedCircuitBreaker = DIS_BREAKER_OFF;
|
||||
a.fbReservedCircuitBreaker = DIS_BREAKER_OFF;
|
||||
pm->m_udpComm.sendDisSysCmd(a);
|
||||
//b. 断开艏部高压设备的主要断路器
|
||||
disHighAVolBusCmd b;
|
||||
b.bowFTDevice123CircuitBreaker = DIS_BREAKER_OFF;
|
||||
b.actuatorCircuitBreaker = DIS_BREAKER_OFF;
|
||||
b.mastSteeringGearControlBoxCircuitBreaker = DIS_BREAKER_OFF;
|
||||
b.xczCircuitBreaker = DIS_BREAKER_OFF;
|
||||
b.bowRudderControlBoxCircuitBreaker = DIS_BREAKER_OFF;
|
||||
b.openWaterCoverStartCylinderCircuitBreaker = DIS_BREAKER_OFF;
|
||||
pm->m_udpComm.sendDisSysCmd(b);
|
||||
//c. 闭合低压母线的断路器
|
||||
disHighBVolBusCmd c;
|
||||
c.lithiumBatteryGroupInstrumentCircuitBreaker = DIS_BREAKER_ON;
|
||||
c.bowLowVoltageDistributionBoxCircuitBreaker = DIS_BREAKER_ON;
|
||||
c.unit4InstrumentDC48VCircuitBreaker = DIS_BREAKER_ON;
|
||||
c.dcC1DCDistributionPanelCircuitBreaker = DIS_BREAKER_ON;
|
||||
c.reservedCircuitBreaker1 = DIS_BREAKER_ON;
|
||||
c.reservedCircuitBreaker2 = DIS_BREAKER_ON;
|
||||
c.emergencyLithiumBatteryGroup2CircuitBreaker = DIS_BREAKER_ON;
|
||||
pm->m_udpComm.sendDisSysCmd(c);
|
||||
//d. 闭合低压汇流排断路器
|
||||
disLowBusCmd d;
|
||||
d.unit1CircuitBreaker = DIS_BREAKER_ON;
|
||||
d.unit2CircuitBreaker = DIS_BREAKER_ON;
|
||||
d.unit3CircuitBreaker = DIS_BREAKER_ON;
|
||||
d.unit5CircuitBreaker = DIS_BREAKER_ON;
|
||||
d.bowPZDeviceCircuitBreaker = DIS_BREAKER_ON;
|
||||
d.reservedCircuitBreaker1 = DIS_BREAKER_ON;
|
||||
d.reservedCircuitBreaker2 = DIS_BREAKER_ON;
|
||||
d.emergencyLithiumBatteryGroup1CircuitBreaker = DIS_BREAKER_ON;
|
||||
pm->m_udpComm.sendDisSysCmd(d);
|
||||
MOOSPause(1000);
|
||||
// pm->workCondition = "";
|
||||
return 0;
|
||||
@@ -852,6 +884,15 @@ int PowerManger::handleFault_s99(FSM_State &fsm, void* pData)
|
||||
{
|
||||
// cout << fsm.name << endl;
|
||||
PowerManger* pm = (PowerManger*)pData;
|
||||
switch (pm->m_faultNum)
|
||||
{
|
||||
case 1:
|
||||
pm->printState(fsm,"通信故障");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pm->printState(fsm,"故障");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user