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,293 +0,0 @@
1
- /*******************************************************************************
2
- ** MODULE: ROS2.C
3
- ** PROJECT: EPANET-MSX
4
- ** DESCRIPTION: a second order Rosenbrock 2(1) method for solving stiff sets of
5
- ** ordinary differential equations.
6
- ** AUTHOR: L. Rossman, US EPA - NRMRL
7
- ** VERSION: 2.0.00
8
- ** LAST UPDATE: 04/14/2021
9
- **
10
- ** This code is based on material presented in:
11
- ** Verwer, J.G., Spee, E.J., Blom, J.G. and Hundsdorfer, W.H.,
12
- ** "A second order Rosenbrock method applied to photochemical dispersion
13
- ** problems", SIAM J. Sci. Comput., 20:1456-1480, July 1999.
14
- *******************************************************************************/
15
-
16
- #include <stdlib.h>
17
- #include <math.h>
18
- #include "msxutils.h"
19
- #include "ros2.h"
20
-
21
- #define fmin(x,y) (((x)<=(y)) ? (x) : (y)) /* minimum of x and y */
22
- #define fmax(x,y) (((x)>=(y)) ? (x) : (y)) /* maximum of x and y */
23
-
24
- // Local variables
25
- //-----------------
26
- MSXRosenbrock MSXRosenbrockSolver;
27
-
28
- #pragma omp threadprivate(MSXRosenbrockSolver)
29
-
30
- //=============================================================================
31
-
32
- int ros2_open(int n, int adjust)
33
- /*
34
- ** Purpose:
35
- ** Opens the ROS2 integrator.
36
- **
37
- ** Input:
38
- ** n = number of equations to be solved
39
- ** adjust = 1 if step size adjustment used, 0 if not
40
- **
41
- ** Returns:
42
- ** 1 if successful, 0 if not.
43
- */
44
- {
45
- int errorcode = 1;
46
- int n1 = n + 1;
47
-
48
- #pragma omp parallel
49
- {
50
- MSXRosenbrockSolver.Nmax = n;
51
- MSXRosenbrockSolver.Adjust = adjust;
52
- MSXRosenbrockSolver.K1 = NULL;
53
- MSXRosenbrockSolver.K2 = NULL;
54
- MSXRosenbrockSolver.Jindx = NULL;
55
- MSXRosenbrockSolver.Ynew = NULL;
56
- MSXRosenbrockSolver.A = NULL;
57
- MSXRosenbrockSolver.K1 = (double*)calloc(n1, sizeof(double));
58
- MSXRosenbrockSolver.K2 = (double*)calloc(n1, sizeof(double));
59
- MSXRosenbrockSolver.Jindx = (int*)calloc(n1, sizeof(int));
60
- MSXRosenbrockSolver.Ynew = (double*)calloc(n1, sizeof(double));
61
- MSXRosenbrockSolver.A = createMatrix(n1, n1);
62
- #pragma omp critical
63
- {
64
- if (!MSXRosenbrockSolver.Jindx || !MSXRosenbrockSolver.Ynew ||
65
- !MSXRosenbrockSolver.K1 || !MSXRosenbrockSolver.K2) errorcode = 0;
66
- if (!MSXRosenbrockSolver.A) errorcode = 0;
67
- }
68
- }
69
-
70
- return errorcode;
71
- }
72
-
73
- //=============================================================================
74
-
75
- void ros2_close()
76
- /*
77
- ** Purpose:
78
- ** closes the ROS2 integrator.
79
- **
80
- ** Input:
81
- ** none.
82
- */
83
- {
84
-
85
- #pragma omp parallel
86
- {
87
-
88
- if (MSXRosenbrockSolver.Jindx) { free(MSXRosenbrockSolver.Jindx); MSXRosenbrockSolver.Jindx = NULL; }
89
- if (MSXRosenbrockSolver.Ynew) { free(MSXRosenbrockSolver.Ynew); MSXRosenbrockSolver.Ynew = NULL; }
90
- if (MSXRosenbrockSolver.K1) { free(MSXRosenbrockSolver.K1); MSXRosenbrockSolver.K1 = NULL; }
91
- if (MSXRosenbrockSolver.K2) { free(MSXRosenbrockSolver.K2); MSXRosenbrockSolver.K2 = NULL; }
92
- freeMatrix(MSXRosenbrockSolver.A);
93
- MSXRosenbrockSolver.A = NULL;
94
- }
95
-
96
- }
97
-
98
- //=============================================================================
99
-
100
- int ros2_integrate(double y[], int n, double t, double tnext,
101
- double* htry, double atol[], double rtol[],
102
- void (*func)(double, double*, int, double*))
103
- /*
104
- ** Purpose:
105
- ** integrates a system of ODEs over a specified time interval.
106
- **
107
- ** Input:
108
- ** y[1..n] = vector of dependent variable values at the start
109
- ** of the integration interval
110
- ** n = number of dependent variables
111
- ** t = time value at the start of the interval
112
- ** tnext = time value at the end of the interval
113
- ** htry = initial step size to be taken
114
- ** atol[1..n] = vector of absolute tolerances on the variables y
115
- ** rtol[1..n] = vector of relative tolerances on the variables y
116
- ** func = name of the function that computes dy/dt for each y
117
- **
118
- ** Output:
119
- ** htry = size of the last full time step taken.
120
- **
121
- ** Returns:
122
- ** the number of times that func() was called, -1 if
123
- ** the Jacobian is singular, or -2 if the step size
124
- ** shrinks to 0.
125
- **
126
- ** Notes:
127
- ** 1. The arguments to the function func() are:
128
- ** t = current time
129
- ** y[1..n] = vector of dependent variable values
130
- ** n = number of dependent variables
131
- ** dfdy[1..n] = vector of derivative values computed.
132
- **
133
- ** 2. The arrays used in this function are 1-based, so
134
- ** they must have been sized to n+1 when first created.
135
- */
136
- {
137
- double UROUND = 2.3e-16;
138
- double g, ghinv, ghinv1, dghinv, ytol;
139
- double h, hold, hmin, hmax, tplus;
140
- double ej, err, factor, facmax;
141
- int nfcn, njac, naccept, nreject, j;
142
- int isReject;
143
- int adjust = MSXRosenbrockSolver.Adjust;
144
-
145
- // --- Initialize counters, etc.
146
-
147
- g = 1.0 + 1.0 / sqrt(2.0);
148
- ghinv1 = 0.0;
149
- tplus = t;
150
- isReject = 0;
151
- naccept = 0;
152
- nreject = 0;
153
- nfcn = 0;
154
- njac = 0;
155
-
156
- // --- Initial step size
157
-
158
- hmax = tnext - t;
159
- hmin = 1.e-8;
160
- h = *htry;
161
- if ( h == 0.0 )
162
- {
163
- func(t, y, n, MSXRosenbrockSolver.K1);
164
- nfcn += 1;
165
- adjust = 1;
166
- h = tnext - t;
167
- for (j=1; j<=n; j++)
168
- {
169
- ytol = atol[j] + rtol[j]*fabs(y[j]);
170
- if (MSXRosenbrockSolver.K1[j] != 0.0) h = fmin(h, (ytol/fabs(MSXRosenbrockSolver.K1[j])));
171
- }
172
- }
173
- h = fmax(hmin, h);
174
- h = fmin(hmax, h);
175
-
176
- // --- Start the time loop
177
-
178
- while ( t < tnext )
179
- {
180
- // --- check for zero step size
181
-
182
- if (0.10*fabs(h) <= fabs(t)*UROUND) return -2;
183
-
184
- // --- adjust step size if interval exceeded
185
-
186
- tplus = t + h;
187
- if ( tplus > tnext )
188
- {
189
- h = tnext - t;
190
- tplus = tnext;
191
- }
192
-
193
- // --- Re-compute the Jacobian if step size accepted
194
-
195
- if ( isReject == 0 )
196
- {
197
- jacobian(y, n, MSXRosenbrockSolver.K1, MSXRosenbrockSolver.K2, MSXRosenbrockSolver.A, func);
198
- njac++;
199
- nfcn += 2*n;
200
- ghinv1 = 0.0;
201
- }
202
-
203
- // --- Update the Jacobian to reflect new step size
204
-
205
- ghinv = -1.0 / (g*h);
206
- dghinv = ghinv - ghinv1;
207
- for (j=1; j<=n; j++)
208
- {
209
- MSXRosenbrockSolver.A[j][j] += dghinv;
210
- }
211
- ghinv1 = ghinv;
212
- if ( !factorize(MSXRosenbrockSolver.A, n, MSXRosenbrockSolver.K1, MSXRosenbrockSolver.Jindx) ) return -1;
213
-
214
- // --- Stage 1 solution
215
-
216
- func(t, y, n, MSXRosenbrockSolver.K1);
217
- nfcn += 1;
218
- for (j=1; j<=n; j++) MSXRosenbrockSolver.K1[j] *= ghinv;
219
- solve(MSXRosenbrockSolver.A, n, MSXRosenbrockSolver.Jindx, MSXRosenbrockSolver.K1);
220
-
221
- // --- Stage 2 solution
222
-
223
- for (j=1; j<=n; j++)
224
- {
225
- MSXRosenbrockSolver.Ynew[j] = y[j] + h* MSXRosenbrockSolver.K1[j];
226
- }
227
- func(t, MSXRosenbrockSolver.Ynew, n, MSXRosenbrockSolver.K2);
228
- nfcn += 1;
229
- for (j=1; j<=n; j++)
230
- {
231
- MSXRosenbrockSolver.K2[j] = (MSXRosenbrockSolver.K2[j] - 2.0* MSXRosenbrockSolver.K1[j])*ghinv;
232
- }
233
- solve(MSXRosenbrockSolver.A, n, MSXRosenbrockSolver.Jindx, MSXRosenbrockSolver.K2);
234
-
235
- // --- Overall solution
236
-
237
- for (j=1; j<=n; j++)
238
- {
239
- MSXRosenbrockSolver.Ynew[j] = y[j] + 1.5*h* MSXRosenbrockSolver.K1[j] + 0.5*h* MSXRosenbrockSolver.K2[j];
240
- }
241
-
242
- // --- Error estimation
243
-
244
- hold = h;
245
- err = 0.0;
246
- if ( adjust )
247
- {
248
- for (j=1; j<=n; j++)
249
- {
250
- ytol = atol[j] + rtol[j]*fabs(MSXRosenbrockSolver.Ynew[j]);
251
- ej = fabs(MSXRosenbrockSolver.Ynew[j] - y[j] - h* MSXRosenbrockSolver.K1[j])/ytol;
252
- err = err + ej*ej;
253
- }
254
- err = sqrt(err/n);
255
- err = fmax(UROUND, err);
256
-
257
- // --- Choose the step size
258
-
259
- factor = 0.9 / sqrt(err);
260
- if (isReject) facmax = 1.0;
261
- else facmax = 10.0;
262
- factor = fmin(factor, facmax);
263
- factor = fmax(factor, 1.0e-1);
264
- h = factor*h;
265
- h = fmin(hmax, h);
266
- }
267
-
268
- // --- Reject/accept the step
269
-
270
- if ( err > 1.0 )
271
- {
272
- isReject = 1;
273
- nreject++;
274
- h = 0.5*h;
275
- }
276
- else
277
- {
278
- isReject = 0;
279
- for (j=1; j<=n; j++)
280
- {
281
- y[j] = MSXRosenbrockSolver.Ynew[j];
282
- if ( y[j] <= UROUND ) y[j] = 0.0;
283
- }
284
- if ( adjust ) *htry = h;
285
- t = tplus;
286
- naccept++;
287
- }
288
-
289
- // --- End of the time loop
290
-
291
- }
292
- return nfcn;
293
- }
@@ -1,35 +0,0 @@
1
- /************************************************************************
2
- ** MODULE: ROS2.H
3
- ** PROJECT: EPANET-MSX
4
- ** DESCRIPTION: Header file for the stiff ODE solver ROS2.C.
5
- ** AUTHOR: L. Rossman, US EPA - NRMRL
6
- ** VERSION: 2.0.00
7
- ** LAST UPDATE: 04/14/2021
8
- ***********************************************************************/
9
-
10
- #ifndef ROS2_H
11
- #define ROS2_H
12
-
13
- typedef struct {
14
-
15
- double** A; // Jacobian matrix
16
- double* K1; // Intermediate solutions
17
- double* K2;
18
- double* Ynew; // Updated function values
19
- int* Jindx; // Jacobian column indexes
20
- int Nmax; // Max. number of equations
21
- int Adjust; // use adjustable step size
22
- }MSXRosenbrock;
23
-
24
- // Opens the ODE solver system
25
- int ros2_open(int n, int adjust);
26
-
27
- // Closes the ODE solver system
28
- void ros2_close(void);
29
-
30
- // Applies the solver to integrate a specific system of ODEs
31
- int ros2_integrate(double y[], int n, double t, double tnext,
32
- double* htry, double atol[], double rtol[],
33
- void (*func)(double, double*, int, double*));
34
-
35
- #endif