diff --git a/flexmeasures/api/v3_0/tests/test_sensor_schedules_fresh_db.py b/flexmeasures/api/v3_0/tests/test_sensor_schedules_fresh_db.py index 3b4db45fb1..1c70b12c9b 100644 --- a/flexmeasures/api/v3_0/tests/test_sensor_schedules_fresh_db.py +++ b/flexmeasures/api/v3_0/tests/test_sensor_schedules_fresh_db.py @@ -324,6 +324,7 @@ def test_inflexible_device_sensors_priority( fresh_db, add_market_prices_fresh_db, add_battery_assets_fresh_db, + setup_fresh_test_forecast_data, battery_soc_sensor_fresh_db, add_charging_station_assets_fresh_db, keep_scheduling_queue_empty, @@ -341,6 +342,9 @@ def test_inflexible_device_sensors_priority( "consumption-price": {"sensor": price_sensor_id}, "production-price": {"sensor": price_sensor_id}, "site-power-capacity": "1 TW", # should be big enough to avoid any infeasibilities + "curtailable-device-sensors": [ + setup_fresh_test_forecast_data["solar-sensor"].id + ], } if context_sensor_num: other_asset = add_battery_assets_fresh_db["Test small battery"] diff --git a/flexmeasures/data/schemas/scheduling/__init__.py b/flexmeasures/data/schemas/scheduling/__init__.py index 763bd08f50..0fac57b6e8 100644 --- a/flexmeasures/data/schemas/scheduling/__init__.py +++ b/flexmeasures/data/schemas/scheduling/__init__.py @@ -290,6 +290,12 @@ class FlexContextSchema(Schema): metadata=metadata.INFLEXIBLE_DEVICE_SENSORS.to_dict(), ) + curtailable_device_sensors = fields.List( + SensorIdField(), + data_key="curtailable-device-sensors", + metadata=metadata.CURTAILABLE_DEVICE_SENSORS.to_dict(), + ) + def set_default_breach_prices( self, data: dict, fields: list[str], price: ur.Quantity ): diff --git a/flexmeasures/data/schemas/scheduling/metadata.py b/flexmeasures/data/schemas/scheduling/metadata.py index 5a0e7db803..31674b363e 100644 --- a/flexmeasures/data/schemas/scheduling/metadata.py +++ b/flexmeasures/data/schemas/scheduling/metadata.py @@ -30,11 +30,19 @@ def to_dict(self): INFLEXIBLE_DEVICE_SENSORS = MetaData( description="""Power sensors representing devices that are relevant, but not flexible in the timing of their demand/supply. For example, a sensor recording rooftop solar power that is connected behind the main meter, and whose production falls under the same contract as the flexible device(s) being scheduled. -Their power demand cannot be adjusted but still matters for finding the best schedule for other devices. +Their power generation (or demand) cannot be adjusted but still matters for finding the best schedule for other devices. Must be a list of integers. """, example=[3, 4], ) +CURTAILABLE_DEVICE_SENSORS = MetaData( + description="""Power sensors representing devices that are curtailable. +For example, a sensor recording rooftop solar power that is connected behind the main meter, and whose production falls under the same contract as the flexible device(s) being scheduled. +Their power generation (or demand) can be reduced. +Must be a list of integers. +""", + example=[5, 6], +) COMMITMENTS = MetaData( description="Prior commitments. Support for this field in the UI is still under further development, but you can study the code to learn more.", example=[],