增加了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
+9
View File
@@ -0,0 +1,9 @@
//SERVERHOST = 192.168.0.223
//SERVERPORT = 9000
ProcessConfig = pPowerManger
{
AppTick = 4
CommsTick = 4
log_level = INFO
log_file = /path/to/your/logfile.log
}
-326
View File
@@ -1,326 +0,0 @@
{
"navigationParam_obj" :
{
"limitedNavRegion_obj" : [],
"maxDepth_fp32" : -1,
"maxSpeed_fp32" : -1,
"maxVerSpeed_fp32" : -1,
"minHeight_fp32" : -1,
"minPitch_fp32" : -1,
"minTurnLimit_fp32" : -1
},
"planHash_int32" : -2031201612,
"planID_int32" : 1817399773,
"planName_str" : "pl_test2",
"taskSort_array_int32" :
[
68991759,
1726048938,
68991758,
-2127541611,
1275525031,
-725793762
],
"task_obj" :
{
"-2127541611" :
{
"bowRudderUnfold_bool" : false,
"depthPoints_array_fp32" :
[
0.0
],
"desiredDepth_fp32" : 0,
"desiredHeight_fp32" : 0,
"desiredSpeed_fp32" : 2.0577776432037354,
"destination_array_fp64" :
[
20.636590882471154,
111.41261861598258
],
"endDuration_int32" : 30,
"estimatedConsume_fp32" : 0,
"estimatedTime_fp32" : 0,
"fixedType_int32" : 1,
"latPoints_array_fp64" :
[
20.636590882471154
],
"lonPoints_array_fp64" :
[
111.41261861598258
],
"pastPointIndex_int32" : -1,
"pathLength_fp32" : 0,
"pointID_array_str" :
[
"-2127541611_0"
],
"radius_fp32" : 20,
"source_int32" : 1,
"speedType_int32" : 1,
"taskID_int32" : -2127541611,
"taskName_str" : "Hover1",
"taskType_str" : "hover"
},
"-725793762" :
{
"bowRudderUnfold_bool" : false,
"cyclePoints_array_int32" :
[
1
],
"depthPoints_array_fp32" :
[
0.0
],
"desiredSpeed_fp32" : 1,
"destination_array_fp64" :
[
20.633257427671467,
111.42364785945182
],
"endWay_int32" : 1,
"estimatedConsume_fp32" : 0,
"estimatedTime_fp32" : 0,
"latPoints_array_fp64" :
[
20.633257427671467
],
"lonPoints_array_fp64" :
[
111.42364785945182
],
"pastPointIndex_int32" : -1,
"pathLength_fp32" : 0,
"pointID_array_str" :
[
"-725793762_0"
],
"radius_fp32" : 20,
"source_int32" : 1,
"speedType_int32" : 2,
"taskID_int32" : -725793762,
"taskName_str" : "Recycle1",
"taskType_str" : "recycle"
},
"1275525031" :
{
"bowRudderUnfold_bool" : false,
"calibrateMode_int32" : 1,
"depthPoints_array_fp32" :
[
0.0
],
"desiredSpeed_fp32" : 1,
"destination_array_fp64" :
[
20.641771649173037,
111.42562196528678
],
"doubleCalibrateSetting_int32" : 0,
"estimatedConsume_fp32" : 0,
"estimatedTime_fp32" : 0,
"latPoints_array_fp64" :
[
20.641771649173037
],
"lonPoints_array_fp64" :
[
111.42562196528678
],
"pastPointIndex_int32" : -1,
"pathLength_fp32" : 0,
"pointID_array_str" :
[
"1275525031_0"
],
"source_int32" : 1,
"speedType_int32" : 2,
"taskID_int32" : 1275525031,
"taskName_str" : "Calibration1",
"taskType_str" : "satCalibrate"
},
"1726048938" :
{
"attack_int32" : 0,
"balanceEnabled_bool" : false,
"bowRudderUnfold_bool" : false,
"calibPointsExtend_array_int32" :
[
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"calibPoints_array_int32" :
[
0,
0,
0
],
"calibrateMode_int32" : 1,
"depthPointsExtend_array_fp32" :
[
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"desiredDepth_fp32" : 0,
"desiredHeight_fp32" : 0,
"desiredSpeed_fp32" : 2,
"estimatedConsume_fp32" : 0,
"estimatedTime_fp32" : 0,
"fixedType_int32" : 1,
"flankArray_int32" : 0,
"latPointsExtend_array_fp64" :
[
20.672185454579221,
20.654677472562906,
20.660540464584184,
20.672185454579221,
20.654677472562906,
20.660540464584184,
20.672185454579221,
20.654677472562906,
20.660540464584184
],
"latPoints_array_fp64" :
[
20.672185454579221,
20.654677472562906,
20.660540464584184
],
"lonPointsExtend_array_fp64" :
[
111.41573055186512,
111.41349821869244,
111.39761978934951,
111.41573055186512,
111.41349821869244,
111.39761978934951,
111.41573055186512,
111.41349821869244,
111.39761978934951
],
"lonPoints_array_fp64" :
[
111.41573055186512,
111.41349821869244,
111.39761978934951
],
"loop_int32" : 3,
"magnet_int32" : 0,
"optronic_int32" : 0,
"pastPointIndex_int32" : -1,
"pathLength_fp32" : 0,
"pointID_array_str" :
[
"1726048938_0",
"1726048938_1",
"1726048938_2",
"1726048938_3",
"1726048938_4",
"1726048938_5",
"1726048938_6",
"1726048938_7",
"1726048938_8"
],
"source_int32" : 1,
"speedType_int32" : 2,
"taskID_int32" : 1726048938,
"taskName_str" : "AreaSurvey1",
"taskType_str" : "tour",
"towArray_int32" : 0
},
"68991758" :
{
"balanceEnabled_bool" : false,
"bowRudderUnfold_bool" : false,
"depthPoints_array_fp32" :
[
0.0
],
"desiredDepth_fp32" : 0,
"desiredHeight_fp32" : 0,
"desiredSpeed_fp32" : 2,
"destination_array_fp64" :
[
20.643378052620122,
111.4050226000524
],
"estimatedConsume_fp32" : 0,
"estimatedTime_fp32" : 0,
"fixedType_int32" : 1,
"latPoints_array_fp64" :
[
20.643378052620122
],
"lonPoints_array_fp64" :
[
111.4050226000524
],
"pastPointIndex_int32" : -1,
"pathLength_fp32" : 0,
"pointID_array_str" :
[
"68991758_0"
],
"source_int32" : 1,
"speedType_int32" : 2,
"taskID_int32" : 68991758,
"taskName_str" : "Goto1",
"taskType_str" : "sail"
},
"68991759" :
{
"balanceEnabled_bool" : false,
"bowRudderUnfold_bool" : false,
"depthPoints_array_fp32" :
[
0.0
],
"desiredDepth_fp32" : 0,
"desiredHeight_fp32" : 0,
"desiredSpeed_fp32" : 2,
"destination_array_fp64" :
[
20.650305473106499,
111.4256434229589
],
"estimatedConsume_fp32" : 0,
"estimatedTime_fp32" : 0,
"fixedType_int32" : 1,
"latPoints_array_fp64" :
[
20.650305473106499
],
"lonPoints_array_fp64" :
[
111.4256434229589
],
"pastPointIndex_int32" : -1,
"pathLength_fp32" : 0,
"pointID_array_str" :
[
"68991759_0"
],
"source_int32" : 1,
"speedType_int32" : 2,
"taskID_int32" : 68991759,
"taskName_str" : "Goto2",
"taskType_str" : "sail"
}
}
}
-64
View File
@@ -1,64 +0,0 @@
{
"DVL" : 0,
"USBL" : 0,
"bowCover1" : 0,
"bowCover2" : 0,
"bowCover3" : 0,
"bowCover4" : 0,
"bowCover5" : 0,
"bowCover6" : 0,
"bowRudderDeploy" : 0,
"bowRudderServo1" : 0,
"bowRudderServo2" : 0,
"bowThrow" : 0,
"bowWaterInet1" : 0,
"bowWaterInet2" : 0,
"bowWaterInet3" : 0,
"bowWaterInet4" : 0,
"bowWaterInet5" : 0,
"bowWaterInet6" : 0,
"bowWaterInet7" : 0,
"bowWaterInet8" : 0,
"buoyage" : 0,
"buoyancyAdjust1" : 0,
"buoyancyAdjust2" : 0,
"buoyancyAdjust3" : 0,
"buoyancyAdjust4" : 0,
"buoyancyAdjust5" : 0,
"commMast" : 0,
"ctd1" : 0,
"ctd2" : 0,
"depth1" : 0,
"depth2" : 0,
"depth3" : 0,
"electSensor" : 0,
"forwardSonar" : 0,
"inputWaterSensor1" : 0,
"inputWaterSensor2" : 0,
"inputWaterSensor3" : 0,
"ins" : 0,
"launchControler" : 0,
"lowFreqSonar" : 0,
"mastLiftingServo" : 0,
"ntp" : 0,
"overDeep1" : 0,
"overDeep2" : 0,
"photoSensor" : 0,
"sideSonar" : 0,
"singleBeamSonar1" : 0,
"singleBeamSonar2" : 0,
"singleBeamSonar3" : 0,
"singleBeamSonar4" : 0,
"singleBeamSonar5" : 0,
"singleBeamSonar6" : 0,
"singleBeamSonar7" : 0,
"singleBeamSonar8" : 0,
"soundVeloc" : 0,
"sternRudderServo1" : 0,
"sternRudderServo2" : 0,
"sternRudderServo3" : 0,
"sternRudderServo4" : 0,
"sternThrow" : 0,
"thruster" : 0,
"waterInject" : 0
}
-3
View File
@@ -1,3 +0,0 @@
{
"value_array_uint16" :[2,1,3]
}
-1
View File
@@ -1 +0,0 @@
{"uPower_currentState_st":{"HVABFTDev123Cur_uint16":0,"HVABactCur_uint16":0,"HVABbowRudCur_uint16":0,"HVABbusBCur_uint16":0,"HVABbusBVol_uint16":0,"HVABmastSteGeaCur_uint16":0,"HVABopenWaterCur_uint16":0,"HVABxczCur_uint16":0,"HVBBCCUCur_uint16":0,"HVBBFCSSecurSysCur_uint16":0,"HVBBbatInsCur_uint16":0,"HVBBbowLowVolDisBoxCur_uint16":0,"HVBBdcC1InsCur_uint16":0,"HVBBemer2BusVol_uint16":0,"HVBBemerBatCur_uint16":0,"HVBBinsBusVol_uint16":0,"HVBBplcCur_uint16":0,"HVBBreservedCur1_uint16":0,"HVBBreservedCur2_uint16":0,"HVBBunit4Cur_uint16":0,"HVBFTDev45Cur_uint16":0,"HVBbatGroupCur_uint16":0,"HVBbowHVolDisBoxCur_uint16":0,"HVBbusACur_uint16":0,"HVBbusAVol_uint16":0,"HVBdcDc5Cur_uint16":0,"HVBfbCur_uint16":0,"HVBmotorCur_uint16":0,"HVBpowerBusCur_uint16":0,"HVBpowerBusVol_uint16":0,"HVBreservedCur1_uint16":0,"HVBreservedCur2_uint16":0,"HVBreservedCur3_uint16":0,"HVBsternRud1Cur_uint16":0,"HVBsternRud2Cur_uint16":0,"HVBtyzCur_uint16":0,"LVBBbowPZDevCur_uint16":0,"LVBBemerBatCur_uint16":0,"LVBBemerBusVol_uint16":0,"LVBBinsBusCur_uint16":0,"LVBBunit1Cur_uint16":0,"LVBBunit2Cur_uint16":0,"LVBBunit3Cur_uint16":0,"LVBBunit5Cur_uint16":0,"LVBinsBusVol_uint16":0}}
-1
View File
@@ -1 +0,0 @@
{"uPower_disSysState_st":{"HVolABusBreaker_uint16":0,"HVolBBusBreaker_uint16":0,"HVolBusBreaker_uint16":0,"LVolBusBreaker_uint16":0,"faultCode_array":[1,2,3,4,5,6,7,8,9,13,14,15,16,17,18,19,20,21,22,25,26,27,28,29,33,34,35,36,37,38,39,40,41,42,44,45]}}
-65
View File
@@ -1,65 +0,0 @@
{"uPower_equState_fb":{
"DVL_uint8" : 0,
"USBL_uint8" : 0,
"bowCover1_uint8" : 0,
"bowCover2_uint8" : 0,
"bowCover3_uint8" : 0,
"bowCover4_uint8" : 0,
"bowCover5_uint8" : 0,
"bowCover6_uint8" : 0,
"bowRudderDeploy_uint8" : 0,
"bowRudderServo1_uint8" : 0,
"bowRudderServo2_uint8" : 0,
"bowThrow_uint8" : 0,
"bowWaterInet1_uint8" : 0,
"bowWaterInet2_uint8" : 0,
"bowWaterInet3_uint8" : 0,
"bowWaterInet4_uint8" : 0,
"bowWaterInet5_uint8" : 0,
"bowWaterInet6_uint8" : 0,
"bowWaterInet7_uint8" : 0,
"bowWaterInet8_uint8" : 0,
"buoyage_uint8" : 0,
"buoyancyAdjust1_uint8" : 0,
"buoyancyAdjust2_uint8" : 0,
"buoyancyAdjust3_uint8" : 0,
"buoyancyAdjust4_uint8" : 0,
"buoyancyAdjust5_uint8" : 0,
"commDev_uint8" : 0,
"ctd1_uint8" : 0,
"ctd2_uint8" : 0,
"depth1_uint8" : 0,
"depth2_uint8" : 0,
"depth3_uint8" : 0,
"electSensor_uint8" : 0,
"forwardSonar_uint8" : 0,
"inputWaterSensor1_uint8" : 0,
"inputWaterSensor2_uint8" : 0,
"inputWaterSensor3_uint8" : 0,
"ins_uint8" : 1,
"launchControler_uint8" : 0,
"lowFreqSonar_uint8" : 0,
"mastLiftingServo_uint8" : 0,
"ntp_uint8" : 1,
"overDeep1_uint8" : 0,
"overDeep2_uint8" : 0,
"photoSensor_uint8" : 0,
"sideSonar_uint8" : 0,
"singleBeamSonar1_uint8" : 0,
"singleBeamSonar2_uint8" : 0,
"singleBeamSonar3_uint8" : 0,
"singleBeamSonar4_uint8" : 0,
"singleBeamSonar5_uint8" : 0,
"singleBeamSonar6_uint8" : 0,
"singleBeamSonar7_uint8" : 0,
"singleBeamSonar8_uint8" : 0,
"soundVeloc_uint8" : 0,
"sternRudderServo1_uint8" : 0,
"sternRudderServo2_uint8" : 0,
"sternRudderServo3_uint8" : 0,
"sternRudderServo4_uint8" : 0,
"sternThrow_uint8" : 0,
"thruster_uint8" : 0,
"waterInject_uint8" : 0
}
}
-1
View File
@@ -1 +0,0 @@
{"uPower_fcsState_st":{"backpressure1_fp32":0.0,"backpressure2_fp32":0.0,"ch4oConcent1_fp32":0.0,"ch4oConcent2_fp32":0.0,"ch4o_fp32":0.0,"excTemp_fp32":0.0,"faultCode1_uint16":0,"faultCode2_uint16":0,"faultCode3_uint16":0,"faultCode4_uint16":0,"fcCommState_uint8":0,"fcuCurIns_fp32":0.0,"fcuCurPower_fp32":0.0,"fcuCur_fp32":0.0,"fcuFaultLeve_uint8":0,"fcuOutIns_fp32":0.0,"fcuOutPower_fp32":0.0,"fcuState_uint8":0,"fcuVolIns_fp32":0.0,"fcuVolPower_fp32":0.0,"fcuVol_fp32":0.0,"flameDet_uint8":0,"h2Concent1_fp32":0.0,"h2Concent2_fp32":0.0,"o2Concent1_fp32":0.0,"o2Concent2_fp32":0.0,"o2Level_fp32":0.0,"o2_fp32":0.0,"powLimit_fp32":0.0,"powerGen_fp32":0.0}}
-1
View File
@@ -1 +0,0 @@
{"uPower_liBatState_st":{"insBatCurElect_uint16":0.0,"insBatLimit_uint16":0.0,"insBatSoc_uint8":0,"insBatTotalElect_uint16":0.0,"insChargeState_uint8":0,"insCommState_uint8":0,"insCurSocHold1_uint8":0,"insCurSocHold2_uint8":0,"insCurSocHold3_uint8":0,"insCurrent_uint16":0.0,"insFaultCode_uint8":0,"insLinkVol_uint16":0.0,"insNegRelayState_uint8":0,"insNegRes_uint16":0.0,"insPackVol_uint16":0.0,"insPosRelayState_uint8":0,"insPosRes_uint16":0.0,"powBatCurElect_uint16":0,"powBatSoc_uint8":0,"powBatTotalElect_uint16":0.0,"powChargeState_uint8":0,"powCommState_uint8":0,"powCurSocHold1_uint8":0,"powCurSocHold2_uint8":0,"powCurSocHold3_uint8":0,"powCurToInsLimit1_uint8":0.0,"powCurToInsLimit2_uint8":0.0,"powCur_uint16":0.0,"powFaultCode_uint8":0,"powLinkVol_uint16":0.0,"powNegRelayState_uint8":0,"powNegRes_uint16":0.0,"powPosRelayState_uint8":0,"powPosRes_uint16":0.0,"powerBatLimit_uint16":0,"powerPackVol_uint16":0.0}}
-13
View File
@@ -1,13 +0,0 @@
{
"currentMod_uint8": 0,
"faultCode_array":
[
0
],
"faultLevel_uint8": 0,
"leakage_uint8": 0,
"powerState_uint8": 0,
"soc_uint16": 0,
"sustainableTime_int64": 0,
"workCondition_uint8": 1
}
-13
View File
@@ -1,13 +0,0 @@
{"uPower_pmState_st":{
"currentMod_uint8" : 1,
"falutLevel_uint8" : 0,
"faultCode_array" :
[
0
],
"powerState_uint8" : 0,
"soc_uint32" : 0,
"sustainableTime_uint32" : 0,
"workCondition_uint8" : 1
}
}
-1
View File
@@ -1 +0,0 @@
{"uPower_secdistState_cmd":{"ADCP_uint8":2,"DVL_uint8":2,"USBL_uint8":2,"bowCover1_uint8":2,"bowCover2_uint8":2,"bowCover3_uint8":2,"bowCover4_uint8":2,"bowCover5_uint8":2,"bowCover6_uint8":2,"bowRudderDeploy_uint8":2,"bowRudderServo_uint8":2,"bowThrow_uint8":2,"bowWaterInet1_uint8":2,"bowWaterInet2_uint8":2,"bowWaterInet3_uint8":2,"bowWaterInet4_uint8":2,"bowWaterInet5_uint8":2,"bowWaterInet6_uint8":2,"bowWaterInet7_uint8":2,"bowWaterInet8_uint8":2,"buoyage_uint8":2,"buoyancyAdjust1_uint8":2,"buoyancyAdjust2_uint8":2,"buoyancyAdjust3_uint8":2,"buoyancyAdjust4_uint8":2,"buoyancyAdjust5_uint8":2,"commDevStern_uint8":2,"commDev_uint8":1,"ctd1_uint8":1,"ctd2_uint8":1,"depth1_uint8":1,"depth2_uint8":1,"depth3_uint8":1,"dragSonar_uint8":2,"electSensor_uint8":2,"forwardSonar_uint8":2,"haulingMachine_uint8":2,"inOutLetWater1_uint8":1,"inOutLetWater2_uint8":1,"inOutLetWater3_uint8":1,"launchControler_uint8":2,"lowFreqSonar_uint8":2,"mainINS_uint8":1,"mastLiftingServo_uint8":2,"photoSensor_uint8":2,"secINS_uint8":1,"sideSonar_uint8":2,"singleBeamSonar1_uint8":2,"singleBeamSonar2_uint8":2,"singleBeamSonar3_uint8":2,"singleBeamSonar4_uint8":2,"singleBeamSonar5_uint8":2,"singleBeamSonar6_uint8":2,"singleBeamSonar7_uint8":2,"singleBeamSonar8_uint8":2,"soundVeloc_uint8":1,"sternRudderServo1_uint8":2,"sternRudderServo2_uint8":2,"sternRudderServo3_uint8":2,"sternRudderServo4_uint8":2,"sternThrow_uint8":2,"thruster_uint8":2,"waterInject_uint8":2}}
-5
View File
@@ -1,5 +0,0 @@
{
"powerCMD":0,
"modCMD":0,
"workCMD":0
}
@@ -1,52 +0,0 @@
{
"protocol_name": "CCU参数设置反馈",
"message_id": "0x0040",
"length": 10,
"checksum": {
"start_offset": 0,
"end_offset": 6,
"algorithm": "sum"
},
"fields": [
{
"name": "start1",
"offset": 0,
"type": "uint8",
"value": "0x20",
"description": "起始字节1"
},
{
"name": "start2",
"offset": 1,
"type": "uint8",
"value": "0x20",
"description": "起始字节2"
},
{
"name": "id",
"offset": 2,
"type": "uint16",
"value": "0x0040",
"description": "消息ID"
},
{
"name": "length",
"offset": 4,
"type": "uint16",
"value": 10,
"description": "消息长度"
},
{
"name": "flag",
"offset": 6,
"type": "uint8",
"description": "设置标志位"
},
{
"name": "failvreCode",
"offset": 7,
"type": "uint8",
"description": "故障代码"
}
]
}
-637
View File
@@ -1,637 +0,0 @@
{
"message_name": "CCUStateFbMsg",
"protocol_id": "0x0041",
"endianness": "little",
"fields": [
{
"name": "start1",
"offset": 0,
"length": 1,
"type": "uint8",
"value": "0x20",
"description": "起始字节1"
},
{
"name": "start2",
"offset": 1,
"length": 1,
"type": "uint8",
"value": "0x20",
"description": "起始字节2"
},
{
"name": "id",
"offset": 2,
"length": 2,
"type": "uint16",
"value": "0x0041",
"description": "消息ID"
},
{
"name": "length",
"offset": 4,
"length": 2,
"type": "uint16",
"dynamic": true,
"description": "数据长度(自动计算)"
},
{
"name": "currentWorkCondition",
"offset": 6,
"length": 1,
"type": "uint8",
"enum": {"0x00":"待机","0x01":"运行","0x02":"故障"},
"description": "当前工作状态"
},
{
"name": "fcuState",
"offset": 7,
"length": 1,
"type": "uint8",
"unit": "%",
"description": "燃料电池状态"
},
{
"name": "fcuFaultLeve",
"offset": 8,
"length": 1,
"type": "uint8",
"description": "故障等级"
},
{
"name": "powerLimit",
"offset": 9,
"length": 4,
"type": "float32",
"unit": "kW",
"description": "功率限制值"
},
{
"name": "totalPowerGeneration",
"offset": 13,
"length": 4,
"type": "float32",
"unit": "kWh",
"description": "总发电量"
},
{
"name": "ch4o",
"offset": 17,
"length": 4,
"type": "float32",
"unit": "ppm",
"description": "甲醇浓度"
},
{
"name": "o2",
"offset": 21,
"length": 4,
"type": "float32",
"unit": "%",
"description": "氧气浓度"
},
{
"name": "fcuVoltage",
"offset": 25,
"length": 4,
"type": "float32",
"unit": "V",
"description": "燃料电池电压"
},
{
"name": "fcuCurrent",
"offset": 29,
"length": 4,
"type": "float32",
"unit": "A",
"description": "燃料电池电流"
},
{
"name": "o2Level",
"offset": 33,
"length": 4,
"type": "float32",
"unit": "%",
"description": "氧气含量"
},
{
"name": "placeholder1",
"offset": 37,
"length": 4,
"type": "float32",
"description": "预留字段1"
},
{
"name": "exchangerTemperature",
"offset": 41,
"length": 4,
"type": "float32",
"unit": "°C",
"description": "换热器温度"
},
{
"name": "fcuOutPower",
"offset": 45,
"length": 4,
"type": "float32",
"unit": "kW",
"description": "燃料电池输出功率"
},
{
"name": "fcuOutIns",
"offset": 49,
"length": 4,
"type": "float32",
"unit": "kΩ",
"description": "绝缘电阻"
},
{
"name": "fcuVoltageIns",
"offset": 53,
"length": 4,
"type": "float32",
"unit": "V",
"description": "绝缘监测电压"
},
{
"name": "fcuVoltagePower",
"offset": 57,
"length": 4,
"type": "float32",
"unit": "V",
"description": "功率电压"
},
{
"name": "fcuCurrentIns",
"offset": 61,
"length": 4,
"type": "float32",
"unit": "A",
"description": "绝缘监测电流"
},
{
"name": "fcuCurrentPower",
"offset": 65,
"length": 4,
"type": "float32",
"unit": "A",
"description": "功率电流"
},
{
"name": "h2Concentration1",
"offset": 69,
"length": 4,
"type": "float32",
"unit": "ppm",
"description": "氢气浓度1"
},
{
"name": "h2Concentration2",
"offset": 73,
"length": 4,
"type": "float32",
"unit": "ppm",
"description": "氢气浓度2"
},
{
"name": "o2Concentration1",
"offset": 77,
"length": 4,
"type": "float32",
"unit": "%",
"description": "氧气浓度1"
},
{
"name": "o2Concentration2",
"offset": 81,
"length": 4,
"type": "float32",
"unit": "%",
"description": "氧气浓度2"
},
{
"name": "ch4oConcentration1",
"offset": 85,
"length": 4,
"type": "float32",
"unit": "ppm",
"description": "甲醇浓度1"
},
{
"name": "ch4oConcentration2",
"offset": 89,
"length": 4,
"type": "float32",
"unit": "ppm",
"description": "甲醇浓度2"
},
{
"name": "backpressure1",
"offset": 93,
"length": 4,
"type": "float32",
"unit": "kPa",
"description": "背压1"
},
{
"name": "backpressure2",
"offset": 97,
"length": 4,
"type": "float32",
"unit": "kPa",
"description": "背压2"
},
{
"name": "flameDetection",
"offset": 101,
"length": 1,
"type": "uint8",
"description": "火焰检测状态"
},
{
"name": "fcuGZ_1L",
"offset": 102,
"length": 1,
"type": "uint8",
"description": "故障字1低字节"
},
{
"name": "fcuGZ_1H",
"offset": 103,
"length": 1,
"type": "uint8",
"description": "故障字1高字节"
},
{
"name": "fcuGZ_2L",
"offset": 104,
"length": 1,
"type": "uint8",
"description": "故障字2低字节"
},
{
"name": "fcuGZ_2H",
"offset": 105,
"length": 1,
"type": "uint8",
"description": "故障字2高字节"
},
{
"name": "fcuGZ_3L",
"offset": 106,
"length": 1,
"type": "uint8",
"description": "故障字3低字节"
},
{
"name": "fcuGZ_3H",
"offset": 107,
"length": 1,
"type": "uint8",
"description": "故障字3高字节"
},
{
"name": "insPosRelayState",
"offset": 108,
"length": 1,
"type": "uint8",
"description": "绝缘正极继电器状态"
},
{
"name": "insNegRelayState",
"offset": 109,
"length": 1,
"type": "uint8",
"description": "绝缘负极继电器状态"
},
{
"name": "powerPosRelayState",
"offset": 110,
"length": 1,
"type": "uint8",
"description": "功率正极继电器状态"
},
{
"name": "powerNegRelayState",
"offset": 111,
"length": 1,
"type": "uint8",
"description": "功率负极继电器状态"
},
{
"name": "insBatLimit",
"offset": 112,
"length": 2,
"type": "uint16",
"unit": "A",
"description": "绝缘电池电流限制"
},
{
"name": "powerBatLimit",
"offset": 114,
"length": 2,
"type": "uint16",
"unit": "A",
"description": "功率电池电流限制"
},
{
"name": "insBatSoc",
"offset": 116,
"length": 1,
"type": "uint8",
"unit": "%",
"description": "绝缘电池SOC"
},
{
"name": "powerBatSoc",
"offset": 117,
"length": 1,
"type": "uint8",
"unit": "%",
"description": "功率电池SOC"
},
{
"name": "insBatTotalElectricity",
"offset": 118,
"length": 2,
"type": "uint16",
"unit": "kWh",
"description": "绝缘电池总电量"
},
{
"name": "powerBatTotalElectricity",
"offset": 120,
"length": 2,
"type": "uint16",
"unit": "kWh",
"description": "功率电池总电量"
},
{
"name": "insBatCurrentElectricity",
"offset": 122,
"length": 2,
"type": "uint16",
"unit": "A",
"description": "绝缘电池当前电流"
},
{
"name": "powerBatCurrentElectricity",
"offset": 124,
"length": 2,
"type": "uint16",
"unit": "A",
"description": "功率电池当前电流"
},
{
"name": "insChargeState",
"offset": 126,
"length": 1,
"type": "uint8",
"description": "绝缘电池充电状态"
},
{
"name": "powerChargeState",
"offset": 127,
"length": 1,
"type": "uint8",
"description": "功率电池充电状态"
},
{
"name": "insLinkVoltage",
"offset": 128,
"length": 2,
"type": "uint16",
"unit": "V",
"description": "绝缘链路电压"
},
{
"name": "insPackVoltage",
"offset": 130,
"length": 2,
"type": "uint16",
"unit": "V",
"description": "绝缘电池组电压"
},
{
"name": "insCurrent",
"offset": 132,
"length": 2,
"type": "uint16",
"unit": "A",
"description": "绝缘电流"
},
{
"name": "insPosInsulationResistance",
"offset": 134,
"length": 2,
"type": "uint16",
"unit": "kΩ",
"description": "正极绝缘电阻"
},
{
"name": "insNegInsulationResistance",
"offset": 136,
"length": 2,
"type": "uint16",
"unit": "kΩ",
"description": "负极绝缘电阻"
},
{
"name": "powerLinkVoltage",
"offset": 138,
"length": 2,
"type": "uint16",
"unit": "V",
"description": "功率链路电压"
},
{
"name": "powerPackVoltage",
"offset": 140,
"length": 2,
"type": "uint16",
"unit": "V",
"description": "功率电池组电压"
},
{
"name": "powerCurrent",
"offset": 142,
"length": 2,
"type": "uint16",
"unit": "A",
"description": "功率电流"
},
{
"name": "powerPosInsulationResistance",
"offset": 144,
"length": 2,
"type": "uint16",
"unit": "kΩ",
"description": "功率正极绝缘电阻"
},
{
"name": "powerNegInsulationResistance",
"offset": 146,
"length": 2,
"type": "uint16",
"unit": "kΩ",
"description": "功率负极绝缘电阻"
},
{
"name": "insEmergencyStatusWord",
"offset": 148,
"length": 1,
"type": "uint8",
"description": "绝缘紧急状态字"
},
{
"name": "powerEmergencyStatusWord",
"offset": 149,
"length": 1,
"type": "uint8",
"description": "功率紧急状态字"
},
{
"name": "insAlarmIdentificationWord",
"offset": 150,
"length": 1,
"type": "uint8",
"description": "绝缘报警标识字"
},
{
"name": "powerAlarmIdentificationWord",
"offset": 151,
"length": 1,
"type": "uint8",
"description": "功率报警标识字"
},
{
"name": "insCurrentSocHold1",
"offset": 152,
"length": 1,
"type": "uint8",
"unit": "%",
"description": "绝缘电流SOC保持1"
},
{
"name": "insCurrentSocHold2",
"offset": 153,
"length": 1,
"type": "uint8",
"unit": "%",
"description": "绝缘电流SOC保持2"
},
{
"name": "insCurrentSocHold3",
"offset": 154,
"length": 1,
"type": "uint8",
"unit": "%",
"description": "绝缘电流SOC保持3"
},
{
"name": "fcuCurrentToInsLimit1",
"offset": 155,
"length": 1,
"type": "uint8",
"unit": "A",
"description": "FCU到绝缘限制1"
},
{
"name": "fcuCurrentToinsLimit2",
"offset": 156,
"length": 1,
"type": "uint8",
"unit": "A",
"description": "FCU到绝缘限制2"
},
{
"name": "powerCurrentSocHold1",
"offset": 157,
"length": 1,
"type": "uint8",
"unit": "%",
"description": "功率电流SOC保持1"
},
{
"name": "powerCurrentSocHold2",
"offset": 158,
"length": 1,
"type": "uint8",
"unit": "%",
"description": "功率电流SOC保持2"
},
{
"name": "powerCurrentSocHold3",
"offset": 159,
"length": 1,
"type": "uint8",
"unit": "%",
"description": "功率电流SOC保持3"
},
{
"name": "powerCurrentToInsLimit1",
"offset": 160,
"length": 1,
"type": "uint8",
"unit": "A",
"description": "功率到绝缘限制1"
},
{
"name": "powerCurrentToinsLimit2",
"offset": 161,
"length": 1,
"type": "uint8",
"unit": "A",
"description": "功率到绝缘限制2"
},
{
"name": "placeholder2",
"offset": 162,
"length": 4,
"type": "float32",
"description": "预留字段2"
},
{
"name": "placeholder3",
"offset": 166,
"length": 4,
"type": "float32",
"description": "预留字段3"
},
{
"name": "placeholder4",
"offset": 170,
"length": 4,
"type": "float32",
"description": "预留字段4"
},
{
"name": "placeholder5",
"offset": 174,
"length": 4,
"type": "float32",
"description": "预留字段5"
},
{
"name": "checkCode",
"offset": 178,
"length": 4,
"type": "uint32",
"description": "校验码(从start1到placeholder5的字节累加和)"
}
],
"metadata": {
"total_length": 182,
"data_section_start": 6,
"data_section_end": 178,
"checksum_range": "0-178",
"float_precision": "IEEE-754单精度",
"reserved_fields": [
"placeholder1",
"placeholder2",
"placeholder3",
"placeholder4",
"placeholder5"
]
}
}
@@ -1,142 +0,0 @@
{
"protocol_name": "高压A母线状态反馈",
"message_id": "0x0006",
"length": 10,
"checksum": {
"start_offset": 0,
"end_offset": 30,
"algorithm": "sum_low_byte"
},
"fields": [
{
"name": "start1",
"offset": 0,
"type": "uint8",
"value": "0x20",
"description": "起始字节1"
},
{
"name": "start2",
"offset": 1,
"type": "uint8",
"value": "0x20",
"description": "起始字节2"
},
{
"name": "id",
"offset": 2,
"type": "uint16",
"value": "0x0006",
"description": "消息ID"
},
{
"name": "length",
"offset": 4,
"type": "uint16",
"value": 10,
"description": "消息长度"
},
{
"name": "bowFTDevice123CircuitBreaker",
"offset": 6,
"type": "uint8",
"description": "艏部FT设备123断路器"
},
{
"name": "actuatorCircuitBreaker",
"offset": 7,
"type": "uint8",
"description": "执行机构断路器"
},
{
"name": "mastSteeringGearControlBoxCircuitBreaker",
"offset": 8,
"type": "uint8",
"description": "桅杆舵机控制箱断路器"
},
{
"name": "xczCircuitBreaker",
"offset": 9,
"type": "uint8",
"description": "XCZ断路器"
},
{
"name": "bowRudderControlBoxCircuitBreaker",
"offset": 10,
"type": "uint8",
"description": "艏舵控制箱断路器"
},
{
"name": "openWaterCoverStartCylinderCircuitBreaker",
"offset": 11,
"type": "uint8",
"description": "开盖启动气缸断路器"
},
{
"name": "instrumentPowerFailureSignal",
"offset": 12,
"type": "uint8",
"description": "仪表电源失效信号"
},
{
"name": "emergencyPowerFailureSignal",
"offset": 13,
"type": "uint8",
"description": "应急电源失效信号"
},
{
"name": "waterIngressionAlarm",
"offset": 14,
"type": "uint8",
"description": "进水报警"
},
{
"name": "busbarBVoltage",
"offset": 15,
"type": "uint16",
"description": "B排电压(V)"
},
{
"name": "busbarBCurrent",
"offset": 17,
"type": "uint16",
"description": "B排电流(A)"
},
{
"name": "bowFTDevice123Current",
"offset": 19,
"type": "uint16",
"description": "艏部FT设备123电流(A)"
},
{
"name": "actuatorCurrent",
"offset": 21,
"type": "uint16",
"description": "执行机构电流(A)"
},
{
"name": "mastSteeringGearControlBoxCurrent",
"offset": 23,
"type": "uint16",
"description": "桅杆舵机控制箱电流(A)"
},
{
"name": "xczCurrent",
"offset": 25,
"type": "uint16",
"description": "XCZ电流(A)"
},
{
"name": "bowRudderControlBoxCurrent",
"offset": 27,
"type": "uint16",
"description": "艏舵控制箱电流(A)"
},
{
"name": "openWaterCoverStartCylinderCurrent",
"offset": 29,
"type": "uint16",
"description": "开盖启动气缸电流(A)"
}
]
}
@@ -1,154 +0,0 @@
{
"protocol_name": "高压B母线状态反馈",
"message_id": "0x0007",
"length": 36,
"checksum": {
"start_offset": 0,
"end_offset": 34,
"algorithm": "sum_low_byte"
},
"fields": [
{
"name": "start1",
"offset": 0,
"type": "uint8",
"value": "0x20",
"description": "起始字节1"
},
{
"name": "start2",
"offset": 1,
"type": "uint8",
"value": "0x20",
"description": "起始字节2"
},
{
"name": "id",
"offset": 2,
"type": "uint16",
"value": "0x0007",
"description": "消息ID"
},
{
"name": "length",
"offset": 4,
"type": "uint16",
"value": 36,
"description": "消息长度(包含校验码)"
},
{
"name": "lithiumBatteryGroupInstrumentCircuitBreaker",
"offset": 6,
"type": "uint8",
"description": "锂电池组仪表断路器"
},
{
"name": "bowLowVoltageDistributionBoxCircuitBreaker",
"offset": 7,
"type": "uint8",
"description": "艏部低压配电箱断路器"
},
{
"name": "unit4InstrumentDC48VCircuitBreaker",
"offset": 8,
"type": "uint8",
"description": "单元4仪表DC48V断路器"
},
{
"name": "dcC1DCDistributionPanelCircuitBreaker",
"offset": 9,
"type": "uint8",
"description": "DC C1直流配电板断路器"
},
{
"name": "reservedCircuitBreaker1",
"offset": 10,
"type": "uint8",
"description": "备用断路器1"
},
{
"name": "reservedCircuitBreaker2",
"offset": 11,
"type": "uint8",
"description": "备用断路器2"
},
{
"name": "emergencyLithiumBatteryGroup2CircuitBreaker",
"offset": 12,
"type": "uint8",
"description": "应急锂电池组2断路器"
},
{
"name": "instrumentPowerFailureSignal",
"offset": 13,
"type": "uint8",
"description": "仪表电源故障信号"
},
{
"name": "emergencyPowerFailureSignal",
"offset": 14,
"type": "uint8",
"description": "应急电源故障信号"
},
{
"name": "instrumentBusbarVoltage",
"offset": 15,
"type": "uint16",
"description": "仪表母线电压(V)"
},
{
"name": "bowLowVoltageDistributionBoxCurrent",
"offset": 17,
"type": "uint16",
"description": "艏部低压配电箱电流(A)"
},
{
"name": "dcC1InstrumentDC48VCurrent",
"offset": 19,
"type": "uint16",
"description": "DC C1仪表DC48V电流(A)"
},
{
"name": "reservedCurrent1",
"offset": 21,
"type": "uint16",
"description": "备用电流1(A)"
},
{
"name": "emergencyLithiumBatteryGroup2Current",
"offset": 23,
"type": "uint16",
"description": "应急锂电池组2电流(A)"
},
{
"name": "lithiumBatteryGroupInstrumentCurrent",
"offset": 25,
"type": "uint16",
"description": "锂电池组仪表电流(A)"
},
{
"name": "unit4InstrumentDC48VCurrent",
"offset": 27,
"type": "uint16",
"description": "单元4仪表DC48V电流(A)"
},
{
"name": "reservedCurrent2",
"offset": 29,
"type": "uint16",
"description": "备用电流2(A)"
},
{
"name": "emergency2BusbarVoltage",
"offset": 31,
"type": "uint16",
"description": "应急2母线电压(V)"
},
{
"name": "compositeEnergyManagementSystemEmergencyDC48VCurrent",
"offset": 33,
"type": "uint16",
"description": "综合能源管理系统应急DC48V电流(A)"
}
]
}
@@ -1,184 +0,0 @@
{
"protocol_name": "高压母线状态反馈",
"message_id": "0x0005",
"length": 38,
"checksum": {
"start_offset": 0,
"end_offset": 37,
"algorithm": "sum_low_byte"
},
"fields": [
{
"name": "start1",
"offset": 0,
"type": "uint8",
"value": "0x20",
"description": "起始字节1"
},
{
"name": "start2",
"offset": 1,
"type": "uint8",
"value": "0x20",
"description": "起始字节2"
},
{
"name": "id",
"offset": 2,
"type": "uint16",
"value": "0x0005",
"description": "消息ID"
},
{
"name": "length",
"offset": 4,
"type": "uint16",
"value": 38,
"description": "消息长度"
},
{
"name": "DCB1",
"offset": 6,
"type": "uint8",
"description": "直流断路器1状态"
},
{
"name": "DCB2",
"offset": 7,
"type": "uint8",
"description": "直流断路器2状态"
},
{
"name": "ZK1",
"offset": 8,
"type": "uint8",
"description": "真空接触器1状态"
},
{
"name": "ZK2",
"offset": 9,
"type": "uint8",
"description": "真空接触器2状态"
},
{
"name": "ZK3",
"offset": 10,
"type": "uint8",
"description": "真空接触器3状态"
},
{
"name": "ZK4",
"offset": 11,
"type": "uint8",
"description": "真空接触器4状态"
},
{
"name": "ZK5",
"offset": 12,
"type": "uint8",
"description": "真空接触器5状态"
},
{
"name": "ZK6",
"offset": 13,
"type": "uint8",
"description": "真空接触器6状态"
},
{
"name": "ZK7",
"offset": 14,
"type": "uint8",
"description": "真空接触器7状态"
},
{
"name": "ZK8",
"offset": 15,
"type": "uint8",
"description": "真空接触器8状态"
},
{
"name": "ZK9",
"offset": 16,
"type": "uint8",
"description": "真空接触器9状态"
},
{
"name": "ZK10",
"offset": 17,
"type": "uint8",
"description": "真空接触器10状态"
},
{
"name": "busInsulationLow",
"offset": 18,
"type": "uint8",
"description": "母线绝缘低报警"
},
{
"name": "busAInsulationHigh",
"offset": 19,
"type": "uint8",
"description": "A母线绝缘高报警"
},
{
"name": "lostPower",
"offset": 20,
"type": "uint8",
"description": "失电信号"
},
{
"name": "lostEmerPower",
"offset": 21,
"type": "uint8",
"description": "应急失电信号"
},
{
"name": "powerBusVoltage",
"offset": 22,
"type": "uint16",
"description": "动力母线电压(V)"
},
{
"name": "dcDc5ModuleCurrent",
"offset": 24,
"type": "uint16",
"description": "DC/DC5模块电流(A)"
},
{
"name": "powerBusCurrent",
"offset": 26,
"type": "uint16",
"description": "动力母线电流(A)"
},
{
"name": "busbarAVoltage",
"offset": 28,
"type": "uint16",
"description": "A排电压(V)"
},
{
"name": "propulsionMotorControlBoxCurrent",
"offset": 30,
"type": "uint16",
"description": "推进电机控制箱电流(A)"
},
{
"name": "busbarACurrent",
"offset": 32,
"type": "uint16",
"description": "A排电流(A)"
},
{
"name": "lithiumBatteryGroupMeterCurrent",
"offset": 34,
"type": "uint16",
"description": "锂电池组表计电流(A)"
},
{
"name": "bowHighVoltageDistributionBoxCurrent",
"offset": 36,
"type": "uint16",
"description": "艏部高压配电箱电流(A)"
}
]
}
-3
View File
@@ -1,3 +0,0 @@
{
"value_array_uint16" :[2,1,3]
}
-64
View File
@@ -1,64 +0,0 @@
{
"DVL" : 0,
"USBL" : 0,
"bowCover1" : 0,
"bowCover2" : 0,
"bowCover3" : 0,
"bowCover4" : 0,
"bowCover5" : 0,
"bowCover6" : 0,
"bowRudderDeploy" : 0,
"bowRudderServo1" : 0,
"bowRudderServo2" : 0,
"bowThrow" : 0,
"bowWaterInet1" : 0,
"bowWaterInet2" : 0,
"bowWaterInet3" : 0,
"bowWaterInet4" : 0,
"bowWaterInet5" : 0,
"bowWaterInet6" : 0,
"bowWaterInet7" : 0,
"bowWaterInet8" : 0,
"buoyage" : 0,
"buoyancyAdjust1" : 0,
"buoyancyAdjust2" : 0,
"buoyancyAdjust3" : 0,
"buoyancyAdjust4" : 0,
"buoyancyAdjust5" : 0,
"commMast" : 0,
"ctd1" : 0,
"ctd2" : 0,
"depth1" : 0,
"depth2" : 0,
"depth3" : 0,
"electSensor" : 0,
"forwardSonar" : 0,
"inputWaterSensor1" : 0,
"inputWaterSensor2" : 0,
"inputWaterSensor3" : 0,
"ins" : 0,
"launchControler" : 0,
"lowFreqSonar" : 0,
"mastLiftingServo" : 0,
"ntp" : 0,
"overDeep1" : 0,
"overDeep2" : 0,
"photoSensor" : 0,
"sideSonar" : 0,
"singleBeamSonar1" : 0,
"singleBeamSonar2" : 0,
"singleBeamSonar3" : 0,
"singleBeamSonar4" : 0,
"singleBeamSonar5" : 0,
"singleBeamSonar6" : 0,
"singleBeamSonar7" : 0,
"singleBeamSonar8" : 0,
"soundVeloc" : 0,
"sternRudderServo1" : 0,
"sternRudderServo2" : 0,
"sternRudderServo3" : 0,
"sternRudderServo4" : 0,
"sternThrow" : 0,
"thruster" : 0,
"waterInject" : 0
}
@@ -1,4 +0,0 @@
{
"id_uint8" : 1,
"cmd_uint8" : 1
}
@@ -1,3 +0,0 @@
{
"state_uint8" : 12
}
@@ -1,3 +0,0 @@
{
"state_uint8" : 1
}
@@ -1,3 +0,0 @@
{
"powerCmd_uint8" :1
}
-4
View File
@@ -1,4 +0,0 @@
{
"stamp_fp64" : 0,
"op_int32" : 1
}
-38
View File
@@ -1,38 +0,0 @@
{
"balanceEnabled_bool" : false,
"bowRudderUnfold_bool" : false,
"depthPoints_array_fp32" :
[
0.0
],
"desiredDepth_fp32" : 0,
"desiredHeight_fp32" : 0,
"desiredSpeed_fp32" : 2,
"destination_array_fp64" :
[
20.650305473106499,
111.4256434229589
],
"estimatedConsume_fp32" : 0,
"estimatedTime_fp32" : 0,
"fixedType_int32" : 1,
"latPoints_array_fp64" :
[
20.650305473106499
],
"lonPoints_array_fp64" :
[
111.4256434229589
],
"pastPointIndex_int32" : -1,
"pathLength_fp32" : 0,
"pointID_array_str" :
[
"68991759_0"
],
"source_int32" : 1,
"speedType_int32" : 2,
"taskID_int32" : 68991759,
"taskName_str" : "Goto2",
"taskType_str" : "sail"
}
-64
View File
@@ -1,64 +0,0 @@
{
"DVL" : 0,
"USBL" : 0,
"bowCover1" : 0,
"bowCover2" : 0,
"bowCover3" : 0,
"bowCover4" : 0,
"bowCover5" : 0,
"bowCover6" : 0,
"bowRudderDeploy" : 0,
"bowRudderServo1" : 0,
"bowRudderServo2" : 0,
"bowThrow" : 0,
"bowWaterInet1" : 0,
"bowWaterInet2" : 0,
"bowWaterInet3" : 0,
"bowWaterInet4" : 0,
"bowWaterInet5" : 0,
"bowWaterInet6" : 0,
"bowWaterInet7" : 0,
"bowWaterInet8" : 0,
"buoyage" : 0,
"buoyancyAdjust1" : 0,
"buoyancyAdjust2" : 0,
"buoyancyAdjust3" : 0,
"buoyancyAdjust4" : 0,
"buoyancyAdjust5" : 0,
"commMast" : 0,
"ctd1" : 0,
"ctd2" : 0,
"depth1" : 0,
"depth2" : 0,
"depth3" : 0,
"electSensor" : 0,
"forwardSonar" : 0,
"inputWaterSensor1" : 0,
"inputWaterSensor2" : 0,
"inputWaterSensor3" : 0,
"ins" : 0,
"launchControler" : 0,
"lowFreqSonar" : 0,
"mastLiftingServo" : 0,
"ntp" : 0,
"overDeep1" : 0,
"overDeep2" : 0,
"photoSensor" : 0,
"sideSonar" : 0,
"singleBeamSonar1" : 0,
"singleBeamSonar2" : 0,
"singleBeamSonar3" : 0,
"singleBeamSonar4" : 0,
"singleBeamSonar5" : 0,
"singleBeamSonar6" : 0,
"singleBeamSonar7" : 0,
"singleBeamSonar8" : 0,
"soundVeloc" : 0,
"sternRudderServo1" : 0,
"sternRudderServo2" : 0,
"sternRudderServo3" : 0,
"sternRudderServo4" : 0,
"sternThrow" : 0,
"thruster" : 0,
"waterInject" : 0
}
-5
View File
@@ -1,5 +0,0 @@
{
"powerCMD":4,
"modCMD":1,
"workCMD":12
}
@@ -1796,10 +1796,12 @@ void PowerManagerFsm::basicNavigationFault()
if(pm->m_systemData->device_common_status.ccu_status.isTimeout)
{
pm->m_systemData->insertFaultCode(0x1413);
LOG_F(INFO, "复合管控器失效");
}
else
{
pm->m_systemData->eraseFaultCode(0x1413);
LOC_F(INFO, "复合管控器恢复");
}
}
void PowerManagerFsm::basicNavigationFault(FaultEvent const &e)
+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"] = "";
+24 -12
View File
@@ -3,6 +3,7 @@ from tkinter import ttk
import socket
import threading
import time
import struct
from db import DB
import os
from udpMsg import (
@@ -15,6 +16,10 @@ from udpMsg import (
msg_disLVMBCmdMsg,
msg_disLVBCmdMsg
)
from ccuMsg import (
msg_ccUFbMsg,
# msg_ccUCmdMsg
)
class PowerManagerApp:
def __init__(self, root):
@@ -32,6 +37,7 @@ class PowerManagerApp:
self.simulation_HVBACmdMsg = msg_disHVBACmdMsg()
self.simulation_LVMBCmdMsg = msg_disLVMBCmdMsg()
self.simulation_LVBCmdMsg = msg_disLVBCmdMsg()
self.simulation_ccUFbMsg = msg_ccUFbMsg()
# 菜单栏复选框状态变量
self.menu_checkbox_vars = {
@@ -1774,27 +1780,33 @@ class PowerManagerApp:
# time.sleep(0.1) # 1秒间隔
# 处理高压母线数据
packed_data = self.simulation_HighVolBusFbMsg.pack()
error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(error_packed_data, self.udp_ip, self.udp_control_port)
# time.sleep(0.1)
# error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(packed_data, self.udp_ip, self.udp_control_port)
time.sleep(0.01)
# 处理高压A母线数据
packed_data = self.simulation_HighAVolBusFbMsg.pack()
error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(error_packed_data, self.udp_ip, self.udp_control_port)
# time.sleep(0.01)
# error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(packed_data, self.udp_ip, self.udp_control_port)
time.sleep(0.01)
# 处理低压母线数据
packed_data = self.simulation_LowBusFbMsg.pack()
error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(error_packed_data, self.udp_ip, self.udp_control_port)
# time.sleep(0.01)
# error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(packed_data, self.udp_ip, self.udp_control_port)
time.sleep(0.01)
# 处理仪表主母线数据
packed_data = self.simulation_LowMainBusFbMsg.pack()
error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(error_packed_data, self.udp_ip, self.udp_control_port)
time.sleep(0.01) # 1秒间隔
# error_packed_data = packed_data[:-1] + b'\x00' # 修改校验位为0x00
self.send_udp_command(packed_data, self.udp_ip, self.udp_control_port)
time.sleep(0.01)
packed_data = self.simulation_ccUFbMsg.pack()
self.send_udp_command(packed_data, self.udp_ip, self.udp_control_port)
time.sleep(0.01)
time.sleep(0.7) # 循环间隔
def on_connection_changed(self, *args):
"""连接状态改变回调"""
if self.Start_Connection.get():
+218 -398
View File
@@ -3,152 +3,150 @@ import datetime
class msg_ccUFbMsg:
def __init__(self):
# 消息头
# 消息头 - 对应C++中的m_header
self.start1 = 0x20
self.start2 = 0x20
self.id = 0x0051 # CCU_STATE_FB_ID
self.length = 0
self.checkCode = 0x00
self.checkCode = 0 # 使用4字节校验码,对应C++中的Checksum (unsigned int)
# CCU状态数据 - 根据ccuState结构体定义
self.fc_mode = 0x00
self.fc_status = 0x00
self.fc_fault_level = 0x00
# CCU状态数据 - 完全对应C++中的ccuState结构体
self.fc_mode = 0x00 # 燃料电池系统运行模式:00H-无效, 01H-调试, 02H-自动, 03H-补给
self.fc_status = 0x00 # 燃料电池状态:00H-无效, 01H-初始化, ..., 0DH-维护完成
self.fc_fault_level = 0x00 # 燃料电池故障等级:00H-无故障, 10H-一级, 20H-二级, 30H-三级, 40H-四级
self.output_power_limit = 0 # 系统输出功率限制值,单位:W,范围:0~30000W
self.total_generation_time = 0 # 系统累计发电时间,单位:0.1小时,最大值6553.5小时
self.total_generation_power = 0 # 系统累计发电总功率,单位:W
self.fault_level_1 = 0 # 一级故障位,按位表示不同的故障项
self.fault_level_2 = 0 # 二级故障位
self.fault_level_3 = 0 # 三级故障位
self.fault_level_4 = 0 # 四级故障位
self.hydrogen_capacity = 0 # 储氢罐剩余容量百分比,单位:%,范围:0~100
self.liquid_oxygen_capacity = 0 # 液氧罐剩余容量百分比,单位:%,范围:0~100
self.palladium_temp = 0 # 钯膜最高温度,单位:℃
self.main_pipe_pressure = 0 # 主水路压力,单位:0.01kPa
self.aux_pipe_pressure = 0 # 辅水路压力,单位:0.01kPa
self.cabin_pressure1 = 0 # 舱室1压力,单位:0.01kPa
self.cabin_pressure2 = 0 # 舱室2压力,单位:0.01kPa
self.cabin_temp1 = 0 # 舱室1温度,单位:0.01℃
self.cabin_temp2 = 0 # 舱室2温度,单位:0.01℃
self.cabin_humidity1 = 0 # 舱室1湿度,单位:0.01%RH
self.cabin_humidity2 = 0 # 舱室2湿度,单位:0.01%RH
self.flame_detector1 = 0x00 # 火焰探测器1状态:00H-无效, 01H-报警, 02H-故障
self.flame_detector2 = 0x00 # 火焰探测器2状态:00H-无效, 01H-报警, 02H-故障
self.h2_concentration1 = 0 # 舱室H2浓度1,单位:0.01% LEL
self.h2_concentration2 = 0 # 舱室H2浓度2,单位:0.01% LEL
self.h2_concentration3 = 0 # 舱室H2浓度3,单位:0.01% LEL
self.o2_concentration1 = 0 # 舱室O2浓度1,单位:0.01% LEL
self.o2_concentration2 = 0 # 舱室O2浓度2,单位:0.01% LEL
self.ch3oh_concentration1 = 0 # 舱室甲醇气体浓度1,单位:0.01% LEL
self.ch3oh_concentration2 = 0 # 舱室甲醇气体浓度2,单位:0.01% LEL
self.reserved1 = [0, 0] # 保留字段前2个元素
self.emergency_battery1_voltage = 0 # 应急电池1总电压 [V]
self.emergency_battery1_current = 0 # 应急电池1总电流 [A]
self.emergency_battery1_max_temp = 0 # 应急电池1最高温度 [°C]
self.emergency_battery1_fault_word = 0 # 应急电池1故障字
self.emergency_battery2_voltage = 0 # 应急电池2总电压 [V]
self.emergency_battery2_current = 0 # 应急电池2总电流 [A]
self.emergency_battery2_max_temp = 0 # 应急电池2最高温度 [°C]
self.emergency_battery2_fault_word = 0 # 应急电池2故障字
self.output_power_limit = 0
self.total_generation_time = 0
self.total_generation_power = 0
self.fault_level_1 = 0
self.fault_level_2 = 0
self.fault_level_3 = 0
self.fault_level_4 = 0
self.cabin_ox_concentration = 0 # 仪表舱内氧气浓度 [%]
self.cabin_temperature = 0 # 仪表舱内温度 [°C]
self.cabin_humidity = 0 # 仪表舱内湿度 [%RH]
self.cabin_pressure = 0 # 仪表舱内大气压 [kPa]
self.power_cabin_ox_concentration = 0 # 动力舱内氧气浓度 [%]
self.power_cabin_temperature = 0 # 动力舱内温度 [°C]
self.power_cabin_humidity = 0 # 动力舱内湿度 [%RH]
self.power_cabin_pressure = 0 # 动力舱内大气压 [kPa]
self.reserved2 = [0] # 保留字段,地址范围54~55,共2个uint8_t,协议预留
self.dyn_alarm_flag = [0] * 6 # 动力锂电池报警标志字数组,共6字节,按位表示各类报警
self.ins_alarm_flag = [0] * 6 # 仪表锂电池报警标志字数组,共6字节,按位表示各类报警
self.ins_relay_status1 = 0x00 # 仪表电池继电器状态,高4位表示正极继电器,低4位表示充电继电器
self.ins_relay_status2 = 0x00 # 仪表电池预充继电器和负极继电器状态
self.dyn_relay_status1 = 0x00 # 动力电池正极与充电继电器状态
self.dyn_relay_status2 = 0x00 # 动力电池预充与负极继电器状态
self.ins_max_discharge_power = 0 # 仪表电池最大允许放电功率,单位:kW,精度0.05kW
self.dyn_max_discharge_power = 0 # 动力电池最大允许放电功率,单位:kW,精度0.05kW
self.ins_soc = 0 # 仪表锂电池荷电状态SOC,范围:0~100
self.dyn_soc = 0 # 动力锂电池荷电状态SOC,范围:0~100
self.ins_total_energy = 0 # 仪表电池总能量,单位:kWh
self.dyn_total_energy = 0 # 动力电池总能量,单位:kWh
self.ins_power_input = 0 # 仪表电池输入功率,单位:kW
self.dyn_power_input = 0 # 动力电池输入功率,单位:kW
self.ins_charge_status = 0x00 # 仪表电池充放电状态:00H-无效,10H-充电,20H-放电
self.dyn_charge_status = 0x00 # 动力电池充放电状态:00H-无效,10H-充电,20H-放电
self.ins_voltage_link = 0 # 仪表电池LINK端电压,单位:0.01V
self.ins_voltage_pack = 0 # 仪表电池PACK端电压,单位:0.01V
self.ins_current = 0 # 仪表电池电流,单位:0.01A(正值放电)
self.ins_resistance_pos = 0 # 仪表电池正极绝缘电阻,单位:kΩ
self.ins_resistance_neg = 0 # 仪表电池负极绝缘电阻,单位:kΩ
self.dyn_voltage_link = 0 # 动力电池LINK端电压,单位:0.01V
self.dyn_voltage_pack = 0 # 动力电池PACK端电压,单位:0.01V
self.dyn_current = 0 # 动力电池电流,单位:0.01A(正值放电)
self.dyn_resistance_pos = 0 # 动力电池正极绝缘电阻,单位:kΩ
self.dyn_resistance_neg = 0 # 动力电池负极绝缘电阻,单位:kΩ
self.ins_emergency_status = 0x00 # 仪表电池紧急状态字,按位表示异常或告警状态
self.dyn_emergency_status = 0x00 # 动力电池紧急状态字,按位表示异常或告警状态
self.reserved3 = [0] * 2 # 保留字节,协议预留
self.ins_soc_threshold1 = 0 # 仪表电池1 SOC门限,范围:0~100
self.ins_soc_threshold2 = 0 # 仪表电池2 SOC门限,范围:0~100
self.ins_soc_threshold3 = 0 # 仪表电池3 SOC门限,范围:0~100
self.dyn_soc_threshold1 = 0 # 动力电池1 SOC门限,范围:0~100
self.dyn_soc_threshold2 = 0 # 动力电池2 SOC门限,范围:0~100
self.dyn_soc_threshold3 = 0 # 动力电池3 SOC门限,范围:0~100
self.ins_power_limit1 = 0 # 仪表电池1功率限制值,单位:%
self.ins_power_limit2 = 0 # 仪表电池2功率限制值,单位:%
self.dyn_power_limit1 = 0 # 动力电池1功率限制值,单位:%
self.dyn_power_limit2 = 0 # 动力电池2功率限制值,单位:%
self.device_online_flag1 = 0 # 设备在线状态标志1,byte0:低压配电板在线标志位 byte1:复合管控主机在线标志位 byte2:复合管控备机在线标志位
self.device_online_flag2 = 0 # 设备在线状态标志2,byte0:仪表锂电在线标志位 byte1:动力锂电在线标志位 byte2:燃电锂电在线标志位 byte3:高压配电板在线标志位
self.hydrogen_capacity = 0
self.liquid_oxygen_capacity = 0
self.palladium_temp = 0
self.main_pipe_pressure = 0
self.aux_pipe_pressure = 0
self.cabin_pressure1 = 0
self.cabin_pressure2 = 0
self.cabin_temp1 = 0
self.cabin_temp2 = 0
self.cabin_humidity1 = 0
self.cabin_humidity2 = 0
self.flame_detector1 = 0x00
self.flame_detector2 = 0x00
self.h2_concentration1 = 0
self.h2_concentration2 = 0
self.h2_concentration3 = 0
self.o2_concentration1 = 0
self.o2_concentration2 = 0
self.ch3oh_concentration1 = 0
self.ch3oh_concentration2 = 0
self.reserved1 = [0, 0]
self.emergency_battery1_voltage = 0
self.emergency_battery1_current = 0
self.emergency_battery1_max_temp = 0
self.emergency_battery1_fault_word = 0
self.emergency_battery2_voltage = 0
self.emergency_battery2_current = 0
self.emergency_battery2_max_temp = 0
self.emergency_battery2_fault_word = 0
self.cabin_ox_concentration = 0
self.cabin_temperature = 0
self.cabin_humidity = 0
self.cabin_pressure = 0
self.power_cabin_ox_concentration = 0
self.power_cabin_temperature = 0
self.power_cabin_humidity = 0
self.power_cabin_pressure = 0
self.reserved2 = [0]
self.dyn_alarm_flag = [0] * 6
self.ins_alarm_flag = [0] * 6
self.ins_relay_status1 = 0x00
self.ins_relay_status2 = 0x00
self.dyn_relay_status1 = 0x00
self.dyn_relay_status2 = 0x00
self.ins_max_discharge_power = 0
self.dyn_max_discharge_power = 0
self.ins_soc = 0
self.dyn_soc = 0
self.ins_total_energy = 0
self.dyn_total_energy = 0
self.ins_power_input = 0
self.dyn_power_input = 0
self.ins_charge_status = 0x00
self.dyn_charge_status = 0x00
self.ins_voltage_link = 0
self.ins_voltage_pack = 0
self.ins_current = 0
self.ins_resistance_pos = 0
self.ins_resistance_neg = 0
self.dyn_voltage_link = 0
self.dyn_voltage_pack = 0
self.dyn_current = 0
self.dyn_resistance_pos = 0
self.dyn_resistance_neg = 0
self.ins_emergency_status = 0x00
self.dyn_emergency_status = 0x00
self.reserved3 = [0] * 2
self.ins_soc_threshold1 = 0
self.ins_soc_threshold2 = 0
self.ins_soc_threshold3 = 0
self.dyn_soc_threshold1 = 0
self.dyn_soc_threshold2 = 0
self.dyn_soc_threshold3 = 0
self.ins_power_limit1 = 0
self.ins_power_limit2 = 0
self.dyn_power_limit1 = 0
self.dyn_power_limit2 = 0
self.device_online_flag1 = 0
self.device_online_flag2 = 0
self.dyn_charge_level = 0x00
self.dyn_water_leak_status = 0x00
self.ins_water_leak_dcdc_status = 0x00
self.dyn_charge_level = 0x00 # 动力电池充电状态:01H-1级(不限), 02H-2级(限功率), 03H-3级(关闭)
self.dyn_water_leak_status = 0x00 # 动力漏水状态:0XH-正常, 1XH-异常漏水
self.ins_water_leak_dcdc_status = 0x00 # 仪表漏水状态与DCDC状态:低4位-漏水状态(0XH正常,1XH异常),高4位-DCDC状态(X0H正常,X1H故障)
self.reserved4 = 0x00
self.heartbeat = 0
self.heartbeat = 0 # 主机心跳计数器或标志值
def pack(self):
"""打包消息为字节数据"""
"""打包消息为字节数据 - 完全对应C++中的msg_CcuStateFbMsg结构体"""
# 重置校验码
self.checkCode = 0x00
self.checkCode = 0
# 打包消息头
data = struct.pack('<BBHH',
self.start1,
self.start2,
self.id,
self.length)
# 首先打包CCU状态数据(不包括消息头和校验码)
body_data = b''
# 打包CCU状态数据
data += struct.pack('<BBB',
# 打包CCU状态数据 - 完全对应C++中的ccuState结构体
# 第一部分:基本状态
body_data += struct.pack('<BBB',
self.fc_mode,
self.fc_status,
self.fc_fault_level)
data += struct.pack('<HHHHHHH',
# 第二部分:功率和时间
body_data += struct.pack('<HHHHHHH',
self.output_power_limit,
self.total_generation_time,
self.total_generation_power,
@@ -157,16 +155,19 @@ class msg_ccUFbMsg:
self.fault_level_3,
self.fault_level_4)
data += struct.pack('<BB',
# 第三部分:容量
body_data += struct.pack('<BB',
self.hydrogen_capacity,
self.liquid_oxygen_capacity)
data += struct.pack('<HHH',
# 第四部分:温度和压力
body_data += struct.pack('<HHH',
self.palladium_temp,
self.main_pipe_pressure,
self.aux_pipe_pressure)
data += struct.pack('<HHHHHH',
# 第五部分:舱室环境
body_data += struct.pack('<HHHHHH',
self.cabin_pressure1,
self.cabin_pressure2,
self.cabin_temp1,
@@ -174,11 +175,13 @@ class msg_ccUFbMsg:
self.cabin_humidity1,
self.cabin_humidity2)
data += struct.pack('<BB',
# 第六部分:火焰探测器
body_data += struct.pack('<BB',
self.flame_detector1,
self.flame_detector2)
data += struct.pack('<HHHHHHH',
# 第七部分:气体浓度
body_data += struct.pack('<HHHHHHH',
self.h2_concentration1,
self.h2_concentration2,
self.h2_concentration3,
@@ -187,8 +190,8 @@ class msg_ccUFbMsg:
self.ch3oh_concentration1,
self.ch3oh_concentration2)
# 保留字段和应急电池数据
data += struct.pack('<HHHHHHHH',
# 第八部分:保留字段和应急电池数据
body_data += struct.pack('<HHHHHHHH',
self.reserved1[0], self.reserved1[1],
self.emergency_battery1_voltage,
self.emergency_battery1_current,
@@ -197,13 +200,14 @@ class msg_ccUFbMsg:
self.emergency_battery2_voltage,
self.emergency_battery2_current)
data += struct.pack('<HHHH',
body_data += struct.pack('<HHHH',
self.emergency_battery2_max_temp,
self.emergency_battery2_fault_word,
self.cabin_ox_concentration,
self.cabin_temperature)
data += struct.pack('<HHHHHHHH',
# 第九部分:舱室环境2
body_data += struct.pack('<HHHHHHHH',
self.cabin_humidity,
self.cabin_pressure,
self.power_cabin_ox_concentration,
@@ -212,21 +216,21 @@ class msg_ccUFbMsg:
self.power_cabin_pressure,
self.reserved2[0], 0) # 填充第二个reserved2字节
# 报警标志数组
# 第十部分:报警标志数组
for flag in self.dyn_alarm_flag:
data += struct.pack('<B', flag)
body_data += struct.pack('<B', flag)
for flag in self.ins_alarm_flag:
data += struct.pack('<B', flag)
body_data += struct.pack('<B', flag)
# 继电器状态
data += struct.pack('<BBBB',
# 第十一部分:继电器状态
body_data += struct.pack('<BBBB',
self.ins_relay_status1,
self.ins_relay_status2,
self.dyn_relay_status1,
self.dyn_relay_status2)
# 功率和SOC数据
data += struct.pack('<HHBBHHHH',
# 第十二部分:功率和SOC数据
body_data += struct.pack('<HHBBHHHH',
self.ins_max_discharge_power,
self.dyn_max_discharge_power,
self.ins_soc,
@@ -236,13 +240,13 @@ class msg_ccUFbMsg:
self.ins_power_input,
self.dyn_power_input)
# 充电状态
data += struct.pack('<BB',
# 第十三部分:充电状态
body_data += struct.pack('<BB',
self.ins_charge_status,
self.dyn_charge_status)
# 电压电流和绝缘电阻
data += struct.pack('<HHHHHHHHHH',
# 第十四部分:电压电流和绝缘电阻
body_data += struct.pack('<HHHHHHHHHH',
self.ins_voltage_link,
self.ins_voltage_pack,
self.ins_current,
@@ -254,16 +258,16 @@ class msg_ccUFbMsg:
self.dyn_resistance_pos,
self.dyn_resistance_neg)
# 紧急状态和保留字段
data += struct.pack('<BB',
# 第十五部分:紧急状态和保留字段
body_data += struct.pack('<BB',
self.ins_emergency_status,
self.dyn_emergency_status)
data += struct.pack('<BB',
body_data += struct.pack('<BB',
self.reserved3[0], self.reserved3[1])
# SOC门限值
data += struct.pack('<BBBBBB',
# 第十六部分:SOC门限值
body_data += struct.pack('<BBBBBB',
self.ins_soc_threshold1,
self.ins_soc_threshold2,
self.ins_soc_threshold3,
@@ -271,41 +275,54 @@ class msg_ccUFbMsg:
self.dyn_soc_threshold2,
self.dyn_soc_threshold3)
# 功率限制值
data += struct.pack('<BBBB',
# 第十七部分:功率限制值
body_data += struct.pack('<BBBB',
self.ins_power_limit1,
self.ins_power_limit2,
self.dyn_power_limit1,
self.dyn_power_limit2)
# 设备在线状态和心跳
data += struct.pack('<II',
# 第十八部分:设备在线状态和心跳
body_data += struct.pack('<II',
self.device_online_flag1,
self.device_online_flag2)
data += struct.pack('<BBBB',
body_data += struct.pack('<BBBB',
self.dyn_charge_level,
self.dyn_water_leak_status,
self.ins_water_leak_dcdc_status,
self.reserved4)
data += struct.pack('<I', self.heartbeat)
body_data += struct.pack('<I', self.heartbeat)
# 计算校验码
# 计算长度字段:body_data的长度
self.length = len(body_data)
# 打包消息头 - 对应C++中的m_header
header_data = struct.pack('<BBHH',
self.start1,
self.start2,
self.id,
self.length)
# 组合头部和body数据
data_without_checksum = header_data + body_data
# 计算校验码 - 根据C++代码,计算所有数据的和(不包括校验码本身)
self.checkCode = 0
for byte in data:
self.checkCode = (self.checkCode + byte) & 0xFF
for byte in data_without_checksum:
self.checkCode += byte
# 添加校验码
data += struct.pack('<B', self.checkCode)
# 添加校验码 - 使用4字节,对应C++中的Checksum (unsigned int)
checksum_data = struct.pack('<I', self.checkCode)
# 更新长度字段
self.length = len(data) - 6 # 减去头部6字节
# 完整数据:头部 + body + 校验码
full_data = data_without_checksum + checksum_data
return data
return full_data
def unpack(self, data):
"""从字节数据解包消息"""
"""从字节数据解包消息 - 完全对应C++中的msg_CcuStateFbMsg结构体"""
if len(data) < 10: # 最小消息长度检查
return False
@@ -317,30 +334,37 @@ class msg_ccUFbMsg:
offset = 6 # 头部结束位置
# 检查数据长度是否足够
if len(data) < offset + self.length + 1: # +1 for checksum
# 检查数据长度是否足够(现在校验码是4字节)
if len(data) < offset + self.length + 4: # +4 for 4-byte checksum
return False
# 解析CCU状态数据
# 解析CCU状态数据 - 完全对应C++中的ccuState结构体
# 第一部分:基本状态
(self.fc_mode, self.fc_status, self.fc_fault_level) = struct.unpack_from('<BBB', data, offset); offset += 3
# 第二部分:功率和时间
(self.output_power_limit, self.total_generation_time, self.total_generation_power,
self.fault_level_1, self.fault_level_2, self.fault_level_3, self.fault_level_4) = struct.unpack_from('<HHHHHHH', data, offset); offset += 14
# 第三部分:容量
(self.hydrogen_capacity, self.liquid_oxygen_capacity) = struct.unpack_from('<BB', data, offset); offset += 2
# 第四部分:温度和压力
(self.palladium_temp, self.main_pipe_pressure, self.aux_pipe_pressure) = struct.unpack_from('<HHH', data, offset); offset += 6
# 第五部分:舱室环境
(self.cabin_pressure1, self.cabin_pressure2, self.cabin_temp1, self.cabin_temp2,
self.cabin_humidity1, self.cabin_humidity2) = struct.unpack_from('<HHHHHH', data, offset); offset += 12
# 第六部分:火焰探测器
(self.flame_detector1, self.flame_detector2) = struct.unpack_from('<BB', data, offset); offset += 2
# 第七部分:气体浓度
(self.h2_concentration1, self.h2_concentration2, self.h2_concentration3,
self.o2_concentration1, self.o2_concentration2, self.ch3oh_concentration1,
self.ch3oh_concentration2) = struct.unpack_from('<HHHHHHH', data, offset); offset += 14
# 保留字段和应急电池数据
# 第八部分:保留字段和应急电池数据
(self.reserved1[0], self.reserved1[1], self.emergency_battery1_voltage,
self.emergency_battery1_current, self.emergency_battery1_max_temp,
self.emergency_battery1_fault_word, self.emergency_battery2_voltage,
@@ -349,49 +373,50 @@ class msg_ccUFbMsg:
(self.emergency_battery2_max_temp, self.emergency_battery2_fault_word,
self.cabin_ox_concentration, self.cabin_temperature) = struct.unpack_from('<HHHH', data, offset); offset += 8
# 第九部分:舱室环境2
(self.cabin_humidity, self.cabin_pressure, self.power_cabin_ox_concentration,
self.power_cabin_temperature, self.power_cabin_humidity, self.power_cabin_pressure,
reserved2_0, reserved2_1) = struct.unpack_from('<HHHHHHBB', data, offset); offset += 16
self.reserved2 = [reserved2_0, reserved2_1]
# 报警标志数组
# 第十部分:报警标志数组
for i in range(6):
self.dyn_alarm_flag[i] = data[offset]; offset += 1
for i in range(6):
self.ins_alarm_flag[i] = data[offset]; offset += 1
# 继电器状态
# 第十一部分:继电器状态
(self.ins_relay_status1, self.ins_relay_status2,
self.dyn_relay_status1, self.dyn_relay_status2) = struct.unpack_from('<BBBB', data, offset); offset += 4
# 功率和SOC数据
# 第十二部分:功率和SOC数据
(self.ins_max_discharge_power, self.dyn_max_discharge_power,
self.ins_soc, self.dyn_soc, self.ins_total_energy, self.dyn_total_energy,
self.ins_power_input, self.dyn_power_input) = struct.unpack_from('<HHBBHHHH', data, offset); offset += 14
# 充电状态
# 第十三部分:充电状态
(self.ins_charge_status, self.dyn_charge_status) = struct.unpack_from('<BB', data, offset); offset += 2
# 电压电流和绝缘电阻
# 第十四部分:电压电流和绝缘电阻
(self.ins_voltage_link, self.ins_voltage_pack, self.ins_current,
self.ins_resistance_pos, self.ins_resistance_neg, self.dyn_voltage_link,
self.dyn_voltage_pack, self.dyn_current, self.dyn_resistance_pos,
self.dyn_resistance_neg) = struct.unpack_from('<HHHHHHHHHH', data, offset); offset += 20
# 紧急状态和保留字段
# 第十五部分:紧急状态和保留字段
(self.ins_emergency_status, self.dyn_emergency_status) = struct.unpack_from('<BB', data, offset); offset += 2
(self.reserved3[0], self.reserved3[1]) = struct.unpack_from('<BB', data, offset); offset += 2
# SOC门限值
# 第十六部分:SOC门限值
(self.ins_soc_threshold1, self.ins_soc_threshold2, self.ins_soc_threshold3,
self.dyn_soc_threshold1, self.dyn_soc_threshold2, self.dyn_soc_threshold3) = struct.unpack_from('<BBBBBB', data, offset); offset += 6
# 功率限制值
# 第十七部分:功率限制值
(self.ins_power_limit1, self.ins_power_limit2,
self.dyn_power_limit1, self.dyn_power_limit2) = struct.unpack_from('<BBBB', data, offset); offset += 4
# 设备在线状态和心跳
# 第十八部分:设备在线状态和心跳
(self.device_online_flag1, self.device_online_flag2) = struct.unpack_from('<II', data, offset); offset += 8
(self.dyn_charge_level, self.dyn_water_leak_status,
@@ -399,12 +424,16 @@ class msg_ccUFbMsg:
(self.heartbeat,) = struct.unpack_from('<I', data, offset); offset += 4
# 校验校验码
# 解析校验码(4字节)
(self.checkCode,) = struct.unpack_from('<I', data, offset); offset += 4
# 校验校验码 - 根据C++代码,计算所有数据的和(不包括校验码本身)
checkCode = 0
for byte in data[:-1]: # 不包括校验码本身
checkCode = (checkCode + byte) & 0xFF
return checkCode == data[-1]
# 计算除校验码外的所有字节的和
for i in range(len(data) - 4): # 不包括最后4字节的校验码
checkCode += data[i]
return checkCode == self.checkCode
def print_info(self):
"""打印消息信息"""
@@ -423,214 +452,5 @@ class msg_ccUFbMsg:
print(f"仪表SOC: {self.ins_soc}%")
print(f"动力SOC: {self.dyn_soc}%")
print(f"心跳计数器: {self.heartbeat}")
print(f"校验码: 0x{self.checkCode:02X}")
class msg_ccUCmdMsg:
def __init__(self):
# 消息头
self.start1 = 0x20
self.start2 = 0x20
self.id = 0x0040 # CCU_CMD_ID
self.length = 0
self.checkCode = 0x00
# 时间戳
self.year = 0
self.month = 0
self.day = 0
self.hour = 0
self.minute = 0
self.second = 0
self.milliseconds = 0
# 复合管控器操作指令
self.fcmode = 0x00 # 燃料电池运行模式
self.fcuCmd = 0x00 # 燃料电池控制命令
self.fcuPowerEfficiency = 0x00 # 燃料电池功率效率
self.insChargeEnable = 0x00 # 仪表电池充电使能
self.insBatCmd = 0x00 # 仪表电池命令
self.powerBatCmd = 0x00 # 动力电池命令
self.powerBatEfficiency = 0 # 动力电池功率效率
self.heartbeat = 0 # 心跳
self.masterState = 0x00 # 主控状态
self.paceholder1 = 0 # 占位符1
self.paceholder2 = 0 # 占位符2
def pack(self):
"""打包消息为字节数据"""
# 重置校验码
self.checkCode = 0x00
# 打包消息头
data = struct.pack('<BBHH',
self.start1,
self.start2,
self.id,
self.length)
# 打包时间戳
data += struct.pack('<HBBBBBB',
self.year,
self.month,
self.day,
self.hour,
self.minute,
self.second,
self.milliseconds)
# 打包复合管控器操作指令
data += struct.pack('<BBBBBBHBBII',
self.fcmode,
self.fcuCmd,
self.fcuPowerEfficiency,
self.insChargeEnable,
self.insBatCmd,
self.powerBatCmd,
self.powerBatEfficiency,
self.heartbeat,
self.masterState,
self.paceholder1,
self.paceholder2)
# 计算校验码
self.checkCode = 0
for byte in data:
self.checkCode = (self.checkCode + byte) & 0xFF
# 添加校验码
data += struct.pack('<B', self.checkCode)
# 更新长度字段
self.length = len(data) - 6 # 减去头部6字节
return data
def unpack(self, data):
"""从字节数据解包消息"""
if len(data) < 10: # 最小消息长度检查
return False
# 解析消息头
self.start1 = data[0]
self.start2 = data[1]
self.id = struct.unpack_from('<H', data, 2)[0]
self.length = struct.unpack_from('<H', data, 4)[0]
offset = 6 # 头部结束位置
# 检查数据长度是否足够
if len(data) < offset + self.length + 1: # +1 for checksum
return False
# 解析时间戳
(self.year, self.month, self.day, self.hour,
self.minute, self.second, self.milliseconds) = struct.unpack_from('<HBBBBBB', data, offset); offset += 8
# 解析复合管控器操作指令
(self.fcmode, self.fcuCmd, self.fcuPowerEfficiency,
self.insChargeEnable, self.insBatCmd, self.powerBatCmd,
self.powerBatEfficiency, self.heartbeat, self.masterState,
self.paceholder1, self.paceholder2) = struct.unpack_from('<BBBBBBHBBII', data, offset); offset += 20
# 校验校验码
checkCode = 0
for byte in data[:-1]: # 不包括校验码本身
checkCode = (checkCode + byte) & 0xFF
return checkCode == data[-1]
def print_info(self):
"""打印消息信息"""
print(f"消息头: start1=0x{self.start1:02X}, start2=0x{self.start2:02X}, id=0x{self.id:04X}, length={self.length}")
print(f"时间戳: {self.year}-{self.month:02d}-{self.day:02d} {self.hour:02d}:{self.minute:02d}:{self.second:02d}.{self.milliseconds:03d}")
print(f"燃料电池模式: 0x{self.fcmode:02X}")
print(f"燃料电池控制命令: 0x{self.fcuCmd:02X}")
print(f"燃料电池功率效率: {self.fcuPowerEfficiency}%")
print(f"仪表电池充电使能: 0x{self.insChargeEnable:02X}")
print(f"仪表电池命令: 0x{self.insBatCmd:02X}")
print(f"动力电池命令: 0x{self.powerBatCmd:02X}")
print(f"动力电池功率效率: {self.powerBatEfficiency}%")
print(f"心跳: {self.heartbeat}")
print(f"主控状态: 0x{self.masterState:02X}")
print(f"占位符1: {self.paceholder1}")
print(f"占位符2: {self.paceholder2}")
print(f"校验码: 0x{self.checkCode:02X}")
# 测试函数
def test_msg_ccUFbMsg():
"""测试msg_ccUFbMsg类"""
msg = msg_ccUFbMsg()
# 设置一些测试数据
msg.fc_mode = 0x02 # 自动模式
msg.fc_status = 0x06 # 运行状态
msg.output_power_limit = 15000
msg.total_generation_time = 100 # 10小时
msg.hydrogen_capacity = 80
msg.liquid_oxygen_capacity = 75
msg.ins_soc = 85
msg.dyn_soc = 90
msg.heartbeat = 12345
# 打包消息
data = msg.pack()
print(f"打包后的数据长度: {len(data)} 字节")
# 解包消息
msg2 = msg_ccUFbMsg()
if msg2.unpack(data):
print("解包成功!")
msg2.print_info()
else:
print("解包失败!")
return msg2
def test_msg_ccUCmdMsg():
"""测试msg_ccUCmdMsg类"""
msg = msg_ccUCmdMsg()
# 设置一些测试数据
msg.year = 2025
msg.month = 9
msg.day = 11
msg.hour = 17
msg.minute = 5
msg.second = 30
msg.milliseconds = 123
msg.fcmode = 0x02 # 自动模式
msg.fcuCmd = 0x02 # 启动命令
msg.fcuPowerEfficiency = 85 # 85%效率
msg.insChargeEnable = 0x01 # 使能充电
msg.insBatCmd = 0x10 # 仪表电池启动
msg.powerBatCmd = 0x10 # 动力电池启动
msg.powerBatEfficiency = 90 # 90%效率
msg.heartbeat = 123
msg.masterState = 0x01 # 主控正常
msg.paceholder1 = 0
msg.paceholder2 = 0
# 打包消息
data = msg.pack()
print(f"CCU命令消息打包后的数据长度: {len(data)} 字节")
# 解包消息
msg2 = msg_ccUCmdMsg()
if msg2.unpack(data):
print("CCU命令消息解包成功!")
msg2.print_info()
else:
print("CCU命令消息解包失败!")
return msg2
if __name__ == "__main__":
print("=== 测试CCU状态反馈消息 ===")
test_msg_ccUFbMsg()
print("\n=== 测试CCU命令消息 ===")
test_msg_ccUCmdMsg()
print(f"校验码: 0x{self.checkCode:08X}")