Skip to content

Commit 8439157

Browse files
authored
Merge pull request #79 from oemof/dev
Release v0.2.2
2 parents 5ab05bf + b0d2a3a commit 8439157

Some content is hidden

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

58 files changed

+151151
-88
lines changed

.github/workflows/tox_pytests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
python-version: ["3.9", "3.10", "3.11"]
19+
python-version: ["3.10", "3.11", "3.12"]
2020

2121
steps:
2222
- uses: actions/checkout@v4

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
build:
44
os: ubuntu-22.04
55
tools:
6-
python: "3.8"
6+
python: "3.10"
77
sphinx:
88
configuration: docs/conf.py
99
formats: all

CHANGELOG.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
Changelog
22
=========
33

4+
v0.2.2 (YYYY-MM-DD)
5+
+++++++++++++++++++++++++
6+
7+
New features
8+
############
9+
* Added Electricity standard load profiles as released by the BDEW in 2025.
10+
11+
Bug fixes
12+
#########
13+
14+
Other changes
15+
#############
16+
17+
418
v0.2.1 (2024-08-06)
519
+++++++++++++++++++++++++
620

MANIFEST.in

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
include setup.py
2+
3+
include *.txt
4+
include *.yml
5+
recursive-include executable *.ico
6+
recursive-include executable *.py
7+
requirements.txt
8+
recursive-include executable *.spec
9+
10+
exclude tests/.coverage
11+
global-exclude *.xml
12+
13+
global-exclude *.py[cod] __pycache__/* *.so *.dylib
14+
15+
# added by check-manifest
16+
include *.py
17+
18+
exclude setup.py
19+
20+
# added by check-manifest
21+
include *.in
22+
23+
exclude MANIFEST.in

docs/bdew.rst

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ The parameter ``building_class`` (German: Baualtersklasse) can assume values in
6565
Usage
6666
+++++
6767

68+
.. code-block:: python
69+
70+
from demandlib import bdew
71+
72+
...
73+
6874
Electrical Profiles
6975
~~~~~~~~~~~~~~~~~~~
7076

@@ -74,7 +80,7 @@ Description
7480
The electrical profiles are the standard load profiles from BDEW. All profiles
7581
have a resolution of 15 minutes. They are based on measurements in the German
7682
electricity sector. There is a dynamic function (h0_dyn) for the houshold (h0)
77-
profile that better takes the seasonal variance into account.
83+
profile that better takes the seasonal variance into account [`BDEW <https://www.bdew.de/energie/standardlastprofile-strom/>`_].
7884

7985
.. math::
8086
@@ -85,7 +91,7 @@ With `t` the day of the year as a decimal number.
8591
The following profile types are available.
8692
Be aware that the types in Python code are strings in **lowercase**.
8793

88-
.. csv-table:: German (original)
94+
.. csv-table:: German (original) [`Wikipedia <https://de.wikipedia.org/wiki/Standardlastprofil>`_]
8995
:header: Typ,Beschreibung,Erläuterung
9096
:widths: 10, 40, 50
9197

@@ -130,3 +136,27 @@ Usage
130136
.. code-block:: python
131137
132138
from demandlib import bdew
139+
e_slp = bdew.ElecSlp(year=2020)
140+
141+
# get all available types
142+
print(e_slp.get_profiles().columns)
143+
144+
# get the "h0" and "g0" profile
145+
profiles = e_slp.get_profiles("h0", "g0")
146+
147+
# get scaled profiles
148+
scaled_profiles = e_slp.get_scaled_profiles({"h0": 3000, "g0": 5000})
149+
150+
# get scaled profiles with power values instead of energy values
151+
# a conversion_factor of 4 will convert Wh, kWh etc. to W, kW
152+
e_slp.get_scaled_power_profiles({"h0": 3000, "g0": 5000}, conversion_factor=4)
153+
154+
# add holidays, holidays are treated as Sundays
155+
holidays = {
156+
datetime.date(2010, 1, 1): "New year",
157+
datetime.date(2010, 10, 3): "Day of German Unity",
158+
}
159+
e_slp = bdew.ElecSlp(year=2010, holidays=holidays)
160+
161+
# holiday dictionaries can be created using workalendar
162+
# https://github.com/workalendar/workalendar

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Contents
88
readme
99
installation
1010
bdew
11+
vdi4655
1112
further_profiles
1213
reference/index
1314
contributing

docs/reference/index.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@ Reference
66
:undoc-members:
77
:show-inheritance:
88

9-
109
.. automodule:: demandlib.bdew.heat_building
1110
:members:
1211
:undoc-members:
1312
:show-inheritance:
1413

15-
1614
.. automodule:: demandlib.particular_profiles
1715
:members:
1816
:undoc-members:
1917
:show-inheritance:
18+
19+
.. automodule:: demandlib.vdi.regions
20+
:members:
21+
:undoc-members:
22+
:show-inheritance:
23+
24+
.. automodule:: demandlib.vdi.dwd_try
25+
:members:
26+
:undoc-members:
27+
:show-inheritance:

docs/vdi4655.rst

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
=====================
2+
VDI4655 Load Profiles
3+
=====================
4+
5+
Overview
6+
--------
7+
8+
The VDI 4655 module implements load profile generation for residential buildings
9+
according to the German engineering standard VDI 4655. Heat and power demand
10+
profiles are generated based on typical days and building characteristics.
11+
12+
Key Features:
13+
14+
* Generates heating, hot water and power demand profiles for residential buildings
15+
* Supports both single-family (EFH) and multi-family houses (MFH)
16+
* Considers weather data, based on the building location in Germany
17+
* Accounts for seasonal variations and holidays
18+
* Customizable temperature limits for season definitions
19+
* Adjustable temporal resolution (e.g., hourly, 15-minute intervals)
20+
21+
22+
Example Usage
23+
-------------
24+
25+
Here's a basic example of how to use the VDI 4655 module::
26+
27+
from demandlib import vdi
28+
29+
# Define houses
30+
houses = [
31+
{
32+
"name": "EFH_1",
33+
"house_type": "EFH",
34+
"N_Pers": 3,
35+
"N_WE": 1,
36+
"Q_Heiz_a": 6000,
37+
"Q_TWW_a": 1500,
38+
"W_a": 5250,
39+
}
40+
]
41+
42+
# Create region
43+
region = vdi.Region(
44+
2017,
45+
try_region=4,
46+
houses=houses,
47+
resample_rule="1h"
48+
)
49+
50+
# Generate load curves
51+
load_curves = region.get_load_curve_houses()
52+
53+
House Parameters
54+
----------------
55+
56+
Required parameters for each house:
57+
58+
* ``name``: Unique identifier for the house
59+
* ``house_type``: Either "EFH" (single-family) or "MFH" (multi-family)
60+
* ``N_Pers``: Number of persons, up to 12 (relevant for EFH)
61+
* ``N_WE``: Number of apartments, up to 40 (relevant for MFH)
62+
* ``Q_Heiz_a``: Annual heating demand in kWh
63+
* ``Q_TWW_a``: Annual hot water demand in kWh
64+
* ``W_a``: Annual electricity demand in kWh
65+
66+
Optional parameters:
67+
68+
* ``summer_temperature_limit``: Temperature threshold for summer season (default: 15°C)
69+
* ``winter_temperature_limit``: Temperature threshold for winter season (default: 5°C)
70+
71+
Weather Data
72+
------------
73+
74+
The module uses German test reference year (TRY) weather data by 'Deutscher Wetterdienst' (DWD)
75+
for determining the daily temperature and cloud coverage. You can:
76+
77+
* Use the weather data from one of the 15 TRY regions by DWD from 2010
78+
79+
* Specify a TRY region number (``try_region`` parameter), or
80+
81+
* Use geographical coordinates to determine the TRY region (requires geopandas)
82+
83+
* Provide your own weather file (``file_weather`` parameter), adhering to the standard
84+
of the TRY weather data published in 2016 by DWD (available at https://kunden.dwd.de/obt/)
85+
86+
Further Reading
87+
---------------
88+
89+
For more details about the VDI 4655 standard, refer to:
90+
91+
* VDI 4655: Reference load profiles of single-family and multi-family houses for the use of CHP systems
92+
* May 2008 (ICS 91.140.01)
93+
* Verein Deutscher Ingenieure e.V.

examples/bdew_slp25.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""
2+
SPDX-FileCopyrightText: Deutsches Zentrum für Luft- und Raumfahrt
3+
SPDX-FileCopyrightText: Patrik Schönfeldt
4+
5+
6+
SPDX-License-Identifier: MIT
7+
"""
8+
9+
import datetime
10+
11+
import matplotlib.pyplot as plt
12+
import pandas as pd
13+
14+
15+
from demandlib import bdew
16+
17+
index15m = pd.date_range(
18+
start="2020-01-01 00:00",
19+
end="2020-01-31 23:45",
20+
freq="15min",
21+
)
22+
index1m = pd.date_range(
23+
start="2020-01-01 00:00",
24+
end="2020-01-31 23:45",
25+
freq="1min",
26+
)
27+
index3h = pd.date_range(
28+
start="2020-01-01 00:00",
29+
end="2020-01-31 23:45",
30+
freq="3h",
31+
)
32+
33+
holidays = [
34+
datetime.date(2020, 1, 1),
35+
datetime.date(2020, 1, 2),
36+
datetime.date(2020, 1, 3),
37+
datetime.date(2020, 1, 4),
38+
datetime.date(2020, 1, 5),
39+
]
40+
41+
h25_holidays = bdew.H25(index1m, holidays)
42+
h25_std = bdew.H25(index15m)
43+
h25_3h = bdew.H25(index3h)
44+
45+
plt.step(h25_holidays.index, h25_holidays, label="Holidays", where="post")
46+
plt.step(h25_std.index, h25_std, label="Standard", where="post")
47+
plt.step(h25_3h.index, h25_3h, label="Three hours", where="post")
48+
plt.legend()
49+
50+
plt.show()

examples/electricity_demand_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import demandlib.bdew as bdew
2929
import demandlib.particular_profiles as profiles
3030

31-
# The following dictionary is create by "workalendar"
31+
# The following dictionary has been created by "workalendar"
3232
# pip3 install workalendar
3333
# >>> from workalendar.europe import Germany
3434
# >>> cal = Germany()
@@ -62,7 +62,7 @@
6262
e_slp = bdew.ElecSlp(year, holidays=holidays)
6363

6464
# multiply given annual demand with timeseries
65-
elec_demand = e_slp.get_profile(ann_el_demand_per_sector)
65+
elec_demand = e_slp.get_scaled_power_profiles(ann_el_demand_per_sector)
6666

6767
# Add the slp for the industrial group
6868
ilp = profiles.IndustrialLoadProfile(e_slp.date_time_index, holidays=holidays)

0 commit comments

Comments
 (0)