Skip to content

Commit

Permalink
Merge pull request #418 from openego/bugfix/update_demandlib
Browse files Browse the repository at this point in the history
Bugfix/update demandlib
  • Loading branch information
birgits authored Aug 14, 2024
2 parents 1c59309 + 60be4ff commit 16cdeb7
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
2 changes: 2 additions & 0 deletions edisgo/config/config_timeseries_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ week_day = 0.8
week_night = 0.6
weekend_day = 0.6
weekend_night = 0.6
holiday_day = 0.6
holiday_night = 0.6
# tuple specifying the beginning/end of a workday (e.g. 18:00)
day_start = 6:00
day_end = 22:00
4 changes: 4 additions & 0 deletions edisgo/io/timeseries_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ def load_time_series_demandlib(edisgo_obj, timeindex=None):
"day": edisgo_obj.config["demandlib"]["weekend_day"],
"night": edisgo_obj.config["demandlib"]["weekend_night"],
},
"holiday": {
"day": edisgo_obj.config["demandlib"]["holiday_day"],
"night": edisgo_obj.config["demandlib"]["holiday_night"],
},
},
)

Expand Down
2 changes: 1 addition & 1 deletion rtd_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dash < 2.9.0
demandlib < 0.2.0
demandlib
egoio >= 0.4.7
geopy >= 2.0.0
jupyter_dash
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def read(fname):
requirements = [
"contextily",
"dash < 2.9.0",
"demandlib < 0.2.0",
"demandlib",
"descartes",
"egoio >= 0.4.7",
"geoalchemy2 < 0.7.0",
Expand Down
10 changes: 7 additions & 3 deletions tests/io/test_timeseries_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,20 @@ def test_feedin_oedb(self):

def test_load_time_series_demandlib(self):
edisgo = EDisGo(ding0_grid=pytest.ding0_test_network_path)
timeindex = pd.date_range("1/1/2018", periods=7000, freq="H")
timeindex = pd.date_range("1/1/2018", periods=8760, freq="H")
load = timeseries_import.load_time_series_demandlib(edisgo, timeindex)
assert (
load.columns == ["cts", "residential", "agricultural", "industrial"]
).all()
assert len(load) == 7000
assert len(load) == 8760
assert np.isclose(load.loc[timeindex[453], "cts"], 8.33507e-05)
assert np.isclose(load.loc[timeindex[13], "residential"], 1.73151e-04)
assert np.isclose(load.loc[timeindex[6328], "agricultural"], 1.01346e-04)
assert np.isclose(load.loc[timeindex[4325], "industrial"], 9.91768e-05)
assert np.isclose(load.loc[timeindex[4325], "industrial"], 9.87654320e-05)
assert np.isclose(load.sum()["cts"], 1.0)
assert np.isclose(load.sum()["residential"], 1.0)
assert np.isclose(load.sum()["agricultural"], 1.0)
assert np.isclose(load.sum()["industrial"], 1.0)

@pytest.mark.local
def test_cop_oedb(self):
Expand Down
8 changes: 4 additions & 4 deletions tests/network/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1565,9 +1565,9 @@ def test_predefined_conventional_loads_by_sector(self, caplog):
index=index,
columns=["cts", "residential", "agricultural", "industrial"],
data=[
[0.0000597, 0.0000782, 0.0000654, 0.0000992],
[0.0000526, 0.0000563, 0.0000611, 0.0000992],
[0.0000459, 0.0000451, 0.0000585, 0.0000992],
[0.000059711, 0.0000782190, 0.00006540, 0.00009876],
[0.000052590, 0.0000563428, 0.00006110, 0.00009876],
[0.000045927, 0.0000451043, 0.00005843, 0.00009876],
],
)

Expand Down Expand Up @@ -1656,7 +1656,7 @@ def test_predefined_conventional_loads_by_sector(self, caplog):
self.edisgo.timeseries.loads_active_power[
"Load_industrial_LVGrid_6_1"
].values,
[0.05752256] * 3,
[0.05728395] * 3,
).all()
assert np.isclose(
self.edisgo.timeseries.loads_active_power.loc[
Expand Down

0 comments on commit 16cdeb7

Please sign in to comment.