From 11a1a909df7247fedd2cdb30a2ef024a1959678e Mon Sep 17 00:00:00 2001 From: Shankari Date: Wed, 12 Jun 2024 01:43:45 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Pass=20the=20payment=20option=20thr?= =?UTF-8?q?ough=20the=20modified=20simulator=20as=20well?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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):: :: Incoming iso15118_car:PyEvJosev->ev:ISO15118_ev->start_charging(EnergyTransferMode) for 2024-06-12 05:40:42.726368 [DEBG] iso15118_car pybind11_init_everestpy(pybind11::module_&):: :: 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_&):: :: 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_&):: :: 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_&):: :: 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_&):: :: 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_&):: :: 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 --- demo-iso15118-2-ac-plus-ocpp.sh | 2 + manager/support_payment_in_jsevmanager.patch | 48 ++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 manager/support_payment_in_jsevmanager.patch diff --git a/demo-iso15118-2-ac-plus-ocpp.sh b/demo-iso15118-2-ac-plus-ocpp.sh index ddd60ebf..e5357a2d 100755 --- a/demo-iso15118-2-ac-plus-ocpp.sh +++ b/demo-iso15118-2-ac-plus-ocpp.sh @@ -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 diff --git a/manager/support_payment_in_jsevmanager.patch b/manager/support_payment_in_jsevmanager.patch new file mode 100644 index 00000000..ec78c903 --- /dev/null +++ b/manager/support_payment_in_jsevmanager.patch @@ -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; + });