使用tinyfsm

This commit is contained in:
zjk
2025-04-06 20:16:37 +08:00
parent 811fbf2924
commit c51eb7073a
18 changed files with 1720 additions and 322 deletions
@@ -0,0 +1,52 @@
{
"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
@@ -0,0 +1,637 @@
{
"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"
]
}
}
@@ -0,0 +1,142 @@
{
"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)"
}
]
}
@@ -0,0 +1,154 @@
{
"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)"
}
]
}
@@ -0,0 +1,184 @@
{
"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)"
}
]
}
-5
View File
@@ -1,5 +0,0 @@
{
"powerCMD":0,
"modCMD":0,
"workCMD":0
}