Original software publication| Volume 15, 100467, March 2023

Ok

datafev—A Python framework for development and testing of management algorithms for electric vehicle charging infrastructures

Open AccessPublished:January 12, 2023

Highlights

• The global electric vehicle (EV) stock is expected to reach 125 million by 2030.
• Smart charging is required for the efficient integration of EVs into power grids.
• datafev is an open-source Python library to develop and test EV charging strategies.
• datafev provides reference algorithms, simulation, and scenario generation routines.

Abstract

datafev is an open-source Python framework for developing and testing management strategies for electric vehicle (EV) charging. It includes several algorithms related to EV charging such as schedule optimization, and reference routines to generate charging events based on statistical inputs such as conditional probability distributions of arrival/departure times. datafev provides reference dynamic simulation routines to represent the temporal and logical sequence of the events taking place in an EV charging environment including EV drivers, aggregators, and charger cluster operators. An illustrative code example demonstrates the framework’s use for testing user-defined energy management strategies.

Keywords

Tabled 1
 Current code version v1.0.0 Permanent link to code/repository used for this code version https://github.com/SoftwareImpacts/SIMPAC-2022-309 Code Ocean compute capsule Legal Code License MIT Code versioning system used git Software code languages, tools, and services used Python 3 Compilation requirements, operating environments & dependencies datafev can be used independently of the hardware. The Python site-package requirements are numpy, pandas, matplotlib, pyomo, and openpyxl. Additionally, a mathematical programming solver, which is supported by the pyomo optimization modeling library, is required. If available Link to developer documentation/manual https://datafev.fein-aachen.org Support email for questions mailto:[email protected]

1. Introduction

datafev is an open-source Python framework for development and testing of management concepts for electric vehicle (EV) charging. In this context, a management concept is a temporal-logical sequence in which multiple intelligent agents (e.g., EV drivers and charging station operators) interact for EV charging. Temporal sequence refers to the order in which events take place in the time–space and indicates that the event taking place at time $t$ constrains the events that can take place at time $t+1$. For instance, an EV approaching a parking lot (PL) cannot immediately connect to a charger if all the chargers are occupied by the previously connected EVs. Logical sequence defines the input–output relationships between the parameters consumed-produced in individual decision steps. For example, for an EV approaching a neighborhood with multiple PLs – each implementing its own pricing strategy – the pricing decisions of PL operators would affect the EV driver’s PL selection.
datafev provides a portfolio of decision algorithms, each determining a specific action of an individual intelligent agent under given conditions. datafev includes dynamic simulation routines which execute several algorithms in a specific temporal-logical sequence determined by a specific management concept. By running the corresponding simulation routines, one can observe the dynamic system behavior that would occur when a specific management concept is applied in a user-defined scenario (i.e., a number of EV charging events with given charging demand parameters). The existing simulation routines serve as references to build new management concepts; the users can modify the given routines by executing the given algorithms in a different sequence or inserting user-defined algorithms into the same existing sequence. Besides, datafev’s scenario-generation routines, which generate charging demand scenarios, can support operational research in the field of EV charging.

2. Software architecture and functionalities

datafev is available in Python Package Index (PyPI) repository [

datafev in Python Package Index - PyPI URL https://pypi.org/project/datafev/1.0.0/.

] with MIT license. It is built on top of the site packages such as numpy [
• et al Charles R. Harris
Array programming with NumPy.
] and pandas [
• McKinney Wes
• Team P.D.
Pandas-powerful python data analysis toolkit.
]. The optimization models in datafev are coded by using the modeling library, pyomo [
• Hart William E.
• Watson Jean-Paul
• Woodruff David L.
Pyomo: modeling and solving mathematical programs in Python.
]. A wide variety of solvers such as Gurobi [
• Gurobi Optimization, LLC
Gurobi Optimizer Reference Manual.
] and CPLEX [
• IBM ILOG
V12. 1: User’s Manual for CPLEX.
] can be called to solve these optimization problems. datafev architecture consists of three Python packages: data_handling, algorithms, routines.
data_handling package consists of the Python classes of the entities such as ElectricVehicle and ChargingUnit. The objects of such classes store the data associated with the respective entities in dynamic simulations. While some of the data remain constant, others change across the simulation. For instance, the energy storage capacity and the power ratings of the battery are constant attributes of an ElectricVehicle; however, the battery’s state-of-charge (SOC) increases when charged and decreases when discharged. datafev uses ChargerCluster objects to define the entities (e.g., a charging station operator and micro-grid controller) that are responsible for the management of a cluster of ChargingUnits. In most scenarios, the aggregate net consumption of a ChargerCluster must be smaller than the total installed power of the ChargingUnits under its control. ChargerCluster is considered the lower aggregation level in the datafev framework. Certain scenarios, such as the urban charging hubs with multiple charging stations, include a higher level of aggregation, which is represented by MultiClusterSystem objects in datafev. ChargerCluster and MultiClusterSystem classes have methods to query the system state during the simulation (e.g., availability) and to analyze the simulation results (e.g., power consumption history).
algorithms package includes Python implementations of several decision algorithms. datafev presents a variety of algorithms based on centralized/decentralized control architectures and rule-/optimization-based methods. In the package structure of datafev, the algorithms are listed under the names of the agents that may use them. For example, the module algorithms.cluster.pricing_rule.py contains the Python implementation of the dynamic pricing algorithm (i.e., idp function), which would be executed by a cluster operator in order to calculate dynamic price signals considering the existing charging commitments and the desired consumption profiles. In datafev, the algorithms are implemented without any structural dependency on the data handling components. In other words, the functions (i.e., Python implementation of the algorithms) do not have the objects from data_handling package such as ChargerCluster in their argument lists. These functions accept inputs and produce outputs in standard Python types such as int, float, dict.
routine package includes reference simulation and scenario generation routines. In datafev simulations, the parameters related to decision-making of intelligent agents are stored by the data handling components. The decisions are taken by executing datafev algorithms. The simulation routines are implemented through the Python functions that link the data handling components to the algorithms. Each simulation routine corresponds to a particular logical sequence of the decisions and actions. For example, the module routines.charging_control. decentralized_llf.py defines the simulation routine that implements decentralized charging control based on the least-laxity-first algorithm. In this routine, each ChargerCluster loops through its ChargingUnit objects, collects the parameters from the ElectricVehicle objects (e.g., departure time estimations and target SOCs), executes least_laxity_first function (i.e., imported from algorithms package) to calculate the power dispatch to ElectricVehicle objects. Based on the calculated decisions, supply method is executed for each ChargingUnit, which results in the corresponding change in the SOC attribute of the connected ElectricVehicle.
Users with basic Python knowledge can easily can apply the given simulation routines to test provided management concepts in their own scenarios, which should be given as Excel or CSV files to the simulator. They can also substitute the existing algorithms with user-defined algorithms. In-built analysis methods of data handling components, such as visualize_fulfillment_rates method of MultiClusterSystem, enable metric-based evaluation of simulation results and thus, comparison of alternative algorithms in a convenient analysis framework. datafev also facilitates the development and testing of more sophisticated simulation routines that incorporate new temporal-logical sequences for interactions of multiple intelligent agents. In such a case, the existing simulation routines can be modified to test customized operational processes. The power consumption profiles of ChargingUnits, which are obtained as datafev simulation results, can be fed to other simulators such as pandapower [
• Thurner Leon
• Scheidler Alexander
• Schäfer Florian
• Menke Jan-Hendrik
• Dollichon Julian
• Meier Friederike
• Meinecke Steffen
• Braun Martin
Pandapower—An open-source python tool for convenient modeling, analysis, and optimization of electric power systems.
] to investigate the impact of e-mobility in power systems. Furthermore, the simulation routines presented in the current version provide references that can be adopted to perform co-simulation with external tools via APIs.
In addition to the simulation routines, routine package provides scenario generation routines. Relevant Python functions receive statistical parameters such as probability distribution of arrival/departure times (for instance as provided in Takahashi and Tamura [

Tomo Takahashi, Shigeru Tamura, Day-Ahead Planning for EV Aggregators Based on Statistical Analysis of Road Traffic Data in Japan, in: 2020 International Conference on Smart Grids and Energy Systems, SGES, 2020, pp. 117–122.

]), EV models, arrival/target SOCs. The scenario generation functions process these inputs to produce scenarios comprising a user-defined number of charging events with the respective distributions of arrival and departure times, and arrival and target SOCs.

3. Impact

The introduction of new technologies, services, and actors diversifies the operational scenarios in the e-mobility sector. datafev includes an algorithm portfolio, reference simulation, and statistical scenario generation routines. datafev is flexible for testing customized decision processes. For this, the users should implement their customized simulation routines. However, the existing simulation routines provide several references for future developments. Besides, datafev provides various performance evaluation functions which can greatly support activities in the field of operation research.
This framework served as a testing environment for comparing charging coordination algorithms in several recent publications [
• Gümrükcü Erdem
• Ponci Ferdinanda
• Monti Antonello
• Guidi Giuseppe
• D’Arco Salvatore
• Suul Jon Are
Optimal load management strategy for large electric vehicle charging stations with undersized charger clusters.
,
• Gümrükcü Erdem
• Joglekar Charukeshi
• Ponci Ferdinanda
• Monti Antonello
• Guidi Giuseppe
• D’Arco Salvatore
• Suul Jon Are
Optimal Management for Megawatt Level Electric Vehicle Charging Stations with a Grid Interface Based on Modular Multilevel Converter.
,
• Gümrükcü Erdem
• Klemets Jonatan Ralf Axel
• Suul Jon Are
• Ponci Ferdinanda
• Monti Antonello
Decentralized energy management concept for urban charging hubs with multiple V2G aggregators.
]. Furthermore, datafev has been successfully applied in multiple projects as an analysis tool. The versions before open-sourcing were used to test and validate the charging coordination strategies in MoMeWEC [
• Guidi Giuseppe
Results report for the project MoMeWEC.
] – EU-Japan research cooperation project. Similar activities are conducted in ongoing projects. In the Norwegian competence building project FuChar [
• SINTEF Energy Research
FuChar – Grid and charging infrastructure of the future.
], the current version of datafev is used to investigate decentralized autonomous control strategies toward optimized V2X services. The Horizon Europe research and innovation project, FLOW [
• FLOW
FLOW – Flexible energy systems Leveraging the Optimal integration of EVs deployment Wave.
], uses datafev simulation routines to identify the cooperation potential of V2X-capable communities.
datafev is an open-source library that researchers, engineers, and policy makers with basic Python knowledge can easily use. It provides a statistical scenario generation tool and a large portfolio of algorithms for the management of G2V-V2G charging activities. By facilitating research in the field of e-mobility, datafev serves for the society toward decarbonization goals.

4. Illustrative example

This section presents an illustrative code example to show the initialization, execution, and analysis of a dynamic simulation scenario within the tutorial script, src/tutorials/simulations/example_03_smart_ reservarions.py. The input parameters for this simulation are in src/tutorials/simulations/inputs/example_03.xlsx. Each sheet in the excel file contains the data related to a particular dynamic simulation object. For example, the sheet Cluster1 has three rows, each including the power capability parameters of a particular EV charger in the system.
Listing 1 shows how the input data are parsed to generate the objects required to run a simulation. An EVFleet object, called fleet, is initialized based on the pandas.DataFrame (i.e., input_fleet), which contains the charging demand parameters such as the battery capacities and real arrival/departure times of the EVs involved in the scenario. The initialization of fleet triggers the initialization of 9 ElectricVehicle objects with corresponding parameters. A ChargerCluster object is initialized for each charger cluster. This triggers the initialization of the specified number of Charger objects according to the input DataFrame (e.g., input_cluster1 for cluster1). Each generated ChargerCluster object is assigned to MultiClusterSystem object, which facilitates accessing the dynamic attributes of the simulation objects throughout and at the end of the simulation. The ChargerCluster objects are assigned with power consumption constraints.
As illustrated in Listing 2, for each time step $ts$ of the simulation horizon, four simulation routines are conducted in accordance with the temporal sequence of departure, reservation, arrival, and charging events. Each routine executes a number of datafev functions in a logical sequence implied by the above-mentioned events. departure_routine disconnects the ElectricalVehicle objects, representing EVs that should leave their charging spots at a particular time in the scenario, from the Charger objects at the corresponding time step $ts$ of the simulation. reservation_routine picks out the ElectricVehicles placing reservation requests at $ts$, identifies the available chargers for the specified period, and applies the reservation management strategy reported in Gümrükcü et al. [
• Gümrükcü Erdem
• Klemets Jonatan Ralf Axel
• Suul Jon Are
• Ponci Ferdinanda
• Monti Antonello
Decentralized energy management concept for urban charging hubs with multiple V2G aggregators.
]. In execution of this routine, first, the candidate Chargers are identified, and the dynamic pricing algorithm in the datafev algorithm portfolio is called to determine the dynamic price signals of ChargerClusters. These price signals are fed to the routing optimization model, which is in the algorithm portfolio of datafev, in order to find the optimal Charger for reservation of incoming ElectricalVehicle. arrival_routine identifies the EVs arriving at $ts$ and connects corresponding ElectricalVehicle objects to the Charger that they were assigned to by the smart reservation strategy applied via reservation_routine. charging_routine optimizes the power dispatch to Charger objects considering the power boundaries of the ChargerCluster and target SOCs of ElectricVehicle objects. After the simulation, the code in Listing 3 is executed to print the simulation results to excel files and to visualize some of the performance metrics. The visualize_cluster_loading method of the MultiClusterSystem object plots the resulting power consumption profiles of the charger clusters as shown in Fig. 1(a). Likewise, visualize_fulfillment_rates creates a parallel coordinate plot, whose y-axes show three fulfillment metrics. These metrics compare the real parking duration, G2V supply, and real V2G feed-in (i.e., observed after the operation) with the amounts specified in the reservation step (i.e., scheduled parking, G2V, and V2G energy transfer respectively) for each EV in the reservation-based charging scenario.

CRediT authorship contribution statement

E. Gümrükcü: Conceptualization, Methodology, Software, Writing – original draft. A. Ahmadifar: Conceptualization, Methodology, Software,Writing – original draft. A. Yavuzer: Conceptualization, Methodology, Software, Writing – original draft. F. Ponci: Writing – review & editing, Supervision, Project administration. A. Monti: Supervision, Project administration, Funding acquisition.

Declaration of Competing Interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Acknowledgments

This work has been undertaken within the framework of the Horizon Europe research and innovation program under FLOW project grant agreement No. 101056730.

References

1. datafev in Python Package Index - PyPI URL https://pypi.org/project/datafev/1.0.0/.

• et al Charles R. Harris
Array programming with NumPy.
Nature. 2020; 585: 357-362https://doi.org/10.1038/s41586-020-2649-2
• McKinney Wes
• Team P.D.
Pandas-powerful python data analysis toolkit.
Pandas—Powerful Python Data Analysis Toolkit. 2015; 1625
• Hart William E.
• Watson Jean-Paul
• Woodruff David L.
Pyomo: modeling and solving mathematical programs in Python.
Math. Program. Comput. 2011; 3: 219-260
• Gurobi Optimization, LLC
Gurobi Optimizer Reference Manual.
2022 (URL https://www.gurobi.com)
• IBM ILOG
V12. 1: User’s Manual for CPLEX.
Int. Bus. Mach. Corp. 2009; 46: 157
• Thurner Leon
• Scheidler Alexander
• Schäfer Florian
• Menke Jan-Hendrik
• Dollichon Julian
• Meier Friederike
• Meinecke Steffen
• Braun Martin
Pandapower—An open-source python tool for convenient modeling, analysis, and optimization of electric power systems.
IEEE Trans. Power Syst. 2018; 33: 6510-6521https://doi.org/10.1109/TPWRS.2018.2829021
2. Tomo Takahashi, Shigeru Tamura, Day-Ahead Planning for EV Aggregators Based on Statistical Analysis of Road Traffic Data in Japan, in: 2020 International Conference on Smart Grids and Energy Systems, SGES, 2020, pp. 117–122.

• Gümrükcü Erdem
• Ponci Ferdinanda
• Monti Antonello
• Guidi Giuseppe
• D’Arco Salvatore
• Suul Jon Are
Optimal load management strategy for large electric vehicle charging stations with undersized charger clusters.
IET Electr. Syst. Transp. 2021; https://doi.org/10.1049/els2.12037
• Gümrükcü Erdem
• Joglekar Charukeshi
• Ponci Ferdinanda
• Monti Antonello
• Guidi Giuseppe
• D’Arco Salvatore
• Suul Jon Are
Optimal Management for Megawatt Level Electric Vehicle Charging Stations with a Grid Interface Based on Modular Multilevel Converter.
IEEE Access. 2021; : 1https://doi.org/10.1109/ACCESS.2021.3137544
• Gümrükcü Erdem
• Klemets Jonatan Ralf Axel
• Suul Jon Are
• Ponci Ferdinanda
• Monti Antonello
Decentralized energy management concept for urban charging hubs with multiple V2G aggregators.
IEEE Trans. Transp. Electr. 2022; : 1https://doi.org/10.1109/TTE.2022.3208627
• Guidi Giuseppe
Results report for the project MoMeWEC.
SINTEF Report. 2022;
• SINTEF Energy Research
FuChar – Grid and charging infrastructure of the future.
2021 (URL https://Www.Sintef.No/Projectweb/Fuchar/)
• FLOW
FLOW – Flexible energy systems Leveraging the Optimal integration of EVs deployment Wave.
2021 (URL https://cordis.europa.eu/project/id/101056730)