Skip to content

Commit

Permalink
fix input definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Sep 19, 2023
1 parent 245977e commit ce88b23
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/devices_models/devices/TwoTerminalDC_branches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ end

function _add_hvdc_flow_constraints!(
container::OptimizationContainer,
devices::Vector{T},
devices::Union{Vector{T}, IS.FlattenIteratorWrapper{T}},
constraint::FlowRateConstraintFromTo,
) where {T <: PSY.TwoTerminalHVDCLine}
_add_hvdc_flow_constraints!(
Expand All @@ -203,7 +203,7 @@ end

function _add_hvdc_flow_constraints!(
container::OptimizationContainer,
devices::Vector{T},
devices::Union{Vector{T}, IS.FlattenIteratorWrapper{T}},
constraint::FlowRateConstraintToFrom,
) where {T <: PSY.TwoTerminalHVDCLine}
_add_hvdc_flow_constraints!(
Expand All @@ -225,9 +225,9 @@ function _add_hvdc_flow_constraints!(

variable = get_variable(container, var, T)
constraint_ub =
add_constraints_container!(container, constraint, U, names, time_steps; meta = "ub")
add_constraints_container!(container, constraint, T, names, time_steps; meta = "ub")
constraint_lb =
add_constraints_container!(container, constraint, U, names, time_steps; meta = "lb")
add_constraints_container!(container, constraint, T, names, time_steps; meta = "lb")
for d in devices
min_rate, max_rate = PSY.get_active_power_limits_from(d)
for t in time_steps
Expand Down Expand Up @@ -274,21 +274,12 @@ function add_constraints!(
devices::IS.FlattenIteratorWrapper{U},
::DeviceModel{U, HVDCTwoTerminalDispatch},
::NetworkModel{<:PM.AbstractDCPModel},
) where {T <: FlowRateConstraintFromTo, U <: PSY.TwoTerminalHVDCLine}
_add_hvdc_flow_constraints!(container, devices, FlowActivePowerFromToVariable())
) where {T <: Union{FlowRateConstraintToFrom, FlowRateConstraintFromTo},
U <: PSY.TwoTerminalHVDCLine}
_add_hvdc_flow_constraints!(container, devices, T())
return
end

function add_constraints!(
container::OptimizationContainer,
::Type{T},
devices::IS.FlattenIteratorWrapper{U},
::DeviceModel{U, HVDCTwoTerminalDispatch},
::NetworkModel{<:PM.AbstractDCPModel},
) where {T <: FlowRateConstraintToFrom, U <: PSY.TwoTerminalHVDCLine}
_add_hvdc_flow_constraints!(container, devices, FlowActivePowerToFromVariable())
return
end

function add_constraints!(
container::OptimizationContainer,
Expand Down

0 comments on commit ce88b23

Please sign in to comment.