Skip to content

Support multiple group reserve services and add tests#1607

Open
ChenHaotianC wants to merge 2 commits into
Sienna-Platform:mainfrom
ChenHaotianC:hc_group_service
Open

Support multiple group reserve services and add tests#1607
ChenHaotianC wants to merge 2 commits into
Sienna-Platform:mainfrom
ChenHaotianC:hc_group_service

Conversation

@ChenHaotianC
Copy link
Copy Markdown
Contributor

Adds support for multiple GroupReserve services in the same model and includes tests for the updated behavior.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 all GroupReserve service models (not just one) until the end of service construction.
  • Add a new test that builds a model with two ConstantReserveGroup services and verifies each group’s requirement constraint RHS.
  • Change contributing-device population behavior for empty mappings from error to @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 =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants