Skip to content

Commit

Permalink
update name to VSC loss
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomha committed Oct 29, 2024
1 parent fdd267d commit 46ccb06
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
15 changes: 15 additions & 0 deletions src/core/constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/core/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/formulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 15 additions & 7 deletions src/devices_models/device_constructors/branch_constructor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -903,15 +903,15 @@ 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)

#####################
##### 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}
Expand All @@ -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,
Expand All @@ -932,7 +933,7 @@ function construct_device!(
InterpolationSquaredVoltageVariableTo,
devices,
V(),
) # δ^{v,to}
) # δ^{v,to}
add_variables!(
container,
InterpolationBinarySquaredVoltageVariableFrom,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -983,6 +987,7 @@ function construct_device!(
devices,
V(),
) # γ^{sq,from}
#=
add_variables!(
container,
InterpolationSquaredBilinearVariableFrom,
Expand All @@ -995,7 +1000,7 @@ function construct_device!(
devices,
V(),
) # z^{γ,from}

=#
add_variables!(
container,
AuxBilinearConverterVariableTo,
Expand All @@ -1008,6 +1013,7 @@ function construct_device!(
devices,
V(),
) # γ^{sq,to}
#=
add_variables!(
container,
InterpolationSquaredBilinearVariableTo,
Expand All @@ -1020,6 +1026,8 @@ function construct_device!(
devices,
V(),
) # z^{γ,to}
=#
_add_sparse_pwl_interpolation_variables!(container, devices, model)

#####################
#### Expressions ####
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/devices_models/devices/common/add_to_expression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 46ccb06

Please sign in to comment.