-
Notifications
You must be signed in to change notification settings - Fork 0
IOM-side port of PSI#1579 (SCUC branch formulation using MODF) #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
83e0de2
877325a
8239dda
a323ef8
0173cc6
b0457e0
d9ba756
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,8 +28,11 @@ Establishes the NetworkModel for a given AC network formulation type. | |
| Adds slack buses to the network modeling. | ||
| - `PTDF_matrix::Union{PNM.PowerNetworkMatrix, Nothing}` = nothing | ||
| PTDF/VirtualPTDF matrix produced by PowerNetworkMatrices (optional). | ||
| - `LODF_matrix::Union{PNM.PowerNetworkMatrix, Nothing}` = nothing | ||
| LODF/VirtualLODF matrix produced by PowerNetworkMatrices (optional). | ||
| - `MODF_matrix::Union{PNM.VirtualMODF, Nothing}` = nothing | ||
| VirtualMODF matrix for security-constrained models (N-k contingencies). | ||
| If `nothing` and the template includes a security-constrained branch | ||
| formulation, the matrix is constructed from the system during | ||
| `instantiate_network_model!` (same pattern as PTDF). | ||
| - `reduce_radial_branches::Bool` = false | ||
| Enable radial branch reduction when building network matrices. | ||
| - `reduce_degree_two_branches::Bool` = false | ||
|
|
@@ -45,7 +48,7 @@ Establishes the NetworkModel for a given AC network formulation type. | |
| # Notes | ||
| - `modeled_branch_types` and `reduced_branch_tracker` are internal fields managed by the model. | ||
| - `subsystem` can be set after construction via `set_subsystem!(model, id)`. | ||
| - PTDF/LODF inputs are validated against the requested reduction flags and may raise | ||
| - PTDF inputs are validated against the requested reduction flags and may raise | ||
| a ConflictingInputsError if they are inconsistent with `reduce_radial_branches` | ||
| or `reduce_degree_two_branches`. | ||
|
acostarelli marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
@@ -59,7 +62,7 @@ Establishes the NetworkModel for a given AC network formulation type. | |
| mutable struct NetworkModel{T <: AbstractPowerModel} | ||
| use_slacks::Bool | ||
| PTDF_matrix::Union{Nothing, PNM.PowerNetworkMatrix} | ||
| LODF_matrix::Union{Nothing, PNM.PowerNetworkMatrix} | ||
| MODF_matrix::Union{Nothing, PNM.VirtualMODF} | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ignoring for now. |
||
| subnetworks::Dict{Int, Set{Int}} | ||
| bus_area_map::Dict{IS.InfrastructureSystemsComponent, Int} | ||
| duals::Vector{DataType} | ||
|
|
@@ -76,7 +79,7 @@ mutable struct NetworkModel{T <: AbstractPowerModel} | |
| ::Type{T}; | ||
| use_slacks = false, | ||
| PTDF_matrix = nothing, | ||
| LODF_matrix = nothing, | ||
| MODF_matrix = nothing, | ||
| reduce_radial_branches = false, | ||
| reduce_degree_two_branches = false, | ||
| subnetworks = Dict{Int, Set{Int}}(), | ||
|
|
@@ -91,7 +94,7 @@ mutable struct NetworkModel{T <: AbstractPowerModel} | |
| new{T}( | ||
| use_slacks, | ||
| PTDF_matrix, | ||
| LODF_matrix, | ||
| MODF_matrix, | ||
| subnetworks, | ||
| Dict{IS.InfrastructureSystemsComponent, Int}(), | ||
| duals, | ||
|
|
@@ -109,7 +112,7 @@ end | |
|
|
||
| get_use_slacks(m::NetworkModel) = m.use_slacks | ||
| get_PTDF_matrix(m::NetworkModel) = m.PTDF_matrix | ||
| get_LODF_matrix(m::NetworkModel) = m.LODF_matrix | ||
| get_MODF_matrix(m::NetworkModel) = m.MODF_matrix | ||
|
Comment on lines
63
to
+110
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not important |
||
| get_reduce_radial_branches(m::NetworkModel) = m.reduce_radial_branches | ||
| get_network_reduction(m::NetworkModel) = m.network_reduction | ||
| get_duals(m::NetworkModel) = m.duals | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,6 +125,28 @@ function write_output!( | |
| return | ||
| end | ||
|
|
||
| # Sparse expressions (e.g., post-contingency flows keyed by | ||
| # `(outage_id, branch_name, t)`) are pre-allocated as 2D dense storage with | ||
| # the non-time tuple flattened into encoded `"a__b"` columns by | ||
| # `get_column_names_from_axis_array(::SparseAxisArray)`. `to_matrix` returns | ||
| # `(n_time, n_cols)`; transpose to match the `(cols, time)` layout the dense | ||
| # storage expects. | ||
| function write_output!( | ||
| store::DecisionModelStore, | ||
| name::Symbol, | ||
| key::OptimizationContainerKey, | ||
| index::DecisionModelIndexType, | ||
| update_timestamp::Dates.DateTime, | ||
| array::SparseAxisArray{T}, | ||
| ) where {T} | ||
| columns = get_column_names_from_axis_array(array)[1] | ||
| matrix = to_matrix(array) | ||
| container = getfield(store, get_store_container_type(key)) | ||
| container[key][index] = | ||
| DenseAxisArray(permutedims(matrix), columns, 1:size(matrix, 1)) | ||
| return | ||
| end | ||
|
Comment on lines
+136
to
+151
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot Does the most recent commit fix this?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes — |
||
|
|
||
| function read_outputs( | ||
| store::DecisionModelStore, | ||
| key::OptimizationContainerKey; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.