You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document modelling choice for storing source types under one or multiple sensors (#2217)
* docs: move subsection on signs of power beliefs to live under Beliefs rather than under Annotations
Signed-off-by: F.N. Claessen <claessen@seita.nl>
* docs: add (cross-referenced) section for guidance on when to record data on one sensor or separate sensors
Signed-off-by: F.N. Claessen <claessen@seita.nl>
* docs: changelog entry
Signed-off-by: F.N. Claessen <claessen@seita.nl>
---------
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com>
* Prepare the ``device_scheduler`` to deal with commitments per device group [see `PR #1934 <https://www.github.com/FlexMeasures/flexmeasures/pull/1934>`_]
20
+
* Documentation section on the modelling choice for recording measurements, forecasts and schedules under one or multiple sensors [see `PR #2217 <https://www.github.com/FlexMeasures/flexmeasures/pull/2217>`_]
Copy file name to clipboardExpand all lines: documentation/concepts/data-model.rst
+65-40Lines changed: 65 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,10 +94,74 @@ when they said so and how certain they were.
94
94
95
95
Each belief links to a sensor and a data source. Here are two examples:
96
96
97
-
98
97
- The power sensor of a battery, where we store the schedules, can have two sources: (1) the schedule itself (a data source of type "scheduler", representing how FlexMeasures created this data) and (2) the realized schedule, i.e. the measurements of how the battery responded (or not) to the schedule. The latter might have a data source of type "user" (who sent the measurements to FlexMeasures).
99
98
- A thermal demand sensor containing forecasts (data source of type "forecast", e.g. heating usage forecast sent to FlexMeasures or made by FlexMeasures) and measurements (sent into FlexMeasures, data source type "user").
100
99
100
+
See also :ref:`one_or_multiple_sensors` for guidance on when such beliefs are best recorded on one shared sensor and when separate sensors are preferable.
101
+
102
+
103
+
.. _signs_of_power_beliefs:
104
+
105
+
About signs of power & energy values
106
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107
+
In short: You can use any sign you want for power data.
108
+
What is recorded in the database is exactly as seen in UI charts.
109
+
But the scheduler in FlexMeasures needs to know how to apply the signs.
110
+
Let us explain.
111
+
112
+
When beliefs are about power or energy, the sign of the value is important. It indicates whether the asset is consuming or producing.
113
+
However, there is no universal standard for this. Some systems use positive values for production and negative values for consumption, while others do the opposite.
114
+
115
+
FlexMeasures doesn't enforce any perspective (we have a design philosophy of letting users model the system in their own way).
116
+
117
+
For example, users can create PV power data with positive values indicating production, and they can also create building power data with positive values indicating consumption.
118
+
We allow this because we want the UI to match what is in the database, and users often desire both of these datasets to be shown as positive values.
119
+
We assume that this is what users send in.
120
+
121
+
Note that, if forecasts are created, they will have the same sign as the original data.
122
+
123
+
For schedules, the sign of the power schedule (as :ref:`beliefs <beliefs>`) recorded in the database, and as seen in UI charts, is determined as follows:
124
+
125
+
- If the flex-model contains the ``sensor`` field, and that sensor has power units (e.g. kW), the ``"consumption_is_positive"`` attribute of the sensor is used to decide the sign of the recorded data.
126
+
If `True`, consumption will be saved as positive, otherwise not. To clarify:
127
+
- If the attribute is not defined, **by default, scheduled power is recorded with production as positive values** (and consumption as negative values).
128
+
- To record scheduled power data with consumption as positive values, set ``sensor.attributes["consumption_is_positive"] = True``.
129
+
- To record scheduled power data with production as positive values (already the default, but this makes it explicit), set ``sensor.attributes["consumption_is_positive"] = False``.
130
+
- If the flex-model contains the ``consumption`` field, scheduled power is recorded with consumption as positive values.
131
+
The ``"consumption_is_positive"`` attribute of the referenced sensor is set automatically to ``True``.
132
+
- If the flex-model contains the ``production`` field, scheduled power is recorded with production as positive values.
133
+
The ``"consumption_is_positive"`` attribute of the referenced sensor is set automatically to ``False``.
134
+
135
+
For guidance on when schedules should share a power sensor with measurements and forecasts, and when dedicated output sensors are preferable, see :ref:`one_or_multiple_sensors`.
136
+
137
+
The ``GET /api/v3_0/sensors/<id>/schedules/<uuid>`` endpoint supports three sign conventions via the ``sign-convention`` query parameter:
138
+
139
+
- ``consumption-positive`` (default): schedules are always returned with consumption as positive values and production as negative values.
140
+
- ``production-positive``: schedules are returned with production as positive values and consumption as negative values.
141
+
- ``wysiwyg`` (*what-you-see-is-what-you-get*): schedules are returned with the same sign as database values and as seen in the UI charts, indicating exactly what the scheduler stored.
142
+
143
+
144
+
.. _one_or_multiple_sensors:
145
+
146
+
147
+
Modeling measurements, forecasts and schedules on one or multiple sensors
A common modeling choice is whether measurements, forecasts and schedules for an asset should all be recorded on a single power sensor, or on separate sensors.
151
+
152
+
Using a single sensor is advisable when these data represent different beliefs about the same physical quantity at the same connection point.
153
+
In that case, keeping them on one sensor makes it explicit that measurements, forecasts and schedules all refer to the same events, and therefore should share the same unit, event resolution and sign convention.
154
+
Different origins of the data can still be distinguished through their data source.
155
+
156
+
Using separate sensors is advisable when scheduled power should be modeled separately from measured or forecast power.
157
+
This can be useful when you want to avoid filtering by source in queries, when schedules should use a different sign convention, when they should be stored at a different resolution, or when the scheduled quantity has a different operational meaning from the measured quantity.
158
+
159
+
For storage scheduling, the ``consumption`` and ``production`` flex-model fields support this second approach by letting FlexMeasures write schedules to dedicated output sensors.
160
+
If both are defined, the scheduled power is split into its consumption and production parts.
161
+
If only one is defined, the full schedule is written to that sensor using the sign convention implied by that field.
162
+
163
+
In short: use one sensor when you want multiple sources to express beliefs about the same underlying events; use separate sensors when you want cleaner operational separation between measured, forecast and scheduled data.
164
+
101
165
102
166
Annotations
103
167
-----------
@@ -152,45 +216,6 @@ Annotations appear in:
152
216
More information, including code examples, is available in :ref:`annotations`.
153
217
154
218
155
-
.. _signs_of_power_beliefs:
156
-
157
-
About signs of power & energy values
158
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
159
-
In short: You can use any sign you want for power data.
160
-
What is recorded in the database is exactly as seen in UI charts.
161
-
But the scheduler in FlexMeasures needs to know how to apply the signs.
162
-
Let us explain.
163
-
164
-
When beliefs are about power or energy, the sign of the value is important. It indicates whether the asset is consuming or producing.
165
-
However, there is no universal standard for this. Some systems use positive values for production and negative values for consumption, while others do the opposite.
166
-
167
-
FlexMeasures doesn't enforce any perspective (we have a design philosophy of letting users model the system in their own way).
168
-
169
-
For example, users can create PV power data with positive values indicating production, and they can also create building power data with positive values indicating consumption.
170
-
We allow this because we want the UI to match what is in the database, and users often desire both of these datasets to be shown as positive values.
171
-
We assume that this is what users send in.
172
-
173
-
Note that, if forecasts are created, they will have the same sign as the original data.
174
-
175
-
For schedules, the sign of the power schedule (as :ref:`beliefs <beliefs>`) recorded in the database, and as seen in UI charts, is determined as follows:
176
-
177
-
- If the flex-model contains the ``sensor`` field, and that sensor has power units (e.g. kW), the ``"consumption_is_positive"`` attribute of the sensor is used to decide the sign of the recorded data.
178
-
If `True`, consumption will be saved as positive, otherwise not. To clarify:
179
-
- If the attribute is not defined, **by default, scheduled power is recorded with production as positive values** (and consumption as negative values).
180
-
- To record scheduled power data with consumption as positive values, set ``sensor.attributes["consumption_is_positive"] = True``.
181
-
- To record scheduled power data with production as positive values (already the default, but this makes it explicit), set ``sensor.attributes["consumption_is_positive"] = False``.
182
-
- If the flex-model contains the ``consumption`` field, scheduled power is recorded with consumption as positive values.
183
-
The ``"consumption_is_positive"`` attribute of the referenced sensor is set automatically to ``True``.
184
-
- If the flex-model contains the ``production`` field, scheduled power is recorded with production as positive values.
185
-
The ``"consumption_is_positive"`` attribute of the referenced sensor is set automatically to ``False``.
186
-
187
-
The ``GET /api/v3_0/sensors/<id>/schedules/<uuid>`` endpoint supports three sign conventions via the ``sign-convention`` query parameter:
188
-
189
-
- ``consumption-positive`` (default): schedules are always returned with consumption as positive values and production as negative values.
190
-
- ``production-positive``: schedules are returned with production as positive values and consumption as negative values.
191
-
- ``wysiwyg`` (*what-you-see-is-what-you-get*): schedules are returned with the same sign as database values and as seen in the UI charts, indicating exactly what the scheduler stored.
0 commit comments