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.
=#
function add_locs!(
network_data::Dict{String,<:Any},
csvfile::String
)
function add_locs!(network_data::Dict{String,<:Any},csvfile::String)
Returns the (string) indices of transmission lines in the network data dictionary that would be considered as underground lines depending on the used maximum length of underground lines and minimum MW-load served. If mode = :sum, the sum of MW-loads of both ends of a line has to exceed min_MW_load, and if mode = :single, one end alone has to exceed min_MW_load.
=#
function get_underground_tl(
network_data::Dict{String,<:Any},
max_length=12.875,# in km
min_MW_load=2.;# in per-unit (assumed 100 MW base)
mode=:sum# :sum or :single
)
MW_loads=get_MW_loads(network_data)# dictionary of MW loads
underground_tl=[]
ifmode==: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
Deactivates branches that have been overloaded due to a power flow redistribution (flow/capacity > 1.). The branches are identified by their string indices in branch_ids. The status of these branches is set to 0 in network_data. Parallel branches are not automatically deactivated.