oemof / demandlib

Creating heat and power demand profiles from annual values.
https://oemof.org
MIT License
54 stars 38 forks source link

Power Example not working? #30

Closed phuismann closed 3 years ago

phuismann commented 3 years ago

I tried to replicate power_demand_example.py, but keep getting the error get_profile() got an unexpected keyword argument 'dyn_function_h0'

Code:

import datetime
import demandlib.bdew as bdew
import demandlib.particular_profiles as profiles
from datetime import time as settime
import matplotlib.pyplot as plt

holidays = {
    datetime.date(2010, 5, 24): 'Whit Monday',
    datetime.date(2010, 4, 5): 'Easter Monday',
    datetime.date(2010, 5, 13): 'Ascension Thursday',
    datetime.date(2010, 1, 1): 'New year',
    datetime.date(2010, 10, 3): 'Day of German Unity',
    datetime.date(2010, 12, 25): 'Christmas Day',
    datetime.date(2010, 5, 1): 'Labour Day',
    datetime.date(2010, 4, 2): 'Good Friday',
    datetime.date(2010, 12, 26): 'Second Christmas Day'}

def power_example(testmode=False):
    year = 2010

    ann_el_demand_per_sector = {
        'g0': 3000,
        'h0': 3000,
        'i0': 3000,
        'i1': 5000,
        'i2': 6000,
        'g6': 5000}

    # read standard load profiles
    e_slp = bdew.ElecSlp(year, holidays=holidays)

    # multiply given annual demand with timeseries
    elec_demand = e_slp.get_profile(ann_el_demand_per_sector,
                                    dyn_function_h0=True)

    [......]
uvchik commented 3 years ago

I think you have downloaded the example from the master branch and now you are trying to run it with demandlib v0.1.6 (latest stable release).

If you use demandlib v0.1.6 you have to download the associated example.

If you want to use your example, which might be better because it contains the dynamic function for residential profiles you have to install the latest version (unreleased) of the demandlib.

pip install git+https://github.com/oemof/demandlib.git

I would recommend to use the latest version.

phuismann commented 3 years ago

Ah yes this makes sense, thank you! Working now.