DS
EV Driver Behaviour Simulator 🚗⚡️

EV Driver Behaviour Simulator 🚗⚡️

Agent-based modelling for EV charging patterns and flexibility insights

Project Details

Industry

Energy / Simulation / Data Science

Client

Energy Company (Technical Exercise)

Technologies

PythonStreamlitPandasPlotlyAgent-Based ModelingSimulationTime Series AnalysisData Visualization

Project Overview

Developed a modular, agent-based simulator to model heterogeneous electric vehicle (EV) charging behaviours across diverse driver populations.

This system generates detailed individual agent traces and aggregate population statistics, culminating in an interactive Streamlit dashboard for real-time simulation execution and results exploration. The project delivers a flexible, reproducible environment focused on both individual-level traces (plug-in times, state-of-charge) and population-level insights (load flexibility, SoC distributions) – providing valuable data for energy companies and grid operators planning for EV integration.

Interactive Dashboard & Demo

Try it Live

Run simulations and explore results instantly in the web-based dashboard.

Run Locally

# Install dependencies
brew install uv && uv venv && source .venv/bin/activate && uv sync

# Launch the UI
streamlit run dashboard.py

Configurable Parameters

  • Adjust population size (10–1000 agents)
  • Set simulation duration (1–30 days)
  • Control random seed for reproducibility
  • Select specific agent traces to inspect
  • Override default configuration settings

Real-time Visualizations

  • Population-level metrics and KPIs
  • Individual agent state traces (SoC, plug status)
  • Flexibility potential analysis
  • Aggregate charging load patterns (Plotly)
  • Event distributions (plug times, durations)

The Challenge

Modeling the complexity of EV charging behavior requires addressing several key challenges:

Driver Heterogeneity

Modeling diverse driver needs based on archetypes (commuters, high mileage, etc.) with varying schedules, driving patterns, battery sizes, and charger types.

Behavioural Stochasticity

Incorporating realistic randomness in daily driving distances, plug-in timing, and the probability of skipping charging sessions.

Realism vs. Simplicity

Balancing detailed behavioural modeling (like charging taper, target SoC variance) with a computationally efficient and understandable simulation core.

Insight Accessibility

Providing a non-technical, interactive way to run scenarios, visualize emergent population behaviour, and inspect individual agent states without needing to code.

Simulation Approach

Simulation Workflow

The simulation progresses step-by-step, updating each agent based on its models:

  1. Configuration & Initialization: Load parameters, create agents based on archetypes.
  2. Time-Stepped Processing: Advance simulation time incrementally.
  3. Agent Behavior Updates: Process scheduling, driving, charging models per agent.
  4. Event & Data Logging: Record state changes, events, stats for analysis.
  5. Results Generation: Compile outputs (load profiles, flexibility metrics).

Process Flow Diagram

EV Simulator Process Flow

Key Design Decisions

Daily Driving Energy Model

Calculates total daily energy need per agent (based on archetype, scaled, randomized) instead of individual trips, simplifying the model while retaining variability.

Stochastic Charging Behavior

Agents follow schedules but may skip charging probabilistically. SoC tapering and target SoC variance add realism.

Modularity Focus

Prioritized separation of concerns (scheduling, driving, charging) for clarity, testability, and easier modification.

Scope Prioritization

Focused on behavioral richness over grid physics (no network constraints/tariffs) for a pure Python implementation.

Key Outcomes

This project delivered several valuable outcomes for understanding EV charging behavior:

Interactive Scenario Testing

Enabled rapid exploration of how different population mixes and behavioural parameters impact aggregate charging load and flexibility via the web dashboard.

Granular Behavioural Insights

Generated detailed datasets for plug events, population statistics, and individual agent states, allowing deep dives into behaviours and model validation.

Quantified Flexibility Potential

Provided metrics on the average flexibility window per session and the percentage of sessions offering potential for demand shifting.

Balanced Realism & Usability

Achieved a balance between behavior realism, computational efficiency, and user-friendly operation valuable for diverse stakeholders.

Open Source Contribution

Released the codebase as open-source, allowing others to build upon the framework for research and applications.

Extensible Framework

Delivered a modular Python codebase suitable for further development (e.g., adding price responsivity, grid interactions).

Future Directions

Current Extensibility Points

  • Add new driver archetypes via CSV data
  • Integrate tariff optimization logic
  • Scale simulation using Dask/Ray
  • Modify behavioral models independently
  • Adjust core parameters in config.py

Potential Enhancements

  • More sophisticated driving models (traffic, routing)
  • Advanced charging physics (degradation, thermal effects)
  • Grid interaction modeling (constraints, V2G)
  • Dynamic price responsivity / Range anxiety logic
  • Integration with real-world travel survey data