Skip to content
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

Fix HVDC Lossless model bug in Copperplate network #1241

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/devices_models/devices/AC_branches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ function add_variables!(
ref_bus_to = get_reference_bus(network_model, PSY.get_arc(d).to)
if ref_bus_from != ref_bus_to
push!(inter_network_branches, d)
else
@warn(
"HVDC Line $(PSY.get_name(d)) is in the same subnetwork, so the line will not be modeled."
)
end
end
if !isempty(inter_network_branches)
Expand Down
41 changes: 41 additions & 0 deletions src/devices_models/devices/TwoTerminalDC_branches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,47 @@ function add_constraints!(
return
end

function add_constraints!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we doing this? If its copper plate it should be no-opt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we model HVDC lines in different subnetworks right? Copperplate balance for each subnetwork using the ref buses, so we want to model HVDC lines between different subnetworks.

container::OptimizationContainer,
::Type{T},
devices::Union{Vector{U}, IS.FlattenIteratorWrapper{U}},
::DeviceModel{U, HVDCTwoTerminalLossless},
network_model::NetworkModel{CopperPlatePowerModel},
) where {T <: FlowRateConstraint, U <: PSY.TwoTerminalHVDCLine}
time_steps = get_time_steps(container)
names = String[]
modeled_devices = U[]

for d in devices
ref_bus_from = get_reference_bus(network_model, PSY.get_arc(d).from)
ref_bus_to = get_reference_bus(network_model, PSY.get_arc(d).to)
if ref_bus_from != ref_bus_to
push!(names, PSY.get_name(d))
push!(modeled_devices, d)
end
end

var = get_variable(container, FlowActivePowerVariable(), U)
constraint_ub =
add_constraints_container!(container, T(), U, names, time_steps; meta = "ub")
constraint_lb =
add_constraints_container!(container, T(), U, names, time_steps; meta = "lb")
for d in modeled_devices
min_rate, max_rate = _get_flow_bounds(d)
for t in time_steps
constraint_ub[PSY.get_name(d), t] = JuMP.@constraint(
get_jump_model(container),
var[PSY.get_name(d), t] <= max_rate
)
constraint_lb[PSY.get_name(d), t] = JuMP.@constraint(
get_jump_model(container),
min_rate <= var[PSY.get_name(d), t]
)
end
end
return
end

function _add_hvdc_flow_constraints!(
container::OptimizationContainer,
devices::Union{Vector{T}, IS.FlattenIteratorWrapper{T}},
Expand Down
Loading