Skip to content
Snippets Groups Projects
Commit e9f891ea authored by Julian Stürmer's avatar Julian Stürmer
Browse files

Add NLsolve as method for power flow calculation

parent 73423502
No related branches found
No related tags found
No related merge requests found
......@@ -53,12 +53,19 @@ end
Calculates the AC power flow solution for the given NDD and updates it in the NDD.
CAUTION: Overwrites any previous AC solution contained in the NDD!
=#
function calc_ac_pf!(network_data::Dict{String,<:Any})
### Calculate AC-PF solution using PowerModels.jl and Ipopt
pf_result = run_ac_pf(
network_data,
optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0)
)
function calc_ac_pf!(network_data::Dict{String,<:Any}, method=:JuMP)
if method == :JuMP # calculate AC-PF solution using a JuMP model
pf_result = run_ac_pf(
network_data,
optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0)
)
elseif method == :NLsolve # calculate AC-PF solution using NLsolve.jl
pf_result = Dict{String,Any}()
pf_result["solution"] = compute_ac_pf(network_data)
else
throw(ArgumentError("Unknown method $method."))
end
update_pf_data!(network_data, pf_result, model=:ac) # update PF in NDD
return network_data
end
......@@ -121,8 +128,7 @@ function calc_branchloads!(network_data::Dict{String,<:Any}; model=:ac)
end
update_data!(network_data, branchloads) # add branchloads to NDD
return branchloads
return nothing
end
#*------------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment