New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add (device) consumption and production capacities as sensors #897
add (device) consumption and production capacities as sensors #897
Conversation
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand what the alias
concept is for yet. Could you give one or two examples of how you'd intend to use it?
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Sure. In short the alias is a protected name which means that users should not be able to edit it. Even though the name cannot be changed via the UI yet (as far as I know), It will probably be something we want to implement. If we rely on the name for internal mechanisms the process might fail in case the name is changed. Some examples:
An alternative would be to define which sensor represents what as a the asset attribute. Other reasons to have this alias is to standarize operations. Let's say we want to set up 100 sites. In that case, we might use a format for the sensor names, for example: |
Then technically the alias isn't required for this PR, right? This is about allowing API users to pass a sensor ID rather than a float. My line of thinking is the following. Right now, we support:
After this PR, this would become a viable alternative:
The title of this PR suggests it tackles a second feature at the same time (separate device power capacities for consumption and production), which is fine. My line of thinking would be to keep the API fields as consistent as possible, by introducing the
In this example, the consumption capacity is a constant value, while the production capacity changes over time, as recorded in sensor 51. |
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
You're absolutely right, the I've created a new Schema for what I call a On the side, I've created the utility function This feature is tested in |
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
flexmeasures/data/migrations/versions/28826e323c7c_add_alias_column_to_the_sensor_table.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Just an update: I'm refactoring this work slightly and will create a PR to merge into this branch any day now. |
* refactor: fix spelling Signed-off-by: F.N. Claessen <felix@seita.nl> * style: missing type annotation Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: method and variable renaming Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: add test case explanations Signed-off-by: F.N. Claessen <felix@seita.nl> --------- Signed-off-by: F.N. Claessen <felix@seita.nl>
* refactor: fix spelling Signed-off-by: F.N. Claessen <felix@seita.nl> * style: missing type annotation Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: method and variable renaming Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: add test case explanations Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: separate logic for falling back on a default attribute and applying a maximum capacity limit Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: fill gaps in capacity sensor data using the max_value rather than with the fallback Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: type annotation (see https://docs.python.org/3/library/typing.html#typing.Optional) Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: clearly separate steps of falling back and performing a nanmin Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: simplify and have get_quantity_from_attribute return a Quantity, as its name already suggested Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: switch argument order Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: update docstring Signed-off-by: F.N. Claessen <felix@seita.nl> * style: flake8 Signed-off-by: F.N. Claessen <felix@seita.nl> --------- Signed-off-by: F.N. Claessen <felix@seita.nl>
Looks like this is almost ready to ship out. Can you resolve the merge conflict, add a changelog item, and create tickets for your suggested follow-ups? |
…ery-power-capacity-as-sensor Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Thanks! I've resolved the merge conflict added the changelog entry and created the tickets. |
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A side question: These capacity fields are not supported in flexmeasures add schedule for-storage
, right? Should this be a new issue?
Yes, new issue please. We want to make headway with the API first. |
Description
This PR introduces the capability of defining device-level power constraints as time series.
This sensors can be passed through the flex-model and the scheduler will look into the sensors belonging to the device (sensors of the same asset) and look for sensors with some alias.
To support this, this PR introduces the concept of sensor
alias
, a new column of thesensor
table that serves as an internal reference for sensors. Using the name would have been a good alternative but the user could change it, the idea is that the alias is not touched by the user.Further Improvements
Related Items
Closes #761