Recargo and AnyLogic 7
Recargo has been developing an agent-based model with the AnyLogic tool to help us simulate the charging patterns of electric vehicle drivers in California. Our goal is to better understand the potential value from delivering electricity grid services with these vehicles. Development has only been underway for a few weeks, but in that time we’ve been able to use AnyLogic’s accessible interface and Java coding tools to quickly build and test a proof-of-concept model with which we can explore the potential for a more sophisticated and complex effort.
Electric vehicles have increasingly large batteries - the largest capacity passenger vehicle on the market could power the average American home for nearly three days - and this presents a huge resource for an electricity grid which otherwise lacks substantial storage capacity. Electric vehicles can be deployed to help maintain the electrical frequency of the grid at a safe level; to provide reserve power when demands are especially high; and to help bring more renewable energy online by closely matching charging patterns to availability of solar and wind generation. These grid services generate revenue that can be returned to the owner of the vehicle and help offset (or even eliminate) the cost of charging. Recargo has developed hardware and software solutions which allow vehicle control and dispatch according to the needs of the grid, utilities and the vehicle owner.
But to deliver grid services, electric vehicles have to be available and plugged in. Given that the first priority of any driver when using their vehicle is to meet their own mobility needs, there is a fundamental challenge in making sure that vehicles are available when the grid needs them; or, when vehicles are plugged in and charging, that they are deployed to the grid in the most effective manner while ensuring that the vehicle owner’s charging needs are still met. Estimating the available share of a given population of vehicles involves answering some difficult questions, like: what are the chances that vehicles will be available over a given time period at a given location? Or, how much frequency regulation can this vehicle provide on a given morning, if the owner has specified that the battery must be at 80% charge by 2 pm? This is where AnyLogic’s simulation and modeling tools become useful: they allow us to develop vehicle state and driver behavior models, couple them with simulations of grid operation, and so develop estimates for how much value we might be able to generate from grid services for a given population of vehicles.
Suitability for simulation
Our problem is a complex one: the amount of value from deploying electric vehicles on the grid is emergent from the diverse decisions of potentially tens or hundreds of thousands of individual drivers, in interaction with a rich and varied environment (destinations, roads, charging stations, actions of other drivers, and so on). Numerical and systems dynamics approaches are possible, but wouldn’t effectively or easily capture the great diversity in driver behavior and allow us as much granularity in interactions between drivers and charging locations, for example. Consequently, agent-based modeling is the natural choice. We chose AnyLogic for model construction for its simple and accessible user interface, sophisticated scaffolding for quickly building complex models, a highly capable simulation engine, and GIS functionality.
We chose an iterative, agile model development approach:
- First iteration: proof-of-concept model, to demonstrate the potential of the approach and get a handle on the challenges we might experience. Our experience with the proof-of-concept is what we focus on in this discussion.
- Second iteration: revising the proof-of-concept to be a good foundation of a more complex model building in more sophisticated agents and a better representation of their environment.
- Third and subsequent iterations: progressively increasing sophistication in the model’s agents, interactions and environment, leading to a final production-ready tool for supporting our VGI planning and operations.
Developing the agents
Our first model development step was to sketch out the possible vehicle states that enable (or preclude) vehicle-grid integration (VGI). We want to simulate transitions to and from active charging, parking and driving, so we can better understand the best times and places to integrate each vehicle into our VGI programs. But in this first round of our modeling, we also wanted to keep things simple, so we settled on just a few states and a limited range of transitions. Figure 1 indicates some of the vehicle’s state possibilities while parked.
With a first draft of possible vehicle states and transitions represented, we then focused on developing a sketch of our driver behavioral model: this is perhaps the most challenging aspect of agent-based modeling, and in our case is a critical factor in how much value we can generate from a given vehicle. If we cannot determine with some certainty that a given vehicle, once deployed in VGI, will remain available, then the value of that vehicle to the electricity grid drops dramatically. So we need to understand the plans, intentions and behaviors of the driver so that the vehicle is rarely interrupted while delivering a grid service. Quite aside from the fact that people take trips for all sorts of reasons (not all of which are always clear!), there are a large number of possible destinations where an electric vehicle will not charge!
Figure 1: possible vehicle states while parked.
Figure 2: an excerpt from the agent statechart for our simulated drivers, showing the planning states possible in our primitive, first-round agents
Such complexity is hard to manage in a proof-of-concept model, so we started out by focusing on just two trip types: commuting and daily errands.
We equipped our agents with a statechart-based planning engine: in each daily planning cycle, each agent first decides whether to commute versus run errands. This choice made, the agent then plans what trips will be taken that day with the electric vehicle. For commuter agents, this will usually just be an outbound and an inbound trip, but the distance, destination and timing will vary. For errand-running agents, decisions must be made around destinations, duration of time spent there, and how many to visit in one trip versus separate trips.
Setting up the environment
The destinations that agents and their electric vehicles visit are not all equipped with charging stations, and not all charging stations have equal levels of current (which means different levels of grid service); consequently, a range of possible destinations must also be simulated and matched with agent travel plans. For this proof-of-concept effort, we drew on Recargo’s deep understanding of the availability of charging stations in California to develop a statistical model which assigned a given charging station model and current level to each destination.
Setting up the vehicles
Finally, we needed to simulate the electric vehicle itself. There are entire simulation models built just to explore the consumption of energy by an electric vehicle, the storage and degradation of batteries, and the powertrain of the vehicle interacting with the road surface. For this first round of modeling, however, we chose to keep things simple and assign vehicles kWh/mile consumption values which would allow us to determine what the vehicle’s state of charge (SOC) would be after a given trip. This omits such complexities as the vehicle model, battery chemistry, impact of ambient temperature, roadway gradient, driver acceleration behavior and so on, but is a useful first step. Similarly, we made simplifying assumptions on the vehicle’s maximum rate of charge when plugged in: this is assigned by vehicle model, and not adjusted to the many complexities which arise in the real world.
Running the model
We took a break at this point to do some initial simulations and check that all our work so far made sense. Our first runs are, unsurprisingly, very basic. We ran one vehicle over a 30 day period, with a 1 minute time step, with State of Charge results indicated in Figure 3.
The results demonstrate a “maximal” use of the vehicle: trips that drain much of the vehicle’s capacity, and charging that restores the entirety of that capacity before moving on. In reality, this pattern would rarely be seen, except for exceptional use on long commutes: most electric vehicle trips are under 30 miles; most vehicles rarely discharge below 20-30%; and charging is rarely to full every time. Consequently, the results are too simple to offer any planning utility. But they are still useful from the perspective of our modeling process: the results indicate we can successfully simulate a driver, their vehicle and its charging patterns in interaction with a complex of driver plans, possible destinations and charging infrastructure; and they set the stage for our next iteration, which is to revise the proof-of-concept and prepare it for more complex modeling work.
Figure 3: the average State of Charge (SOC), from 0-1 (where at the 0 the electric vehicle’s battery is completely discharged, and at 1 it is completely charged), minute by minute over the course of the simulation.
There’s plenty more for us to do. Top of our list:
- Hook up some grid data: in practice, we don’t need to simulate the enormous and complex grid here in California. We just need to incorporate some basic dynamics like local congestion in the distribution network and market prices for different kinds of grid services. Just enough so we have a decent model of what kinds of value can be generated based on available vehicles and their driving patterns.
- Refine and enhance the driver behavioral model: there’s more to driving than just going to work and running errands. We want to build in more sophisticated scheduling and a wider range of destinations, and a larger variety of driver trip scheduling behavior.
- Improve the simulation of destinations and charging stations: right now our model has no realistic spatial element, which means that we’re not linking it to real world data on where charging stations are relative to where people live and how they might get there; nor on the distribution of different kinds of charging stations. Here at Recargo we have a huge dataset of charging stations, their location and use, and we’ll be drawing on this dataset and AnyLogic’s GIS capabilities to improve the model’s spatial awareness.