Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b02e111
feat: allow setting a power sensor in the flex_model of an asset when…
Flix6x May 18, 2026
db45c30
Merge remote-tracking branch 'origin/main' into feat/sensor-in-db-fle…
Flix6x May 20, 2026
3ffdaa0
fix: fields without a data_key just use the variable name as data_key
Flix6x May 20, 2026
4f5b116
feat: switch to consumption and production sensor reference fields in…
Flix6x May 20, 2026
c3f2d68
feat: add UI support for new fields
Flix6x May 20, 2026
711e228
docs: document new fields in scheduling.rst
Flix6x May 20, 2026
1fa459e
feat: add new fields to StorageFlexModelSchema
Flix6x May 20, 2026
ed640b2
chore: update openapi-specs.json
Flix6x May 20, 2026
4733868
storage: add consumption and production output sensor support
Flix6x May 20, 2026
a96edd4
tests: expand storage scheduler tests for consumption/production outp…
Flix6x May 20, 2026
e63ee43
docs: document consumption/production output sensor semantics and add…
Flix6x May 20, 2026
82c6015
style: black
Flix6x May 20, 2026
f9adee9
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/sen…
Flix6x May 26, 2026
6d2b33b
Merge remote-tracking branch 'origin/main' into feat/sensor-in-db-fle…
Flix6x May 26, 2026
4b1ab4f
fix: guard sensor_d against None in StorageScheduler._prepare
saerts-gp Apr 2, 2026
5811ca8
Merge remote-tracking branch 'origin/main' into feat/sensor-in-db-fle…
Flix6x May 26, 2026
a8a3e9e
feat: resample from the resolution of the storage-efficiency sensor t…
Flix6x May 26, 2026
1546e51
docs: extend field description accordingly
Flix6x May 26, 2026
d42f65f
fix: remove obsolete validator
Flix6x May 26, 2026
9bd75ed
feat: do not allow storage-efficiency to be set without a known resol…
Flix6x May 26, 2026
d6e15b6
docs: fill in PR number
Flix6x May 26, 2026
75fa2eb
docs: API changelog entry
Flix6x May 26, 2026
9f173fa
docs: simplify main changelog entry
Flix6x May 26, 2026
1033baf
feat: add more explicit checks in test
Flix6x May 26, 2026
061389b
data/services/scheduling: fix double sign inversion for consumption/p…
Flix6x May 26, 2026
7d902c3
fix: refine sign inversion logic for consumption/production output se…
Flix6x May 26, 2026
82da372
refactor: extract sign resolution logic to utility function
Flix6x May 26, 2026
40128b7
fix: explicitly set the consumption_is_positive attribute on consumpt…
Flix6x May 26, 2026
5651024
Merge remote-tracking branch 'origin/feat/sensor-in-db-flex-model' in…
Copilot May 27, 2026
30afea8
Refactor sign convention: store output sensor roles in data source at…
Copilot May 27, 2026
de9f1ed
Update get_schedule docstring and notation docs with sign convention …
Copilot May 27, 2026
f9f0d31
Move flag_modified import to top of file per PEP 8
Copilot May 27, 2026
d5521d4
Merge remote-tracking branch 'origin/main' into feat/sensor-in-db-fle…
Flix6x May 27, 2026
1cc12c1
Merge remote-tracking branch 'origin/feat/sensor-in-db-flex-model' in…
Flix6x May 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions documentation/api/change_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ v3.0-31 | 2026-05-20
- Added a unified job status endpoint ``GET /api/v3_0/jobs/<uuid>`` that returns the current execution status and a human-readable result message for any background job (scheduling, forecasting, etc.) identified by its UUID.
- Switched from ``force_new_job_creation`` to ``force-new-job-creation`` (maintaining backwards compatibility) and added the field to `/assets/(id)/schedules/trigger` (POST) endpoint, too.
- Support both snake_case and kebab-case fields in `/sensors/<id>/data` (GET), while only documenting the kebab-case ones.
- The ``consumption`` and ``production`` flex-model fields for the ``StorageScheduler`` now act as output sensors: the scheduler writes the resulting power schedule to those sensors, with unit conversion and resampling applied. When only one of the two is defined, the full power profile is written (sign-inverted for the production sensor). When both are defined, the schedule is split into its non-negative (consumption) and non-positive (production) parts.

v3.0-30 | 2026-04-15
""""""""""""""""""""
Expand Down
6 changes: 6 additions & 0 deletions documentation/api/notation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,9 @@ We'd recommend to use positive power values to indicate consumption and negative

Read more at :ref:`signs_of_power_beliefs` about our treatment of data, which includes data you send in, or you get from forecasts and schedules
(hint: you are free to define the sign for your data, but it might affect how you receive your schedules).

**Sign convention for schedules returned by get_schedule:**

- By default (and for the main power sensor), the ``get_schedule`` endpoint returns values in the **consumption-positive** convention: positive values denote consumption, negative values denote production.
- When retrieving a schedule from a dedicated **consumption** output sensor, values also follow the consumption-positive convention (positive = consumption, negative = production).
- When retrieving a schedule from a dedicated **production** output sensor, values follow the **production-positive** convention (positive = production, negative = consumption).
2 changes: 2 additions & 0 deletions documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ New features
* Improve UX after deleting a child asset through the UI [see `PR #2119 <https://www.github.com/FlexMeasures/flexmeasures/pull/2119>`_]
* Improve source filtering in the sensor data GET endpoint by exposing the documented query parameters in Swagger and allowing filtering by the account linked to data sources [see `PR #2083 <https://www.github.com/FlexMeasures/flexmeasures/pull/2083>`_ and `PR #2151 <https://www.github.com/FlexMeasures/flexmeasures/pull/2151>`_]
* Support sensor references for efficiency fields in storage flex-models [see `PR #2142 <https://www.github.com/FlexMeasures/flexmeasures/pull/2142>`_]
* Introduce the ``consumption`` and ``production`` flex-model fields for the ``StorageScheduler`` to save schedules to [see `PR #2190 <https://www.github.com/FlexMeasures/flexmeasures/pull/2190>`_]
* Added a unified job status endpoint ``GET /api/v3_0/jobs/<uuid>`` to retrieve the current execution status and result message for any background job [see `PR #2141 <https://www.github.com/FlexMeasures/flexmeasures/pull/2141>`_]
* New ``GET /api/v3_0/sources`` endpoint to list accessible data sources and defined types, with ``only_latest=true`` by default to return only the most recent version per source [see `PR #2126 <https://www.github.com/FlexMeasures/flexmeasures/pull/2126>`_]
* Add support for filtering sensor data GET requests by ``source-type`` on ``/api/v3_0/sensors/<id>/data`` [see `PR #2127 <https://www.github.com/FlexMeasures/flexmeasures/pull/2127>`_]
Expand Down Expand Up @@ -137,6 +138,7 @@ Bugfixes


v0.31.3 | April 11, 2026
============================

Bugfixes
-----------
Expand Down
8 changes: 7 additions & 1 deletion documentation/features/scheduling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,13 @@ For more details on the possible formats for field values, see :ref:`variable_qu

* - Field
- Example value
- Description
- Description
* - ``consumption``
- |CONSUMPTION.example|
- .. include:: ../_autodoc/CONSUMPTION.rst
* - ``production``
- |PRODUCTION.example|
- .. include:: ../_autodoc/PRODUCTION.rst
* - ``state-of-charge``
- |STATE_OF_CHARGE.example|
- .. include:: ../_autodoc/STATE_OF_CHARGE.rst
Expand Down
30 changes: 28 additions & 2 deletions flexmeasures/api/v3_0/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,15 +1139,28 @@ def get_schedule( # noqa: C901
description: Human-readable message about request processing.
examples:
schedule:
summary: Schedule response
summary: Schedule response (consumption sensor)
description: |
This message contains a schedule indicating to consume at various power
rates from 10am UTC onward for a duration of 45 minutes.
By default, values follow the **consumption-positive** convention:
positive values denote consumption; negative values denote production.
value:
values: [2.15, 3, 2]
start: "2015-06-02T10:00:00+00:00"
duration: "PT45M"
unit: "MW"
production_schedule:
summary: Schedule response (production output sensor)
description: |
When retrieving a schedule from a dedicated **production** output sensor,
values follow the **production-positive** convention:
positive values denote production; negative values denote consumption.
value:
values: [-2.15, -3, -2]
start: "2015-06-02T10:00:00+00:00"
duration: "PT45M"
unit: "MW"
400:
description: INVALID_TIMEZONE, INVALID_DOMAIN, UNKNOWN_SCHEDULE, UNRECOGNIZED_CONNECTION_GROUP
401:
Expand Down Expand Up @@ -1223,7 +1236,20 @@ def get_schedule( # noqa: C901
)

sign = 1
if sensor.measures_power and not sensor.get_attribute(
# Check data source config for dedicated output sensors
# (consumption/production output sensors already store values in their
# own sign convention and should not be flipped).
ds_config = (
(data_source.attributes or {}).get("data_generator", {}).get("config", {})
)
output_sensor_roles = ds_config.get("output_sensor_roles", {})
sensor_role = output_sensor_roles.get(str(sensor.id))

if sensor_role is not None:
# Dedicated output sensor — values are already stored in the correct
# convention (consumption-positive or production-positive), no flip.
sign = 1
elif sensor.measures_power and not sensor.get_attribute(
"consumption_is_positive", False
):
sign = -1
Expand Down
Loading
Loading