Skip to content

Commit

Permalink
Remove vss2dbc mapping for sensor
Browse files Browse the repository at this point in the history
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
  • Loading branch information
erikbosch committed May 20, 2024
1 parent 973fe30 commit 0f02124
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
7 changes: 6 additions & 1 deletion dbcfeederlib/dbc2vssmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=""):
"""
Expand Down
2 changes: 2 additions & 0 deletions mapping/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions mapping/vss_4.0/dbc_overlay.vspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions mapping/vss_4.0/vss_dbc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7105,10 +7105,7 @@
},
"description": "Motor temperature.",
"type": "sensor",
"unit": "celsius",
"vss2dbc": {
"signal": "PTC_rightTempIGBT"
}
"unit": "celsius"
},
"Torque": {
"datatype": "int16",
Expand Down
2 changes: 0 additions & 2 deletions mapping/vss_4.1/dbc_overlay.vspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions mapping/vss_4.1/vss_dbc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7476,10 +7476,7 @@
},
"description": "Motor temperature.",
"type": "sensor",
"unit": "celsius",
"vss2dbc": {
"signal": "PTC_rightTempIGBT"
}
"unit": "celsius"
},
"Torque": {
"datatype": "int16",
Expand Down

0 comments on commit 0f02124

Please sign in to comment.