Reparent network formulation hierarchy onto IOM.AbstractNetworkModel#173
Reparent network formulation hierarchy onto IOM.AbstractNetworkModel#173luke-kiernan wants to merge 2 commits into
Conversation
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>
There was a problem hiding this comment.
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
AbstractPowerModelhierarchy ontoInfrastructureOptimizationModels.AbstractNetworkModel. - Renamed PTDF/MODF matrix kwargs/getters/field accesses to
network_matrix/contingency_matrixacrosssrc/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.
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>
|
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
left a comment
There was a problem hiding this comment.
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
|
This PR should be merged after finishing #155 |
|
closed in favor of #177 |
Summary
main(run):TypeError: in NetworkModel, in T, expected T<:InfrastructureOptimizationModels.AbstractNetworkModel, got Type{PowerOperationsModels.AreaPTDFPowerModel}.mainbranch landed ADR 0001 "IOM network vocabulary neutralization", movingNetworkModel{T}'s bound offIS.Optimization.AbstractPowerModelonto a new IOM-ownedAbstractNetworkModel, and renaming theNetworkModelmatrix fields/gettersPTDF_matrix/MODF_matrix→network_matrix/contingency_matrix. POM (pinned to IOMmainper[sources]) hadn't been updated to match.AbstractPowerModel/AbstractActivePowerModel/AbstractACPModelhierarchy (and transitively every concrete network formulation:DCPPowerModel,ACPPowerModel,PTDFPowerModel,AreaPTDFPowerModel,CopperPlatePowerModel,AreaBalancePowerModel, …) ontoIOM.AbstractNetworkModelinstead ofIS.Optimization.AbstractPowerModel.PTDF_matrix/MODF_matrix(kwargs, field accesses, getters) tonetwork_matrix/contingency_matrixthroughoutsrc/,ext/, andtest/to match IOM's renamedNetworkModelAPI.Test plan
julia --project=test -e 'using PowerOperationsModels'precompiles cleanly (previously failed with theTypeErrorabove).julia --project=test -e 'using PowerFlows; using PowerOperationsModels'—PowerFlowsExtalso precompiles cleanly (it hit the same error in CI).julia --project=test test/runtests.jl test_network_constructors test_device_hvdc test_parallel_branch_parameter_multipliers— 4237/4237 pass on this branch.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, unrelatedHydroReservoir/LinearCurve→FunctionDatafailure intest_model_decision.jlthat's also present in themainCI run and stems fromPowerSystems/PowerSystemCaseBuildertest-data generation, not this change.Note: the
PowerSystemCaseBuilderCaseDataartifact-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