Maintain a real-time fleet state database indexed by chargePointId and transactionId; for each active bidirectional session, store the current SOC (from MeterValues 'SoC' measurand), available discharge power (from the V2XChargingNeeds response), and session start time.
Receive a dispatch signal from the grid operator or VPP market system specifying total MW discharge target and duration; distribute the target across available V2G-capable sessions using a dispatch algorithm (e.g., proportional to available discharge capacity, or merit-order based on SOC and departure time constraints).
For each session in the dispatch plan, send a SetChargingProfile request with a ChargingProfile containing a negative-power ChargingSchedule period (discharge) for the dispatch duration, a ChargingRateUnit of 'W', and stackLevel set to distinguish VPP dispatch from other profiles.
Monitor MeterValues during the dispatch window: collect 'Power.Active.Import' (negative = discharge) and 'Energy.Active.Export.Register' measurands at the configured SampledValue interval; aggregate across all sessions to compute fleet-level power and energy delivered.
Handle session drop-outs gracefully: if a vehicle disconnects mid-dispatch, recalculate the dispatch plan across remaining sessions and send updated SetChargingProfile requests — maintain a headroom buffer (e.g., deploy 90% of available capacity) to absorb unexpected dropouts.
After the dispatch window, send a ClearChargingProfile (targeting the VPP stackLevel) or a new SetChargingProfile with a positive power schedule to resume normal charging; report the delivered energy and power time series to the grid operator via the agreed telemetry channel.
Known gotchas
V2G dispatch accuracy depends on each vehicle's ability to track the CSMS setpoint; vehicle-side power control loops have ramp rates and dead-bands, so fleet-level power delivery will lag and deviate from the target — size dispatch commitments conservatively and provide this uncertainty to the grid operator.
SOC data from MeterValues is reported by the charge point and reflects the vehicle's own SOC estimate, which may differ from actual battery capacity due to BMS estimation errors; do not commit a dispatch based on SOC alone without a buffer to avoid discharging vehicles below their stated minimum SOC.
OCPP 2.1 charging profiles at higher stackLevel override those at lower stackLevel; if the charge point already has a smart-charging profile applied by another system (e.g., a local energy management system), confirm stackLevel priority with the site operator before deploying VPP profiles to avoid unintended profile conflicts.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp