Skip to content

Commit

Permalink
REF: stochastic formulation to get the same power on all versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjospina committed Sep 16, 2024
1 parent a64539c commit db11a1d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ function instantiate_model_decomposition(
master_boundary_vars_vector = Vector{Vector{Vector{JuMP.VariableRef}}}(undef, number_of_subproblems)

# Threaded loop for instantiating subproblems
Threads.@threads for i in 1:1:number_of_subproblems # faster but causes +RAM usage
# for i in 1:1:number_of_subproblems
# Threads.@threads for i in 1:1:number_of_subproblems # faster but causes +RAM usage
for i in 1:1:number_of_subproblems
ckt_name = ckts_names_vector[i]
ckt_data = ckts_data_vector[i]

Expand Down Expand Up @@ -492,8 +492,8 @@ function instantiate_model_decomposition(
boundary_vars_vector = Vector{Vector{Vector{JuMP.VariableRef}}}(undef, number_of_subproblems)

# Threaded loop for instantiating subproblems
Threads.@threads for i in 1:1:number_of_subproblems # faster but causes +RAM usage
# for i in 1:number_of_subproblems
# Threads.@threads for i in 1:1:number_of_subproblems # faster but causes +RAM usage
for i in 1:number_of_subproblems
ckt_name = ckts_names_vector[i]
ckt_data = ckts_data_vector[i]

Expand Down
23 changes: 23 additions & 0 deletions src/form_decomposition/acp_stochastic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,26 @@ function constraint_transmission_power_balance_stochastic(pm::_PM.AbstractACPMod
end

end


function constraint_transmission_boundary_power_scaled_equalization_stochastic(pm::_PM.AbstractACPModel, i::Int; nw::Int=nw_id_default)

boundary = _PM.ref(pm, nw, :boundary, i)
f_bus = boundary["f_bus"] # convention: from bus Transmission always!
t_bus = boundary["t_bus"] # convention: to bus Distribution always!

# Original (1st real connection to transmission)
f_idx_org = (100001, f_bus, t_bus)
pbound_load_scaled_org = _PM.var(pm, nw, :pbound_load_scaled, f_idx_org)
qbound_load_scaled_org = _PM.var(pm, nw, :qbound_load_scaled, f_idx_org)

# Pbound_load vars
f_idx = (i, f_bus, t_bus)
pbound_load_scaled = _PM.var(pm, nw, :pbound_load_scaled, f_idx)
qbound_load_scaled = _PM.var(pm, nw, :qbound_load_scaled, f_idx)

# Add scaling constraint
JuMP.@constraint(pm.model, pbound_load_scaled[1] == pbound_load_scaled_org[1])
JuMP.@constraint(pm.model, qbound_load_scaled[1] == qbound_load_scaled_org[1])

end
1 change: 1 addition & 0 deletions src/prob/opfitd_decomposition_stochastic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function build_opfitd_decomposition_stochastic(pm_model::_PM.AbstractPowerModel)
# Boundary constraints
for i in _PM.ids(pm_model, :boundary)
constraint_transmission_boundary_power_shared_vars_scaled(pm_model, i)
constraint_transmission_boundary_power_scaled_equalization_stochastic(pm_model, i)
end

# PM cost function
Expand Down

0 comments on commit db11a1d

Please sign in to comment.