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
@@ -4,8 +4,7 @@ Module provides a class for implementing sensor configurations.
4
4
  from copy import deepcopy
5
5
  import itertools
6
6
  import numpy as np
7
- import epyt
8
- from epyt.epanet import ToolkitConstants
7
+ from epanet_plus import EpanetConstants, EPyT
9
8
 
10
9
  from ..serialization import SENSOR_CONFIG_ID, JsonSerializable, serializable
11
10
 
@@ -157,7 +156,7 @@ def flowunit_to_str(unit_id: int) -> str:
157
156
  unit_id : `int`
158
157
  ID of the flow unit.
159
158
 
160
- Must be one of the following EPANET toolkit constants:
159
+ Must be one of the following EPANET constants:
161
160
 
162
161
  - EN_CFS = 0 (cubic foot/sec)
163
162
  - EN_GPM = 1 (gal/min)
@@ -177,25 +176,25 @@ def flowunit_to_str(unit_id: int) -> str:
177
176
  """
178
177
  if unit_id is None:
179
178
  return ""
180
- elif unit_id == ToolkitConstants.EN_CFS:
179
+ elif unit_id == EpanetConstants.EN_CFS:
181
180
  return "cubic foot/sec"
182
- elif unit_id == ToolkitConstants.EN_GPM:
181
+ elif unit_id == EpanetConstants.EN_GPM:
183
182
  return "gal/min"
184
- elif unit_id == ToolkitConstants.EN_MGD:
183
+ elif unit_id == EpanetConstants.EN_MGD:
185
184
  return "Million gal/day"
186
- elif unit_id == ToolkitConstants.EN_IMGD:
185
+ elif unit_id == EpanetConstants.EN_IMGD:
187
186
  return "Imperial MGD"
188
- elif unit_id == ToolkitConstants.EN_AFD:
187
+ elif unit_id == EpanetConstants.EN_AFD:
189
188
  return "ac-foot/day"
190
- elif unit_id == ToolkitConstants.EN_LPS:
189
+ elif unit_id == EpanetConstants.EN_LPS:
191
190
  return "liter/sec"
192
- elif unit_id == ToolkitConstants.EN_LPM:
191
+ elif unit_id == EpanetConstants.EN_LPM:
193
192
  return "liter/min"
194
- elif unit_id == ToolkitConstants.EN_MLD:
193
+ elif unit_id == EpanetConstants.EN_MLD:
195
194
  return "Megaliter/day"
196
- elif unit_id == ToolkitConstants.EN_CMH:
195
+ elif unit_id == EpanetConstants.EN_CMH:
197
196
  return "cubic meter/hr"
198
- elif unit_id == ToolkitConstants.EN_CMD:
197
+ elif unit_id == EpanetConstants.EN_CMD:
199
198
  return "cubic meter/day"
200
199
  else:
201
200
  raise ValueError(f"Unknown unit ID '{unit_id}'")
@@ -274,7 +273,7 @@ def is_flowunit_simetric(unit_id: int) -> bool:
274
273
  unit_id : `int`
275
274
  ID of the flow unit.
276
275
 
277
- Must be one of the following EPANET toolkit constants:
276
+ Must be one of the following EPANET constants:
278
277
 
279
278
  - EN_CFS = 0 (cubic foot/sec)
280
279
  - EN_GPM = 1 (gal/min)
@@ -292,8 +291,8 @@ def is_flowunit_simetric(unit_id: int) -> bool:
292
291
  `bool`
293
292
  True if the fiven unit is a SI metric unit, False otherwise.
294
293
  """
295
- return unit_id in [ToolkitConstants.EN_LPS, ToolkitConstants.EN_LPM, ToolkitConstants.EN_MLD,
296
- ToolkitConstants.EN_CMH, ToolkitConstants.EN_CMD]
294
+ return unit_id in [EpanetConstants.EN_LPS, EpanetConstants.EN_LPM, EpanetConstants.EN_MLD,
295
+ EpanetConstants.EN_CMH, EpanetConstants.EN_CMD]
297
296
 
298
297
 
299
298
  @serializable(SENSOR_CONFIG_ID, ".epytflow_sensor_config")
@@ -410,7 +409,7 @@ class SensorConfig(JsonSerializable):
410
409
  Specifies the flow units and consequently all other hydraulic units
411
410
  (US CUSTOMARY or SI METRIC) as well.
412
411
 
413
- Must be one of the following EPANET toolkit constants:
412
+ Must be one of the following EPANET constants:
414
413
 
415
414
  - EN_CFS = 0 (cubic foot/sec)
416
415
  - EN_GPM = 1 (gal/min)
@@ -1201,34 +1200,34 @@ class SensorConfig(JsonSerializable):
1201
1200
  surface_species_idx_shift)}
1202
1201
  self.__sensors_id_to_idx = mapping
1203
1202
 
1204
- def validate(self, epanet_api: epyt.epanet) -> None:
1203
+ def validate(self, epanet_api: EPyT) -> None:
1205
1204
  """
1206
1205
  Validates this sensor configuration --
1207
1206
  i.e. checks whether all nodes, etc. exist in the .inp file.
1208
1207
 
1209
1208
  Parameters
1210
1209
  ----------
1211
- epanet_api : `epyt.epanet`
1210
+ epanet_api : `epanet_plus.EPyT <https://epanet-plus.readthedocs.io/en/stable/api.html#epanet_plus.epanet_toolkit.EPyT>`_
1212
1211
  EPANET and EPANET-MSX API.
1213
1212
  """
1214
- if not isinstance(epanet_api, epyt.epanet):
1215
- raise TypeError("'epanet_api' must be an instance of 'epyt.epanet' " +
1213
+ if not isinstance(epanet_api, EPyT):
1214
+ raise TypeError("'epanet_api' must be an instance of 'epanet-plus.EPyT' " +
1216
1215
  f"but not of '{type(epanet_api)}'")
1217
1216
 
1218
- nodes = epanet_api.getNodeNameID()
1219
- links = epanet_api.getLinkNameID()
1220
- valves = epanet_api.getLinkValveNameID()
1221
- pumps = epanet_api.getLinkPumpNameID()
1222
- tanks = epanet_api.getNodeTankNameID()
1217
+ nodes = epanet_api.get_all_nodes_id()
1218
+ links = epanet_api.get_all_links_id()
1219
+ valves = epanet_api.get_all_valves_id()
1220
+ pumps = epanet_api.get_all_pumps_id()
1221
+ tanks = epanet_api.get_all_tanks_id()
1223
1222
 
1224
1223
  bulk_species = []
1225
1224
  surface_species = []
1226
- if epanet_api.msx is not None:
1227
- for species_id, species_type in zip(epanet_api.getMSXSpeciesNameID(),
1228
- epanet_api.getMSXSpeciesType()):
1229
- if species_type == "BULK":
1225
+ if epanet_api.msx_file is not None:
1226
+ for species_id, species_info in zip(epanet_api.get_all_msx_species_id(),
1227
+ epanet_api.get_all_msx_species_info()):
1228
+ if species_info["type"] == EpanetConstants.MSX_BULK:
1230
1229
  bulk_species.append(species_id)
1231
- elif species_type == "WALL":
1230
+ elif species_info["type"] == EpanetConstants.MSX_WALL:
1232
1231
  surface_species.append(species_id)
1233
1232
 
1234
1233
  if any(node_id not in nodes for node_id in self.__nodes):
@@ -1334,7 +1333,7 @@ class SensorConfig(JsonSerializable):
1334
1333
  Gets the flow units.
1335
1334
  Note that this specifies all other hydraulic units as well.
1336
1335
 
1337
- Will be one of the following EPANET toolkit constants:
1336
+ Will be one of the following EPANET constants:
1338
1337
 
1339
1338
  - EN_CFS = 0 (cubic foot/sec)
1340
1339
  - EN_GPM = 1 (gal/min)
epyt_flow/topology.py CHANGED
@@ -9,6 +9,7 @@ import networkx as nx
9
9
  from scipy.sparse import bsr_array
10
10
  from geopandas import GeoDataFrame
11
11
  from shapely.geometry import Point, LineString
12
+ from epanet_plus import EpanetConstants
12
13
 
13
14
  from .serialization import serializable, JsonSerializable, NETWORK_TOPOLOGY_ID
14
15
 
@@ -228,7 +229,7 @@ class NetworkTopology(nx.Graph, JsonSerializable):
228
229
  r = []
229
230
 
230
231
  for node_id in self.get_all_nodes():
231
- if self.get_node_info(node_id)["type"] == "JUNCTION":
232
+ if self.get_node_info(node_id)["type"] == EpanetConstants.EN_JUNCTION:
232
233
  r.append(node_id)
233
234
 
234
235
  return r
@@ -256,7 +257,7 @@ class NetworkTopology(nx.Graph, JsonSerializable):
256
257
  r = []
257
258
 
258
259
  for node_id in self.get_all_nodes():
259
- if self.get_node_info(node_id)["type"] == "TANK":
260
+ if self.get_node_info(node_id)["type"] == EpanetConstants.EN_TANK:
260
261
  r.append(node_id)
261
262
 
262
263
  return r
@@ -284,7 +285,7 @@ class NetworkTopology(nx.Graph, JsonSerializable):
284
285
  r = []
285
286
 
286
287
  for node_id in self.get_all_nodes():
287
- if self.get_node_info(node_id)["type"] == "RESERVOIR":
288
+ if self.get_node_info(node_id)["type"] == EpanetConstants.EN_RESERVOIR:
288
289
  r.append(node_id)
289
290
 
290
291
  return r
@@ -314,7 +315,7 @@ class NetworkTopology(nx.Graph, JsonSerializable):
314
315
  for link_id, link_nodes in self.get_all_links():
315
316
  link_info = self.get_link_info(link_id)
316
317
 
317
- if link_info["type"] == "PIPE":
318
+ if link_info["type"] == EpanetConstants.EN_PIPE:
318
319
  r.append((link_id, link_nodes))
319
320
 
320
321
  return r
@@ -574,7 +575,7 @@ class NetworkTopology(nx.Graph, JsonSerializable):
574
575
  node_data["elevation"].append(node_info["elevation"])
575
576
  node_data["geometry"].append(Point(node_info["coord"]))
576
577
 
577
- if node_info["type"] == "TANK":
578
+ if node_info["type"] == EpanetConstants.EN_TANK:
578
579
  tank_data["id"].append(node_id)
579
580
  tank_data["elevation"].append(node_info["elevation"])
580
581
  tank_data["diameter"].append(node_info["diameter"])
@@ -582,9 +583,9 @@ class NetworkTopology(nx.Graph, JsonSerializable):
582
583
  tank_data["max_level"].append(node_info["max_level"])
583
584
  tank_data["min_level"].append(node_info["min_level"])
584
585
  tank_data["mixing_fraction"].append(node_info["mixing_fraction"])
585
- #tank_data["mixing_model"].append(node_info["mixing_model"])
586
+ tank_data["mixing_model"].append(node_info["mixing_model"])
586
587
  tank_data["geometry"].append(Point(node_info["coord"]))
587
- elif node_info["type"] == "RESERVOIR":
588
+ elif node_info["type"] == EpanetConstants.EN_RESERVOIR:
588
589
  reservoir_data["id"].append(node_id)
589
590
  reservoir_data["elevation"].append(node_info["elevation"])
590
591
  reservoir_data["geometry"].append(Point(node_info["coord"]))
@@ -602,7 +603,7 @@ class NetworkTopology(nx.Graph, JsonSerializable):
602
603
  link_info = self.get_link_info(link_id)
603
604
  end_points_coord = [self.get_node_info(n)["coord"] for n in link_nodes]
604
605
 
605
- if link_info["type"] == "PIPE":
606
+ if link_info["type"] == EpanetConstants.EN_PIPE:
606
607
  pipe_data["id"].append(link_id)
607
608
  pipe_data["type"].append(link_info["type"])
608
609
  pipe_data["end_point_a"].append(link_nodes[0])
@@ -610,7 +611,7 @@ class NetworkTopology(nx.Graph, JsonSerializable):
610
611
  pipe_data["length"].append(link_info["length"])
611
612
  pipe_data["diameter"].append(link_info["diameter"])
612
613
  pipe_data["geometry"].append(LineString(end_points_coord))
613
- elif link_info["type"] == "PUMP":
614
+ elif link_info["type"] == EpanetConstants.EN_PUMP:
614
615
  pump_data["id"].append(link_id)
615
616
  pump_data["type"].append(self.get_pump_info(link_id)["type"])
616
617
  if pumps_as_points is True:
@@ -619,7 +620,7 @@ class NetworkTopology(nx.Graph, JsonSerializable):
619
620
  pump_data["geometry"].append(LineString(end_points_coord))
620
621
  else: # Valve
621
622
  valve_data["id"].append(link_id)
622
- valve_data["type"].append(self.get_valve_info[link_id]["type"])
623
+ valve_data["type"].append(self.get_valve_info(link_id)["type"])
623
624
  if valves_as_points is True:
624
625
  valve_data["geometry"].append(Point(end_points_coord[0]))
625
626
  else: