diff --git a/src/devices_models/device_constructors/branch_constructor.jl b/src/devices_models/device_constructors/branch_constructor.jl index c884ea7920..9f018e2e35 100644 --- a/src/devices_models/device_constructors/branch_constructor.jl +++ b/src/devices_models/device_constructors/branch_constructor.jl @@ -102,7 +102,12 @@ function construct_device!( if has_subnetworks(network_model) devices = get_available_components(T, sys, get_attribute(device_model, "filter_function")) - branch_rate_bounds!(container, devices, device_model, S) + branch_rate_bounds!( + container, + devices, + device_model, + typeof(network_model).parameters[1], + ) end return end @@ -173,8 +178,8 @@ function construct_device!( ::OptimizationContainer, ::PSY.System, ::ArgumentConstructStage, - ::DeviceModel{<: PSY.ACBranch, StaticBranch}, - ::NetworkModel{<: PM.AbstractActivePowerModel}, + ::DeviceModel{<:PSY.ACBranch, StaticBranch}, + ::NetworkModel{<:PM.AbstractActivePowerModel}, ) end @@ -254,12 +259,17 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, device_model::DeviceModel{T, StaticBranchBounds}, - network_model::NetworkModel{S}, -) where {T <: PSY.ACBranch, S <: StandardPTDFModel} + network_model::NetworkModel{StandardPTDFModel}, +) where {T <: PSY.ACBranch} devices = get_available_components(T, sys, get_attribute(device_model, "filter_function")) add_constraints!(container, NetworkFlowConstraint, devices, device_model, network_model) - branch_rate_bounds!(container, devices, device_model, S) + branch_rate_bounds!( + container, + devices, + device_model, + get_network_formulation(network_model) + ) add_constraint_dual!(container, sys, device_model) return end @@ -304,7 +314,7 @@ function construct_device!( ::PSY.System, ::ArgumentConstructStage, ::DeviceModel{T, StaticBranch}, - ::NetworkModel{<: PM.AbstractPowerModel}, + ::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ACBranch} end function construct_device!( @@ -312,11 +322,11 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, StaticBranch}, - network_model::NetworkModel{S}, -) where {T <: PSY.ACBranch, S <: PM.AbstractPowerModel} + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {T <: PSY.ACBranch} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) - branch_rate_bounds!(container, devices, model, S) + branch_rate_bounds!(container, devices, model, get_network_formulation(network_model)) add_constraints!(container, RateLimitConstraintFromTo, devices, model, network_model) add_constraints!(container, RateLimitConstraintToFrom, devices, model, network_model) @@ -329,7 +339,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, ::DeviceModel{T, StaticBranchBounds}, - ::NetworkModel{<: PM.AbstractPowerModel}, + ::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ACBranch} end function construct_device!( @@ -337,11 +347,11 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, StaticBranchBounds}, - ::NetworkModel{S}, -) where {T <: PSY.ACBranch, S <: PM.AbstractPowerModel} + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {T <: PSY.ACBranch} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) - branch_rate_bounds!(container, devices, model, S) + branch_rate_bounds!(container, devices, model, get_network_formulation(network_model)) add_constraint_dual!(container, sys, model) return end @@ -402,8 +412,8 @@ function construct_device!( ::OptimizationContainer, ::PSY.System, ::ArgumentConstructStage, - ::DeviceModel{<: TwoTerminalHVDCTypes, <: HVDCTwoTerminalUnbounded}, - ::NetworkModel{<: PM.AbstractPowerModel}, + ::DeviceModel{<:TwoTerminalHVDCTypes, HVDCTwoTerminalUnbounded}, + ::NetworkModel{<:PM.AbstractPowerModel}, ) return end @@ -412,8 +422,8 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{<: TwoTerminalHVDCTypes, <: HVDCTwoTerminalUnbounded}, - ::NetworkModel{<: PM.AbstractPowerModel}, + model::DeviceModel{<:TwoTerminalHVDCTypes, HVDCTwoTerminalUnbounded}, + ::NetworkModel{<:PM.AbstractPowerModel}, ) add_constraint_dual!(container, sys, model) end @@ -424,7 +434,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, U}, - network_model::NetworkModel{<: Union{StandardPTDFModel, PTDFPowerModel}}, + network_model::NetworkModel{<:Union{StandardPTDFModel, PTDFPowerModel}}, ) where { T <: TwoTerminalHVDCTypes, U <: HVDCTwoTerminalUnbounded, @@ -448,8 +458,8 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{<: TwoTerminalHVDCTypes, <: HVDCTwoTerminalUnbounded}, - network_model::NetworkModel{<: Union{StandardPTDFModel, PTDFPowerModel}}, + model::DeviceModel{<:TwoTerminalHVDCTypes, <:HVDCTwoTerminalUnbounded}, + network_model::NetworkModel{<:Union{StandardPTDFModel, PTDFPowerModel}}, ) add_constraint_dual!(container, sys, model) return @@ -459,8 +469,8 @@ function construct_device!( ::OptimizationContainer, ::PSY.System, ::ArgumentConstructStage, - ::DeviceModel{<: TwoTerminalHVDCTypes, <: HVDCTwoTerminalLossless}, - ::NetworkModel{<: PM.AbstractPowerModel} + ::DeviceModel{<:TwoTerminalHVDCTypes, HVDCTwoTerminalLossless}, + ::NetworkModel{<:PM.AbstractPowerModel}, ) return end @@ -469,8 +479,8 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{T, <: HVDCTwoTerminalLossless}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + model::DeviceModel{T, HVDCTwoTerminalLossless}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: TwoTerminalHVDCTypes} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -590,7 +600,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, HVDCTwoTerminalDispatch}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: TwoTerminalHVDCTypes} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -647,7 +657,7 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, HVDCTwoTerminalDispatch}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: TwoTerminalHVDCTypes} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) diff --git a/src/devices_models/device_constructors/constructor_validations.jl b/src/devices_models/device_constructors/constructor_validations.jl index ccbb4d8f3e..36def3c486 100644 --- a/src/devices_models/device_constructors/constructor_validations.jl +++ b/src/devices_models/device_constructors/constructor_validations.jl @@ -1,5 +1,5 @@ function validate_available_devices( - device_model::DeviceModel{T, <: AbstractDeviceFormulation}, + device_model::DeviceModel{T, <:AbstractDeviceFormulation}, system::PSY.System, ) where {T <: PSY.Device} devices = diff --git a/src/devices_models/device_constructors/hvdcsystems_constructor.jl b/src/devices_models/device_constructors/hvdcsystems_constructor.jl index 5fe9d98738..0e2cb75cf2 100644 --- a/src/devices_models/device_constructors/hvdcsystems_constructor.jl +++ b/src/devices_models/device_constructors/hvdcsystems_constructor.jl @@ -3,7 +3,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{PSY.InterconnectingConverter, LossLessConverter}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) devices = get_available_components(PSY.InterconnectingConverter, sys) add_variables!(container, ActivePowerVariable, devices, LossLessConverter()) @@ -24,11 +24,11 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{PSY.InterconnectingConverter, LossLessConverter}, - ::NetworkModel{S}, -) where {S <: PM.AbstractActivePowerModel} + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) devices = get_available_components(PSY.InterconnectingConverter, sys) add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, get_network_formulation(network_model)) add_constraint_dual!(container, sys, model) return end @@ -38,7 +38,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{PSY.TModelHVDCLine, LossLessLine}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) devices = get_available_components(PSY.TModelHVDCLine, sys) add_variables!(container, FlowActivePowerVariable, devices, LossLessLine()) @@ -59,6 +59,6 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{PSY.TModelHVDCLine, LossLessLine}, - ::NetworkModel{<: PM.AbstractActivePowerModel}, + ::NetworkModel{<:PM.AbstractActivePowerModel}, ) end diff --git a/src/devices_models/device_constructors/load_constructor.jl b/src/devices_models/device_constructors/load_constructor.jl index 37413f43a4..e41b458d2a 100644 --- a/src/devices_models/device_constructors/load_constructor.jl +++ b/src/devices_models/device_constructors/load_constructor.jl @@ -3,7 +3,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{L, D}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where { L <: PSY.ControllableLoad, D <: AbstractControllablePowerLoadFormulation, @@ -43,13 +43,9 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{L, D}, - network_model::NetworkModel{S}, -) where { - L <: PSY.ControllableLoad, - D <: AbstractControllablePowerLoadFormulation, - S <: PM.AbstractPowerModel, -} + model::DeviceModel{L, <:AbstractControllablePowerLoadFormulation}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {L <: PSY.ControllableLoad} devices = get_available_components(L, sys, get_attribute(model, "filter_function")) @@ -71,7 +67,7 @@ function construct_device!( ) add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return @@ -82,7 +78,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{L, D}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where { L <: PSY.ControllableLoad, D <: AbstractControllablePowerLoadFormulation, @@ -112,13 +108,9 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{L, D}, - network_model::NetworkModel{S}, -) where { - L <: PSY.ControllableLoad, - D <: AbstractControllablePowerLoadFormulation, - S <: PM.AbstractActivePowerModel, -} + model::DeviceModel{L, <:AbstractControllablePowerLoadFormulation}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {L <: PSY.ControllableLoad} devices = get_available_components(L, sys, get_attribute(model, "filter_function")) @@ -132,7 +124,7 @@ function construct_device!( ) add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return @@ -143,7 +135,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{L, PowerLoadInterruption}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {L <: PSY.ControllableLoad} devices = get_available_components(L, sys, get_attribute(model, "filter_function")) @@ -182,8 +174,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{L, PowerLoadInterruption}, - network_model::NetworkModel{S}, -) where {L <: PSY.ControllableLoad, S <: PM.AbstractPowerModel} + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {L <: PSY.ControllableLoad} devices = get_available_components(L, sys, get_attribute(model, "filter_function")) @@ -205,7 +197,7 @@ function construct_device!( ) add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return @@ -216,7 +208,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{L, PowerLoadInterruption}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {L <: PSY.ControllableLoad} devices = get_available_components(L, sys, get_attribute(model, "filter_function")) @@ -245,8 +237,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{L, PowerLoadInterruption}, - network_model::NetworkModel{S}, -) where {L <: PSY.ControllableLoad, S <: PM.AbstractActivePowerModel} + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {L <: PSY.ControllableLoad} devices = get_available_components(L, sys, get_attribute(model, "filter_function")) @@ -260,7 +252,7 @@ function construct_device!( ) add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return @@ -271,7 +263,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{L, StaticPowerLoad}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {L <: PSY.ElectricLoad} devices = get_available_components(L, sys, get_attribute(model, "filter_function")) @@ -303,7 +295,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{L, StaticPowerLoad}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {L <: PSY.ElectricLoad} devices = get_available_components(L, sys, get_attribute(model, "filter_function")) @@ -325,8 +317,8 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{<: PSY.ElectricLoad, StaticPowerLoad}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + model::DeviceModel{<:PSY.ElectricLoad, StaticPowerLoad}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) # Static PowerLoad doesn't add any constraints to the model. This function covers # AbstractPowerModel and AbtractActivePowerModel @@ -337,8 +329,8 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ArgumentConstructStage, - model::DeviceModel{L, <: AbstractControllablePowerLoadFormulation}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + model::DeviceModel{L, <:AbstractControllablePowerLoadFormulation}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {L <: PSY.StaticLoad} devices = get_available_components(L, sys, get_attribute(model, "filter_function")) @@ -369,8 +361,8 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ArgumentConstructStage, - model::DeviceModel{L, <: AbstractControllablePowerLoadFormulation}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + model::DeviceModel{L, <:AbstractControllablePowerLoadFormulation}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {L <: PSY.StaticLoad} devices = get_available_components(L, sys, get_attribute(model, "filter_function")) @@ -392,7 +384,7 @@ function construct_device!( sys::PSY.System, ccs::ModelConstructStage, model::DeviceModel{L, D}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where { L <: PSY.StaticLoad, D <: AbstractControllablePowerLoadFormulation, diff --git a/src/devices_models/device_constructors/regulationdevice_constructor.jl b/src/devices_models/device_constructors/regulationdevice_constructor.jl index 2ed663008d..da3231a2b2 100644 --- a/src/devices_models/device_constructors/regulationdevice_constructor.jl +++ b/src/devices_models/device_constructors/regulationdevice_constructor.jl @@ -98,7 +98,13 @@ function construct_device!( network_model, ) - add_constraints!(container, ParticipationAssignmentConstraint, devices, model, AreaBalancePowerModel) + add_constraints!( + container, + ParticipationAssignmentConstraint, + devices, + model, + AreaBalancePowerModel, + ) objective_function!(container, devices, model) return end @@ -107,7 +113,7 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ArgumentConstructStage, - model::DeviceModel{PSY.RegulationDevice{<: PSY.StaticInjection}, FixedOutput}, + model::DeviceModel{PSY.RegulationDevice{<:PSY.StaticInjection}, FixedOutput}, network_model::NetworkModel{AreaBalancePowerModel}, ) devices = get_available_components(get_component_type(model), sys) @@ -128,7 +134,7 @@ function construct_device!( ::OptimizationContainer, ::PSY.System, ::ModelConstructStage, - ::DeviceModel{PSY.RegulationDevice{<: PSY.StaticInjection}, FixedOutput}, + ::DeviceModel{PSY.RegulationDevice{<:PSY.StaticInjection}, FixedOutput}, network_model::NetworkModel{AreaBalancePowerModel}, ) # There is no-op under FixedOutput formulation diff --git a/src/devices_models/device_constructors/renewablegeneration_constructor.jl b/src/devices_models/device_constructors/renewablegeneration_constructor.jl index d7dbcb2d7c..186cd9122e 100644 --- a/src/devices_models/device_constructors/renewablegeneration_constructor.jl +++ b/src/devices_models/device_constructors/renewablegeneration_constructor.jl @@ -3,7 +3,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{R, D}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where { R <: PSY.RenewableGen, D <: AbstractRenewableDispatchFormulation, @@ -59,12 +59,9 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{R, <: AbstractRenewableDispatchFormulation}, - network_model::NetworkModel{S}, -) where { - R <: PSY.RenewableGen, - S <: PM.AbstractPowerModel, -} + model::DeviceModel{R, <:AbstractRenewableDispatchFormulation}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {R <: PSY.RenewableGen} devices = get_available_components(R, sys, get_attribute(model, "filter_function")) @@ -106,7 +103,7 @@ function construct_device!( ) add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return @@ -117,7 +114,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{R, D}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where { R <: PSY.RenewableGen, D <: AbstractRenewableDispatchFormulation, @@ -164,12 +161,9 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{R, <: AbstractRenewableDispatchFormulation}, - network_model::NetworkModel{S}, -) where { - R <: PSY.RenewableGen, - S <: PM.AbstractActivePowerModel, -} + model::DeviceModel{R, <:AbstractRenewableDispatchFormulation}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {R <: PSY.RenewableGen} devices = get_available_components(R, sys, get_attribute(model, "filter_function")) @@ -202,7 +196,7 @@ function construct_device!( end add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) @@ -214,7 +208,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{R, FixedOutput}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {R <: PSY.RenewableGen} devices = get_available_components(R, sys, get_attribute(model, "filter_function")) @@ -246,7 +240,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{R, FixedOutput}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {R <: PSY.RenewableGen} devices = get_available_components(R, sys, get_attribute(model, "filter_function")) @@ -267,8 +261,8 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{<: PSY.RenewableGen, FixedOutput}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + model::DeviceModel{<:PSY.RenewableGen, FixedOutput}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) # FixedOutput doesn't add any constraints to the model. This function covers # AbstractPowerModel and AbtractActivePowerModel diff --git a/src/devices_models/device_constructors/thermalgeneration_constructor.jl b/src/devices_models/device_constructors/thermalgeneration_constructor.jl index d765d68ebc..c4378e8ffb 100644 --- a/src/devices_models/device_constructors/thermalgeneration_constructor.jl +++ b/src/devices_models/device_constructors/thermalgeneration_constructor.jl @@ -3,7 +3,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, device_model::DeviceModel{T, FixedOutput}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(device_model, "filter_function")) @@ -23,8 +23,8 @@ function construct_device!( ::OptimizationContainer, ::PSY.System, ::ModelConstructStage, - ::DeviceModel{<: PSY.ThermalGen, FixedOutput}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + ::DeviceModel{<:PSY.ThermalGen, FixedOutput}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) # FixedOutput doesn't add any constraints to the model. This function covers # AbstractPowerModel and AbtractActivePowerModel @@ -39,7 +39,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, D}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where { T <: PSY.ThermalGen, D <: AbstractStandardUnitCommitment, @@ -104,13 +104,9 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{T, D}, - network_model::NetworkModel{S}, -) where { - T <: PSY.ThermalGen, - D <: AbstractStandardUnitCommitment, - S <: PM.AbstractPowerModel, -} + model::DeviceModel{T, <:AbstractStandardUnitCommitment}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -144,7 +140,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -157,7 +153,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, D}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen, D <: AbstractStandardUnitCommitment} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -211,12 +207,9 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{T, <: AbstractStandardUnitCommitment}, - network_model::NetworkModel{S}, -) where { - T <: PSY.ThermalGen, - S <: PM.AbstractActivePowerModel, -} + model::DeviceModel{T, <:AbstractStandardUnitCommitment}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) add_constraints!( @@ -242,7 +235,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return @@ -256,7 +249,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, ThermalBasicUnitCommitment}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -317,8 +310,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, ThermalBasicUnitCommitment}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractPowerModel} + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -351,7 +344,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -364,8 +357,8 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, ThermalBasicUnitCommitment}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractActivePowerModel} + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -416,8 +409,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, ThermalBasicUnitCommitment}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractActivePowerModel} + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -442,7 +435,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -455,7 +448,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, ThermalStandardDispatch}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -513,8 +506,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, ThermalStandardDispatch}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractPowerModel} + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -547,7 +540,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -560,7 +553,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, ThermalStandardDispatch}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -609,8 +602,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, ThermalStandardDispatch}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractActivePowerModel} + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -635,7 +628,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -645,7 +638,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, D}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where { T <: PSY.ThermalGen, D <: AbstractThermalDispatchFormulation, @@ -700,12 +693,9 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{T, <: AbstractThermalDispatchFormulation}, - network_model::NetworkModel{S}, -) where { - T <: PSY.ThermalGen, - S <: PM.AbstractPowerModel, -} + model::DeviceModel{T, <:AbstractThermalDispatchFormulation}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -737,7 +727,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -747,7 +737,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, D}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where { T <: PSY.ThermalGen, D <: AbstractThermalDispatchFormulation, @@ -793,12 +783,9 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{T, <: AbstractThermalDispatchFormulation}, - network_model::NetworkModel{S}, -) where { - T <: PSY.ThermalGen, - S <: PM.AbstractActivePowerModel, -} + model::DeviceModel{T, <:AbstractThermalDispatchFormulation}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -821,7 +808,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) return end @@ -830,7 +817,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{PSY.ThermalMultiStart, ThermalMultiStartUnitCommitment}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) devices = get_available_components(PSY.ThermalMultiStart, sys) @@ -913,8 +900,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{PSY.ThermalMultiStart, ThermalMultiStartUnitCommitment}, - network_model::NetworkModel{S}, -) where {S <: PM.AbstractPowerModel} + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) devices = get_available_components(PSY.ThermalMultiStart, sys) add_constraints!( @@ -964,7 +951,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -974,7 +961,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{PSY.ThermalMultiStart, ThermalMultiStartUnitCommitment}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) devices = get_available_components(PSY.ThermalMultiStart, sys) @@ -1041,8 +1028,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{PSY.ThermalMultiStart, ThermalMultiStartUnitCommitment}, - network_model::NetworkModel{S}, -) where {S <: PM.AbstractActivePowerModel} + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) devices = get_available_components(PSY.ThermalMultiStart, sys) initial_conditions!(container, devices, ThermalMultiStartUnitCommitment()) @@ -1086,7 +1073,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -1096,7 +1083,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, ThermalCompactUnitCommitment}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1168,8 +1155,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, ThermalCompactUnitCommitment}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractPowerModel} + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1204,7 +1191,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -1214,7 +1201,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, ThermalCompactUnitCommitment}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1279,8 +1266,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, ThermalCompactUnitCommitment}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractActivePowerModel} + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1307,7 +1294,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -1317,7 +1304,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, ThermalBasicCompactUnitCommitment}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1387,8 +1374,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, ThermalBasicCompactUnitCommitment}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractPowerModel} + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1421,7 +1408,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -1431,7 +1418,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, ThermalBasicCompactUnitCommitment}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1494,8 +1481,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, ThermalBasicCompactUnitCommitment}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractActivePowerModel} + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1520,7 +1507,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -1530,7 +1517,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, ThermalCompactDispatch}, - network_model::NetworkModel{<: PM.AbstractPowerModel}, + network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1614,8 +1601,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, ThermalCompactDispatch}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractPowerModel} + network_model::NetworkModel{<:PM.AbstractPowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1648,7 +1635,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end @@ -1658,7 +1645,7 @@ function construct_device!( sys::PSY.System, ::ArgumentConstructStage, model::DeviceModel{T, ThermalCompactDispatch}, - network_model::NetworkModel{<: PM.AbstractActivePowerModel}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1717,8 +1704,8 @@ function construct_device!( sys::PSY.System, ::ModelConstructStage, model::DeviceModel{T, ThermalCompactDispatch}, - network_model::NetworkModel{S}, -) where {T <: PSY.ThermalGen, S <: PM.AbstractActivePowerModel} + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) where {T <: PSY.ThermalGen} devices = get_available_components(T, sys, get_attribute(model, "filter_function")) @@ -1743,7 +1730,7 @@ function construct_device!( add_feedforward_constraints!(container, model, devices) - objective_function!(container, devices, model, S) + objective_function!(container, devices, model, typeof(network_model).parameters[1]) add_constraint_dual!(container, sys, model) return end