Extract Data from Simulations
analyzer
contaminated_volume
contaminated_volume(trace: pd.DataFrame, demand: pd.DataFrame, det_time: pd.DataFrame) -> pd.DataFrame
Compute, for each pair (node, injection node), the volume of contaminated water consumed prior to detection.
Parameters:
-
trace
(DataFrame
) –A pandas Dataframe containing the contaminant trace (percentage) for each injection points in each node.
The Dataframe has the following columns:
-
time
: Simulation time in seconds. -
node
: Node of the water network to which the trace refers. -
<node_id1>
, ...,<node_idN>
: Nodes of the water network where the contaminant has been injected.
This Dataframe can be obtained calling
waco.sim.contamination
. -
-
demand
(DataFrame
) –A pandas Dataframe with the demand at each node for each simulation timestep.
The Dataframe has to have the following columns:
-
time
: Simulation time in seconds. -
node
: Node of the water network. -
demand
: Demand atnode
in the simulation timestep identified bytime
.
This Dataframe can be obtained calling waco.sim.demand.
-
-
det_time
(DataFrame
) –A pandas Dataframe with the detection times for each pair (node, injection_node).
The Dataframe has to have the following columns:
-
node
: The "observer" node of the water network. -
inj_node
: The node of the water network where the contaminant has been injected. -
time
: The first simulation timestep when the contaminant concentration innode
exceedssensibility
, when the contaminant has been injected ininj_node
.
This Dataframe can be obtained calling waco.analyzer.contaminated_volume.
-
Returns:
-
DataFrame
–A pandas Dataframe with the volume of contaminated water consumed prior detection for each pair (node, injection_node).
The Dataframe has the following columns:
- `node`: The "observer" node of the water network. - `inj_node`: The node of the water network where the contaminant has been injected. - `volume`: The contaminated water consumed prior detection.
Source code in waco/analyzer.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
detection_time
detection_time(trace: pd.DataFrame, sensibility: float = 1, non_detection_value: float = None) -> pd.DataFrame
Compute, for each pair (node, injection node), the time contaminant needs to reach a concentration greater
than sensibility
in node
if injected in injection_node
.
Parameters:
-
trace
(DataFrame
) –A pandas Dataframe containing the contaminant trace (percentage) for each injection points in each node.
The Dataframe has the following columns:
-
time
: Simulation time in seconds. -
node
: Node of the water network to which the trace refers. -
<node_id1>
, ...,<node_idN>
: Nodes of the water network where the contaminant has been injected.
This Dataframe can be obtained calling waco.sim.contamination.
-
-
sensibility
(float
, default:1
) –The concentration (percentage) to consider a contaminant detected.
-
non_detection_value
(float
, default:None
) –The value to use if the concentration of contaminat in a node does not exceed
sensibility
in the simulation horizon.
Returns:
-
DataFrame
–A pandas Dataframe with the detection times for each pair (node, injection_node).
The Dataframe has the following columns:
-
node
: The "observer" node of the water network. -
inj_node
: The node of the water network where the contaminant has been injected. -
time
: The first simulation timestep when the contaminant concentration innode
exceedssensibility
, when the contaminant has been injected ininj_node
.
-
Source code in waco/analyzer.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|