criticalityMaps.criticality package¶
Submodules¶
criticalityMaps.criticality.core module¶
Created on Tue Jun 4 11:09:02 2019
@author: PHassett
Modified: jhogge
-
criticalityMaps.criticality.core.
fire_criticality_analysis
(wn, output_dir='./', fire_demand=0.946, fire_start=86400, fire_duration=7200, min_pipe_diam=0.1524, max_pipe_diam=0.2032, p_nom=17.58, p_min=14.06, save_log=False, summary_file='fire_criticality_summary.yml', post_process=True, pop=None, multiprocess=False, num_processors=None)[source]¶ A plug-and-play ready function for executing fire criticality analysis.
- Parameters
wn (wntr WaterNetworkModel object) – wntr wn for the water network of interest
output_dir (str/path-like object, optional) –
path to the directory to save the results of the analysis.
Defaults to the working directory (“./”).
fire_demand (float, optional) –
fire fighting demand(m^3/s).
Defaults to 0.946 m^3/s (1500gpm).
fire_start (integer, optional) –
start time of the fire in seconds.
Defaults to 86400 sec (24hr).
fire_duration (integer, optional) –
total duration of the fire demand in seconds.
Defaults to 7200 sec (2hr).
min_pipe_diam (float, optional) –
minimum diameter pipe to perform fire criticality analysis on(meters).
Defaults to 0.1524 m (6in).
max_pipe_diam (float, optional) –
maximum diameter pipe to perform fire criticality analysis on(meters).
Defaults to 0.2032 m (8in).
p_nom (float, optional) –
nominal pressure for PDD (kPa). The minimun pressure to still recieve full expected demand.
Defaults to 17.58 kPa (25psi).
p_min (float, optional) –
minimum pressure for PDD (kPa). The minimun pressure to still recieve any demand.
Defaults to 14.06 kPa (20psi).
save_log (boolean, optional) –
option to save .json log files for each fire simulation. Otherwise, log files are still created but deleted after successful completion of all simulations. Serves as an effective back-up of the analysis results.
Defaults to False.
summary_file (str, optional) –
file name for the yml summary file saved in output_dir
Defaults to ‘fire_criticality_summary.yml’.
post_process (boolean, optional) –
option to post process the analysis results with process_criticality. Saves pdf maps of the nodes and population impacted at each fire node, and corresponding csv files. To customize the post-processing output, set post_process to False and then run process_criticality() with the summary .yml file and any additional args as input.
Defaults to True.
pop (dict or pandas DataFrame, optional) –
population estimate at each node. Used for post processing. If undefined, defaults to the result of wntr.metrics.population(wn).
Defaults to None.
multiprocess (boolean, optional) –
option to run criticality across multiple processors.
Defaults to False.
num_processors (int, optional) –
the number of processors to use if mp is True.
Defaults to None if mp is False. Otherwise, defaults to int(mp.cpu_count() * 0.666), or 2/3 of the available processors.
-
criticalityMaps.criticality.core.
pipe_criticality_analysis
(wn, output_dir='./', break_start=86400, break_duration=172800, min_pipe_diam=0.3048, max_pipe_diam=None, p_nom=17.58, p_min=14.06, save_log=False, summary_file='pipe_criticality_summary.yml', post_process=True, pop=None, multiprocess=False, num_processors=None)[source]¶ A plug-and-play ready function for executing fire criticality analysis.
- Parameters
wn (wntr WaterNetworkModel object) – wntr wn for the water network of interest
output_dir (str/path-like object, optional) –
path to the directory to save the results of the analysis.
Defaults to the working directory (“./”).
break_start (integer, optional) –
start time of the pipe break in seconds.
Defaults to 86400 sec (24hr).
break_duration (integer, optional) –
total duration of the fire demand in seconds.
Defaults to 172800 sec (48hr).
min_pipe_diam (float, optional) –
minimum diameter pipe to perform fire criticality analysis on(meters).
Defaults to 0.3048 m (12in).
max_pipe_diam (float, optional) –
maximum diameter pipe to perform fire criticality analysis on(meters).
Defaults to None.
p_nom (float, optional) –
nominal pressure for PDD (kPa). The minimun pressure to still recieve full expected demand.
Defaults to 17.58 kPa (25psi).
p_min (float, optional) –
minimum pressure for PDD (kPa). The minimun pressure to still recieve any demand.
Defaults to 14.06 kPa (20psi).
save_log (boolean, optional) –
option to save .json log files for each fire simulation. Otherwise, log files are still created but deleted after successful completion of all simulations. Serves as an effective back-up of the analysis results.
Defaults to False.
summary_file (str, optional) –
file name for the yml summary file saved in output_dir.
Defaults to ‘pipe_criticality_summary.yml’.
post_process (boolean, optional) –
option to post process the analysis results with process_criticality. Saves pdf maps of the nodes and population impacted at each fire node, and corresponding csv files. To customize the post-processing output, set post_process to False and then run process_criticality() with the summary .yml file and any additional args as input.
Defaults to True.
pop (dict or pandas DataFrame, optional) –
population estimate at each node. Used for post processing. If undefined, defaults to the result of wntr.metrics.population(_wn).
Defaults to None.
multiprocess (boolean, optional) –
option to run criticality across multiple processors.
Defaults to False.
num_processors (int, optional) –
the number of processors to use if mp is True.
Defaults to None if mp is False. Otherwise, defaults to int(mp.cpu_count() * 0.666), or 2/3 of the available processors.
-
criticalityMaps.criticality.core.
segment_criticality_analysis
(wn, link_segments, node_segments, valve_layer, output_dir='./', break_start=86400, break_duration=172800, min_pipe_diam=0.3048, max_pipe_diam=None, p_nom=17.58, p_min=14.06, save_log=False, summary_file='segment_criticality_summary.yml', post_process=True, pop=None, multiprocess=False, num_processors=None)[source]¶ A plug-and-play ready function for executing segment criticality analysis.
- Parameters
wn (wntr WaterNetworkModel object) – wntr wn for the water network of interest
link_segments (Pandas series) – results of valve_segments algorithm, listing links and their segment
node_segments (Pandas series) – results of valve_segments algorithm, listing nodes and their segment
valve_layer (Pandas dataframe) – list of node/segment combinations for the valves in the network
output_dir (str/path-like object, optional) –
path to the directory to save the results of the analysis.
Defaults to the working directory (“./”).
break_start (integer, optional) –
start time of the pipe break in seconds.
Defaults to 86400 sec (24hr).
break_duration (integer, optional) –
total duration of the fire demand in seconds.
Defaults to 172800 sec (48hr).
min_pipe_diam (float, optional) –
minimum diameter pipe to perform fire criticality analysis on(meters).
Defaults to 0.3048 m (12in).
max_pipe_diam (float, optional) –
maximum diameter pipe to perform fire criticality analysis on(meters).
Defaults to None.
p_nom (float, optional) –
nominal pressure for PDD (kPa). The minimun pressure to still recieve full expected demand.
Defaults to 17.58 kPa (25psi).
p_min (float, optional) –
minimum pressure for PDD (kPa). The minimun pressure to still recieve any demand.
Defaults to 14.06 kPa (20psi).
save_log (boolean, optional) –
option to save .json log files for each fire simulation. Otherwise, log files are still created but deleted after successful completion of all simulations. Serves as an effective back-up of the analysis results.
Defaults to False.
summary_file (str, optional) –
file name for the yml summary file saved in output_dir.
Defaults to ‘segment_criticality_summary.txt’.
post_process (boolean, optional) –
option to post process the analysis results with process_criticality. Saves pdf maps of the nodes and population impacted at each fire node, and corresponding csv files. To customize the post-processing output, set post_process to False and then run process_criticality() with the summary .yml file and any additional args as input.
Defaults to True.
pop (dict or pandas DataFrame, optional) –
population estimate at each node. Used for post processing. If undefined, defaults to the result of wntr.metrics.population(_wn).
Defaults to None.
multiprocess (boolean, optional) –
option to run criticality across multiple processors.
Defaults to False.
num_processors (int, optional) –
the number of processors to use if mp is True.
Defaults to None if mp is False. Otherwise, defaults to int(mp.cpu_count() * 0.666), or 2/3 of the available processors.
-
criticalityMaps.criticality.core.
process_criticality
(wn, summary_file, output_dir, pop=None, save_maps=True, save_csv=True, link_segments=None, node_segments=None, valve_layer=None)[source]¶ Process the results of a criticality analysis and produce some figures
- Parameters
wn (wntr WaterNetworkModel object) – the _wn that the analysis was performed on
summary_file (str/path-like object) – path to the .yml summary file produced from a criticality analysis
pop (dict or pandas Series, optional) – population estimate at each junction of the _wn. Output from wntr.metrics.population is suitable input format.
save_maps (bool, optional) – option to save pdf maps of the population and nodes impacted at each node/link tested. Defaults to True.
save_csv (bool, optional) – option to save a csv log of the population and nodes impacted at each node/link tested. Defaults to True.
criticalityMaps.criticality.criticality_functions module¶
Created on Tue Jun 4 11:33:38 2019
@author: PHassett
criticalityMaps.criticality.mp_queue_tools module¶
Created on Tue Jun 4 07:59:47 2019
@author: PHassett
-
criticalityMaps.criticality.mp_queue_tools.
runner
(tasks, num_processors)[source]¶ Run the tasks specified across mutiple processors and return the results in a list.
- Parameters
- list (tasks) – task list of the form [(func,(arg1, arg2,…,argN))]
- int (num_processors) – the number of processors to use
- Returns
list of func return objects for each task
- Return type
results - list