epyt-flow 0.14.0__py3-none-any.whl → 0.14.1__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 (60) hide show
  1. epyt_flow/EPANET/EPANET/SRC_engines/AUTHORS +40 -8
  2. epyt_flow/EPANET/EPANET/SRC_engines/LICENSE +3 -3
  3. epyt_flow/EPANET/EPANET/SRC_engines/enumstxt.h +24 -7
  4. epyt_flow/EPANET/EPANET/SRC_engines/epanet.c +726 -374
  5. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.c +128 -32
  6. epyt_flow/EPANET/EPANET/SRC_engines/errors.dat +7 -1
  7. epyt_flow/EPANET/EPANET/SRC_engines/flowbalance.c +186 -0
  8. epyt_flow/EPANET/EPANET/SRC_engines/funcs.h +40 -14
  9. epyt_flow/EPANET/EPANET/SRC_engines/hash.c +177 -177
  10. epyt_flow/EPANET/EPANET/SRC_engines/hash.h +28 -28
  11. epyt_flow/EPANET/EPANET/SRC_engines/hydcoeffs.c +192 -40
  12. epyt_flow/EPANET/EPANET/SRC_engines/hydraul.c +101 -46
  13. epyt_flow/EPANET/EPANET/SRC_engines/hydsolver.c +85 -24
  14. epyt_flow/EPANET/EPANET/SRC_engines/hydstatus.c +29 -63
  15. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2.h +70 -37
  16. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_2.h +408 -234
  17. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_enums.h +87 -37
  18. epyt_flow/EPANET/EPANET/SRC_engines/inpfile.c +153 -79
  19. epyt_flow/EPANET/EPANET/SRC_engines/input1.c +59 -94
  20. epyt_flow/EPANET/EPANET/SRC_engines/input2.c +73 -202
  21. epyt_flow/EPANET/EPANET/SRC_engines/input3.c +446 -351
  22. epyt_flow/EPANET/EPANET/SRC_engines/leakage.c +527 -0
  23. epyt_flow/EPANET/EPANET/SRC_engines/mempool.c +8 -4
  24. epyt_flow/EPANET/EPANET/SRC_engines/mempool.h +23 -23
  25. epyt_flow/EPANET/EPANET/SRC_engines/output.c +5 -4
  26. epyt_flow/EPANET/EPANET/SRC_engines/project.c +407 -75
  27. epyt_flow/EPANET/EPANET/SRC_engines/quality.c +12 -2
  28. epyt_flow/EPANET/EPANET/SRC_engines/qualreact.c +70 -13
  29. epyt_flow/EPANET/EPANET/SRC_engines/qualroute.c +7 -5
  30. epyt_flow/EPANET/EPANET/SRC_engines/report.c +88 -20
  31. epyt_flow/EPANET/EPANET/SRC_engines/rules.c +144 -6
  32. epyt_flow/EPANET/EPANET/SRC_engines/smatrix.c +19 -19
  33. epyt_flow/EPANET/EPANET/SRC_engines/text.h +16 -5
  34. epyt_flow/EPANET/EPANET/SRC_engines/types.h +73 -19
  35. epyt_flow/EPANET/EPANET/SRC_engines/util/cstr_helper.c +59 -0
  36. epyt_flow/EPANET/EPANET/SRC_engines/util/cstr_helper.h +38 -0
  37. epyt_flow/EPANET/EPANET/SRC_engines/util/errormanager.c +92 -0
  38. epyt_flow/EPANET/EPANET/SRC_engines/util/errormanager.h +39 -0
  39. epyt_flow/EPANET/EPANET/SRC_engines/util/filemanager.c +212 -0
  40. epyt_flow/EPANET/EPANET/SRC_engines/util/filemanager.h +81 -0
  41. epyt_flow/EPANET/EPANET/SRC_engines/validate.c +408 -0
  42. epyt_flow/EPANET/compile_linux.sh +1 -1
  43. epyt_flow/EPANET/compile_macos.sh +1 -1
  44. epyt_flow/VERSION +1 -1
  45. epyt_flow/gym/scenario_control_env.py +26 -3
  46. epyt_flow/simulation/events/quality_events.py +6 -6
  47. epyt_flow/simulation/events/sensor_faults.py +24 -24
  48. epyt_flow/simulation/events/system_event.py +3 -3
  49. epyt_flow/simulation/scada/scada_data.py +1 -1
  50. epyt_flow/simulation/scenario_simulator.py +14 -11
  51. epyt_flow/topology.py +8 -1
  52. epyt_flow/uncertainty/model_uncertainty.py +292 -150
  53. {epyt_flow-0.14.0.dist-info → epyt_flow-0.14.1.dist-info}/METADATA +2 -2
  54. {epyt_flow-0.14.0.dist-info → epyt_flow-0.14.1.dist-info}/RECORD +57 -51
  55. epyt_flow/EPANET/EPANET/SRC_engines/Readme_SRC_Engines.txt +0 -18
  56. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.def +0 -131
  57. epyt_flow/EPANET/EPANET/SRC_engines/main.c +0 -93
  58. {epyt_flow-0.14.0.dist-info → epyt_flow-0.14.1.dist-info}/WHEEL +0 -0
  59. {epyt_flow-0.14.0.dist-info → epyt_flow-0.14.1.dist-info}/licenses/LICENSE +0 -0
  60. {epyt_flow-0.14.0.dist-info → epyt_flow-0.14.1.dist-info}/top_level.txt +0 -0
@@ -13,7 +13,7 @@ class SystemEvent(Event):
13
13
  """
14
14
  def __init__(self, **kwds):
15
15
  self._epanet_api = None
16
- self.__exit_called = False
16
+ self._exit_called = False
17
17
 
18
18
  super().__init__(**kwds)
19
19
 
@@ -52,9 +52,9 @@ class SystemEvent(Event):
52
52
  if self.start_time <= cur_time < self.end_time:
53
53
  self.apply(cur_time)
54
54
  elif cur_time > self.end_time:
55
- if self.__exit_called is False:
55
+ if self._exit_called is False:
56
56
  self.exit(cur_time)
57
- self.__exit_called = True
57
+ self._exit_called = True
58
58
 
59
59
  def reset(self) -> None:
60
60
  """
@@ -1713,7 +1713,7 @@ class ScadaData(Serializable):
1713
1713
  self.__sensor_reading_events = sensor_reading_events
1714
1714
  self.__init()
1715
1715
 
1716
- def extract_time_window(self, start_time: int, end_time: int):
1716
+ def extract_time_window(self, start_time: int, end_time: int = None):
1717
1717
  """
1718
1718
  Extracts a time window of SCADA data from this SCADA data instance --
1719
1719
  i.e. creating a new SCADA data instance containing data from the requested
@@ -1966,9 +1966,12 @@ class ScenarioSimulator():
1966
1966
  self._adapt_to_network_changes()
1967
1967
 
1968
1968
  if self._model_uncertainty is not None:
1969
- if self.__uncertainties_applied is True and reapply_uncertainties is True:
1969
+ if self.__uncertainties_applied is False:
1970
1970
  self._model_uncertainty.apply(self.epanet_api)
1971
1971
  self.__uncertainties_applied = True
1972
+ elif self.__uncertainties_applied is True and reapply_uncertainties is True:
1973
+ self._model_uncertainty.undo(self.epanet_api)
1974
+ self._model_uncertainty.apply(self.epanet_api)
1972
1975
 
1973
1976
  for event in self._system_events:
1974
1977
  event.reset()
@@ -2006,8 +2009,8 @@ class ScenarioSimulator():
2006
2009
  with the hydraulic simulation.
2007
2010
 
2008
2011
  The default is False.
2009
- reapply_uncertainties: bool = False : `bool`, optional
2010
- If True, the uncertainties are re-applied.
2012
+ reapply_uncertainties: `bool`, optional
2013
+ If True, the uncertainties are re-applied on the original properties.
2011
2014
 
2012
2015
  The default is False.
2013
2016
 
@@ -2089,8 +2092,8 @@ class ScenarioSimulator():
2089
2092
  with the hydraulic simulation.
2090
2093
 
2091
2094
  The default is False.
2092
- reapply_uncertainties: bool = False : `bool`, optional
2093
- If True, the uncertainties are re-applied.
2095
+ reapply_uncertainties : `bool`, optional
2096
+ If True, the uncertainties are re-applied on the original properties.
2094
2097
 
2095
2098
  The default is False.
2096
2099
 
@@ -2511,8 +2514,8 @@ class ScenarioSimulator():
2511
2514
  will be stored -- this usually leads to a significant reduction in memory consumption.
2512
2515
 
2513
2516
  The default is False.
2514
- reapply_uncertainties: bool = False : `bool`, optional
2515
- If True, the uncertainties are re-applied.
2517
+ reapply_uncertainties : `bool`, optional
2518
+ If True, the uncertainties are re-applied on the original properties.
2516
2519
 
2517
2520
  The default is False.
2518
2521
 
@@ -2596,8 +2599,8 @@ class ScenarioSimulator():
2596
2599
  will be stored -- this usually leads to a significant reduction in memory consumption.
2597
2600
 
2598
2601
  The default is False.
2599
- reapply_uncertainties: bool = False : `bool`, optional
2600
- If True, the uncertainties are re-applied.
2602
+ reapply_uncertainties : `bool`, optional
2603
+ If True, the uncertainties are re-applied on the original properties.
2601
2604
 
2602
2605
  The default is False.
2603
2606
 
@@ -2778,8 +2781,8 @@ class ScenarioSimulator():
2778
2781
  will be stored -- this usually leads to a significant reduction in memory consumption.
2779
2782
 
2780
2783
  The default is False.
2781
- reapply_uncertainties: bool = False : `bool`, optional
2782
- If True, the uncertainties are re-applied.
2784
+ reapply_uncertainties: `bool`, optional
2785
+ If True, the uncertainties are re-applied on the original properties.
2783
2786
 
2784
2787
  The default is False.
2785
2788
 
epyt_flow/topology.py CHANGED
@@ -500,8 +500,15 @@ class NetworkTopology(nx.Graph, JsonSerializable):
500
500
  raise TypeError("Can not compare 'NetworkTopology' instance to " +
501
501
  f"'{type(other)}' instance")
502
502
 
503
+ adj_matrix = self.get_adj_matrix()
504
+ other_adj_matrix = other.get_adj_matrix()
505
+
503
506
  return super().__eq__(other) and \
504
- self.get_all_nodes() == other.get_all_nodes() \
507
+ self.name == other.name \
508
+ and not np.any(adj_matrix.data != other_adj_matrix.data) \
509
+ and not np.any(adj_matrix.indices != other_adj_matrix.indices) \
510
+ and not np.any(adj_matrix.indptr != other_adj_matrix.indptr) \
511
+ and self.get_all_nodes() == other.get_all_nodes() \
505
512
  and all(link_a[0] == link_b[0] and link_a[1] == link_b[1]
506
513
  for link_a, link_b in zip(self.get_all_links(), other.get_all_links())) \
507
514
  and self.__units == other.units \