From e15b67b2e5f0e0ec6fd8c090f550d862fdf1248c Mon Sep 17 00:00:00 2001 From: "F.N. Claessen" Date: Mon, 26 Feb 2024 16:05:39 +0100 Subject: [PATCH] docs: changelog entry for v0.19.1, plus 2 fixes Signed-off-by: F.N. Claessen --- documentation/api/change_log.rst | 2 +- documentation/changelog.rst | 12 ++++++++++-- documentation/cli/change_log.rst | 13 +++++-------- flexmeasures/cli/data_add.py | 5 +++-- flexmeasures/cli/tests/test_data_add.py | 2 +- flexmeasures/data/models/planning/utils.py | 6 ++++++ 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/documentation/api/change_log.rst b/documentation/api/change_log.rst index 32fbd400c..240d9e513 100644 --- a/documentation/api/change_log.rst +++ b/documentation/api/change_log.rst @@ -9,7 +9,7 @@ API change log v3.0-16 | 2024-02-26 """""""""""""""""""" -- Fix support for providing a sensor definition to the ``site-power-capacity`` flex-config field for `/sensors//schedules/trigger` (POST). +- Fix support for providing a sensor definition to the ``power-capacity`` flex-model field for `/sensors//schedules/trigger` (POST). v3.0-15 | 2024-01-11 """""""""""""""""""" diff --git a/documentation/changelog.rst b/documentation/changelog.rst index 43f37847d..16a8b485d 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -17,6 +17,14 @@ Infrastructure / Support ---------------------- + + +v0.19.1 | February 26, 2024 +============================ + +* Support defining the ``power-capacity`` as a sensor in the API and CLI [see `PR #987 `_] + + v0.19.0 | February 18, 2024 ============================ @@ -52,7 +60,8 @@ v0.18.2 | February 26, 2024 * Convert unit of the power capacities to ``MW`` instead of that of the storage power sensor [see `PR #979 `_] * Automatically update table navigation in the UI without requiring users to hard refresh their browser [see `PR #961 `_] * Updated documentation to enhance clarity for integrating plugins within the FlexMeasures Docker container [see `PR #958 `_] -* Support defining the ``site-power-capacity`` as a sensor [see `PR #987 `_] +* Support defining the ``power-capacity`` as a sensor in the API [see `PR #987 `_] + v0.18.1 | January 15, 2024 ============================ @@ -69,7 +78,6 @@ Bugfixes * Fix the validation of the option ``--parent-asset`` of command ``flexmeasures add asset`` [see `PR #959 `_] - v0.18.0 | December 23, 2023 ============================ diff --git a/documentation/cli/change_log.rst b/documentation/cli/change_log.rst index a7fd30dab..ca7a2fb0f 100644 --- a/documentation/cli/change_log.rst +++ b/documentation/cli/change_log.rst @@ -9,6 +9,11 @@ since v.0.20.0 | March XX, 2024 * Add command ``flexmeasures edit transfer-ownership`` to transfer the ownership of an asset and its children. +since v0.19.1 | February 26, 2024 +======================================= + +* Fix support for providing a sensor definition to the ``--storage-power-capacity`` option of the ``flexmeasures add schedule for-storage`` command. + since v0.19.0 | February 18, 2024 ======================================= @@ -32,19 +37,11 @@ since v0.19.0 | February 18, 2024 * ``--source-id`` -> ``--source`` * ``--user-id`` -> ``--user` - -since v0.18.2 | February 26, 2024 -======================================= - -* Fix support for providing a sensor definition to the ``--site-power-capacity`` option of the ``flexmeasures add schedule for-storage`` command. - - since v0.18.1 | January 15, 2024 ======================================= * Fix the validation of the option ``--parent-asset`` of command ``flexmeasures add asset``. - since v0.17.0 | November 8, 2023 ======================================= diff --git a/flexmeasures/cli/data_add.py b/flexmeasures/cli/data_add.py index 63fc2818d..223601ce2 100755 --- a/flexmeasures/cli/data_add.py +++ b/flexmeasures/cli/data_add.py @@ -1218,10 +1218,11 @@ def create_schedule(ctx): @click.option( "--storage-power-capacity", "storage_power_capacity", - type=QuantityField("MW"), + type=QuantityOrSensor("MW"), required=False, default=None, - help="Storage consumption/production power capacity. Provide this as a quantity in power units (e.g. 1 MW or 1000 kW)." + help="Storage consumption/production power capacity. Provide this as a quantity in power units (e.g. 1 MW or 1000 kW)" + "or reference a sensor using 'sensor:' (e.g. sensor:34)." "It defines both-ways maximum power capacity.", ) @click.option( diff --git a/flexmeasures/cli/tests/test_data_add.py b/flexmeasures/cli/tests/test_data_add.py index 11083a0f8..da43c1785 100644 --- a/flexmeasures/cli/tests/test_data_add.py +++ b/flexmeasures/cli/tests/test_data_add.py @@ -461,7 +461,7 @@ def test_add_account( @pytest.mark.skip_github @pytest.mark.parametrize("storage_power_capacity", ["sensor", "quantity", None]) @pytest.mark.parametrize("storage_efficiency", ["sensor", "quantity", None]) -def test_add_storage_scheduler( +def test_add_storage_schedule( app, add_market_prices_fresh_db, storage_schedule_sensors, diff --git a/flexmeasures/data/models/planning/utils.py b/flexmeasures/data/models/planning/utils.py index 3311aa0ef..0374c9eea 100644 --- a/flexmeasures/data/models/planning/utils.py +++ b/flexmeasures/data/models/planning/utils.py @@ -411,4 +411,10 @@ def get_continuous_series_sensor_or_quantity( def nanmin_of_series_and_value(s: pd.Series, value: float | pd.Series) -> pd.Series: """Perform a nanmin between a Series and a float.""" + if isinstance(value, pd.Series): + # Avoid strange InvalidIndexError on .clip due to different "dtype" + # pd.testing.assert_index_equal(value.index, s.index) + # [left]: datetime64[ns, +0000] + # [right]: datetime64[ns, UTC] + value = value.tz_convert("UTC") return s.fillna(value).clip(upper=value)