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

Add build_network_data that builds NDD's

parent 6df8fea8
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,31 @@
#*------------------------------------------------------------------------------
#=
Reads the geographic bus locations (longitude and latitude coordinates in degrees) from a CSV file and adds them to the NDD. Returns the resulting NDD, in which each bus has a "bus_lat" and "bus_lon" entry. The columns containg the longitude and latitude coordinates in the CSV file should be called "SubLongitude" and "SubLatitude", respectively.
Builds a network data dictionary conform with PowerModels.jl from several files containing certain input data:
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
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
)
### Read grid data and calculate initial operation point
network_data = calc_init_op(pgfile, model=:ac)
add_locs!(network_data, busfile) # add geographic bus locations
add_tl_lengths!(network_data, branchfile) # add transmission line lengths
add_tl_voltages!(network_data) # add transmission line voltages
save(nddfile, "network_data", network_data) # save network data
return nothing
end
#*------------------------------------------------------------------------------
#=
Reads the geographic bus locations (longitude and latitude coordinates in degrees) from a .csv file and adds them to the network data dictionary (NDD). Returns the resulting NDD, in which each bus has a "bus_lat" and "bus_lon" entry. The columns containg the longitude and latitude coordinates in the .csv file should be called "SubLongitude" and "SubLatitude", respectively.
=#
function add_locs!(network_data::Dict{String,<:Any}, csvfile::String)
pos = Dict{String,Any}(
......@@ -28,6 +52,9 @@ end
#*------------------------------------------------------------------------------
#=
Reads transmission line lengths from a .csv file and adds them to the network data dictionary.
=#
function add_tl_lengths!(network_data::Dict{String,<:Any}, csvfile::String)
len = Dict{String,Any}(
"baseMVA" => 100.0,
......@@ -57,7 +84,7 @@ end
#*------------------------------------------------------------------------------
#=
Determines voltage levels of transmission lines and adds them to the NDD.
Determines voltage levels of transmission lines and adds them to the network data dictionary.
=#
function add_tl_voltages!(network_data::Dict{String,<:Any})
voltages = Dict{String,Any}(
......
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