Calculates the total impact of a hurricane given a time series of damaged transmission lines. Each time a transmission line is destroyed, the AC power flow equations are solved and failure cascades may unfold. The output of the solver is saved in a .txt file.
Calculates the total impact of a hurricane given a time series of damaged transmission lines. Each time a transmission line is destroyed, the AC power flow equations are solved and failure cascades may unfold. The terminal output of the solver is saved in a .txt file, if an "outputpath" is defined. Additionally the final network data dictionary is saved in a .jld2 file, if a "savepath" is defined.
=#
function calc_total_impact!(
network_data::Dict{String,<:Any},
tl_damage::Array{Tuple{String,Int64},1},# time series of tl damage
savepath::String;
tl_damage::Array{Tuple{String,Int64},1};# time series of tl damage
method=:JuMP,# solver to use
print_level=5# Ipopt output details
print_level=5,# Ipopt output details
outputpath="",# path for saving solver terminal output
savepath="",# path for saving final network data dictionary
ifisempty(savepath)==false# save final network data
save(savepath,"network_data",network_data)
end
returnnothing
...
...
@@ -252,12 +263,12 @@ end
Restores active power balance in a connected component identified by the set of buses cc. Depending on whether an overproduction or underproduction exists, generator dispatches may be increased or reduced. If necessary, load can be shed by reducing the demands uniformly until the total demand matches generation. For more details see flow chart.
=#
function _restore_p_balance!(network_data::Dict{String,<:Any},cc::Set{Int64})
active_cc_gens=[
active_cc_gens=Int64[
gen["index"]forgeninvalues(network_data["gen"])if
gen["gen_bus"]∈cc&&gen["gen_status"]!=0
]# indices of active generators that are connected to buses in cc