Virtual lab
A virtual car, charger and backend on one clock: run a charging session, make one part go wrong, watch every message, and open the files in the analyzer.
What it is
Three parts run in this browser on one clock. The car and the charger speak ISO 15118-2 (AC or DC), DIN SPEC 70121 (DC) or ISO 15118-20 (AC, DC, or bidirectional DC where the car gives energy back) over the cable, with the Control Pilot, SLAC and SDP before it. ISO 15118-20 runs only over TLS 1.3, so the lab does too: the car and the charger agree on what ISO 15118-20 asks, the charger shows a lab certificate chain with its OCSP response, and the run writes the key log beside the capture, so the analyzer opens the session as it opens a bench capture with its key log. The charger and its backend speak OCPP 1.6, 2.0.1 or 2.1. The charger links the two sides as a real one does: it asks the backend about the card before it lets the car charge, it reports the transaction and the meter, and a charging profile from the backend lowers the limit it gives the car. Every V2G message is encoded with the same libcbv2g codec the analyzer decodes with, every OCPP message is checked against the OCA schema of its version, and the backend answers like the OCPP sandbox. Nothing is sent anywhere; the lab works in the offline edition too.
Run it
- Open Virtual lab in the top bar.
- Choose how the car talks to the charger, the OCPP version between charger and backend, and how long the car charges. In Expert mode you also set the state of charge at the start and the card the driver presents.
- Choose what should happen: everything works, the backend limits the power, or one part goes wrong: the backend refuses the card, SLAC never matches, the cable check fails, pre-charge stalls, an emergency stop, a car that draws too much current, a charger that draws more out of a bidirectional car than it asked, a charger that reports late, bills other energy, gives the wrong stop reason or breaks the OCPP schema. On ISO 15118-2 and ISO 15118-20 there are also the Plug and Charge situations below. A situation that needs DC or AC says so.
- Run. The three lanes show the car, the charger and the backend with their state at the playhead; the messages appear between them as they happen, a request and its answer on one line, a loop of the same exchange counted. Play, pause, change the speed or drag the time.
- What the analyzer finds: the page reads the files the run wrote and puts the verdict and the checks beside what the situation expects. Open in Diagnose opens the capture, the Control Pilot log and the OCPP log in the analyzer, on one timeline, with the key log of a run over TLS; Download saves them all.
Plug and Charge
- On ISO 15118-2 (AC and DC) and ISO 15118-20 (AC, DC and bidirectional DC) the car can pay with its contract instead of a card. The car sends its contract certificate chain and signs a fresh challenge from the charger, and the charger asks the backend about the contract before it answers the car.
- ISO 15118-2 runs these situations in TLS 1.2, as Plug and Charge needs: the charger shows a secp256r1 lab chain and staples its OCSP response, and the run writes the key log beside the capture. The car selects Contract payment and presents its contract in PaymentDetailsReq, where the charger asks the backend; it then signs the challenge of PaymentDetailsRes in AuthorizationReq. A refused certificate gets its FAILED_ code in PaymentDetailsRes, and the charger closes the connection. ISO 15118-20 runs in TLS 1.3 as always, offers Plug and Charge in AuthorizationSetupRes and refuses with a WARNING_ code. Card runs of ISO 15118-2 stay without TLS.
- Over OCPP 2.0.1 and 2.1 the charger sends Authorize with the eMAID and the hashes of the contract chain; over OCPP 1.6 the same goes inside a DataTransfer for Plug and Charge.
- Situations: Plug and Charge; a contract installed first, where the car shows its car maker certificate and the backend issues a contract through the charger; a contract that has expired, one the operator revoked, a chain that misses a certificate; a car that signs the wrong challenge; and a charger that lets the car charge although the backend refused the contract.
- The certificates are a lab PKI made for the lab, and the signatures have the right shape but no key behind them, so the lab shows the messages and the decisions, not a cryptographic proof. These situations run with the virtual backend only, since the backend judges the contract.
Your backend in place of the virtual one
- Hosted edition, Pro and Team: choose Your backend above the settings, enter the address of your OCPP backend, the charge point identity and the password if it asks for one, and test the connection.
- Run against my backend: the emulator service connects to your backend as the lab charger and plays the run in real time, about the charging time plus 20 seconds. The frames show as they come; when the run ends, the page rebuilds it from them, with the lanes, the files and the verdict as for a virtual run.
- Your backend decides: a card it refuses keeps the car waiting until it gives up, a boot it does not accept stops the charger before any car charges, a charging profile it sends lowers the limit the charger gives the car, and a remote stop ends the transaction. The situations about the card, the power limit and Plug and Charge are therefore the virtual backend's alone.
- A run counts like a run of the emulator: the same runs a day, runs at a time and address rules. The password is used for the run and not stored. Your last runs are listed below the form and open again.
The test matrix
- Test matrix, beside One run: every situation on each standard and OCPP version you choose, each run through the analyzer and held to its expected verdict and checks. All 291 combinations take a few seconds in the browser.
- The scorecard has a row per situation and a column per standard and OCPP version; a tick is as expected, a cross differs. A cell opens its run in One run, with its lanes and files.
- Download the report saves the scorecard as a web page, with each combination that differs, what was expected and what the analyzer found.
- Against your backend (hosted, Pro and Team): choose Your backend, then Test matrix. The situations your backend does not decide run on each standard you choose, at the OCPP version you choose, one run after the other in real time with a 20 s charge, about 40 s each. The first generation standards are ticked to start with; tick ISO 15118-20 to add it, within the runs your plan has in a day. Each run counts as a run of the emulator; the button says how many runs and about how long. The page scores each run as it ends; a cell opens the run with what your backend answered, and the report names your backend.
- Every night: Run it every night, under the matrix against your backend, saves it as one of the emulator's daily runs at an hour you choose (UTC). The emulator then plays the matrix and scores each run itself, with no page open, and emails the owners and admins of your account when a combination stops landing where it should, when all land again, and when the matrix cannot run. The password, if your backend needs one, is stored sealed. Nightly test matrices lists them: Run now, Pause, Delete, and the last result opens that night's scorecard.
Against a real charger
- The lab car also runs from the command line against a real charger, for charger firmware you own on a link you control: node scripts/harness/lab-car.ts --interface <the interface the charger is on> --protocol iso2-dc --charge 30. It finds the charger with SDP, runs an ISO 15118-2, DIN SPEC 70121 or ISO 15118-20 (AC, DC or bidirectional) session that the charger's answers lead, writes the capture, and holds the analyzer's verdict to what a charger that does its part gets; the exit code says whether it did. ISO 15118-20 runs over TLS 1.3 and ISO 15118-2 over TLS 1.2 with --tls: the capture holds the encrypted records and the key log beside it opens them, and --root checks the charger's chain against your V2G root. Plug and Charge is not played: it needs a contract certificate from a mobility operator's PKI, which the lab car does not hold, so the car identifies itself externally (EIM).
- Situations: a full session for the time you set; the car stopping five seconds after the energy starts; on DC, a car that keeps asking for more current than the charger allows (the charger passes when it never delivers more than its limit); and a car that goes silent (the charger passes when it ends the session within its sequence timeout, 60 s by default). --demo runs it against a lab charger on your own machine; --demo-fault against one whose pre-charge stalls, to see a run fail.
- In the software-in-the-loop harness, V2G_CAR=lab puts the lab car in place of Josev's, with no Python to install. It needs no SLAC: on a powerline, the modems pair first.
Use it for
- A demonstration or a training: show what each part does and what a fault looks like from the cable, from the pilot and from the backend.
- Learning the analyzer: each situation lands on a known verdict, so you see which checks catch which fault.
- Regression: every combination of standard, OCPP version and situation runs in the unit tests with its expected verdict (test/lab.test.ts), and the test matrix runs them on the page, so a change in the analyzer that moves one shows at once.
- Testing a backend with a car and a charger behind it: what your backend answers decides what the virtual car does, and the analyzer checks the result across the cable, the pilot and OCPP.