From e062a25fa5a0dc64c918b0b704df8562366249f8 Mon Sep 17 00:00:00 2001 From: Felix Claessen <30658763+flix6x@users.noreply.github.com> Date: Mon, 31 Oct 2022 15:44:47 +0100 Subject: [PATCH] Backport PR #517: Fix scheduler for Charge Points (#517) * Fix bug: list multiplication refers to the same object; as a consequence, any new device constraint overwrote all previously set device constraints Signed-off-by: F.N. Claessen * changelog entry Signed-off-by: F.N. Claessen Signed-off-by: F.N. Claessen --- documentation/changelog.rst | 8 ++++++++ flexmeasures/data/models/planning/charging_station.py | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/documentation/changelog.rst b/documentation/changelog.rst index f9da737ea..174fca2c4 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -2,6 +2,14 @@ FlexMeasures Changelog ********************** +v0.11.3 | November XX, 2022 +============================ + +Bugfixes +----------- +* Fix scheduler for Charge Points when taking into account inflexible devices [see `PR #517 `_] + + v0.11.2 | September 6, 2022 ============================ diff --git a/flexmeasures/data/models/planning/charging_station.py b/flexmeasures/data/models/planning/charging_station.py index 40a321c63..a53df9610 100644 --- a/flexmeasures/data/models/planning/charging_station.py +++ b/flexmeasures/data/models/planning/charging_station.py @@ -110,9 +110,10 @@ def schedule_charging_station( ] if inflexible_device_sensors is None: inflexible_device_sensors = [] - device_constraints = [initialize_df(columns, start, end, resolution)] * ( - 1 + len(inflexible_device_sensors) - ) + device_constraints = [ + initialize_df(columns, start, end, resolution) + for i in range(1 + len(inflexible_device_sensors)) + ] for i, inflexible_sensor in enumerate(inflexible_device_sensors): device_constraints[i + 1]["derivative equals"] = get_power_values( query_window=(start, end),