Skip to content
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

remove changes related to PTDFNetwork #1046

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/PowerSimulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export SimulationPartitionResults
# Network Relevant Exports
export NetworkModel
export StandardPTDFModel
export PTDFPowerModel
export CopperPlatePowerModel
export AreaBalancePowerModel

Expand Down
1 change: 0 additions & 1 deletion src/core/formulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ struct LossLessLine <: AbstractBranchFormulation end

abstract type AbstractPTDFModel <: PM.AbstractDCPModel end
struct StandardPTDFModel <: AbstractPTDFModel end
struct PTDFPowerModel <: AbstractPTDFModel end

struct CopperPlatePowerModel <: PM.AbstractActivePowerModel end
struct AreaBalancePowerModel <: PM.AbstractActivePowerModel end
Expand Down
2 changes: 1 addition & 1 deletion src/core/optimization_container.jl
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ function _make_system_expressions!(
dc_bus_numbers::Vector{Int},
::Type{T},
bus_reduction_map::Dict{Int64, Set{Int64}},
) where {T <: Union{PTDFPowerModel, StandardPTDFModel}}
) where {T <: StandardPTDFModel}
time_steps = get_time_steps(container)
if isempty(bus_reduction_map)
ac_bus_numbers = collect(Iterators.flatten(values(subnetworks)))
Expand Down
8 changes: 4 additions & 4 deletions src/devices_models/device_constructors/branch_constructor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ function construct_device!(
sys::PSY.System,
::ArgumentConstructStage,
model::DeviceModel{T, HVDCTwoTerminalUnbounded},
network_model::NetworkModel{<:Union{StandardPTDFModel, PTDFPowerModel}},
network_model::NetworkModel{StandardPTDFModel},
) where {T <: TwoTerminalHVDCTypes}
devices =
get_available_components(T, sys, get_attribute(model, "filter_function"))
Expand All @@ -461,7 +461,7 @@ function construct_device!(
sys::PSY.System,
::ModelConstructStage,
model::DeviceModel{<:TwoTerminalHVDCTypes, HVDCTwoTerminalUnbounded},
network_model::NetworkModel{<:Union{StandardPTDFModel, PTDFPowerModel}},
network_model::NetworkModel{StandardPTDFModel},
)
add_constraint_dual!(container, sys, model)
return
Expand Down Expand Up @@ -497,7 +497,7 @@ function construct_device!(
sys::PSY.System,
::ArgumentConstructStage,
model::DeviceModel{T, HVDCTwoTerminalLossless},
network_model::NetworkModel{<:Union{StandardPTDFModel, PTDFPowerModel}},
network_model::NetworkModel{StandardPTDFModel},
) where {T <: TwoTerminalHVDCTypes}
devices =
get_available_components(T, sys, get_attribute(model, "filter_function"))
Expand All @@ -522,7 +522,7 @@ function construct_device!(
network_model::NetworkModel{U},
) where {
T <: TwoTerminalHVDCTypes,
U <: Union{StandardPTDFModel, PTDFPowerModel},
U <: StandardPTDFModel,
}
devices =
get_available_components(T, sys, get_attribute(model, "filter_function"))
Expand Down
2 changes: 1 addition & 1 deletion src/devices_models/devices/HVDCsystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function add_to_expression!(
U <: ActivePowerVariable,
V <: PSY.InterconnectingConverter,
W <: AbstractConverterFormulation,
X <: Union{PTDFPowerModel, StandardPTDFModel},
X <: StandardPTDFModel
}
variable = get_variable(container, U(), V)
expression_dc = get_expression(container, T(), PSY.DCBus)
Expand Down
12 changes: 6 additions & 6 deletions src/devices_models/devices/common/add_to_expression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function add_to_expression!(
U <: FlowActivePowerToFromVariable,
V <: TwoTerminalHVDCTypes,
W <: AbstractDeviceFormulation,
X <: Union{PTDFPowerModel, StandardPTDFModel},
X <: StandardPTDFModel,
}
var = get_variable(container, U(), V)
nodal_expr = get_expression(container, T(), PSY.ACBus)
Expand Down Expand Up @@ -248,7 +248,7 @@ function add_to_expression!(
U <: FlowActivePowerFromToVariable,
V <: TwoTerminalHVDCTypes,
W <: AbstractTwoTerminalDCLineFormulation,
X <: Union{PTDFPowerModel, StandardPTDFModel},
X <: StandardPTDFModel,
}
var = get_variable(container, U(), V)
nodal_expr = get_expression(container, T(), PSY.ACBus)
Expand Down Expand Up @@ -579,7 +579,7 @@ function add_to_expression!(
U <: TimeSeriesParameter,
V <: PSY.StaticInjection,
W <: AbstractDeviceFormulation,
X <: Union{PTDFPowerModel, StandardPTDFModel},
X <: StandardPTDFModel,
}
param_container = get_parameter(container, U(), V)
multiplier = get_multiplier_array(param_container)
Expand Down Expand Up @@ -613,7 +613,7 @@ function add_to_expression!(
U <: OnStatusParameter,
V <: PSY.ThermalGen,
W <: AbstractDeviceFormulation,
X <: Union{PTDFPowerModel, StandardPTDFModel},
X <: StandardPTDFModel,
}
parameter = get_parameter_array(container, U(), V)
sys_expr = get_expression(container, T(), PSY.System)
Expand Down Expand Up @@ -647,7 +647,7 @@ function add_to_expression!(
U <: VariableType,
V <: PSY.StaticInjection,
W <: AbstractDeviceFormulation,
X <: Union{PTDFPowerModel, StandardPTDFModel},
X <: StandardPTDFModel,
}
variable = get_variable(container, U(), V)
sys_expr = get_expression(container, T(), PSY.System)
Expand Down Expand Up @@ -686,7 +686,7 @@ function add_to_expression!(
U <: OnVariable,
V <: PSY.ThermalGen,
W <: Union{AbstractCompactUnitCommitment, ThermalCompactDispatch},
X <: Union{PTDFPowerModel, StandardPTDFModel},
X <: StandardPTDFModel,
}
variable = get_variable(container, U(), V)
sys_expr = get_expression(container, T(), PSY.System)
Expand Down
2 changes: 1 addition & 1 deletion src/network_models/copperplate_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function add_constraints!(
) where {
T <: CopperPlateBalanceConstraint,
U <: PSY.System,
V <: Union{CopperPlatePowerModel, StandardPTDFModel, PTDFPowerModel},
V <: Union{CopperPlatePowerModel, StandardPTDFModel},
}
time_steps = get_time_steps(container)
expressions = get_expression(container, ActivePowerBalance(), U)
Expand Down
47 changes: 12 additions & 35 deletions src/network_models/network_constructor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,34 +75,11 @@ function construct_network!(
return
end

function construct_network!(
container::OptimizationContainer,
sys::PSY.System,
model::NetworkModel{T},
template::ProblemTemplate,
) where {T <: PTDFPowerModel}
construct_network!(
container,
sys,
model,
template;
instantiate_model = instantiate_nip_ptdf_expr_model,
)

add_pm_expr_refs!(container, T, sys)

add_constraints!(container, CopperPlateBalanceConstraint, sys, model)
add_constraints!(container, NodalBalanceActiveConstraint, sys, model)
add_constraint_dual!(container, sys, model)
return
end

function construct_network!(
container::OptimizationContainer,
sys::PSY.System,
model::NetworkModel{T},
template::ProblemTemplate;
instantiate_model = instantiate_nip_expr_model,
) where {T <: PM.AbstractActivePowerModel}
if T in UNSUPPORTED_POWERMODELS
throw(
Expand All @@ -126,9 +103,9 @@ function construct_network!(
objective_function!(container, PSY.ACBus, model)
end

@debug "Building the $T network with $instantiate_model method" _group =
@debug "Building the $T network with instantiate_nip_expr_model method" _group =
LOG_GROUP_NETWORK_CONSTRUCTION
powermodels_network!(container, T, sys, template, instantiate_model)
powermodels_network!(container, T, sys, template, instantiate_nip_expr_model)
#Constraints in case the model has DC Buses
add_constraints!(container, NodalBalanceActiveConstraint, sys, model)
add_pm_variable_refs!(container, T, sys)
Expand All @@ -143,7 +120,6 @@ function construct_network!(
sys::PSY.System,
model::NetworkModel{T},
template::ProblemTemplate;
instantiate_model = instantiate_nip_expr_model,
) where {T <: PM.AbstractPowerModel}
if T in UNSUPPORTED_POWERMODELS
throw(
Expand Down Expand Up @@ -174,11 +150,11 @@ function construct_network!(
objective_function!(container, PSY.ACBus, model)
end

@debug "Building the $T network with $instantiate_model method" _group =
@debug "Building the $T network with instantiate_nip_expr_model method" _group =
LOG_GROUP_NETWORK_CONSTRUCTION
#Constraints in case the model has DC Buses
add_constraints!(container, NodalBalanceActiveConstraint, sys, model)
powermodels_network!(container, T, sys, template, instantiate_model)
powermodels_network!(container, T, sys, template, instantiate_nip_expr_model)
add_pm_variable_refs!(container, T, sys)
add_pm_constraint_refs!(container, T, sys)

Expand All @@ -190,8 +166,7 @@ function construct_network!(
container::OptimizationContainer,
sys::PSY.System,
model::NetworkModel{T},
template::ProblemTemplate;
instantiate_model = instantiate_bfp_expr_model,
template::ProblemTemplate,
) where {T <: PM.AbstractBFModel}
if T in UNSUPPORTED_POWERMODELS
throw(
Expand Down Expand Up @@ -235,23 +210,24 @@ function construct_network!(
objective_function!(container, PSY.ACBus, model)
end

@debug "Building the $T network with $instantiate_model method" _group =
@debug "Building the $T network with instantiate_bfp_expr_model method" _group =
LOG_GROUP_NETWORK_CONSTRUCTION
#Constraints in case the model has DC Buses
add_constraints!(container, NodalBalanceActiveConstraint, sys, model)
powermodels_network!(container, T, sys, template, instantiate_model)
powermodels_network!(container, T, sys, template, instantiate_bfp_expr_model)
add_pm_variable_refs!(container, T, sys)
add_pm_constraint_refs!(container, T, sys)
add_constraint_dual!(container, sys, model)
return
end

#=
# AbstractIVRModel models not currently supported
function construct_network!(
container::OptimizationContainer,
sys::PSY.System,
model::NetworkModel{T},
template::ProblemTemplate;
instantiate_model = instantiate_vip_expr_model,
) where {T <: PM.AbstractIVRModel}
if T in UNSUPPORTED_POWERMODELS
throw(
Expand Down Expand Up @@ -299,13 +275,14 @@ function construct_network!(
objective_function!(container, PSY.ACBus, model)
end

@debug "Building the $T network with $instantiate_model method" _group =
@debug "Building the $T network with instantiate_vip_expr_model method" _group =
LOG_GROUP_NETWORK_CONSTRUCTION
#Constraints in case the model has DC Buses
add_constraints!(container, NodalBalanceActiveConstraint, sys, model)
powermodels_network!(container, T, sys, template, instantiate_model)
powermodels_network!(container, T, sys, template, instantiate_vip_expr_model)
add_pm_variable_refs!(container, T, sys)
add_pm_constraint_refs!(container, T, sys)
add_constraint_dual!(container, sys, model)
return
end
=#
12 changes: 0 additions & 12 deletions src/network_models/pm_translator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -446,18 +446,6 @@ function get_branches_to_pm(
return PM_branches, PMmap_br
end

function get_branches_to_pm(
::PSY.System,
network_model::NetworkModel{PTDFPowerModel},
::Type{T},
branch_template::BranchModelContainer,
start_idx = 0,
) where {T <: TwoTerminalHVDCTypes}
PM_branches = Dict{String, Any}()
PMmap_br = Dict{PM_MAP_TUPLE, T}()
return PM_branches, PMmap_br
end

function get_buses_to_pm(buses::IS.FlattenIteratorWrapper{PSY.ACBus})
PM_buses = Dict{String, Any}()
PMmap_buses = Dict{Int, PSY.ACBus}()
Expand Down
Loading
Loading