epyt-flow 0.14.1__py3-none-any.whl → 0.15.0__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.
Files changed (108) hide show
  1. epyt_flow/VERSION +1 -1
  2. epyt_flow/__init__.py +0 -37
  3. epyt_flow/data/benchmarks/battledim.py +2 -2
  4. epyt_flow/data/benchmarks/leakdb.py +12 -9
  5. epyt_flow/gym/scenario_control_env.py +32 -33
  6. epyt_flow/simulation/events/actuator_events.py +24 -18
  7. epyt_flow/simulation/events/leakages.py +59 -57
  8. epyt_flow/simulation/events/quality_events.py +21 -30
  9. epyt_flow/simulation/events/system_event.py +3 -3
  10. epyt_flow/simulation/scada/complex_control.py +14 -12
  11. epyt_flow/simulation/scada/custom_control.py +22 -21
  12. epyt_flow/simulation/scada/scada_data.py +108 -105
  13. epyt_flow/simulation/scada/simple_control.py +38 -31
  14. epyt_flow/simulation/scenario_simulator.py +368 -395
  15. epyt_flow/simulation/sensor_config.py +31 -32
  16. epyt_flow/topology.py +11 -10
  17. epyt_flow/uncertainty/model_uncertainty.py +146 -122
  18. epyt_flow/utils.py +66 -0
  19. epyt_flow/visualization/visualization_utils.py +4 -2
  20. {epyt_flow-0.14.1.dist-info → epyt_flow-0.15.0.dist-info}/METADATA +14 -19
  21. epyt_flow-0.15.0.dist-info/RECORD +65 -0
  22. epyt_flow/EPANET/EPANET/SRC_engines/AUTHORS +0 -60
  23. epyt_flow/EPANET/EPANET/SRC_engines/LICENSE +0 -21
  24. epyt_flow/EPANET/EPANET/SRC_engines/enumstxt.h +0 -151
  25. epyt_flow/EPANET/EPANET/SRC_engines/epanet.c +0 -5930
  26. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.c +0 -961
  27. epyt_flow/EPANET/EPANET/SRC_engines/errors.dat +0 -79
  28. epyt_flow/EPANET/EPANET/SRC_engines/flowbalance.c +0 -186
  29. epyt_flow/EPANET/EPANET/SRC_engines/funcs.h +0 -219
  30. epyt_flow/EPANET/EPANET/SRC_engines/genmmd.c +0 -1000
  31. epyt_flow/EPANET/EPANET/SRC_engines/hash.c +0 -177
  32. epyt_flow/EPANET/EPANET/SRC_engines/hash.h +0 -28
  33. epyt_flow/EPANET/EPANET/SRC_engines/hydcoeffs.c +0 -1303
  34. epyt_flow/EPANET/EPANET/SRC_engines/hydraul.c +0 -1172
  35. epyt_flow/EPANET/EPANET/SRC_engines/hydsolver.c +0 -781
  36. epyt_flow/EPANET/EPANET/SRC_engines/hydstatus.c +0 -442
  37. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2.h +0 -464
  38. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_2.h +0 -1960
  39. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_enums.h +0 -518
  40. epyt_flow/EPANET/EPANET/SRC_engines/inpfile.c +0 -884
  41. epyt_flow/EPANET/EPANET/SRC_engines/input1.c +0 -672
  42. epyt_flow/EPANET/EPANET/SRC_engines/input2.c +0 -735
  43. epyt_flow/EPANET/EPANET/SRC_engines/input3.c +0 -2265
  44. epyt_flow/EPANET/EPANET/SRC_engines/leakage.c +0 -527
  45. epyt_flow/EPANET/EPANET/SRC_engines/mempool.c +0 -146
  46. epyt_flow/EPANET/EPANET/SRC_engines/mempool.h +0 -24
  47. epyt_flow/EPANET/EPANET/SRC_engines/output.c +0 -853
  48. epyt_flow/EPANET/EPANET/SRC_engines/project.c +0 -1691
  49. epyt_flow/EPANET/EPANET/SRC_engines/quality.c +0 -695
  50. epyt_flow/EPANET/EPANET/SRC_engines/qualreact.c +0 -800
  51. epyt_flow/EPANET/EPANET/SRC_engines/qualroute.c +0 -696
  52. epyt_flow/EPANET/EPANET/SRC_engines/report.c +0 -1557
  53. epyt_flow/EPANET/EPANET/SRC_engines/rules.c +0 -1500
  54. epyt_flow/EPANET/EPANET/SRC_engines/smatrix.c +0 -871
  55. epyt_flow/EPANET/EPANET/SRC_engines/text.h +0 -508
  56. epyt_flow/EPANET/EPANET/SRC_engines/types.h +0 -928
  57. epyt_flow/EPANET/EPANET/SRC_engines/util/cstr_helper.c +0 -59
  58. epyt_flow/EPANET/EPANET/SRC_engines/util/cstr_helper.h +0 -38
  59. epyt_flow/EPANET/EPANET/SRC_engines/util/errormanager.c +0 -92
  60. epyt_flow/EPANET/EPANET/SRC_engines/util/errormanager.h +0 -39
  61. epyt_flow/EPANET/EPANET/SRC_engines/util/filemanager.c +0 -212
  62. epyt_flow/EPANET/EPANET/SRC_engines/util/filemanager.h +0 -81
  63. epyt_flow/EPANET/EPANET/SRC_engines/validate.c +0 -408
  64. epyt_flow/EPANET/EPANET-MSX/MSX_Updates.txt +0 -53
  65. epyt_flow/EPANET/EPANET-MSX/Src/dispersion.h +0 -27
  66. epyt_flow/EPANET/EPANET-MSX/Src/hash.c +0 -107
  67. epyt_flow/EPANET/EPANET-MSX/Src/hash.h +0 -28
  68. epyt_flow/EPANET/EPANET-MSX/Src/include/epanetmsx.h +0 -102
  69. epyt_flow/EPANET/EPANET-MSX/Src/include/epanetmsx_export.h +0 -42
  70. epyt_flow/EPANET/EPANET-MSX/Src/mathexpr.c +0 -937
  71. epyt_flow/EPANET/EPANET-MSX/Src/mathexpr.h +0 -39
  72. epyt_flow/EPANET/EPANET-MSX/Src/mempool.c +0 -204
  73. epyt_flow/EPANET/EPANET-MSX/Src/mempool.h +0 -24
  74. epyt_flow/EPANET/EPANET-MSX/Src/msxchem.c +0 -1285
  75. epyt_flow/EPANET/EPANET-MSX/Src/msxcompiler.c +0 -368
  76. epyt_flow/EPANET/EPANET-MSX/Src/msxdict.h +0 -42
  77. epyt_flow/EPANET/EPANET-MSX/Src/msxdispersion.c +0 -586
  78. epyt_flow/EPANET/EPANET-MSX/Src/msxerr.c +0 -116
  79. epyt_flow/EPANET/EPANET-MSX/Src/msxfile.c +0 -260
  80. epyt_flow/EPANET/EPANET-MSX/Src/msxfuncs.c +0 -175
  81. epyt_flow/EPANET/EPANET-MSX/Src/msxfuncs.h +0 -35
  82. epyt_flow/EPANET/EPANET-MSX/Src/msxinp.c +0 -1504
  83. epyt_flow/EPANET/EPANET-MSX/Src/msxout.c +0 -401
  84. epyt_flow/EPANET/EPANET-MSX/Src/msxproj.c +0 -791
  85. epyt_flow/EPANET/EPANET-MSX/Src/msxqual.c +0 -2010
  86. epyt_flow/EPANET/EPANET-MSX/Src/msxrpt.c +0 -400
  87. epyt_flow/EPANET/EPANET-MSX/Src/msxtank.c +0 -422
  88. epyt_flow/EPANET/EPANET-MSX/Src/msxtoolkit.c +0 -1164
  89. epyt_flow/EPANET/EPANET-MSX/Src/msxtypes.h +0 -551
  90. epyt_flow/EPANET/EPANET-MSX/Src/msxutils.c +0 -524
  91. epyt_flow/EPANET/EPANET-MSX/Src/msxutils.h +0 -56
  92. epyt_flow/EPANET/EPANET-MSX/Src/newton.c +0 -158
  93. epyt_flow/EPANET/EPANET-MSX/Src/newton.h +0 -34
  94. epyt_flow/EPANET/EPANET-MSX/Src/rk5.c +0 -287
  95. epyt_flow/EPANET/EPANET-MSX/Src/rk5.h +0 -39
  96. epyt_flow/EPANET/EPANET-MSX/Src/ros2.c +0 -293
  97. epyt_flow/EPANET/EPANET-MSX/Src/ros2.h +0 -35
  98. epyt_flow/EPANET/EPANET-MSX/Src/smatrix.c +0 -816
  99. epyt_flow/EPANET/EPANET-MSX/Src/smatrix.h +0 -29
  100. epyt_flow/EPANET/EPANET-MSX/readme.txt +0 -14
  101. epyt_flow/EPANET/compile_linux.sh +0 -4
  102. epyt_flow/EPANET/compile_macos.sh +0 -4
  103. epyt_flow/simulation/backend/__init__.py +0 -1
  104. epyt_flow/simulation/backend/my_epyt.py +0 -1101
  105. epyt_flow-0.14.1.dist-info/RECORD +0 -148
  106. {epyt_flow-0.14.1.dist-info → epyt_flow-0.15.0.dist-info}/WHEEL +0 -0
  107. {epyt_flow-0.14.1.dist-info → epyt_flow-0.15.0.dist-info}/licenses/LICENSE +0 -0
  108. {epyt_flow-0.14.1.dist-info → epyt_flow-0.15.0.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,7 @@
2
2
  The module contains classes for representing simple control rules as used in EPANET.
3
3
  """
4
4
  from typing import Union
5
- from epyt.epanet import ToolkitConstants
5
+ from epanet_plus import EpanetConstants
6
6
 
7
7
  from ..events import ActuatorConstants
8
8
  from ...serialization import JsonSerializable, SIMPLE_CONTROL_ID, serializable
@@ -27,8 +27,10 @@ class SimpleControlModule(JsonSerializable):
27
27
  must be one of the followig costants defined in
28
28
  :class:`~epyt_flow.simulation.events.actuator_events.ActuatorConstants`:
29
29
 
30
- - EN_CLOSED = 0
31
- - EN_OPEN = 1
30
+ - EN_CLOSED = 0
31
+ - EN_OPEN = 1
32
+ - EN_SET_CLOSED = -1e10
33
+ - EN_SET_OPEN = 1e10
32
34
  cond_type : `int`
33
35
  Condition/Rule type.
34
36
 
@@ -57,27 +59,25 @@ class SimpleControlModule(JsonSerializable):
57
59
  **kwds):
58
60
  if not isinstance(link_id, str):
59
61
  raise TypeError(f"'link_id' must be an instance of 'str' but not of '{type(link_id)}'")
60
- if isinstance(link_status, int):
61
- if link_status not in [ActuatorConstants.EN_OPEN, ActuatorConstants.EN_CLOSED]:
62
- raise ValueError(f"Invalid link status {link_status} in 'link_status'")
63
- elif isinstance(link_status, float):
64
- if link_status < 0:
65
- raise TypeError("'link_status' can not be negative")
66
- else:
62
+ if not isinstance(link_status, int) and not isinstance(link_status, float):
67
63
  raise TypeError("'link_status' must be an instance of 'int' or 'float' but not " +
68
64
  f"of '{type(link_status)}'")
69
- if cond_type not in [ToolkitConstants.EN_TIMEOFDAY, ToolkitConstants.EN_TIMER,
70
- ToolkitConstants.EN_LOWLEVEL, ToolkitConstants.EN_HILEVEL]:
65
+ if link_status not in [ActuatorConstants.EN_OPEN, ActuatorConstants.EN_CLOSED,
66
+ ActuatorConstants.EN_SET_OPEN, ActuatorConstants.EN_SET_CLOSED]:
67
+ if link_status < 0:
68
+ raise TypeError("'link_status' can not be negative")
69
+ if cond_type not in [EpanetConstants.EN_TIMEOFDAY, EpanetConstants.EN_TIMER,
70
+ EpanetConstants.EN_LOWLEVEL, EpanetConstants.EN_HILEVEL]:
71
71
  raise ValueError(f"Invalid control type '{cond_type}' in 'cond_type'")
72
72
 
73
- if cond_type == ToolkitConstants.EN_TIMEOFDAY:
73
+ if cond_type == EpanetConstants.EN_TIMEOFDAY:
74
74
  if not isinstance(cond_var_value, str):
75
75
  raise TypeError("EN_TIMEOFDAY requires that 'cond_var_value' must be an instance " +
76
76
  f"of 'str' but not of '{type(cond_var_value)}'")
77
77
  if not cond_var_value.endswith("AM") and not cond_var_value.endswith("PM"):
78
78
  raise ValueError(f"Invalid time of day format '{cond_var_value}' in " +
79
79
  "'cond_var_value'")
80
- elif cond_type == ToolkitConstants.EN_TIMER:
80
+ elif cond_type == EpanetConstants.EN_TIMER:
81
81
  if not isinstance(cond_var_value, int):
82
82
  raise TypeError("EN_TIMER requires that 'cond_var_value' must be an instance " +
83
83
  f"of 'int' but not of '{type(cond_var_value)}'")
@@ -121,11 +121,14 @@ class SimpleControlModule(JsonSerializable):
121
121
  Returns
122
122
  -------
123
123
  `int` or `float`
124
- Pump speed if the link is a pump, otherwise one of the followig costants defined in
124
+ Pump speed if the link is a pump, otherwise one of the followig constants defined in
125
125
  :class:`~epyt_flow.simulation.events.actuator_events.ActuatorConstants`:
126
126
 
127
- - EN_CLOSED = 0
128
- - EN_OPEN = 1
127
+ - EN_CLOSED = 0
128
+ - EN_OPEN = 1
129
+ - EN_SET_CLOSED = -1e10
130
+ - EN_SET_OPEN = 1e10
131
+
129
132
  """
130
133
  return self.__link_status
131
134
 
@@ -193,18 +196,18 @@ class SimpleControlModule(JsonSerializable):
193
196
  def __str__(self) -> str:
194
197
  control_rule_str = f"LINK {self.__link_id} "
195
198
  if isinstance(self.__link_status, int):
196
- control_rule_str += "OPEN " if self.__link_status == ActuatorConstants.EN_OPEN \
197
- else "CLOSED "
199
+ control_rule_str += "OPEN " if self.__link_status == ActuatorConstants.EN_OPEN or \
200
+ self.__link_status == ActuatorConstants.EN_SET_OPEN else "CLOSED "
198
201
  else:
199
202
  control_rule_str += f"{self.__link_status} "
200
203
 
201
- if self.__cond_type == ToolkitConstants.EN_TIMER:
204
+ if self.__cond_type == EpanetConstants.EN_TIMER:
202
205
  control_rule_str += f"AT TIME {self.__cond_var_value}"
203
- elif self.__cond_type == ToolkitConstants.EN_TIMEOFDAY:
206
+ elif self.__cond_type == EpanetConstants.EN_TIMEOFDAY:
204
207
  control_rule_str += f"AT CLOCKTIME {self.__cond_var_value}"
205
- elif self.__cond_type == ToolkitConstants.EN_LOWLEVEL:
208
+ elif self.__cond_type == EpanetConstants.EN_LOWLEVEL:
206
209
  control_rule_str += f"IF NODE {self.__cond_var_value} BELOW {self.__cond_comp_value}"
207
- elif self.__cond_type == ToolkitConstants.EN_HILEVEL:
210
+ elif self.__cond_type == EpanetConstants.EN_HILEVEL:
208
211
  control_rule_str += f"IF NODE {self.__cond_var_value} ABOVE {self.__cond_comp_value}"
209
212
 
210
213
  return control_rule_str
@@ -226,8 +229,8 @@ class SimplePumpSpeedTimeControl(SimpleControlModule):
226
229
  """
227
230
  def __init__(self, pump_id: str, pump_speed: float, time: Union[str, int]):
228
231
  super().__init__(link_id=pump_id, link_status=pump_speed,
229
- cond_type=ToolkitConstants.EN_TIMER if isinstance(time, int)
230
- else ToolkitConstants.EN_TIMEOFDAY,
232
+ cond_type=EpanetConstants.EN_TIMER if isinstance(time, int)
233
+ else EpanetConstants.EN_TIMEOFDAY,
231
234
  cond_var_value=time, cond_comp_value=None)
232
235
 
233
236
 
@@ -273,16 +276,18 @@ class SimpleValveTimeControl(SimpleControlModule):
273
276
  Valve status -- must be one of the followig costants defined in
274
277
  :class:`~epyt_flow.simulation.events.actuator_events.ActuatorConstants`:
275
278
 
276
- - EN_CLOSED = 0
277
- - EN_OPEN = 1
279
+ - EN_CLOSED = 0
280
+ - EN_OPEN = 1
281
+ - EN_SET_CLOSED = -1e10
282
+ - EN_SET_OPEN = 1e10
278
283
  time : `str` or `int`
279
284
  Time of the day (in AM/PM format) in the case or
280
285
  number of hours (as an integer) since simulation start.
281
286
  """
282
287
  def __init__(self, valve_id: str, valve_status: int, time: Union[str, int]):
283
288
  super().__init__(link_id=valve_id, link_status=valve_status,
284
- cond_type=ToolkitConstants.EN_TIMER if isinstance(time, int)
285
- else ToolkitConstants.EN_TIMEOFDAY,
289
+ cond_type=EpanetConstants.EN_TIMER if isinstance(time, int)
290
+ else EpanetConstants.EN_TIMEOFDAY,
286
291
  cond_var_value=time, cond_comp_value=None)
287
292
 
288
293
 
@@ -298,8 +303,10 @@ class SimpleValveConditionControl(SimpleControlModule):
298
303
  Valve status -- must be one of the followig costants defined in
299
304
  :class:`~epyt_flow.simulation.events.actuator_events.ActuatorConstants`:
300
305
 
301
- - EN_CLOSED = 0
302
- - EN_OPEN = 1
306
+ - EN_CLOSED = 0
307
+ - EN_OPEN = 1
308
+ - EN_SET_CLOSED = -1e10
309
+ - EN_SET_OPEN = 1e10
303
310
  node_id : `str`
304
311
  Node ID.
305
312
  comp_type : `int`