epyt-flow 0.14.2__py3-none-any.whl → 0.15.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- epyt_flow/VERSION +1 -1
- epyt_flow/__init__.py +0 -37
- epyt_flow/data/benchmarks/battledim.py +2 -2
- epyt_flow/data/benchmarks/leakdb.py +12 -9
- epyt_flow/gym/scenario_control_env.py +32 -33
- epyt_flow/simulation/events/actuator_events.py +24 -18
- epyt_flow/simulation/events/leakages.py +59 -57
- epyt_flow/simulation/events/quality_events.py +21 -30
- epyt_flow/simulation/events/system_event.py +3 -3
- epyt_flow/simulation/scada/complex_control.py +14 -12
- epyt_flow/simulation/scada/custom_control.py +22 -21
- epyt_flow/simulation/scada/scada_data.py +107 -104
- epyt_flow/simulation/scada/simple_control.py +38 -31
- epyt_flow/simulation/scenario_simulator.py +367 -395
- epyt_flow/simulation/sensor_config.py +31 -32
- epyt_flow/topology.py +11 -10
- epyt_flow/uncertainty/model_uncertainty.py +146 -122
- epyt_flow/utils.py +0 -66
- epyt_flow/visualization/visualization_utils.py +2 -4
- {epyt_flow-0.14.2.dist-info → epyt_flow-0.15.0b1.dist-info}/METADATA +12 -18
- epyt_flow-0.15.0b1.dist-info/RECORD +65 -0
- epyt_flow/EPANET/EPANET/SRC_engines/AUTHORS +0 -28
- epyt_flow/EPANET/EPANET/SRC_engines/LICENSE +0 -21
- epyt_flow/EPANET/EPANET/SRC_engines/Readme_SRC_Engines.txt +0 -18
- epyt_flow/EPANET/EPANET/SRC_engines/enumstxt.h +0 -134
- epyt_flow/EPANET/EPANET/SRC_engines/epanet.c +0 -5578
- epyt_flow/EPANET/EPANET/SRC_engines/epanet2.c +0 -865
- epyt_flow/EPANET/EPANET/SRC_engines/epanet2.def +0 -131
- epyt_flow/EPANET/EPANET/SRC_engines/errors.dat +0 -73
- epyt_flow/EPANET/EPANET/SRC_engines/funcs.h +0 -193
- epyt_flow/EPANET/EPANET/SRC_engines/genmmd.c +0 -1000
- epyt_flow/EPANET/EPANET/SRC_engines/hash.c +0 -177
- epyt_flow/EPANET/EPANET/SRC_engines/hash.h +0 -28
- epyt_flow/EPANET/EPANET/SRC_engines/hydcoeffs.c +0 -1151
- epyt_flow/EPANET/EPANET/SRC_engines/hydraul.c +0 -1117
- epyt_flow/EPANET/EPANET/SRC_engines/hydsolver.c +0 -720
- epyt_flow/EPANET/EPANET/SRC_engines/hydstatus.c +0 -476
- epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2.h +0 -431
- epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_2.h +0 -1786
- epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_enums.h +0 -468
- epyt_flow/EPANET/EPANET/SRC_engines/inpfile.c +0 -810
- epyt_flow/EPANET/EPANET/SRC_engines/input1.c +0 -707
- epyt_flow/EPANET/EPANET/SRC_engines/input2.c +0 -864
- epyt_flow/EPANET/EPANET/SRC_engines/input3.c +0 -2170
- epyt_flow/EPANET/EPANET/SRC_engines/main.c +0 -93
- epyt_flow/EPANET/EPANET/SRC_engines/mempool.c +0 -142
- epyt_flow/EPANET/EPANET/SRC_engines/mempool.h +0 -24
- epyt_flow/EPANET/EPANET/SRC_engines/output.c +0 -852
- epyt_flow/EPANET/EPANET/SRC_engines/project.c +0 -1359
- epyt_flow/EPANET/EPANET/SRC_engines/quality.c +0 -685
- epyt_flow/EPANET/EPANET/SRC_engines/qualreact.c +0 -743
- epyt_flow/EPANET/EPANET/SRC_engines/qualroute.c +0 -694
- epyt_flow/EPANET/EPANET/SRC_engines/report.c +0 -1489
- epyt_flow/EPANET/EPANET/SRC_engines/rules.c +0 -1362
- epyt_flow/EPANET/EPANET/SRC_engines/smatrix.c +0 -871
- epyt_flow/EPANET/EPANET/SRC_engines/text.h +0 -497
- epyt_flow/EPANET/EPANET/SRC_engines/types.h +0 -874
- epyt_flow/EPANET/EPANET-MSX/MSX_Updates.txt +0 -53
- epyt_flow/EPANET/EPANET-MSX/Src/dispersion.h +0 -27
- epyt_flow/EPANET/EPANET-MSX/Src/hash.c +0 -107
- epyt_flow/EPANET/EPANET-MSX/Src/hash.h +0 -28
- epyt_flow/EPANET/EPANET-MSX/Src/include/epanetmsx.h +0 -102
- epyt_flow/EPANET/EPANET-MSX/Src/include/epanetmsx_export.h +0 -42
- epyt_flow/EPANET/EPANET-MSX/Src/mathexpr.c +0 -937
- epyt_flow/EPANET/EPANET-MSX/Src/mathexpr.h +0 -39
- epyt_flow/EPANET/EPANET-MSX/Src/mempool.c +0 -204
- epyt_flow/EPANET/EPANET-MSX/Src/mempool.h +0 -24
- epyt_flow/EPANET/EPANET-MSX/Src/msxchem.c +0 -1285
- epyt_flow/EPANET/EPANET-MSX/Src/msxcompiler.c +0 -368
- epyt_flow/EPANET/EPANET-MSX/Src/msxdict.h +0 -42
- epyt_flow/EPANET/EPANET-MSX/Src/msxdispersion.c +0 -586
- epyt_flow/EPANET/EPANET-MSX/Src/msxerr.c +0 -116
- epyt_flow/EPANET/EPANET-MSX/Src/msxfile.c +0 -260
- epyt_flow/EPANET/EPANET-MSX/Src/msxfuncs.c +0 -175
- epyt_flow/EPANET/EPANET-MSX/Src/msxfuncs.h +0 -35
- epyt_flow/EPANET/EPANET-MSX/Src/msxinp.c +0 -1504
- epyt_flow/EPANET/EPANET-MSX/Src/msxout.c +0 -401
- epyt_flow/EPANET/EPANET-MSX/Src/msxproj.c +0 -791
- epyt_flow/EPANET/EPANET-MSX/Src/msxqual.c +0 -2010
- epyt_flow/EPANET/EPANET-MSX/Src/msxrpt.c +0 -400
- epyt_flow/EPANET/EPANET-MSX/Src/msxtank.c +0 -422
- epyt_flow/EPANET/EPANET-MSX/Src/msxtoolkit.c +0 -1164
- epyt_flow/EPANET/EPANET-MSX/Src/msxtypes.h +0 -551
- epyt_flow/EPANET/EPANET-MSX/Src/msxutils.c +0 -524
- epyt_flow/EPANET/EPANET-MSX/Src/msxutils.h +0 -56
- epyt_flow/EPANET/EPANET-MSX/Src/newton.c +0 -158
- epyt_flow/EPANET/EPANET-MSX/Src/newton.h +0 -34
- epyt_flow/EPANET/EPANET-MSX/Src/rk5.c +0 -287
- epyt_flow/EPANET/EPANET-MSX/Src/rk5.h +0 -39
- epyt_flow/EPANET/EPANET-MSX/Src/ros2.c +0 -293
- epyt_flow/EPANET/EPANET-MSX/Src/ros2.h +0 -35
- epyt_flow/EPANET/EPANET-MSX/Src/smatrix.c +0 -816
- epyt_flow/EPANET/EPANET-MSX/Src/smatrix.h +0 -29
- epyt_flow/EPANET/EPANET-MSX/readme.txt +0 -14
- epyt_flow/EPANET/compile_linux.sh +0 -4
- epyt_flow/EPANET/compile_macos.sh +0 -4
- epyt_flow/simulation/backend/__init__.py +0 -1
- epyt_flow/simulation/backend/my_epyt.py +0 -1101
- epyt_flow-0.14.2.dist-info/RECORD +0 -142
- {epyt_flow-0.14.2.dist-info → epyt_flow-0.15.0b1.dist-info}/WHEEL +0 -0
- {epyt_flow-0.14.2.dist-info → epyt_flow-0.15.0b1.dist-info}/licenses/LICENSE +0 -0
- {epyt_flow-0.14.2.dist-info → epyt_flow-0.15.0b1.dist-info}/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Module provides base classes for system events such as leakages, actuator events, etc.
|
|
3
3
|
"""
|
|
4
4
|
from abc import abstractmethod
|
|
5
|
-
import
|
|
5
|
+
from epanet_plus import EPyT
|
|
6
6
|
|
|
7
7
|
from .event import Event
|
|
8
8
|
|
|
@@ -17,13 +17,13 @@ class SystemEvent(Event):
|
|
|
17
17
|
|
|
18
18
|
super().__init__(**kwds)
|
|
19
19
|
|
|
20
|
-
def init(self, epanet_api:
|
|
20
|
+
def init(self, epanet_api: EPyT) -> None:
|
|
21
21
|
"""
|
|
22
22
|
Initializes the event.
|
|
23
23
|
|
|
24
24
|
Parameters
|
|
25
25
|
----------
|
|
26
|
-
epanet_api : `
|
|
26
|
+
epanet_api : `epanet_plus.EPyT <https://epanet-plus.readthedocs.io/en/stable/api.html#epanet_plus.epanet_toolkit.EPyT>`_
|
|
27
27
|
API to EPANET and EPANET-MSX.
|
|
28
28
|
"""
|
|
29
29
|
self._epanet_api = epanet_api
|
|
@@ -4,7 +4,7 @@ Module contains a class for representing complex control rules as implemented in
|
|
|
4
4
|
from copy import deepcopy
|
|
5
5
|
from typing import Any
|
|
6
6
|
import numpy as np
|
|
7
|
-
from
|
|
7
|
+
from epanet_plus import EpanetConstants
|
|
8
8
|
|
|
9
9
|
from ...serialization import JsonSerializable, COMPLEX_CONTROL_ID, COMPLEX_CONTROL_CONDITION_ID, \
|
|
10
10
|
COMPLEX_CONTROL_ACTION_ID, serializable
|
|
@@ -42,6 +42,8 @@ EN_R_ACTION_STATUS_OPEN = 1
|
|
|
42
42
|
EN_R_ACTION_STATUS_CLOSED = 2
|
|
43
43
|
EN_R_ACTION_STATUS_ACTIVE = 3
|
|
44
44
|
|
|
45
|
+
RULESTATUS = ['OPEN', 'CLOSED', 'ACTIVE']
|
|
46
|
+
|
|
45
47
|
|
|
46
48
|
@serializable(COMPLEX_CONTROL_CONDITION_ID, ".epytflow_complex_control_condition")
|
|
47
49
|
class RuleCondition(JsonSerializable):
|
|
@@ -99,8 +101,8 @@ class RuleCondition(JsonSerializable):
|
|
|
99
101
|
if not isinstance(object_type_id, int):
|
|
100
102
|
raise TypeError("'object_type_id' must be an instance of 'int' " +
|
|
101
103
|
f"but not of '{type(object_type_id)}'")
|
|
102
|
-
if object_type_id not in [
|
|
103
|
-
|
|
104
|
+
if object_type_id not in [EpanetConstants.EN_R_NODE, EpanetConstants.EN_R_LINK,
|
|
105
|
+
EpanetConstants.EN_R_SYSTEM]:
|
|
104
106
|
raise ValueError(f"Invalid value '{object_type_id}' for 'object_type_id'")
|
|
105
107
|
if not isinstance(object_id, str):
|
|
106
108
|
raise TypeError("'object_id' must be an instance of 'str' " +
|
|
@@ -236,9 +238,9 @@ class RuleCondition(JsonSerializable):
|
|
|
236
238
|
desc = ""
|
|
237
239
|
|
|
238
240
|
if self.__attribute_id == EN_R_DEMAND:
|
|
239
|
-
if self.__object_type_id ==
|
|
241
|
+
if self.__object_type_id == EpanetConstants.EN_R_NODE:
|
|
240
242
|
desc += f"JUNCTION {self.__object_id} DEMAND "
|
|
241
|
-
elif self.__object_type_id ==
|
|
243
|
+
elif self.__object_type_id == EpanetConstants.EN_R_SYSTEM:
|
|
242
244
|
desc += "SYSTEM DEMAND "
|
|
243
245
|
elif self.__attribute_id == EN_R_HEAD:
|
|
244
246
|
desc += f"JUNCTION {self.__object_id} HEAD "
|
|
@@ -326,11 +328,11 @@ class RuleAction(JsonSerializable):
|
|
|
326
328
|
if not isinstance(link_type_id, int):
|
|
327
329
|
raise TypeError("'link_type_id' must be an istanace of 'int' " +
|
|
328
330
|
f"but not of '{type(link_type_id)}'")
|
|
329
|
-
if link_type_id not in [
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
if link_type_id not in [EpanetConstants.EN_CVPIPE, EpanetConstants.EN_PIPE,
|
|
332
|
+
EpanetConstants.EN_PUMP, EpanetConstants.EN_PRV,
|
|
333
|
+
EpanetConstants.EN_PSV, EpanetConstants.EN_PBV,
|
|
334
|
+
EpanetConstants.EN_FCV, EpanetConstants.EN_TCV,
|
|
335
|
+
EpanetConstants.EN_GPV]:
|
|
334
336
|
raise ValueError(f"Invalid value '{link_type_id}' for 'link_type_id'")
|
|
335
337
|
if not isinstance(link_id, str):
|
|
336
338
|
raise TypeError("'link_id' must be an instance of 'str' " +
|
|
@@ -432,9 +434,9 @@ class RuleAction(JsonSerializable):
|
|
|
432
434
|
def __str__(self) -> str:
|
|
433
435
|
desc = ""
|
|
434
436
|
|
|
435
|
-
if self.__link_type_id in [
|
|
437
|
+
if self.__link_type_id in [EpanetConstants.EN_CVPIPE, EpanetConstants.EN_PIPE]:
|
|
436
438
|
desc += "PIPE "
|
|
437
|
-
elif self.__link_type_id ==
|
|
439
|
+
elif self.__link_type_id == EpanetConstants.EN_PUMP:
|
|
438
440
|
desc += "PUMP "
|
|
439
441
|
else:
|
|
440
442
|
desc += "VALVE "
|
|
@@ -4,7 +4,7 @@ Module provides a base class for custom control modules.
|
|
|
4
4
|
from abc import abstractmethod, ABC
|
|
5
5
|
import warnings
|
|
6
6
|
import numpy as np
|
|
7
|
-
import
|
|
7
|
+
from epanet_plus import EPyT, EpanetConstants
|
|
8
8
|
|
|
9
9
|
from . import ScadaData
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ class CustomControlModule(ABC):
|
|
|
15
15
|
|
|
16
16
|
Attributes
|
|
17
17
|
----------
|
|
18
|
-
epanet_api : `
|
|
18
|
+
epanet_api : `epanet_plus.EPyT <https://epanet-plus.readthedocs.io/en/stable/api.html#epanet_plus.epanet_toolkit.EPyT>`_
|
|
19
19
|
API to EPANET and EPANET-MSX. Is set in :func:`init`.
|
|
20
20
|
"""
|
|
21
21
|
def __init__(self, **kwds):
|
|
@@ -23,17 +23,17 @@ class CustomControlModule(ABC):
|
|
|
23
23
|
|
|
24
24
|
super().__init__(**kwds)
|
|
25
25
|
|
|
26
|
-
def init(self, epanet_api:
|
|
26
|
+
def init(self, epanet_api: EPyT) -> None:
|
|
27
27
|
"""
|
|
28
28
|
Initializes the control module.
|
|
29
29
|
|
|
30
30
|
Parameters
|
|
31
31
|
----------
|
|
32
|
-
epanet_api : `
|
|
32
|
+
epanet_api : `epanet_plus.EPyT <https://epanet-plus.readthedocs.io/en/stable/api.html#epanet_plus.epanet_toolkit.EPyT>`_
|
|
33
33
|
API to EPANET for implementing the control module.
|
|
34
34
|
"""
|
|
35
|
-
if not isinstance(epanet_api,
|
|
36
|
-
raise TypeError("'epanet_api' must be an instance of '
|
|
35
|
+
if not isinstance(epanet_api, EPyT):
|
|
36
|
+
raise TypeError("'epanet_api' must be an instance of 'epanet_plus.EPyT' but not of " +
|
|
37
37
|
f"'{type(epanet_api)}'")
|
|
38
38
|
|
|
39
39
|
self._epanet_api = epanet_api
|
|
@@ -55,9 +55,8 @@ class CustomControlModule(ABC):
|
|
|
55
55
|
- EN_CLOSED = 0
|
|
56
56
|
- EN_OPEN = 1
|
|
57
57
|
"""
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
self._epanet_api.setLinkStatus(pump_link_idx, status)
|
|
58
|
+
pump_link_idx = self._epanet_api.get_link_idx(pump_id)
|
|
59
|
+
self._epanet_api.setlinkvalue(pump_link_idx, EpanetConstants.EN_STATUS, status)
|
|
61
60
|
|
|
62
61
|
def set_pump_speed(self, pump_id: str, speed: float) -> None:
|
|
63
62
|
"""
|
|
@@ -70,15 +69,18 @@ class CustomControlModule(ABC):
|
|
|
70
69
|
speed : `float`
|
|
71
70
|
New pump speed.
|
|
72
71
|
"""
|
|
73
|
-
pump_idx = self._epanet_api.
|
|
74
|
-
pattern_idx = self._epanet_api.
|
|
72
|
+
pump_idx = self._epanet_api.get_link_idx(pump_id)
|
|
73
|
+
pattern_idx = self._epanet_api.getlinkvalue(pump_idx, EpanetConstants.EN_LINKPATTERN)
|
|
75
74
|
|
|
76
75
|
if pattern_idx == 0:
|
|
77
76
|
warnings.warn(f"No pattern for pump '{pump_id}' found -- a new pattern is created")
|
|
78
|
-
pattern_idx = self._epanet_api.addPattern(f"pump_speed_{pump_id}")
|
|
79
|
-
self._epanet_api.setLinkPumpPatternIndex(pattern_idx)
|
|
80
77
|
|
|
81
|
-
|
|
78
|
+
pattern_id = f"pump_speed_{pump_id}"
|
|
79
|
+
self._epanet_api.add_pattern(pattern_id, [speed])
|
|
80
|
+
pattern_idx = self._epanet_api.getpatternindex(pattern_id)
|
|
81
|
+
self._epanet_api.setlinkvalue(pump_idx, EpanetConstants.EN_LINKPATTERN, pattern_idx)
|
|
82
|
+
|
|
83
|
+
self._epanet_api.setpattern(pattern_idx, [speed], 1)
|
|
82
84
|
|
|
83
85
|
def set_valve_status(self, valve_id: str, status: int) -> None:
|
|
84
86
|
"""
|
|
@@ -97,9 +99,8 @@ class CustomControlModule(ABC):
|
|
|
97
99
|
- EN_CLOSED = 0
|
|
98
100
|
- EN_OPEN = 1
|
|
99
101
|
"""
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
self._epanet_api.setLinkStatus(valve_link_idx, status)
|
|
102
|
+
valve_link_idx = self._epanet_api.get_link_idx(valve_id)
|
|
103
|
+
self._epanet_api.setlinkvalue(valve_link_idx, EpanetConstants.EN_STATUS, status)
|
|
103
104
|
|
|
104
105
|
def set_node_quality_source_value(self, node_id: str, pattern_id: str,
|
|
105
106
|
qual_value: float) -> None:
|
|
@@ -116,10 +117,10 @@ class CustomControlModule(ABC):
|
|
|
116
117
|
qual_value : `float`
|
|
117
118
|
New quality source value.
|
|
118
119
|
"""
|
|
119
|
-
node_idx = self._epanet_api.
|
|
120
|
-
pattern_idx = self._epanet_api.
|
|
121
|
-
self._epanet_api.
|
|
122
|
-
self._epanet_api.
|
|
120
|
+
node_idx = self._epanet_api.get_node_idx(node_id)
|
|
121
|
+
pattern_idx = self._epanet_api.getpatternindex(pattern_id)
|
|
122
|
+
self._epanet_api.setnodevalue(node_idx, EpanetConstants.EN_SOURCEQUAL, 1)
|
|
123
|
+
self._epanet_api.set_pattern(pattern_idx, np.array([qual_value]))
|
|
123
124
|
|
|
124
125
|
@abstractmethod
|
|
125
126
|
def step(self, scada_data: ScadaData) -> None:
|
|
@@ -8,7 +8,7 @@ import numpy as np
|
|
|
8
8
|
from scipy.sparse import bsr_array
|
|
9
9
|
import matplotlib
|
|
10
10
|
import pandas as pd
|
|
11
|
-
from
|
|
11
|
+
from epanet_plus import EpanetConstants
|
|
12
12
|
|
|
13
13
|
from ..sensor_config import SensorConfig, is_flowunit_simetric, massunit_to_str, flowunit_to_str,\
|
|
14
14
|
qualityunit_to_str, areaunit_to_str,\
|
|
@@ -556,7 +556,7 @@ class ScadaData(Serializable):
|
|
|
556
556
|
New units of hydraulic measurements -- note that the flow unit specifies all other
|
|
557
557
|
hydraulic measurement units.
|
|
558
558
|
|
|
559
|
-
Must be one of the following EPANET
|
|
559
|
+
Must be one of the following EPANET constants:
|
|
560
560
|
|
|
561
561
|
- EN_CFS = 0 (cubic foot/sec)
|
|
562
562
|
- EN_GPM = 1 (gal/min)
|
|
@@ -698,195 +698,195 @@ class ScadaData(Serializable):
|
|
|
698
698
|
f"'{massunit_to_str(new_unit_id)}'")
|
|
699
699
|
|
|
700
700
|
def __get_flow_convert_factor(new_unit_id: int, old_unit: int) -> float:
|
|
701
|
-
if new_unit_id ==
|
|
702
|
-
if old_unit ==
|
|
701
|
+
if new_unit_id == EpanetConstants.EN_CFS:
|
|
702
|
+
if old_unit == EpanetConstants.EN_GPM:
|
|
703
703
|
return .0022280093
|
|
704
|
-
elif old_unit ==
|
|
704
|
+
elif old_unit == EpanetConstants.EN_MGD:
|
|
705
705
|
return 1.5472286523
|
|
706
|
-
elif old_unit ==
|
|
706
|
+
elif old_unit == EpanetConstants.EN_IMGD:
|
|
707
707
|
return 1.8581441347
|
|
708
|
-
elif old_unit ==
|
|
708
|
+
elif old_unit == EpanetConstants.EN_AFD:
|
|
709
709
|
return .5041666667
|
|
710
|
-
elif old_unit ==
|
|
710
|
+
elif old_unit == EpanetConstants.EN_LPS:
|
|
711
711
|
return .0353146667
|
|
712
|
-
elif old_unit ==
|
|
712
|
+
elif old_unit == EpanetConstants.EN_LPM:
|
|
713
713
|
return .0005885778
|
|
714
|
-
elif old_unit ==
|
|
714
|
+
elif old_unit == EpanetConstants.EN_MLD:
|
|
715
715
|
return .40873456853575
|
|
716
|
-
elif old_unit ==
|
|
716
|
+
elif old_unit == EpanetConstants.EN_CMH:
|
|
717
717
|
return .0098096296
|
|
718
|
-
elif old_unit ==
|
|
718
|
+
elif old_unit == EpanetConstants.EN_CMD:
|
|
719
719
|
return .0004087346
|
|
720
|
-
elif new_unit_id ==
|
|
721
|
-
if old_unit ==
|
|
720
|
+
elif new_unit_id == EpanetConstants.EN_GPM:
|
|
721
|
+
if old_unit == EpanetConstants.EN_CFS:
|
|
722
722
|
return 448.8325660485
|
|
723
|
-
elif old_unit ==
|
|
723
|
+
elif old_unit == EpanetConstants.EN_MGD:
|
|
724
724
|
return 694.44444444
|
|
725
|
-
elif old_unit ==
|
|
725
|
+
elif old_unit == EpanetConstants.EN_IMGD:
|
|
726
726
|
return 833.99300382
|
|
727
|
-
elif old_unit ==
|
|
727
|
+
elif old_unit == EpanetConstants.EN_AFD:
|
|
728
728
|
return 226.28571429
|
|
729
|
-
elif old_unit ==
|
|
729
|
+
elif old_unit == EpanetConstants.EN_LPS:
|
|
730
730
|
return 15.850323141
|
|
731
|
-
elif old_unit ==
|
|
731
|
+
elif old_unit == EpanetConstants.EN_LPM:
|
|
732
732
|
return .2641720524
|
|
733
|
-
elif old_unit ==
|
|
733
|
+
elif old_unit == EpanetConstants.EN_MLD:
|
|
734
734
|
return 183.4528141376
|
|
735
|
-
elif old_unit ==
|
|
735
|
+
elif old_unit == EpanetConstants.EN_CMH:
|
|
736
736
|
return 4.4028675393
|
|
737
|
-
elif old_unit ==
|
|
737
|
+
elif old_unit == EpanetConstants.EN_CMD:
|
|
738
738
|
return .1834528141
|
|
739
|
-
elif new_unit_id ==
|
|
740
|
-
if old_unit ==
|
|
739
|
+
elif new_unit_id == EpanetConstants.EN_MGD:
|
|
740
|
+
if old_unit == EpanetConstants.EN_CFS:
|
|
741
741
|
return .6463168831
|
|
742
|
-
elif old_unit ==
|
|
742
|
+
elif old_unit == EpanetConstants.EN_GPM:
|
|
743
743
|
return .00144
|
|
744
|
-
elif old_unit ==
|
|
744
|
+
elif old_unit == EpanetConstants.EN_IMGD:
|
|
745
745
|
return 1.2009499255
|
|
746
|
-
elif old_unit ==
|
|
746
|
+
elif old_unit == EpanetConstants.EN_AFD:
|
|
747
747
|
return 0.3258514286
|
|
748
|
-
elif old_unit ==
|
|
748
|
+
elif old_unit == EpanetConstants.EN_LPS:
|
|
749
749
|
return .0228244653
|
|
750
|
-
elif old_unit ==
|
|
750
|
+
elif old_unit == EpanetConstants.EN_LPM:
|
|
751
751
|
return .0003804078
|
|
752
|
-
elif old_unit ==
|
|
752
|
+
elif old_unit == EpanetConstants.EN_MLD:
|
|
753
753
|
return .26417205124156
|
|
754
|
-
elif old_unit ==
|
|
754
|
+
elif old_unit == EpanetConstants.EN_CMH:
|
|
755
755
|
return .0063401293
|
|
756
|
-
elif old_unit ==
|
|
756
|
+
elif old_unit == EpanetConstants.EN_CMD:
|
|
757
757
|
return .0002641721
|
|
758
|
-
elif new_unit_id ==
|
|
759
|
-
if old_unit ==
|
|
758
|
+
elif new_unit_id == EpanetConstants.EN_IMGD:
|
|
759
|
+
if old_unit == EpanetConstants.EN_CFS:
|
|
760
760
|
return .5381713837
|
|
761
|
-
elif old_unit ==
|
|
761
|
+
elif old_unit == EpanetConstants.EN_MGD:
|
|
762
762
|
return .8326741846
|
|
763
|
-
elif old_unit ==
|
|
763
|
+
elif old_unit == EpanetConstants.EN_GPM:
|
|
764
764
|
return .0011990508
|
|
765
|
-
elif old_unit ==
|
|
765
|
+
elif old_unit == EpanetConstants.EN_AFD:
|
|
766
766
|
return .2713280726
|
|
767
|
-
elif old_unit ==
|
|
767
|
+
elif old_unit == EpanetConstants.EN_LPS:
|
|
768
768
|
return .0190053431
|
|
769
|
-
elif old_unit ==
|
|
769
|
+
elif old_unit == EpanetConstants.EN_LPM:
|
|
770
770
|
return .0003167557
|
|
771
|
-
elif old_unit ==
|
|
771
|
+
elif old_unit == EpanetConstants.EN_MLD:
|
|
772
772
|
return .21996924829908776
|
|
773
|
-
elif old_unit ==
|
|
773
|
+
elif old_unit == EpanetConstants.EN_CMH:
|
|
774
774
|
return .005279262
|
|
775
|
-
elif old_unit ==
|
|
775
|
+
elif old_unit == EpanetConstants.EN_CMD:
|
|
776
776
|
return .0002199692
|
|
777
|
-
elif new_unit_id ==
|
|
778
|
-
if old_unit ==
|
|
777
|
+
elif new_unit_id == EpanetConstants.EN_AFD:
|
|
778
|
+
if old_unit == EpanetConstants.EN_CFS:
|
|
779
779
|
return 1.9834710744
|
|
780
|
-
elif old_unit ==
|
|
780
|
+
elif old_unit == EpanetConstants.EN_MGD:
|
|
781
781
|
return 3.0688832772
|
|
782
|
-
elif old_unit ==
|
|
782
|
+
elif old_unit == EpanetConstants.EN_GPM:
|
|
783
783
|
return .0044191919
|
|
784
|
-
elif old_unit ==
|
|
784
|
+
elif old_unit == EpanetConstants.EN_IMGD:
|
|
785
785
|
return 3.6855751432
|
|
786
|
-
elif old_unit ==
|
|
786
|
+
elif old_unit == EpanetConstants.EN_LPS:
|
|
787
787
|
return .0700456199
|
|
788
|
-
elif old_unit ==
|
|
788
|
+
elif old_unit == EpanetConstants.EN_LPM:
|
|
789
789
|
return .001167427
|
|
790
|
-
elif old_unit ==
|
|
790
|
+
elif old_unit == EpanetConstants.EN_MLD:
|
|
791
791
|
return .81070995093708
|
|
792
|
-
elif old_unit ==
|
|
792
|
+
elif old_unit == EpanetConstants.EN_CMH:
|
|
793
793
|
return .0194571167
|
|
794
|
-
elif old_unit ==
|
|
794
|
+
elif old_unit == EpanetConstants.EN_CMD:
|
|
795
795
|
return .0008107132
|
|
796
|
-
elif new_unit_id ==
|
|
797
|
-
if old_unit ==
|
|
796
|
+
elif new_unit_id == EpanetConstants.EN_LPS:
|
|
797
|
+
if old_unit == EpanetConstants.EN_CFS:
|
|
798
798
|
return 28.316846592
|
|
799
|
-
elif old_unit ==
|
|
799
|
+
elif old_unit == EpanetConstants.EN_MGD:
|
|
800
800
|
return 43.812636389
|
|
801
|
-
elif old_unit ==
|
|
801
|
+
elif old_unit == EpanetConstants.EN_IMGD:
|
|
802
802
|
return 52.616782407
|
|
803
|
-
elif old_unit ==
|
|
803
|
+
elif old_unit == EpanetConstants.EN_GPM:
|
|
804
804
|
return .0630901964
|
|
805
|
-
elif old_unit ==
|
|
805
|
+
elif old_unit == EpanetConstants.EN_AFD:
|
|
806
806
|
return 14.276410157
|
|
807
|
-
elif old_unit ==
|
|
807
|
+
elif old_unit == EpanetConstants.EN_LPM:
|
|
808
808
|
return .0166666667
|
|
809
|
-
elif old_unit ==
|
|
809
|
+
elif old_unit == EpanetConstants.EN_MLD:
|
|
810
810
|
return 11.574074074074
|
|
811
|
-
elif old_unit ==
|
|
811
|
+
elif old_unit == EpanetConstants.EN_CMH:
|
|
812
812
|
return .2777777778
|
|
813
|
-
elif old_unit ==
|
|
813
|
+
elif old_unit == EpanetConstants.EN_CMD:
|
|
814
814
|
return .0115740741
|
|
815
|
-
elif new_unit_id ==
|
|
816
|
-
if old_unit ==
|
|
815
|
+
elif new_unit_id == EpanetConstants.EN_LPM:
|
|
816
|
+
if old_unit == EpanetConstants.EN_CFS:
|
|
817
817
|
return 1699.0107955
|
|
818
|
-
elif old_unit ==
|
|
818
|
+
elif old_unit == EpanetConstants.EN_MGD:
|
|
819
819
|
return 2628.7581833
|
|
820
|
-
elif old_unit ==
|
|
820
|
+
elif old_unit == EpanetConstants.EN_IMGD:
|
|
821
821
|
return 3157.0069444
|
|
822
|
-
elif old_unit ==
|
|
822
|
+
elif old_unit == EpanetConstants.EN_AFD:
|
|
823
823
|
return 856.58460941
|
|
824
|
-
elif old_unit ==
|
|
824
|
+
elif old_unit == EpanetConstants.EN_LPS:
|
|
825
825
|
return 60
|
|
826
|
-
elif old_unit ==
|
|
826
|
+
elif old_unit == EpanetConstants.EN_GPM:
|
|
827
827
|
return 3.785411784
|
|
828
|
-
elif old_unit ==
|
|
828
|
+
elif old_unit == EpanetConstants.EN_MLD:
|
|
829
829
|
return 694.44444444443
|
|
830
|
-
elif old_unit ==
|
|
830
|
+
elif old_unit == EpanetConstants.EN_CMH:
|
|
831
831
|
return 16.666666667
|
|
832
|
-
elif old_unit ==
|
|
832
|
+
elif old_unit == EpanetConstants.EN_CMD:
|
|
833
833
|
return 0.6944444444
|
|
834
|
-
elif new_unit_id ==
|
|
835
|
-
if old_unit ==
|
|
834
|
+
elif new_unit_id == EpanetConstants.EN_MLD:
|
|
835
|
+
if old_unit == EpanetConstants.EN_CFS:
|
|
836
836
|
return 2.4465755456688
|
|
837
|
-
elif old_unit ==
|
|
837
|
+
elif old_unit == EpanetConstants.EN_MGD:
|
|
838
838
|
return 3.7854117999999777
|
|
839
|
-
elif old_unit ==
|
|
839
|
+
elif old_unit == EpanetConstants.EN_IMGD:
|
|
840
840
|
return 4.54609
|
|
841
|
-
elif old_unit ==
|
|
841
|
+
elif old_unit == EpanetConstants.EN_AFD:
|
|
842
842
|
return 1.2334867714947
|
|
843
|
-
elif old_unit ==
|
|
843
|
+
elif old_unit == EpanetConstants.EN_LPS:
|
|
844
844
|
return .0864
|
|
845
|
-
elif old_unit ==
|
|
845
|
+
elif old_unit == EpanetConstants.EN_LPM:
|
|
846
846
|
return .00144
|
|
847
|
-
elif old_unit ==
|
|
847
|
+
elif old_unit == EpanetConstants.EN_GPM:
|
|
848
848
|
return .00545099296896
|
|
849
|
-
elif old_unit ==
|
|
849
|
+
elif old_unit == EpanetConstants.EN_CMH:
|
|
850
850
|
return .024
|
|
851
|
-
elif old_unit ==
|
|
851
|
+
elif old_unit == EpanetConstants.EN_CMD:
|
|
852
852
|
return .00099999999999999
|
|
853
|
-
elif new_unit_id ==
|
|
854
|
-
if old_unit ==
|
|
853
|
+
elif new_unit_id == EpanetConstants.EN_CMH:
|
|
854
|
+
if old_unit == EpanetConstants.EN_CFS:
|
|
855
855
|
return 101.94064773
|
|
856
|
-
elif old_unit ==
|
|
856
|
+
elif old_unit == EpanetConstants.EN_MGD:
|
|
857
857
|
return 157.725491
|
|
858
|
-
elif old_unit ==
|
|
858
|
+
elif old_unit == EpanetConstants.EN_IMGD:
|
|
859
859
|
return 189.42041667
|
|
860
|
-
elif old_unit ==
|
|
860
|
+
elif old_unit == EpanetConstants.EN_AFD:
|
|
861
861
|
return 51.395076564
|
|
862
|
-
elif old_unit ==
|
|
862
|
+
elif old_unit == EpanetConstants.EN_LPS:
|
|
863
863
|
return 3.6
|
|
864
|
-
elif old_unit ==
|
|
864
|
+
elif old_unit == EpanetConstants.EN_LPM:
|
|
865
865
|
return .06
|
|
866
|
-
elif old_unit ==
|
|
866
|
+
elif old_unit == EpanetConstants.EN_MLD:
|
|
867
867
|
return 41.666666666666
|
|
868
|
-
elif old_unit ==
|
|
868
|
+
elif old_unit == EpanetConstants.EN_GPM:
|
|
869
869
|
return .227124707
|
|
870
|
-
elif old_unit ==
|
|
870
|
+
elif old_unit == EpanetConstants.EN_CMD:
|
|
871
871
|
return 0.0416666667
|
|
872
|
-
elif new_unit_id ==
|
|
873
|
-
if old_unit ==
|
|
872
|
+
elif new_unit_id == EpanetConstants.EN_CMD:
|
|
873
|
+
if old_unit == EpanetConstants.EN_CFS:
|
|
874
874
|
return 2446.5755455
|
|
875
|
-
elif old_unit ==
|
|
875
|
+
elif old_unit == EpanetConstants.EN_MGD:
|
|
876
876
|
return 3785.411784
|
|
877
|
-
elif old_unit ==
|
|
877
|
+
elif old_unit == EpanetConstants.EN_IMGD:
|
|
878
878
|
return 4546.09
|
|
879
|
-
elif old_unit ==
|
|
879
|
+
elif old_unit == EpanetConstants.EN_AFD:
|
|
880
880
|
return 1233.4818375
|
|
881
|
-
elif old_unit ==
|
|
881
|
+
elif old_unit == EpanetConstants.EN_LPS:
|
|
882
882
|
return 86.4
|
|
883
|
-
elif old_unit ==
|
|
883
|
+
elif old_unit == EpanetConstants.EN_LPM:
|
|
884
884
|
return 1.44
|
|
885
|
-
elif old_unit ==
|
|
885
|
+
elif old_unit == EpanetConstants.EN_MLD:
|
|
886
886
|
return 1000.
|
|
887
|
-
elif old_unit ==
|
|
887
|
+
elif old_unit == EpanetConstants.EN_CMH:
|
|
888
888
|
return 24
|
|
889
|
-
elif old_unit ==
|
|
889
|
+
elif old_unit == EpanetConstants.EN_GPM:
|
|
890
890
|
return 5.450992969
|
|
891
891
|
|
|
892
892
|
# Convert units
|
|
@@ -926,8 +926,11 @@ class ScadaData(Serializable):
|
|
|
926
926
|
convert_factor_volume = 35.3147
|
|
927
927
|
convert_factor_pressure = 1.4219702084872
|
|
928
928
|
|
|
929
|
-
pressure_data
|
|
930
|
-
|
|
929
|
+
if pressure_data is not None:
|
|
930
|
+
pressure_data *= convert_factor_pressure
|
|
931
|
+
|
|
932
|
+
if tanks_volume_data is not None:
|
|
933
|
+
tanks_volume_data *= convert_factor_volume
|
|
931
934
|
|
|
932
935
|
if quality_unit is not None:
|
|
933
936
|
old_quality_unit = self.__sensor_config.quality_unit()
|