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

Add power flow model to build_network_data

parent 904e7196
No related branches found
No related tags found
No related merge requests found
......@@ -3,19 +3,25 @@
#=
Builds a network data dictionary conform with PowerModels.jl from several files containing certain input data:
model - whether to calculate AC- or DC-PF (:ac or :dc)
pgfile - .RAW or .m file that contains the detailed grid data (e.g. generator and load information etc.)
busfile - .csv file that contains geographic locations of all buses
branchfile - .csv file that contains transmission line lengths
branchfile - optional .csv file that contains transmission line lengths
nddfile - .jld2 file in which the final network data dictionary will be saved
=#
function build_network_data(;
pgfile::String, busfile::String, branchfile::String, nddfile::String
function build_network_data(
model = :ac;
pgfile::String, busfile::String, nddfile::String, branchfile = ""
)
### Read grid data and calculate initial operation point
network_data = calc_init_op(pgfile, model=:ac)
network_data = calc_init_op(pgfile, model=model)
### Add additional data to dictionary
add_locs!(network_data, busfile) # add geographic bus locations
add_tl_lengths!(network_data, branchfile) # add transmission line lengths
if isempty(branchfile) == false # check whether to add line lengths
add_tl_lengths!(network_data, branchfile)
end
add_tl_voltages!(network_data) # add transmission line voltages
save(nddfile, "network_data", network_data) # save network data
......@@ -191,19 +197,15 @@ function get_underground_tl(
if mode == :single # one end alone has to exceed min_MW_load
filter!(load -> last(load) >= min_MW_load, MW_loads)
large_MW_loads = collect(keys(MW_loads))
println(large_MW_loads)
counter = 0
### Go through branches and identify underground transmission lines
for (i, branch) in network_data["branch"]
if branch["transformer"] == false && branch["length"] < max_length
from, to = branch["f_bus"], branch["t_bus"]
if from in large_MW_loads || to in large_MW_loads
push!(underground_tl, i)
counter += 1
end
end
end
println(counter)
elseif mode == :sum # both ends together have to exceed min_MW_load
### Go through branches and identify underground transmission lines
for (i, branch) in network_data["branch"]
......
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