Skip to content

Reparent network formulation hierarchy onto IOM.AbstractNetworkModel#173

Closed
luke-kiernan wants to merge 2 commits into
mainfrom
lk/fix-iom-network-vocabulary-neutralization
Closed

Reparent network formulation hierarchy onto IOM.AbstractNetworkModel#173
luke-kiernan wants to merge 2 commits into
mainfrom
lk/fix-iom-network-vocabulary-neutralization

Conversation

@luke-kiernan

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes the CI precompile failure on main (run): TypeError: in NetworkModel, in T, expected T<:InfrastructureOptimizationModels.AbstractNetworkModel, got Type{PowerOperationsModels.AreaPTDFPowerModel}.
  • Root cause: IOM's main branch landed ADR 0001 "IOM network vocabulary neutralization", moving NetworkModel{T}'s bound off IS.Optimization.AbstractPowerModel onto a new IOM-owned AbstractNetworkModel, and renaming the NetworkModel matrix fields/getters PTDF_matrix/MODF_matrixnetwork_matrix/contingency_matrix. POM (pinned to IOM main per [sources]) hadn't been updated to match.
  • Reparents the embedded PowerModels submodule's AbstractPowerModel/AbstractActivePowerModel/AbstractACPModel hierarchy (and transitively every concrete network formulation: DCPPowerModel, ACPPowerModel, PTDFPowerModel, AreaPTDFPowerModel, CopperPlatePowerModel, AreaBalancePowerModel, …) onto IOM.AbstractNetworkModel instead of IS.Optimization.AbstractPowerModel.
  • Renames PTDF_matrix/MODF_matrix (kwargs, field accesses, getters) to network_matrix/contingency_matrix throughout src/, ext/, and test/ to match IOM's renamed NetworkModel API.

Test plan

  • julia --project=test -e 'using PowerOperationsModels' precompiles cleanly (previously failed with the TypeError above).
  • julia --project=test -e 'using PowerFlows; using PowerOperationsModels'PowerFlowsExt also precompiles cleanly (it hit the same error in CI).
  • Formatter run (no diffs).
  • julia --project=test test/runtests.jl test_network_constructors test_device_hvdc test_parallel_branch_parameter_multipliers — 4237/4237 pass on this branch.
  • Also validated a superset of network-model-touching test files (test_static_injection_security_constrained_models, test_device_branch_constructors, test_ac_transmission_security_constrained_models, test_network_constructors_with_branch_rating_time_series, test_postcontingency_mixed_outage_axes, test_model_decision) on a working branch with the same fix — all pass, aside from one pre-existing, unrelated HydroReservoir/LinearCurve→FunctionData failure in test_model_decision.jl that's also present in the main CI run and stems from PowerSystems/PowerSystemCaseBuilder test-data generation, not this change.

Note: the PowerSystemCaseBuilder CaseData artifact-download failure visible in the linked CI run (404 / hash mismatch) is a separate, transient CI-infra issue unrelated to this fix — the artifact is already cached locally and unaffected.

🤖 Generated with Claude Code

IOM's ADR 0001 ("IOM network vocabulary neutralization") moved NetworkModel{T}'s
bound off IS.Optimization.AbstractPowerModel and onto a new, IOM-owned
AbstractNetworkModel, and renamed the NetworkModel matrix fields/getters
PTDF_matrix/MODF_matrix -> network_matrix/contingency_matrix. POM hadn't been
updated to match, so precompilation failed with a TypeError wherever a concrete
network formulation (e.g. NetworkModel{AreaPTDFPowerModel}) was written as a
type-parameter application, since none of POM's formulation-marker types
reached IOM.AbstractNetworkModel.

Reparent the embedded PowerModels submodule's AbstractPowerModel /
AbstractActivePowerModel / AbstractACPModel hierarchy onto
IOM.AbstractNetworkModel instead of IS.Optimization.AbstractPowerModel, and
rename PTDF_matrix/MODF_matrix (kwargs, field accesses, getters) to
network_matrix/contingency_matrix throughout src/, ext/, and test/ to match
IOM's renamed NetworkModel API.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

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.

Pull request overview

This PR updates PowerOperationsModels.jl to match InfrastructureOptimizationModels (IOM) ADR 0001 by (1) re-rooting the embedded PowerModels formulation-marker hierarchy under IOM.AbstractNetworkModel and (2) renaming the NetworkModel matrix API from PTDF_matrix/MODF_matrix to network_matrix/contingency_matrix, fixing a precompile failure on main.

Changes:

  • Reparented the embedded PowerModels AbstractPowerModel hierarchy onto InfrastructureOptimizationModels.AbstractNetworkModel.
  • Renamed PTDF/MODF matrix kwargs/getters/field accesses to network_matrix / contingency_matrix across src/ and tests.
  • Updated network instantiation and security-constrained logic to use the renamed matrix getters.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/test_power_flow_in_the_loop.jl Updates NetworkModel construction to pass network_matrix instead of PTDF_matrix.
test/test_postcontingency_mixed_outage_axes.jl Uses contingency_matrix instead of MODF_matrix for post-contingency tests.
test/test_parallel_branch_parameter_multipliers.jl Renames PTDF kwarg to network_matrix in template construction.
test/test_network_constructors.jl Renames PTDF_matrix kwarg to network_matrix in constructor test.
test/test_network_constructors_with_branch_rating_time_series.jl Renames PTDF kwarg occurrences (and commented examples) to network_matrix.
test/test_model_decision.jl Renames PTDF kwarg uses to network_matrix in decision-model tests.
test/test_device_hvdc.jl Renames PTDF kwarg use to network_matrix in HVDC-related tests.
test/test_device_branch_constructors.jl Renames PTDF getter usage to get_network_matrix and PTDF kwarg uses to network_matrix.
test/test_ac_transmission_security_constrained_models.jl Renames PTDF/MODF kwarg + getter usage to network_matrix/contingency_matrix across SC tests.
src/utils/print.jl Uses get_network_matrix in the network-model summary display.
src/twoterminal_hvdc_models/AC_branches.jl Switches PTDF getter usage to get_network_matrix.
src/PowerOperationsModels.jl Imports embedded AbstractPowerModel (now rooted on IOM) instead of importing it from IS.Optimization.
src/PowerModels/PowerModels.jl Defines AbstractPowerModel hierarchy as subtypes of IOM.AbstractNetworkModel.
src/network_models/instantiate_network_model.jl Replaces PTDF/MODF field/getter usage with network_matrix/contingency_matrix throughout instantiation and reconciliation logic.
src/initial_conditions/initialization.jl Uses network_matrix/contingency_matrix when building the initial-conditions template network model.
src/ac_transmission_models/security_constrained_branch.jl Switches MODF getter usage to get_contingency_matrix.
src/ac_transmission_models/AC_branches.jl Switches PTDF getter usage to get_network_matrix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/initial_conditions/initialization.jl Outdated
Address CoPilot review feedback on #173: the comment above the
contingency_matrix kwarg still referred to the old "MODF" field name.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@acostarelli

Copy link
Copy Markdown
Member

I think I'm still bothered by NetworkModel's having "network" and "outage" matrices because these are things only the PTDF models need right? And I don't know if other infrastructure systems would need the same matrices. In other words, it still feels not only power-specific but PTDF-model power-specific.

I still feel like I want these to live in POM even if it breaks some code symmetry. Maybe the type that parameterizes the network model carries the information about what, if any matrices, need to exist?

@jd-lara jd-lara left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We probably want to have some container for matrices or additional info but that's something we should rework once the whole solution with POM is in a better place with tests and coverage

@jd-lara

jd-lara commented Jul 12, 2026

Copy link
Copy Markdown
Member

This PR should be merged after finishing #155

@jd-lara

jd-lara commented Jul 13, 2026

Copy link
Copy Markdown
Member

closed in favor of #177

@jd-lara jd-lara closed this Jul 13, 2026
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