Skip to content

Commit

Permalink
✨ Pass the payment option through the modified simulator as well
Browse files Browse the repository at this point in the history
Changes needed:
- change the `iso_start_v2g_session` to take two parameters
- convert the first to the payment method and use the second for the energy type
- add a new argument to the module method for `start_charging`
- pass the payment method through properly

The changes are applied by:
- checking in another patch
- applying the patch after changing into the build directory

Testing done:
- AC EIM works

```
2024-06-12 05:40:37.622543 [INFO] car_simulator_1  :: {
  cmd: 'iso_start_v2g_session',
  args: [ 'externalpayment', 'ac' ],
  exec: [Function (anonymous)]
}

2024-06-12 05:40:37.624913 [DEBG] iso15118_car    Everest::Everest::provide_cmd(std::string, std::string, JsonCommand)::<lambda(Everest::json)> :: Incoming iso15118_car:PyEvJosev->ev:ISO15118_ev->start_charging(EnergyTransferMode) for <handler>

2024-06-12 05:40:42.726368 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Message to encode (ns=urn:iso:15118:2:2013:MsgDef): {"V2G_Message": {"Header": {"SessionID": "6954F76C3DCCE6FD"}, "Body": {"PaymentServiceSelectionReq": {"SelectedPaymentOption": "ExternalPayment", "SelectedServiceList": {"SelectedService": [{"ServiceID": 1}]}}}}}

2024-06-12 05:40:46.308633 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Decoded message (ns=urn:iso:15118:2:2013:MsgDef): {"V2G_Message":{"Header":{"SessionID":"6954F76C3DCCE6FD"},"Body":{"ChargeParameterDiscoveryRes":{"ResponseCode":"OK","EVSEProcessing":"Finished","SAScheduleList":{"SAScheduleTuple":[{"SAScheduleTupleID":1,"PMaxSchedule":{"PMaxScheduleEntry":[{"RelativeTimeInterval":{"start":0,"duration":86400},"PMax":{"Multiplier":0,"Unit":"W","Value":22080}}]}}]},"AC_EVSEChargeParameter":{"AC_EVSEStatus":{"NotificationMaxDelay":0,"EVSENotification":"None","RCD":false},"EVSENominalVoltage":{"Multiplier":-1,"Unit":"V","Value":2300},"EVSEMaxCurrent":{"Multiplier":-1,"Unit":"A","Value":320}}}}}}

2024-06-12 05:40:46.310640 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Message to encode (ns=urn:iso:15118:2:2013:MsgDef): {"V2G_Message": {"Header": {"SessionID": "6954F76C3DCCE6FD"}, "Body": {"PowerDeliveryReq": {"ChargeProgress": "Start", "SAScheduleTupleID": 1, "ChargingProfile": {"ProfileEntry": [{"ChargingProfileEntryStart": 0, "ChargingProfileEntryMaxPower": {"Value": 22080, "Multiplier": 0, "Unit": "W"}}, {"ChargingProfileEntryStart": 86400, "ChargingProfileEntryMaxPower": {"Value": 0, "Multiplier": 0, "Unit": "W"}}]}}}}}
```

- AC contract cert works

```
  cmd: 'iso_start_v2g_session',
  args: [ 'contract', 'ac' ],
  exec: [Function (anonymous)]
}

2024-06-12 05:48:00.517485 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Message to encode (ns=urn:iso:15118:2:2013:MsgDef): {"V2G_Message": {"Header": {"SessionID": "18B5F6A7DB7EEE7F"}, "Body": {"PaymentServiceSelectionReq": {"SelectedPaymentOption": "Contract", "SelectedServiceList": {"SelectedService": [{"ServiceID": 1}]}}}}}

2024-06-12 05:48:04.212986 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Decoded message (ns=urn:iso:15118:2:2013:MsgDef): {"V2G_Message":{"Header":{"SessionID":"18B5F6A7DB7EEE7F"},"Body":{"ChargeParameterDiscoveryRes":{"ResponseCode":"OK","EVSEProcessing":"Finished","SAScheduleList":{"SAScheduleTuple":[{"SAScheduleTupleID":1,"PMaxSchedule":{"PMaxScheduleEntry":[{"RelativeTimeInterval":{"start":0,"duration":86400},"PMax":{"Multiplier":0,"Unit":"W","Value":22080}}]}}]},"AC_EVSEChargeParameter":{"AC_EVSEStatus":{"NotificationMaxDelay":0,"EVSENotification":"None","RCD":false},"EVSENominalVoltage":{"Multiplier":-1,"Unit":"V","Value":2300},"EVSEMaxCurrent":{"Multiplier":-1,"Unit":"A","Value":320}}}}}}

2024-06-12 05:48:04.215246 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Message to encode (ns=urn:iso:15118:2:2013:MsgDef): {"V2G_Message": {"Header": {"SessionID": "18B5F6A7DB7EEE7F"}, "Body": {"PowerDeliveryReq": {"ChargeProgress": "Start", "SAScheduleTupleID": 1, "ChargingProfile": {"ProfileEntry": [{"ChargingProfileEntryStart": 0, "ChargingProfileEntryMaxPower": {"Value": 22080, "Multiplier": 0, "Unit": "W"}}, {"ChargingProfileEntryStart": 86400, "ChargingProfileEntryMaxPower": {"Value": 0, "Multiplier": 0, "Unit": "W"}}]}}}}}
```

Signed-off-by: Shankari <[email protected]>
  • Loading branch information
shankari committed Jun 12, 2024
1 parent bdf9654 commit 11a1a90
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions demo-iso15118-2-ac-plus-ocpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,10 @@ docker restart everest-ac-demo-nodered-1
# Configure and restart EVerest
docker cp config-sil-ocpp201-pnc.yaml everest-ac-demo-manager-1:/ext/source/config/config-sil-ocpp201-pnc.yaml
docker cp manager/enable_payment_method.patch everest-ac-demo-manager-1:/tmp/
docker cp manager/support_payment_in_jsevmanager.patch everest-ac-demo-manager-1:/tmp/
docker cp manager/enable_evcc_logging.cfg everest-ac-demo-manager-1:/ext/source/build/dist/etc/everest/default_logging.cfg
docker exec everest-ac-demo-manager-1 /bin/bash -c "apk add patch && cd /ext && patch -p0 -i /tmp/enable_payment_method.patch"
docker exec everest-ac-demo-manager-1 /bin/bash -c "cd /ext/source/build/dist/libexec/everest && patch -p1 -i /tmp/support_payment_in_jsevmanager.patch"

if [[ "$DEMO_VERSION" =~ sp2 || "$DEMO_VERSION" =~ sp3 ]]; then
docker cp manager/cached_certs_correct_name_emaid.tar.gz everest-ac-demo-manager-1:/ext/source/build
Expand Down
48 changes: 48 additions & 0 deletions manager/support_payment_in_jsevmanager.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/modules/PyEvJosev/module.py b/modules/PyEvJosev/module.py
index fabc388..c8961fc 100644
--- a/modules/PyEvJosev/module.py
+++ b/modules/PyEvJosev/module.py
@@ -95,6 +95,7 @@ class PyEVJosevModule():

def _handler_start_charging(self, args) -> bool:

+ self._es.PaymentOption =args['PaymentOption']
self._es.EnergyTransferMode = args['EnergyTransferMode']

self._ready_event.set()
diff --git a/modules/simulation/JsEvManager/index.js b/modules/simulation/JsEvManager/index.js
index e5b4e9c..4bce5f5 100644
--- a/modules/JsEvManager/index.js
+++ b/modules/JsEvManager/index.js
@@ -362,17 +362,27 @@ function registerAllCmds(mod) {
});

if (mod.uses_list.ev.length > 0) {
- registerCmd(mod, 'iso_start_v2g_session', 1, (mod, c) => {
- switch (c.args[0]) {
+ registerCmd(mod, 'iso_start_v2g_session', 2, (mod, c) => {
+ if (c.args[0] === 'externalpayment') mod.payment = 'ExternalPayment';
+ else if (c.args[0] === 'contract') mod.payment = 'Contract';
+ else {
+ evlog.debug('Found invalid payment method' + c.args[0]);
+ return false;
+ }
+
+ switch (c.args[1]) {
case 'ac':
if (mod.config.module.three_phases !== true) mod.energymode = 'AC_single_phase_core';
else mod.energymode = 'AC_three_phase_core';
break;
case 'dc': mod.energymode = 'DC_extended'; break;
- default: return false;
+ default:
+ evlog.debug('Found invalid payment method' + c.args[1]);
+ return false;
}

- mod.uses_list.ev[0].call.start_charging({ EnergyTransferMode: mod.energymode });
+ args = { PaymentOption: mod.payment, EnergyTransferMode: mod.energymode };
+ mod.uses_list.ev[0].call.start_charging(args);

return true;
});

0 comments on commit 11a1a90

Please sign in to comment.