From dc6334e20343075112098071348cb8e6cc5315be Mon Sep 17 00:00:00 2001 From: pietfried Date: Thu, 5 Jan 2023 10:12:41 +0100 Subject: [PATCH] - Adjusted OCPP module to new libocpp namespaces and structure - Added basic OCPP201 module - Removed config parameters from ocpp201 module and added evse manager requirement Signed-off-by: pietfried --- config/CMakeLists.txt | 1 + config/config-sil-ocpp201.yaml | 152 +++++++++++++++++++++++++++++++++ dependencies.yaml | 2 +- modules/OCPP201/OCPP201.cpp | 16 ++++ 4 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 config/config-sil-ocpp201.yaml diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 2fbf45e16..52ef67f0a 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -1,6 +1,7 @@ generate_config_run_script(CONFIG sil) generate_config_run_script(CONFIG sil-two-evse) generate_config_run_script(CONFIG sil-ocpp) +generate_config_run_script(CONFIG sil-ocpp201) generate_config_run_script(CONFIG sil-dc) generate_config_run_script(CONFIG sil-two-evse-dc) generate_config_run_script(CONFIG hil) diff --git a/config/config-sil-ocpp201.yaml b/config/config-sil-ocpp201.yaml new file mode 100644 index 000000000..851b947cf --- /dev/null +++ b/config/config-sil-ocpp201.yaml @@ -0,0 +1,152 @@ +active_modules: + iso15118_charger: + module: JsRiseV2G + config_implementation: + main: + mqtt_base_path: everest_external/iso15118/java + device: auto + iso15118_car: + module: JsCarV2G + config_implementation: + main: + stack_implementation: RISE-V2G + mqtt_base_path: everest_external/iso15118/ev + device: auto + evse_manager_1: + module: EvseManager + config_module: + connector_id: 1 + three_phases: true + has_ventilation: true + country_code: DE + rcd_enabled: true + evse_id: "1" + session_logging: true + session_logging_xml: false + session_logging_path: /tmp + ac_hlc_enabled: false + ac_hlc_use_5percent: false + ac_enforce_hlc: false + connections: + bsp: + - module_id: yeti_driver_1 + implementation_id: board_support + powermeter_grid_side: + - module_id: yeti_driver_1 + implementation_id: powermeter + slac: + - module_id: slac + implementation_id: evse + hlc: + - module_id: iso15118_charger + implementation_id: charger + evse_manager_2: + module: EvseManager + config_module: + connector_id: 2 + three_phases: true + has_ventilation: true + country_code: DE + rcd_enabled: true + evse_id: "2" + session_logging: true + session_logging_xml: false + session_logging_path: /tmp + ac_hlc_enabled: false + ac_hlc_use_5percent: false + ac_enforce_hlc: false + connections: + bsp: + - module_id: yeti_driver_2 + implementation_id: board_support + powermeter_grid_side: + - module_id: yeti_driver_2 + implementation_id: powermeter + slac: + - module_id: slac + implementation_id: evse + hlc: + - module_id: iso15118_charger + implementation_id: charger + yeti_driver_1: + module: JsYetiSimulator + yeti_driver_2: + module: JsYetiSimulator + slac: + module: JsSlacSimulator + car_simulator_1: + module: JsCarSimulator + config_module: + connector_id: 1 + auto_enable: true + auto_exec: false + auto_exec_commands: sleep 1;iec_wait_pwr_ready;sleep 1;draw_power_regulated 16,3;sleep 30;unplug + connections: + simulation_control: + - module_id: yeti_driver_1 + implementation_id: yeti_simulation_control + ev: + - module_id: iso15118_car + implementation_id: ev + slac: + - module_id: slac + implementation_id: ev + car_simulator_2: + module: JsCarSimulator + config_module: + connector_id: 2 + auto_enable: true + auto_exec: false + connections: + simulation_control: + - module_id: yeti_driver_2 + implementation_id: yeti_simulation_control + ev: + - module_id: iso15118_car + implementation_id: ev + slac: + - module_id: slac + implementation_id: ev + ocpp: + module: OCPP201 + config_module: + ChargePointConfigPath: config.json + connections: + evse_manager: + - module_id: evse_manager_1 + implementation_id: evse + - module_id: evse_manager_2 + implementation_id: evse + token_provider_1: + module: JsDummyTokenProviderManual + energy_manager: + module: EnergyManager + connections: + energy_trunk: + - module_id: grid_connection_point + implementation_id: energy_grid + grid_connection_point: + module: EnergyNode + config_module: + fuse_limit_A: 40.0 + phase_count: 3 + connections: + price_information: [] + energy_consumer: + - module_id: evse_manager_1 + implementation_id: energy_grid + - module_id: evse_manager_2 + implementation_id: energy_grid + powermeter: + - module_id: yeti_driver_1 + implementation_id: powermeter + api: + module: API + connections: + evse_manager: + - module_id: evse_manager_1 + implementation_id: evse + system: + module: System + +x-module-layout: {} diff --git a/dependencies.yaml b/dependencies.yaml index af81ee2d7..d44262db2 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -38,7 +38,7 @@ RISE-V2G: # OCPP libocpp: git: https://github.com/EVerest/libocpp.git - git_tag: 904343c96f945710586b45975beb5b6dfed811d6 + git_tag: v0.5.1 # Josev Josev: git: https://github.com/EVerest/ext-switchev-iso15118.git diff --git a/modules/OCPP201/OCPP201.cpp b/modules/OCPP201/OCPP201.cpp index aec58f544..8d5e90307 100644 --- a/modules/OCPP201/OCPP201.cpp +++ b/modules/OCPP201/OCPP201.cpp @@ -44,6 +44,22 @@ void OCPP201::init() { this->charge_point = std::make_unique(json_config, this->ocpp_share_path.string(), this->config.MessageLogPath); + + int evse_id = 1; + for (const auto &evse : this->r_evse_manager) { + evse->subscribe_session_event([this, evse_id](types::evse_manager::SessionEvent session_event) { + switch (session_event.event) { + case types::evse_manager::SessionEventEnum::SessionStarted: + this->charge_point->on_session_started(evse_id, 1); + break; + case types::evse_manager::SessionEventEnum::SessionFinished: + this->charge_point->on_session_finished(evse_id, 1); + break; + } + }); + evse_id++; + } + this->charge_point->start(); }