Newer
Older
#*------------------------------------------------------------------------------
#* Use packages
using CSV
using DataFrames
using JLD2
using FileIO
using PowerModels
using PyPlot, PyCall
using Colors
using LaTeXStrings
using DataStructures
using NetCDF
using Statistics
#*------------------------------------------------------------------------------
#* Setup logger for generating .log files during simulations
function __init__()
### Setup logger (PowerModels.jl logger will inherit the format)
global LOGGER = Memento.config!(
"info", fmt="[{date} | {level} | {name}]: {msg}"
)
end
#=
Changes the logger level to the passed level. Common options are "info" (default) and "debug" (additional logs for debugging)
=#
function config_logger(level="info")
info(LOGGER, "Logger level set to $(level)!")
setlevel!(LOGGER, level)
return nothing
end
export config_logger
#*------------------------------------------------------------------------------
#* Include other code files and export functions
include("Data.jl")
export add_locs!, add_tl_lengths!, add_tl_voltages!
export get_bustypes, get_underground_tl, get_MW_loads, get_branches
export update_pf_data!, calc_init_op, calc_ac_pf!, calc_branchloads!
export calc_total_impact!, calc_cascade!, restore_p_balance!, calc_Δp
include("PlotUtils.jl")
export plot_pg_map, plot_pg_overhead_tl_segments, plot_pg
include("Impact.jl")
export sim_impact
export calc_overhead_tl_windloads, get_windfield, calc_overhead_tl_segments
include("PlotImpact.jl")
include("PlotPFC.jl")
export scatter_branchloads, plot_pg_pf_diff