Skip to content

Commit 4f15bce

Browse files
committed
Merge branch 'release/0.5.0'
2 parents a74037e + a91b790 commit 4f15bce

File tree

175 files changed

+36656
-6739
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+36656
-6739
lines changed

.coveragerc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[report]
2+
include =
3+
mesmo/*
4+
examples/*
5+
omit =
6+
examples/development/*

.github/workflows/documentation.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: Documentation
2-
32
on: [push]
43

54
jobs:
65
build-documentation:
7-
86
runs-on: ubuntu-latest
7+
defaults:
8+
run:
9+
shell: bash -l {0} # Required for conda commands.
910

1011
steps:
1112
- name: Checkout repository
@@ -14,9 +15,9 @@ jobs:
1415
run: |
1516
git fetch --prune --unshallow
1617
- name: Set up Python
17-
uses: s-weigand/setup-conda@v1
18+
uses: conda-incubator/setup-miniconda@v2
1819
with:
19-
python-version: 3.7
20+
python-version: 3.8
2021
- name: Install dependencies
2122
run: |
2223
conda install sphinx
@@ -25,10 +26,13 @@ jobs:
2526
run: |
2627
sphinx-multiversion docs docs/_build/html
2728
cp docs/assets/gh-pages_index.html docs/_build/html/index.html
28-
find docs/_build/html -type f -name "*.html" -exec sed -i 's/<li><p>\(.*\)<\/p>\(.*\)/<li>\1\2/g' {} +
2929
- name: Deploy documentation HTML to Github Pages
3030
uses: peaceiris/actions-gh-pages@v3
3131
with:
3232
github_token: ${{ secrets.GITHUB_TOKEN }}
3333
publish_dir: docs/_build/html/
3434
keep_files: false
35+
force_orphan: true
36+
full_commit_message: Deploy documentation for ${{ github.sha }}
37+
user_name: GitHub Actions
38+
user_email: github-actions[bot]@users.noreply.github.com

.github/workflows/maintenance.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Maintenance
2+
on:
3+
workflow_run:
4+
workflows: ["Python tests"]
5+
branches: [develop]
6+
types:
7+
- completed
8+
9+
jobs:
10+
get-environment:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
max-parallel: 8
15+
matrix:
16+
os: [
17+
windows-latest,
18+
macos-latest,
19+
ubuntu-latest
20+
]
21+
defaults:
22+
run:
23+
shell: bash -l {0} # Required for conda commands.
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v2
28+
- name: Checkout submodules
29+
run: |
30+
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
31+
git submodule sync --recursive
32+
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
33+
- name: Set up Python
34+
uses: conda-incubator/setup-miniconda@v2
35+
- name: Install dependencies
36+
run: |
37+
conda create -n mesmo -c conda-forge python=3.8 contextily cvxpy numpy pandas scipy
38+
conda activate mesmo
39+
pip install -v -e .
40+
- name: Get new environment-${{ matrix.os }}.yml
41+
run: |
42+
rm environment-*
43+
conda env export -n mesmo --no-builds | grep -v "^prefix: " > environment-${{ matrix.os }}.yml
44+
- name: Store environment-${{ matrix.os }}.yml
45+
uses: actions/upload-artifact@v2
46+
with:
47+
name: environment-${{ matrix.os }}.yml
48+
path: environment-${{ matrix.os }}.yml
49+
50+
run-maintenance:
51+
needs: get-environment
52+
runs-on: ubuntu-latest
53+
defaults:
54+
run:
55+
shell: bash -l {0}
56+
57+
steps:
58+
- name: Checkout repository
59+
uses: actions/checkout@v2
60+
- name: Remove old environment files
61+
run: |
62+
rm environment-*
63+
- name: Get cached environment-windows-latest.yml
64+
uses: actions/download-artifact@v2
65+
with:
66+
name: environment-windows-latest.yml
67+
- name: Get cached environment-macos-latest.yml
68+
uses: actions/download-artifact@v2
69+
with:
70+
name: environment-macos-latest.yml
71+
- name: Get cached environment-ubuntu-latest.yml
72+
uses: actions/download-artifact@v2
73+
with:
74+
name: environment-ubuntu-latest.yml
75+
- name: Commit changes
76+
uses: stefanzweifel/git-auto-commit-action@v4
77+
with:
78+
commit_message: Automated maintenance for ${{ github.sha }}
79+
commit_user_name: GitHub Actions
80+
commit_user_email: github-actions[bot]@users.noreply.github.com

.github/workflows/pythontests.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
name: Python tests
2-
32
on: [push]
43

54
jobs:
65
run-tests:
7-
86
runs-on: ${{ matrix.os }}
97
strategy:
8+
fail-fast: false
109
max-parallel: 8
1110
matrix:
1211
os: [
1312
windows-latest,
14-
# macos-latest,
13+
macos-latest,
1514
ubuntu-latest
1615
]
17-
python-version: [3.7]
16+
python-version: [3.7, 3.8]
17+
defaults:
18+
run:
19+
shell: bash -l {0} # Required for conda commands.
1820

1921
steps:
2022
- name: Checkout repository
@@ -25,21 +27,32 @@ jobs:
2527
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
2628
git submodule sync --recursive
2729
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
28-
- name: Set up Python ${{ matrix.python-version }}
29-
uses: s-weigand/setup-conda@v1
30-
with:
31-
python-version: ${{ matrix.python-version }}
30+
- name: Set up Python
31+
uses: conda-incubator/setup-miniconda@v2
3232
- name: Install dependencies
3333
run: |
34+
conda create -n mesmo -c conda-forge python=${{ matrix.python-version }} contextily cvxpy numpy pandas scipy
35+
conda activate mesmo
3436
pip install -v -e .
3537
- name: Lint with flake8
3638
run: |
39+
conda activate mesmo
3740
pip install flake8
3841
# Stop the build if there are Python syntax errors or undefined names.
3942
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
40-
# Exit-zero treats all errors as warnings. Line lengths should not exceed 120 characters.
41-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
42-
- name: Test with pytest
43+
- name: Run tests
4344
run: |
44-
pip install pytest
45-
pytest tests
45+
conda activate mesmo
46+
pip install pytest pytest-cov pytest-subtests
47+
pytest tests --cov=./ --cov-report=xml
48+
- name: Report coverage to Codecov
49+
if: always()
50+
uses: codecov/codecov-action@v2
51+
with:
52+
fail_ci_if_error: true
53+
- name: Report coverage to Codacy
54+
if: always()
55+
uses: codacy/codacy-coverage-reporter-action@v1
56+
with:
57+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
58+
coverage-reports: coverage.xml

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
.pytest_cache
1515

16-
cache/
17-
1816
*.sqlite
1917

2018
*.sqlite-journal

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "cobmo"]
22
path = cobmo
3-
url = https://github.com/TUMCREATE-ESTL/cobmo
3+
url = https://github.com/mesmo-dev/cobmo

CITATION.bib

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@misc{mesmo,
2+
author = {Sebastian Troitzsch and Verena Kleinschmidt and Tom Schelo and Arif Ahmed},
3+
title = {{MESMO - Multi-Energy System Modeling and Optimization}},
4+
year = 2021,
5+
howpublished = {Version 0.5.0, Zenodo},
6+
doi = {10.5281/zenodo.3523568},
7+
url = {https://doi.org/10.5281/zenodo.3523568}
8+
}

README.md

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,72 @@
1-
# FLEDGE - Flexible Distribution Grid Demonstrator
1+
![](docs/assets/mesmo_logo.png)
22

3-
[![DOI](https://zenodo.org/badge/201130660.svg)](https://zenodo.org/badge/latestdoi/201130660)
3+
[![](https://zenodo.org/badge/201130660.svg)](https://zenodo.org/badge/latestdoi/201130660)
4+
[![](https://img.shields.io/github/release-date/mesmo-dev/mesmo?label=last%20release)](https://github.com/mesmo-dev/mesmo/releases)
5+
[![](https://img.shields.io/github/last-commit/mesmo-dev/mesmo?label=last%20commit%20%28develop%29)](https://github.com/mesmo-dev/mesmo/commits/develop)
6+
[![](https://img.shields.io/github/workflow/status/mesmo-dev/mesmo/Python%20tests/develop?label=tests%20%28develop%29)](https://github.com/mesmo-dev/mesmo/actions/workflows/pythontests.yml?query=branch%3Adevelop)
47

5-
The Flexible Distribution Grid Demonstrator (FLEDGE) is a software tool for optimal operation problems of electric and thermal distribution grids along with distributed energy resources (DERs), such as flexible building loads, electric vehicle (EV) chargers, distributed generators (DGs) and energy storage systems (ESS). To this end, it implements 1) electric grid models, 2) thermal grid models, 3) DER models, and 4) optimal operation problems.
8+
> Work in progress: The repository is under active development and interfaces may change without notice. Please use [GitHub issues](https://github.com/mesmo-dev/mesmo/issues) for raising problems, questions, comments and feedback.
69
7-
## Work in progress
10+
# What is MESMO?
811

9-
Please note that the repository is under active development and the interface may change without notice. Create an [issue](https://github.com/TUMCREATE-ESTL/fledge/issues) if you have ideas / comments / criticism that may help to make the tool more useful.
12+
MESMO stand for "Multi-Energy System Modeling and Optimization" and is an open-source Python tool for the modeling, simulation and optimization of multi-scale electric and thermal distribution systems along with distributed energy resources (DERs), such as flexible building loads, electric vehicle (EV) chargers, distributed generators (DGs) and energy storage systems (ESS).
1013

1114
## Features
1215

13-
- Electric grid models:
14-
- Obtain nodal / branch admittance and incidence matrices¹.
15-
- Obtain steady state power flow solution for nodal voltage / branch flows / losses via fixed-point algorithm / [OpenDSS](https://github.com/dss-extensions/OpenDSSDirect.py)¹.
16-
- Obtain sensitivity matrices of global linear approximate grid model¹.
17-
- ¹Fully enabled for unbalanced / multiphase grid configuration.
18-
- Thermal grid models:
19-
- Obtain nodal / branch incidence matrices.
20-
- Obtain thermal power flow solution for nodal head / branch flows / pumping losses.
21-
- Obtain sensitivity matrices of global linear approximate grid model.
22-
- Distributed energy resource (DER) models:
23-
- Time series models for fixed loads.
24-
- Time series models for EV charging.
25-
- Linear models for flexible building loads.
26-
- Optimal operation problems:
27-
- Obtain numerical optimization problem for combined optimal operation for electric / thermal grids with DERs.
28-
- Obtain electric / thermal optimal power flow solution.
29-
- Obtain distribution locational marginal prices (DLMPs) for the electric / thermal grids.
16+
MESMO implements 1) non-linear models for simulation-based analysis and 2) convex models for optimization-based analysis of electric grids, thermal grids and DERs. Through high-level interfaces, MESMO enables modeling operation problems for both traditional scenario-based simulation as well as optimization-based decision support. An emphasis of MESMO is on the modeling of multi-energy systems, i.e. the coupling of multi-commodity and multi-scale energy systems.
17+
18+
1. **Electric grid modeling**
19+
- Simulation: Non-linear modeling of steady-state nodal voltage / branch flows / losses, for multi-phase / unbalanced AC networks.
20+
- Optimization: Linear approximate modeling via global or local approximation, for multi-phase / unbalanced AC networks.
21+
2. **Thermal grid modeling**
22+
- Simulation: Non-linear modeling of steady-state nodal pressure head / branch flow / pump losses, for radial district heating / cooling systems.
23+
- Optimization: Linear approximate modeling via global or local approximation, for radial district heating / cooling systems.
24+
3. **Distributed energy resource (DER) modeling**
25+
- Simulation & optimization: Time series models for non-dispatchable / fixed DERs.
26+
- Optimization: Linear state-space models for dispatchable / flexible DERs.
27+
- Currently implemented DER models: Conventional fixed loads, generic flexible loads, flexible thermal building loads, non-dispatchable generators, controllable electric / thermal generators, electric / thermal energy storage systems, combined heat-and-power plants.
28+
4. **Solution interfaces**
29+
- Simulation: Solution of non-linear power flow problems for electric / thermal grids.
30+
- Optimization: Solution of convex optimization problems for electric / thermal grids and DERs, through third-party numerical optimization solvers.
31+
- Generic optimization problem interface: Supports defining custom constraints and objective terms to augment the built-in models. Enables retrieving duals / DLMPs for the study of decentralized / distributed control architectures for energy systems.
32+
- High-level problem interfaces: Nominal operation problem for simulation-based studies; Optimal operation problem for optimization-based studies.
3033

3134
## Documentation
3235

33-
The preliminary documentation is located at [tumcreate-estl.github.io/fledge](https://tumcreate-estl.github.io/fledge).
36+
The documentation is located at [mesmo-dev.github.io/mesmo](https://mesmo-dev.github.io/mesmo).
3437

3538
## Installation
3639

37-
1. Check requirements:
38-
- Python 3.7
39-
- [Gurobi Optimizer](http://www.gurobi.com/)
40-
2. Clone or download repository. Ensure that the `cobmo` submodule directory is loaded as well.
41-
3. In your Python environment, run:
42-
1. `pip install -v -e path_to_repository`
40+
MESMO has not yet been deployed to Python `pip` / `conda` package indexes, but can be installed in a local development environment as follows:
4341

44-
Please also read [docs/getting_started.md](./docs/getting_started.md).
42+
1. Check requirements:
43+
- Python distribution¹: [Anaconda](https://www.anaconda.com/distribution/) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html) or [Miniforge](https://github.com/conda-forge/miniforge).
44+
- Optimization solver²: [Gurobi](http://www.gurobi.com/) or [CVXPY-supported solver](https://www.cvxpy.org/tutorial/advanced/index.html#choosing-a-solver).
45+
2. Clone or download the repository. Ensure that the `cobmo` submodule directory is loaded as well.
46+
3. In `conda`-enabled shell (e.g. Anaconda Prompt), run:
47+
- `cd path_to_mesmo_repository`
48+
- `conda create -n mesmo -c conda-forge python=3.8 contextily cvxpy numpy pandas scipy`
49+
- `conda activate mesmo`
50+
- `pip install -v -e .`
51+
- On Intel CPUs³: `conda install -c conda-forge "libblas=*=*mkl"`
52+
53+
For notes ¹/²/³ and alternative installation guide, see [docs/installation.md](docs/installation.md).
4554

4655
## Contributing
4756

4857
If you are keen to contribute to this project, please see [docs/contributing.md](./docs/contributing.md).
4958

5059
## Publications
5160

52-
Information on citing FLEDGE and a list of related publications is available at [docs/publications.md](docs/publications.md).
61+
Information on citing MESMO and a list of related publications is available at [docs/publications.md](docs/publications.md).
5362

5463
## Acknowledgements
5564

65+
- MESMO is developed in collaboration between [TUMCREATE](https://www.tum-create.edu.sg/), the [Institute for High Performance Computing, A*STAR](https://www.a-star.edu.sg/ihpc) and the [Chair of Renewable and Sustainable Energy Systems, TUM](https://www.ei.tum.de/en/ens/).
66+
- Sebastian Troitzsch implemented the initial version of MESMO and maintains this repository.
67+
- Sarmad Hanif and Kai Zhang developed the underlying electric grid modeling, fixed-point power flow solution and electric grid approximation methodologies.
68+
- Arif Ahmed implemented the implicit Z-bus power flow solution method & overhead line type definitions.
69+
- Mischa Grussmann developed the thermal grid modeling and approximation methodologies.
70+
- Verena Kleinschmidt implemented several multi-energy DER models, such as the heating plant and CHP plant models.
71+
- Sebastian Troitzsch and Tom Schelo implemented the optimization problem class.
5672
- This work was financially supported by the Singapore National Research Foundation under its Campus for Research Excellence And Technological Enterprise (CREATE) programme.
57-
- Sebastian Troitzsch implemented the initial version of FLEDGE and maintains this repository.
58-
- Sarmad Hanif and Kai Zhang developed the underlying electric grid modelling, fixed-point power flow solution and electric grid approximation methodologies.
59-
- Arif Ahmed implemented the implicit Z-bus power flow solution method.
60-
- Mischa Grussmann developed the thermal grid modelling and approximation methodologies.

data/der_models.csv

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
der_type,der_model_name,definition_type,definition_name,power_per_unit_minimum,power_per_unit_maximum,power_factor_minimum,power_factor_maximum,energy_storage_capacity_per_unit,charging_efficiency,self_discharge_rate,marginal_cost,heat_pump_efficiency,thermal_efficiency,electric_efficiency
2-
fixed_load,mixed_commercial_residential,schedule_per_unit,mixed_commercial_residential,,,,,,,,,,,
3-
fixed_load,residential_landed,schedule_per_unit,residential_landed,,,,,,,,,,,
4-
flexible_load,mixed_commercial_residential,schedule_per_unit,mixed_commercial_residential,0.6,1.4,,,6,,,,,,
5-
flexible_load,residential_landed,schedule_per_unit,residential_landed,0.6,1.4,,,6,,,,,,
6-
fixed_generator,photovoltaic_generic,schedule_per_unit,photovoltaic_generic,,,,,,,,,,,
7-
fixed_generator,solarthermal_generic,schedule_per_unit,solarthermal_generic,,,,,,,,,,,
8-
flexible_generator,photovoltaic_generic,schedule_per_unit,photovoltaic_generic,0,1,,,,,,0.1,,,
9-
flexible_generator,solarthermal_generic,schedule_per_unit,solarthermal_generic,0,1,,,,,,0.1,,,
10-
fixed_ev_charger,fixed_ev_charger_generic,schedule_per_unit,fixed_ev_charger_generic,,,,,,,,,,,
11-
cooling_plant,cooling_plant_singapore,cooling_plant,cooling_plant_singapore,,,,,,,,,,,
12-
heat_pump,heat_pump_generic,schedule_per_unit,heat_pump_generic,0,1,,,6,,,1,1.2,,
13-
flexible_chp,flexible_chp_generic,schedule_per_unit,flexible_chp_generic,0,1,,,6,,,1,,0.55,0.37
14-
storage,battery_storage_generic,,,0,1,,,12,0.99,0.01,,,,
15-
storage,thermal_storage_generic,,,0.5,1,,,6,0.99,0.01,,,,
1+
der_type,der_model_name,definition_type,definition_name,power_per_unit_minimum,power_per_unit_maximum,power_factor_minimum,power_factor_maximum,energy_storage_capacity_per_unit,charging_efficiency,self_discharge_rate,marginal_cost,thermal_efficiency,electric_efficiency
2+
fixed_load,singapore_base_load,schedule_per_unit,singapore_base_load,,,,,,,,,,
3+
fixed_load,mixed_commercial_residential,schedule_per_unit,mixed_commercial_residential,,,,,,,,,,
4+
fixed_load,residential_landed,schedule_per_unit,residential_landed,,,,,,,,,,
5+
flexible_load,mixed_commercial_residential,schedule_per_unit,mixed_commercial_residential,0.6,1.4,,,6,,,,,
6+
flexible_load,residential_landed,schedule_per_unit,residential_landed,0.6,1.4,,,6,,,,,
7+
fixed_generator,photovoltaic_generic,schedule_per_unit,photovoltaic_generic,,,,,,,,,,
8+
fixed_generator,solarthermal_generic,schedule_per_unit,solarthermal_generic,,,,,,,,,,
9+
flexible_generator,photovoltaic_generic,schedule_per_unit,photovoltaic_generic,0,1,,,,,,0.1,,
10+
flexible_generator,solarthermal_generic,schedule_per_unit,solarthermal_generic,0,1,,,,,,0.1,,
11+
fixed_ev_charger,fixed_ev_charger_generic,schedule_per_unit,fixed_ev_charger_generic,,,,,,,,,,
12+
cooling_plant,cooling_plant_singapore,cooling_plant,cooling_plant_singapore,,,,,,,,,,
13+
heating_plant,heating_plant_generic,schedule_per_unit,heating_plant_generic,0,1,,,6,,,1,1.2,
14+
flexible_chp,flexible_chp_generic,schedule_per_unit,flexible_chp_generic,0,1,,,6,,,1,0.55,0.37
15+
storage,battery_storage_generic,,,0,1,,,12,0.99,0.01,,,
16+
storage,thermal_storage_generic,,,0.5,1,,,6,0.99,0.01,,,

0 commit comments

Comments
 (0)