epyt-flow 0.14.1__py3-none-any.whl → 0.14.2__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 (55) hide show
  1. epyt_flow/EPANET/EPANET/SRC_engines/AUTHORS +8 -40
  2. epyt_flow/EPANET/EPANET/SRC_engines/LICENSE +3 -3
  3. epyt_flow/EPANET/EPANET/SRC_engines/Readme_SRC_Engines.txt +18 -0
  4. epyt_flow/EPANET/EPANET/SRC_engines/enumstxt.h +7 -24
  5. epyt_flow/EPANET/EPANET/SRC_engines/epanet.c +374 -726
  6. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.c +32 -128
  7. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.def +131 -0
  8. epyt_flow/EPANET/EPANET/SRC_engines/errors.dat +1 -7
  9. epyt_flow/EPANET/EPANET/SRC_engines/funcs.h +14 -40
  10. epyt_flow/EPANET/EPANET/SRC_engines/hash.c +177 -177
  11. epyt_flow/EPANET/EPANET/SRC_engines/hash.h +28 -28
  12. epyt_flow/EPANET/EPANET/SRC_engines/hydcoeffs.c +40 -192
  13. epyt_flow/EPANET/EPANET/SRC_engines/hydraul.c +46 -101
  14. epyt_flow/EPANET/EPANET/SRC_engines/hydsolver.c +24 -85
  15. epyt_flow/EPANET/EPANET/SRC_engines/hydstatus.c +63 -29
  16. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2.h +37 -70
  17. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_2.h +234 -408
  18. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_enums.h +37 -87
  19. epyt_flow/EPANET/EPANET/SRC_engines/inpfile.c +79 -153
  20. epyt_flow/EPANET/EPANET/SRC_engines/input1.c +94 -59
  21. epyt_flow/EPANET/EPANET/SRC_engines/input2.c +202 -73
  22. epyt_flow/EPANET/EPANET/SRC_engines/input3.c +351 -446
  23. epyt_flow/EPANET/EPANET/SRC_engines/main.c +93 -0
  24. epyt_flow/EPANET/EPANET/SRC_engines/mempool.c +4 -8
  25. epyt_flow/EPANET/EPANET/SRC_engines/mempool.h +23 -23
  26. epyt_flow/EPANET/EPANET/SRC_engines/output.c +4 -5
  27. epyt_flow/EPANET/EPANET/SRC_engines/project.c +75 -407
  28. epyt_flow/EPANET/EPANET/SRC_engines/quality.c +2 -12
  29. epyt_flow/EPANET/EPANET/SRC_engines/qualreact.c +13 -70
  30. epyt_flow/EPANET/EPANET/SRC_engines/qualroute.c +5 -7
  31. epyt_flow/EPANET/EPANET/SRC_engines/report.c +20 -88
  32. epyt_flow/EPANET/EPANET/SRC_engines/rules.c +6 -144
  33. epyt_flow/EPANET/EPANET/SRC_engines/smatrix.c +19 -19
  34. epyt_flow/EPANET/EPANET/SRC_engines/text.h +5 -16
  35. epyt_flow/EPANET/EPANET/SRC_engines/types.h +19 -73
  36. epyt_flow/EPANET/compile_linux.sh +1 -1
  37. epyt_flow/EPANET/compile_macos.sh +1 -1
  38. epyt_flow/VERSION +1 -1
  39. epyt_flow/simulation/scada/scada_data.py +1 -1
  40. epyt_flow/utils.py +66 -0
  41. epyt_flow/visualization/visualization_utils.py +4 -2
  42. {epyt_flow-0.14.1.dist-info → epyt_flow-0.14.2.dist-info}/METADATA +1 -1
  43. {epyt_flow-0.14.1.dist-info → epyt_flow-0.14.2.dist-info}/RECORD +46 -52
  44. epyt_flow/EPANET/EPANET/SRC_engines/flowbalance.c +0 -186
  45. epyt_flow/EPANET/EPANET/SRC_engines/leakage.c +0 -527
  46. epyt_flow/EPANET/EPANET/SRC_engines/util/cstr_helper.c +0 -59
  47. epyt_flow/EPANET/EPANET/SRC_engines/util/cstr_helper.h +0 -38
  48. epyt_flow/EPANET/EPANET/SRC_engines/util/errormanager.c +0 -92
  49. epyt_flow/EPANET/EPANET/SRC_engines/util/errormanager.h +0 -39
  50. epyt_flow/EPANET/EPANET/SRC_engines/util/filemanager.c +0 -212
  51. epyt_flow/EPANET/EPANET/SRC_engines/util/filemanager.h +0 -81
  52. epyt_flow/EPANET/EPANET/SRC_engines/validate.c +0 -408
  53. {epyt_flow-0.14.1.dist-info → epyt_flow-0.14.2.dist-info}/WHEEL +0 -0
  54. {epyt_flow-0.14.1.dist-info → epyt_flow-0.14.2.dist-info}/licenses/LICENSE +0 -0
  55. {epyt_flow-0.14.1.dist-info → epyt_flow-0.14.2.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  ******************************************************************************
3
3
  Project: OWA EPANET
4
- Version: 2.3
4
+ Version: 2.2
5
5
  Module: smatrix.c
6
6
  Description: solves a sparse set of linear equations
7
7
  Authors: see AUTHORS
@@ -48,8 +48,8 @@ static int paralink(Network *, Smatrix *, int, int, int k);
48
48
  static void xparalinks(Network *);
49
49
  static int reordernodes(Project *);
50
50
  static int factorize(Project *);
51
- static int growlist(Project *, int, int *);
52
- static int newlink(Project *, Padjlist, int *);
51
+ static int growlist(Project *, int);
52
+ static int newlink(Project *, Padjlist);
53
53
  static int linked(Network *, int, int);
54
54
  static int addlink(Network *, int, int, int);
55
55
  static int storesparse(Project *, int);
@@ -443,8 +443,8 @@ int factorize(Project *pr)
443
443
  Padjlist alink;
444
444
 
445
445
  // Find degree of each junction node
446
- int *degree = (int *)calloc(net->Nnodes + 1, sizeof(int));
447
- if (degree == NULL) return 101;
446
+ sm->Degree = (int *)calloc(net->Nnodes + 1, sizeof(int));
447
+ if (sm->Degree == NULL) return 101;
448
448
 
449
449
  // NOTE: For purposes of node re-ordering, Tanks (nodes with
450
450
  // indexes above Njuncs) have zero degree of adjacency.
@@ -453,7 +453,7 @@ int factorize(Project *pr)
453
453
  {
454
454
  for (alink = net->Adjlist[k]; alink != NULL; alink = alink->next)
455
455
  {
456
- if (alink->node > 0) degree[k]++;
456
+ if (alink->node > 0) sm->Degree[k]++;
457
457
  }
458
458
  }
459
459
 
@@ -463,19 +463,19 @@ int factorize(Project *pr)
463
463
  for (k = 1; k <= net->Njuncs; k++) // Examine each junction
464
464
  {
465
465
  knode = sm->Order[k]; // Re-ordered index
466
- if (!growlist(pr, knode, degree)) // Augment adjacency list
466
+ if (!growlist(pr, knode)) // Augment adjacency list
467
467
  {
468
468
  errcode = 101;
469
469
  break;
470
470
  }
471
- degree[knode] = 0; // In-activate node
471
+ sm->Degree[knode] = 0; // In-activate node
472
472
  }
473
- free(degree);
473
+ free(sm->Degree);
474
474
  return errcode;
475
475
  }
476
476
 
477
477
 
478
- int growlist(Project *pr, int knode, int *degree)
478
+ int growlist(Project *pr, int knode)
479
479
  /*
480
480
  **--------------------------------------------------------------
481
481
  ** Input: knode = node index
@@ -496,10 +496,10 @@ int growlist(Project *pr, int knode, int *degree)
496
496
  for (alink = net->Adjlist[knode]; alink != NULL; alink = alink -> next)
497
497
  {
498
498
  node = alink->node; // End node of connecting link
499
- if (node > 0 && degree[node] > 0) // End node is active
499
+ if (node > 0 && sm->Degree[node] > 0) // End node is active
500
500
  {
501
- degree[node]--; // Reduce degree of adjacency
502
- if (!newlink(pr, alink, degree)) // Add to adjacency list
501
+ sm->Degree[node]--; // Reduce degree of adjacency
502
+ if (!newlink(pr, alink)) // Add to adjacency list
503
503
  {
504
504
  return 0;
505
505
  }
@@ -509,7 +509,7 @@ int growlist(Project *pr, int knode, int *degree)
509
509
  }
510
510
 
511
511
 
512
- int newlink(Project *pr, Padjlist alink, int *degree)
512
+ int newlink(Project *pr, Padjlist alink)
513
513
  /*
514
514
  **--------------------------------------------------------------
515
515
  ** Input: alink = element of node's adjacency list
@@ -533,7 +533,7 @@ int newlink(Project *pr, Padjlist alink, int *degree)
533
533
 
534
534
  // If jnode still active, and inode not connected to jnode,
535
535
  // then add a new connection between inode and jnode.
536
- if (jnode > 0 && degree[jnode] > 0) // jnode still active
536
+ if (jnode > 0 && sm->Degree[jnode] > 0) // jnode still active
537
537
  {
538
538
  if (!linked(net, inode, jnode)) // inode not linked to jnode
539
539
  {
@@ -545,8 +545,8 @@ int newlink(Project *pr, Padjlist alink, int *degree)
545
545
  // reflect the new connection.
546
546
  if (!addlink(net, inode, jnode, sm->Ncoeffs)) return 0;
547
547
  if (!addlink(net, jnode, inode, sm->Ncoeffs)) return 0;
548
- degree[inode]++;
549
- degree[jnode]++;
548
+ sm->Degree[inode]++;
549
+ sm->Degree[jnode]++;
550
550
  }
551
551
  }
552
552
  }
@@ -651,7 +651,7 @@ int sortsparse(Smatrix *sm, int n)
651
651
  /*
652
652
  **--------------------------------------------------------------
653
653
  ** Input: n = number of rows in solution matrix
654
- ** Output: returns error code
654
+ ** Output: returns eror code
655
655
  ** Purpose: puts row indexes in ascending order in NZSUB
656
656
  **--------------------------------------------------------------
657
657
  */
@@ -834,7 +834,7 @@ int linsolve(Smatrix *sm, int n)
834
834
  }
835
835
  } // next j
836
836
 
837
- // Forward substitution
837
+ // Foward substitution
838
838
  for (j = 1; j <= n; j++)
839
839
  {
840
840
  bj = B[j]/Aii[j];
@@ -1,13 +1,13 @@
1
1
  /*
2
2
  ******************************************************************************
3
3
  Project: OWA EPANET
4
- Version: 2.3
4
+ Version: 2.2
5
5
  Module: text.h
6
6
  Description: string constants used throughout EPANET
7
7
  Authors: see AUTHORS
8
8
  Copyright: see AUTHORS
9
9
  License: see LICENSE
10
- Last Updated: 03/10/2025
10
+ Last Updated: 07/15/2019
11
11
  ******************************************************************************
12
12
  */
13
13
 
@@ -40,7 +40,6 @@
40
40
  #define w_FCV "FCV"
41
41
  #define w_TCV "TCV"
42
42
  #define w_GPV "GPV"
43
- #define w_PCV "PCV"
44
43
 
45
44
  #define w_OPEN "OPEN"
46
45
  #define w_CLOSED "CLOSED"
@@ -52,6 +51,9 @@
52
51
  #define w_IS "IS"
53
52
  #define w_NOT "NOT"
54
53
 
54
+ #define w_ADD "ADD"
55
+ #define w_MULTIPLY "MULT"
56
+
55
57
  #define w_LIMITING "LIMIT"
56
58
  #define w_ORDER "ORDER"
57
59
  #define w_GLOBAL "GLOB"
@@ -84,14 +86,11 @@
84
86
  #define w_MLD "MLD"
85
87
  #define w_CMH "CMH"
86
88
  #define w_CMD "CMD"
87
- #define w_CMS "CMS"
88
89
  #define w_SI "SI"
89
90
 
90
91
  #define w_PSI "PSI"
91
92
  #define w_KPA "KPA"
92
93
  #define w_METERS "METERS"
93
- #define w_BAR "BAR"
94
- #define w_FEET "FEET"
95
94
 
96
95
  #define w_ELEV "ELEV"
97
96
  #define w_DEMAND "DEMAND"
@@ -131,8 +130,6 @@
131
130
  #define w_SEGMENTS "SEGM"
132
131
  #define w_TOLERANCE "TOLER"
133
132
  #define w_EMITTER "EMIT"
134
- #define w_BACKFLOW "BACK"
135
- #define w_ALLOWED "ALLOW"
136
133
 
137
134
  #define w_PRICE "PRICE"
138
135
  #define w_DMNDCHARGE "DEMAN"
@@ -153,9 +150,6 @@
153
150
  #define w_REQUIRED "REQ"
154
151
  #define w_EXPONENT "EXP"
155
152
 
156
- #define w_AREA "AREA"
157
- #define w_EXPAN "EXPAN"
158
-
159
153
  #define w_SECONDS "SEC"
160
154
  #define w_MINUTES "MIN"
161
155
  #define w_HOURS "HOU"
@@ -198,7 +192,6 @@
198
192
  #define w_THEN "THEN"
199
193
  #define w_ELSE "ELSE"
200
194
  #define w_PRIORITY "PRIO"
201
- #define w_DISABLED "DISABLED"
202
195
 
203
196
  // ------ Input File Section Names ------------------------
204
197
 
@@ -214,7 +207,6 @@
214
207
  #define s_DEMANDS "[DEMANDS]"
215
208
  #define s_SOURCES "[SOURCES]"
216
209
  #define s_EMITTERS "[EMITTERS]"
217
- #define s_LEAKAGE "[LEAKAGE]"
218
210
  #define s_PATTERNS "[PATTERNS]"
219
211
  #define s_CURVES "[CURVES]"
220
212
  #define s_QUALITY "[QUALITY]"
@@ -242,7 +234,6 @@
242
234
  #define u_IMGD "Imgd"
243
235
  #define u_LPS "L/s"
244
236
  #define u_LPM "Lpm"
245
- #define u_CMS "m3/s"
246
237
  #define u_CMH "m3/h"
247
238
  #define u_CMD "m3/d"
248
239
  #define u_MLD "ML/d"
@@ -272,8 +263,6 @@
272
263
  #define c_PUMP "PUMP"
273
264
  #define c_EFFIC "EFFIC"
274
265
  #define c_VOLUME "VOLUME"
275
- #define c_VALVE "VALVE"
276
- #define c_GENERIC "GENERIC"
277
266
 
278
267
  //------- Text Phrases ------------------------------------
279
268
 
@@ -1,13 +1,13 @@
1
1
  /*
2
2
  ******************************************************************************
3
3
  Project: OWA EPANET
4
- Version: 2.3
4
+ Version: 2.2
5
5
  Module: types.h
6
6
  Description: symbolic constants and data types used throughout EPANET
7
7
  Authors: see AUTHORS
8
8
  Copyright: see AUTHORS
9
9
  License: see LICENSE
10
- Last Updated: 04/19/2025
10
+ Last Updated: 10/29/2019
11
11
  ******************************************************************************
12
12
  */
13
13
 
@@ -31,7 +31,7 @@ typedef int INT4;
31
31
  Various constants
32
32
  ----------------------------------------------
33
33
  */
34
- #define CODEVERSION 20300
34
+ #define CODEVERSION 20200
35
35
  #define MAGICNUMBER 516114521
36
36
  #define ENGINE_VERSION 201 // Used for binary hydraulics file
37
37
  #define EOFMARK 0x1A // Use 0x04 for UNIX systems
@@ -48,9 +48,6 @@ typedef int INT4;
48
48
  #define BIG 1.E10
49
49
  #define TINY 1.E-6
50
50
  #define MISSING -1.E10 // Missing value indicator
51
- #define SET_CLOSED -1.E10 // Link set closed indicator
52
- #define SET_OPEN 1.E10 // Link set open indicator
53
-
54
51
  #define DIFFUS 1.3E-8 // Diffusivity of chlorine
55
52
  // @ 20 deg C (sq ft/sec)
56
53
  #define VISCOS 1.1E-5 // Kinematic viscosity of water
@@ -74,7 +71,6 @@ typedef int INT4;
74
71
  #define IMGDperCFS 0.5382
75
72
  #define LPSperCFS 28.317
76
73
  #define LPMperCFS 1699.0
77
- #define CMSperCFS 0.028317
78
74
  #define CMHperCFS 101.94
79
75
  #define CMDperCFS 2446.6
80
76
  #define MLDperCFS 2.4466
@@ -83,7 +79,6 @@ typedef int INT4;
83
79
  #define MperFT 0.3048
84
80
  #define PSIperFT 0.4333
85
81
  #define KPAperPSI 6.895
86
- #define BARperPSI 0.068948
87
82
  #define KWperHP 0.7457
88
83
  #define SECperDAY 86400
89
84
 
@@ -150,8 +145,7 @@ typedef enum {
150
145
  PBV, // pressure breaker valve
151
146
  FCV, // flow control valve
152
147
  TCV, // throttle control valve
153
- GPV, // general purpose valve
154
- PCV // positional control valve
148
+ GPV // general purpose valve
155
149
  } LinkType;
156
150
 
157
151
  typedef enum {
@@ -172,8 +166,7 @@ typedef enum {
172
166
  PUMP_CURVE, // pump curve
173
167
  EFFIC_CURVE, // efficiency curve
174
168
  HLOSS_CURVE, // head loss curve
175
- GENERIC_CURVE, // generic curve
176
- VALVE_CURVE // positional valve loss curve
169
+ GENERIC_CURVE // generic curve
177
170
  } CurveType;
178
171
 
179
172
  typedef enum {
@@ -232,17 +225,13 @@ typedef enum {
232
225
  LPM, // liters per minute
233
226
  MLD, // megaliters per day
234
227
  CMH, // cubic meters per hour
235
- CMD, // cubic meters per day
236
- CMS // cubic meters per second
228
+ CMD // cubic meters per day
237
229
  } FlowUnitsType;
238
230
 
239
231
  typedef enum {
240
232
  PSI, // pounds per square inch
241
233
  KPA, // kiloPascals
242
- METERS, // meters
243
- BAR, // bar
244
- FEET, // feet
245
- DEFAULTUNIT // default based on unit system (SI or US)
234
+ METERS // meters
246
235
  } PressureUnitsType;
247
236
 
248
237
  typedef enum {
@@ -298,7 +287,7 @@ typedef enum {
298
287
  _VALVES, _CONTROLS, _RULES, _DEMANDS, _SOURCES, _EMITTERS,
299
288
  _PATTERNS, _CURVES, _QUALITY, _STATUS, _ROUGHNESS, _ENERGY,
300
289
  _REACTIONS, _MIXING, _REPORT, _TIMES, _OPTIONS,
301
- _COORDS, _VERTICES, _LABELS, _BACKDROP, _TAGS, _LEAKAGE, _END
290
+ _COORDS, _VERTICES, _LABELS, _BACKDROP, _TAGS, _END
302
291
  } SectionType;
303
292
 
304
293
  typedef enum {
@@ -366,8 +355,6 @@ typedef struct // Energy Usage Object
366
355
  double KwHrs; // total kw-hrs consumed
367
356
  double MaxKwatts; // max. kw consumed
368
357
  double TotalCost; // total pumping cost
369
- double CurrentPower; // current pump power (kw)
370
- double CurrentEffic; // current pump efficiency
371
358
  } Senergy;
372
359
 
373
360
  struct Ssource // Water Quality Source Object
@@ -402,7 +389,6 @@ typedef struct // Node Object
402
389
  int ResultIndex; // saved result index
403
390
  NodeType Type; // node type
404
391
  char *Comment; // node comment
405
- char *Tag; // optional category tag
406
392
  } Snode;
407
393
 
408
394
  typedef struct // Link Object
@@ -412,22 +398,18 @@ typedef struct // Link Object
412
398
  int N2; // end node index
413
399
  double Diam; // diameter
414
400
  double Len; // length
415
- double Kc; // pipe roughness, pump speed, valve setting
401
+ double Kc; // roughness
416
402
  double Km; // minor loss coeff.
417
403
  double Kb; // bulk react. coeff.
418
404
  double Kw; // wall react. coef.
419
405
  double R; // flow resistance
420
406
  double Rc; // reaction coeff.
421
- double LeakArea; // leak area (sq mm per 100 pipe length units
422
- double LeakExpan; // leak expansion (sq mm per unit of head)
423
407
  LinkType Type; // link type
424
- StatusType InitStatus; // initial status
425
- double InitSetting; // initial setting
408
+ StatusType Status; // initial status
426
409
  Pvertices Vertices; // internal vertex coordinates
427
410
  int Rpt; // reporting flag
428
411
  int ResultIndex; // saved result index
429
412
  char *Comment; // link comment
430
- char *Tag; // optional category tag
431
413
  } Slink;
432
414
 
433
415
  typedef struct // Tank Object
@@ -446,7 +428,7 @@ typedef struct // Tank Object
446
428
  int Pat; // fixed grade time pattern
447
429
  int Vcurve; // volume v. elev. curve index
448
430
  MixType MixModel; // type of mixing model
449
- double V1frac; // mixing compartment fraction
431
+ double V1max; // mixing compartment size
450
432
  int CanOverflow; // tank can overflow or not
451
433
  } Stank;
452
434
 
@@ -471,7 +453,6 @@ typedef struct // Pump Object
471
453
  typedef struct // Valve Object
472
454
  {
473
455
  int Link; // link index of valve
474
- int Curve; // positional loss coeff. curve
475
456
  } Svalve;
476
457
 
477
458
  typedef struct // Control Statement
@@ -483,7 +464,6 @@ typedef struct // Control Statement
483
464
  double Setting; // new link setting
484
465
  StatusType Status; // new link status
485
466
  ControlType Type; // control type
486
- int isEnabled; // control enabled?
487
467
  } Scontrol;
488
468
 
489
469
  typedef struct // Field Object of Report Table
@@ -535,7 +515,6 @@ typedef struct // Control Rule Structure
535
515
  {
536
516
  char label[MAXID+1]; // rule label
537
517
  double priority; // priority level
538
- int isEnabled; // is the rule enabled?
539
518
  Spremise *Premises; // list of premises
540
519
  Saction *ThenActions; // list of THEN actions
541
520
  Saction *ElseActions; // list of ELSE actions
@@ -556,29 +535,8 @@ typedef struct // Mass Balance Components
556
535
  double reacted; // mass reacted in system
557
536
  double final; // final mass in system
558
537
  double ratio; // ratio of mass added to mass lost
559
- int segCount; // total number of pipe segments used
560
538
  } SmassBalance;
561
539
 
562
- typedef struct
563
- {
564
- double totalInflow;
565
- double totalOutflow;
566
- double consumerDemand;
567
- double emitterDemand;
568
- double leakageDemand;
569
- double deficitDemand;
570
- double storageDemand;
571
- double ratio;
572
- } SflowBalance;
573
-
574
- typedef struct // Node Leakage Object
575
- {
576
- double qfa; // fixed area leakage flow
577
- double qva; // variable area leakage flow
578
- double cfa; // fixed area leakage coeff.
579
- double cva; // variable area leakage coeff.
580
- } Sleakage;
581
-
582
540
  /*
583
541
  ------------------------------------------------------
584
542
  Wrapper Data Structures
@@ -613,7 +571,8 @@ typedef struct {
613
571
  ErrTok, // Index of error-producing token
614
572
  Unitsflag, // Unit system flag
615
573
  Flowflag, // Flow units flag
616
- Pressflag; // Pressure units flag
574
+ Pressflag, // Pressure units flag
575
+ DefPat; // Default demand pattern
617
576
 
618
577
  Spattern *PrevPat; // Previous pattern processed
619
578
  Scurve *PrevCurve; // Previous curve processed
@@ -669,10 +628,7 @@ typedef struct {
669
628
  Rpt2Fname[MAXFNAME+1], // Secondary report file name
670
629
  DateStamp[26]; // Current date & time
671
630
 
672
- SField Field[MAXVAR]; // Output reporting fields
673
-
674
- void (*reportCallback)(void*,void*,const char*); // user-supplied reporting callback
675
- void *reportCallbackUserData; // user-supplied reporting context
631
+ SField Field[MAXVAR]; // Output reporting fields
676
632
 
677
633
  } Report;
678
634
 
@@ -732,6 +688,7 @@ typedef struct {
732
688
  *XLNZ, // Start position of each column in NZSUB
733
689
  *NZSUB, // Row index of each coeff. in each column
734
690
  *LNZ, // Position of each coeff. in Aij array
691
+ *Degree, // Number of links adjacent to each node
735
692
  *link, // Array used by linear eqn. solver
736
693
  *first; // Array used by linear eqn. solver
737
694
 
@@ -742,11 +699,9 @@ typedef struct {
742
699
 
743
700
  double
744
701
  *NodeHead, // Node hydraulic heads
745
- *NodeDemand, // Node total demand (consumer + emitter + leakage)
746
- *FullDemand, // Required consumer demand
747
- *DemandFlow, // Demand flow from nodes
748
- *EmitterFlow, // Emitter flow from nodes
749
- *LeakageFlow, // Leakage flow from nodes
702
+ *NodeDemand, // Node demand + emitter flows
703
+ *DemandFlow, // Work array of demand flows
704
+ *EmitterFlow, // Emitter outflows
750
705
  *LinkFlow, // Link flows
751
706
  *LinkSetting, // Link settings
752
707
  Htol, // Hydraulic head tolerance
@@ -773,18 +728,15 @@ typedef struct {
773
728
  MaxHeadError, // Max. error for link head loss
774
729
  MaxFlowChange, // Max. change in link flow
775
730
  DemandReduction, // % demand reduction at pressure deficient nodes
776
- LeakageLoss, // % system leakage loss
777
731
  RelaxFactor, // Relaxation factor for flow updating
778
732
  *P, // Inverse of head loss derivatives
779
733
  *Y, // Flow correction factors
780
734
  *Xflow; // Inflow - outflow at each node
781
735
 
782
736
  int
783
- DefPat, // Default demand pattern
784
737
  Epat, // Energy cost time pattern
785
738
  DemandModel, // Fixed or pressure dependent
786
739
  Formflag, // Head loss formula flag
787
- EmitBackFlag, // Emitter backflow flag
788
740
  Iterations, // Number of hydraulic trials taken
789
741
  MaxIter, // Max. hydraulic trials allowed
790
742
  ExtraIter, // Extra hydraulic trials
@@ -792,18 +744,12 @@ typedef struct {
792
744
  MaxCheck, // Hydraulic trials limit on status checks
793
745
  OpenHflag, // Hydraulic system opened flag
794
746
  Haltflag, // Flag to halt simulation
795
- DeficientNodes, // Number of pressure deficient nodes
796
- HasLeakage; // TRUE if project has non-zero leakage parameters
797
-
798
- Sleakage *Leakage; // Array of node leakage parameters
747
+ DeficientNodes; // Number of pressure deficient nodes
799
748
 
800
749
  StatusType
801
750
  *LinkStatus, // Link status
802
751
  *OldStatus; // Previous link/tank status
803
752
 
804
- SflowBalance
805
- FlowBalance; // Flow balance components
806
-
807
753
  Smatrix smatrix; // Sparse matrix storage
808
754
 
809
755
  } Hydraul;
@@ -1,4 +1,4 @@
1
1
  #!/bin/bash
2
2
  mkdir -p "../customlibs/"
3
- gcc -w -O3 -march=native -shared -Wl,-soname,libepanet2_2.so -fPIC -o "../customlibs/libepanet2_2.so" EPANET/SRC_engines/*.c -IEPANET/SRC_engines/include EPANET/SRC_engines/util/*.c -IEPANET/SRC_engines/util/ -lc -lm -pthread
3
+ gcc -w -O3 -march=native -shared -Wl,-soname,libepanet2_2.so -fPIC -o "../customlibs/libepanet2_2.so" EPANET/SRC_engines/*.c -IEPANET/SRC_engines/include -lc -lm -pthread
4
4
  gcc -w -O3 -march=native -fPIC -shared -Wl,-soname,libepanetmsx2_2_0.so -o "../customlibs/libepanetmsx2_2_0.so" -fopenmp -Depanetmsx_EXPORTS -IEPANET-MSX/Src/include -IEPANET/SRC_engines/include EPANET-MSX/Src/*.c -Wl,-rpath=. "../customlibs/libepanet2_2.so" -lm -lgomp -lpthread
@@ -1,4 +1,4 @@
1
1
  #!/bin/bash
2
2
  mkdir -p "../customlibs/"
3
- gcc-15 -w -O3 -march=native -dynamiclib -fPIC -install_name libepanet2_2.dylib -o "../customlibs/libepanet2_2.dylib" EPANET/SRC_engines/*.c -IEPANET/SRC_engines/include EPANET/SRC_engines/util/*.c -IEPANET/SRC_engines/util/ -lc -lm -pthread
3
+ gcc-15 -w -O3 -march=native -dynamiclib -fPIC -install_name libepanet2_2.dylib -o "../customlibs/libepanet2_2.dylib" EPANET/SRC_engines/*.c -IEPANET/SRC_engines/include -lc -lm -pthread
4
4
  gcc-15 -w -O3 -march=native -dynamiclib -fPIC -install_name libepanetmsx2_2_0.dylib -o "../customlibs/libepanetmsx2_2_0.dylib" -fopenmp -Depanetmsx_EXPORTS -IEPANET-MSX/Src/include -IEPANET/SRC_engines/include EPANET-MSX/Src/*.c -L'../customlibs' -lepanet2_2 -lm -lgomp -lpthread
epyt_flow/VERSION CHANGED
@@ -1 +1 @@
1
- 0.14.1
1
+ 0.14.2
@@ -167,7 +167,7 @@ class ScadaData(Serializable):
167
167
  raise TypeError("'sensor_readings_time' must be an instance of 'numpy.ndarray' " +
168
168
  f"but not of '{type(sensor_readings_time)}'")
169
169
  if warnings_code is None:
170
- warnings_code = [0] * len(sensor_readings_time)
170
+ warnings_code = np.array([0] * len(sensor_readings_time))
171
171
  else:
172
172
  if not isinstance(warnings_code, np.ndarray):
173
173
  raise TypeError("'warnings_code' must be an instance of 'numpy.ndarray' " +
epyt_flow/utils.py CHANGED
@@ -6,6 +6,7 @@ import math
6
6
  import tempfile
7
7
  import zipfile
8
8
  from pathlib import Path
9
+ import re
9
10
  import requests
10
11
  from tqdm import tqdm
11
12
  import numpy as np
@@ -344,6 +345,71 @@ def plot_timeseries_prediction(y: np.ndarray, y_pred: np.ndarray,
344
345
  return ax
345
346
 
346
347
 
348
+ def download_from_gdrive_if_necessary(download_path: str, url: str, verbose: bool = True) -> None:
349
+ """
350
+ Downloads a file from a google drive repository if it does not already exist
351
+ in a given path.
352
+
353
+ Note that if the path (folder) does not already exist, it will be created.
354
+
355
+ Parameters
356
+ ----------
357
+ download_path : `str`
358
+ Local path to the file -- if this path does not exist, the file will be downloaded from
359
+ the provided 'url' and stored in 'download_dir'.
360
+ url : `str`
361
+ Web-URL of the google drive repository.
362
+ verbose : `bool`, optional
363
+ If True, a progress bar is shown while downloading the file.
364
+
365
+ The default is True.
366
+ """
367
+ folder_path = str(Path(download_path).parent.absolute())
368
+ create_path_if_not_exist(folder_path)
369
+
370
+ if not os.path.isfile(download_path):
371
+ session = requests.Session()
372
+
373
+ response = session.get(url)
374
+ html = response.text
375
+
376
+ def extract(pattern):
377
+ match = re.search(pattern, html)
378
+ return match.group(1) if match else None
379
+
380
+ file_id = extract(r'name="id" value="([^"]+)"')
381
+ file_confirm = extract(r'name="confirm" value="([^"]+)"')
382
+ file_uuid = extract(r'name="uuid" value="([^"]+)"')
383
+
384
+ if not all([file_id, file_confirm, file_uuid]):
385
+ raise SystemError("Failed to extract download parameters")
386
+
387
+ download_url = (
388
+ f"https://drive.usercontent.google.com/download"
389
+ f"?id={file_id}&export=download&confirm={file_confirm}&uuid={file_uuid}"
390
+ )
391
+
392
+ response = session.get(download_url, stream=True)
393
+
394
+ if response.status_code != 200:
395
+ raise SystemError(f"Failed to download -- {response.status_code}")
396
+
397
+ if verbose is True:
398
+ content_length = int(response.headers.get('content-length', 0))
399
+ with open(download_path, "wb") as file, tqdm(desc=download_path,
400
+ total=content_length,
401
+ ascii=True,
402
+ unit='B',
403
+ unit_scale=True,
404
+ unit_divisor=1024) as progress_bar:
405
+ for data in response.iter_content(chunk_size=1024):
406
+ size = file.write(data)
407
+ progress_bar.update(size)
408
+ else:
409
+ with open(download_path, "wb") as f_out:
410
+ f_out.write(response.content)
411
+
412
+
347
413
  def download_if_necessary(download_path: str, url: str, verbose: bool = True,
348
414
  backup_urls: list[str] = []) -> None:
349
415
  """
@@ -188,7 +188,8 @@ class JunctionObject:
188
188
 
189
189
  valid_params = {
190
190
  key: value for key, value in attributes.items()
191
- if key in sig.parameters and value is not None
191
+ if key in sig.parameters and key not in ['vmin', 'vmax', 'cmap']
192
+ and value is not None
192
193
  }
193
194
 
194
195
  return valid_params
@@ -518,7 +519,8 @@ class EdgeObject:
518
519
 
519
520
  valid_params = {
520
521
  key: value for key, value in attributes.items()
521
- if key in sig.parameters and value is not None
522
+ if key in sig.parameters and key not in ['vmin', 'vmax', 'cmap']
523
+ and value is not None
522
524
  }
523
525
 
524
526
  return valid_params
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: epyt-flow
3
- Version: 0.14.1
3
+ Version: 0.14.2
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-Expression: MIT