OCPP 2.0.1 and ISO 15118: the backend behind the cable
How a charger turns what the car says into OCPP calls and back: Plug and Charge authorization, contract certificates installed and renewed through the backend, certificate status, backend charging profiles that become the schedules the car sees, and meter values on their way to the backend.
Three parties, two links
ISO 15118 runs between the car and the charger; OCPP runs between the charger and its management system (CSMS). The car never talks to the backend. Everything it needs from there, a contract check, a new certificate, a power limit, travels as an OCPP call that the charger makes while the car waits on the cable. Everything the backend learns about the car, its energy needs, the schedule it chose, the meter, is what the charger forwards.
- The charger translates: EXI over the powerline on one side, JSON over a WebSocket on the other. Most content is mapped field by field; the certificate messages pass through as EXI.
- The car keeps its own timers meanwhile. The charger can only buy time in responses that have EVSEProcessing: it answers Ongoing and the car asks again. Where that field is missing, the whole backend round trip has to fit into one response time.
- OCPP 2.0.1 was written around ISO 15118-2. OCPP 2.1 extends it for ISO 15118-20 and bidirectional power. This page names ISO 15118-2 first and says where ISO 15118-20 differs.
| Step | ISO 15118-2 | ISO 15118-20 | OCPP call meanwhile |
|---|---|---|---|
| Contract check | AuthorizationRes, EVSEProcessing Ongoing | AuthorizationRes, EVSEProcessing Ongoing | Authorize |
| Charging needs and schedule | ChargeParameterDiscoveryRes, EVSEProcessing Ongoing | ScheduleExchangeRes, EVSEProcessing Ongoing | NotifyEVChargingNeeds, then SetChargingProfile from the backend |
| Certificate installation | No EVSEProcessing: one response time | CertificateInstallationRes, EVSEProcessing Ongoing | Get15118EVCertificate |
V2G_EVCC_Ongoing_Timeout (tim.ongoingTimeoutS, 60 s) and the longer response time of the certificate messages (tim.msgTimeoutLongS, 5 s) are flagged for verification in the limit profile. Which ISO 15118 parts each OCPP version covers is to be checked against the OCPP specifications.
Plug and Charge authorization
- The car sends its contract chain, in PaymentDetailsReq (ISO 15118-2) or AuthorizationReq (ISO 15118-20), and signs AuthorizationReq with its contract key over the challenge the charger sent. Plug and Charge and its PKI shows the messages.
- The charger checks on the spot what it can: the signature, with the public key of the contract certificate, and that the echoed challenge is the one it sent.
- For the contract itself it sends Authorize to the CSMS. The idToken is the eMAID, of type eMAID. With it goes either the contract certificate, or iso15118CertificateHashData: the hashes and serial numbers the backend needs to ask the OCSP responders about each certificate of the chain.
- The answer carries idTokenInfo with the status of the contract (Accepted, Blocked, Expired, Invalid and others) and a certificateStatus for the chain. The charger turns it into the ResponseCode of AuthorizationRes: OK with EVSEProcessing Finished, or one of the certificate codes described in Certificate lifecycle: validity, renewal and revocation.
- Until the answer arrives the charger keeps answering Ongoing. A backend slower than the car is patient turns a valid contract into a session that never starts. TIM-02 measures the loop, and The session stops at authorization lists the other causes.
- A charger may also check the chain locally, against the MO roots it holds, when the backend cannot be reached. Whether it may is a matter of its configuration.
OCPP 1.6 has none of this natively. Installations that run Plug and Charge over OCPP 1.6 carry the same exchanges in DataTransfer messages defined by an extension, so the names in the log differ.
The fields of Authorize (the idToken type eMAID, certificate, iso15118CertificateHashData, idTokenInfo and certificateStatus) and their values are given as OCPP 2.0.1 is commonly implemented. Check them, and the mapping from certificateStatus to the ISO 15118 response codes, against the OCPP 2.0.1 specification.
Installing and renewing a contract certificate
- The car asks for a contract with CertificateInstallationReq, signed with its OEM provisioning key. In ISO 15118-2 it renews one with CertificateUpdateReq, signed with the current contract key; ISO 15118-20 runs another installation instead.
- The charger does not need to understand the request. It sends it to the CSMS in Get15118EVCertificate: the EXI request, base64 encoded, with the action Install or Update and the schema the car used.
- The CSMS passes it on to the provisioning service of the ecosystem, which finds the contract for the car's PCID, encrypts the contract key for the car and signs the package. The EXI response comes back in the Get15118EVCertificate result, and the charger hands it to the car as CertificateInstallationRes or CertificateUpdateRes.
- The package is signed by the provisioning service, so the car can tell whether anyone on the way changed it.
- Timing is the hard part. In ISO 15118-2 CertificateInstallationRes has no EVSEProcessing, so the round trip through CSMS and provisioning service has to fit into one response time. In ISO 15118-20 the charger can answer Ongoing and the car asks again.
- When no contract waits for the car, it gets FAILED_NoCertificateAvailable (ISO 15118-2) or WARNING_NoCertificateAvailable (ISO 15118-20) and can go on with external identification.
- A charger should offer installation only when its backend supports it: the Certificate service in ServiceDiscoveryRes (ISO 15118-2), CertificateInstallationService in AuthorizationSetupRes (ISO 15118-20).
The same link keeps the charger's own side of the PKI current. SignCertificate asks the CSMS for a new SECC certificate and CertificateSigned delivers it; InstallCertificate adds a trust anchor such as a V2G root or an MO root, and DeleteCertificate removes one.
The fields of Get15118EVCertificate (the schema version, the action, the EXI request and response) and the certificate types of SignCertificate and InstallCertificate are given as commonly implemented; check them against OCPP 2.0.1.
Certificate status
- Contract certificates are checked in the backend: the CSMS uses the hash data from Authorize to ask the OCSP responder of each issuer.
- GetCertificateStatus lets the charger obtain an OCSP response without reaching the responder itself. It sends the OCSP request data of one certificate, and the CSMS returns the response it got. A charger that checks contracts locally keeps its revocation data current this way, and it can fetch responses for its own chain the same way.
- ISO 15118-20 needs those responses on the cable: the car asks for OCSP stapling in its ClientHello, and the charger attaches a response to each certificate of its chain. A charger whose stapled responses have expired fails the handshake with a strict car, although its certificates are fine. See Certificate lifecycle: validity, renewal and revocation.
In TLS 1.3 the stapled responses travel inside the encrypted Certificate message, and an alert the car sends after the ServerHello is encrypted too. Load the key log to see which response the car rejected; see TLS in charging captures.
Which OCPP 2.0.1 use cases call GetCertificateStatus, and whether OCPP 2.0.1 covers the OCSP stapling of ISO 15118-20 or leaves it to OCPP 2.1, is to be checked against the specifications.
From a charging profile to the car's schedule
- 1. The car states its needs in ChargeParameterDiscoveryReq: the energy transfer mode, DepartureTime, EAmount (AC) or EVEnergyRequest (DC), its limits, and MaxEntriesSAScheduleTuple.
- 2. The charger forwards them in NotifyEVChargingNeeds and answers the car Ongoing meanwhile.
- 3. The CSMS works out a plan and sends SetChargingProfile with a transaction profile (TxProfile): charging schedules made of periods with a limit in W or A, and optionally a sales tariff.
- 4. The charger combines it with the other profiles in force, such as a station maximum or a limit from a site energy manager, and builds the SAScheduleList: up to three SAScheduleTuple entries, each a PMaxSchedule with an optional SalesTariff. It answers ChargeParameterDiscoveryRes with Finished.
- 5. The car picks a tuple and names its SAScheduleTupleID in PowerDeliveryReq, with an optional ChargingProfile of its own. SQ-08 checks that the ID is one the charger sent.
- 6. The charger reports the car's choice to the CSMS with NotifyEVChargingSchedule.
| What goes wrong in the translation | What you see |
|---|---|
| Units: PMax is a power, so a profile in amperes has to be multiplied by the voltage and the number of phases | A wrong phase count gives a third, or three times, the intended power in the PMaxSchedule |
| Time: an OCPP schedule can start at an absolute time, the SAScheduleList counts relative seconds from its RelativeTimeInterval starts | Steps that come early or late by the offset between the two |
| Too many schedules for the car | More tuples than MaxEntriesSAScheduleTuple, or more than the three the list can hold |
| No profile arrives in time | The Ongoing loop runs until the charger falls back to a schedule of its own, or until the car gives up; TIM-02 measures it |
- A new SetChargingProfile for the running transaction makes the charger set EVSENotification ReNegotiation (ISO 15118-2) or ScheduleRenegotiation (ISO 15118-20), and the car renegotiates and picks a new tuple.
- For a quick change without a new schedule, the charger can lower EVSEMaxCurrent in ChargingStatusRes (AC) or its EVSEMaximum limits in CurrentDemandRes (DC).
- In ISO 15118-20 the needs come from ScheduleExchangeReq. In scheduled mode the plan goes back as ScheduleTuple entries of power in ScheduleExchangeRes; in dynamic mode the charger sets the power itself during the loop. ISO 15118-20: control modes, BPT and power profiles explains both modes.
The fields of NotifyEVChargingNeeds, NotifyEVChargingSchedule and SetChargingProfile, the profile purposes and the number of schedules one profile may carry are given as commonly implemented; check them against OCPP 2.0.1.
Metering, from the cable to the backend
- On the cable the charger reports its meter in MeterInfo: MeterID with MeterReading, and optionally SigMeterReading and MeterStatus, in ChargingStatusRes and CurrentDemandRes (ISO 15118-2); ChargedEnergyReadingWh and, for BPT, BPT_DischargedEnergyReadingWh in ISO 15118-20.
- With Plug and Charge the charger can set ReceiptRequired, and the car signs the reading with its contract key in MeteringReceiptReq (ISO 15118-2). ISO 15118-20 asks with EVSENotification MeteringConfirmation, and the car answers with MeteringConfirmationReq. SQ-10 checks that a requested receipt arrives.
- To the backend the charger reports meter values in TransactionEvent messages: at the start, periodically while the transaction runs, and at the end, with measurands such as Energy.Active.Import.Register, Power.Active.Import and SoC. Energy.Active.Export.Register counts what a bidirectional session gave back. A meter that signs its readings adds a signedMeterValue.
- Both usually come from the same meter but are sampled at different moments. Compare the last MeterInfo before SessionStop with the meter value at the end of the transaction: a small difference is timing, a large one or a MeterID the backend does not know is a configuration fault.
- A state of charge in the meter values can only come from the car: EVRESSSOC in DC_EVStatus (ISO 15118-2 DC) or DisplayParameters (ISO 15118-20). An ISO 15118-2 AC session does not carry it.
Whether and how OCPP 2.0.1 forwards the signed receipt of the car to the backend is to be checked; this page names no message for it. That MeterValues is meant for readings outside a transaction is to be checked as well.
Reading both sides in the analyzer
- Drop the OCPP-J log of the charger with the capture. The OCPP tab shows the connector status, the transactions with their metered energy, the backend's errors and its slowest answer, and lines the backend's view up with the cable: the transaction start against PowerDeliveryRes, the stop against SessionStopReq.
- The OCPP lane of the timeline puts Authorize, NotifyEVChargingNeeds or SetChargingProfile next to the Ongoing loop they explain.
- OCPP never changes a check or the verdict. It explains a long Ongoing loop or a refused contract; the checks still judge the cable.
- The ac-ok demo carries the OCPP 1.6 log of a session with external identification, to see the lane at work.
- Plug and Charge messages run inside TLS. Load the key log with the capture to read PaymentDetails, Authorization and the certificate messages.
Sources
- OCPP 2.0.1, Open Charge Alliance, part 2: authorization, smart charging and ISO 15118 certificate management
- OCPP 2.1, Open Charge Alliance
- ISO 15118-2:2014, PaymentDetails, Authorization, ChargeParameterDiscovery, CertificateInstallation, CertificateUpdate, MeteringReceipt
- ISO 15118-20:2022, AuthorizationSetup, Authorization, ScheduleExchange, CertificateInstallation, MeteringConfirmation
- RFC 6960, OCSP