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
@@ -1,400 +0,0 @@
1
- /******************************************************************************
2
- ** MODULE: MSXRPT.C
3
- ** PROJECT: EPANET-MSX
4
- ** DESCRIPTION: report writing routines for the EPANET Multi-Species
5
- ** Extension toolkit.
6
- ** AUTHORS: see AUTHORS
7
- ** Copyright: see AUTHORS
8
- ** License: see LICENSE
9
- ** VERSION: 2.0.00
10
- ** LAST UPDATE: 04/14/2021
11
- ******************************************************************************/
12
-
13
- #include <stdio.h>
14
- #include <string.h>
15
- #include <time.h>
16
- #include <math.h>
17
-
18
- #include "msxtypes.h"
19
- #include "epanet2.h"
20
-
21
- // Constants
22
- //----------
23
- #define SERIES_TABLE 0
24
- #define STATS_TABLE 1
25
-
26
- // External variables
27
- //--------------------
28
- extern MSXproject MSX; // MSX project data
29
-
30
- // Local variables
31
- //-----------------
32
- static char *Logo[] =
33
- {"******************************************************************",
34
- "* E P A N E T - M S X *",
35
- "* Multi-Species Water Quality *",
36
- "* Analysis for Pipe Networks *",
37
- "* Version 2.0.0 *", //2.0.00
38
- "******************************************************************"};
39
-
40
- static char PageHdr[] = " Page %d ";
41
- static char *StatsHdrs[] =
42
- {"", "Average Values ", "Minimum Values ",
43
- "Maximum Values ", "Range of Values "};
44
- static char Line[MAXLINE+1];
45
- static long LineNum;
46
- static long PageNum;
47
- static int *RptdSpecies;
48
- static struct TableHdrStruct
49
- {
50
- char Line1[MAXLINE+1];
51
- char Line2[MAXLINE+1];
52
- char Line3[MAXLINE+1];
53
- char Line4[MAXLINE+1];
54
- char Line5[MAXLINE+1];
55
- } TableHdr;
56
- static char IDname[MAXLINE+1];
57
-
58
- // Imported functions
59
- //--------------------
60
- void MSXinp_getSpeciesUnits(int m, char *units);
61
- float MSXout_getNodeQual(int k, int j, int m);
62
- float MSXout_getLinkQual(int k, int j, int m);
63
-
64
- // Exported functions
65
- //--------------------
66
- int MSXrpt_write(void);
67
- void MSXrpt_writeLine(char *line);
68
-
69
- // Local functions
70
- //-----------------
71
- static void createSeriesTables(void);
72
- static void createStatsTables(void);
73
- static void createTableHdr(int objType, int tableType);
74
- static void writeTableHdr(void);
75
- static void writeNodeTable(int j, int tableType);
76
- static void writeLinkTable(int j, int tableType);
77
- static void getHrsMins(int k, int *hrs, int *mins);
78
- static void newPage(void);
79
- static void writeLine(char *line);
80
-
81
- static void writemassbalance();
82
-
83
- //=============================================================================
84
-
85
- int MSXrpt_write()
86
- {
87
- INT4 magic = 0;
88
- int j;
89
- int recordsize = sizeof(INT4);
90
-
91
- // --- check that results are available
92
-
93
- if ( MSX.Nperiods < 1 ) return 0;
94
- if ( MSX.OutFile.file == NULL ) return ERR_OPEN_OUT_FILE;
95
- fseek(MSX.OutFile.file, -recordsize, SEEK_END);
96
- fread(&magic, sizeof(INT4), 1, MSX.OutFile.file);
97
- if ( magic != MAGICNUMBER ) return ERR_IO_OUT_FILE;
98
-
99
- // --- write program logo & project title
100
-
101
- PageNum = 1;
102
- LineNum = 1;
103
- newPage();
104
- for (j=0; j<=5; j++) writeLine(Logo[j]);
105
- writeLine("");
106
- writeLine(MSX.Title);
107
-
108
- // --- generate the appropriate type of table
109
-
110
- if ( MSX.Statflag == SERIES ) createSeriesTables();
111
- else createStatsTables();
112
-
113
- writemassbalance();
114
-
115
- writeLine("");
116
- return 0;
117
- }
118
-
119
- //=============================================================================
120
-
121
- void MSXrpt_writeLine(char *line)
122
- {
123
- writeLine(line);
124
- }
125
-
126
- //=============================================================================
127
-
128
- void createSeriesTables()
129
- {
130
- int j;
131
-
132
- // --- report on all requested nodes
133
-
134
- for (j=1; j<=MSX.Nobjects[NODE]; j++)
135
- {
136
- if ( !MSX.Node[j].rpt ) continue;
137
- ENgetnodeid(j, IDname);
138
- createTableHdr(NODE, SERIES_TABLE);
139
- writeNodeTable(j, SERIES_TABLE);
140
- }
141
-
142
- // --- report on all requested links
143
-
144
- for (j=1; j<=MSX.Nobjects[LINK]; j++)
145
- {
146
- if ( !MSX.Link[j].rpt ) continue;
147
- ENgetlinkid(j, IDname);
148
- createTableHdr(LINK, SERIES_TABLE);
149
- writeLinkTable(j, SERIES_TABLE);
150
- }
151
- }
152
-
153
- //=============================================================================
154
-
155
- void createStatsTables()
156
- {
157
- int j;
158
- int count;
159
-
160
- // --- check if any nodes to be reported
161
-
162
- count = 0;
163
- for (j = 1; j <= MSX.Nobjects[NODE]; j++) count += MSX.Node[j].rpt;
164
-
165
- // --- report on all requested nodes
166
-
167
- if ( count > 0 )
168
- {
169
- createTableHdr(NODE, STATS_TABLE);
170
- for (j = 1; j <= MSX.Nobjects[NODE]; j++)
171
- {
172
- if ( MSX.Node[j].rpt ) writeNodeTable(j, STATS_TABLE);
173
- }
174
- }
175
-
176
- // --- check if any links to be reported
177
-
178
- count = 0;
179
- for (j = 1; j <= MSX.Nobjects[LINK]; j++) count += MSX.Link[j].rpt;
180
-
181
- // --- report on all requested links
182
-
183
- if ( count > 0 )
184
- {
185
- createTableHdr(LINK, STATS_TABLE);
186
- for (j = 1; j <= MSX.Nobjects[LINK]; j++)
187
- {
188
- if ( MSX.Link[j].rpt ) writeLinkTable(j, STATS_TABLE);
189
- }
190
- }
191
- }
192
-
193
- //=============================================================================
194
-
195
- void createTableHdr(int objType, int tableType)
196
- {
197
- int m;
198
- char s1[MAXLINE+1];
199
- char s2[MAXLINE+1];
200
-
201
- if ( tableType == SERIES_TABLE )
202
- {
203
- if ( objType == NODE )
204
- sprintf(TableHdr.Line1, "<<< Node %s >>>", IDname);
205
- else
206
- sprintf(TableHdr.Line1, "<<< Link %s >>>", IDname);
207
- strcpy(TableHdr.Line2, "Time ");
208
- strcpy(TableHdr.Line3, "hr:min ");
209
- strcpy(TableHdr.Line4, "-------");
210
- }
211
- if ( tableType == STATS_TABLE )
212
- {
213
- strcpy(TableHdr.Line1, "");
214
- sprintf(TableHdr.Line2, "%-16s", StatsHdrs[tableType]);
215
- if ( objType == NODE ) strcpy(TableHdr.Line3, "for Node ");
216
- else strcpy(TableHdr.Line3, "for Link ");
217
- strcpy(TableHdr.Line4, "----------------");
218
- }
219
- for (m=1; m<=MSX.Nobjects[SPECIES]; m++)
220
- {
221
- if ( !MSX.Species[m].rpt ) continue;
222
- if ( objType == NODE && MSX.Species[m].type == WALL ) continue;
223
- sprintf(s1, " %10s", MSX.Species[m].id);
224
- strcat(TableHdr.Line2, s1);
225
- strcat(TableHdr.Line4, " ----------");
226
- MSXinp_getSpeciesUnits(m, s1);
227
- sprintf(s2, " %10s", s1);
228
- strcat(TableHdr.Line3, s2);
229
- }
230
- if ( MSX.PageSize > 0 && MSX.PageSize - LineNum < 8 ) newPage();
231
- else writeTableHdr();
232
- }
233
-
234
- //=============================================================================
235
-
236
- void writeTableHdr()
237
- {
238
- if ( MSX.PageSize > 0 && MSX.PageSize - LineNum < 6 ) newPage();
239
- writeLine("");
240
- writeLine(TableHdr.Line1);
241
- writeLine("");
242
- writeLine(TableHdr.Line2);
243
- writeLine(TableHdr.Line3);
244
- writeLine(TableHdr.Line4);
245
- }
246
-
247
- //=============================================================================
248
-
249
- void writeNodeTable(int j, int tableType)
250
- {
251
- int k, m, hrs, mins;
252
- char s[MAXLINE+1];
253
- float c;
254
-
255
- for (k=0; k<MSX.Nperiods; k++)
256
- {
257
- if ( tableType == SERIES_TABLE )
258
- {
259
- getHrsMins(k, &hrs, &mins);
260
- sprintf(Line, "%4d:%02d", hrs, mins);
261
- }
262
- if ( tableType == STATS_TABLE )
263
- {
264
- ENgetnodeid(j, IDname);
265
- sprintf(Line, "%-16s", IDname);
266
- }
267
- for (m=1; m<=MSX.Nobjects[SPECIES]; m++)
268
- {
269
- if ( !MSX.Species[m].rpt ) continue;
270
- if ( MSX.Species[m].type == WALL ) continue;
271
- c = MSXout_getNodeQual(k, j, m);
272
- sprintf(s, " %10.*f", MSX.Species[m].precision, c);
273
- strcat(Line, s);
274
- }
275
- writeLine(Line);
276
- }
277
- }
278
-
279
- //=============================================================================
280
-
281
- void writeLinkTable(int j, int tableType)
282
- {
283
- int k, m, hrs, mins;
284
- char s[MAXLINE+1];
285
- float c;
286
-
287
- for (k=0; k<MSX.Nperiods; k++)
288
- {
289
- if ( tableType == SERIES_TABLE )
290
- {
291
- getHrsMins(k, &hrs, &mins);
292
- sprintf(Line, "%4d:%02d", hrs, mins);
293
- }
294
- if ( tableType == STATS_TABLE )
295
- {
296
- ENgetlinkid(j, IDname);
297
- sprintf(Line, "%-16s", IDname);
298
- }
299
- for (m=1; m<=MSX.Nobjects[SPECIES]; m++)
300
- {
301
- if ( !MSX.Species[m].rpt ) continue;
302
- c = MSXout_getLinkQual(k, j, m);
303
- sprintf(s, " %10.*f", MSX.Species[m].precision, c);
304
- strcat(Line, s);
305
- }
306
- writeLine(Line);
307
- }
308
- }
309
-
310
- //=============================================================================
311
-
312
- void getHrsMins(int k, int *hrs, int *mins)
313
- {
314
- long m, h;
315
-
316
- m = (MSX.Rstart + k*MSX.Rstep) / 60;
317
- h = m / 60;
318
- m = m - 60*h;
319
- *hrs = h;
320
- *mins = m;
321
- }
322
-
323
- //=============================================================================
324
-
325
- void newPage()
326
- {
327
- char s[MAXLINE+1];
328
- LineNum = 1;
329
- sprintf(s,
330
- "\nPage %-3d EPANET-MSX 2.0.0", //2.0.0
331
- PageNum);
332
- writeLine(s);
333
- writeLine("");
334
- if ( PageNum > 1 ) writeTableHdr();
335
- PageNum++;
336
- }
337
-
338
- //=============================================================================
339
-
340
- void writeLine(char *line)
341
- {
342
- if ( LineNum == MSX.PageSize ) newPage();
343
- if ( MSX.RptFile.file ) fprintf(MSX.RptFile.file, " %s\n", line); //(modified, FS-01/07/2008)
344
- else ENwriteline(line);
345
- LineNum++;
346
- }
347
-
348
-
349
- void writemassbalance()
350
- /*
351
- **-------------------------------------------------------------
352
- ** Input: none
353
- ** Output: none
354
- ** Purpose: writes water quality mass balance ratio
355
- ** (Outflow + Final Storage) / Inflow + Initial Storage)
356
- ** to report file.
357
- **-------------------------------------------------------------
358
- */
359
- {
360
-
361
- char s1[MAXMSG + 1];
362
- int kunits = 0;
363
-
364
- for (int m = 1; m <= MSX.Nobjects[SPECIES]; m++)
365
- {
366
- if (MSX.Species[m].pipeExprType != RATE)
367
- continue;
368
-
369
- snprintf(s1, MAXMSG, "\n");
370
- writeLine(s1);
371
- snprintf(s1, MAXMSG, "Water Quality Mass Balance: %s (%s)", MSX.Species[m].id, MSX.Species[m].units);
372
- writeLine(s1);
373
- snprintf(s1, MAXMSG, "================================");
374
- writeLine(s1);
375
- snprintf(s1, MAXMSG, "Initial Mass: %12.5e", MSX.MassBalance.initial[m]);
376
- writeLine(s1);
377
- snprintf(s1, MAXMSG, "Mass Inflow: %12.5e", MSX.MassBalance.inflow[m]+ MSX.MassBalance.indisperse[m]);
378
- writeLine(s1);
379
- // snprintf(s1, MAXMSG, "Mass Dispersed Inflow: %12.5e", MSX.MassBalance.indisperse[m]);
380
- // writeLine(s1);
381
- snprintf(s1, MAXMSG, "Mass Outflow: %12.5e", MSX.MassBalance.outflow[m]);
382
- writeLine(s1);
383
- snprintf(s1, MAXMSG, "Mass Reacted: %12.5e", MSX.MassBalance.reacted[m]);
384
- writeLine(s1);
385
- snprintf(s1, MAXMSG, "Final Mass: %12.5e", MSX.MassBalance.final[m]);
386
- writeLine(s1);
387
- snprintf(s1, MAXMSG, "Mass Ratio: %-.5f", MSX.MassBalance.ratio[m]);
388
- writeLine(s1);
389
- snprintf(s1, MAXMSG, "================================\n");
390
- writeLine(s1);
391
- }
392
- }
393
-
394
-
395
-
396
-
397
-
398
-
399
-
400
-