Skip to content

Commit

Permalink
Add resampling of heat pump time series to EDisGo resampling
Browse files Browse the repository at this point in the history
  • Loading branch information
birgits committed Mar 8, 2023
1 parent cf610da commit c04dcff
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
10 changes: 8 additions & 2 deletions edisgo/edisgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2359,7 +2359,10 @@ def resample_timeseries(
self, method: str = "ffill", freq: str | pd.Timedelta = "15min"
):
"""
Resamples all generator, load and storage time series to a desired resolution.
Resamples time series data in
:class:`~.network.timeseries.TimeSeries` and :class:`~.network.heat.HeatPump`.
Both up- and down-sampling methods are possible.
The following time series are affected by this:
Expand All @@ -2375,7 +2378,9 @@ def resample_timeseries(
* :attr:`~.network.timeseries.TimeSeries.storage_units_reactive_power`
Both up- and down-sampling methods are possible.
* :attr:`~.network.heat.HeatPump.cop_df`
* :attr:`~.network.heat.HeatPump.heat_demand_df`
Parameters
----------
Expand All @@ -2402,6 +2407,7 @@ def resample_timeseries(
"""
self.timeseries.resample_timeseries(method=method, freq=freq)
self.heat_pump.resample_timeseries(method=method, freq=freq)


def import_edisgo_from_pickle(filename, path=""):
Expand Down
16 changes: 16 additions & 0 deletions tests/test_edisgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,22 @@ def test_check_integrity(self, caplog):
)
caplog.clear()

def test_resample_timeseries(self):
self.setup_worst_case_time_series()
self.edisgo.resample_timeseries()
assert len(self.edisgo.timeseries.loads_active_power) == 16

self.edisgo.heat_pump.cop_df = pd.DataFrame(
data={
"hp1": [5.0, 6.0],
"hp2": [7.0, 8.0],
},
index=pd.date_range("1/1/2011 12:00", periods=2, freq="H"),
)
self.edisgo.resample_timeseries(freq="30min")
assert len(self.edisgo.timeseries.loads_active_power) == 8
assert len(self.edisgo.heat_pump.cop_df) == 4


class TestEDisGoFunc:
def test_import_edisgo_from_files(self):
Expand Down

0 comments on commit c04dcff

Please sign in to comment.