Skip to content

Commit

Permalink
Multiplexer module for ISO communication
Browse files Browse the repository at this point in the history
This module starts and SDP server and waits
for incoming V2G connections (TCP, and optionally TLS).
Upon connection, it reads the SupportedAppProtocol.req message
to determine if the EV supports ISO-20 or not.

If ISO-20 is supported, it transparently bridges the connection
to the ISO-20 module (using TLS->TCP).

If the EV does not support ISO-20, it bridges to the ISO-2 module
instead.

Both the required iso-2 and iso-20 modules only need TCP enabled,
but they require to accept e.g. PnC on TCP sessions (as the actual
communication to the EV may be TLS).
Also the need to listen on localhost (::1) instead of the actual
PLC device.

Signed-off-by: Cornelius Claussen <[email protected]>
  • Loading branch information
corneliusclaussen committed Jul 12, 2024
1 parent b2ea2fe commit 02ea455
Show file tree
Hide file tree
Showing 32 changed files with 4,012 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ 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-dc-tls)
generate_config_run_script(CONFIG sil-dc-isomux)
generate_config_run_script(CONFIG sil-dc-isomux-tls)
generate_config_run_script(CONFIG sil-dc-sae-v2g)
generate_config_run_script(CONFIG sil-dc-sae-v2h)
generate_config_run_script(CONFIG sil-two-evse-dc)
Expand Down
165 changes: 165 additions & 0 deletions config/config-sil-dc-isomux-tls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
active_modules:
iso15118_2:
module: EvseV2G
config_module:
device: lo
tls_security: allow
enable_sdp_server: false
connections:
security:
- module_id: evse_security
implementation_id: main
iso15118_20:
module: DummyV2G
iso_mux:
module: IsoMux
config_module:
device: auto
tls_security: force
connections:
security:
- module_id: evse_security
implementation_id: main
iso2:
- module_id: iso15118_2
implementation_id: charger
iso20:
- module_id: iso15118_20
implementation_id: main
iso15118_car:
module: PyEvJosev
config_module:
device: auto
supported_DIN70121: false
supported_ISO15118_2: true
tls_active: true
enforce_tls: true
evse_manager:
module: EvseManager
config_module:
connector_id: 1
country_code: DE
evse_id: DE*PNX*E12345*1
evse_id_din: 49A80737A45678
session_logging: true
session_logging_xml: false
session_logging_path: /tmp/everest-logs
charge_mode: DC
hack_allow_bpt_with_iso2: true
payment_enable_contract: false
connections:
bsp:
- module_id: yeti_driver
implementation_id: board_support
powermeter_car_side:
- module_id: powersupply_dc
implementation_id: powermeter
slac:
- module_id: slac
implementation_id: evse
hlc:
- module_id: iso_mux
implementation_id: charger
powersupply_DC:
- module_id: powersupply_dc
implementation_id: main
imd:
- module_id: imd
implementation_id: main
powersupply_dc:
module: DCSupplySimulator
yeti_driver:
module: JsYetiSimulator
config_module:
connector_id: 1
slac:
module: JsSlacSimulator
imd:
config_implementation:
main:
selftest_success: true
module: IMDSimulator
ev_manager:
module: EvManager
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
dc_target_current: 20
dc_target_voltage: 400
connections:
ev_board_support:
- module_id: yeti_driver
implementation_id: ev_board_support
ev:
- module_id: iso15118_car
implementation_id: ev
slac:
- module_id: slac
implementation_id: ev
auth:
module: Auth
config_module:
connection_timeout: 10
selection_algorithm: FindFirst
connections:
token_provider:
- module_id: token_provider
implementation_id: main
token_validator:
- module_id: token_validator
implementation_id: main
evse_manager:
- module_id: evse_manager
implementation_id: evse
token_provider:
module: DummyTokenProvider
config_implementation:
main:
token: TOKEN1
connections:
evse:
- module_id: evse_manager
implementation_id: evse
token_validator:
module: DummyTokenValidator
config_implementation:
main:
validation_result: Accepted
validation_reason: Token seems valid
sleep: 0.25
evse_security:
module: EvseSecurity
config_module:
private_key_password: "123456"
energy_manager:
module: EnergyManager
config_module:
schedule_total_duration: 1
schedule_interval_duration: 60
debug: false
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
implementation_id: energy_grid
powermeter:
- module_id: yeti_driver
implementation_id: powermeter
api:
module: API
connections:
evse_manager:
- module_id: evse_manager
implementation_id: evse
x-module-layout: {}
162 changes: 162 additions & 0 deletions config/config-sil-dc-isomux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
active_modules:
iso15118_2:
module: EvseV2G
config_module:
device: lo
tls_security: allow
enable_sdp_server: false
connections:
security:
- module_id: evse_security
implementation_id: main
iso15118_20:
module: DummyV2G
iso_mux:
module: IsoMux
config_module:
device: auto
tls_security: allow
connections:
security:
- module_id: evse_security
implementation_id: main
iso2:
- module_id: iso15118_2
implementation_id: charger
iso20:
- module_id: iso15118_20
implementation_id: main
iso15118_car:
module: PyEvJosev
config_module:
device: auto
supported_DIN70121: true
supported_ISO15118_2: true
evse_manager:
module: EvseManager
config_module:
connector_id: 1
country_code: DE
evse_id: DE*PNX*E12345*1
evse_id_din: 49A80737A45678
session_logging: true
session_logging_xml: false
session_logging_path: /tmp/everest-logs
charge_mode: DC
hack_allow_bpt_with_iso2: true
connections:
bsp:
- module_id: yeti_driver
implementation_id: board_support
powermeter_car_side:
- module_id: powersupply_dc
implementation_id: powermeter
slac:
- module_id: slac
implementation_id: evse
hlc:
- module_id: iso_mux
implementation_id: charger
powersupply_DC:
- module_id: powersupply_dc
implementation_id: main
imd:
- module_id: imd
implementation_id: main
powersupply_dc:
module: DCSupplySimulator
yeti_driver:
module: JsYetiSimulator
config_module:
connector_id: 1
slac:
module: JsSlacSimulator
imd:
config_implementation:
main:
selftest_success: true
module: IMDSimulator
ev_manager:
module: EvManager
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
dc_target_current: 20
dc_target_voltage: 400
connections:
ev_board_support:
- module_id: yeti_driver
implementation_id: ev_board_support
ev:
- module_id: iso15118_car
implementation_id: ev
slac:
- module_id: slac
implementation_id: ev
auth:
module: Auth
config_module:
connection_timeout: 10
selection_algorithm: FindFirst
connections:
token_provider:
- module_id: token_provider
implementation_id: main
token_validator:
- module_id: token_validator
implementation_id: main
evse_manager:
- module_id: evse_manager
implementation_id: evse
token_provider:
module: DummyTokenProvider
config_implementation:
main:
token: TOKEN1
connections:
evse:
- module_id: evse_manager
implementation_id: evse
token_validator:
module: DummyTokenValidator
config_implementation:
main:
validation_result: Accepted
validation_reason: Token seems valid
sleep: 0.25
evse_security:
module: EvseSecurity
config_module:
private_key_password: "123456"
energy_manager:
module: EnergyManager
config_module:
schedule_total_duration: 1
schedule_interval_duration: 60
debug: false
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
implementation_id: energy_grid
powermeter:
- module_id: yeti_driver
implementation_id: powermeter
api:
module: API
connections:
evse_manager:
- module_id: evse_manager
implementation_id: evse
x-module-layout: {}
4 changes: 4 additions & 0 deletions lib/staging/tls/tls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,10 @@ int Connection::socket() const {
return m_context->soc;
}

SSL* Connection::ssl_context() const {
return m_context->ctx.get();
}

// ----------------------------------------------------------------------------
// ServerConnection represents a TLS server connection

Expand Down
14 changes: 14 additions & 0 deletions lib/staging/tls/tls.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <functional>
#include <memory>
#include <mutex>
#include <openssl/types.h>
#include <string>
#include <tuple>
#include <unistd.h>
Expand Down Expand Up @@ -309,6 +310,19 @@ class Connection {
* \returns the underlying socket or INVALID_SOCKET on error
*/
[[nodiscard]] int socket() const;

/**
* \brief obtain the underlying SSL context
* \returns the underlying SSL context pointer
*/
[[nodiscard]] SSL* ssl_context() const;

/**
* \brief set the read timeout in ms
*/
void set_read_timeout(int ms) {
m_timeout_ms = ms;
}
};

/**
Expand Down
1 change: 1 addition & 0 deletions modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ev_add_module(EvseManager)
ev_add_module(EvseSecurity)
ev_add_module(EvseSlac)
ev_add_module(EvseV2G)
ev_add_module(IsoMux)
ev_add_module(EvSlac)
ev_add_module(GenericPowermeter)
ev_add_module(JsTibber)
Expand Down
Loading

0 comments on commit 02ea455

Please sign in to comment.