diff --git a/src/core/auxiliary_variables.jl b/src/core/auxiliary_variables.jl index c2baca4288..c4fc29faad 100644 --- a/src/core/auxiliary_variables.jl +++ b/src/core/auxiliary_variables.jl @@ -13,4 +13,18 @@ Auxiliary Variable for Thermal Generation Models that solve for power above min """ struct PowerOutput <: AuxVariableType end +""" +Auxiliary Variable of DC Current Variables for DC Lines formulations + +Docs abbreviation: ``i_l^{dc}`` +""" +struct DCLineCurrent <: AuxVariableType end + +""" +Auxiliary Variable of DC Current Variables for DC Lines formulations + +Docs abbreviation: ``p_l^{loss}`` +""" +struct DCLineLosses <: AuxVariableType end + convert_result_to_natural_units(::Type{PowerOutput}) = true diff --git a/src/core/formulations.jl b/src/core/formulations.jl index 019b7f5b0f..2764fa0dc6 100644 --- a/src/core/formulations.jl +++ b/src/core/formulations.jl @@ -163,7 +163,7 @@ struct LossLessLine <: AbstractBranchFormulation end """ DC Loss Line Abstract Model """ -struct DCLossLine <: AbstractBranchFormulation end +struct DCLossyLine <: AbstractBranchFormulation end ############################## Network Model Formulations ################################## # These formulations are taken directly from PowerModels diff --git a/src/core/variables.jl b/src/core/variables.jl index 42d5bc0560..3ef58aa05b 100644 --- a/src/core/variables.jl +++ b/src/core/variables.jl @@ -168,6 +168,118 @@ Docs abbreviation: ``\\theta`` """ struct VoltageAngle <: VariableType end +""" +Struct to dispatch the creation of Voltage Variables for DC formulations + +Docs abbreviation: ``v^{dc}`` +""" +struct DCVoltage <: VariableType end + +""" +Struct to dispatch the creation of Squared Voltage Variables for DC formulations + +Docs abbreviation: ``v^{sq,dc}`` +""" +struct SquaredDCVoltage <: VariableType end + +""" +Struct to dispatch the creation of DC Converter Current Variables for DC formulations + +Docs abbreviation: ``i_c^{dc}`` +""" +struct ConverterCurrent <: VariableType end + +""" +Struct to dispatch the creation of Squared DC Converter Current Variables for DC formulations + +Docs abbreviation: ``i_c^{sq,dc}`` +""" +struct SquaredConverterCurrent <: VariableType end + +""" +Struct to dispatch the creation of DC Converter Positive Term Current Variables for DC formulations + +Docs abbreviation: ``i_c^{+,dc}`` +""" +struct ConverterPositiveCurrent <: VariableType end + +""" +Struct to dispatch the creation of DC Converter Negative Term Current Variables for DC formulations + +Docs abbreviation: ``i_c^{-,dc}`` +""" +struct ConverterNegativeCurrent <: VariableType end + +""" +Struct to dispatch the creation of DC Converter Binary for Absolute Value Current Variables for DC formulations + +Docs abbreviation: `\\nu_c`` +""" +struct ConverterBinaryAbsoluteValueCurrent <: VariableType end + +""" +Struct to dispatch the creation of Binary Variable for Converter Power Direction + +Docs abbreviation: ``\\kappa_c^{dc}`` +""" +struct ConverterPowerDirection <: VariableType end + +""" +Struct to dispatch the creation of Auxiliary Variable for Converter Bilinear term: v * i + +Docs abbreviation: ``\\gamma_c^{dc}`` +""" +struct AuxBilinearConverterVariable <: VariableType end + +""" +Struct to dispatch the creation of Auxiliary Variable for Squared Converter Bilinear term: v * i + +Docs abbreviation: ``\\gamma_c^{sq,dc}`` +""" +struct AuxBilinearSquaredConverterVariable <: VariableType end + +""" +Struct to dispatch the creation of Continuous Interpolation Variable for Squared Converter Voltage + +Docs abbreviation: ``\\delta_c^{v}`` +""" +struct InterpolationSquaredVoltageVariable <: VariableType end + +""" +Struct to dispatch the creation of Binary Interpolation Variable for Squared Converter Voltage + +Docs abbreviation: ``z_c^{v}`` +""" +struct InterpolationBinarySquaredVoltageVariable <: VariableType end + +""" +Struct to dispatch the creation of Continuous Interpolation Variable for Squared Converter Current + +Docs abbreviation: ``\\delta_c^{i}`` +""" +struct InterpolationSquaredCurrentVariable <: VariableType end + +""" +Struct to dispatch the creation of Binary Interpolation Variable for Squared Converter Current + +Docs abbreviation: ``z_c^{i}`` +""" +struct InterpolationBinarySquaredCurrentVariable <: VariableType end + +""" +Struct to dispatch the creation of Continuous Interpolation Variable for Squared Converter AuxVar + +Docs abbreviation: ``\\delta_c^{\\gamma}`` +""" +struct InterpolationSquaredBilinearVariable <: VariableType end + +""" +Struct to dispatch the creation of Binary Interpolation Variable for Squared Converter AuxVar + +Docs abbreviation: ``z_c^{\\gamma}`` +""" +struct InterpolationBinarySquaredBilinearVariable <: VariableType end + """ Struct to dispatch the creation of bidirectional Active Power Flow Variables diff --git a/src/devices_models/device_constructors/hvdcsystems_constructor.jl b/src/devices_models/device_constructors/hvdcsystems_constructor.jl index 668b41f70e..f95f088640 100644 --- a/src/devices_models/device_constructors/hvdcsystems_constructor.jl +++ b/src/devices_models/device_constructors/hvdcsystems_constructor.jl @@ -39,6 +39,112 @@ function construct_device!( return end +function construct_device!( + container::OptimizationContainer, + sys::PSY.System, + ::ArgumentConstructStage, + model::DeviceModel{PSY.InterconnectingConverter, QuadraticLossConverter}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) + devices = get_available_components( + model, + sys, + ) + # Add Power Variable + add_variables!(container, ActivePowerVariable, devices, QuadraticLossConverter()) # p_c + add_variables!(container, ConverterPowerDirection, devices, QuadraticLossConverter()) #κ + # Add Current Variables: i, δ^i, z^i, i+, i- + add_variables!(container, ConverterCurrent, devices, QuadraticLossConverter()) # i + add_variables!(container, SquaredConverterCurrent, devices, QuadraticLossConverter()) # i^sq + add_variables!( + container, + InterpolationSquaredCurrentVariable, + devices, + QuadraticLossConverter(), + ) # δ^i + add_variables!( + container, + InterpolationBinarySquaredCurrentVariable, + devices, + QuadraticLossConverter(), + ) # z^i + add_variables!(container, ConverterPositiveCurrent, devices, QuadraticLossConverter()) # i^+ + add_variables!(container, ConverterNegativeCurrent, devices, QuadraticLossConverter()) # i^- + add_variables!( + container, + ConverterBinaryAbsoluteValueCurrent, + devices, + QuadraticLossConverter(), + ) # ν + # Add Voltage Variables: v^sq, δ^v, z^v + add_variables!(container, SquaredDCVoltage, devices, QuadraticLossConverter()) + add_variables!( + container, + InterpolationSquaredVoltageVariable, + devices, + QuadraticLossConverter(), + ) # δ^v + add_variables!( + container, + InterpolationBinarySquaredVoltageVariable, + devices, + QuadraticLossConverter(), + ) # z^v + # Add Bilinear Variables: γ, γ^{sq} + add_variables!( + container, + AuxBilinearConverterVariable, + devices, + QuadraticLossConverter(), + ) # γ + add_variables!( + container, + AuxBilinearSquaredConverterVariable, + devices, + QuadraticLossConverter(), + ) # γ^{sq} + add_variables!( + container, + InterpolationSquaredBilinearVariable, + devices, + QuadraticLossConverter(), + ) # δ^γ + add_variables!( + container, + InterpolationBinarySquaredBilinearVariable, + devices, + QuadraticLossConverter(), + ) # z^γ + add_to_expression!( + container, + ActivePowerBalance, + ActivePowerVariable, + devices, + model, + network_model, + ) + add_feedforward_arguments!(container, model, devices) + return +end + +function construct_device!( + container::OptimizationContainer, + sys::PSY.System, + ::ModelConstructStage, + model::DeviceModel{PSY.InterconnectingConverter, QuadraticLossConverter}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) + devices = get_available_components( + model, + sys, + ) + # TODO Constraints + add_feedforward_constraints!(container, model, devices) + objective_function!(container, devices, model, get_network_formulation(network_model)) + add_constraint_dual!(container, sys, model) + return +end + function construct_device!( container::OptimizationContainer, sys::PSY.System, @@ -71,3 +177,35 @@ function construct_device!( ::NetworkModel{<:PM.AbstractActivePowerModel}, ) end + +function construct_device!( + container::OptimizationContainer, + sys::PSY.System, + ::ArgumentConstructStage, + model::DeviceModel{PSY.TModelHVDCLine, DCLossyLine}, + network_model::NetworkModel{<:PM.AbstractActivePowerModel}, +) + devices = get_available_components( + model, + sys, + ) + + dc_buses = PSY.get_components( + DCBus, + sys, + ) + add_variables!(container, DCVoltage, dc_buses, DCLossyLine()) + add_variables!(container, DCLineCurrent, devices, DCLossyLine()) + add_variables!(container, DCLineLosses, devices, DCLossyLine()) + add_feedforward_arguments!(container, model, devices) + return +end + +function construct_device!( + ::OptimizationContainer, + sys::PSY.System, + ::ModelConstructStage, + model::DeviceModel{PSY.TModelHVDCLine, LossLessLine}, + ::NetworkModel{<:PM.AbstractActivePowerModel}, +) +end