From c8af4cc2450690da2231891a358ac19dcb77b306 Mon Sep 17 00:00:00 2001 From: Simone Ruffini Date: Mon, 8 Jul 2024 15:25:23 +0200 Subject: [PATCH] feat: correct ids generated, script to gen can-id from ecu-id,message-id --- SC24/MCB.json | 110 +++++++++++++++++------------------ SC24/infos.md | 4 +- SC24/scripts/generate_ids.py | 20 +++++++ 3 files changed, 77 insertions(+), 57 deletions(-) create mode 100644 SC24/scripts/generate_ids.py diff --git a/SC24/MCB.json b/SC24/MCB.json index 7574648..f319287 100644 --- a/SC24/MCB.json +++ b/SC24/MCB.json @@ -86,7 +86,7 @@ "messages": { "DIAG_TOOL__xcpTxBMS_LV": { "message-id_dec": 40, - "id": 2044, + "id": 646, "length": 8, "sender": "DIAG_TOOL", "send_type": "cyclicIfActive", @@ -105,7 +105,7 @@ "DIAG_TOOL__xcpTxDASH": { "message-id_dec": 41, "length": 8, - "id": 2043, + "id": 662, "sender": "DIAG_TOOL", "send_type": "cyclicIfActive", "signals": { @@ -122,7 +122,7 @@ }, "DIAG_TOOL__xcpTxSB_REAR": { "message-id_dec": 42, - "id": 2042, + "id": 678, "length": 8, "sender": "DIAG_TOOL", "send_type": "cyclicIfActive", @@ -140,7 +140,7 @@ }, "DIAG_TOOL__xcpTxSB_FRONT": { "message-id_dec": 43, - "id": 2036, + "id": 694, "length": 8, "sender": "DIAG_TOOL", "send_type": "cyclicIfActive", @@ -158,7 +158,7 @@ }, "DIAG_TOOL__xcpTxSCANNER": { "message-id_dec": 44, - "id": 2037, + "id": 710, "length": 8, "sender": "DIAG_TOOL", "send_type": "cyclicIfActive", @@ -176,7 +176,7 @@ }, "DIAG_TOOL__xcpTxTLB_BAT": { "message-id_dec": 45, - "id": 2039, + "id": 726, "length": 8, "sender": "DIAG_TOOL", "send_type": "cyclicIfActive", @@ -194,8 +194,8 @@ }, "BMS_LV__xcpTx": { "message-id_dec": 70, - "length": 3, - "id": 2041, + "length": 8, + "id": 1124, "sender": "BMS_LV", "send_type": "cyclicIfActive", "signals": { @@ -212,7 +212,7 @@ }, "BMS_LV__hello": { "message-id_dec": 100, - "id": 2035, + "id": 1604, "length": 3, "sender": "BMS_LV", "send_type": "IfActive", @@ -263,7 +263,7 @@ }, "BMS_LV__lvBatGeneral": { "message-id_dec": 20, - "id": 258, + "id": 324, "length": 6, "sender": "BMS_LV", "cycle_time": 100, @@ -318,7 +318,7 @@ }, "BMS_LV__lvCellNTCResistance0": { "message-id_dec": 101, - "id": 260, + "id": 1620, "length": 8, "sender": "BMS_LV", "cycle_time": 2000, @@ -417,8 +417,8 @@ } }, "BMS_LV__lvCellNTCResistance1": { - "message-id_dec": 101, - "id": 261, + "message-id_dec": 102, + "id": 1636, "length": 8, "sender": "BMS_LV", "cycle_time": 2000, @@ -518,7 +518,7 @@ }, "BMS_LV__cellsStatus": { "message-id_dec": 75, - "id": 75, + "id": 1204, "length": 5, "sender": "BMS_LV", "cycle_time": 100, @@ -892,7 +892,7 @@ }, "BMS_LV__status": { "message-id_dec": 76, - "id": 2034, + "id": 1220, "length": 8, "sender": "BMS_LV", "cycle_time": 500, @@ -930,7 +930,7 @@ }, "BMS_LV__lvCellVoltage0": { "message-id_dec": 77, - "id": 256, + "id": 1236, "length": 8, "sender": "BMS_LV", "cycle_time": 100, @@ -1000,7 +1000,7 @@ }, "BMS_LV__lvCellVoltage1": { "message-id_dec": 78, - "id": 257, + "id": 1252, "length": 6, "sender": "BMS_LV", "cycle_time": 100, @@ -1056,7 +1056,7 @@ "DASH__xcpTx": { "message-id_dec": 70, "length": 8, - "id": 2040, + "id": 1125, "sender": "DASH", "send_type": "cyclicIfActive", "signals": { @@ -1073,7 +1073,7 @@ }, "DASH__appsRangeLimits": { "message-id_dec": 105, - "id": 1300, + "id": 1685, "length": 8, "sender": "DASH", "send_type": "IfActive", @@ -1142,7 +1142,7 @@ }, "DASH__hmiDevicesState": { "message-id_dec": 22, - "id": 38, + "id": 357, "length": 2, "sender": "DASH", "cycle_time": 500, @@ -1250,7 +1250,7 @@ }, "DASH__hello": { "message-id_dec": 100, - "id": 23, + "id": 1605, "length": 3, "sender": "DASH", "send_type": "IfActive", @@ -1301,7 +1301,7 @@ }, "DASH__carCommands": { "message-id_dec": 106, - "id": 255, + "id": 1701, "length": 2, "sender": "DASH", "send_type": "IfActive", @@ -1337,7 +1337,7 @@ }, "DASH__peripheralsStatus": { "message-id_dec": 79, - "id": 519, + "id": 1269, "length": 1, "sender": "DASH", "cycle_time": 500, @@ -1361,8 +1361,8 @@ } }, "DSPACE__timeAndDate": { - "message-id_dec": 0, - "id": 39, + "message-id_dec": 1, + "id": 23, "length": 6, "sender": "DSPACE", "cycle_time": 10, @@ -1502,7 +1502,7 @@ }, "DSPACE__hello": { "message-id_dec": 100, - "id": 25, + "id": 1607, "length": 3, "sender": "DSPACE", "send_type": "IfActive", @@ -1550,7 +1550,7 @@ }, "DSPACE__fsmStates": { "message-id_dec": 74, - "id": 37, + "id": 1191, "length": 5, "sender": "DSPACE", "cycle_time": 100, @@ -1630,7 +1630,7 @@ }, "DSPACE_peripheralsCTRL": { "message-id_dec": 25, - "id": 512, + "id": 407, "length": 3, "sender": "DSPACE", "cycle_time": 100, @@ -1687,7 +1687,7 @@ }, "DSPACE_dashLedsColorRGB": { "message-id_dec": 107, - "id": 1603, + "id": 1719, "length": 8, "sender": "DSPACE", "cycle_time": 200, @@ -1817,7 +1817,7 @@ }, "DSPACE_dashLedsColorLiteral": { "message-id_dec": 108, - "id": 1619, + "id": 1735, "length": 2, "sender": "DSPACE", "cycle_time": 200, @@ -1863,7 +1863,7 @@ }, "SB_FRONT__xcpTx": { "message-id_dec": 70, - "id": 2038, + "id": 1122, "length": 8, "sender": "SB_FRONT", "send_type": "cyclicIfActive", @@ -1881,7 +1881,7 @@ }, "SB_FRONT__hello": { "message-id_dec": 100, - "id": 21, + "id": 1602, "length": 3, "sender": "SB_FRONT", "send_type": "IfActive", @@ -1932,7 +1932,7 @@ }, "SB_FRONT__analogDevice": { "message-id_dec": 5, - "id": 5, + "id": 82, "length": 7, "sender": "SB_FRONT", "cycle_time": 10, @@ -2002,7 +2002,7 @@ }, "SB_FRONT__ntcResistance": { "message-id_dec": 103, - "id": 1024, + "id": 1650, "length": 8, "sender": "SB_FRONT", "cycle_time": 500, @@ -2102,7 +2102,7 @@ }, "SB_FRONT__potentiometer": { "message-id_dec": 50, - "id": 16, + "id": 802, "length": 4, "cycle_time": 10, "send_type": "Cyclic", @@ -2141,8 +2141,8 @@ } }, "SB_FRONT__SDCsensingStatus": { - "message-id_dec": 50, - "id": 49, + "message-id_dec": 48, + "id": 770, "length": 1, "sender": "SB_FRONT", "cycle_time": 10, @@ -2194,7 +2194,7 @@ }, "SB_REAR__xcpTx": { "message-id_dec": 70, - "id":2030, + "id": 1123, "length": 8, "sender": "SB_REAR", "send_type": "cyclicIfActive", @@ -2212,7 +2212,7 @@ }, "SB_REAR__analogDevice": { "message-id_dec": 6, - "id": 1026, + "id": 99, "length": 6, "sender": "SB_REAR", "cycle_time": 10, @@ -2267,7 +2267,7 @@ }, "SB_REAR__criticalPeripherals": { "message-id_dec": 7, - "id": 50, + "id": 115, "length": 1, "sender": "SB_REAR", "cycle_time": 10, @@ -2305,7 +2305,7 @@ }, "SB_REAR__hello": { "message-id_dec": 100, - "id": 22, + "id": 1603, "length": 3, "sender": "SB_REAR", "send_type": "IfActive", @@ -2356,7 +2356,7 @@ }, "SB_REAR__ntcResistance": { "message-id_dec": 104, - "id": 1025, + "id": 1667, "length": 8, "sender": "SB_REAR", "cycle_time": 500, @@ -2455,8 +2455,8 @@ } }, "SB_REAR__potentiometer": { - "message-id_dec": 47, - "id": 17, + "message-id_dec": 51, + "id": 819, "length": 4, "sender": "SB_REAR", "cycle_time": 10, @@ -2495,8 +2495,8 @@ } }, "SB_REAR__SDCsensingStatus": { - "message-id_dec": 51, - "id": 48, + "message-id_dec": 47, + "id": 755, "length": 1, "sender": "SB_REAR", "cycle_time": 10, @@ -2562,7 +2562,7 @@ }, "SCANNER__xcpTx": { "message-id_dec": 70, - "id": 2046, + "id": 1129, "length": 8, "sender": "SCANNER", "send_type": "cyclicIfActive", @@ -2580,7 +2580,7 @@ }, "TLB_BAT_xcpTx": { "message-id_dec": 70, - "id": 2045, + "id": 1121, "length": 8, "sender": "TLB_BAT", "send_type": "cyclicIfActive", @@ -2598,7 +2598,7 @@ }, "TLB_BAT_hello": { "message-id_dec": 100, - "id": 24, + "id": 1601, "length": 3, "sender": "TLB_BAT", "send_type": "IfActive", @@ -2649,7 +2649,7 @@ }, "TLB_BAT__SDCsensingStatus": { "message-id_dec": 46, - "id": 18, + "id": 737, "length": 3, "sender": "TLB_BAT", "cycle_time": 10, @@ -2740,7 +2740,7 @@ }, "TLB_BAT_signalsStatus": { "message-id_dec": 4, - "id": 19, + "id": 65, "length": 4, "sender": "TLB_BAT", "cycle_time": 10, @@ -2960,7 +2960,7 @@ }, "TPMS__frontWheelsPressure": { "message-id_dec": 80, - "id": 1816, + "id": 1290, "length": 8, "sender": "TPMS", "send_type": "cyclicIfActive", @@ -3085,7 +3085,7 @@ }, "TPMS__rearWheelsPressure": { "message-id_dec": 81, - "id": 1832, + "id": 1306, "length": 8, "sender": "TPMS", "send_type": "cyclicIfActive", @@ -3314,7 +3314,7 @@ "receivers": [ "SCANNER" ], - "scale": 1e-7, + "scale": 1e-07, "offset": 0, "min": -214.7483648, "max": 214.7483647 @@ -3328,7 +3328,7 @@ "receivers": [ "SCANNER" ], - "scale": 1e-7, + "scale": 1e-07, "offset": 0, "min": -214.7483648, "max": 214.7483647 diff --git a/SC24/infos.md b/SC24/infos.md index fce75c0..7028502 100644 --- a/SC24/infos.md +++ b/SC24/infos.md @@ -4,7 +4,7 @@ Below values are in base 10 ### High Priority high speed (1-50ms) ``` - Message IDs: 0-19 [20] - - 0: DSPACE-date_time + - 1: DSPACE-date_time - 4: TLB_BAT_signalsStatus - 5: SB_FRONT_analogDevices - 6: SB_REAR_analogDevices @@ -24,7 +24,7 @@ Below values are in base 10 - 40-45: DIAG_TOOL_xcpTx[all ecus] - 46: TLB_BAT_sdcSensingStatus - 47: SB_REAR_sdcSensingStatus - - 50: SB_FRONT_sdcSensingStatus + - 48: SB_FRONT_sdcSensingStatus - 50: SB_FRONT_potentiometer - 51: SB_REAR_potentiometer ``` diff --git a/SC24/scripts/generate_ids.py b/SC24/scripts/generate_ids.py new file mode 100644 index 0000000..3e118ca --- /dev/null +++ b/SC24/scripts/generate_ids.py @@ -0,0 +1,20 @@ +import json + +#512 con dspace_peripheral control +mcb_f=open("./MCB.json") +mcb = json.load(mcb_f) + +ecu_ids = mcb["signal_enums"]["ecu_id_Enum"]; +for message in mcb["messages"]: + sender = mcb["messages"][message]["sender"] + if sender == "IMU" : + continue + sender_ecu_id = ecu_ids[sender] + message_id = mcb["messages"][message]["message-id_dec"] + old_can_id=mcb['messages'][message]["id"] + new_can_id = message_id*(2**4)+sender_ecu_id; + print(sender,'[',sender_ecu_id,']',message,'[',message_id,hex(message_id),']',':',old_can_id,hex(old_can_id),'->',new_can_id,hex(new_can_id)) + mcb['messages'][message]["id"]=new_can_id + +mcb_fw=open("./MCB_gen.json","w") +json.dump(mcb,mcb_fw,indent=4)