-
Notifications
You must be signed in to change notification settings - Fork 1
Update MT-HVDC quadratic converter model #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
35145a8
b39c63d
b745791
4c8c8fe
abbc792
baa0288
f0a590a
79200d9
046c508
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -718,6 +718,45 @@ function add_to_expression!( | |
| return | ||
| end | ||
|
|
||
| # A VSC terminal can inject or consume Q freely, so the variable enters | ||
| # `ReactivePowerBalance` as a signed injection (+1.0) rather than a load (−1.0). | ||
| # Side selection picks the from- or to-terminal bus via dispatch on the | ||
| # variable type, so the body is written once. | ||
| _vsc_q_terminal_bus(d, ::Type{HVDCReactivePowerFromVariable}) = PSY.get_arc(d).from | ||
| _vsc_q_terminal_bus(d, ::Type{HVDCReactivePowerToVariable}) = PSY.get_arc(d).to | ||
|
|
||
| function add_to_expression!( | ||
| container::OptimizationContainer, | ||
| ::Type{T}, | ||
| ::Type{U}, | ||
| devices::IS.FlattenIteratorWrapper{V}, | ||
| ::DeviceModel{V, W}, | ||
| network_model::NetworkModel{X}, | ||
| ) where { | ||
| T <: ReactivePowerBalance, | ||
| U <: Union{HVDCReactivePowerFromVariable, HVDCReactivePowerToVariable}, | ||
| V <: PSY.TwoTerminalVSCLine, | ||
| W <: AbstractTwoTerminalVSCFormulation, | ||
| X <: ACPPowerModel, | ||
| } | ||
| var = get_variable(container, U, V) | ||
| nodal_expr = get_expression(container, T, PSY.ACBus) | ||
| network_reduction = get_network_reduction(network_model) | ||
| time_steps = get_time_steps(container) | ||
| for d in devices | ||
| name = PSY.get_name(d) | ||
| bus_no = PNM.get_mapped_bus_number( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little surprised to see this
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LCC does something similar.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is needed for network reductions I think |
||
| network_reduction, _vsc_q_terminal_bus(d, U), | ||
| ) | ||
| for t in time_steps | ||
| add_proportional_to_jump_expression!( | ||
| nodal_expr[bus_no, t], var[name, t], 1.0, | ||
| ) | ||
| end | ||
| end | ||
| return | ||
| end | ||
|
|
||
| """ | ||
| PWL implementation to add FromTo branch variables to SystemBalanceExpressions | ||
| """ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Helpers for variables/constraints that should only appear when the network | ||
| # model actually represents the relevant physical quantity (e.g. reactive | ||
| # power on AC networks). Each helper has a no-op method that dispatches on | ||
| # `NetworkModel{<:AbstractActivePowerModel}`; Julia's method resolution picks | ||
| # the more specific no-op over the AC body for DC formulations. | ||
|
|
||
| """ | ||
| Add reactive-power variables for a device and register them in the system's | ||
| `ReactivePowerBalance` expression. `var_types` is a tuple/iterable of | ||
| `VariableType` subtypes; each is added via `add_variables!` and then linked | ||
| into `ReactivePowerBalance` via `add_to_expression!`. The caller's | ||
| device-specific `add_to_expression!` methods are responsible for the actual | ||
| bus mapping and sign convention. | ||
| """ | ||
| function _maybe_add_reactive_power_variables!( | ||
| container::OptimizationContainer, | ||
| devices, | ||
| model::DeviceModel{D, F}, | ||
| network_model::NetworkModel{<:AbstractPowerModel}, | ||
| var_types, | ||
| ) where {D <: PSY.Device, F} | ||
| for V in var_types | ||
| add_variables!(container, V, devices, F) | ||
| add_to_expression!( | ||
| container, ReactivePowerBalance, V, devices, model, network_model, | ||
| ) | ||
| end | ||
| return | ||
| end | ||
|
|
||
| _maybe_add_reactive_power_variables!( | ||
| ::OptimizationContainer, | ||
| _devices, | ||
| ::DeviceModel{D, F}, | ||
| ::NetworkModel{<:AbstractActivePowerModel}, | ||
| _var_types, | ||
| ) where {D <: PSY.Device, F} = nothing | ||
|
|
||
| """ | ||
| Add a reactive-power-related constraint for a device on AC networks. | ||
| """ | ||
| function _maybe_add_reactive_power_constraints!( | ||
| container::OptimizationContainer, | ||
| devices, | ||
| model::DeviceModel{D, F}, | ||
| network_model::NetworkModel{<:AbstractPowerModel}, | ||
| constraint_type::Type{<:ConstraintType}, | ||
| ) where {D <: PSY.Device, F} | ||
| add_constraints!(container, constraint_type, devices, model, network_model) | ||
| return | ||
| end | ||
|
|
||
| _maybe_add_reactive_power_constraints!( | ||
| ::OptimizationContainer, | ||
| _devices, | ||
| ::DeviceModel{D, F}, | ||
| ::NetworkModel{<:AbstractActivePowerModel}, | ||
| ::Type{<:ConstraintType}, | ||
| ) where {D <: PSY.Device, F} = nothing |
Uh oh!
There was an error while loading. Please reload this page.