Automated graph-based simulation model generation and analysis tool
Project description
UESgraphs
UESgraphs (Urban Energy Systems graphs) is a Python package for describing Urban Energy Systems, managing their data within a Python graph structure, and enabling the automatic generation of dynamic district simulation models. We extend the networkx Graph class and add basic methods to represent buildings and energy networks in the graph. UESgraphs can be used as a foundation to analyze energy network structures, evaluate district energy systems or generate simulation models. Version 2 has been updated with the following enhancements:
- Simplified Installation: Easier installation with the removal of unnecessary Python library dependencies.
- Enabled Logging Features: Logging functionality has been activated for better tracking and debugging.
- Enhanced Compatibility: Compatible with the latest versions of Modelica and the AixLib package.
- Improved Visualization: Enhanced visualization features for better representation of results.
- Addition of
analyze.py: Introducedanalyze.pyto enable simulation post-processing and visualization for dynamic district simulations. - Updated Model Template Generation: The template generation feature for Modelica models has been updated, enabling automation of multiple models.
- Updated Examples: The examples for UESgraphs have been updated, and two new examples have been added to clarify the use of template generation and the
analyze.pyscript.
UESgraphs is being developed at RWTH Aachen University, E.ON Energy Research Center, Institute for Energy Efficient Buildings and Indoor Climate.
If you have any questions regarding the tool, feel free to contact us at ebc-tools@eonerc.rwth-aachen.de.
:rocket: Quick start
:wrench: Install UESgraphs
We recommend using Conda or Anaconda for installing UESgraphs. Usage of python venv has shown to cause trouble in the installation process.
Follow these steps to install UESgraphs using Conda:
-
Create a new virtual environment:
conda create -n uesgraphs python=3.13
Note: Replace
3.13with your desired version of Python. -
Activate the virtual environment:
conda activate uesgraphs
-
Install UESgraphs from PyPI (Quick Installation):
If you want to use UESgraphs without modifying the source code, install directly from PyPI:
Basic Installation (core functionality only):
pip install uesgraphs
Installation with Optional Dependencies:
-
For template generation and Modelica support:
pip install uesgraphs[templates]
-
For development (includes testing and coverage tools):
pip install uesgraphs[dev]
-
Complete installation with all dependencies:
pip install uesgraphs[full]
Note: If you're installing from PyPI, skip steps 4 and 5 and proceed directly to step 6 for OpenModelica setup.
-
-
Clone or download the UESgraphs repository (Development Installation):
If you want to modify the source code or contribute to development:
-
If you're cloning the repository using Git, run:
git clone https://github.com/RWTH-EBC/uesgraphs.git
-
If you've downloaded the repository as a ZIP file, extract it to your desired location.
-
-
Install UESgraphs in editable mode (Development Installation):
Navigate to the directory where uesgraphs is located and choose your installation method:
Basic Installation (core functionality only):
pip install -e <path/to/your/uesgraphs>
Installation with Optional Dependencies:
-
For template generation and Modelica support:
pip install -e <path/to/your/uesgraphs>[templates]
-
For development (includes testing and coverage tools):
pip install -e <path/to/your/uesgraphs>[dev]
-
Complete installation with all dependencies:
pip install -e <path/to/your/uesgraphs>[full]
Note: The
[full]option installs all optional dependencies including OMPython, pytest, coverage, and other development tools. Use this for a complete development environment. -
-
Verify your UESgraphs installation by running the automated tests:
Navigate to the top-level uesgraphs folder and execute:
pytest --mplThis will run the test suite and verify that everything is set up correctly.
Note: Running tests requires the
[dev]or[full]optional dependencies to be installed. If you only installed the basic version, install the dev dependencies first:pip install uesgraphs[dev]orpip install -e .[dev](for editable installs).
For more detailed information, please check the pyproject.toml file.
-
Install OpenModelica and OMPython to Run Examples 9 to 14
To run examples 9 to 14, you need to install OpenModelica and OMPython.
-
Download and Install OpenModelica:
- Visit the OpenModelica download page to download the installer for your operating system.
- Follow the on-screen instructions to install OpenModelica on your computer.
- Add OpenModelica to the environment variable
-
Install OMPython:
If you haven't already installed OMPython with the
[templates], or[full]options in step 3 or 5, you can install it separately:pip install "OMPython>=3.4.0,<4.0.0"
Alternative: If you skipped the optional dependencies, you can add them:
For PyPI installation:
pip install uesgraphs[templates] # or for complete installation: pip install uesgraphs[full]
For editable/development installation:
pip install -e <path/to/your/uesgraphs>[templates] # or for complete installation: pip install -e <path/to/your/uesgraphs>[full]
Important Notes:
- ✓ UESgraphs is compatible with OMPython 3.x only (versions
>=3.4.0,<4.0.0) - ✗ OMPython 4.0.0+ introduces breaking API changes and is not yet supported
- If you encounter the error
'OMCSessionZMQ' object has no attribute 'loadFile', downgrade OMPython:pip install "OMPython==3.6.0"
Tested Configurations:
- ✓ OpenModelica 1.24.4 + OMPython 3.6.0
- ✓ OpenModelica 1.26.0 + OMPython 3.6.0
For more information on OMPython, refer to the OMPython documentation.
- ✓ UESgraphs is compatible with OMPython 3.x only (versions
-
:bulb: Usage
You can assemble a graph of an urban energy system by adding buildings, network
nodes and edges to an UESGraph object. The following code builds a heating
network from one building to another, connected via one network node:
import uesgraphs as ug
from shapely.geometry import Point
graph = ug.UESGraph()
supply = graph.add_building(
name='Supply',
position=Point(0, 10),
is_supply_heating=True,
)
demand = graph.add_building(
name='Building 1',
position=Point(50, 15),
)
heating_node = graph.add_network_node(
network_type='heating',
position=Point(30, 5),
)
graph.add_edge(supply, heating_node)
graph.add_edge(heating_node, demand)
You can go on to plot this energy system with
vis = ug.Visuals(graph)
vis.show_network(
show_plot=True,
scaling_factor=30,
)
Instead of building a graph from scratch, UESgraphs comes with an example containing all supported energy network types. You can create this example graph with
import uesgraphs as ug
from shapely.geometry import Point
graph = ug.simple_dhc_model()
graph = ug.add_more_networks(graph)
vis = ug.Visuals(example_district)
fig = vis.show_network(
show_plot=True,
scaling_factor=10,
)
This leads to the following plot:
You can extract single networks into their own subgraph with
heating_network_1 = graph.create_subgraphs('heating')['default']
In the example above, this extracts the first of the two heating networks shown in red:
You can use this graph framework to add data to the nodes and edges, e.g.
import uesgraphs as ug
from shapely.geometry import Point
graph = ug.UESGraph()
demand = graph.add_building(
name='Building 1',
position=Point(50, 15),
)
graph.nodes[demand]['heat_load_kW'] = 200
This can be used as a foundation to analyze networks or to generate models.
Version Information
The package version can be accessed programmatically:
import uesgraphs
print(f"UESgraphs version: {uesgraphs.__version__}")
:herb: Branch strategy
Main branch: master
:memo: Documentation
Further documentation is available in the /doc directory. There you find:
- Manual that gives a gist
- Development guidelines
:page_facing_up: License
UESgraphs is released by RWTH Aachen University, E.ON Energy Research Center, Institute for Energy Efficient Buildings and Indoor Climate, under the MIT License.
:books: How to cite UESgraphs
To reference UESgraphs, please cite the following papers:
- (doi 10.1016/j.energy.2016.04.023):
M. Fuchs, J. Teichmann, M. Lauster, P. Remmen, R. Streblow, and D. Müller, “Workflow automation for combined modeling of buildings and district energy systems,” Energy, vol. 117, pp. 478–484, Dec. 2016.
The BibTex for this paper is:
@article{Fuchs2016,
doi = {10.1016/j.energy.2016.04.023},
url = {https://doi.org/10.1016/j.energy.2016.04.023},
year = {2016},
month = {dec},
publisher = {Elsevier {BV}},
volume = {117},
pages = {478--484},
author = {Marcus Fuchs and Jens Teichmann and Moritz Lauster and Peter Remmen and Rita Streblow and Dirk M\"{u}ller},
title = {Workflow automation for combined modeling of buildings and district energy systems},
journal = {Energy}
}
Related Publications
- (doi 10.3390/en151243723):
M. Mans, T. Blacha, T. Schreiber, and D. Müller, “Development and Application of an Open-Source Framework for Automated Thermal Network Generation and Simulations in Modelica,” Energies, vol. 15, no. 12, p. 4372, Jun. 2022.
The BibTex for this paper is:
@article{Mans2022,
doi = {10.3390/en15124372},
url = {https://doi.org/10.3390/en15124372},
year = {2022},
month = {jun},
publisher = {Energies},
volume = {15},
pages = {4372},
author = {Michael Mans and Tobias Blacha and Thomas Schreiber and Dirk M\"{u}ller},
title = {Development and Application of an Open-Source Framework for Automated Thermal Network Generation and Simulations in Modelica},
journal = {Energies}
}
:clap: Acknowledgements
This work was supported by the Helmholtz Association under the Joint Initiative “Energy System 2050 – A Contribution of the Research Field Energy”.
Parts of UESgraphs have been developed within public funded projects and with financial support by BMWK (German Federal Ministry for Economic Affairs and Climate Action).
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uesgraphs-2.1.4.tar.gz.
File metadata
- Download URL: uesgraphs-2.1.4.tar.gz
- Upload date:
- Size: 13.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05bacd22744b30df0e7e2b1e72960fc9b0b41b6696bf7a19b0d4b713a4b126e6
|
|
| MD5 |
17a32a104ed83cd2c40a43413f881896
|
|
| BLAKE2b-256 |
420b35c0ffd55c0643bfdc6b3e3aa9f1ca61bbd602a84715bf068db4d4f7370f
|
File details
Details for the file uesgraphs-2.1.4-py3-none-any.whl.
File metadata
- Download URL: uesgraphs-2.1.4-py3-none-any.whl
- Upload date:
- Size: 13.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4d535a5280168000cd68ca79591d68179743e2ba91094bc62fd251523d23a2e
|
|
| MD5 |
df64733f579e13297172a94a5399e3b3
|
|
| BLAKE2b-256 |
b19fcc32d06e0af7992ea80054ecf9b5205c8a0e76cfa4cd679c7906f8885ffa
|