Contents¶
Overview¶
docs | |
---|---|
tests | |
package |
Creating heat and power demand profiles from annual values.
- Free software: MIT license
Installation¶
pip install demandlib
You can also install the in-development version with:
pip install https://github.com/oemof/demandlib/archive/master.zip
Documentation¶
Development¶
To run all the tests run:
tox
Note, to combine the coverage data from all the tox environments run:
Windows | set PYTEST_ADDOPTS=--cov-append
tox
|
---|---|
Other | PYTEST_ADDOPTS=--cov-append tox
|
BDEW Load Profiles¶
Using the demandlib you can create heat and electrical profiles by scaling the BDEW profiles to your desired annual demand. The BDEW profiles are the standard load profiles from BDEW.
Heat Profiles¶
Description¶
Heat profiles are created according to the approach described in the corresponding BDEW guideline.
The method was originally established in this PhD Thesis at TU Munich.
The approach for generating heat demand profiles is described in section 4.1 (Synthetic load profile approach).

The geometric series approach is meant to account for thermal inertia.
Depending on the profile type, different coefficients A, B, C, D for the sigmoid function are used.
Types of houses:
Building class:
The parameter building_class
(German: Baualtersklasse) can assume values in the range 1-11.
Usage¶
Electrical Profiles¶
Description¶
The electrical profiles are the standard load profiles from BDEW. All profiles have a resolution of 15 minutes. They are based on measurements in the German electricity sector. There is a dynamic function (h0_dyn) for the houshold (h0) profile that better takes the seasonal variance into account.
With t the day of the year as a decimal number.
The following profile types are available. Be aware that the types in Python code are strings in lowercase.
Typ | Beschreibung | Erläuterung |
---|---|---|
G0 | Gewerbe allgemein | Gewogener Mittelwert der Profile G1-G6 |
G1 | Gewerbe werktags 8–18 Uhr | z.B. Büros, Arztpraxen, Werkstätten, Verwaltungseinrichtungen |
G2 | Gewerbe mit starkem bis überwiegendem Verbrauch in den Abendstunden | z.B. Sportvereine, Fitnessstudios, Abendgaststätten |
G3 | Gewerbe durchlaufend | z.B. Kühlhäuser, Pumpen, Kläranlagen |
G4 | Laden/Friseur | |
G5 | Bäckerei mit Backstube | |
G6 | Wochenendbetrieb | z.B. Kinos |
G7 | Mobilfunksendestation | durchgängiges Bandlastprofil |
L0 | Landwirtschaftsbetriebe allgemein | Gewogener Mittelwert der Profile L1 und L2 |
L1 | Landwirtschaftsbetriebe mit Milchwirtschaft/Nebenerwerbs-Tierzucht | |
L2 | Übrige Landwirtschaftsbetriebe | |
H0/H0_dyn | Haushalt/Haushalt dynamisiert |
type | description | explanation |
---|---|---|
G0 | General trade/business/commerce | Weighted average of profiles G1-G6 |
G1 | Business on weekdays 8 a.m. - 6 p.m. | e.g. offices, doctors’ surgeries, workshops, administrative facilities |
G2 | Businesses with heavy to predominant consumption in the evening hours | e.g. sports clubs, fitness studios, evening restaurants |
G3 | Continuous business | e.g. cold stores, pumps, sewage treatment plants |
G4 | Shop/barber shop | |
G5 | Bakery with bakery | |
G6 | Weekend operation | e.g. cinemas |
G7 | Mobile phone transmitter station | continuous band load profile |
L0 | General farms | Weighted average of profiles L1 and L2 |
L1 | Farms with dairy farming/part-time livestock farming | |
L2 | Other farms | |
H0/H0_dyn | Household/dynamic houshold |
Further information in German language is available at the BDEW.
Usage¶
from demandlib import bdew
Further Profiles¶
We implemented further profiles (one until now) to represent further demand sectors which are not covered by the BDEW load profiles.
Reference¶
Implementation of the standard load profiles
-
class
demandlib.bdew.elec_slp.
ElecSlp
(year, seasons=None, holidays=None)[source]¶ Bases:
object
Generate electrical standardized load profiles based on the BDEW method.
Variables: - datapath (string) – Path to the csv files containing the load profile data.
- date_time_index (pandas.DateTimeIndex) – Time range for and frequency for the profile.
Parameters: - year (integer) – Year of the demand series.
- Optional Parameters
- ——————-
- seasons (dictionary) – Describing the time ranges for summer, winter and transition periods.
- holidays (dictionary or list) – The keys of the dictionary or the items of the list should be datetime objects of the days that are holidays.
-
create_bdew_load_profiles
(dt_index, slp_types, holidays=None)[source]¶ Calculates the hourly electricity load profile in MWh/h of a region.
Implementation of the bdew heat load profiles
-
class
demandlib.bdew.heat_building.
HeatBuilding
(df_index, **kwargs)[source]¶ Bases:
object
Parameters: year (int) – year for which the profile is created
Variables: - datapath (string) – path to the bdew basic data files (csv)
- temperature (pandas.Series) – Series containing hourly temperature data
- annual_heat_demand (float) – annual heat demand of building in kWh
- building_class (int) – class of building according to bdew classification possible numbers are: 1 - 11
- shlp_type (string) – type of standardized heat load profile according to bdew possible types are: GMF, GPD, GHD, GWA, GGB, EFH, GKO, MFH, GBD, GBA, GMK, GBH, GGA, GHA
- wind_class (int) – wind classification for building location (0=not windy or 1=windy)
- ww_incl (boolean) – decider whether warm water load is included in the heat load profile
-
get_sf_values
(filename='shlp_hour_factors.csv')[source]¶ Determine the h-values
Parameters: filename (string) – name of file where sigmoid factors are stored
-
get_sigmoid_parameters
(filename='shlp_sigmoid_factors.csv')[source]¶ Retrieve the sigmoid parameters from csv-files
Parameters: filename (string) – name of file where sigmoid factors are stored
-
get_temperature_interval
()[source]¶ Appoints the corresponding temperature interval to each temperature in the temperature vector.
-
get_weekday_parameters
(filename='shlp_weekday_factors.csv')[source]¶ Retrieve the weekday parameter from csv-file
Parameters: filename (string) – name of file where sigmoid factors are stored
-
weighted_temperature
(how='geometric_series')[source]¶ A new temperature vector is generated containing a multi-day average temperature as needed in the load profile function.
Parameters: how (string) – string which type to return (“geometric_series” or “mean”) Notes
Equation for the mathematical series of the average temperature [1]:
- with
= Average temperature on the present day
= Average temperature on the day - i
References
[1] BDEW, # noqa: E501 BDEW Documentation for heat profiles. - with
Implementation of the bdew standard load profiles for electric power.
-
class
demandlib.particular_profiles.
IndustrialLoadProfile
(dt_index, holidays=None)[source]¶ Bases:
object
Generate an industrial heat or electric load profile.
-
simple_profile
(annual_demand, **kwargs)[source]¶ Create industrial load profile
Parameters: annual_demand (float) – Total demand.
Other Parameters: - am (datetime.time) – beginning of workday
- pm (datetime.time) – end of workday
- week (list) – list of weekdays
- weekend (list) – list of weekend days
- profile_factors (dictionary) – dictionary with scaling factors for night and day of weekdays and weekend days
-
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
Bug reports¶
When reporting a bug please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Documentation improvements¶
oemof could always use more documentation, whether as part of the official oemof docs, in docstrings, or even on the web in blog posts, articles, and such.
Feature requests and feedback¶
The best way to send feedback is to file an issue at https://github.com/oemof/demandlib/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that code contributions are welcome :)
Development¶
To set up demandlib for local development:
Fork demandlib (look for the “Fork” button).
Clone your fork locally:
git clone git@github.com:YOURGITHUBNAME/demandlib.git
Create a branch for local development:
git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes run all the checks and docs builder with tox one command:
tox
Commit your changes and push your branch to GitHub:
git add . git commit -m "Your detailed description of your changes." git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
If you need some code review or feedback while you’re developing the code just make the pull request.
For merging, you should:
- Include passing tests (run
tox
). - Update documentation when there’s new API, functionality etc.
- Add a note to
CHANGELOG.rst
about the changes. - Add yourself to
AUTHORS.rst
.
Tips¶
To run a subset of tests:
tox -e envname -- pytest -k test_myfeature
To run all the test environments in parallel:
tox -p auto
Authors¶
(alphabetic order)
- Birgit Schachler
- Caroline Möller
- Guido Plessmann
- Hendrik Huyskens
- Jann Launer
- Patrik Schönfeldt
- Pyosch
- Steffen Wehkamp
- Stephen Bosch
- Uwe Krien
Changelog¶
v0.1.9 (2023-03-18)¶
- Calculation of BDEW profiles was improved
v0.1.7 (2021-01-27)¶
New features¶
- Add dynamic h0 profile calculation (The implementation is not optimised for performance. Thus, it is not used by default.)
Bug fixes¶
- Fix improper use of pandas.dataframe.merge (demandlib will now work with pandas>=1.2)
Other changes¶
- Update deprecated pd.datetime to datetime.datetime
- Add (integration) tests and coverage as CI
- Split BDEW profile generation into submodules
v0.1.5 (2018-09-05)¶
New features¶
- Add function get_normalized_bdew_profile(self) to get a normalised profile. You could also use an annual_demand of one to get the same results.
Bug fixes¶
- Fix y-label of the heat example plot.
Other changes¶
- Make matplotlib optional in examples.
v0.1.4 (2018-05-30)¶
Code¶
- fix temperature bug
- fix Code style
Documentation¶
- Documentation improvements.