Awesome
SpiceEV - Simulation Program for Individual Charging Events of Electric Vehicles
Simulation program to generate scenarios of electric vehicle fleets and simulate different charging strategies.
Introduction
SpiceEV is a program to simulate different charging strategies for a defined set of vehicles and corresponding trips to and from charging stations. The output shows load profiles of the vehicle battery, the corresponding charging station, the grid connector as well as the electricity price and, if applicable, stationary batteries. Each vehicle is by default connected to a separate charging station. All charging stations of one location can be connected to one grid connector with a defined maximum power. Some charging strategies only allow for one grid connector, please check charging strategies for more information.
The first step of SpiceEV is to generate a scenario.json
. The scenario.json
contains information about the vehicles and their specific attributes (e.g. battery capacity, charging curve, etc.) as well as their trips from and to a specific charging station (so-called vehicle events). Further, the charging stations attributes, such as its maximum power, the attached grid connector and the according electricity price are defined. Depending on the scenario, a certain foresight can be applied for grid operator signals. If applicable, stationary batteries with according capacities and c_rates can be defined and fixed load profiles or local generation time series attached to a grid connector can be imported from CSV files. The input scenario.json
can be generated by one of the generate scripts.
Documentation
The full documentation can be found here
Installation
Clone this repository. SpiceEV just has an optional dependency on Matplotlib. Everything else uses the Python (>= 3.6) standard library.
To install spice_ev
as a package run:
pip install -e .
Run Examples
In order to run a simulation with simulate.py
a scenario JSON has to be generated first using generate.py
.
For this three modes are available:
statistics
Generate a scenario JSON with trips from statistical input parameters.csv
Generate a scenario JSON with trips listed in a CSV.simbev
Generate a scenario JSON from SimBEV results.
Show all command line options:
python generate.py -h
python simulate.py -h
Quick Start
Generate a scenario and store it in a JSON. By default, the mode statistics
is used.
python generate.py --output scenario.json
Run a simulation of this scenario using the greedy
charging strategy and show
plots of the results:
python simulate.py scenario.json --strategy greedy --visual
Using Configuration Files
There are example configuration files in the folder examples. The required input/output must still be specified manually:
python generate.py --config examples/configs/generate.cfg
python simulate.py --config examples/configs/simulate.cfg
Generating Scenarios
Generate a 7-day scenario with 10 vehicles of different types and 15 minute timesteps:
python generate.py --days 7 --vehicles 6 golf --vehicles 4 sprinter --interval 15 --output scenario.json
Including external Timeseries
Include a fixed load in the scenario:
python generate.py --include-fixed-load-csv fixed_load.csv --output scenario.json
Please note that included file paths are relative to the scenario file location. Consider this directory structure:
├── scenarios
│ ├── price
│ │ ├── price.csv
│ ├── my_scenario
│ │ ├── fixed_load.csv
│ │ ├── scenario.json
The file fixed_load.csv
is in the same directory as the scenario.json
, hence no relative path is specified.
To include the price and fixed load timeseries:
python generate.py --include-price-csv ../price/price.csv --include-fixed-load-csv fixed_load.csv --output scenario.json
Adding a Schedule to a Scenario
Calculate and include schedule:
python generate_schedule.py --scenario scenario.json --input examples/data/grid_situation.csv --output schedules/schedule_example.csv
Integrating SimBEV
SpiceEV supports scenarios generated by the SimBEV tool. Convert SimBEV output files to a SpiceEV scenario:
python generate.py simbev --simbev /path/to/simbev/output/ --output scenario.json
License
SpiceEV is licensed under the MIT License as described in the file LICENSE