From 46ccb066f03858e8c41a9288c3dff9e295262a0b Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Mon, 28 Oct 2024 17:22:47 -0700 Subject: [PATCH] update name to VSC loss --- src/core/constraints.jl | 15 +++++++++++++ src/core/definitions.jl | 1 + src/core/formulations.jl | 2 +- .../device_constructors/branch_constructor.jl | 22 +++++++++++++------ .../devices/common/add_to_expression.jl | 4 ++-- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/core/constraints.jl b/src/core/constraints.jl index 8cecdfacd..2cc8931ab 100644 --- a/src/core/constraints.jl +++ b/src/core/constraints.jl @@ -454,3 +454,18 @@ The specified constraints are formulated as: ``` """ struct ConverterMcCormickEnvelopes <: ConstraintType end + +""" +Struct to create the Quadratic PWL interpolation constraints that decide square value of the voltage. +For more information check [Converter Formulations](@ref PowerSystems.Converter-Formulations). +The specified constraints are formulated as: +```math +\\begin{align*} +& p_c >= V^{min} i_c + v_c I^{min} - I^{min}V^{min}, \\quad \\forall t \\in \\{1,\\dots, T\\} \\\\ +& p_c >= V^{max} i_c + v_c I^{max} - I^{max}V^{max}, \\quad \\forall t \\in \\{1,\\dots, T\\} \\\\ +& p_c <= V^{max} i_c + v_c I^{min} - I^{min}V^{max}, \\quad \\forall t \\in \\{1,\\dots, T\\} \\\\ +& p_c <= V^{min} i_c + v_c I^{max} - I^{max}V^{min}, \\quad \\forall t \\in \\{1,\\dots, T\\} \\\\ +\\end{align*} +``` +""" +struct InterpolationVoltageConstraints <: ConstraintType end diff --git a/src/core/definitions.jl b/src/core/definitions.jl index 8e1291ddb..e6bc76347 100644 --- a/src/core/definitions.jl +++ b/src/core/definitions.jl @@ -65,6 +65,7 @@ const OBJECTIVE_FUNCTION_NEGATIVE = -1.0 const INITIALIZATION_PROBLEM_HORIZON_COUNT = 3 # The DEFAULT_RESERVE_COST value is used to avoid degeneracy of the solutions, reserve cost isn't provided. const DEFAULT_RESERVE_COST = 1.0 +const DEFAULT_INTERPOLATION_LENGTH = 4 const KiB = 1024 const MiB = KiB * KiB const GiB = MiB * KiB diff --git a/src/core/formulations.jl b/src/core/formulations.jl index 112aa2b2d..dc4e9d055 100644 --- a/src/core/formulations.jl +++ b/src/core/formulations.jl @@ -141,7 +141,7 @@ struct HVDCTwoTerminalPiecewiseLoss <: AbstractTwoTerminalDCLineFormulation end """ Branch type to represent physical lossy model on two terminal DC lines """ -struct HVDCTwoTerminalPhysicalLoss <: AbstractTwoTerminalDCLineFormulation end +struct HVDCTwoTerminalVSCLoss <: AbstractTwoTerminalDCLineFormulation end # Not Implemented # struct VoltageSourceDC <: AbstractTwoTerminalDCLineFormulation end diff --git a/src/devices_models/device_constructors/branch_constructor.jl b/src/devices_models/device_constructors/branch_constructor.jl index 946f85858..fa1288508 100644 --- a/src/devices_models/device_constructors/branch_constructor.jl +++ b/src/devices_models/device_constructors/branch_constructor.jl @@ -903,7 +903,7 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ArgumentConstructStage, - model::DeviceModel{PSY.TwoTerminalHVDCDetailedLine, HVDCTwoTerminalPhysicalLoss}, + model::DeviceModel{PSY.TwoTerminalHVDCDetailedLine, HVDCTwoTerminalVSCLoss}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) devices = get_available_components(model, sys) @@ -911,7 +911,7 @@ function construct_device!( ##################### ##### Variables ##### ##################### - V = HVDCTwoTerminalPhysicalLoss + V = HVDCTwoTerminalVSCLoss # Add Power Variable add_variables!(container, HVDCActivePowerReceivedFromVariable, devices, V()) # p_c^{ac,from} add_variables!(container, HVDCActivePowerReceivedToVariable, devices, V()) # p_c^{ac,from} @@ -921,6 +921,7 @@ function construct_device!( add_variables!(container, DCVoltageTo, devices, V()) # v_dc^{from} add_variables!(container, SquaredDCVoltageFrom, devices, V()) # v_dc^{sq, from} add_variables!(container, SquaredDCVoltageTo, devices, V()) # # v_dc^{sq, to} + #= add_variables!( container, InterpolationSquaredVoltageVariableFrom, @@ -932,7 +933,7 @@ function construct_device!( InterpolationSquaredVoltageVariableTo, devices, V(), - ) # δ^{v,to} + ) # δ^{v,to} add_variables!( container, InterpolationBinarySquaredVoltageVariableFrom, @@ -945,10 +946,12 @@ function construct_device!( devices, V(), ) # z^{v,to} + =# # Add Current Variables: i, δ^i, z^i, i+, i- add_variables!(container, ConverterCurrent, devices, V()) # i add_variables!(container, SquaredConverterCurrent, devices, V()) # i^sq + #= add_variables!( container, InterpolationSquaredCurrentVariable, @@ -961,8 +964,9 @@ function construct_device!( devices, V(), ) # z^i - add_variables!(container, ConverterPositiveCurrent, devices, V()) # i^+ - add_variables!(container, ConverterNegativeCurrent, devices, V()) # i^- + =# + #add_variables!(container, ConverterPositiveCurrent, devices, V()) # i^+ + #add_variables!(container, ConverterNegativeCurrent, devices, V()) # i^- add_variables!( container, ConverterBinaryAbsoluteValueCurrent, @@ -983,6 +987,7 @@ function construct_device!( devices, V(), ) # γ^{sq,from} + #= add_variables!( container, InterpolationSquaredBilinearVariableFrom, @@ -995,7 +1000,7 @@ function construct_device!( devices, V(), ) # z^{γ,from} - + =# add_variables!( container, AuxBilinearConverterVariableTo, @@ -1008,6 +1013,7 @@ function construct_device!( devices, V(), ) # γ^{sq,to} + #= add_variables!( container, InterpolationSquaredBilinearVariableTo, @@ -1020,6 +1026,8 @@ function construct_device!( devices, V(), ) # z^{γ,to} + =# + _add_sparse_pwl_interpolation_variables!(container, devices, model) ##################### #### Expressions #### @@ -1052,7 +1060,7 @@ function construct_device!( container::OptimizationContainer, sys::PSY.System, ::ModelConstructStage, - model::DeviceModel{PSY.TwoTerminalHVDCDetailedLine, HVDCTwoTerminalPhysicalLoss}, + model::DeviceModel{PSY.TwoTerminalHVDCDetailedLine, HVDCTwoTerminalVSCLoss}, network_model::NetworkModel{<:PM.AbstractActivePowerModel}, ) devices = get_available_components(model, sys) diff --git a/src/devices_models/devices/common/add_to_expression.jl b/src/devices_models/devices/common/add_to_expression.jl index 7bdedca7b..16c1e23ba 100644 --- a/src/devices_models/devices/common/add_to_expression.jl +++ b/src/devices_models/devices/common/add_to_expression.jl @@ -393,7 +393,7 @@ function add_to_expression!( T <: ActivePowerBalance, U <: HVDCActivePowerReceivedFromVariable, V <: TwoTerminalHVDCTypes, - W <: Union{HVDCTwoTerminalPiecewiseLoss, HVDCTwoTerminalPhysicalLoss}, + W <: Union{HVDCTwoTerminalPiecewiseLoss, HVDCTwoTerminalVSCLoss}, X <: AbstractPTDFModel, } var = get_variable(container, U(), V) @@ -430,7 +430,7 @@ function add_to_expression!( T <: ActivePowerBalance, U <: HVDCActivePowerReceivedToVariable, V <: TwoTerminalHVDCTypes, - W <: Union{HVDCTwoTerminalPiecewiseLoss, HVDCTwoTerminalPhysicalLoss}, + W <: Union{HVDCTwoTerminalPiecewiseLoss, HVDCTwoTerminalVSCLoss}, X <: AbstractPTDFModel, } var = get_variable(container, U(), V)