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:
- ESDL gitbook documentation with a general introduction, example applications and some code samples.
- 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.esdl_handler import EnergySystemHandler
from esdl import esdl
from pprint import pprint
esh = EnergySystemHandler()
# load an ESDL file and use type hinting to help the IDE to do auto completion
es: esdl.EnergySystem = esh.load_file('test.esdl')
print(es)
# Create a WindTurbine
wind_turbine = esdl.WindTurbine(name='WindTurbine at coast', rotorDiameter=50.0, height=100.0,
type=esdl.WindTurbineTypeEnum.WIND_ON_COAST)
# print the wind turbines properties in ESDL as a dict
pprint(esh.attr_to_dict(wind_turbine))
# 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
esh.save()
# Give the WindTurbine a location on the map
location = esdl.Point(lat=52.6030475337285, lon=4.729614257812501)
wind_turbine.geometry = location
esh.save()
# Convert the Energy System to an XML string and print it
xml_string = esh.to_string()
print(xml_string)
Changes
Version 21.6.2
-
Fix issue with version definition, making the EnergySystemHandler unusable.
-
Add get_all_instances_of_type() to EnergySystemHandler to retrieve all the instances of a certain type in an EnergySystem.
E.g.
esh.get_all_instances_of_type(esdl.GenericProfile)
will give you all the profiles defined in the EnergySystem.
Version 21.6.1
- Add support for InputOutputRelation
Releasing
The release process is as follows:
- Do a
git tag
with the new version number - Do
python setup.py sdist bdist_wheel
to create the tarball and wheel in thedist
folder - upload to PyPi:
python3 -m twine upload --repository pyESDL dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyESDL-21.6.2.tar.gz
.
File metadata
- Download URL: pyESDL-21.6.2.tar.gz
- Upload date:
- Size: 60.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5501a642d93845503863caa5981bbe083678cf7b803aed0a96f0d71d594d5e5b |
|
MD5 | b6cc5f6ca08066c940c5cbe3c00e8d78 |
|
BLAKE2b-256 | 14db1c7f66cc25202773de7f07b134dbcf5700b34f8dffec71e633da38986fa5 |
File details
Details for the file pyESDL-21.6.2-py3-none-any.whl
.
File metadata
- Download URL: pyESDL-21.6.2-py3-none-any.whl
- Upload date:
- Size: 45.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec1bcb67234461cc64b254a4262948cb26cadd5c987267ab264fd22600593db8 |
|
MD5 | 42b5fc52a79d6e677b0fe304fcb72bff |
|
BLAKE2b-256 | 397b5a2a7afa61e91da6eb39482a67279c6f55c2bf8c057151e079fe8d51f179 |