Support multiple group reserve services and add tests#1607
Open
ChenHaotianC wants to merge 2 commits into
Open
Support multiple group reserve services and add tests#1607ChenHaotianC wants to merge 2 commits into
ChenHaotianC wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the service construction pipeline to support multiple GroupReserve service models within the same ProblemTemplate/model build, and adds a regression test to ensure multiple reserve groups produce distinct requirement constraints.
Changes:
- Update
construct_services!to defer allGroupReserveservice models (not just one) until the end of service construction. - Add a new test that builds a model with two
ConstantReserveGroupservices and verifies each group’s requirement constraint RHS. - Change contributing-device population behavior for empty mappings from
errorto@warn+continue.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/services_models/services_constructor.jl |
Collect and construct multiple GroupReserve services at the end of service construction. |
test/test_services_constructor.jl |
Add test coverage for multiple ConstantReserveGroup constraints with different requirements. |
src/services_models/reserves.jl |
Alters NonSpinning reserve logic by switching from time_limits.up to time_limits.down (appears incorrect). |
src/operation/problem_template.jl |
Downgrade empty contributing-device mapping from hard error to warning/skip. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+26
to
31
| groupservices = Any[] | ||
|
|
||
| for (key, service_model) in services_template | ||
| if get_formulation(service_model) === GroupReserve # group service needs to be constructed last | ||
| groupservice = key | ||
| if get_formulation(service_model) === GroupReserve # group service needs to be constructed last | ||
| push!(groupservices, key) | ||
| continue |
Comment on lines
+69
to
73
| groupservices = Any[] | ||
| for (key, service_model) in services_template | ||
| if get_formulation(service_model) === GroupReserve # group service needs to be constructed last | ||
| groupservice = key | ||
| if get_formulation(service_model) === GroupReserve # group service needs to be constructed last | ||
| push!(groupservices, key) | ||
| continue |
Comment on lines
483
to
488
| component_type = typeof(d) | ||
| name = PSY.get_name(d) | ||
| varstatus = get_variable(container, OnVariable(), component_type) | ||
| startup_time = PSY.get_time_limits(d).up | ||
| startup_time = PSY.get_time_limits(d).down | ||
| ramp_limits = _get_ramp_limits(d) | ||
| if reserve_response_time > startup_time |
| error( | ||
| "The contributing devices for service $(PSY.get_name(service)) is empty. Add contributing devices to the service in the data to continue.", | ||
| ) | ||
| @warn "The contributing devices for service $(PSY.get_name(service)) is empty, consider removing the service from the system" _group = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for multiple GroupReserve services in the same model and includes tests for the updated behavior.