Skip to content

Commit

Permalink
replace radial_branches to radial_network_reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Jan 15, 2024
1 parent 32b40cb commit f0a7c76
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions src/core/network_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mutable struct NetworkModel{T <: PM.AbstractPowerModel}
subnetworks::Dict{Int, Set{Int}}
bus_area_map::Dict{PSY.ACBus, Int}
duals::Vector{DataType}
radial_branches::PNM.RadialNetworkReduction
radial_network_reduction::PNM.RadialNetworkReduction
reduce_radial_branches::Bool

function NetworkModel(
Expand All @@ -59,7 +59,7 @@ end
get_use_slacks(m::NetworkModel) = m.use_slacks
get_PTDF_matrix(m::NetworkModel) = m.PTDF_matrix
get_reduce_radial_branches(m::NetworkModel) = m.reduce_radial_branches
get_radial_branches(m::NetworkModel) = m.radial_branches
get_radial_network_reduction(m::NetworkModel) = m.radial_branches
get_duals(m::NetworkModel) = m.duals
get_network_formulation(::NetworkModel{T}) where {T} = T
get_reference_buses(m::NetworkModel{T}) where {T <: PM.AbstractPowerModel} =
Expand All @@ -83,7 +83,7 @@ function instantiate_network_model(
model.subnetworks = PNM.find_subnetworks(sys)
end
if model.reduce_radial_branches
model.radial_branches = PNM.RadialNetworkReduction(sys)
model.radial_network_reduction = PNM.RadialNetworkReduction(sys)
end
return
end
Expand Down Expand Up @@ -117,7 +117,7 @@ function instantiate_network_model(model::NetworkModel{StandardPTDFModel}, sys::
end
if model.reduce_radial_branches
@assert !isempty(model.PTDF_matrix.radial_branches)
model.radial_branches = model.PTDF_matrix.radial_branches
model.radial_network_reduction = model.PTDF_matrix.radial_branches
end
return
end
Expand Down
10 changes: 5 additions & 5 deletions src/devices_models/devices/AC_branches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function branch_rate_bounds!(
) where {B <: PSY.ACBranch}
var = get_variable(container, FlowActivePowerVariable(), B)

radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
radial_branches_names = PNM.get_radial_branches(radial_branches)

for d in devices
Expand Down Expand Up @@ -136,7 +136,7 @@ function branch_rate_bounds!(
]

time_steps = get_time_steps(container)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
radial_branches_names = PNM.get_radial_branches(radial_branches)

for d in devices
Expand Down Expand Up @@ -191,7 +191,7 @@ function add_constraints!(
V <: PM.AbstractActivePowerModel,
}
time_steps = get_time_steps(container)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
if isempty(radial_branches)
device_names = [PSY.get_name(d) for d in devices]
else
Expand Down Expand Up @@ -287,7 +287,7 @@ function add_constraints!(
)
constraint = get_constraint(container, cons_type(), B)

radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
radial_branches_names = PNM.get_radial_branches(radial_branches)

for r in rating_data
Expand Down Expand Up @@ -328,7 +328,7 @@ function add_constraints!(
)
constraint = get_constraint(container, cons_type(), B)

radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
radial_branches_names = PNM.get_radial_branches(radial_branches)

for r in rating_data
Expand Down
30 changes: 15 additions & 15 deletions src/devices_models/devices/common/add_to_expression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function add_to_expression!(
}
param_container = get_parameter(container, U(), V)
multiplier = get_multiplier_array(param_container)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices, t in get_time_steps(container)
bus_no = PNM.get_mapped_bus_number(radial_branches, PSY.get_number(PSY.get_bus(d)))
name = PSY.get_name(d)
Expand Down Expand Up @@ -117,7 +117,7 @@ function add_to_expression!(
X <: PM.AbstractPowerModel,
}
parameter = get_parameter_array(container, U(), V)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices, t in get_time_steps(container)
bus_no = PNM.get_mapped_bus_number(radial_branches, PSY.get_number(PSY.get_bus(d)))
name = PSY.get_name(d)
Expand Down Expand Up @@ -150,7 +150,7 @@ function add_to_expression!(
}
variable = get_variable(container, U(), V)
expression = get_expression(container, T(), PSY.ACBus)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices, t in get_time_steps(container)
name = PSY.get_name(d)
bus_no = PNM.get_mapped_bus_number(radial_branches, PSY.get_number(PSY.get_bus(d)))
Expand Down Expand Up @@ -217,7 +217,7 @@ function add_to_expression!(
var = get_variable(container, U(), V)
nodal_expr = get_expression(container, T(), PSY.ACBus)
sys_expr = get_expression(container, T(), PSY.System)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices
bus_no_to_ = PSY.get_number(PSY.get_arc(d).to)
bus_no_to = PNM.get_mapped_bus_number(radial_branches, bus_no_to_)
Expand Down Expand Up @@ -254,7 +254,7 @@ function add_to_expression!(
var = get_variable(container, U(), V)
nodal_expr = get_expression(container, T(), PSY.ACBus)
sys_expr = get_expression(container, T(), PSY.System)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices
bus_no_from_ = PSY.get_number(PSY.get_arc(d).from)
bus_no_from = PNM.get_mapped_bus_number(radial_branches, bus_no_from_)
Expand Down Expand Up @@ -358,7 +358,7 @@ function add_to_expression!(
}
variable = get_variable(container, U(), V)
expression = get_expression(container, T(), PSY.ACBus)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices
name = PSY.get_name(d)
bus_no_ = PSY.get_number(PSY.get_arc(d).from)
Expand Down Expand Up @@ -393,7 +393,7 @@ function add_to_expression!(
}
variable = get_variable(container, U(), V)
expression = get_expression(container, T(), PSY.ACBus)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices
name = PSY.get_name(d)
bus_no_ = PSY.get_number(PSY.get_arc(d).to)
Expand Down Expand Up @@ -425,7 +425,7 @@ function add_to_expression!(
}
variable = get_variable(container, U(), V)
expression = get_expression(container, T(), PSY.ACBus)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices, t in get_time_steps(container)
name = PSY.get_name(d)
bus_no_ = PSY.get_number(PSY.get_bus(d))
Expand Down Expand Up @@ -586,7 +586,7 @@ function add_to_expression!(
multiplier = get_multiplier_array(param_container)
sys_expr = get_expression(container, T(), PSY.System)
nodal_expr = get_expression(container, T(), PSY.ACBus)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices
name = PSY.get_name(d)
device_bus = PSY.get_bus(d)
Expand Down Expand Up @@ -619,7 +619,7 @@ function add_to_expression!(
parameter = get_parameter_array(container, U(), V)
sys_expr = get_expression(container, T(), PSY.System)
nodal_expr = get_expression(container, T(), PSY.ACBus)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices, t in get_time_steps(container)
name = PSY.get_name(d)
bus_no_ = PSY.get_number(PSY.get_bus(d))
Expand Down Expand Up @@ -653,7 +653,7 @@ function add_to_expression!(
variable = get_variable(container, U(), V)
sys_expr = get_expression(container, T(), PSY.System)
nodal_expr = get_expression(container, T(), PSY.ACBus)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices
name = PSY.get_name(d)
device_bus = PSY.get_bus(d)
Expand Down Expand Up @@ -693,7 +693,7 @@ function add_to_expression!(
variable = get_variable(container, U(), V)
sys_expr = get_expression(container, T(), PSY.System)
nodal_expr = get_expression(container, T(), PSY.ACBus)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices
name = PSY.get_name(d)
device_bus = PSY.get_bus(d)
Expand Down Expand Up @@ -735,7 +735,7 @@ function add_to_expression!(
}
var = get_variable(container, U(), V)
expression = get_expression(container, T(), PSY.ACBus)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices
bus_no_from_ = PSY.get_number(PSY.get_arc(d).from)
bus_no_from = PNM.get_mapped_bus_number(radial_branches, bus_no_from_)
Expand Down Expand Up @@ -777,7 +777,7 @@ function add_to_expression!(
var = get_variable(container, U(), V)
nodal_expr = get_expression(container, T(), PSY.ACBus)
sys_expr = get_expression(container, T(), PSY.System)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices
bus_no_from_ = PSY.get_number(PSY.get_arc(d).from)
bus_no_from = PNM.get_mapped_bus_number(radial_branches, bus_no_from_)
Expand Down Expand Up @@ -854,7 +854,7 @@ function add_to_expression!(
) where {T <: ActivePowerBalance, U <: PhaseShifterAngle, V <: PhaseAngleControl}
var = get_variable(container, U(), PSY.PhaseShiftingTransformer)
expression = get_expression(container, T(), PSY.ACBus)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
for d in devices
bus_no_from_ = PSY.get_number(PSY.get_arc(d).from)
bus_no_from = PNM.get_mapped_bus_number(radial_branches, bus_no_from_)
Expand Down
2 changes: 1 addition & 1 deletion src/initial_conditions/initialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function get_initial_conditions_template(model::OperationModel)
get_network_model(model.template),
),
)
network_model.radial_branches = get_radial_branches(get_network_model(model.template))
network_model.radial_network_reduction = get_radial_network_reduction(get_network_model(model.template))
network_model.subnetworks = get_subnetworks(get_network_model(model.template))
bus_area_map = get_bus_area_map(get_network_model(model.template))
if !isempty(bus_area_map)
Expand Down
2 changes: 1 addition & 1 deletion src/network_models/pm_translator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ function get_branches_to_pm(
PM_branches = Dict{String, Any}()
PMmap_br = Dict{PM_MAP_TUPLE, T}()

radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
radial_branches_names = PNM.get_radial_branches(radial_branches)
for (d, device_model) in branch_template
comp_type = get_component_type(device_model)
Expand Down
4 changes: 2 additions & 2 deletions src/network_models/powermodels_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ function powermodels_network!(
pm_data, PM_map = pass_to_pm(sys, template, time_steps[end])

network_model = get_network_model(template)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
if isempty(radial_branches)
ac_bus_numbers = PSY.get_number.(get_available_components(PSY.ACBus, sys))
else
Expand Down Expand Up @@ -332,7 +332,7 @@ function powermodels_network!(
buses = get_available_components(PSY.ACBus, sys)

network_model = get_network_model(template)
radial_branches = get_radial_branches(network_model)
radial_network_reduction = get_radial_network_reduction(network_model)
if isempty(radial_branches)
ac_bus_numbers = PSY.get_number.(get_available_components(PSY.ACBus, sys))
else
Expand Down

0 comments on commit f0a7c76

Please sign in to comment.