Skip to content

Port G-1 reserves - #331

Merged
jd-lara merged 30 commits into
mainfrom
ac/g1-reserves-total
Oct 12, 2026
Merged

jd-lara merged 30 commits into
mainfrom
ac/g1-reserves-total

Conversation

@acostarelli

Copy link
Copy Markdown
Member

No description provided.

Anthony Costarelli added 27 commits September 28, 2026 14:04
… slacks keys need to be reconsidered I think
- consolidated expressions across area balance and ptdf
- dropped type aliases
- simplified template validation. i realize what i dont like is how
  template validation affects the program state, which is confusing. id
  rather just check for valid components when they are needed.
- uuid -> outage_id
- flatten tests for retest compatibility
-

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Unresolved construction, export, validation, serialization, compatibility, and test issues remain.

Review effort: Lite
Findings: 5 High severity · 3 Medium severity

Open (8)
What changed in this PR

Ports G-1 security-constrained reserve formulations with post-contingency deployment, balance, flow constraints, validation, and tests.

Changes:

  • Adds G-1 formulations, variables, expressions, and constraints.
  • Integrates reserve construction and outage validation.
  • Updates tests, exports, compatibility, and solve behavior.
File Description
test/​test_static_injection_security_constrained_models.jl Adds G-1 integration tests.
src/​services_models/​services_constructor.jl Constructs G-1 reserve services.
src/​services_models/​security_constrained_injectors.jl Implements contingency deployment and flow logic.
src/​services_models/​reserves.jl Adds reserve time-series defaults.
src/​PowerOperationsModels.jl Registers and exports new APIs.
src/​operation/​template_validation.jl Validates transformer outages.
src/​operation/​decision_model.jl Changes system output handling.
src/​core/​variables.jl Adds post-contingency variables.
src/​core/​formulations.jl Defines G-1 formulations.
src/​core/​expressions.jl Adds deployment expressions.
src/​core/​constraints.jl Adds G-1 constraints.
Project.toml Updates PowerFlows compatibility.
.claude/​pom_port_plan.md Removes the porting plan.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/operation/decision_model.jl Outdated
Comment on lines +234 to +236
# TODO: re-enable before merging, once PSY.to_file is fixed.
#!ispath(sys_dir) &&
# PSY.to_file(sys, sys_dir; power_units = :component_base)
Comment on lines +67 to +69
for generator in
PSY.get_associated_components(sys, outage; component_type = PSY.Generator)
T = typeof(generator)
Comment on lines +44 to +49
function seed_reserve_range_expressions!(
container::OptimizationContainer,
sys::PSY.System,
model::ServiceModel{S, <:AbstractReservesFormulation},
devices_template::DevicesModelContainer,
) where {S <: PSY.AbstractReserve}
Comment on lines +61 to +64
_seed_range_expression!(
container,
sys,
get_expression_type_for_reserve(ActivePowerReserveVariable, device_type, S),
outaged = Set(
(typeof(g), PSY.get_name(g), uuid) for (uuid, o) in uuids for g in _outaged(sys, o)
)
@test !any(((D, _, _, d, uuid, _),) -> (D, d, uuid) in outaged, keys(deployments))
Comment thread src/PowerOperationsModels.jl Outdated
Comment thread src/operation/template_validation.jl Outdated
Comment on lines +537 to +538
model = get(branch_models, nameof(T), nothing)
_has_unsupported_phase(transformer, model) && throw(
Comment on lines +1124 to +1128
_is_procured(
model::ServiceModel{<:PSY.AbstractReserve, F},
service::PSY.AbstractReserve,
) where {F <: AbstractSecurityConstrainedReservesFormulation} =
_is_ramp_formulation(F) || _has_ts_requirement(model, service)
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Performance Results

Version Precompile Time
Main 2.920518943
This Branch 2.873101196
Version Build Time
Main-Build Time Precompile 86.110156408
Main-Build Time Postcompile 1.195689066
This Branch-Build Time Precompile 88.289935148
This Branch-Build Time Postcompile 1.161397458
Version Solve Time
Main-Solve Time Precompile 117.577258817
Main-Solve Time Postcompile 86.884311842
This Branch-Solve Time Precompile 603.730068663
This Branch-Solve Time Postcompile 555.392898088

jd-lara and others added 3 commits September 28, 2026 13:52
Scope the security-constrained reserve formulations to
OnlineReserve{ReserveUp}. Remove the offline-reserve paths and the
use_slacks agreement check, which one service model type cannot reach.

Add a template validation gate for the supported networks, reserve
types, and contributor types. Gate post-contingency deployment on the
commitment status and the time-step availability. Support storage
contributors. Under AreaPTDF, carry the PTDF flow change over the AC
tie lines of each monitored interchange.

Restore Project.toml, decision_model.jl, template_validation.jl, and
pom_port_plan.md to main. Fix the undefined exports and the method
ambiguity that Aqua reported.
@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.72650% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../services_models/security_constrained_injectors.jl 97.42% 10 Missing ⚠️
src/operation/template_validation.jl 83.33% 5 Missing ⚠️
src/services_models/services_constructor.jl 93.61% 3 Missing ⚠️
src/core/variables.jl 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@jd-lara
jd-lara merged commit 2d108dd into main Oct 12, 2026
8 checks passed
@jd-lara
jd-lara deleted the ac/g1-reserves-total branch October 12, 2026 03:51
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.

4 participants