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

rename StandardPTDFModel to PTDFPowerModel #1047

Merged
merged 1 commit 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
2 changes: 1 addition & 1 deletion docs/src/tutorials/pcm_simulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ example, PSI also provides pre-specified templates for some standard problems:

```@example pcm
template_ed = template_economic_dispatch(
network = NetworkModel(StandardPTDFModel, use_slacks = true),
network = NetworkModel(PTDFPowerModel, use_slacks = true),
)
```

Expand Down
2 changes: 1 addition & 1 deletion src/PowerSimulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export SimulationPartitionResults

# Network Relevant Exports
export NetworkModel
export StandardPTDFModel
export PTDFPowerModel
export CopperPlatePowerModel
export AreaBalancePowerModel

Expand Down
2 changes: 1 addition & 1 deletion src/core/formulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct LossLessLine <: AbstractBranchFormulation end
# These formulations are taken directly from PowerModels

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
6 changes: 3 additions & 3 deletions src/core/network_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Establishes the model for a particular device specified by type.
# Example

ptdf_array = PTDF(system)
thermal_gens = NetworkModel(StandardPTDFModel, ptdf = ptdf_array),
thermal_gens = NetworkModel(PTDFPowerModel, ptdf = ptdf_array),
"""
mutable struct NetworkModel{T <: PM.AbstractPowerModel}
use_slacks::Bool
Expand Down Expand Up @@ -113,7 +113,7 @@ function instantiate_network_model(
return
end

function instantiate_network_model(model::NetworkModel{StandardPTDFModel}, sys::PSY.System)
function instantiate_network_model(model::NetworkModel{PTDFPowerModel}, sys::PSY.System)
if get_PTDF_matrix(model) === nothing
@info "PTDF Matrix not provided. Calculating using PowerNetworkMatrices.PTDF"
model.PTDF_matrix =
Expand All @@ -135,7 +135,7 @@ end
function _assign_subnetworks_to_buses(
model::NetworkModel{T},
sys::PSY.System,
) where {T <: Union{CopperPlatePowerModel, StandardPTDFModel}}
) where {T <: Union{CopperPlatePowerModel, PTDFPowerModel}}
subnetworks = model.subnetworks
temp_bus_map = Dict{Int, Int}()
radial_network_reduction = PSI.get_radial_network_reduction(model)
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 <: StandardPTDFModel}
) where {T <: PTDFPowerModel}
time_steps = get_time_steps(container)
if isempty(bus_reduction_map)
ac_bus_numbers = collect(Iterators.flatten(values(subnetworks)))
Expand Down
28 changes: 14 additions & 14 deletions src/devices_models/device_constructors/branch_constructor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function construct_device!(
sys::PSY.System,
::ArgumentConstructStage,
device_model::DeviceModel{T, StaticBranch},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {T <: PSY.ACBranch}
devices =
get_available_components(T, sys, get_attribute(device_model, "filter_function"))
Expand All @@ -230,7 +230,7 @@ function construct_device!(
sys::PSY.System,
::ModelConstructStage,
device_model::DeviceModel{T, StaticBranch},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {T <: PSY.ACBranch}
devices =
get_available_components(T, sys, get_attribute(device_model, "filter_function"))
Expand All @@ -245,7 +245,7 @@ function construct_device!(
sys::PSY.System,
::ArgumentConstructStage,
device_model::DeviceModel{T, StaticBranchBounds},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {T <: PSY.ACBranch}
devices =
get_available_components(T, sys, get_attribute(device_model, "filter_function"))
Expand All @@ -264,7 +264,7 @@ function construct_device!(
sys::PSY.System,
::ModelConstructStage,
device_model::DeviceModel{T, StaticBranchBounds},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {T <: PSY.ACBranch}
devices =
get_available_components(T, sys, get_attribute(device_model, "filter_function"))
Expand All @@ -284,7 +284,7 @@ function construct_device!(
sys::PSY.System,
::ArgumentConstructStage,
device_model::DeviceModel{T, StaticBranchUnbounded},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {T <: PSY.ACBranch}
devices =
get_available_components(T, sys, get_attribute(device_model, "filter_function"))
Expand All @@ -303,7 +303,7 @@ function construct_device!(
sys::PSY.System,
::ModelConstructStage,
model::DeviceModel{T, StaticBranchUnbounded},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {T <: PSY.ACBranch}
devices =
get_available_components(T, sys, get_attribute(model, "filter_function"))
Expand Down Expand Up @@ -439,7 +439,7 @@ function construct_device!(
sys::PSY.System,
::ArgumentConstructStage,
model::DeviceModel{T, HVDCTwoTerminalUnbounded},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) 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{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
)
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{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) 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 <: StandardPTDFModel,
U <: PTDFPowerModel,
}
devices =
get_available_components(T, sys, get_attribute(model, "filter_function"))
Expand All @@ -536,7 +536,7 @@ function construct_device!(
sys::PSY.System,
::ArgumentConstructStage,
model::DeviceModel{T, HVDCTwoTerminalDispatch},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {T <: TwoTerminalHVDCTypes}
devices =
get_available_components(T, sys, get_attribute(model, "filter_function"))
Expand Down Expand Up @@ -586,7 +586,7 @@ function construct_device!(
sys::PSY.System,
::ModelConstructStage,
model::DeviceModel{T, HVDCTwoTerminalDispatch},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {T <: TwoTerminalHVDCTypes}
devices =
get_available_components(T, sys, get_attribute(model, "filter_function"))
Expand Down Expand Up @@ -705,7 +705,7 @@ function construct_device!(
sys::PSY.System,
::ArgumentConstructStage,
model::DeviceModel{PSY.PhaseShiftingTransformer, PhaseAngleControl},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
)
devices = get_available_components(
PSY.PhaseShiftingTransformer,
Expand Down Expand Up @@ -749,7 +749,7 @@ function construct_device!(
sys::PSY.System,
::ModelConstructStage,
model::DeviceModel{PSY.PhaseShiftingTransformer, PhaseAngleControl},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
)
devices = get_available_components(
PSY.PhaseShiftingTransformer,
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 @@ -46,7 +46,7 @@ end
function add_variables!(
container::OptimizationContainer,
::Type{FlowActivePowerVariable},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
devices::IS.FlattenIteratorWrapper{T},
formulation::AbstractBranchFormulation,
) where {T <: PSY.ACBranch}
Expand Down Expand Up @@ -345,14 +345,14 @@ function add_constraints!(
end

"""
Add network flow constraints for ACBranch and NetworkModel with StandardPTDFModel
Add network flow constraints for ACBranch and NetworkModel with PTDFPowerModel
"""
function add_constraints!(
container::OptimizationContainer,
::Type{NetworkFlowConstraint},
devices::IS.FlattenIteratorWrapper{B},
model::DeviceModel{B, <:AbstractBranchFormulation},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {B <: PSY.ACBranch}
ptdf = get_PTDF_matrix(network_model)
# This is a workaround to not call the same list comprehension to find
Expand Down Expand Up @@ -388,14 +388,14 @@ function add_constraints!(
end

"""
Add network flow constraints for PhaseShiftingTransformer and NetworkModel with StandardPTDFModel
Add network flow constraints for PhaseShiftingTransformer and NetworkModel with PTDFPowerModel
"""
function add_constraints!(
container::OptimizationContainer,
::Type{NetworkFlowConstraint},
devices::IS.FlattenIteratorWrapper{T},
model::DeviceModel{T, PhaseAngleControl},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {T <: PSY.PhaseShiftingTransformer}
ptdf = get_PTDF_matrix(network_model)
branches = PSY.get_name.(devices)
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 <: StandardPTDFModel
X <: PTDFPowerModel
}
variable = get_variable(container, U(), V)
expression_dc = get_expression(container, T(), PSY.DCBus)
Expand Down
2 changes: 1 addition & 1 deletion src/devices_models/devices/common/add_constraint_dual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function add_constraint_dual!(
container::OptimizationContainer,
sys::PSY.System,
model::NetworkModel{T},
) where {T <: Union{CopperPlatePowerModel, StandardPTDFModel}}
) where {T <: Union{CopperPlatePowerModel, PTDFPowerModel}}
if !isempty(get_duals(model))
for constraint_type in get_duals(model)
assign_dual_variable!(container, constraint_type, sys, model)
Expand Down
20 changes: 10 additions & 10 deletions src/devices_models/devices/common/add_to_expression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function add_to_expression!(
U <: HVDCLosses,
V <: TwoTerminalHVDCTypes,
W <: HVDCTwoTerminalDispatch,
X <: Union{StandardPTDFModel, CopperPlatePowerModel},
X <: Union{PTDFPowerModel, CopperPlatePowerModel},
}
variable = get_variable(container, U(), V)
expression = get_expression(container, T(), PSY.System)
Expand Down Expand Up @@ -212,7 +212,7 @@ function add_to_expression!(
U <: FlowActivePowerToFromVariable,
V <: TwoTerminalHVDCTypes,
W <: AbstractDeviceFormulation,
X <: StandardPTDFModel,
X <: PTDFPowerModel,
}
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 <: StandardPTDFModel,
X <: PTDFPowerModel,
}
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 <: StandardPTDFModel,
X <: PTDFPowerModel,
}
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 <: StandardPTDFModel,
X <: PTDFPowerModel,
}
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 <: StandardPTDFModel,
X <: PTDFPowerModel,
}
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 <: StandardPTDFModel,
X <: PTDFPowerModel,
}
variable = get_variable(container, U(), V)
sys_expr = get_expression(container, T(), PSY.System)
Expand Down Expand Up @@ -762,7 +762,7 @@ function add_to_expression!(
::Type{U},
devices::IS.FlattenIteratorWrapper{V},
::DeviceModel{V, W},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {
T <: ActivePowerBalance,
U <: FlowActivePowerVariable,
Expand Down Expand Up @@ -844,7 +844,7 @@ function add_to_expression!(
::Type{U},
devices::IS.FlattenIteratorWrapper{PSY.PhaseShiftingTransformer},
::DeviceModel{PSY.PhaseShiftingTransformer, V},
network_model::NetworkModel{StandardPTDFModel},
network_model::NetworkModel{PTDFPowerModel},
) where {T <: ActivePowerBalance, U <: PhaseShifterAngle, V <: PhaseAngleControl}
var = get_variable(container, U(), PSY.PhaseShiftingTransformer)
expression = get_expression(container, T(), PSY.ACBus)
Expand Down Expand Up @@ -1076,7 +1076,7 @@ function add_to_expression!(
) where {
T <: ActivePowerBalance,
U <: Union{SystemBalanceSlackUp, SystemBalanceSlackDown},
W <: Union{CopperPlatePowerModel, StandardPTDFModel},
W <: Union{CopperPlatePowerModel, PTDFPowerModel},
}
variable = get_variable(container, U(), PSY.System)
expression = 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},
V <: Union{CopperPlatePowerModel, PTDFPowerModel},
}
time_steps = get_time_steps(container)
expressions = get_expression(container, ActivePowerBalance(), U)
Expand Down
2 changes: 1 addition & 1 deletion src/network_models/network_constructor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ end
function construct_network!(
container::OptimizationContainer,
sys::PSY.System,
model::NetworkModel{StandardPTDFModel},
model::NetworkModel{PTDFPowerModel},
::ProblemTemplate,
)
if get_use_slacks(model)
Expand Down
4 changes: 2 additions & 2 deletions src/network_models/network_slack_variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function add_variables!(
network_model::NetworkModel{U},
) where {
T <: Union{SystemBalanceSlackUp, SystemBalanceSlackDown},
U <: Union{CopperPlatePowerModel, StandardPTDFModel},
U <: Union{CopperPlatePowerModel, PTDFPowerModel},
}
time_steps = get_time_steps(container)
reference_buses = get_reference_buses(network_model)
Expand Down Expand Up @@ -95,7 +95,7 @@ function objective_function!(
container::OptimizationContainer,
::Type{PSY.System},
network_model::NetworkModel{T},
) where {T <: Union{CopperPlatePowerModel, StandardPTDFModel}}
) where {T <: Union{CopperPlatePowerModel, PTDFPowerModel}}
variable_up = get_variable(container, SystemBalanceSlackUp(), PSY.System)
variable_dn = get_variable(container, SystemBalanceSlackDown(), PSY.System)
reference_buses = get_reference_buses(network_model)
Expand Down
2 changes: 1 addition & 1 deletion test/performance/performance_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ try
for i in 1:2
template_uc = ProblemTemplate(
NetworkModel(
StandardPTDFModel;
PTDFPowerModel;
use_slacks = true,
PTDF_matrix = PTDF(sys_rts_da),
duals = [CopperPlateBalanceConstraint],
Expand Down
2 changes: 1 addition & 1 deletion test/run_partitioned_simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function build_simulation(
set_network_model!(
template_uc,
NetworkModel(
StandardPTDFModel;
PTDFPowerModel;
PTDF_matrix = PTDF(c_sys5_pjm_da),
# duals = [CopperPlateBalanceConstraint]
),
Expand Down
Loading
Loading