From 5662db18283073521339d1a5987fa5965b990574 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Tue, 6 Aug 2024 13:03:28 -0600 Subject: [PATCH] formatter --- .../device_constructors/branch_constructor.jl | 39 +++------ .../renewablegeneration_constructor.jl | 18 ++-- .../thermalgeneration_constructor.jl | 87 +++++++------------ 3 files changed, 48 insertions(+), 96 deletions(-) diff --git a/src/devices_models/device_constructors/branch_constructor.jl b/src/devices_models/device_constructors/branch_constructor.jl index 92b8b1b6a4..87546cfe9d 100644 --- a/src/devices_models/device_constructors/branch_constructor.jl +++ b/src/devices_models/device_constructors/branch_constructor.jl @@ -326,8 +326,7 @@ function construct_device!( model::DeviceModel{T, StaticBranchBounds}, network_model::NetworkModel{<:AbstractPTDFModel}, ) where {T <: PSY.ACBranch} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!(container, NetworkFlowConstraint, devices, model, network_model) branch_rate_bounds!( container, @@ -347,8 +346,7 @@ function construct_device!( model::DeviceModel{T, StaticBranchUnbounded}, network_model::NetworkModel{<:AbstractPTDFModel}, ) where {T <: PSY.ACBranch} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!( container, FlowActivePowerVariable, @@ -367,8 +365,7 @@ function construct_device!( model::DeviceModel{T, StaticBranchUnbounded}, network_model::NetworkModel{<:AbstractPTDFModel}, ) where {T <: PSY.ACBranch} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_feedforward_constraints!(container, model, devices) add_constraints!(container, NetworkFlowConstraint, devices, model, network_model) add_constraint_dual!(container, sys, model) @@ -405,8 +402,7 @@ function construct_device!( model::DeviceModel{T, StaticBranch}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ACBranch} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) branch_rate_bounds!(container, devices, model, network_model) add_feedforward_constraints!(container, model, devices) add_constraints!(container, RateLimitConstraintFromTo, devices, model, network_model) @@ -553,8 +549,7 @@ function construct_device!( model::DeviceModel{T, HVDCTwoTerminalUnbounded}, network_model::NetworkModel{<:AbstractPTDFModel}, ) where {T <: TwoTerminalHVDCTypes} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, FlowActivePowerVariable, devices, HVDCTwoTerminalUnbounded()) add_to_expression!( container, @@ -596,8 +591,7 @@ function construct_device!( model::DeviceModel{T, HVDCTwoTerminalLossless}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: TwoTerminalHVDCTypes} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!(container, FlowRateConstraint, devices, model, network_model) add_constraint_dual!(container, sys, model) return @@ -611,8 +605,7 @@ function construct_device!( model::DeviceModel{T, HVDCTwoTerminalLossless}, network_model::NetworkModel{<:AbstractPTDFModel}, ) where {T <: TwoTerminalHVDCTypes} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, FlowActivePowerVariable, devices, HVDCTwoTerminalLossless()) add_to_expression!( container, @@ -635,8 +628,7 @@ function construct_device!( ) where { T <: TwoTerminalHVDCTypes, } - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!(container, FlowRateConstraint, devices, model, network_model) add_constraint_dual!(container, sys, model) return @@ -649,8 +641,7 @@ function construct_device!( model::DeviceModel{T, HVDCTwoTerminalDispatch}, network_model::NetworkModel{<:AbstractPTDFModel}, ) where {T <: TwoTerminalHVDCTypes} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!( container, FlowActivePowerToFromVariable, @@ -699,8 +690,7 @@ function construct_device!( model::DeviceModel{T, HVDCTwoTerminalDispatch}, network_model::NetworkModel{<:AbstractPTDFModel}, ) where {T <: TwoTerminalHVDCTypes} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!(container, FlowRateConstraintFromTo, devices, model, network_model) add_constraints!(container, FlowRateConstraintToFrom, devices, model, network_model) add_constraints!(container, HVDCPowerBalance, devices, model, network_model) @@ -715,8 +705,7 @@ function construct_device!( model::DeviceModel{T, HVDCTwoTerminalDispatch}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: TwoTerminalHVDCTypes} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!( container, FlowActivePowerToFromVariable, @@ -757,8 +746,7 @@ function construct_device!( model::DeviceModel{T, HVDCTwoTerminalDispatch}, network_model::NetworkModel{CopperPlatePowerModel}, ) where {T <: TwoTerminalHVDCTypes} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) @warn "CopperPlatePowerModel models with HVDC ignores inter-area losses" add_constraints!(container, FlowRateConstraintFromTo, devices, model, network_model) add_constraints!(container, FlowRateConstraintToFrom, devices, model, network_model) @@ -773,8 +761,7 @@ function construct_device!( model::DeviceModel{T, HVDCTwoTerminalDispatch}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: TwoTerminalHVDCTypes} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!(container, FlowRateConstraintFromTo, devices, model, network_model) add_constraints!(container, FlowRateConstraintToFrom, devices, model, network_model) add_constraints!(container, HVDCPowerBalance, devices, model, network_model) diff --git a/src/devices_models/device_constructors/renewablegeneration_constructor.jl b/src/devices_models/device_constructors/renewablegeneration_constructor.jl index 7c05d30ceb..10939d52ea 100644 --- a/src/devices_models/device_constructors/renewablegeneration_constructor.jl +++ b/src/devices_models/device_constructors/renewablegeneration_constructor.jl @@ -8,8 +8,7 @@ function construct_device!( R <: PSY.RenewableGen, D <: AbstractRenewableDispatchFormulation, } - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, ActivePowerVariable, devices, D()) add_variables!(container, ReactivePowerVariable, devices, D()) @@ -62,8 +61,7 @@ function construct_device!( model::DeviceModel{R, <:AbstractRenewableDispatchFormulation}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {R <: PSY.RenewableGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) if has_service_model(model) add_constraints!( @@ -119,8 +117,7 @@ function construct_device!( R <: PSY.RenewableGen, D <: AbstractRenewableDispatchFormulation, } - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, ActivePowerVariable, devices, D()) @@ -164,8 +161,7 @@ function construct_device!( model::DeviceModel{R, <:AbstractRenewableDispatchFormulation}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {R <: PSY.RenewableGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) if has_service_model(model) add_constraints!( @@ -210,8 +206,7 @@ function construct_device!( model::DeviceModel{R, FixedOutput}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {R <: PSY.RenewableGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model) add_parameters!(container, ReactivePowerTimeSeriesParameter, devices, model) @@ -242,8 +237,7 @@ function construct_device!( model::DeviceModel{R, FixedOutput}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {R <: PSY.RenewableGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model) add_to_expression!( diff --git a/src/devices_models/device_constructors/thermalgeneration_constructor.jl b/src/devices_models/device_constructors/thermalgeneration_constructor.jl index f24d154b08..8831cd3aa4 100644 --- a/src/devices_models/device_constructors/thermalgeneration_constructor.jl +++ b/src/devices_models/device_constructors/thermalgeneration_constructor.jl @@ -5,8 +5,7 @@ function construct_device!( device_model::DeviceModel{T, FixedOutput}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_parameters!(container, ActivePowerTimeSeriesParameter, devices, device_model) add_to_expression!( container, @@ -44,8 +43,7 @@ function construct_device!( T <: PSY.ThermalGen, D <: AbstractStandardUnitCommitment, } - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, ActivePowerVariable, devices, D()) add_variables!(container, ReactivePowerVariable, devices, D()) @@ -107,8 +105,7 @@ function construct_device!( model::DeviceModel{T, <:AbstractStandardUnitCommitment}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -155,8 +152,7 @@ function construct_device!( model::DeviceModel{T, D}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen, D <: AbstractStandardUnitCommitment} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, ActivePowerVariable, devices, D()) add_variables!(container, OnVariable, devices, D()) @@ -210,8 +206,7 @@ function construct_device!( model::DeviceModel{T, <:AbstractStandardUnitCommitment}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, ActivePowerVariableLimitsConstraint, @@ -251,8 +246,7 @@ function construct_device!( model::DeviceModel{T, ThermalBasicUnitCommitment}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, ActivePowerVariable, devices, ThermalBasicUnitCommitment()) add_variables!(container, ReactivePowerVariable, devices, ThermalBasicUnitCommitment()) @@ -312,8 +306,7 @@ function construct_device!( model::DeviceModel{T, ThermalBasicUnitCommitment}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -359,8 +352,7 @@ function construct_device!( model::DeviceModel{T, ThermalBasicUnitCommitment}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, ActivePowerVariable, devices, ThermalBasicUnitCommitment()) add_variables!(container, OnVariable, devices, ThermalBasicUnitCommitment()) @@ -411,8 +403,7 @@ function construct_device!( model::DeviceModel{T, ThermalBasicUnitCommitment}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -450,8 +441,7 @@ function construct_device!( model::DeviceModel{T, ThermalStandardDispatch}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, ActivePowerVariable, devices, ThermalStandardDispatch()) add_variables!(container, ReactivePowerVariable, devices, ThermalStandardDispatch()) @@ -508,8 +498,7 @@ function construct_device!( model::DeviceModel{T, ThermalStandardDispatch}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -555,8 +544,7 @@ function construct_device!( model::DeviceModel{T, ThermalStandardDispatch}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, ActivePowerVariable, devices, ThermalStandardDispatch()) @@ -604,8 +592,7 @@ function construct_device!( model::DeviceModel{T, ThermalStandardDispatch}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -643,8 +630,7 @@ function construct_device!( T <: PSY.ThermalGen, D <: AbstractThermalDispatchFormulation, } - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, ActivePowerVariable, devices, D()) add_variables!(container, ReactivePowerVariable, devices, D()) @@ -696,8 +682,7 @@ function construct_device!( model::DeviceModel{T, <:AbstractThermalDispatchFormulation}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -742,8 +727,7 @@ function construct_device!( T <: PSY.ThermalGen, D <: AbstractThermalDispatchFormulation, } - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, ActivePowerVariable, devices, D()) @@ -786,8 +770,7 @@ function construct_device!( model::DeviceModel{T, <:AbstractThermalDispatchFormulation}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -1085,8 +1068,7 @@ function construct_device!( model::DeviceModel{T, ThermalCompactUnitCommitment}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!( container, @@ -1157,8 +1139,7 @@ function construct_device!( model::DeviceModel{T, ThermalCompactUnitCommitment}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -1203,8 +1184,7 @@ function construct_device!( model::DeviceModel{T, ThermalCompactUnitCommitment}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!( container, @@ -1268,8 +1248,7 @@ function construct_device!( model::DeviceModel{T, ThermalCompactUnitCommitment}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -1306,8 +1285,7 @@ function construct_device!( model::DeviceModel{T, ThermalBasicCompactUnitCommitment}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!( container, @@ -1376,8 +1354,7 @@ function construct_device!( model::DeviceModel{T, ThermalBasicCompactUnitCommitment}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -1420,8 +1397,7 @@ function construct_device!( model::DeviceModel{T, ThermalBasicCompactUnitCommitment}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!( container, @@ -1483,8 +1459,7 @@ function construct_device!( model::DeviceModel{T, ThermalBasicCompactUnitCommitment}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -1519,8 +1494,7 @@ function construct_device!( model::DeviceModel{T, ThermalCompactDispatch}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, PowerAboveMinimumVariable, devices, ThermalCompactDispatch()) add_variables!(container, ReactivePowerVariable, devices, ThermalCompactDispatch()) @@ -1603,8 +1577,7 @@ function construct_device!( model::DeviceModel{T, ThermalCompactDispatch}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container, @@ -1647,8 +1620,7 @@ function construct_device!( model::DeviceModel{T, ThermalCompactDispatch}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_variables!(container, PowerAboveMinimumVariable, devices, ThermalCompactDispatch()) @@ -1706,8 +1678,7 @@ function construct_device!( model::DeviceModel{T, ThermalCompactDispatch}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) where {T <: PSY.ThermalGen} - devices = - get_available_components(model, sys) + devices = get_available_components(model, sys) add_constraints!( container,