epyt-flow 0.14.1__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 (106) 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 +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-0.14.1.dist-info → epyt_flow-0.15.0b1.dist-info}/METADATA +12 -18
  19. epyt_flow-0.15.0b1.dist-info/RECORD +65 -0
  20. epyt_flow/EPANET/EPANET/SRC_engines/AUTHORS +0 -60
  21. epyt_flow/EPANET/EPANET/SRC_engines/LICENSE +0 -21
  22. epyt_flow/EPANET/EPANET/SRC_engines/enumstxt.h +0 -151
  23. epyt_flow/EPANET/EPANET/SRC_engines/epanet.c +0 -5930
  24. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.c +0 -961
  25. epyt_flow/EPANET/EPANET/SRC_engines/errors.dat +0 -79
  26. epyt_flow/EPANET/EPANET/SRC_engines/flowbalance.c +0 -186
  27. epyt_flow/EPANET/EPANET/SRC_engines/funcs.h +0 -219
  28. epyt_flow/EPANET/EPANET/SRC_engines/genmmd.c +0 -1000
  29. epyt_flow/EPANET/EPANET/SRC_engines/hash.c +0 -177
  30. epyt_flow/EPANET/EPANET/SRC_engines/hash.h +0 -28
  31. epyt_flow/EPANET/EPANET/SRC_engines/hydcoeffs.c +0 -1303
  32. epyt_flow/EPANET/EPANET/SRC_engines/hydraul.c +0 -1172
  33. epyt_flow/EPANET/EPANET/SRC_engines/hydsolver.c +0 -781
  34. epyt_flow/EPANET/EPANET/SRC_engines/hydstatus.c +0 -442
  35. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2.h +0 -464
  36. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_2.h +0 -1960
  37. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_enums.h +0 -518
  38. epyt_flow/EPANET/EPANET/SRC_engines/inpfile.c +0 -884
  39. epyt_flow/EPANET/EPANET/SRC_engines/input1.c +0 -672
  40. epyt_flow/EPANET/EPANET/SRC_engines/input2.c +0 -735
  41. epyt_flow/EPANET/EPANET/SRC_engines/input3.c +0 -2265
  42. epyt_flow/EPANET/EPANET/SRC_engines/leakage.c +0 -527
  43. epyt_flow/EPANET/EPANET/SRC_engines/mempool.c +0 -146
  44. epyt_flow/EPANET/EPANET/SRC_engines/mempool.h +0 -24
  45. epyt_flow/EPANET/EPANET/SRC_engines/output.c +0 -853
  46. epyt_flow/EPANET/EPANET/SRC_engines/project.c +0 -1691
  47. epyt_flow/EPANET/EPANET/SRC_engines/quality.c +0 -695
  48. epyt_flow/EPANET/EPANET/SRC_engines/qualreact.c +0 -800
  49. epyt_flow/EPANET/EPANET/SRC_engines/qualroute.c +0 -696
  50. epyt_flow/EPANET/EPANET/SRC_engines/report.c +0 -1557
  51. epyt_flow/EPANET/EPANET/SRC_engines/rules.c +0 -1500
  52. epyt_flow/EPANET/EPANET/SRC_engines/smatrix.c +0 -871
  53. epyt_flow/EPANET/EPANET/SRC_engines/text.h +0 -508
  54. epyt_flow/EPANET/EPANET/SRC_engines/types.h +0 -928
  55. epyt_flow/EPANET/EPANET/SRC_engines/util/cstr_helper.c +0 -59
  56. epyt_flow/EPANET/EPANET/SRC_engines/util/cstr_helper.h +0 -38
  57. epyt_flow/EPANET/EPANET/SRC_engines/util/errormanager.c +0 -92
  58. epyt_flow/EPANET/EPANET/SRC_engines/util/errormanager.h +0 -39
  59. epyt_flow/EPANET/EPANET/SRC_engines/util/filemanager.c +0 -212
  60. epyt_flow/EPANET/EPANET/SRC_engines/util/filemanager.h +0 -81
  61. epyt_flow/EPANET/EPANET/SRC_engines/validate.c +0 -408
  62. epyt_flow/EPANET/EPANET-MSX/MSX_Updates.txt +0 -53
  63. epyt_flow/EPANET/EPANET-MSX/Src/dispersion.h +0 -27
  64. epyt_flow/EPANET/EPANET-MSX/Src/hash.c +0 -107
  65. epyt_flow/EPANET/EPANET-MSX/Src/hash.h +0 -28
  66. epyt_flow/EPANET/EPANET-MSX/Src/include/epanetmsx.h +0 -102
  67. epyt_flow/EPANET/EPANET-MSX/Src/include/epanetmsx_export.h +0 -42
  68. epyt_flow/EPANET/EPANET-MSX/Src/mathexpr.c +0 -937
  69. epyt_flow/EPANET/EPANET-MSX/Src/mathexpr.h +0 -39
  70. epyt_flow/EPANET/EPANET-MSX/Src/mempool.c +0 -204
  71. epyt_flow/EPANET/EPANET-MSX/Src/mempool.h +0 -24
  72. epyt_flow/EPANET/EPANET-MSX/Src/msxchem.c +0 -1285
  73. epyt_flow/EPANET/EPANET-MSX/Src/msxcompiler.c +0 -368
  74. epyt_flow/EPANET/EPANET-MSX/Src/msxdict.h +0 -42
  75. epyt_flow/EPANET/EPANET-MSX/Src/msxdispersion.c +0 -586
  76. epyt_flow/EPANET/EPANET-MSX/Src/msxerr.c +0 -116
  77. epyt_flow/EPANET/EPANET-MSX/Src/msxfile.c +0 -260
  78. epyt_flow/EPANET/EPANET-MSX/Src/msxfuncs.c +0 -175
  79. epyt_flow/EPANET/EPANET-MSX/Src/msxfuncs.h +0 -35
  80. epyt_flow/EPANET/EPANET-MSX/Src/msxinp.c +0 -1504
  81. epyt_flow/EPANET/EPANET-MSX/Src/msxout.c +0 -401
  82. epyt_flow/EPANET/EPANET-MSX/Src/msxproj.c +0 -791
  83. epyt_flow/EPANET/EPANET-MSX/Src/msxqual.c +0 -2010
  84. epyt_flow/EPANET/EPANET-MSX/Src/msxrpt.c +0 -400
  85. epyt_flow/EPANET/EPANET-MSX/Src/msxtank.c +0 -422
  86. epyt_flow/EPANET/EPANET-MSX/Src/msxtoolkit.c +0 -1164
  87. epyt_flow/EPANET/EPANET-MSX/Src/msxtypes.h +0 -551
  88. epyt_flow/EPANET/EPANET-MSX/Src/msxutils.c +0 -524
  89. epyt_flow/EPANET/EPANET-MSX/Src/msxutils.h +0 -56
  90. epyt_flow/EPANET/EPANET-MSX/Src/newton.c +0 -158
  91. epyt_flow/EPANET/EPANET-MSX/Src/newton.h +0 -34
  92. epyt_flow/EPANET/EPANET-MSX/Src/rk5.c +0 -287
  93. epyt_flow/EPANET/EPANET-MSX/Src/rk5.h +0 -39
  94. epyt_flow/EPANET/EPANET-MSX/Src/ros2.c +0 -293
  95. epyt_flow/EPANET/EPANET-MSX/Src/ros2.h +0 -35
  96. epyt_flow/EPANET/EPANET-MSX/Src/smatrix.c +0 -816
  97. epyt_flow/EPANET/EPANET-MSX/Src/smatrix.h +0 -29
  98. epyt_flow/EPANET/EPANET-MSX/readme.txt +0 -14
  99. epyt_flow/EPANET/compile_linux.sh +0 -4
  100. epyt_flow/EPANET/compile_macos.sh +0 -4
  101. epyt_flow/simulation/backend/__init__.py +0 -1
  102. epyt_flow/simulation/backend/my_epyt.py +0 -1101
  103. epyt_flow-0.14.1.dist-info/RECORD +0 -148
  104. {epyt_flow-0.14.1.dist-info → epyt_flow-0.15.0b1.dist-info}/WHEEL +0 -0
  105. {epyt_flow-0.14.1.dist-info → epyt_flow-0.15.0b1.dist-info}/licenses/LICENSE +0 -0
  106. {epyt_flow-0.14.1.dist-info → epyt_flow-0.15.0b1.dist-info}/top_level.txt +0 -0
@@ -1,408 +0,0 @@
1
- /*
2
- ******************************************************************************
3
- Project: OWA EPANET
4
- Version: 2.3
5
- Module: validate.c
6
- Description: validates project data
7
- Authors: see AUTHORS
8
- Copyright: see AUTHORS
9
- License: see LICENSE
10
- Last Updated: 03/18/2024
11
- ******************************************************************************
12
- */
13
-
14
- #include <stdlib.h>
15
- #include <stdio.h>
16
- #include <string.h>
17
- #include <math.h>
18
-
19
- #include "types.h"
20
- #include "funcs.h"
21
- #include "text.h"
22
-
23
- // Exported functions
24
- int validateproject(Project *);
25
- void reindextanks(Project *);
26
-
27
- int validatetanks(Project *pr)
28
- /*
29
- **-------------------------------------------------------------------
30
- ** Input: none
31
- ** Output: returns 1 if successful, 0 if not
32
- ** Purpose: checks for valid tank levels.
33
- **-------------------------------------------------------------------
34
- */
35
- {
36
- Network *net = &pr->network;
37
- int i, j, n, result = 1, levelerr;
38
- char errmsg[MAXMSG+1] = "";
39
- Stank *tank;
40
- Scurve *curve;
41
- double elev;
42
-
43
- for (j = 1; j <= net->Ntanks; j++)
44
- {
45
- tank = &net->Tank[j];
46
- if (tank->A == 0.0) continue; // Skip reservoirs
47
-
48
- // Check for valid lower/upper tank levels
49
- levelerr = 0;
50
- if (tank->H0 > tank->Hmax ||
51
- tank->Hmin > tank->Hmax ||
52
- tank->H0 < tank->Hmin
53
- ) levelerr = 1;
54
-
55
- // Check that tank heights are within volume curve
56
- elev = net->Node[tank->Node].El;
57
- i = tank->Vcurve;
58
- if (i > 0)
59
- {
60
- curve = &net->Curve[i];
61
- n = curve->Npts - 1;
62
- if ((tank->Hmin - elev) * pr->Ucf[ELEV] < curve->X[0] - TINY ||
63
- (tank->Hmax - elev) * pr->Ucf[ELEV] > curve->X[n] + TINY)
64
- {
65
- levelerr = 1;
66
- }
67
- }
68
-
69
- // Report error in levels if found
70
- if (levelerr)
71
- {
72
- sprintf(pr->Msg, "Error 225: %s node %s", geterrmsg(225, errmsg),
73
- net->Node[tank->Node].ID);
74
- writeline(pr, pr->Msg);
75
- result = 0;
76
- }
77
- }
78
- return result;
79
- }
80
-
81
- int validatepatterns(Project *pr)
82
- /*
83
- **-------------------------------------------------------------------
84
- ** Input: none
85
- ** Output: returns 1 if successful, 0 if not
86
- ** Purpose: checks if time patterns have data.
87
- **-------------------------------------------------------------------
88
- */
89
- {
90
- Network *net = &pr->network;
91
- int j, result = 1;
92
- char errmsg[MAXMSG+1] = "";
93
-
94
- if (pr->network.Pattern != NULL)
95
- {
96
- for (j = 0; j <= pr->network.Npats; j++)
97
- {
98
- if (pr->network.Pattern[j].Length == 0)
99
- {
100
- sprintf(pr->Msg, "Error 232: %s %s", geterrmsg(232, errmsg),
101
- pr->network.Pattern[j].ID);
102
- writeline(pr, pr->Msg);
103
- result = 0;
104
- }
105
- }
106
- }
107
- return result;
108
- }
109
-
110
- int validatecurves(Project *pr)
111
- /*
112
- **-------------------------------------------------------------------
113
- ** Input: none
114
- ** Output: returns 1 if successful, 0 if not
115
- ** Purpose: checks if data curves have data.
116
- **-------------------------------------------------------------------
117
- */
118
- {
119
- int i, j, npts, result = 1;
120
- char errmsg[MAXMSG+1] = "";
121
- Scurve *curve;
122
-
123
- if (pr->network.Curve != NULL)
124
- {
125
- for (j = 1; j <= pr->network.Ncurves; j++)
126
- {
127
- // Check that curve has data
128
- curve = &pr->network.Curve[j];
129
- npts = curve->Npts;
130
- if (npts == 0)
131
- {
132
- sprintf(pr->Msg, "Error 231: %s %s", geterrmsg(231, errmsg),
133
- curve->ID);
134
- writeline(pr, pr->Msg);
135
- result = 0;
136
- }
137
-
138
- // Check that x values are increasing
139
- for (i = 1; i < npts; i++)
140
- {
141
- if (curve->X[i-1] >= curve->X[i])
142
- {
143
- sprintf(pr->Msg, "Error 230: %s %s", geterrmsg(230, errmsg),
144
- curve->ID);
145
- writeline(pr, pr->Msg);
146
- result = 0;
147
- break;
148
- }
149
- }
150
- }
151
- }
152
- return result;
153
- }
154
-
155
- int powerfuncpump(double h0, double h1, double h2, double q1, double q2,
156
- double *a, double *b, double *c)
157
- /*
158
- **---------------------------------------------------------
159
- ** Input: h0 = shutoff head
160
- ** h1 = design head
161
- ** h2 = head at max. flow
162
- ** q1 = design flow
163
- ** q2 = max. flow
164
- ** Output: *a, *b, *c = pump curve coeffs. (H = a-bQ^c),
165
- ** Returns 1 if successful, 0 otherwise.
166
- ** Purpose: computes coeffs. for a power function pump curve
167
- **----------------------------------------------------------
168
- */
169
- {
170
- double h4, h5;
171
-
172
- if (h0 < TINY || h0 - h1 < TINY || h1 - h2 < TINY ||
173
- q1 < TINY || q2 - q1 < TINY
174
- ) return 0;
175
- *a = h0;
176
- h4 = h0 - h1;
177
- h5 = h0 - h2;
178
- *c = log(h5 / h4) / log(q2 / q1);
179
- if (*c <= 0.0 || *c > 20.0) return 0;
180
- *b = -h4 / pow(q1, *c);
181
- if (*b >= 0.0) return 0;
182
- return 1;
183
- }
184
-
185
- int customcurvepump(Project *pr, Spump *pump, Scurve *curve)
186
- /*
187
- **-------------------------------------------------------------------
188
- ** Input: pump = a pump object
189
- ** curve = a data curve object
190
- ** Output: returns an error code
191
- ** Purpose: computes properties for a pump with a custom pump curve.
192
- **-------------------------------------------------------------------
193
- */
194
- {
195
- int m, npts = curve->Npts;
196
- pump->Ptype = CUSTOM;
197
- for (m = 1; m < npts; m++)
198
- {
199
- // Curve must have continuously decreasing head (the Y value)
200
- if (curve->Y[m] >= curve->Y[m - 1])
201
- {
202
- pump->Ptype = NOCURVE;
203
- return 227;
204
- }
205
- }
206
- pump->Qmax = curve->X[npts - 1];
207
- pump->Q0 = (curve->X[0] + pump->Qmax) / 2.0 / pr->Ucf[FLOW];
208
- pump->Qmax /= pr->Ucf[FLOW];
209
- pump->Hmax = curve->Y[0] / pr->Ucf[HEAD];
210
- return 0;
211
- }
212
-
213
- int pumpcurvepump(Project *pr, Spump *pump, Scurve *curve)
214
- /*
215
- **-------------------------------------------------------------------
216
- ** Input: pump = a pump object
217
- ** curve = a data curve object
218
- ** Output: returns an error code
219
- ** Purpose: computes properties for a pump assigned a pump curve.
220
- **-------------------------------------------------------------------
221
- */
222
- {
223
- double a, b, c, h0 = 0.0, h1 = 0.0, h2 = 0.0, q1 = 0.0, q2 = 0.0;
224
- int npts = curve->Npts;
225
-
226
- curve->Type = PUMP_CURVE;
227
-
228
- // Generic power function curve
229
- if (npts == 1)
230
- {
231
- pump->Ptype = POWER_FUNC;
232
- q1 = curve->X[0];
233
- h1 = curve->Y[0];
234
- h0 = 1.33334 * h1;
235
- q2 = 2.0 * q1;
236
- h2 = 0.0;
237
- }
238
-
239
- // 3 point curve with shutoff head
240
- else if (npts == 3 && curve->X[0] == 0.0)
241
- {
242
- pump->Ptype = POWER_FUNC;
243
- h0 = curve->Y[0];
244
- q1 = curve->X[1];
245
- h1 = curve->Y[1];
246
- q2 = curve->X[2];
247
- h2 = curve->Y[2];
248
- }
249
- else return customcurvepump(pr, pump, curve);
250
-
251
- // Compute shape factors & limits of power function curves
252
- if (!powerfuncpump(h0, h1, h2, q1, q2, &a, &b, &c))
253
- {
254
- pump->Ptype = NOCURVE;
255
- return 227;
256
- }
257
- else
258
- {
259
- pump->H0 = -a / pr->Ucf[HEAD];
260
- pump->R = -b * (pow(pr->Ucf[FLOW], c) / pr->Ucf[HEAD]);
261
- pump->N = c;
262
- pump->Q0 = q1 / pr->Ucf[FLOW];
263
- pump->Qmax = pow((-a / b), (1.0 / c)) / pr->Ucf[FLOW];
264
- pump->Hmax = h0 / pr->Ucf[HEAD];
265
- }
266
- return 0;
267
- }
268
-
269
- int constpowerpump(Project *pr, Spump *pump)
270
- /*
271
- **-------------------------------------------------------------------
272
- ** Input: pump = a pump object
273
- ** Output: returns an error code
274
- ** Purpose: computes properties for a constant power pump.
275
- **-------------------------------------------------------------------
276
- */
277
- {
278
- pump->Ptype = CONST_HP;
279
- pump->H0 = 0.0;
280
- pump->R = -8.814 * pr->network.Link[pump->Link].Km / pr->Ucf[POWER];
281
- pump->N = -1.0;
282
- pump->Hmax = BIG; // No head limit
283
- pump->Qmax = BIG; // No flow limit
284
- pump->Q0 = 1.0; // Init. flow = 1 cfs
285
- return 0;
286
- }
287
-
288
- int validatepumps(Project *pr)
289
- /*
290
- **-------------------------------------------------------------------
291
- ** Input: none
292
- ** Output: returns 1 if successful, 0 if not
293
- ** Purpose: checks if pumps are assigned valid pump curve data.
294
- **-------------------------------------------------------------------
295
- */
296
- {
297
- Network *net = &pr->network;
298
- int i, errcode, result = 1;
299
- char errmsg[MAXMSG+1] = "";
300
- Spump *pump;
301
-
302
- for (i = 1; i <= net->Npumps; i++)
303
- {
304
- // Pump has a designated pump curve
305
- pump = &net->Pump[i];
306
- if (pump->Hcurve > 0)
307
- errcode = pumpcurvepump(pr, pump, &net->Curve[pump->Hcurve]);
308
-
309
- // Pump has a constant power setting
310
- else if (net->Link[pump->Link].Km > 0.0)
311
- errcode = constpowerpump(pr, pump);
312
-
313
- // Pump has no pump curve info assigned
314
- else
315
- {
316
- pump->Ptype = NOCURVE;
317
- errcode = 226;
318
- }
319
-
320
- if (errcode)
321
- {
322
- sprintf(pr->Msg, "Error %d: %s %s",
323
- errcode, geterrmsg(errcode, errmsg), net->Link[pump->Link].ID);
324
- writeline(pr, pr->Msg);
325
- result = 0;
326
- }
327
- }
328
- return result;
329
- }
330
-
331
- int validateproject(Project *pr)
332
- /*
333
- *--------------------------------------------------------------
334
- * Input: none
335
- * Output: returns error code
336
- * Purpose: checks for valid network data.
337
- *--------------------------------------------------------------
338
- */
339
- {
340
- int errcode = 0;
341
- if (pr->network.Nnodes < 2) return 223;
342
- if (pr->network.Ntanks == 0) return 224;
343
- if (!validatetanks(pr)) errcode = 110;
344
- if (!validatepumps(pr)) errcode = 110;
345
- if (!validatepatterns(pr)) errcode = 110;
346
- if (!validatecurves(pr)) errcode = 110;
347
- return errcode;
348
- }
349
-
350
- void reindextanks(Project *pr)
351
- /*
352
- *--------------------------------------------------------------
353
- * Input: none
354
- * Output: none
355
- * Purpose: adjusts tank node indexes when the number of
356
- * junctions created from an input file is less than
357
- * the total number of junction lines in the file.
358
- *--------------------------------------------------------------
359
- */
360
- {
361
- Network *net = &pr->network;
362
- Parser *parser = &pr->parser;
363
- Quality *qual = &pr->quality;
364
- Scontrol *control;
365
- int i, j, ndiff, n1, n2, size;
366
-
367
- // ndiff = # unused entries in Node array before first tank node
368
- ndiff = parser->MaxJuncs - net->Njuncs;
369
- if (ndiff > 0)
370
- {
371
- for (i = 1; i <= net->Ntanks; ++i)
372
- {
373
- // n1 is current tank index in Node array, n2 is adjusted index
374
- n1 = net->Tank[i].Node;
375
- n2 = n1 - ndiff;
376
-
377
- // Update the tank node's hash table entry
378
- hashtable_update(net->NodeHashTable, net->Node[n1].ID, n2);
379
-
380
- // Update the tank's node index
381
- net->Tank[i].Node = n2;
382
-
383
- // Re-position tank node in Node array
384
- net->Node[n2] = net->Node[n1];
385
-
386
- // Replace all references to old tank node index with new one
387
- for (j = 1; j <= net->Nlinks; ++j)
388
- {
389
- if (net->Link[j].N1 == n1) net->Link[j].N1 = n2;
390
- if (net->Link[j].N2 == n1) net->Link[j].N2 = n2;
391
- }
392
- for (j = 1; j <= net->Ncontrols; ++j)
393
- {
394
- control = &net->Control[j];
395
- if (control->Node == n1) control->Node = n2;
396
- }
397
- adjusttankrules(pr, -ndiff);
398
- if (qual->TraceNode == n1) qual->TraceNode = n2;
399
- }
400
-
401
- // Reallocate the Node array (shouldn't fail as new size < old size)
402
- parser->MaxJuncs = net->Njuncs;
403
- parser->MaxNodes = net->Njuncs + net->Ntanks;
404
- size = (net->Nnodes + 2) * sizeof(Snode);
405
- net->Node = (Snode *)realloc(net->Node, size);
406
- }
407
- }
408
-
@@ -1,53 +0,0 @@
1
-
2
- MSX 1.1.00
3
- 02/08/2011
4
-
5
- 1. A new compilation option for the user's chemistry functions
6
- was added that makes the program run anywhere from 2 to ten
7
- times faster. Details are in the Users Manual.
8
-
9
- 2. Problems related to the exponentiation operator (^) used
10
- in math expressions were fixed.
11
-
12
- 3. A new error message (number 524) was added that detects if
13
- an expression tries to perform an illegal math operation.
14
-
15
- 4. Several bugs in the routines that implement the MSXsavemsxfile
16
- toolkit function were fixed.
17
-
18
- 5. A memory leak occurring when the MSXclose toolkit function is
19
- called was fixed.
20
-
21
- 6. A possible unterminated string copy was fixed in the MSXgetID
22
- toolkit function.
23
-
24
- 7. Temporary files are now created in the user's current working
25
- directory.
26
-
27
- MSX 1.00.01
28
- 05/05/2008
29
-
30
- The following bugs are fixed.
31
-
32
- 1. Report file specified in the [REPORT] section of the msx configuration file is not generated. Instead the multispecies modeling results are written to the EPANET report file.
33
-
34
- 2. Memory violation error may occur when toolkit function MSXsavemsxfile is called.
35
-
36
- 3. A source node which is defined as �setpoint� source behaves like �flowpaced� source and vice versa.
37
-
38
- 4. MSXsetpattern did not set the current patternvalue index to be the first.
39
-
40
- 5. Pipe roughness is added as a reserved hydraulic variable. The keyword is Kc.
41
-
42
- MSX 2.00.00
43
-
44
- 08/26/2022
45
-
46
- 1. Dispersion modeling is included as an option.
47
-
48
- 2. OPENMP parallelization for both reactuion and dispersion solver.
49
-
50
- 3. EPANET 2.2 WQ routing method.
51
-
52
- 4. Mass balance report.
53
-
@@ -1,27 +0,0 @@
1
- #ifndef DISPERSION_H
2
- #define DISPERSION_H
3
-
4
- #define MAXSEGMENTS 5000
5
-
6
- typedef enum {
7
- XHEAD, // pump cannot deliver head (closed)
8
- TEMPCLOSED, // temporarily closed
9
- CLOSED, // closed
10
- OPEN, // open
11
- ACTIVE, // valve active (partially open)
12
- XFLOW, // pump exceeds maximum flow
13
- XFCV, // FCV cannot supply flow
14
- XPRESSURE, // valve cannot supply pressure
15
- FILLING, // tank filling
16
- EMPTYING, // tank emptying
17
- OVERFLOWING // tank overflowing
18
- } StatusType;
19
-
20
- int dispersion_open();
21
- int dispersion_close();
22
- void dispersion_pipe(int m, double tstep); //effective dispersion coefficient and upstream/downstream node impact calculation
23
- void solve_nodequal(int m, double tstep); //solve nodal concentration
24
- void segqual_update(int m, double tstep); //update pipe segment concentration
25
- void tridiag(int n, double *a, double *b, double *c, double *r, double *y);
26
-
27
- #endif
@@ -1,107 +0,0 @@
1
- //-----------------------------------------------------------------------------
2
- // hash.c
3
- //
4
- // Implementation of a simple Hash Table for string storage & retrieval
5
- // /
6
- // Written by L. Rossman
7
- // Last Updated on 6/19/03
8
- //
9
- // The hash table data structure (HTable) is defined in "hash.h".
10
- // Interface Functions:
11
- // HTcreate() - creates a hash table
12
- // HTinsert() - inserts a string & its index value into a hash table
13
- // HTfind() - retrieves the index value of a string from a table
14
- // HTfree() - frees a hash table
15
- //-----------------------------------------------------------------------------
16
-
17
- #include <string.h>
18
- #include <stdlib.h>
19
-
20
- #include "hash.h"
21
-
22
- /* Use Fletcher's checksum to compute 2-byte hash of string */
23
- unsigned int hash(char *str)
24
- {
25
- unsigned int sum1= 0, check1;
26
- unsigned long sum2= 0L;
27
- while( '\0' != *str )
28
- {
29
- sum1 += (*str);
30
- str++;
31
- if ( 255 <= sum1 ) sum1 -= 255;
32
- sum2 += sum1;
33
- }
34
- check1= sum2;
35
- check1 %= 255;
36
- check1= 255 - (sum1+check1) % 255;
37
- sum1= 255 - (sum1+check1) % 255;
38
- return( ( ( check1 << 8 ) | sum1 ) % HTMAXSIZE);
39
- }
40
-
41
- HTtable *HTcreate()
42
- {
43
- int i;
44
- HTtable *ht = (HTtable *) calloc(HTMAXSIZE, sizeof(HTtable));
45
- if (ht != NULL) for (i=0; i<HTMAXSIZE; i++) ht[i] = NULL;
46
- return(ht);
47
- }
48
-
49
- int HTinsert(HTtable *ht, char *key, int data)
50
- {
51
- unsigned int i = hash(key);
52
- struct HTentry *entry;
53
- if ( i >= HTMAXSIZE ) return(0);
54
- entry = (struct HTentry *) malloc(sizeof(struct HTentry));
55
- if (entry == NULL) return(0);
56
- entry->key = key;
57
- entry->data = data;
58
- entry->next = ht[i];
59
- ht[i] = entry;
60
- return(1);
61
- }
62
-
63
- int HTfind(HTtable *ht, char *key)
64
- {
65
- unsigned int i = hash(key);
66
- struct HTentry *entry;
67
- if ( i >= HTMAXSIZE ) return(NOTFOUND);
68
- entry = ht[i];
69
- while (entry != NULL)
70
- {
71
- if ( strcmp(entry->key,key) == 0 ) return(entry->data);
72
- entry = entry->next;
73
- }
74
- return(NOTFOUND);
75
- }
76
-
77
- char *HTfindKey(HTtable *ht, char *key)
78
- {
79
- unsigned int i = hash(key);
80
- struct HTentry *entry;
81
- if ( i >= HTMAXSIZE ) return(NULL);
82
- entry = ht[i];
83
- while (entry != NULL)
84
- {
85
- if ( strcmp(entry->key,key) == 0 ) return(entry->key);
86
- entry = entry->next;
87
- }
88
- return(NULL);
89
- }
90
-
91
- void HTfree(HTtable *ht)
92
- {
93
- struct HTentry *entry,
94
- *nextentry;
95
- int i;
96
- for (i=0; i<HTMAXSIZE; i++)
97
- {
98
- entry = ht[i];
99
- while (entry != NULL)
100
- {
101
- nextentry = entry->next;
102
- free(entry);
103
- entry = nextentry;
104
- }
105
- }
106
- free(ht);
107
- }
@@ -1,28 +0,0 @@
1
- /* HASH.H
2
- **
3
- ** Header file for Hash Table module HASH.C
4
- **
5
- */
6
-
7
- #ifndef HASH_H
8
- #define HASH_H
9
-
10
- #define HTMAXSIZE 1999
11
- #define NOTFOUND 0
12
-
13
- struct HTentry
14
- {
15
- char *key;
16
- int data;
17
- struct HTentry *next;
18
- };
19
-
20
- typedef struct HTentry *HTtable;
21
-
22
- HTtable *HTcreate(void);
23
- int HTinsert(HTtable *, char *, int);
24
- int HTfind(HTtable *, char *);
25
- char *HTfindKey(HTtable *, char *);
26
- void HTfree(HTtable *);
27
-
28
- #endif