How mharisnaveed/iso15118_evcat works
1. System shape
- This repo is a two-node ISO 15118 deployment: an EVCC process on one Raspberry Pi and a SECC process on another, connected only through a PLC bridge.
- The physical/data-link side is handled by the PLC network; the application side is the ISO 15118 session implemented in Python under iso15118_core.
2. Top-level deployment boundaries
- EVCC_Client/ contains the vehicle-side runner scripts.
- SECC_Master/ contains the charger-side runner scripts.
- config/ holds network and host setup for the Raspberry Pi/PLC environment.
- logs/ stores captured session logs and historical runs.
- iso15118_core/ is the actual protocol stack and custom battery-test extension layer.
3. Startup and process ownership
- Each side is a separate process with its own configuration and controller state; there is no shared memory between EVCC and SECC.
- The main.py modules under iso15118/evcc/ and iso15118/secc/ are the primary application entry points into the protocol stack.
4. Transport path
- Discovery starts with SDP over UDP multicast on link-local IPv6.
- After discovery, the nodes establish TCP, then upgrade to TLS 1.3 before exchanging V2G application messages.
- The transport layer is split cleanly into udp_client.py / udp_server.py and tcp_client.py / tcp_server.py.
5. Protocol engine and message model
- The repo follows the ISO 15118 layering: shared message definitions, schema-backed message types, and protocol state machines.
- iso15118/shared/messages/ and iso15118/shared/schemas/ define the protocol payloads for DIN SPEC, ISO 15118-2, and ISO 15118-20.
- The state-machine implementations live in evcc/states/ and secc/states/, separated by protocol version and energy-service family.
6. Session orchestration
- comm_session_handler.py on each side coordinates the session lifecycle: protocol negotiation, authorization, service discovery, service selection, and charge-loop execution.
- shared/comm_session.py holds the common session abstractions used by both roles.
- This is the main boundary where transport events are converted into protocol-state transitions.
7. Controller abstraction
- Both EVCC and SECC use controller interfaces to isolate protocol logic from the “real world.”
- controller/interface.py defines the expected controller contract, while controller/simulator.py provides simulated implementations.
- On the SECC side, ev_data.py and evse_data.py package the negotiated limits and runtime state that flow through the session.
8. Battery diagnostic extension layer
- The project’s main custom addition is shared/battery_diagnostics/, which implements a Value-Added Services framework on top of ISO 15118-20.
- registry.py routes a selected diagnostic service by service ID.
- base_service.py defines the service interface, and telemetry.py writes the final report.
- services/health_test.py is the implemented battery discharge-capacity service; EIS and HPPC are planned placeholders in the architecture.
9. Battery physics model
- battery_simulator.py is intentionally separated from protocol and service logic.
- It provides the SOC/voltage/thermal behavior used by the diagnostic service, so the protocol layer only sees charging/discharging commands and measured telemetry.
- This separation is important for diagramming: protocol state machine, diagnostic service sequencing, and battery model are three distinct layers.
10. Security and PKI
- Security is not optional glue here; it is part of the main architecture.
- shared/security.py, shared/pki/, and the cert config files support the TLS/Plug-and-Charge-style certificate chain.
- The repo includes certificate generation tooling and sample configs, indicating that security setup is an explicit deployment step, not a runtime afterthought.
11. Standard and version partitioning
- The implementation supports multiple standards branches: DIN SPEC, ISO 15118-2, and ISO 15118-20.
- The current project focus is ISO 15118-20 because it natively supports BPT and VAS, which are required for the discharge-based battery tests.
- This means there are parallel protocol trees, but the architecture is centered on ISO 15118-20 for the diagnostic use case.
12. Infrastructure and operational tooling
- docker-compose*.yml, Makefile, and .env files support local and containerized execution of the protocol stack.
- config/setup_plc_network.sh and config/dhcpcd.conf reflect the Raspberry Pi + PLC networking setup.
- tests/ covers protocol states, message validation, security, and the new diagnostic framework, showing that behavior is validated at both the standards and service layers.
13. External integration points
- The physical PLC hardware is the transport boundary to the real world.
- The current architecture also leaves room for future hardware/BMS integration, but today the diagnostic layer runs on the simulated battery model.
- Diagnostic telemetry is emitted as a JSON report at session end, which is the main data product produced outside the live protocol exchange.
14. How to draw the diagram
- Draw two separate runtime nodes: EVCC client and SECC master.
- Between them, show SDP discovery over UDP, then TCP/TLS 1.3, then the ISO 15118-20 session.
- Inside the SECC node, show the flow from session handler to controller to diagnostic service registry to battery simulator/telemetry.
- Inside the EVCC node, show the mirrored session/state machine path and the client-side controller/transport boundary.
Main entry points: secc/comm_session_handler.py SECC session · evcc/comm_session_handler.py EVCC session · udp_client.py EVCC transport · udp_server.py SECC transport
Components 21
Deployment
Runtime processes and environment boundaries
Protocol Stack
EVCC/SECC session logic and transport
- EVCC session · EVCC session lifecycle and state dispatch
iso15118_core/iso15118/evcc/comm_session_handler.py - SECC session · SECC session lifecycle and state dispatch
iso15118_core/iso15118/secc/comm_session_handler.py - EVCC states · DIN SPEC, ISO 15118-2, and ISO 15118-20 EVCC states
iso15118_core/iso15118/evcc/states/iso15118_20_states.py - SECC states · DIN SPEC, ISO 15118-2, and ISO 15118-20 SECC states
iso15118_core/iso15118/secc/states/iso15118_20_states.py - EVCC transport · SDP discovery and TCP client path
iso15118_core/iso15118/evcc/transport/udp_client.py - SECC transport · SDP responder and TCP server path
iso15118_core/iso15118/secc/transport/udp_server.py - EVCC controller · EVCC world-interface abstraction
iso15118_core/iso15118/evcc/controller/interface.py - SECC controller · SECC world-interface abstraction
iso15118_core/iso15118/secc/controller/interface.py
Shared Core
Common message, security, and session primitives
- Shared session · Common comm-session abstractions
iso15118_core/iso15118/shared/comm_session.py - Messages · Shared protocol message definitions
iso15118_core/iso15118/shared/messages/__init__.py - Schemas · DIN SPEC, ISO 15118-2, and ISO 15118-20 schemas
iso15118_core/iso15118/shared/schemas/__init__.py - Security · TLS and Plug-and-Charge security helpers
iso15118_core/iso15118/shared/security.py - PKI · Certificate configs and generation tooling
iso15118_core/iso15118/shared/pki/create_certs.sh
Battery Diagnostics
Custom service layer and battery model
- VAS registry · Routes battery diagnostic services by ID
iso15118_core/iso15118/shared/battery_diagnostics/registry.py - Health test · Battery discharge-capacity service
iso15118_core/iso15118/shared/battery_diagnostics/services/health_test.py - Battery model · SOC, voltage, and thermal behavior
iso15118_core/iso15118/shared/battery_diagnostics/battery_simulator.py - Telemetry · Final session report writer
iso15118_core/iso15118/shared/battery_diagnostics/telemetry.py
Connections 24
- EVCC main → EVCC session: starts · EVCC entry point creates the session handler
- SECC main → SECC session: starts · SECC entry point creates the session handler
- EVCC session → EVCC states: drives · Session events advance EVCC protocol states
- SECC session → SECC states: drives · Session events advance SECC protocol states
- EVCC session → EVCC transport: uses · Session handler receives discovery and TCP/TLS events
- SECC session → SECC transport: uses · Session handler accepts discovery and TCP/TLS events
- EVCC session → EVCC controller: calls · Protocol state machine consults EV controller abstraction
- SECC session → SECC controller: calls · Protocol state machine consults SE controller abstraction
- EVCC session → Shared session: builds on · EVCC session uses shared comm-session primitives
- SECC session → Shared session: builds on · SECC session uses shared comm-session primitives
- EVCC states → Messages: encodes · EVCC states exchange shared protocol messages
- SECC states → Messages: encodes · SECC states exchange shared protocol messages
- Messages → Schemas: validated by · Shared payloads are backed by standards schemas
- EVCC transport → SECC transport: SDP / UDP · Link-local multicast discovery over UDP
- EVCC transport → SECC transport: TCP / TLS 1.3 · Post-discovery V2G session transport
- Security → PKI: depends on · TLS and Plug-and-Charge trust material come from PKI config
- SECC session → VAS registry: selects · ISO 15118-20 service selection routes to a diagnostic service
- VAS registry → Health test: routes to · Selected service is instantiated by service ID
- Health test → Battery model: simulates · Diagnostic service reads battery behavior from the model
- Health test → Telemetry: reports · Service writes final telemetry report
- PLC setup → SECC transport: enables · PLC network setup supports charger-side transport
- PLC setup → EVCC transport: enables · PLC network setup supports vehicle-side transport
- Logs → EVCC session: captures · Runtime logs reflect EVCC session execution
- Logs → SECC session: captures · Runtime logs reflect SECC session execution