diff --git a/bin/pPowerManger.moos b/bin/pPowerManger.moos new file mode 100644 index 0000000..2de7531 --- /dev/null +++ b/bin/pPowerManger.moos @@ -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 +} \ No newline at end of file diff --git a/data/msg/pl_test2_1817399773.json b/data/msg/pl_test2_1817399773.json deleted file mode 100644 index f33f43f..0000000 --- a/data/msg/pl_test2_1817399773.json +++ /dev/null @@ -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" - } - } -} \ No newline at end of file diff --git a/data/msg/subDisSysCmd.json b/data/msg/subDisSysCmd.json deleted file mode 100644 index 19d3bde..0000000 --- a/data/msg/subDisSysCmd.json +++ /dev/null @@ -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 -} diff --git a/data/msg/uDevice_depth_st.json b/data/msg/uDevice_depth_st.json deleted file mode 100644 index 0c734a3..0000000 --- a/data/msg/uDevice_depth_st.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "value_array_uint16" :[2,1,3] -} \ No newline at end of file diff --git a/data/msg/uPower_currentState_st.json b/data/msg/uPower_currentState_st.json deleted file mode 100644 index 68d961a..0000000 --- a/data/msg/uPower_currentState_st.json +++ /dev/null @@ -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}} diff --git a/data/msg/uPower_disSysState_st.json b/data/msg/uPower_disSysState_st.json deleted file mode 100644 index 62af903..0000000 --- a/data/msg/uPower_disSysState_st.json +++ /dev/null @@ -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]}} diff --git a/data/msg/uPower_equState_fb.json b/data/msg/uPower_equState_fb.json deleted file mode 100644 index 6a2672e..0000000 --- a/data/msg/uPower_equState_fb.json +++ /dev/null @@ -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 -} -} diff --git a/data/msg/uPower_fcsState_st.json b/data/msg/uPower_fcsState_st.json deleted file mode 100644 index 46bb393..0000000 --- a/data/msg/uPower_fcsState_st.json +++ /dev/null @@ -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}} diff --git a/data/msg/uPower_liBatState_st.json b/data/msg/uPower_liBatState_st.json deleted file mode 100644 index 3bd0d02..0000000 --- a/data/msg/uPower_liBatState_st.json +++ /dev/null @@ -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}} diff --git a/data/msg/uPower_pmState_fb.json b/data/msg/uPower_pmState_fb.json deleted file mode 100644 index 5896dea..0000000 --- a/data/msg/uPower_pmState_fb.json +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/data/msg/uPower_pmState_st.json b/data/msg/uPower_pmState_st.json deleted file mode 100644 index df2e35e..0000000 --- a/data/msg/uPower_pmState_st.json +++ /dev/null @@ -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 -} -} diff --git a/data/msg/uPower_secdistState_cmd.json b/data/msg/uPower_secdistState_cmd.json deleted file mode 100644 index 712affc..0000000 --- a/data/msg/uPower_secdistState_cmd.json +++ /dev/null @@ -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}} diff --git a/data/msg/uPower_sysState_cmd.json b/data/msg/uPower_sysState_cmd.json deleted file mode 100644 index 4309ae7..0000000 --- a/data/msg/uPower_sysState_cmd.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "powerCMD":0, - "modCMD":0, - "workCMD":0 -} \ No newline at end of file diff --git a/data/protocol-specs/udp/ccu_set_param_fb.json b/data/protocol-specs/udp/ccu_set_param_fb.json deleted file mode 100644 index 3f1c4a2..0000000 --- a/data/protocol-specs/udp/ccu_set_param_fb.json +++ /dev/null @@ -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": "故障代码" - } - ] -} \ No newline at end of file diff --git a/data/protocol-specs/udp/ccu_state_fb.json b/data/protocol-specs/udp/ccu_state_fb.json deleted file mode 100644 index d7a838a..0000000 --- a/data/protocol-specs/udp/ccu_state_fb.json +++ /dev/null @@ -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" - ] - } -} \ No newline at end of file diff --git a/data/protocol-specs/udp/dis_high_a_vol_bus_fb.json b/data/protocol-specs/udp/dis_high_a_vol_bus_fb.json deleted file mode 100644 index 8495ad6..0000000 --- a/data/protocol-specs/udp/dis_high_a_vol_bus_fb.json +++ /dev/null @@ -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)" - } - ] -} \ No newline at end of file diff --git a/data/protocol-specs/udp/dis_high_b_vol_bus_fb.json b/data/protocol-specs/udp/dis_high_b_vol_bus_fb.json deleted file mode 100644 index d627ae1..0000000 --- a/data/protocol-specs/udp/dis_high_b_vol_bus_fb.json +++ /dev/null @@ -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)" - } - ] -} diff --git a/data/protocol-specs/udp/dis_high_vol_bus_fb.json b/data/protocol-specs/udp/dis_high_vol_bus_fb.json deleted file mode 100644 index 2ea80a3..0000000 --- a/data/protocol-specs/udp/dis_high_vol_bus_fb.json +++ /dev/null @@ -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)" - } - ] -} \ No newline at end of file diff --git a/data/testmsg/uDevice_depth_st.json b/data/testmsg/uDevice_depth_st.json deleted file mode 100644 index 0c734a3..0000000 --- a/data/testmsg/uDevice_depth_st.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "value_array_uint16" :[2,1,3] -} \ No newline at end of file diff --git a/data/testmsg/uDevice_secdistState_st.json b/data/testmsg/uDevice_secdistState_st.json deleted file mode 100644 index 9efd182..0000000 --- a/data/testmsg/uDevice_secdistState_st.json +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/data/testmsg/uExternComm_setDeviceSwitch_cmd.json b/data/testmsg/uExternComm_setDeviceSwitch_cmd.json deleted file mode 100644 index a39f963..0000000 --- a/data/testmsg/uExternComm_setDeviceSwitch_cmd.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "id_uint8" : 1, - "cmd_uint8" : 1 -} \ No newline at end of file diff --git a/data/testmsg/uExternComm_setOpCondition_cmd.json b/data/testmsg/uExternComm_setOpCondition_cmd.json deleted file mode 100644 index 5f5ea7a..0000000 --- a/data/testmsg/uExternComm_setOpCondition_cmd.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "state_uint8" : 12 -} \ No newline at end of file diff --git a/data/testmsg/uExternComm_setOpMode_cmd.json b/data/testmsg/uExternComm_setOpMode_cmd.json deleted file mode 100644 index 6c4e59c..0000000 --- a/data/testmsg/uExternComm_setOpMode_cmd.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "state_uint8" : 1 -} \ No newline at end of file diff --git a/data/testmsg/uExternComm_setPowerSystem_cmd.json b/data/testmsg/uExternComm_setPowerSystem_cmd.json deleted file mode 100644 index c744c79..0000000 --- a/data/testmsg/uExternComm_setPowerSystem_cmd.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "powerCmd_uint8" :1 -} \ No newline at end of file diff --git a/data/testmsg/uPlan_planStop_cmd.json b/data/testmsg/uPlan_planStop_cmd.json deleted file mode 100644 index 432e152..0000000 --- a/data/testmsg/uPlan_planStop_cmd.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "stamp_fp64" : 0, - "op_int32" : 1 -} \ No newline at end of file diff --git a/data/testmsg/uPlan_taskStart_cmd.json b/data/testmsg/uPlan_taskStart_cmd.json deleted file mode 100644 index 2baaacf..0000000 --- a/data/testmsg/uPlan_taskStart_cmd.json +++ /dev/null @@ -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" -} \ No newline at end of file diff --git a/data/testmsg/uPower_equState_cmd.json b/data/testmsg/uPower_equState_cmd.json deleted file mode 100644 index 9b0b13c..0000000 --- a/data/testmsg/uPower_equState_cmd.json +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/data/testmsg/uPower_sysState_cmd.json b/data/testmsg/uPower_sysState_cmd.json deleted file mode 100644 index 29cb461..0000000 --- a/data/testmsg/uPower_sysState_cmd.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "powerCMD":4, - "modCMD":1, - "workCMD":12 -} \ No newline at end of file diff --git a/src/bck/pPowerManger/fsm/PowerManagerFsm.cpp b/src/bck/pPowerManger/fsm/PowerManagerFsm.cpp index 4b51075..2ffe977 100644 --- a/src/bck/pPowerManger/fsm/PowerManagerFsm.cpp +++ b/src/bck/pPowerManger/fsm/PowerManagerFsm.cpp @@ -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) diff --git a/src/pPowerManger/LowerCommManager.cpp b/src/pPowerManger/LowerCommManager.cpp index c485ae4..6b96a8c 100644 --- a/src/pPowerManger/LowerCommManager.cpp +++ b/src/pPowerManger/LowerCommManager.cpp @@ -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); //写入数据库 diff --git a/src/pPowerManger/PowerManger.cpp b/src/pPowerManger/PowerManger.cpp index f79ecde..eccb099 100644 --- a/src/pPowerManger/PowerManger.cpp +++ b/src/pPowerManger/PowerManger.cpp @@ -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); diff --git a/src/pPowerManger/fsm/CruiseMode.cpp b/src/pPowerManger/fsm/CruiseMode.cpp index 48dbe35..0824d8f 100644 --- a/src/pPowerManger/fsm/CruiseMode.cpp +++ b/src/pPowerManger/fsm/CruiseMode.cpp @@ -49,6 +49,7 @@ void CruiseMode::entry() { } pm->workCondition = WorkCondition::CRUISE_MODE; LOG_F(INFO, "进入巡航模式"); + pm->m_systemData->setSystemInfo("INFO:已进入巡航模式"); } // CruiseMode实现 diff --git a/src/pPowerManger/fsm/DJMode.cpp b/src/pPowerManger/fsm/DJMode.cpp index ad81a34..543a7dd 100644 --- a/src/pPowerManger/fsm/DJMode.cpp +++ b/src/pPowerManger/fsm/DJMode.cpp @@ -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:已进入打击模式"); } diff --git a/src/pPowerManger/fsm/FaultState.cpp b/src/pPowerManger/fsm/FaultState.cpp index 3ef4cc6..c6b3dae 100644 --- a/src/pPowerManger/fsm/FaultState.cpp +++ b/src/pPowerManger/fsm/FaultState.cpp @@ -6,6 +6,7 @@ void FaultState::entry() { if(pm->m_missionState.type == TaskType::THROW_LOAD) { LOG_F(INFO, "检测到抛载"); + pm->m_systemData->setSystemInfo("ERROR:检测到抛载"); } } diff --git a/src/pPowerManger/fsm/FloatAdjust.cpp b/src/pPowerManger/fsm/FloatAdjust.cpp index 2a0a145..bbbb884 100644 --- a/src/pPowerManger/fsm/FloatAdjust.cpp +++ b/src/pPowerManger/fsm/FloatAdjust.cpp @@ -13,4 +13,5 @@ void FloatAdjust::entry() { handleCuriseWork(); pm->workCondition = WorkCondition::BUOYANCY_ADJUST; LOG_F(INFO, "进入浮调模式"); + pm->m_systemData->setSystemInfo("INFO:已进入浮调模式"); } diff --git a/src/pPowerManger/fsm/FloatDown.cpp b/src/pPowerManger/fsm/FloatDown.cpp index a9bdd1d..7631c5f 100644 --- a/src/pPowerManger/fsm/FloatDown.cpp +++ b/src/pPowerManger/fsm/FloatDown.cpp @@ -6,6 +6,7 @@ void FloatDown::entry() { handleCuriseWork(); pm->workCondition = WorkCondition::ASCEND_DESCEND; LOG_F(INFO, "进入上浮下潜模式"); + pm->m_systemData->setSystemInfo("INFO:已进入上浮下潜模式"); } // FloatDown实现 diff --git a/src/pPowerManger/fsm/HighSpeedMode.cpp b/src/pPowerManger/fsm/HighSpeedMode.cpp index 233f7a7..3367f9d 100644 --- a/src/pPowerManger/fsm/HighSpeedMode.cpp +++ b/src/pPowerManger/fsm/HighSpeedMode.cpp @@ -6,6 +6,7 @@ void HighSpeedMode::entry() { handleCuriseWork(); pm->workCondition = WorkCondition::HIGH_SPEED_MODE; LOG_F(INFO, "进入高速模式"); + pm->m_systemData->setSystemInfo("INFO:已经进入高速模式"); } // HighSpeedMode实现 diff --git a/src/pPowerManger/fsm/InitState.cpp b/src/pPowerManger/fsm/InitState.cpp index 5cdd3ac..bc17bd0 100644 --- a/src/pPowerManger/fsm/InitState.cpp +++ b/src/pPowerManger/fsm/InitState.cpp @@ -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(); diff --git a/src/pPowerManger/fsm/Lifting.cpp b/src/pPowerManger/fsm/Lifting.cpp index 709a4f0..e27bd29 100644 --- a/src/pPowerManger/fsm/Lifting.cpp +++ b/src/pPowerManger/fsm/Lifting.cpp @@ -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(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(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); } diff --git a/src/pPowerManger/fsm/PowerManagerFsm.cpp b/src/pPowerManger/fsm/PowerManagerFsm.cpp index 522ee4e..072fbcd 100644 --- a/src/pPowerManger/fsm/PowerManagerFsm.cpp +++ b/src/pPowerManger/fsm/PowerManagerFsm.cpp @@ -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++; diff --git a/src/pPowerManger/fsm/RemoteControl.cpp b/src/pPowerManger/fsm/RemoteControl.cpp index ba2e292..e014e07 100644 --- a/src/pPowerManger/fsm/RemoteControl.cpp +++ b/src/pPowerManger/fsm/RemoteControl.cpp @@ -11,6 +11,7 @@ void RemoteControl::entry() { PowerManagerFsm::entry(); pm->workCondition = WorkCondition::REMOTE_CONTROL; LOG_F(INFO, "进入遥控工况"); + pm->m_systemData->setSystemInfo("INFO:已经进入遥控工况"); } diff --git a/src/pPowerManger/fsm/ShoreBasedReady.cpp b/src/pPowerManger/fsm/ShoreBasedReady.cpp index 0d9bc1b..d33a818 100644 --- a/src/pPowerManger/fsm/ShoreBasedReady.cpp +++ b/src/pPowerManger/fsm/ShoreBasedReady.cpp @@ -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:已经进入岸基备航"); } \ No newline at end of file diff --git a/src/pPowerManger/fsm/StandbyState.cpp b/src/pPowerManger/fsm/StandbyState.cpp index 0943696..3a9f216 100644 --- a/src/pPowerManger/fsm/StandbyState.cpp +++ b/src/pPowerManger/fsm/StandbyState.cpp @@ -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(); diff --git a/src/pPowerManger/fsm/SurfaceSurvey.cpp b/src/pPowerManger/fsm/SurfaceSurvey.cpp index d71ed4c..9c70e5c 100644 --- a/src/pPowerManger/fsm/SurfaceSurvey.cpp +++ b/src/pPowerManger/fsm/SurfaceSurvey.cpp @@ -13,4 +13,5 @@ void SurfaceSurvey::entry() { handleCuriseWork(); pm->workCondition = WorkCondition::SURFACE_RECON; LOG_F(INFO, "进入水面侦查模式"); + pm->m_systemData->setSystemInfo("INFO:已经进入水面侦查模式"); } \ No newline at end of file diff --git a/src/pPowerManger/fsm/UnderwaterSurvey.cpp b/src/pPowerManger/fsm/UnderwaterSurvey.cpp index f5afc5c..d5a08f0 100644 --- a/src/pPowerManger/fsm/UnderwaterSurvey.cpp +++ b/src/pPowerManger/fsm/UnderwaterSurvey.cpp @@ -6,6 +6,7 @@ void UnderwaterSurvey::entry() { handleCuriseWork(); pm->workCondition = WorkCondition::UNDERWATER_RECON; LOG_F(INFO, "进入水下侦查模式"); + pm->m_systemData->setSystemInfo("INFO:已经进入水下侦查模式"); } diff --git a/src/pPowerManger/fsm/WaterBasedReady.cpp b/src/pPowerManger/fsm/WaterBasedReady.cpp index 5d90661..4b71b17 100644 --- a/src/pPowerManger/fsm/WaterBasedReady.cpp +++ b/src/pPowerManger/fsm/WaterBasedReady.cpp @@ -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 diff --git a/src/pPowerManger/systemData.h b/src/pPowerManger/systemData.h index 42f98a9..d65b2f1 100644 --- a/src/pPowerManger/systemData.h +++ b/src/pPowerManger/systemData.h @@ -11,6 +11,10 @@ private: SQLite* m_db; std::set sysFaultCodes; mutable std::mutex sysFaultCodesMutex; + + // 系统状态描述(线程安全) + std::string system_info = "INFO:能源系统启动"; + mutable std::mutex systemInfoMutex; public: /** * @brief 向系统故障码集合中插入一个故障码 @@ -52,6 +56,25 @@ public: std::lock_guard lock(sysFaultCodesMutex); return sysFaultCodes; } + + /** + * @brief 设置系统状态描述信息(线程安全) + * @param info 要设置的系统状态描述 + */ + void setSystemInfo(const std::string& info) { + std::lock_guard lock(systemInfoMutex); + system_info = info; + } + + /** + * @brief 获取系统状态描述信息(线程安全) + * @return std::string 系统状态描述 + */ + std::string getSystemInfo() const { + std::lock_guard 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 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); + } } //温度 diff --git a/src/pPowerManger/udpcomm/udpComm.cpp b/src/pPowerManger/udpcomm/udpComm.cpp index 3f64212..e5e13a0 100644 --- a/src/pPowerManger/udpcomm/udpComm.cpp +++ b/src/pPowerManger/udpcomm/udpComm.cpp @@ -177,7 +177,7 @@ bool udpComm::pushMsgToQueue(unsigned char *m) { if(m_qReceiveCcuStateBuffer.size() #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"] = ""; diff --git a/test/disSysTest/PowerManagerApp copy.py b/test/disSysTest/PowerManagerApp copy.py index 6a14035..0c04c4a 100644 --- a/test/disSysTest/PowerManagerApp copy.py +++ b/test/disSysTest/PowerManagerApp copy.py @@ -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(): diff --git a/test/disSysTest/ccuMsg.py b/test/disSysTest/ccuMsg.py index f3b91e6..a1e702b 100644 --- a/test/disSysTest/ccuMsg.py +++ b/test/disSysTest/ccuMsg.py @@ -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('