flexmeasures icon indicating copy to clipboard operation
flexmeasures copied to clipboard

Implement fallback attribute mechanism in the `flex-model` load step

Open victorgarcia98 opened this issue 7 months ago • 1 comments

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

victorgarcia98 avatar Nov 27 '23 16:11 victorgarcia98

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.

nhoening avatar Mar 28 '24 16:03 nhoening