Skip to main content

Python implementation of the Energy System Description Language (ESDL) for modelling Energy systems

Project description

pyESDL

pyESDL is a library for using ESDL in python programs. ESDL stands for Energy System Description Language and is created to support developers creating, parsing, generating ESDL-files with the goal to create interoperable energy system transition tooling.

This package contains all the ESDL classes of the ESDL language and an EnergySystemHandler that helps the developer to read and write ESDL-files.

More information about ESDL can be found at:

  1. ESDL gitbook documentation with a general introduction, example applications and some code samples.
  2. ESDL Model Reference documentation that describes all the classes and definitions in detail using a clickable UML diagram.

Installing

Use the following command to install the pyESDL python module from the PyPi registry:

pip install pyESDL

Usage

Example 1 - Creating an ESDL-file and saving it to disk

from esdl.esdl_handler import EnergySystemHandler
from esdl import esdl
esh = EnergySystemHandler()
es = esh.create_empty_energy_system(name="ES1", es_description='Nice Energy System',
                                   inst_title='instance 1', area_title="Area 51")
print(es)
esh.save(filename="test.esdl")

Example 2 - Loading an ESDL file and adding a WindTurbine to an area

from esdl import esdl
from esdl.esdl_handler import EnergySystemHandler

esh = EnergySystemHandler()
es: esdl.EnergySystem = esh.load_file('test.esdl')
print(es)
# Create a WindTurbine
wind_turbine = esdl.WindTurbine(name='WindTurbine at coast', rotorDiameter=50, height=100, type=esdl.WindTurbineTypeEnum.WIND_ON_COAST)
# Get the area where this windturbine should be added
area51: esdl.Area = es.instance[0].area
# add the WindTurbine to the area
area51.asset.append(wind_turbine)
# save the file
es.save()

# Give the WindTurbine a location on the map
location = esdl.Point(lat=52.6030475337285, lon=4.729614257812501)
wind_turbine.geometry = location

es.save()
# Convert the Energy System to an XML string and print it
xml_string = esh.to_string()
print(xml_string)

Releasing

The release process is as follows:

  1. Do a git tag with the new version number
  2. Do python setup.py sdist bdist_wheel to create the tarball and wheel in the dist folder
  3. upload to PyPi: python3 -m twine upload --repository testpypi dist/*

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

pyESDL-21.3.2.tar.gz (58.8 kB view hashes)

Uploaded Source

Built Distribution

pyESDL-21.3.2-py3-none-any.whl (43.1 kB view hashes)

Uploaded Python 3

Supported by

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