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,13 +1,13 @@
1
1
  /*
2
2
  ******************************************************************************
3
3
  Project: OWA EPANET
4
- Version: 2.3
4
+ Version: 2.2
5
5
  Module: inpfile.c
6
6
  Description: saves network data to an EPANET formatted text file
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
 
@@ -33,18 +33,17 @@ extern char *MixTxt[];
33
33
  extern char *TstatTxt[];
34
34
  extern char *RptFlagTxt[];
35
35
  extern char *SectTxt[];
36
- extern char *BackflowTxt[];
37
- extern char *CurveTypeTxt[];
38
36
 
39
37
  void saveauxdata(Project *pr, FILE *f)
40
38
  /*
41
39
  ------------------------------------------------------------
42
- Writes auxiliary data from original input file to new file.
40
+ Writes auxilary data from original input file to new file.
43
41
  ------------------------------------------------------------
44
42
  */
45
43
  {
46
44
  int sect, newsect;
47
45
  char *tok;
46
+ char write;
48
47
  char line[MAXLINE + 1];
49
48
  char s[MAXLINE + 1];
50
49
  FILE *InFile = pr->parser.InFile;
@@ -79,23 +78,31 @@ void saveauxdata(Project *pr, FILE *f)
79
78
  {
80
79
  case _LABELS:
81
80
  case _BACKDROP:
81
+ case _TAGS:
82
82
  fprintf(f, "\n%s", line);
83
83
  }
84
84
  }
85
85
  }
86
86
 
87
- // Write line of auxiliary data to file
87
+ // Write line of auxilary data to file
88
88
  else
89
89
  {
90
+ write = FALSE;
90
91
  switch (sect)
91
92
  {
93
+ case _TAGS:
94
+ if (*tok == ';' ||
95
+ (match("NODE", tok) && findnode(&pr->network, strtok(NULL, SEPSTR))) ||
96
+ (match("LINK", tok) && findlink(&pr->network, strtok(NULL, SEPSTR))))
97
+ write = TRUE;
98
+ break;
92
99
  case _LABELS:
93
100
  case _BACKDROP:
94
- fprintf(f, "%s", line);
95
- break;
101
+ write = TRUE; break;
96
102
  default:
97
103
  break;
98
104
  }
105
+ if (write) fprintf(f, "%s", line);
99
106
  }
100
107
  }
101
108
  fclose(InFile);
@@ -144,46 +151,40 @@ int saveinpfile(Project *pr, const char *fname)
144
151
  // (Leave demands for [DEMANDS] section)
145
152
  fprintf(f, "\n\n");
146
153
  fprintf(f, s_JUNCTIONS);
147
- fprintf(f, "\n;;%-31s\t%-12s\t%-12s\t%-31s",
148
- "ID", "Elev", "Demand", "Pattern");
149
154
  for (i = 1; i <= net->Njuncs; i++)
150
155
  {
151
156
  node = &net->Node[i];
152
- fprintf(f, "\n %-31s\t%-12.4f", node->ID, node->El * pr->Ucf[ELEV]);
153
- if (node->Comment) fprintf(f, "\t;%s", node->Comment);
157
+ fprintf(f, "\n %-31s %12.4f", node->ID, node->El * pr->Ucf[ELEV]);
158
+ if (node->Comment) fprintf(f, " ;%s", node->Comment);
154
159
  }
155
160
 
156
161
  // Write [RESERVOIRS] section
157
162
  fprintf(f, "\n\n");
158
163
  fprintf(f, s_RESERVOIRS);
159
- fprintf(f, "\n;;%-31s\t%-12s\t%-31s",
160
- "ID", "Head", "Pattern");
161
164
  for (i = 1; i <= net->Ntanks; i++)
162
165
  {
163
166
  tank = &net->Tank[i];
164
167
  if (tank->A == 0.0)
165
168
  {
166
169
  node = &net->Node[tank->Node];
167
- sprintf(s, " %-31s\t%-12.4f", node->ID, node->El * pr->Ucf[ELEV]);
168
- if ((j = tank->Pat) > 0) sprintf(s1, "%s", net->Pattern[j].ID);
170
+ sprintf(s, " %-31s %12.4f", node->ID, node->El * pr->Ucf[ELEV]);
171
+ if ((j = tank->Pat) > 0) sprintf(s1, " %s", net->Pattern[j].ID);
169
172
  else strcpy(s1, " ");
170
- fprintf(f, "\n%s\t%-31s", s, s1);
171
- if (node->Comment) fprintf(f, "\t;%s", node->Comment);
173
+ fprintf(f, "\n%s %-31s", s, s1);
174
+ if (node->Comment) fprintf(f, " ;%s", node->Comment);
172
175
  }
173
176
  }
174
177
 
175
178
  // Write [TANKS] section
176
179
  fprintf(f, "\n\n");
177
180
  fprintf(f, s_TANKS);
178
- fprintf(f, "\n;;%-31s\t%-12s\t%-12s\t%-12s\t%-12s\t%-12s\t%-12s\t%-31s\t%-12s",
179
- "ID", "Elevation", "InitLevel", "MinLevel", "MaxLevel", "Diameter", "MinVol", "VolCurve", "Overflow");
180
181
  for (i = 1; i <= net->Ntanks; i++)
181
182
  {
182
183
  tank = &net->Tank[i];
183
184
  if (tank->A > 0.0)
184
185
  {
185
186
  node = &net->Node[tank->Node];
186
- sprintf(s, " %-31s\t%-12.4f\t%-12.4f\t%-12.4f\t%-12.4f\t%-12.4f\t%-12.4f",
187
+ sprintf(s, " %-31s %12.4f %12.4f %12.4f %12.4f %12.4f %12.4f",
187
188
  node->ID, node->El * pr->Ucf[ELEV],
188
189
  (tank->H0 - node->El) * pr->Ucf[ELEV],
189
190
  (tank->Hmin - node->El) * pr->Ucf[ELEV],
@@ -193,59 +194,55 @@ int saveinpfile(Project *pr, const char *fname)
193
194
  if ((j = tank->Vcurve) > 0) sprintf(s1, "%s", net->Curve[j].ID);
194
195
  else if (tank->CanOverflow) strcpy(s1, "*");
195
196
  else strcpy(s1, " ");
196
- fprintf(f, "\n%s\t%-31s", s, s1);
197
- if (tank->CanOverflow) fprintf(f, "\t%-12s", "YES");
198
- if (node->Comment) fprintf(f, "\t;%s", node->Comment);
197
+ fprintf(f, "\n%s %-31s", s, s1);
198
+ if (tank->CanOverflow) fprintf(f, " YES ");
199
+ if (node->Comment) fprintf(f, " ;%s", node->Comment);
199
200
  }
200
201
  }
201
202
 
202
203
  // Write [PIPES] section
203
204
  fprintf(f, "\n\n");
204
205
  fprintf(f, s_PIPES);
205
- fprintf(f, "\n;;%-31s\t%-31s\t%-31s\t%-12s\t%-12s\t%-12s\t%-12s\t%-6s",
206
- "ID", "Node1", "Node2", "Length", "Diameter", "Roughness", "MinorLoss", "Status");
207
206
  for (i = 1; i <= net->Nlinks; i++)
208
207
  {
209
208
  link = &net->Link[i];
210
209
  if (link->Type <= PIPE)
211
210
  {
212
211
  d = link->Diam;
213
- kc = link->InitSetting;
212
+ kc = link->Kc;
214
213
  if (hyd->Formflag == DW) kc = kc * pr->Ucf[ELEV] * 1000.0;
215
214
  km = link->Km * SQR(d) * SQR(d) / 0.02517;
216
215
 
217
- sprintf(s, " %-31s\t%-31s\t%-31s\t%-12.4f\t%-12.4f\t%-12.4f\t%-12.4f",
216
+ sprintf(s, " %-31s %-31s %-31s %12.4f %12.4f %12.4f %12.4f",
218
217
  link->ID, net->Node[link->N1].ID, net->Node[link->N2].ID,
219
218
  link->Len * pr->Ucf[LENGTH], d * pr->Ucf[DIAM], kc, km);
220
219
 
221
220
  if (link->Type == CVPIPE) sprintf(s2, "CV");
222
- else if (link->InitStatus == CLOSED) sprintf(s2, "CLOSED");
221
+ else if (link->Status == CLOSED) sprintf(s2, "CLOSED");
223
222
  else strcpy(s2, " ");
224
- fprintf(f, "\n%s\t%-6s", s, s2);
225
- if (link->Comment) fprintf(f, "\t;%s", link->Comment);
223
+ fprintf(f, "\n%s %-6s", s, s2);
224
+ if (link->Comment) fprintf(f, " ;%s", link->Comment);
226
225
  }
227
226
  }
228
227
 
229
228
  // Write [PUMPS] section
230
229
  fprintf(f, "\n\n");
231
230
  fprintf(f, s_PUMPS);
232
- fprintf(f, "\n;;%-31s\t%-31s\t%-31s\t%-12s",
233
- "ID", "Node1", "Node2", "Parameters");
234
231
  for (i = 1; i <= net->Npumps; i++)
235
232
  {
236
233
  n = net->Pump[i].Link;
237
234
  link = &net->Link[n];
238
235
  pump = &net->Pump[i];
239
- sprintf(s, " %-31s\t%-31s\t%-31s", link->ID, net->Node[link->N1].ID,
236
+ sprintf(s, " %-31s %-31s %-31s", link->ID, net->Node[link->N1].ID,
240
237
  net->Node[link->N2].ID);
241
238
 
242
239
  // Pump has constant power
243
- if (pump->Ptype == CONST_HP) sprintf(s1, "\tPOWER %.4f", link->Km);
240
+ if (pump->Ptype == CONST_HP) sprintf(s1, " POWER %.4f", link->Km);
244
241
 
245
242
  // Pump has a head curve
246
243
  else if ((j = pump->Hcurve) > 0)
247
244
  {
248
- sprintf(s1, "\tHEAD %s", net->Curve[j].ID);
245
+ sprintf(s1, " HEAD %s", net->Curve[j].ID);
249
246
  }
250
247
 
251
248
  // Old format used for pump curve
@@ -262,26 +259,25 @@ int saveinpfile(Project *pr, const char *fname)
262
259
  // Optional speed pattern
263
260
  if ((j = pump->Upat) > 0)
264
261
  {
265
- sprintf(s1, "\tPATTERN %s", net->Pattern[j].ID);
262
+ sprintf(s1, " PATTERN %s", net->Pattern[j].ID);
266
263
  strcat(s, s1);
267
264
  }
268
265
 
269
266
  // Optional speed setting
270
- if (link->InitSetting != 1.0)
267
+ if (link->Kc != 1.0)
271
268
  {
272
- sprintf(s1, "\tSPEED %.4f", link->InitSetting);
269
+ sprintf(s1, " SPEED %.4f", link->Kc);
273
270
  strcat(s, s1);
274
271
  }
275
272
 
276
273
  fprintf(f, "\n%s", s);
277
- if (link->Comment) fprintf(f, "\t;%s", link->Comment);
274
+ if (link->Comment) fprintf(f, " ;%s", link->Comment);
275
+
278
276
  }
279
277
 
280
278
  // Write [VALVES] section
281
279
  fprintf(f, "\n\n");
282
280
  fprintf(f, s_VALVES);
283
- fprintf(f, "\n;;%-31s\t%-31s\t%-31s\t%-12s\t%-6s\t%-12s\t%-12s",
284
- "ID", "Node1", "Node2", "Diameter", "Type", "Setting", "MinorLoss");
285
281
  for (i = 1; i <= net->Nvalves; i++)
286
282
  {
287
283
  n = net->Valve[i].Link;
@@ -289,7 +285,8 @@ int saveinpfile(Project *pr, const char *fname)
289
285
  d = link->Diam;
290
286
 
291
287
  // Valve setting
292
- kc = link->InitSetting;
288
+ kc = link->Kc;
289
+ if (kc == MISSING) kc = 0.0;
293
290
  switch (link->Type)
294
291
  {
295
292
  case FCV:
@@ -305,44 +302,36 @@ int saveinpfile(Project *pr, const char *fname)
305
302
  }
306
303
  km = link->Km * SQR(d) * SQR(d) / 0.02517;
307
304
 
308
- sprintf(s, " %-31s\t%-31s\t%-31s\t%-12.4f\t%-6s",
305
+ sprintf(s, " %-31s %-31s %-31s %12.4f %5s",
309
306
  link->ID, net->Node[link->N1].ID,
310
307
  net->Node[link->N2].ID, d * pr->Ucf[DIAM],
311
308
  LinkTxt[link->Type]);
312
309
 
313
310
  // For GPV, setting = head curve index
314
- if (link->Type == GPV && (j = ROUND(kc)) > 0)
315
- {
316
- sprintf(s1, "%-31s\t%-12.4f", net->Curve[j].ID, km);
317
- }
318
- // For PCV add loss curve if present
319
- else if (link->Type == PCV && (j = net->Valve[i].Curve) > 0)
311
+ if (link->Type == GPV && (j = ROUND(link->Kc)) > 0)
320
312
  {
321
- sprintf(s1, "%-12.4f\t%-12.4f\t%-31s", kc, km, net->Curve[j].ID);
313
+ sprintf(s1, "%-31s %12.4f", net->Curve[j].ID, km);
322
314
  }
323
- else sprintf(s1, "%-12.4f\t%-12.4f", kc, km);
324
- fprintf(f, "\n%s\t%s", s, s1);
325
- if (link->Comment) fprintf(f, "\t;%s", link->Comment);
315
+ else sprintf(s1, "%12.4f %12.4f", kc, km);
316
+ fprintf(f, "\n%s %s", s, s1);
317
+ if (link->Comment) fprintf(f, " ;%s", link->Comment);
326
318
  }
327
319
 
328
320
 
329
321
  // Write [DEMANDS] section
330
322
  fprintf(f, "\n\n");
331
323
  fprintf(f, s_DEMANDS);
332
- fprintf(f, "\n;;%-31s\t%-14s\t%-31s\t%-31s",
333
- "Junction", "Demand", "Pattern", "Category");
334
324
  ucf = pr->Ucf[DEMAND];
335
325
  for (i = 1; i <= net->Njuncs; i++)
336
326
  {
337
327
  node = &net->Node[i];
338
328
  for (demand = node->D; demand != NULL; demand = demand->next)
339
329
  {
340
- if (demand->Base == 0.0) continue;
341
- sprintf(s, " %-31s\t%-14.6f", node->ID, ucf * demand->Base);
342
- if ((j = demand->Pat) > 0) sprintf(s1, "%-31s", net->Pattern[j].ID);
330
+ sprintf(s, " %-31s %14.6f", node->ID, ucf * demand->Base);
331
+ if ((j = demand->Pat) > 0) sprintf(s1, " %-31s", net->Pattern[j].ID);
343
332
  else strcpy(s1, " ");
344
- fprintf(f, "\n%s\t%-31s", s, s1);
345
- if (demand->Name) fprintf(f, "\t;%s", demand->Name);
333
+ fprintf(f, "\n%s %-31s", s, s1);
334
+ if (demand->Name) fprintf(f, " ;%s", demand->Name);
346
335
  }
347
336
  }
348
337
 
@@ -350,42 +339,25 @@ int saveinpfile(Project *pr, const char *fname)
350
339
  // Write [EMITTERS] section
351
340
  fprintf(f, "\n\n");
352
341
  fprintf(f, s_EMITTERS);
353
- fprintf(f, "\n;;%-31s\t%-14s",
354
- "Junction", "Coefficient");
355
342
  for (i = 1; i <= net->Njuncs; i++)
356
343
  {
357
344
  node = &net->Node[i];
358
345
  if (node->Ke == 0.0) continue;
359
346
  ke = pr->Ucf[FLOW] / pow(pr->Ucf[PRESSURE] * node->Ke, (1.0 / hyd->Qexp));
360
- fprintf(f, "\n %-31s\t%-14.6f", node->ID, ke);
361
- }
362
-
363
- // Write [LEAKAGE] section
364
- fprintf(f, "\n\n");
365
- fprintf(f, s_LEAKAGE);
366
- fprintf(f, "\n;;%-31s\t%-14s\t%-14s",
367
- "Pipe", "Leak Area", "Leak Expansion");
368
- for (i = 1; i <= net->Nlinks; i++)
369
- {
370
- link = &net->Link[i];
371
- if (link->LeakArea == 0.0 && link->LeakExpan == 0.0) continue;
372
- fprintf(f, "\n %-31s %14.6f %14.6f", link->ID,
373
- link->LeakArea * pr->Ucf[LENGTH], link->LeakExpan * pr->Ucf[LENGTH]);
347
+ fprintf(f, "\n %-31s %14.6f", node->ID, ke);
374
348
  }
375
349
 
376
350
  // Write [STATUS] section
377
351
  fprintf(f, "\n\n");
378
352
  fprintf(f, s_STATUS);
379
- fprintf(f, "\n;;%-31s\t%-12s",
380
- "ID", "Status/Setting");
381
353
  for (i = 1; i <= net->Nlinks; i++)
382
354
  {
383
355
  link = &net->Link[i];
384
356
  if (link->Type <= PUMP)
385
357
  {
386
- if (link->InitStatus == CLOSED)
358
+ if (link->Status == CLOSED)
387
359
  {
388
- fprintf(f, "\n %-31s\t%s", link->ID, StatTxt[CLOSED]);
360
+ fprintf(f, "\n %-31s %s", link->ID, StatTxt[CLOSED]);
389
361
  }
390
362
 
391
363
  // Write pump speed here for pumps with old-style pump curve input
@@ -394,23 +366,23 @@ int saveinpfile(Project *pr, const char *fname)
394
366
  n = findpump(net, i);
395
367
  pump = &net->Pump[n];
396
368
  if (pump->Hcurve == 0 && pump->Ptype != CONST_HP &&
397
- link->InitSetting != 1.0)
369
+ link->Kc != 1.0)
398
370
  {
399
- fprintf(f, "\n %-31s\t%-.4f", link->ID, link->InitSetting);
371
+ fprintf(f, "\n %-31s %-.4f", link->ID, link->Kc);
400
372
  }
401
373
  }
402
374
  }
403
375
 
404
- // Write fixed-status valves
405
- else
376
+ // Write fixed-status PRVs & PSVs (setting = MISSING)
377
+ else if (link->Kc == MISSING)
406
378
  {
407
- if (link->InitStatus == OPEN)
379
+ if (link->Status == OPEN)
408
380
  {
409
- fprintf(f, "\n %-31s\t%s", link->ID, StatTxt[OPEN]);
381
+ fprintf(f, "\n %-31s %s", link->ID, StatTxt[OPEN]);
410
382
  }
411
- if (link->InitStatus == CLOSED)
383
+ if (link->Status == CLOSED)
412
384
  {
413
- fprintf(f, "\n%-31s\t%s", link->ID, StatTxt[CLOSED]);
385
+ fprintf(f, "\n%-31s %s", link->ID, StatTxt[CLOSED]);
414
386
  }
415
387
  }
416
388
  }
@@ -419,35 +391,26 @@ int saveinpfile(Project *pr, const char *fname)
419
391
  // (Use 6 pattern factors per line)
420
392
  fprintf(f, "\n\n");
421
393
  fprintf(f, s_PATTERNS);
422
- fprintf(f, "\n;;%-31s\t%-12s",
423
- "ID", "Multipliers");
424
394
  for (i = 1; i <= net->Npats; i++)
425
395
  {
426
396
  if (net->Pattern[i].Comment) fprintf(f, "\n;%s", net->Pattern[i].Comment);
427
397
  for (j = 0; j < net->Pattern[i].Length; j++)
428
398
  {
429
399
  if (j % 6 == 0) fprintf(f, "\n %-31s", net->Pattern[i].ID);
430
- fprintf(f, "\t%-12.4f", net->Pattern[i].F[j]);
400
+ fprintf(f, " %12.4f", net->Pattern[i].F[j]);
431
401
  }
432
402
  }
433
403
 
434
404
  // Write [CURVES] section
435
405
  fprintf(f, "\n\n");
436
406
  fprintf(f, s_CURVES);
437
- fprintf(f, "\n;;%-31s\t%-12s\t%-12s", "ID", "X-Value", "Y-Value");
438
407
  for (i = 1; i <= net->Ncurves; i++)
439
408
  {
440
- curve = &net->Curve[i];
441
- if (curve->Comment) fprintf(f, "\n;%s", curve->Comment);
442
- if (curve->Npts > 0)
409
+ if (net->Curve[i].Comment) fprintf(f, "\n;%s", net->Curve[i].Comment);
410
+ for (j = 0; j < net->Curve[i].Npts; j++)
443
411
  {
444
- fprintf(f, "\n %-31s\t%-12.4f\t%-12.4f\t%s", curve->ID,
445
- curve->X[0], curve->Y[0], CurveTypeTxt[curve->Type]);
446
- for (j = 1; j < curve->Npts; j++)
447
- {
448
- fprintf(f, "\n %-31s\t%-12.4f\t%-12.4f", curve->ID,
449
- curve->X[j], curve->Y[j]);
450
- }
412
+ curve = &net->Curve[i];
413
+ fprintf(f, "\n %-31s %12.4f %12.4f", curve->ID, curve->X[j], curve->Y[j]);
451
414
  }
452
415
  }
453
416
 
@@ -462,12 +425,7 @@ int saveinpfile(Project *pr, const char *fname)
462
425
  link = &net->Link[j];
463
426
 
464
427
  // Get text of control's link status/setting
465
- if (control->Setting == MISSING || link->Type == GPV || link->Type == PIPE)
466
- {
467
- sprintf(s, " LINK %s %s ", link->ID, StatTxt[control->Status]);
468
- }
469
- else if (link->Type == PUMP &&
470
- (control->Setting == 0.0 || control->Setting == 1.0))
428
+ if (control->Setting == MISSING)
471
429
  {
472
430
  sprintf(s, " LINK %s %s ", link->ID, StatTxt[control->Status]);
473
431
  }
@@ -515,10 +473,7 @@ int saveinpfile(Project *pr, const char *fname)
515
473
  fprintf(f, "\n%s AT %s %s", s, ControlTxt[TIMEOFDAY],
516
474
  clocktime(rpt->Atime, control->Time));
517
475
  break;
518
-
519
- default: continue;
520
476
  }
521
- if (control->isEnabled == FALSE) fprintf(f, " DISABLED");
522
477
  }
523
478
 
524
479
  // Write [RULES] section
@@ -528,7 +483,6 @@ int saveinpfile(Project *pr, const char *fname)
528
483
  {
529
484
  fprintf(f, "\nRULE %s", pr->network.Rule[i].label);
530
485
  writerule(pr, f, i); // see RULES.C
531
- if (pr->network.Rule[i].isEnabled == FALSE) fprintf(f, "\nDISABLED");
532
486
  fprintf(f, "\n");
533
487
  }
534
488
 
@@ -536,43 +490,40 @@ int saveinpfile(Project *pr, const char *fname)
536
490
  // (Skip nodes with default quality of 0)
537
491
  fprintf(f, "\n\n");
538
492
  fprintf(f, s_QUALITY);
539
- fprintf(f, "\n;;%-31s\t%-14s", "ID", "InitQual");
540
493
  for (i = 1; i <= net->Nnodes; i++)
541
494
  {
542
495
  node = &net->Node[i];
543
496
  if (node->C0 == 0.0) continue;
544
- fprintf(f, "\n %-31s\t%-14.6f", node->ID, node->C0 * pr->Ucf[QUALITY]);
497
+ fprintf(f, "\n %-31s %14.6f", node->ID, node->C0 * pr->Ucf[QUALITY]);
545
498
  }
546
499
 
547
500
  // Write [SOURCES] section
548
501
  fprintf(f, "\n\n");
549
502
  fprintf(f, s_SOURCES);
550
- fprintf(f, "\n;;%-31s\t%-9s\t%-14s\t%-31s", "ID", "Type", "Quality", "Pattern");
551
503
  for (i = 1; i <= net->Nnodes; i++)
552
504
  {
553
505
  node = &net->Node[i];
554
506
  source = node->S;
555
507
  if (source == NULL) continue;
556
- sprintf(s, " %-31s\t%-9s\t%-14.6f", node->ID, SourceTxt[source->Type],
508
+ sprintf(s, " %-31s %-8s %14.6f", node->ID, SourceTxt[source->Type],
557
509
  source->C0);
558
510
  if ((j = source->Pat) > 0)
559
511
  {
560
512
  sprintf(s1, "%s", net->Pattern[j].ID);
561
513
  }
562
514
  else strcpy(s1, "");
563
- fprintf(f, "\n%s\t%s", s, s1);
515
+ fprintf(f, "\n%s %s", s, s1);
564
516
  }
565
517
 
566
518
  // Write [MIXING] section
567
519
  fprintf(f, "\n\n");
568
520
  fprintf(f, s_MIXING);
569
- fprintf(f, "\n;;%-31s\t%-8s", "ID", "Model");
570
521
  for (i = 1; i <= net->Ntanks; i++)
571
522
  {
572
523
  tank = &net->Tank[i];
573
524
  if (tank->A == 0.0) continue;
574
- fprintf(f, "\n %-31s\t%-8s\t%12.4f", net->Node[tank->Node].ID,
575
- MixTxt[tank->MixModel], tank->V1frac);
525
+ fprintf(f, "\n %-31s %-8s %12.4f", net->Node[tank->Node].ID,
526
+ MixTxt[tank->MixModel], (tank->V1max / tank->Vmax));
576
527
  }
577
528
 
578
529
  // Write [REACTIONS] section
@@ -595,10 +546,6 @@ int saveinpfile(Project *pr, const char *fname)
595
546
  fprintf(f, "\n ROUGHNESS CORRELATION %-.6f", qual->Rfactor);
596
547
  }
597
548
 
598
- fprintf(f, "\n\n");
599
- fprintf(f, s_REACTIONS);
600
- fprintf(f, "\n;%-9s\t%-31s\t%-12s", "Type", "Pipe/Tank", "Coefficient");
601
-
602
549
  // Pipe-specific parameters
603
550
  for (i = 1; i <= net->Nlinks; i++)
604
551
  {
@@ -606,11 +553,11 @@ int saveinpfile(Project *pr, const char *fname)
606
553
  if (link->Type > PIPE) continue;
607
554
  if (link->Kb != qual->Kbulk)
608
555
  {
609
- fprintf(f, "\n %-9s\t%-31s\t%-.6f", "BULK", link->ID, link->Kb * SECperDAY);
556
+ fprintf(f, "\n BULK %-31s %-.6f", link->ID, link->Kb * SECperDAY);
610
557
  }
611
558
  if (link->Kw != qual->Kwall)
612
559
  {
613
- fprintf(f, "\n %-9s\t%-31s\t%-.6f", "WALL", link->ID, link->Kw * SECperDAY);
560
+ fprintf(f, "\n WALL %-31s %-.6f", link->ID, link->Kw * SECperDAY);
614
561
  }
615
562
  }
616
563
 
@@ -621,7 +568,7 @@ int saveinpfile(Project *pr, const char *fname)
621
568
  if (tank->A == 0.0) continue;
622
569
  if (tank->Kb != qual->Kbulk)
623
570
  {
624
- fprintf(f, "\n %-9s\t%-31s\t%-.6f", "TANK", net->Node[tank->Node].ID,
571
+ fprintf(f, "\n TANK %-31s %-.6f", net->Node[tank->Node].ID,
625
572
  tank->Kb * SECperDAY);
626
573
  }
627
574
  }
@@ -719,11 +666,8 @@ int saveinpfile(Project *pr, const char *fname)
719
666
  break;
720
667
  }
721
668
 
722
- if (hyd->DefPat > 0)
723
- fprintf(f, "\n PATTERN %s", net->Pattern[hyd->DefPat].ID);
724
669
  fprintf(f, "\n DEMAND MULTIPLIER %-.4f", hyd->Dmult);
725
670
  fprintf(f, "\n EMITTER EXPONENT %-.4f", 1.0 / hyd->Qexp);
726
- fprintf(f, "\n BACKFLOW ALLOWED %s", BackflowTxt[hyd->EmitBackFlag]);
727
671
  fprintf(f, "\n VISCOSITY %-.6f", hyd->Viscos / VISCOS);
728
672
  fprintf(f, "\n DIFFUSIVITY %-.6f", qual->Diffus / DIFFUS);
729
673
  fprintf(f, "\n SPECIFIC GRAVITY %-.6f", hyd->SpGrav);
@@ -830,50 +774,32 @@ int saveinpfile(Project *pr, const char *fname)
830
774
  }
831
775
  else fprintf(f, "\n %-20sNO",field->Name);
832
776
  }
833
-
834
- // Write [TAGS] section
835
- fprintf(f, "\n\n");
836
- fprintf(f, s_TAGS);
837
- fprintf(f, "\n;;%-8s\t%-31s\t%s", "Object", "ID", "Tag");
838
- for (i = 1; i <= net->Nnodes; i++)
839
- {
840
- node = &net->Node[i];
841
- if (node->Tag == NULL || strlen(node->Tag) == 0) continue;
842
- fprintf(f, "\n %-8s\t%-31s\t%s", "NODE", node->ID, node->Tag);
843
- }
844
- for (i = 1; i <= net->Nlinks; i++)
845
- {
846
- link = &net->Link[i];
847
- if (link->Tag == NULL || strlen(link->Tag) == 0) continue;
848
- fprintf(f, "\n %-8s\t%-31s\t%s", "LINK", link->ID, link->Tag);
849
- }
777
+
850
778
  // Write [COORDINATES] section
851
779
  fprintf(f, "\n\n");
852
780
  fprintf(f, s_COORDS);
853
- fprintf(f, "\n;;%-31s\t%-14s\t%-14s", "ID", "X-Coord", "Y-Coord");
854
781
  for (i = 1; i <= net->Nnodes; i++)
855
782
  {
856
783
  node = &net->Node[i];
857
784
  if (node->X == MISSING || node->Y == MISSING) continue;
858
- fprintf(f, "\n %-31s\t%-14.6f\t%-14.6f", node->ID, node->X, node->Y);
785
+ fprintf(f, "\n %-31s %14.6f %14.6f", node->ID, node->X, node->Y);
859
786
  }
860
787
 
861
788
  // Write [VERTICES] section
862
789
  fprintf(f, "\n\n");
863
790
  fprintf(f, s_VERTICES);
864
- fprintf(f, "\n;;%-31s\t%-14s\t%-14s", "ID", "X-Coord", "Y-Coord");
865
791
  for (i = 1; i <= net->Nlinks; i++)
866
792
  {
867
793
  link = &net->Link[i];
868
794
  if (link->Vertices != NULL)
869
795
  {
870
796
  for (j = 0; j < link->Vertices->Npts; j++)
871
- fprintf(f, "\n %-31s\t%-14.6f\t%-14.6f",
797
+ fprintf(f, "\n %-31s %14.6f %14.6f",
872
798
  link->ID, link->Vertices->X[j], link->Vertices->Y[j]);
873
799
  }
874
800
  }
875
801
 
876
- // Save auxiliary data to new input file
802
+ // Save auxilary data to new input file
877
803
  fprintf(f, "\n");
878
804
  saveauxdata(pr, f);
879
805