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
feat(scheduling): Add multiple maxima and minima constraints into StorageScheduler
#680
Conversation
…lable. 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>
style: rename build_device_soc_targets to build_device_soc_values Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
StorageScheduler
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.
Nice feature. Here are some comments from a code read. I still need to think a bit about whether we are now covering our intended use case from Issue #575.
What happens if a target exceeds the maxima (to such an extent that maxima may have to be ignored even a couple of time steps before the target)? Is it the client's responsibility to present a solvable problem?
Good question! This could happen the same for the minima, were the user could raise the minima with a low target after it. I'm not sure it will lead to an unfeasible problem as the It would be a problem if there were more than one of the constraints (target, maxima and minima) defined in the same time slot, being incompatible i.e not fulfilling the condition Off topicI think we should include the resolution into the calculations of device_constraints[0]["derivative min"] = (
sensor.get_attribute("capacity_in_mw") * -1 * ( resolution / timedelta(hours=1))
) That way, If the storage has a limit of 1MW -> 1MWh in 1 hour is equivalent to a limit 250kWh in 15min. |
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>
Upon further reflection, I believe this PR does in fact resolve #575, by implementing the first approach suggested there. We should still add documentation:
One more thing: we should be able to raise informative validation errors by checking feasibility of constraints over consecutive time steps. For example: Can you open a new issue or discussion for the off-topic comment? I'll add my thoughts there. |
…use soc_minima 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>
* style: sphinx docstrings Signed-off-by: F.N. Claessen <felix@seita.nl> * style: more detailed type annotation Signed-off-by: F.N. Claessen <felix@seita.nl> * style: consistency Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: incomplete type annotation Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: validation A.1) Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: Validation B.2) Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: Validation C.1) Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: Validation C.3) Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: Validation C.4) Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: move statements to where they matter Signed-off-by: F.N. Claessen <felix@seita.nl> * style: consistency (also: https://books.google.com/ngrams/graph?content=infeasible%2Cunfeasible&year_start=1800&year_end=2019&corpus=en-2019&smoothing=0&case_insensitive=true ) Signed-off-by: F.N. Claessen <felix@seita.nl> * style: Validation B.2) Signed-off-by: F.N. Claessen <felix@seita.nl> --------- Signed-off-by: F.N. Claessen <felix@seita.nl>
* style: sphinx docstrings Signed-off-by: F.N. Claessen <felix@seita.nl> * style: more detailed type annotation Signed-off-by: F.N. Claessen <felix@seita.nl> * style: consistency Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: incomplete type annotation Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: validation A.1) Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: Validation B.2) Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: Validation C.1) Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: Validation C.3) Signed-off-by: F.N. Claessen <felix@seita.nl> * fix: Validation C.4) Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: move statements to where they matter Signed-off-by: F.N. Claessen <felix@seita.nl> * style: consistency (also: https://books.google.com/ngrams/graph?content=infeasible%2Cunfeasible&year_start=1800&year_end=2019&corpus=en-2019&smoothing=0&case_insensitive=true ) Signed-off-by: F.N. Claessen <felix@seita.nl> * style: Validation B.2) Signed-off-by: F.N. Claessen <felix@seita.nl> * refactor: Constraint validation for cases A and B Signed-off-by: F.N. Claessen <felix@seita.nl> * style: fixing typos Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * fix: add comments clarifying why we need to sort the `{equals, max, min}_extended` series Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * refactor: create storage_device_constraints inside of add_storage_constraints Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * reactor: max_soc -> soc_max Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * reactor: min_soc -> soc_min Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * feat: update validate_constraint to accept arbitrary constraint expressions Signed-off-by: Victor Garcia Reolid <victor@seita.nl> * style: fixing some refactor that affected the comments Signed-off-by: Victor Garcia Reolid <victor@seita.nl> --------- Signed-off-by: F.N. Claessen <felix@seita.nl> Signed-off-by: Victor Garcia Reolid <victor@seita.nl> Co-authored-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.
Pretty amazing stuff you did with the constraint validation! 😎
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor <victor@seita.nl>
Actually, note to self: we still need to update the API changelog. |
This PR allows to set multiple maxima and minima SOC values as timeseries. These parameters can be passed into
StorageScheduler
inflex-model
.Closes #575.
Applications:
soc-max
andsoc-min
users can define a global maximum and minimum, respected during the whole scheduling period. I think of these two values as hard limits.soc-minima
, users can define what is calledsoc-max-preference
in Issue Handle SoC targets that exceed the maximum SoC #575.soc-maxima
can be used to apply hourly restrictions in congested hours.Please, let me know your thoughts on this new feature.