-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DCSupplySimulator: Add C++ simulation module #499
Conversation
modules/simulation/DCSupplySimulator/main/power_supply_DCImpl.cpp
Outdated
Show resolved
Hide resolved
modules/simulation/DCSupplySimulator/main/power_supply_DCImpl.cpp
Outdated
Show resolved
Hide resolved
modules/simulation/DCSupplySimulator/main/power_supply_DCImpl.cpp
Outdated
Show resolved
Hide resolved
double settings_connector_max_export_current; | ||
double settings_connector_max_import_current; | ||
types::power_supply_DC::Mode mode; | ||
double connector_voltage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see connector_voltage and connector_current are used in the worker thread without locking the mutex. Also the set mode command handler does not use the mutex. Please review all access and add locks or use std::atomic here if it is ok that voltage/current do not both need to be locked at the same time.
@@ -1,3 +1,4 @@ | |||
ev_add_module(DCSupplySimulator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could remove JsDCSupplySimulator probably with this PR and update the configs in core to use the C++ version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, as the car sides of the SIL configs use JsDCSupplySimulator's powermeter
interface implementation. That is not covered in this PR. (Should it be?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, not neccesarily now, but I'd like to drop the JS module at some point
modules/simulation/DCSupplySimulator/main/power_supply_DCImpl.cpp
Outdated
Show resolved
Hide resolved
Latest commits tested with config/config-sil-dc.yaml with this config: diff --git a/config/config-sil-dc.yaml b/config/config-sil-dc.yaml
index 0756652..6f77277 100644
--- a/config/config-sil-dc.yaml
+++ b/config/config-sil-dc.yaml
@@ -31,7 +31,7 @@ active_modules:
- module_id: yeti_driver
implementation_id: board_support
powermeter_car_side:
- - module_id: powersupply_dc
+ - module_id: powersupply_dc_js
implementation_id: powermeter
slac:
- module_id: slac
@@ -46,6 +46,8 @@ active_modules:
- module_id: imd
implementation_id: main
powersupply_dc:
+ module: DCSupplySimulator
+ powersupply_dc_js:
module: JsDCSupplySimulator
yeti_driver:
module: JsYetiSimulator |
e65b1f5
to
9b6c67e
Compare
Please squash before merging into one commit and adapt commit description |
This C++ module emulates the behavior of the existing JsDCSupplySimulator. Unlike JsDCSupplySimulator, it does not provide the powermeter simulation interface though. This should be implemented in a separate C++ module. Co-authored-by: Cornelius Claussen <[email protected]> Co-authored-by: Fabian Hartung <[email protected]> Co-authored-by: Mohannad Oraby <[email protected]> Co-authored-by: Moritz Barsnick <[email protected]> Signed-off-by: Fabian Hartung <[email protected]> Signed-off-by: Moritz Barsnick <[email protected]>
9b6c67e
to
3d619bb
Compare
This C++ module supplements JsDCSupplySimulator, and emulates its behavior.
Unlike JsDCSupplySimulator, it does not provide the
powermeter
simulation interface though. This should be implemented in a separate C++ module, if required.Co-authored-by: Cornelius Claussen [email protected]
Co-authored-by: Fabian Hartung [email protected]
Co-authored-by: Mohannad Oraby [email protected]
Co-authored-by: Moritz Barsnick [email protected]