Skip to main content

Python package for cosimulation of multi-energy systems

Project description

logo.png

Compatible with Python 3.6 and above. Documentation available here.

What is energysim?

energysim is a python based cosimulation tool designed to simplify multi-energy cosimulations. The tool was initially called FMUWorld, since it focussed exclusively on combining models developed and packaged as Functional Mockup Units (FMUs). However, it has since been majorly updated to become a more generalisable cosimulation tool to include a more variety of energy system simulators.

The idea behind development of energysim is to simplify cosimulation to focus on the high-level applications, such as energy system planning, evaluation of control strategies, etc., rather than low-level cosimulation tasks such as message exchange, time progression coordination, etc.

Currently, energysim allows users to combine:

  1. Dynamic models packaged as Functional Mockup Units.

  2. Pandapower networks packaged as pickle files.

  3. PyPSA models (still under testing) as Excel files.

  4. User-defined external simulators interfaced with .py functions.

  5. CSV data files

Installation

energysim can be installed with pip using:

pip install energysim

Dependencies

energysim requires the following packages to work:

  1. FMPy

  2. Pandapower

  3. PyPSA

  4. NumPy

  5. Pandas

  6. Matplotlib

  7. NetworkX

  8. tqdm

Usage

energysim cosimulation is designed for an easy-plug-and-play approach. The main component is the world() object. This is the “playground” where all simulators, and connections are added and the options for simulation are specified. world() can be imported by implementing:

from energysim import world

Initialization

Once world is imported, it can be initialized with basic simulation parameters using:

my_world = world(start_time=0, stop_time=1000, logging=True, t_macro=60)

world accepts the following parameters :

  • start_time : simulation start time (0 by default).

  • stop_time : simulation end time (1000 by default).

  • logging : Flag to toggle update on simulation progress (True by default).

  • t_macro : Time steps at which information between simulators needs to be exchanged. (60 by default).

Adding Simulators

After initializing the world cosimulation object, simulators can be added to the world using the add_simulator() method:

my_world.add_simulator(sim_type='fmu', sim_name='FMU1',
sim_loc=/path/to/sim, inputs=['v1', 'v2'], outputs=['var1','var2'], step_size=1)

where:

  • sim_type : ‘fmu’, ‘powerflow’, ‘csv’, ‘external’

  • sim_name : Unique simulator name.

  • sim_loc : A raw string address of simulator location.

  • outputs : Variables that need to be recorded from the simulator during simulation.

  • inputs : Input variables to the simulator.

  • step_size : Internal step size for simulator (1e-3 by default).

Please see documentation on add_simulator to properly add simulators to energysim. The values to simulator input are kept constant for the duration between two macro time steps.

Connections between simulators

Once all the required simulators are added, the connections between them can be specified with a dictionary as follows

connections = {'sim1.output_variable1' : 'sim2.input_variable1',
   'sim3.output_variable2' : 'sim4.input_variable2',
   'sim1.output_variable3' : 'sim2.input_variable3',}

This dictionary can be passed onto the world object:

my_world.add_connections(connections)

Initializing simulator variables

Initialization is important to start-up simulator in a cosimulation. If the simulators are not internally initialized, or of users want to use different initial conditions for the simulators, it can easily be done in energysim. To provide initial values to the simulators, an init dictionary can be specified and given to the world object

initializations = {'sim_name1' : (['sim_variables'], [values]),
                   'sim_name2' : (['sim_variables'], [values])}
options = {'init' : initializations}
my_world.options(options)

Executing simulation

Finally, the simulate() function can be called to simulate the world. This returns a dictionary with simulator name as keys and the results of the simulator as pandas dataframe. pbar can be used to toggle the progress bar for the simulation:

results = my_world.simulate(pbar=True)

More information is provided on the documentation page.

## Citing Please cite the following paper if you use energysim: Gusain, D, Cvetković, M & Palensky, P 2019, Energy flexibility analysis using FMUWorld. in 2019 IEEE Milan PowerTech., 8810433, IEEE, 2019 IEEE Milan PowerTech, PowerTech 2019, Milan, Italy, 23/06/19. https://doi.org/10.1109/PTC.2019.8810433

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

energysim-2.0.3.tar.gz (884.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

energysim-2.0.3-py3-none-any.whl (91.7 kB view details)

Uploaded Python 3

File details

Details for the file energysim-2.0.3.tar.gz.

File metadata

  • Download URL: energysim-2.0.3.tar.gz
  • Upload date:
  • Size: 884.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for energysim-2.0.3.tar.gz
Algorithm Hash digest
SHA256 53a5da4c77701cb008c226b3d61d7432c3ac4eab846421f8a115721ea8886608
MD5 e0e1cfa53c73deefe4516309fe86c0e0
BLAKE2b-256 cd80f44056e9691c94a4b83ab1c2f195aba01c939c8e3044c024e2249edf1a68

See more details on using hashes here.

File details

Details for the file energysim-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: energysim-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 91.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for energysim-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5b90bad6a65875ddc4e5073d44abf79de5d18f31da79268d26938bb900b92548
MD5 fef815a8aca0172d6dff70250a141f4f
BLAKE2b-256 5424b46bb3bd7eb46a117a0f3dc831057275a85e9fe637f03fc299a08fee73a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page