epyt-flow 0.14.2__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 (100) 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 +107 -104
  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-0.14.2.dist-info → epyt_flow-0.15.0.dist-info}/METADATA +14 -19
  19. epyt_flow-0.15.0.dist-info/RECORD +65 -0
  20. epyt_flow/EPANET/EPANET/SRC_engines/AUTHORS +0 -28
  21. epyt_flow/EPANET/EPANET/SRC_engines/LICENSE +0 -21
  22. epyt_flow/EPANET/EPANET/SRC_engines/Readme_SRC_Engines.txt +0 -18
  23. epyt_flow/EPANET/EPANET/SRC_engines/enumstxt.h +0 -134
  24. epyt_flow/EPANET/EPANET/SRC_engines/epanet.c +0 -5578
  25. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.c +0 -865
  26. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.def +0 -131
  27. epyt_flow/EPANET/EPANET/SRC_engines/errors.dat +0 -73
  28. epyt_flow/EPANET/EPANET/SRC_engines/funcs.h +0 -193
  29. epyt_flow/EPANET/EPANET/SRC_engines/genmmd.c +0 -1000
  30. epyt_flow/EPANET/EPANET/SRC_engines/hash.c +0 -177
  31. epyt_flow/EPANET/EPANET/SRC_engines/hash.h +0 -28
  32. epyt_flow/EPANET/EPANET/SRC_engines/hydcoeffs.c +0 -1151
  33. epyt_flow/EPANET/EPANET/SRC_engines/hydraul.c +0 -1117
  34. epyt_flow/EPANET/EPANET/SRC_engines/hydsolver.c +0 -720
  35. epyt_flow/EPANET/EPANET/SRC_engines/hydstatus.c +0 -476
  36. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2.h +0 -431
  37. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_2.h +0 -1786
  38. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_enums.h +0 -468
  39. epyt_flow/EPANET/EPANET/SRC_engines/inpfile.c +0 -810
  40. epyt_flow/EPANET/EPANET/SRC_engines/input1.c +0 -707
  41. epyt_flow/EPANET/EPANET/SRC_engines/input2.c +0 -864
  42. epyt_flow/EPANET/EPANET/SRC_engines/input3.c +0 -2170
  43. epyt_flow/EPANET/EPANET/SRC_engines/main.c +0 -93
  44. epyt_flow/EPANET/EPANET/SRC_engines/mempool.c +0 -142
  45. epyt_flow/EPANET/EPANET/SRC_engines/mempool.h +0 -24
  46. epyt_flow/EPANET/EPANET/SRC_engines/output.c +0 -852
  47. epyt_flow/EPANET/EPANET/SRC_engines/project.c +0 -1359
  48. epyt_flow/EPANET/EPANET/SRC_engines/quality.c +0 -685
  49. epyt_flow/EPANET/EPANET/SRC_engines/qualreact.c +0 -743
  50. epyt_flow/EPANET/EPANET/SRC_engines/qualroute.c +0 -694
  51. epyt_flow/EPANET/EPANET/SRC_engines/report.c +0 -1489
  52. epyt_flow/EPANET/EPANET/SRC_engines/rules.c +0 -1362
  53. epyt_flow/EPANET/EPANET/SRC_engines/smatrix.c +0 -871
  54. epyt_flow/EPANET/EPANET/SRC_engines/text.h +0 -497
  55. epyt_flow/EPANET/EPANET/SRC_engines/types.h +0 -874
  56. epyt_flow/EPANET/EPANET-MSX/MSX_Updates.txt +0 -53
  57. epyt_flow/EPANET/EPANET-MSX/Src/dispersion.h +0 -27
  58. epyt_flow/EPANET/EPANET-MSX/Src/hash.c +0 -107
  59. epyt_flow/EPANET/EPANET-MSX/Src/hash.h +0 -28
  60. epyt_flow/EPANET/EPANET-MSX/Src/include/epanetmsx.h +0 -102
  61. epyt_flow/EPANET/EPANET-MSX/Src/include/epanetmsx_export.h +0 -42
  62. epyt_flow/EPANET/EPANET-MSX/Src/mathexpr.c +0 -937
  63. epyt_flow/EPANET/EPANET-MSX/Src/mathexpr.h +0 -39
  64. epyt_flow/EPANET/EPANET-MSX/Src/mempool.c +0 -204
  65. epyt_flow/EPANET/EPANET-MSX/Src/mempool.h +0 -24
  66. epyt_flow/EPANET/EPANET-MSX/Src/msxchem.c +0 -1285
  67. epyt_flow/EPANET/EPANET-MSX/Src/msxcompiler.c +0 -368
  68. epyt_flow/EPANET/EPANET-MSX/Src/msxdict.h +0 -42
  69. epyt_flow/EPANET/EPANET-MSX/Src/msxdispersion.c +0 -586
  70. epyt_flow/EPANET/EPANET-MSX/Src/msxerr.c +0 -116
  71. epyt_flow/EPANET/EPANET-MSX/Src/msxfile.c +0 -260
  72. epyt_flow/EPANET/EPANET-MSX/Src/msxfuncs.c +0 -175
  73. epyt_flow/EPANET/EPANET-MSX/Src/msxfuncs.h +0 -35
  74. epyt_flow/EPANET/EPANET-MSX/Src/msxinp.c +0 -1504
  75. epyt_flow/EPANET/EPANET-MSX/Src/msxout.c +0 -401
  76. epyt_flow/EPANET/EPANET-MSX/Src/msxproj.c +0 -791
  77. epyt_flow/EPANET/EPANET-MSX/Src/msxqual.c +0 -2010
  78. epyt_flow/EPANET/EPANET-MSX/Src/msxrpt.c +0 -400
  79. epyt_flow/EPANET/EPANET-MSX/Src/msxtank.c +0 -422
  80. epyt_flow/EPANET/EPANET-MSX/Src/msxtoolkit.c +0 -1164
  81. epyt_flow/EPANET/EPANET-MSX/Src/msxtypes.h +0 -551
  82. epyt_flow/EPANET/EPANET-MSX/Src/msxutils.c +0 -524
  83. epyt_flow/EPANET/EPANET-MSX/Src/msxutils.h +0 -56
  84. epyt_flow/EPANET/EPANET-MSX/Src/newton.c +0 -158
  85. epyt_flow/EPANET/EPANET-MSX/Src/newton.h +0 -34
  86. epyt_flow/EPANET/EPANET-MSX/Src/rk5.c +0 -287
  87. epyt_flow/EPANET/EPANET-MSX/Src/rk5.h +0 -39
  88. epyt_flow/EPANET/EPANET-MSX/Src/ros2.c +0 -293
  89. epyt_flow/EPANET/EPANET-MSX/Src/ros2.h +0 -35
  90. epyt_flow/EPANET/EPANET-MSX/Src/smatrix.c +0 -816
  91. epyt_flow/EPANET/EPANET-MSX/Src/smatrix.h +0 -29
  92. epyt_flow/EPANET/EPANET-MSX/readme.txt +0 -14
  93. epyt_flow/EPANET/compile_linux.sh +0 -4
  94. epyt_flow/EPANET/compile_macos.sh +0 -4
  95. epyt_flow/simulation/backend/__init__.py +0 -1
  96. epyt_flow/simulation/backend/my_epyt.py +0 -1101
  97. epyt_flow-0.14.2.dist-info/RECORD +0 -142
  98. {epyt_flow-0.14.2.dist-info → epyt_flow-0.15.0.dist-info}/WHEEL +0 -0
  99. {epyt_flow-0.14.2.dist-info → epyt_flow-0.15.0.dist-info}/licenses/LICENSE +0 -0
  100. {epyt_flow-0.14.2.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`