flexmeasures
flexmeasures copied to clipboard
Implement fallback attribute mechanism in the `flex-model` load step
The recently created QuantityOrSensor
Marshmallow class (https://github.com/FlexMeasures/flexmeasures/pull/897) allows defining a field with a Sensor or with a quantity. This enables the use of Sensors (time-varying data) or fixed values (quantities) for the inputs of the Scheduler.
If the value is not provided, we should (and we usually do) default to a fallback attribute that lives in the sensor or asset of the target device. This fallback mechanism should be built-in in the flex-model deserialization step. This class already has the sensor as its input and can be used in the load step.
Credits: https://github.com/FlexMeasures/flexmeasures/pull/909#issuecomment-1827755440
I like the idea to let the Marshmallow schema sort out where this comes from. Not 100% convinced yet, though.
This is relevant to discussion #990
The function get_continuous_time_series_from_quantity_or_sensor()
might give an indication on which fields to start with here.