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