A Simulation Framework for Ride-Hailing with Electric Vehicles

Chen Zhang, Sushil Mahavir VarmaarXiv 2024 · DOI

Abstract

This research presents a Python-based simulation framework designed to model electric vehicle (EV) on-demand transportation systems, with a focus on optimizing urban fleet operations. Built on a process-driven architecture, the system efficiently simulates EV fleet dynamics, including passenger matching, vehicle dispatching, and charging strategies, while enabling customization to address critical challenges such as charger placement, fleet management, and algorithm performance. We overcome the challenge of high dimensional state-space and non-Markovian system dynamics by executing processes asynchronously using SimPy and updating only the states that are affected by employing object-oriented programming. As a result, our simulation framework is capable of handling peak demand scenarios involving thousands of trips and completing multi-day scenarios in minutes. The modular design enables users to experiment with parameters, test algorithms, and integrate custom datasets, making the tool highly adaptable for diverse urban contexts. By providing a realistic and extensible platform, this adaptable, scalable, and open-source framework advances the optimization of EV fleet operations and offers a valuable resource for decision-makers and city planners navigating the transition to sustainable urban mobility solutions. We also present a case study using the NYC taxi dataset evaluating various dispatching algorithms, including closest vehicle dispatch, closest available vehicle dispatch, and power-of-$d$ vehicle dispatch, and exploring charging approaches like continuous and nighttime charging. We propose a novel adaptive power-of-$d$ dispatch policy, which dynamically adjusts to real-time conditions and demonstrates high throughputs when combined with adaptive charging policies that interrupt charging to meet demand during the peak and delay some of the charging to the nighttime.

Introduction

As ride-hailing services transition toward 100% electric vehicle (EV) fleets, they encounter a significant "charging gap" that distinguishes them from traditional internal combustion engine operations. Unlike gasoline vehicles that refuel in minutes, EVs require strategic downtime, specialized infrastructure, and precise management of State of Charge (SoC).

Existing analytical models often oversimplify these dynamics, failing to account for the non-Markovian nature of the system—where a vehicle's future state depends on a complex sequence of past events, such as charging duration or queue position. Furthermore, tracking every vehicle’s location and SoC in real-time creates a "curse of dimensionality" that makes traditional simulations unscalable for large urban environments.

Methodology

The framework is built on SimPy, a process-based discrete-event simulation library. To ensure scalability, the authors implemented two primary architectural strategies:

  1. The "Teleportation" Approach: Rather than calculating vehicle positions continuously, the system updates an EV's state (location and SoC) only upon the completion of a specific process, such as a trip or a charging session. This asynchronous update method significantly reduces computational overhead.
  2. Object-Oriented Modularity: By treating EVs and chargers as independent objects, the framework allows for the seamless swapping of matching and charging algorithms.
System architecture of the simulation framework, illustrating the interaction between matching, charging, and interrupt processes.

A core contribution is the Novel Adaptive Power-of-$d$ Dispatch Policy. While standard "Power-of-$d$" logic selects the vehicle with the highest SoC from the $d$ closest candidates, this adaptive version dynamically adjusts $d$ based on real-time fleet conditions, such as the current number of idle cars, ensuring responsiveness across varying demand levels.

Datasets

The framework was validated using the NYC Taxi and Limousine Commission (TLC) Yellow Taxi records from May 2024, as well as Chicago taxi data and synthetic datasets generated via Poisson processes to test theoretical edge cases.

Key Insights and Results

The simulation results highlight several critical factors for efficient EV fleet management:

  • The "Closest" Trap: Dispatching the nearest vehicle is often suboptimal. If the closest car has a low SoC, it may fail the trip or require immediate charging afterward, creating service gaps.
  • Interruptible Charging: Allowing the system to interrupt a charging vehicle to serve high-priority passengers significantly boosts overall throughput. This logic is formalized in the framework's interrupt algorithm.
  • Nighttime Primacy: Implementing a high SoC threshold for nighttime charging (95%) versus a lower threshold during the day (40%) ensures vehicles are prepared for peak morning demand.
Pseudocode for Algorithm 4: Interrupt Charging, a key component for maintaining high service levels during peak demand.

In terms of performance, the system can simulate a full day of operations involving thousands of trips in approximately 10 minutes. In the NYC case study, the framework successfully managed a fleet of 2,101 EVs with only 270 chargers, achieving service levels of approximately 91.5% through the Adaptive Power-of-$d$ algorithm.

Conclusion and Future Work

This open-source framework provides a robust foundation for urban mobility planning. Future research will focus on integrating dynamic traffic congestion models to improve pickup time accuracy and exploring "batch matching" to reduce empty miles (deadheading). Additionally, the integration of dynamic pricing models could further optimize passenger behavior and fleet efficiency. The code is publicly available to encourage community-driven development in sustainable transportation.

Summary updated

BibTeX
@misc{zhang2024simulation,
  author = {Chen Zhang and Sushil Mahavir Varma},
  title = {{A Simulation Framework for Ride-Hailing with Electric Vehicles}},
  year = {2024},
  eprint = {2411.19471},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.19471},
}
Figure