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

Add example application of ITCPG to Texas and Ike

parent d93c7a42
No related branches found
No related tags found
No related merge requests found
#* Application of ITCPG.jl to the synthetic grid of Texas
#*------------------------------------------------------------------------------
using ITCPG
using FileIO
#*------------------------------------------------------------------------------
### Load network data dictionary (NDD) that contains initial AC-PF solution
file = joinpath(@__DIR__, "Results/ACPF/Texas_init_acpf.jld2")
ndd_ac = load(file, "network_data")
#*------------------------------------------------------------------------------
#* SIMULATE IMPACT OF HURRICANE IKE
#*------------------------------------------------------------------------------
#=
First step:
Calculate all wind loads acting on overhead transmission line segments in Texas for hurricane Ike. Transmission line segments are the sections between transmission towers and are determined within the following code.
=#
hurr_Ike = joinpath(@__DIR__, "Data/Hurricanes/tc_winds-2008245N17323-60min.nc")
seg_data = calc_overhead_tl_windloads(ndd_ac, hurr_Ike, mode=:sum)
### Optional: Save wind loads in a file in order to save future calculation time
# seg_path = joinpath(@__DIR__, "Results/Hurricane_Ike/Texas_Ike_segment_data.jld2")
# save(seg_path, "seg_data", seg_data)
#*------------------------------------------------------------------------------
#=
Second step:
Simulate damage to overhead transmission lines in Texas caused by hurricane Ike for a specific γ value.
=#
γ = 0.0004 # γ value to use in failure probabilities
S = 1 # numbering of realization/scenario
tl_failures = sim_impact(seg_data, γ=γ)
#=
Optional: Plot time series of the impact of hurricane Ike for a specific realization (scenario).
Note that this plotting function requires that Cartopy is already installed and the target directory for plots already exists (otherwise thrown errors can be confusing). Cartopy can be installed via Conda by running `using Conda` followed by `Conda.add("cartopy")`.
=#
# plot_pg_impact(
# ndd_ac, tl_failures,
# windfile = hurr_Ike,
# figpath = joinpath(
# @__DIR__, "Plots/Hurricane_Ike/Ike_impact_gamma$γ/Scenario_1/" *
# "Texas_pg_Ike_impact_gamma$γ" * "_S1"
# )
# )
#*------------------------------------------------------------------------------
#=
Third step:
Calculate the total impact of hurricane Ike for a specific time series of destroyed overhead transmission lines by calculating possible failure cascades.
=#
outputpath = joinpath(
@__DIR__, "Results/Hurricane_Ike/Ike_impact_gamma$γ/Scenario_$S/" *
"Texas_Ike_gamma$γ" * "_S$S" * "_cf_output_warm.txt"
) # optional path for saving terminal output of solver
savepath = joinpath(
@__DIR__, "Results/Hurricane_Ike/Ike_impact_gamma$γ/Scenario_$S/" *
"Texas_Ike_gamma$γ" * "_S$S" * "_cf_final_ndd.jld2"
) # optional path for saving the final network data dictionary
ndd_ac_cascade = deepcopy(ndd_ac) # copy that will be changed during cascade
calc_total_impact!(
ndd_ac_cascade, tl_failures,
method = :JuMP, # solver to use
print_level = 5, # level of details for Ipopt output (saved in outputpath)
outputpath = outputpath,
savepath = savepath
)
#*------------------------------------------------------------------------------
#* PLOTTING IMPACT OF HURRICANE IKE
#*------------------------------------------------------------------------------
### Adjust font size
using PyPlot
plt.rc("font", size=12.0)
#*------------------------------------------------------------------------------
### Plot final grid state with AC power flow
savepath = joinpath(
@__DIR__, "Results/Hurricane_Ike/Ike_impact_gamma$γ/Scenario_$S/" *
"Texas_Ike_gamma$γ" * "_S$S" * "_cf_final_ndd.jld2"
)
ndd_ac_cascade = load(savepath, "network_data")
plot_pg(
ndd_ac_cascade,
Dict(
"Branches" => Dict(
"br_status" => "active",
"br_coloring" => "MVA-loading",
"br_alpha" => 1
),
), # plot settings (see PlotUtils.jl for complete list)
figpath = joinpath(@__DIR__, "Plots/Texas_pg_acpf_Ike_gamma$γ" * "_S$S" * "_cascade_end.png")
)
#*------------------------------------------------------------------------------
#* OTHER PLOTTING EXAMPLES
#*------------------------------------------------------------------------------
### Adjust font size
using PyPlot
plt.rc("font", size=12.0)
### Plot initial AC power flow solution for Texas
plot_pg(
ndd_ac,
Dict(
"Branches" => Dict(
"br_status" => "active",
"br_coloring" => "MVA-loading",
"br_alpha" => 1
),
),
figpath = joinpath(@__DIR__, "Plots/Texas_pg_acpf.png")
)
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