
Simulating individual charging behaviour in MATSim
Sebastian Hörl
13 June 2025
MATSim User Meeting 2025

- Electric vehicles become more and more prevalent
- Various studies on infrastructure placement exist
- But behavior plays a crucial role
- Charging at home, at work, using public chargers?
- Only last component is covered in most studies
-
Goal: Let agents intelligently choose chargers in MATSim so that they optimize their daily score, like in a standard simulation
- Additional features: fallback behavior if a station is taken, ...
Introduction

- Electric vehicles (ev) contrib simulates decharging and charging of vehicles, provides the data and code infrastructure for charging stations, ...
- EV charging in DRT
- Send vehicle to charging stations when idle
- Decide when to stop charging
- UrbanEv package by TU Berlin
- Insert charging activities based on plan structure
- Charging inserted along the way
- Based on SoC thresholds
- Last package is used by for optimizing charging service provision (Montreal)
Existing work

Concept
- Each standard plan of MATSim obtains a new attribute that is a container for charging plans
- Always one charging plan is selected while the others are there for memory
- A charging plan indicates when an agent wants to charge during the day. The relevant information is saved in a ChargingActivity
- During an activity (start activity index, end activity index, charger)
- Along a leg (leg index, start/end time, charger)
- During an activity (start activity index, end activity index, charger)


Concept
- While running the simulation, we obtain charging plan score:
- Large penalty for reaching SoC = 0
- Penalty for falling below a configurable SoC
- Penalty for performing a detour to get to a charger
- ...
- A new replanning strategy for startegic charging is introduced:
- In X% of the cases, a new charging plan is proposed
- In (1 - X)%, an existing charging plan is selected from the charging plan memory, according to the charging score
- Fully integrated with other replanning strategies: A plan that is duplicated for mode choice / time mutation / ... keeps its attributes and thus the charging plan memory


Components
Two new major components:
Within-day electric vehicle charging (WEVC)
- Computational infrastructure for implementing charging activities during a day
- Provides interfaces that return a list of planned charging activities at the beginning of the day and implements them at time step 0
- Provides interfaces for online decision-making if desired
Strategic electric vehicle charging (SEVC)
- A standard implementation of the interfaces of WEVC
- Reads the planned charging activities from the plan attribute and lets WEVC implement them
- Provides standard routines for online decision-making
- Provides comprehensive scoring with charger types, tariffs, subscriptions, ...

Within-day electric vehicle charging
- Handles the insertion of new plug and unplug activities:
- Useful for analysis
- Act as triggers in the modeling chain ("when a plug activity starts, do this ...")
- Charging slots describe when the respective activities should be inserted (around a chain of activities, or along a leg)




Within-day electric vehicle charging
- Handles the insertion of new plug and unplug activities:
- Useful for analysis
- Act as triggers in the modeling chain ("when a plug activity starts, do this ...")
-
Charging slots describe when the respective activities should be inserted (around a chain of activities, or along a leg)
- Charging alternatives describe what the agent does when a planned charger is not available anymore




Within-day electric vehicle charging



Within-day electric vehicle charging
En-route alternatives
- When an agent goes on a leg that leads to a planned plug activity, we can call the alternative provides
- Allows the agent to check whether the plug is currently taken; allows us to implement short-term reservation systems
Proactive charging
- Send an agent to a charger at any time while a leg is ongoing
- Allows to implement spontaneous charging decisions
- With computational impact!

Strategic electric vehicle charging
- Streamlined interfaces that are implementing the WEVC functionality
- Replanning strategy for MATSim
Selection
Innovation
- Choose among the existing charging plans based on the charging score
- Find all possible activity-based charging slots
- Find all possible leg-based charging slots
- Randomly activate/deactivate each activity-based slot
- Remove all incompatible leg-based slots
- Randomly activate/deactivate each leg-based slot
- Randomly select a charger for each retained slot

LH
LH

Charging infrastructure
- Define different classes of chargers that ease the charger innovation process
Person-based chargers (e.g. household chargers)
- Added to the choice set by person identifier
- Per-charger attribute sevc:facilities (comma-separated)
Facility-based chargers (e.g. workplace chargers)
- Added to the choice set by the facility identifier of the first activity along a charging slot
- Per-charger attribute sevc:persons (comma-separated)
Public chargers
- Searched within a radius of (configurable) meters
- Per-charger attribute sevc:public = true

Charging infrastructure
Subscriptions
- Person attribute sevc:subscriptions contains the subscriptions that an agent possesses
- Charger attributes sevc:subscriptions indicates which subscriptions are necessary to use a charger
- Only chargers without subscriptions or compatible ones are selected

Charging scoring
- Various dimensions that are already included


Charging tariffs
- Different configurable cost structures
Global for all chargers
Individually per charger
- Using charger attributes
Tariff-based
- All tariffs are configured by name in configuration
- Chargers can have sevc:tariffs charger attribute
- Tariffs can be accessible conditional on the possession of subscriptions
- Agents choose the cheapest tariff that is available to them


Usage
- Activate the relevant modules in the run script
- Otherwise, everything encoded in
- Configuration
- Population (subscriptions, desired SoCs, ...)
- Activate functionality by setting wevc:active = true !!!
- Chargers (types, ...)
- Considerable work of setting everything up coherently and in a realistic way.
- Plan is to provide a bootstrap script that sets up a basic configuration from scratch.
- Next step: set up a fully parameterized realistic scenario!



Usage
Full MATSim loop
- Use SEVC together with other replanning strategies
- ChargingSlot activation works such that a slot is only implemented if it is still compatible with the current standard plan configuration

Standalone charging simulation
- Disable all other replanning strategies
- Agents will try to find the optimal charging plan for a fixed standard plan from a baseline simulation
- Allows to adapt the infrastructure according to the driving needs of the population
- Allows to explore the optimal charging decisions given current mobility patters

Output
- Detailed trace for all
- charging processes (from first attempt to finishing or giving up)
- charging attempts
- Detailed tracking of all scoring events
- When, where, who, how much (cost, travel time, ...), and how much score


Example
- Tests based on an existing simulation scenario


Example
- Tests based on an existing simulation scenario


Example
- Tests based on an existing simulation scenario


Example
- Tests based on an existing simulation scenario

Questions?


sebastian.horl@irt-systemx.fr
Simulating individual charging behaviour in MATSim
By Sebastian Hörl
Simulating individual charging behaviour in MATSim
MATSim User Meeting 2025, June 2025
- 141