From 0f021247e66c6e57846d1fe431877eb003a872f1 Mon Sep 17 00:00:00 2001 From: Erik Jaegervall Date: Thu, 16 May 2024 14:21:16 +0200 Subject: [PATCH] Remove vss2dbc mapping for sensor Related to #23 Current CAN provider implementation always subscribe to target value for "vss2dbc". That does not really make sense for sensors, as they do not have target values --- dbcfeederlib/dbc2vssmapper.py | 7 ++++++- mapping/README.md | 2 ++ mapping/vss_4.0/dbc_overlay.vspec | 2 -- mapping/vss_4.0/vss_dbc.json | 5 +---- mapping/vss_4.1/dbc_overlay.vspec | 2 -- mapping/vss_4.1/vss_dbc.json | 5 +---- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/dbcfeederlib/dbc2vssmapper.py b/dbcfeederlib/dbc2vssmapper.py index 3e6cd72..218f693 100644 --- a/dbcfeederlib/dbc2vssmapper.py +++ b/dbcfeederlib/dbc2vssmapper.py @@ -426,7 +426,12 @@ def _analyze_signal(self, expanded_name, node): if dbc2vss_def is not None: self._analyze_dbc2vss(expanded_name, node, dbc2vss_def) if "vss2dbc" in node: - self._analyze_vss2dbc(expanded_name, node, node["vss2dbc"]) + if node["type"] == "actuator": + self._analyze_vss2dbc(expanded_name, node, node["vss2dbc"]) + else: + # vss2dbc is handled by subscription to target value, so only makes sense for actuators + log.error("vss2dbc only allowed for actuators, VSS signal %s is not an actuator!", expanded_name) + sys.exit(-1) def _traverse_vss_node(self, name, node, prefix=""): """ diff --git a/mapping/README.md b/mapping/README.md index ea6de07..2155f28 100644 --- a/mapping/README.md +++ b/mapping/README.md @@ -44,6 +44,8 @@ This is built on the assumption that the DBC provider always send target values Having separate configurations (`dbc2vss` and `vss2dbc`) is needed as wanted value and actual value never are sent by the same DBC signal, they are not even part of the same CAN-frame. +*This means that `vss2dbc` only can be used for actuators, as only actuators have target values!* + ## Example mapping files Example mapping files for various VSS versions can be found in this folder. diff --git a/mapping/vss_4.0/dbc_overlay.vspec b/mapping/vss_4.0/dbc_overlay.vspec index 2c8970d..1cc2ccb 100644 --- a/mapping/vss_4.0/dbc_overlay.vspec +++ b/mapping/vss_4.0/dbc_overlay.vspec @@ -301,8 +301,6 @@ Vehicle.Powertrain.ElectricMotor.Temperature: dbc2vss: signal: PTC_rightTempIGBT interval_ms: 1000 - vss2dbc: - signal: PTC_rightTempIGBT Vehicle.Cabin.Door.Row1.DriverSide.IsOpen: type: actuator diff --git a/mapping/vss_4.0/vss_dbc.json b/mapping/vss_4.0/vss_dbc.json index c3b067f..2ef89f3 100644 --- a/mapping/vss_4.0/vss_dbc.json +++ b/mapping/vss_4.0/vss_dbc.json @@ -7105,10 +7105,7 @@ }, "description": "Motor temperature.", "type": "sensor", - "unit": "celsius", - "vss2dbc": { - "signal": "PTC_rightTempIGBT" - } + "unit": "celsius" }, "Torque": { "datatype": "int16", diff --git a/mapping/vss_4.1/dbc_overlay.vspec b/mapping/vss_4.1/dbc_overlay.vspec index 7b81f30..4ad6430 100644 --- a/mapping/vss_4.1/dbc_overlay.vspec +++ b/mapping/vss_4.1/dbc_overlay.vspec @@ -301,8 +301,6 @@ Vehicle.Powertrain.ElectricMotor.Temperature: dbc2vss: signal: PTC_rightTempIGBT interval_ms: 1000 - vss2dbc: - signal: PTC_rightTempIGBT Vehicle.Cabin.Door.Row1.DriverSide.IsOpen: type: actuator diff --git a/mapping/vss_4.1/vss_dbc.json b/mapping/vss_4.1/vss_dbc.json index e4231df..49e7f9d 100644 --- a/mapping/vss_4.1/vss_dbc.json +++ b/mapping/vss_4.1/vss_dbc.json @@ -7476,10 +7476,7 @@ }, "description": "Motor temperature.", "type": "sensor", - "unit": "celsius", - "vss2dbc": { - "signal": "PTC_rightTempIGBT" - } + "unit": "celsius" }, "Torque": { "datatype": "int16",