epyt-flow 0.7.2__py3-none-any.whl → 0.8.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.
- epyt_flow/VERSION +1 -1
- epyt_flow/gym/scenario_control_env.py +129 -10
- epyt_flow/serialization.py +10 -3
- epyt_flow/simulation/events/__init__.py +1 -0
- epyt_flow/simulation/events/leakages.py +55 -12
- epyt_flow/simulation/events/quality_events.py +194 -0
- epyt_flow/simulation/events/system_event.py +5 -0
- epyt_flow/simulation/scada/scada_data.py +512 -64
- epyt_flow/simulation/scada/scada_data_export.py +7 -5
- epyt_flow/simulation/scenario_config.py +13 -2
- epyt_flow/simulation/scenario_simulator.py +275 -187
- epyt_flow/simulation/scenario_visualizer.py +1259 -13
- epyt_flow/simulation/sensor_config.py +21 -10
- {epyt_flow-0.7.2.dist-info → epyt_flow-0.8.0.dist-info}/METADATA +31 -30
- {epyt_flow-0.7.2.dist-info → epyt_flow-0.8.0.dist-info}/RECORD +18 -17
- {epyt_flow-0.7.2.dist-info → epyt_flow-0.8.0.dist-info}/WHEEL +1 -1
- {epyt_flow-0.7.2.dist-info → epyt_flow-0.8.0.dist-info}/LICENSE +0 -0
- {epyt_flow-0.7.2.dist-info → epyt_flow-0.8.0.dist-info}/top_level.txt +0 -0
|
@@ -33,6 +33,7 @@ MASS_UNIT_UG = 5
|
|
|
33
33
|
MASS_UNIT_MOL = 6
|
|
34
34
|
MASS_UNIT_MMOL = 7
|
|
35
35
|
TIME_UNIT_HRS = 8
|
|
36
|
+
MASS_UNIT_CUSTOM = 9
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
def areaunit_to_id(unit_desc: str) -> int:
|
|
@@ -68,10 +69,15 @@ def massunit_to_id(unit_desc: str) -> int:
|
|
|
68
69
|
`int`
|
|
69
70
|
Corresponding mass unit ID.
|
|
70
71
|
"""
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
mass_unit_dict = {"MG": MASS_UNIT_MG,
|
|
73
|
+
"UG": MASS_UNIT_UG,
|
|
74
|
+
"MOL": MASS_UNIT_MOL,
|
|
75
|
+
"MMOL": MASS_UNIT_MMOL}
|
|
76
|
+
|
|
77
|
+
if unit_desc in mass_unit_dict:
|
|
78
|
+
return mass_unit_dict[unit_desc]
|
|
79
|
+
else:
|
|
80
|
+
return MASS_UNIT_CUSTOM
|
|
75
81
|
|
|
76
82
|
|
|
77
83
|
def qualityunit_to_id(unit_desc: str) -> int:
|
|
@@ -116,10 +122,11 @@ def massunit_to_str(unit_id: int) -> str:
|
|
|
116
122
|
|
|
117
123
|
Must be one of the following constant:
|
|
118
124
|
|
|
119
|
-
- MASS_UNIT_MG
|
|
120
|
-
- MASS_UNIT_UG
|
|
121
|
-
- MASS_UNIT_MOL
|
|
122
|
-
- MASS_UNIT_MMOL
|
|
125
|
+
- MASS_UNIT_MG = 4
|
|
126
|
+
- MASS_UNIT_UG = 5
|
|
127
|
+
- MASS_UNIT_MOL = 6
|
|
128
|
+
- MASS_UNIT_MMOL = 7
|
|
129
|
+
- MASS_UNIT_CUSTOM = 9
|
|
123
130
|
|
|
124
131
|
Returns
|
|
125
132
|
-------
|
|
@@ -136,6 +143,8 @@ def massunit_to_str(unit_id: int) -> str:
|
|
|
136
143
|
return "MOL"
|
|
137
144
|
elif unit_id == MASS_UNIT_MMOL:
|
|
138
145
|
return "MMOL"
|
|
146
|
+
elif unit_id == MASS_UNIT_CUSTOM:
|
|
147
|
+
return "CUSTOM UNIT"
|
|
139
148
|
else:
|
|
140
149
|
raise ValueError(f"Unknown mass unit ID '{unit_id}'")
|
|
141
150
|
|
|
@@ -698,7 +707,8 @@ class SensorConfig(JsonSerializable):
|
|
|
698
707
|
raise ValueError("Inconsistency between 'bulk_species_mass_unit' and 'bulk_species'")
|
|
699
708
|
if any(not isinstance(mass_unit, int) for mass_unit in bulk_species_mass_unit):
|
|
700
709
|
raise TypeError("All items in 'bulk_species_mass_unit' must be an instance of 'int'")
|
|
701
|
-
if any(mass_unit not in [MASS_UNIT_MG, MASS_UNIT_UG, MASS_UNIT_MOL, MASS_UNIT_MMOL
|
|
710
|
+
if any(mass_unit not in [MASS_UNIT_MG, MASS_UNIT_UG, MASS_UNIT_MOL, MASS_UNIT_MMOL,
|
|
711
|
+
MASS_UNIT_CUSTOM]
|
|
702
712
|
for mass_unit in bulk_species_mass_unit):
|
|
703
713
|
raise ValueError("Invalid mass unit in 'bulk_species_mass_unit'")
|
|
704
714
|
|
|
@@ -707,7 +717,8 @@ class SensorConfig(JsonSerializable):
|
|
|
707
717
|
"and 'surface_species'")
|
|
708
718
|
if any(not isinstance(mass_unit, int) for mass_unit in surface_species_mass_unit):
|
|
709
719
|
raise TypeError("All items in 'surface_species_mass_unit' must be an instance of 'int'")
|
|
710
|
-
if any(mass_unit not in [MASS_UNIT_MG, MASS_UNIT_UG, MASS_UNIT_MOL, MASS_UNIT_MMOL
|
|
720
|
+
if any(mass_unit not in [MASS_UNIT_MG, MASS_UNIT_UG, MASS_UNIT_MOL, MASS_UNIT_MMOL,
|
|
721
|
+
MASS_UNIT_CUSTOM]
|
|
711
722
|
for mass_unit in surface_species_mass_unit):
|
|
712
723
|
raise ValueError("Invalid mass unit in 'surface_species_mass_unit'")
|
|
713
724
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: epyt-flow
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: EPyT-Flow -- EPANET Python Toolkit - Flow
|
|
5
5
|
Author-email: André Artelt <aartelt@techfak.uni-bielefeld.de>, "Marios S. Kyriakou" <kiriakou.marios@ucy.ac.cy>, "Stelios G. Vrachimis" <vrachimis.stelios@ucy.ac.cy>
|
|
6
6
|
License: MIT License
|
|
@@ -20,17 +20,19 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
20
20
|
Requires-Python: >=3.9
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: epyt
|
|
24
|
-
Requires-Dist: requests
|
|
25
|
-
Requires-Dist: scipy
|
|
26
|
-
Requires-Dist: u-msgpack-python
|
|
27
|
-
Requires-Dist: networkx
|
|
28
|
-
Requires-Dist: scikit-learn
|
|
29
|
-
Requires-Dist: tqdm
|
|
30
|
-
Requires-Dist: openpyxl
|
|
31
|
-
Requires-Dist: falcon
|
|
32
|
-
Requires-Dist: multiprocess
|
|
33
|
-
Requires-Dist: geopandas
|
|
23
|
+
Requires-Dist: epyt>=1.2.0
|
|
24
|
+
Requires-Dist: requests>=2.31.0
|
|
25
|
+
Requires-Dist: scipy>=1.11.4
|
|
26
|
+
Requires-Dist: u-msgpack-python>=2.8.0
|
|
27
|
+
Requires-Dist: networkx>=3.2.1
|
|
28
|
+
Requires-Dist: scikit-learn>=1.4.0
|
|
29
|
+
Requires-Dist: tqdm>=4.66.2
|
|
30
|
+
Requires-Dist: openpyxl>=3.1.2
|
|
31
|
+
Requires-Dist: falcon>=3.1.3
|
|
32
|
+
Requires-Dist: multiprocess>=0.70.16
|
|
33
|
+
Requires-Dist: geopandas>=0.14.4
|
|
34
|
+
Requires-Dist: svgpath2mpl>=1.0.0
|
|
35
|
+
Requires-Dist: Deprecated>=1.2.14
|
|
34
36
|
Requires-Dist: psutil
|
|
35
37
|
|
|
36
38
|
[](https://pypi.org/project/epyt-flow/)
|
|
@@ -40,6 +42,7 @@ Requires-Dist: psutil
|
|
|
40
42
|
[](https://epyt-flow.readthedocs.io/en/stable/?badge=stable)
|
|
41
43
|
[](https://pepy.tech/project/epyt-flow)
|
|
42
44
|
[](https://pepy.tech/project/epyt-flow)
|
|
45
|
+
[](https://doi.org/10.21105/joss.07104)
|
|
43
46
|
|
|
44
47
|
# EPyT-Flow -- EPANET Python Toolkit - Flow
|
|
45
48
|
|
|
@@ -121,7 +124,7 @@ pip install .
|
|
|
121
124
|
```python
|
|
122
125
|
from epyt_flow.data.benchmarks import load_leakdb_scenarios
|
|
123
126
|
from epyt_flow.simulation import ScenarioSimulator
|
|
124
|
-
from epyt_flow.utils import to_seconds
|
|
127
|
+
from epyt_flow.utils import to_seconds
|
|
125
128
|
|
|
126
129
|
|
|
127
130
|
if __name__ == "__main__":
|
|
@@ -144,16 +147,10 @@ if __name__ == "__main__":
|
|
|
144
147
|
|
|
145
148
|
# Print & plot sensor readings over the entire simulation
|
|
146
149
|
print(f"Pressure readings: {scada_data.get_data_pressures()}")
|
|
147
|
-
|
|
148
|
-
labels=[f"Node {n_id}" for n_id in
|
|
149
|
-
scada_data.sensor_config.pressure_sensors],
|
|
150
|
-
x_axis_label="Time (30min steps)",
|
|
151
|
-
y_axis_label="Pressure in $m$")
|
|
150
|
+
scada_data.plot_pressures()
|
|
152
151
|
|
|
153
152
|
print(f"Flow readings: {scada_data.get_data_flows()}")
|
|
154
|
-
|
|
155
|
-
x_axis_label="Time (30min steps)",
|
|
156
|
-
y_axis_label="Flow rate in $m^3/h$")
|
|
153
|
+
scada_data.plot_flows()
|
|
157
154
|
```
|
|
158
155
|
### Generated plots
|
|
159
156
|
|
|
@@ -194,15 +191,19 @@ MIT license -- see [LICENSE](LICENSE)
|
|
|
194
191
|
|
|
195
192
|
If you use this software, please cite it as follows:
|
|
196
193
|
|
|
197
|
-
```
|
|
198
|
-
@
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
194
|
+
```bibtex
|
|
195
|
+
@article{Artelt2024,
|
|
196
|
+
doi = {10.21105/joss.07104},
|
|
197
|
+
url = {https://doi.org/10.21105/joss.07104},
|
|
198
|
+
year = {2024},
|
|
199
|
+
publisher = {The Open Journal},
|
|
200
|
+
volume = {9},
|
|
201
|
+
number = {103},
|
|
202
|
+
pages = {7104},
|
|
203
|
+
author = {André Artelt and Marios S. Kyriakou and Stelios G. Vrachimis and Demetrios G. Eliades and Barbara Hammer and Marios M. Polycarpou},
|
|
204
|
+
title = {EPyT-Flow: A Toolkit for Generating Water Distribution Network Data},
|
|
205
|
+
journal = {Journal of Open Source Software}
|
|
206
|
+
}
|
|
206
207
|
```
|
|
207
208
|
|
|
208
209
|
## How to get Support?
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
epyt_flow/VERSION,sha256=
|
|
1
|
+
epyt_flow/VERSION,sha256=pmeA2iMQO-rxJDK0GFCJZrMaKjp4f5RopbbNqoZnwe8,6
|
|
2
2
|
epyt_flow/__init__.py,sha256=KNDiPWiHdB9a5ZF1ipjA1uoq61TwU2ThjaStpvSLBtY,1742
|
|
3
3
|
epyt_flow/metrics.py,sha256=W-dolnrmWfoanyvg-knoe2QMUtFwV1xODp4D4EwsQ00,14261
|
|
4
|
-
epyt_flow/serialization.py,sha256=
|
|
4
|
+
epyt_flow/serialization.py,sha256=aT4R0vXQgmHaOJ8cyWc8TjcnyFQzwjcHuNbtc1ggM6Y,14191
|
|
5
5
|
epyt_flow/topology.py,sha256=8gqgJrKxw0zY69sIKo4NxrQAoXHP1Ni00U2DV09vR6g,25275
|
|
6
6
|
epyt_flow/utils.py,sha256=GJDktl7ciUPJxqMg9f2nCnQf6DosNd2mxeKOy7omkik,15196
|
|
7
7
|
epyt_flow/EPANET/compile_linux.sh,sha256=wcrDyiB8NkivmaC-X9FI2WxhY3IJqDLiyIbVTv2XEPY,489
|
|
@@ -92,7 +92,7 @@ epyt_flow/data/benchmarks/leakdb_data.py,sha256=FNssgMkC1wqWVlaOrrihr4Od9trEZY7K
|
|
|
92
92
|
epyt_flow/data/benchmarks/water_usage.py,sha256=FLqjff3pha33oEU9ZM3UGPXn9eJJumsJH8Gdj7YFX3A,4778
|
|
93
93
|
epyt_flow/gym/__init__.py,sha256=KNTDtPTEtHwZ4ehHfj9qGw81Z9acFqPIgMzYUzH5_uM,115
|
|
94
94
|
epyt_flow/gym/control_gyms.py,sha256=xbq1gjUC2i-TR_0jXBxXFM24lo_ykHLqMEEpmXPaGq0,1281
|
|
95
|
-
epyt_flow/gym/scenario_control_env.py,sha256=
|
|
95
|
+
epyt_flow/gym/scenario_control_env.py,sha256=SYev3RjPs4-m74V7gCmYrxtAEVEvE-H8I12eQ2NYRj8,12349
|
|
96
96
|
epyt_flow/models/__init__.py,sha256=be5s08y1Tg66SuNYKGz5GnNMHThnQJo8SWJdT9493Kc,75
|
|
97
97
|
epyt_flow/models/event_detector.py,sha256=idR7byBgloo07XEJEyMIwi49VW4wxJErLQtI-tJXWPs,789
|
|
98
98
|
epyt_flow/models/sensor_interpolation_detector.py,sha256=5MBK9WlliGPonrNApf0j9lp-NjwF0iTwPDXx4yv7Fa0,3624
|
|
@@ -111,29 +111,30 @@ epyt_flow/rest_api/scenario/simulation_handlers.py,sha256=oY1Ch6ZQgYT_5WeE1I7tvG
|
|
|
111
111
|
epyt_flow/rest_api/scenario/uncertainty_handlers.py,sha256=uuu6AP11ZZUp2P3Dnukjg5ZTjyYKljlubg1xLN1GnXY,4048
|
|
112
112
|
epyt_flow/simulation/__init__.py,sha256=VGGJqJRUoXZjKJ0-m6KPp3JQqD_1TFW0pofLgkwZJ8M,164
|
|
113
113
|
epyt_flow/simulation/parallel_simulation.py,sha256=VmC7xemjxRB_N0fx1AAQ7ux82tnyTi7jk7jfFpeg7gM,6523
|
|
114
|
-
epyt_flow/simulation/scenario_config.py,sha256=
|
|
115
|
-
epyt_flow/simulation/scenario_simulator.py,sha256=
|
|
116
|
-
epyt_flow/simulation/scenario_visualizer.py,sha256=
|
|
117
|
-
epyt_flow/simulation/sensor_config.py,sha256=
|
|
118
|
-
epyt_flow/simulation/events/__init__.py,sha256=
|
|
114
|
+
epyt_flow/simulation/scenario_config.py,sha256=fpG9vs9a7Wedf03cpIQGfB0SNpJlnYyoO6KFLrB2sJU,27188
|
|
115
|
+
epyt_flow/simulation/scenario_simulator.py,sha256=NYivKsSegRuaMkpgodPx9qX4HJqrWYC-zFy4ix7V92g,114708
|
|
116
|
+
epyt_flow/simulation/scenario_visualizer.py,sha256=U7bT4MGEb0IG2Y_HskqdDNBD_d8drcfoMC7hbL3idM4,59259
|
|
117
|
+
epyt_flow/simulation/sensor_config.py,sha256=ZiTFQpyftLSVXd0p5egBxxHe47vD9af_1Tv7ppJR8Y0,92637
|
|
118
|
+
epyt_flow/simulation/events/__init__.py,sha256=gv8ZcvwjJN0Z5MwRXEOVFRNq4X5NPyyqXIQnhBxszQ0,215
|
|
119
119
|
epyt_flow/simulation/events/actuator_events.py,sha256=2_MPYbYO9As6fMkm5Oy9pjSB9kCvFuKpGu8ykYDAydg,7903
|
|
120
120
|
epyt_flow/simulation/events/event.py,sha256=kARPV20XCAl6zxnJwI9U7ICtZUPACO_rgAmtHm1mGCs,2603
|
|
121
|
-
epyt_flow/simulation/events/leakages.py,sha256=
|
|
121
|
+
epyt_flow/simulation/events/leakages.py,sha256=EBH8i-9yu9F6MRG-rNFGhesk0sJspQ92Q7tQCghk-aY,17767
|
|
122
|
+
epyt_flow/simulation/events/quality_events.py,sha256=Rp8t7aXZU4jGekdIRB85F9I5qtI4QQk3jX2Trfac5hM,7199
|
|
122
123
|
epyt_flow/simulation/events/sensor_faults.py,sha256=XX6k-GJh9RWZ4x54eGj9um-Ir9Eq41tY_9pRSCeYeqc,8447
|
|
123
124
|
epyt_flow/simulation/events/sensor_reading_attack.py,sha256=bo5VavArN0wD5AHbIXJC9NFGZ7KR1uyWE6tBtwj0k9I,7538
|
|
124
125
|
epyt_flow/simulation/events/sensor_reading_event.py,sha256=rQ-CmdpSUyZzDFYwNUGH2jGoj0oyU-aAb-7E8Oshhqw,6785
|
|
125
|
-
epyt_flow/simulation/events/system_event.py,sha256=
|
|
126
|
+
epyt_flow/simulation/events/system_event.py,sha256=X6YGGjm0FTynL19wGST_BLXimGiotdpWdoEphT3496s,2515
|
|
126
127
|
epyt_flow/simulation/scada/__init__.py,sha256=ZFAxJVqwEVsgiyFilFetnb13gPhZg1JEOPWYvKIJT4c,90
|
|
127
128
|
epyt_flow/simulation/scada/advanced_control.py,sha256=5h7dmSMcNlTE7TMZa8gQVnOCGMf7uZy60r9aOfKDxMc,4487
|
|
128
|
-
epyt_flow/simulation/scada/scada_data.py,sha256=
|
|
129
|
-
epyt_flow/simulation/scada/scada_data_export.py,sha256=
|
|
129
|
+
epyt_flow/simulation/scada/scada_data.py,sha256=qu5KVP0Gnu4r3M_FbLXJekGjlje77h7Ppcrj_ey4UjU,164106
|
|
130
|
+
epyt_flow/simulation/scada/scada_data_export.py,sha256=iSz2SlpjVpK4jcx3iq6Zu7LbEAp_77fRyba_pkc5Pac,11572
|
|
130
131
|
epyt_flow/uncertainty/__init__.py,sha256=ZRjuJL9rDpWVSdPwObPxFpEmMTcgAl3VmPOsS6cIyGg,89
|
|
131
132
|
epyt_flow/uncertainty/model_uncertainty.py,sha256=SD2sYGqj7K0Ys0Lvak4HsbP18A0SmwsK5Mnys_pZilg,14191
|
|
132
133
|
epyt_flow/uncertainty/sensor_noise.py,sha256=zJVULxnxVPSSqc6UW0iwZ9O-HGf9dn4CwScPqf4yCY0,2324
|
|
133
134
|
epyt_flow/uncertainty/uncertainties.py,sha256=jzaAwv5--HGc-H4-SwB0s-pAnzhhFuc06IXck7rC5l8,17902
|
|
134
135
|
epyt_flow/uncertainty/utils.py,sha256=gq66c9-QMOxOqI6wgWLyFxjVV0fbG0_8Yzd6mQjNYNo,5315
|
|
135
|
-
epyt_flow-0.
|
|
136
|
-
epyt_flow-0.
|
|
137
|
-
epyt_flow-0.
|
|
138
|
-
epyt_flow-0.
|
|
139
|
-
epyt_flow-0.
|
|
136
|
+
epyt_flow-0.8.0.dist-info/LICENSE,sha256=-4hYIY2BLmCkdOv2_PehEwlnMKTCes8_oyIUXjKtkug,1076
|
|
137
|
+
epyt_flow-0.8.0.dist-info/METADATA,sha256=rUMgwUMNclREWRm4XLMi5W74guRZltV-Q2vahIDzLXc,9218
|
|
138
|
+
epyt_flow-0.8.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
139
|
+
epyt_flow-0.8.0.dist-info/top_level.txt,sha256=Wh_kd7TRL8ownCw3Y3dxx-9C0iTSk6wNauv_NX9JcrY,10
|
|
140
|
+
epyt_flow-0.8.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|