# datafev
Python package datafev is a framework for the development, testing, and assessment of managemant algorithms for EV charging scenarios. The framework allows to develop scenario-oriented management strategies. It includes a portfolio of optimization- and rule-based algorithms to coordinate charging and routing operations in clustered charging systems. Furthermore, it provides statistical scenario generation tool to create EV fleet demand profiles.
Its target users are researchers in the field of smart grid applications and the deployment of operational flexibility for local energy systems.
## Contribution
1. Clone repository via SSH (`git clone git@github.com:erdemgumrukcu/datafev.git`) or clone repository via HTTPS (`git clone https://github.com/erdemgumrukcu/datafev.git`)
2. Open an issue at [https://github.com/erdemgumrukcu/datafev/issues](https://github.com/erdemgumrukcu/datafev/issues)
3. Checkout the development branch: `git checkout development`
4. Update your local development branch (if necessary): `git pull origin development`
5. Create your feature/issue branch: `git checkout -b issueXY_explanation`
6. Commit your changes: `git commit -m "Add feature #XY"`
7. Push to the branch: `git push origin issueXY_explanation`
8. Submit a pull request from issueXY_explanation to development branch via [https://github.com/erdemgumrukcu/datafev/pulls](https://github.com/erdemgumrukcu/datafev/pulls)
9. Wait for approval or revision of the new implementations.
## Installation
datafev requires at least the following Python packages:
- matplotlib>=3.5.1
- numpy>=1.21.5
- openpyxl>=3.0.9
- pandas>=1.4.2
- pyomo>=6.4.1
as well as the installation of at least one mathematical programming solver for convex and/or non-convex problems, which is supported by the [Pyomo](http://www.pyomo.org/) optimisation modelling library.
We recommend one of the following solvers:
- [Gurobi (gurobipy)](https://www.gurobi.com/products/gurobi-optimizer/) (default)
- [IBM ILOG CPLEX](https://www.ibm.com/products/ilog-cplex-optimization-studio)
- [GLPK (GNU Linear Programming Kit)](https://www.gnu.org/software/glpk/)
If all the above-mentioned dependencies are installed, you should be able to install package datafev via [PyPI](https://pypi.org/) (using Python 3.X) as follows:
`pip install datafev`
or:
`pip install -e '<your_path_to_datafev_git_folder>/src'`
or:
`<path_to_your_python_binary> -m pip install -e '<your_path_to_datafev_git_folder>/src'`
Another option rather than installing via PyPI would be installing via setup.py:
`py <your_path_to_datafev_git_folder>/setup.py install`
or:
`pyton <your_path_to_datafev_git_folder>/setup.py install`
You can check if the installation has been successful by trying to import package datafev into your Python environment.
This import should be possible without any errors.
`import datafev`
## Documentation
The documentation for the latest datafev release can be found in folder ./docs and on [this](https://datafev.fein-aachen.org//) GitHub page.
For further information, please also visit the [FEIN Aachen association website](https://fein-aachen.org/en/projects/datafev/).
## Example usage
```python
import os
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
from pyomo.environ import SolverFactory
from datafev.data_handling.fleet import EVFleet
from datafev.data_handling.cluster import ChargerCluster
from datafev.data_handling.multi_cluster import MultiClusterSystem
from datafev.routines.arrival import *
from datafev.routines.departure import *
from datafev.routines.charging_control.decentralized_fcfs import charging_routine
def main():
"""
This tutorial aims to show the use of datafev framework in a small example scenario
in the following the steps to set up a simulation instance will be given.
"""
########################################################################################################################
########################################################################################################################
# SIMULATION SET-UP
# Simulation inputs
input_file = pd.ExcelFile("inputs/example_01.xlsx")
input_fleet = pd.read_excel(input_file, "Fleet")
input_cluster1 = pd.read_excel(input_file, "Cluster1")
input_capacity1 = pd.read_excel(input_file, "Capacity1")
# Getting the path of the input excel file
abs_path_input = os.path.abspath(input_file)
print("Scenario inputs are taken from the xlsx file:",abs_path_input)
print()
#Printing the input parameters related to the EV fleet
print("The charging demands of the EVs in the simulation scenario are given in the following:")
print(input_fleet[["Battery Capacity (kWh)", "Real Arrival Time", "Real Arrival SOC"]])
print()
# Printing the input parameters of the charging infrastructure
print("The system consists of one charger cluster with the following chargers:")
print(input_cluster1)
print()
print("Aggregate net consumption of the cluster is limited in the scenario (i.e., LB-UB indicating lower-upper bounds)")
print(input_capacity1)
print()
print()
# Simulation parameters
sim_start = datetime(2022, 1, 8, 7)
sim_end = datetime(2022, 1, 8, 9)
sim_length = sim_end - sim_start
sim_step = timedelta(minutes=5)
sim_horizon = [sim_start + t * sim_step for t in range(int(sim_length / sim_step))]
print("Simulation starts at:", sim_start)
print("Simulation fininshes at:", sim_end)
print("Length of one time step in simulation:", sim_step)
print()
print()
########################################################################################################################
########################################################################################################################
########################################################################################################################
########################################################################################################################
# INITIALIZATION OF THE SIMULATION
cluster1 = ChargerCluster("cluster1", input_cluster1)
system = MultiClusterSystem("multicluster")
system.add_cc(cluster1)
fleet = EVFleet("test_fleet", input_fleet, sim_horizon)
cluster1.enter_power_limits(sim_start, sim_end, sim_step, input_capacity1)
print("Simulation scenario has been initalized")
print()
########################################################################################################################
########################################################################################################################
########################################################################################################################
########################################################################################################################
# DYNAMIC SIMULATION
print("Simulation started...")
for ts in sim_horizon:
print(" Simulating time step:", ts)
# The departure protocol for the EVs leaving the charger clusters
departure_routine(ts, fleet)
# The arrival protocol for the EVs incoming to the charger clusters
arrival_routine(ts, sim_step, fleet, system)
# Real-time charging control of the charger clusters
charging_routine(ts, sim_step, system)
print("Simulation finished...")
print()
print()
########################################################################################################################
########################################################################################################################
########################################################################################################################
########################################################################################################################
# ANALYSIS OF THE SIMULATION RESULTS
# Displaying connection data of cluster
print("Connection data")
print(cluster1.cc_dataset[["EV ID", "Arrival Time", "Leave Time"]])
print()
# Printing the results to excel files
system.export_results_to_excel(sim_start, sim_end, sim_step, "results/example01_clusters.xlsx")
fleet.export_results_to_excel(sim_start, sim_end, sim_step, "results/example01_fleet.xlsx")
# Path of the output excel file
abs_path_output_cluster = os.path.abspath("results/example01_clusters.xlsx")
abs_path_output_fleet = os.path.abspath("results/example01_fleet.xlsx")
print("Scenario results are saved to the following xlsx files:")
print(abs_path_output_cluster)
print(abs_path_output_fleet)
print()
#Line charts to visualize cluster loading and occupation profiles
fig1=system.visualize_cluster_loading(sim_start, sim_end, sim_step)
fig2=system.visualize_cluster_occupation(sim_start, sim_end, sim_step)
plt.show()
########################################################################################################################
########################################################################################################################
if __name__ == "__main__":
main()
```
## License
The datafev package is released by the Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), RWTH Aachen University under the [MIT License](https://opensource.org/licenses/MIT).
## Contact
- Erdem Gumrukcu, M.Sc. <erdem.guemruekcue@eonerc.rwth-aachen.de>
- Amir Ahmadifar, M.Sc. <aahmadifar@eonerc.rwth-aachen.de>
- Aytug Yavuzer, B.Sc. <aytug.yavuzer@rwth-aachen.de>
- Univ.-Prof. Antonello Monti, Ph.D. <post_acs@eonerc.rwth-aachen.de>
[Institute for Automation of Complex Power Systems (ACS)](http://www.acs.eonerc.rwth-aachen.de) \
[E.ON Energy Research Center (E.ON ERC)](http://www.eonerc.rwth-aachen.de) \
[RWTH Aachen University, Germany](http://www.rwth-aachen.de)
<img src="https://fein-aachen.org/img/logos/eonerc.png"/>
Raw data
{
"_id": null,
"home_page": "https://github.com/erdemgumrukcu/datafev",
"name": "datafev",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Institute for Automation of Complex Power Systems (ACS),E.ON Energy Research Center (E.ON ERC),RWTH Aachen University",
"author_email": "post_acs@eonerc.rwth-aachen.de",
"download_url": "https://files.pythonhosted.org/packages/80/70/01011cb2ac754ad75aa0af8e3be4ebfaa26eceff0659f05944958db181ab/datafev-1.0.0.tar.gz",
"platform": "any",
"description": "# datafev\r\n\r\nPython package datafev is a framework for the development, testing, and assessment of managemant algorithms for EV charging scenarios. The framework allows to develop scenario-oriented management strategies. It includes a portfolio of optimization- and rule-based algorithms to coordinate charging and routing operations in clustered charging systems. Furthermore, it provides statistical scenario generation tool to create EV fleet demand profiles.\r\nIts target users are researchers in the field of smart grid applications and the deployment of operational flexibility for local energy systems.\r\n\r\n\r\n## Contribution\r\n\r\n1. Clone repository via SSH (`git clone git@github.com:erdemgumrukcu/datafev.git`) or clone repository via HTTPS (`git clone https://github.com/erdemgumrukcu/datafev.git`)\r\n2. Open an issue at [https://github.com/erdemgumrukcu/datafev/issues](https://github.com/erdemgumrukcu/datafev/issues)\r\n3. Checkout the development branch: `git checkout development` \r\n4. Update your local development branch (if necessary): `git pull origin development`\r\n5. Create your feature/issue branch: `git checkout -b issueXY_explanation`\r\n6. Commit your changes: `git commit -m \"Add feature #XY\"`\r\n7. Push to the branch: `git push origin issueXY_explanation`\r\n8. Submit a pull request from issueXY_explanation to development branch via [https://github.com/erdemgumrukcu/datafev/pulls](https://github.com/erdemgumrukcu/datafev/pulls)\r\n9. Wait for approval or revision of the new implementations.\r\n\r\n## Installation\r\n\r\ndatafev requires at least the following Python packages:\r\n- matplotlib>=3.5.1\r\n- numpy>=1.21.5\r\n- openpyxl>=3.0.9\r\n- pandas>=1.4.2\r\n- pyomo>=6.4.1\r\n\r\nas well as the installation of at least one mathematical programming solver for convex and/or non-convex problems, which is supported by the [Pyomo](http://www.pyomo.org/) optimisation modelling library.\r\nWe recommend one of the following solvers:\r\n\r\n- [Gurobi (gurobipy)](https://www.gurobi.com/products/gurobi-optimizer/) (default)\r\n- [IBM ILOG CPLEX](https://www.ibm.com/products/ilog-cplex-optimization-studio)\r\n- [GLPK (GNU Linear Programming Kit)](https://www.gnu.org/software/glpk/)\r\n\r\nIf all the above-mentioned dependencies are installed, you should be able to install package datafev via [PyPI](https://pypi.org/) (using Python 3.X) as follows:\r\n\r\n`pip install datafev`\r\n\r\nor:\r\n\r\n`pip install -e '<your_path_to_datafev_git_folder>/src'`\r\n\r\nor:\r\n\r\n`<path_to_your_python_binary> -m pip install -e '<your_path_to_datafev_git_folder>/src'`\r\n\r\nAnother option rather than installing via PyPI would be installing via setup.py:\r\n\r\n`py <your_path_to_datafev_git_folder>/setup.py install`\r\n\r\nor:\r\n\r\n`pyton <your_path_to_datafev_git_folder>/setup.py install`\r\n\r\n\r\nYou can check if the installation has been successful by trying to import package datafev into your Python environment.\r\nThis import should be possible without any errors.\r\n\r\n`import datafev`\r\n\r\n\r\n## Documentation\r\n\r\nThe documentation for the latest datafev release can be found in folder ./docs and on [this](https://datafev.fein-aachen.org//) GitHub page.\r\n\r\nFor further information, please also visit the [FEIN Aachen association website](https://fein-aachen.org/en/projects/datafev/).\r\n\r\n\r\n## Example usage\r\n\r\n```python\r\nimport os\r\nfrom datetime import datetime, timedelta\r\nimport matplotlib.pyplot as plt\r\nfrom pyomo.environ import SolverFactory\r\n\r\nfrom datafev.data_handling.fleet import EVFleet\r\nfrom datafev.data_handling.cluster import ChargerCluster\r\nfrom datafev.data_handling.multi_cluster import MultiClusterSystem\r\n\r\nfrom datafev.routines.arrival import *\r\nfrom datafev.routines.departure import *\r\nfrom datafev.routines.charging_control.decentralized_fcfs import charging_routine\r\n\r\ndef main():\r\n \"\"\"\r\n This tutorial aims to show the use of datafev framework in a small example scenario\r\n in the following the steps to set up a simulation instance will be given.\r\n \"\"\"\r\n\r\n ########################################################################################################################\r\n ########################################################################################################################\r\n # SIMULATION SET-UP\r\n\r\n # Simulation inputs\r\n input_file = pd.ExcelFile(\"inputs/example_01.xlsx\")\r\n input_fleet = pd.read_excel(input_file, \"Fleet\")\r\n input_cluster1 = pd.read_excel(input_file, \"Cluster1\")\r\n input_capacity1 = pd.read_excel(input_file, \"Capacity1\")\r\n # Getting the path of the input excel file\r\n abs_path_input = os.path.abspath(input_file)\r\n print(\"Scenario inputs are taken from the xlsx file:\",abs_path_input)\r\n print()\r\n\r\n\r\n #Printing the input parameters related to the EV fleet \r\n print(\"The charging demands of the EVs in the simulation scenario are given in the following:\")\r\n print(input_fleet[[\"Battery Capacity (kWh)\", \"Real Arrival Time\", \"Real Arrival SOC\"]])\r\n print()\r\n \r\n # Printing the input parameters of the charging infrastructure\r\n print(\"The system consists of one charger cluster with the following chargers:\")\r\n print(input_cluster1)\r\n print()\r\n print(\"Aggregate net consumption of the cluster is limited in the scenario (i.e., LB-UB indicating lower-upper bounds)\")\r\n print(input_capacity1)\r\n print()\r\n print()\r\n \r\n # Simulation parameters\r\n sim_start = datetime(2022, 1, 8, 7)\r\n sim_end = datetime(2022, 1, 8, 9)\r\n sim_length = sim_end - sim_start\r\n sim_step = timedelta(minutes=5)\r\n sim_horizon = [sim_start + t * sim_step for t in range(int(sim_length / sim_step))]\r\n print(\"Simulation starts at:\", sim_start)\r\n print(\"Simulation fininshes at:\", sim_end)\r\n print(\"Length of one time step in simulation:\", sim_step)\r\n print()\r\n print()\r\n \r\n ########################################################################################################################\r\n ########################################################################################################################\r\n \r\n\r\n ########################################################################################################################\r\n ########################################################################################################################\r\n # INITIALIZATION OF THE SIMULATION\r\n \r\n cluster1 = ChargerCluster(\"cluster1\", input_cluster1)\r\n system = MultiClusterSystem(\"multicluster\")\r\n system.add_cc(cluster1)\r\n fleet = EVFleet(\"test_fleet\", input_fleet, sim_horizon)\r\n cluster1.enter_power_limits(sim_start, sim_end, sim_step, input_capacity1)\r\n \r\n print(\"Simulation scenario has been initalized\")\r\n print()\r\n \r\n ########################################################################################################################\r\n ########################################################################################################################\r\n \r\n \r\n ########################################################################################################################\r\n ########################################################################################################################\r\n # DYNAMIC SIMULATION\r\n\r\n print(\"Simulation started...\")\r\n\r\n for ts in sim_horizon:\r\n print(\" Simulating time step:\", ts)\r\n\r\n # The departure protocol for the EVs leaving the charger clusters\r\n departure_routine(ts, fleet)\r\n\r\n # The arrival protocol for the EVs incoming to the charger clusters\r\n arrival_routine(ts, sim_step, fleet, system)\r\n\r\n # Real-time charging control of the charger clusters\r\n charging_routine(ts, sim_step, system)\r\n\r\n print(\"Simulation finished...\")\r\n print()\r\n print()\r\n ########################################################################################################################\r\n ########################################################################################################################\r\n \r\n\r\n ########################################################################################################################\r\n ########################################################################################################################\r\n # ANALYSIS OF THE SIMULATION RESULTS\r\n\r\n # Displaying connection data of cluster\r\n print(\"Connection data\")\r\n print(cluster1.cc_dataset[[\"EV ID\", \"Arrival Time\", \"Leave Time\"]])\r\n print()\r\n\r\n # Printing the results to excel files\r\n system.export_results_to_excel(sim_start, sim_end, sim_step, \"results/example01_clusters.xlsx\")\r\n fleet.export_results_to_excel(sim_start, sim_end, sim_step, \"results/example01_fleet.xlsx\")\r\n # Path of the output excel file\r\n abs_path_output_cluster = os.path.abspath(\"results/example01_clusters.xlsx\")\r\n abs_path_output_fleet = os.path.abspath(\"results/example01_fleet.xlsx\")\r\n print(\"Scenario results are saved to the following xlsx files:\")\r\n print(abs_path_output_cluster)\r\n print(abs_path_output_fleet)\r\n print()\r\n \r\n #Line charts to visualize cluster loading and occupation profiles\r\n fig1=system.visualize_cluster_loading(sim_start, sim_end, sim_step) \r\n fig2=system.visualize_cluster_occupation(sim_start, sim_end, sim_step) \r\n plt.show()\r\n\r\n\r\n ########################################################################################################################\r\n ########################################################################################################################\r\n\r\nif __name__ == \"__main__\":\r\n main()\r\n```\r\n\r\n## License\r\n\r\nThe datafev package is released by the Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), RWTH Aachen University under the [MIT License](https://opensource.org/licenses/MIT).\r\n\r\n\r\n## Contact\r\n\r\n- Erdem Gumrukcu, M.Sc. <erdem.guemruekcue@eonerc.rwth-aachen.de>\r\n- Amir Ahmadifar, M.Sc. <aahmadifar@eonerc.rwth-aachen.de>\r\n- Aytug Yavuzer, B.Sc. <aytug.yavuzer@rwth-aachen.de>\r\n- Univ.-Prof. Antonello Monti, Ph.D. <post_acs@eonerc.rwth-aachen.de>\r\n\r\n[Institute for Automation of Complex Power Systems (ACS)](http://www.acs.eonerc.rwth-aachen.de) \\\r\n[E.ON Energy Research Center (E.ON ERC)](http://www.eonerc.rwth-aachen.de) \\\r\n[RWTH Aachen University, Germany](http://www.rwth-aachen.de)\r\n\r\n\r\n<img src=\"https://fein-aachen.org/img/logos/eonerc.png\"/>\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python framework for development and testing of management algorithms for electric vehicle charging infrastructures",
"version": "1.0.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "f090aab9f133e4469337210562d59614",
"sha256": "02aab74bb10acd8906bb130521afa719676b82e6b460a93fbfe9ec5801bc8189"
},
"downloads": -1,
"filename": "datafev-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "f090aab9f133e4469337210562d59614",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 51925,
"upload_time": "2022-12-22T15:04:48",
"upload_time_iso_8601": "2022-12-22T15:04:48.070953Z",
"url": "https://files.pythonhosted.org/packages/80/70/01011cb2ac754ad75aa0af8e3be4ebfaa26eceff0659f05944958db181ab/datafev-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-22 15:04:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "erdemgumrukcu",
"github_project": "datafev",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "matplotlib",
"specs": [
[
">=",
"3.5.1"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.21.5"
]
]
},
{
"name": "openpyxl",
"specs": [
[
">=",
"3.0.9"
]
]
},
{
"name": "pandas",
"specs": [
[
">=",
"1.4.2"
]
]
},
{
"name": "pyomo",
"specs": [
[
">=",
"6.4.1"
]
]
}
],
"lcname": "datafev"
}