A Co-Simulation Platform For Packetized Energy Management and Trading
PEMT-CoSim is a co-simulation platform for packetized energy management (PEM) and trading (PET) in smart grids. It is developed based on the open-source Transactive Energy Simulation Platform (TESP, v1.0.0).
Packetized Energy (PE) is a gird management technology which breaks the power into fixed-duration/fixed power "energy packet" with a "request-reply" scheme. Prosumers (both suppler and consumer) can request a packet for their load/generator to consume/provide. A central coordinator will accept/reject the request based on grid condition. There are two types of PE, Packetized Energy Management (PEM) and Packetized Energy Trading (PET). Packetized Energy Management (PEM) is a load dispatch program which uses a PEM controller to have houses' flexible load to request a packet with a probability, and the central coordinator will accept/reject the request by comparing the the request load with a balancing signal. PET allows prosumers to bid for a packet in a double-auction market. The cleared price and quantity determine whether bids are accepted or rejected for prosumers.
PEMT-CoSim utilizes the TESP's HELICS co-simulation framework to enable coordination between a number of dedicated simulators/programs (named "federate" under the HECLIS framework): GridLAB-D federate (distribution system simulator), PyPower federate (transmission system simulator), EnergyPlus federate(building simulator), Wether federate (weather data generator), Substation federate (Implemented the processes for PET and PEM).
Substation is main federate which implements the PEM and PET using developed API, including PEM-related modules (PEM Controllers, PEM Coordinator), PET-related modules (PET Prosumer, PEM Market). Moreover, the AI modules implemented the reinforcement learning algorithm that can be used to optimize the biding strategies for prosumers.
PEMT-CoSim runs natively on Linux. However, for better deployment of this project, it is suggested to run this project in a docker container. Therefore, PEMT-CoSim can also run in Windows and MacOS via docker.
Before the installation, the Docker or Docker Desktop, and Git should be installed.
cd docker
docker build . -t ubuntu-vnc
docker run -it --privileged -p 2222:22 -p 5951:5901 --mount type=bind,source= /YOURDIRECTORY/To/PEMT-CoSim,destination=/PEMT-CoSim --name ubuntu-pemt ubuntu-vnc
When the 'docker run' command runs, the container starts and executes a startup .sh script that will set up the environment for development. \ The "--mount" option can make a file or directory on the host machine mounted into the container. So, after the installation you can make development/edition/post-processing on your project in your host machine, and run the co-simulation in the container.
/root/startup/tesp-1.0.0-linux-x64-installer.run
After this step, you have now installed the PEMT-CoSim.
The following steps show how you start and connect to your running container
docker start ubuntu-pemt
docker exec --privileged -it ubuntu-pemt /bin/bash
Denote "(c)" as configuration file, "(o)" as output file.
_generatecase.py : a python script to generate a study case based on user configuration
glmhelper.py : a class including functions to generate the .glm file
plotFig.py : makes plots for the case
fed_gridlabd : folder for Gridlab-D federate
fed_pypower : folder for PyPower federate
fed_energyplus : folder for EnergyPlus federate and EnergyPlus agent federate
fed_substation : folder for substation federate
fed_weather : folder for weather federate
my_tesp_support_api: include the modified version of TESP support API
In the docker container, type:
cd /PEMT-CoSim/demo-PEM
python3 generate_case.py
cd ./fed_substation/
python3 launch_substation.py
To visualize the experimental results after the simulation
cd /PEMT-CoSim/
python3 plotFig.py
In the docker container, type:
cd /PEMT-CoSim/demo-PET
python3 generate_case.py
cd ./fed_substation/
python3 launch_substation.py
To visualize the experimental results after the simulation
cd /PEMT-CoSim/
python3 plotFig.py
In this case, we apply RL to optimize the biding price for prosumers including the biding prices for seller and buyer, respectively. The first 48 hours are used to train the RL agents. After 48 hours, prsoumers use the trained policy to generate biding prices.
In the docker container, type:
cd /PEMT-CoSim/demo-PET-RL
python3 generate_case.py
cd ./fed_substation/
python3 launch_substation.py
To visualize the experimental results after the simulation
cd /PEMT-CoSim/
python3 plotFig.py