Feat/efficiencyfield support sensor - #2142
Conversation
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Documentation build overview
3 files changed± changelog.html± _autosummary/flexmeasures.data.schemas.scheduling.storage.html± api/v3_0.html |
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR extends the storage flex-model configuration (UI + schema/OpenAPI) to allow efficiency fields to be set via sensor references (dynamic signals), aligning with issue #2123.
Changes:
- Update flex-model schema metadata and UI typing to treat efficiency fields as variable quantities (fixed value or sensor reference).
- Refactor
EfficiencyFieldto support sensor references and add/extend schema validation tests for efficiency sensors. - Regenerate/update OpenAPI specs and add a changelog entry documenting the feature.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| flexmeasures/ui/templates/assets/asset_properties.html | Removes typeFive handling so UI backend-types map cleanly to remaining type categories (enabling sensor tab for efficiency fields). |
| flexmeasures/ui/static/openapi-specs.json | Updates OpenAPI schema for roundtrip-efficiency to use VariableQuantityOpenAPI, but also includes an unintended info.version regression. |
| flexmeasures/data/schemas/tests/test_scheduling.py | Adds DB flex-model schema tests for efficiency sensor references and unit convertibility checks. |
| flexmeasures/data/schemas/scheduling/storage.py | Changes EfficiencyField to a VariableQuantityField (sensor-capable), but introduces downstream/runtime + doctest issues. |
| flexmeasures/data/schemas/scheduling/init.py | Changes efficiency fields’ metadata to “fixed or sensor” in the flex-model schema exposed to the UI. |
| documentation/changelog.rst | Adds a changelog bullet for efficiency sensor references in storage flex-models. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
…just related schema fields Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Agent-Logs-Url: https://github.com/FlexMeasures/flexmeasures/sessions/78236b92-a722-4d40-b912-cae162ad3db4 Co-authored-by: joshuaunity <45713692+joshuaunity@users.noreply.github.com>
There was a problem hiding this comment.
It seems to work well (I tested the flex-model dialogue for a bit).
Two smaller comments from my side that can be fixed easily by @joshuaunity .
I am not sure if @Flix6x wants to see this, as well.
There is a comment in the issue about testing if the feature set between UI and schema diverges, but it is not specified well yet, and does not need to be part of this PR IMO.
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…Measures/flexmeasures into feat/efficiencyfield-support-sensor
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Flix6x
left a comment
There was a problem hiding this comment.
Nice to see this PR. I think copilot's review deserves another look. I think it correctly flagged that the roundtrip-efficiency field is problematic. Imo it should simply be reverted.
For the storage-efficiency field, the sensor reference is also not without issue, because we are still lacking logic to resample the efficiency from the sensor resolution to the scheduling resolution. I think we should add something of a warning in the UI (info marker?) when the user is about to select (and/or has selected) a sensor for the storage-efficiency. Not sure what a good text is yet. I do like that this field can now be a sensor, too, though!
I can do that. |
@Flix6x what do you think? |
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Nailed it! 👌 |
Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
|
@nhoening, this can be merged if there are no more requests. |
|
@Flix6x do you approve? |
Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
Flix6x
left a comment
There was a problem hiding this comment.
No! Please address my review comments, and not just click resolve.
|
Please do not prompt me for a review again before commenting on each of my review comments. |
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
|
Looking at this, the |
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
|
@Flix6x, I've looked over the comments and attended to them. |
Flix6x
left a comment
There was a problem hiding this comment.
Great. I only have tiny requests to finish up the PR.
| ) | ||
|
|
||
| storage_efficiency = EfficiencyField( | ||
| storage_efficiency = VariableQuantityField( |
There was a problem hiding this comment.
Is there no associated change to the openapi-specs.json?
There was a problem hiding this comment.
No, I don't think they should, as the flex-config schema isn't directly placed on the API's themselves, rather they are used under the hood.
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>

Description
This PR extends the support for efficiency-based sensors on the flex-model efficiency fields.
Look & Feel
Before

After

How to test
Further Improvements
None
Related Items
This PR closes #2123
Sign-off