epyt-flow 0.13.1__py3-none-any.whl → 0.14.1__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 (63) hide show
  1. epyt_flow/EPANET/EPANET/SRC_engines/AUTHORS +40 -8
  2. epyt_flow/EPANET/EPANET/SRC_engines/LICENSE +3 -3
  3. epyt_flow/EPANET/EPANET/SRC_engines/enumstxt.h +24 -7
  4. epyt_flow/EPANET/EPANET/SRC_engines/epanet.c +726 -374
  5. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.c +128 -32
  6. epyt_flow/EPANET/EPANET/SRC_engines/errors.dat +7 -1
  7. epyt_flow/EPANET/EPANET/SRC_engines/flowbalance.c +186 -0
  8. epyt_flow/EPANET/EPANET/SRC_engines/funcs.h +40 -14
  9. epyt_flow/EPANET/EPANET/SRC_engines/hash.c +177 -177
  10. epyt_flow/EPANET/EPANET/SRC_engines/hash.h +28 -28
  11. epyt_flow/EPANET/EPANET/SRC_engines/hydcoeffs.c +192 -40
  12. epyt_flow/EPANET/EPANET/SRC_engines/hydraul.c +101 -46
  13. epyt_flow/EPANET/EPANET/SRC_engines/hydsolver.c +85 -24
  14. epyt_flow/EPANET/EPANET/SRC_engines/hydstatus.c +29 -63
  15. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2.h +70 -37
  16. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_2.h +408 -234
  17. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_enums.h +87 -37
  18. epyt_flow/EPANET/EPANET/SRC_engines/inpfile.c +153 -79
  19. epyt_flow/EPANET/EPANET/SRC_engines/input1.c +59 -94
  20. epyt_flow/EPANET/EPANET/SRC_engines/input2.c +73 -202
  21. epyt_flow/EPANET/EPANET/SRC_engines/input3.c +446 -351
  22. epyt_flow/EPANET/EPANET/SRC_engines/leakage.c +527 -0
  23. epyt_flow/EPANET/EPANET/SRC_engines/mempool.c +8 -4
  24. epyt_flow/EPANET/EPANET/SRC_engines/mempool.h +23 -23
  25. epyt_flow/EPANET/EPANET/SRC_engines/output.c +5 -4
  26. epyt_flow/EPANET/EPANET/SRC_engines/project.c +407 -75
  27. epyt_flow/EPANET/EPANET/SRC_engines/quality.c +12 -2
  28. epyt_flow/EPANET/EPANET/SRC_engines/qualreact.c +70 -13
  29. epyt_flow/EPANET/EPANET/SRC_engines/qualroute.c +7 -5
  30. epyt_flow/EPANET/EPANET/SRC_engines/report.c +88 -20
  31. epyt_flow/EPANET/EPANET/SRC_engines/rules.c +144 -6
  32. epyt_flow/EPANET/EPANET/SRC_engines/smatrix.c +19 -19
  33. epyt_flow/EPANET/EPANET/SRC_engines/text.h +16 -5
  34. epyt_flow/EPANET/EPANET/SRC_engines/types.h +73 -19
  35. epyt_flow/EPANET/EPANET/SRC_engines/util/cstr_helper.c +59 -0
  36. epyt_flow/EPANET/EPANET/SRC_engines/util/cstr_helper.h +38 -0
  37. epyt_flow/EPANET/EPANET/SRC_engines/util/errormanager.c +92 -0
  38. epyt_flow/EPANET/EPANET/SRC_engines/util/errormanager.h +39 -0
  39. epyt_flow/EPANET/EPANET/SRC_engines/util/filemanager.c +212 -0
  40. epyt_flow/EPANET/EPANET/SRC_engines/util/filemanager.h +81 -0
  41. epyt_flow/EPANET/EPANET/SRC_engines/validate.c +408 -0
  42. epyt_flow/EPANET/compile_linux.sh +1 -1
  43. epyt_flow/EPANET/compile_macos.sh +2 -2
  44. epyt_flow/VERSION +1 -1
  45. epyt_flow/__init__.py +1 -1
  46. epyt_flow/gym/scenario_control_env.py +26 -3
  47. epyt_flow/simulation/backend/my_epyt.py +58 -13
  48. epyt_flow/simulation/events/quality_events.py +6 -6
  49. epyt_flow/simulation/events/sensor_faults.py +24 -24
  50. epyt_flow/simulation/events/system_event.py +3 -3
  51. epyt_flow/simulation/scada/scada_data.py +10 -14
  52. epyt_flow/simulation/scenario_simulator.py +100 -20
  53. epyt_flow/topology.py +8 -1
  54. epyt_flow/uncertainty/model_uncertainty.py +292 -150
  55. epyt_flow/uncertainty/uncertainties.py +2 -2
  56. {epyt_flow-0.13.1.dist-info → epyt_flow-0.14.1.dist-info}/METADATA +4 -4
  57. {epyt_flow-0.13.1.dist-info → epyt_flow-0.14.1.dist-info}/RECORD +60 -54
  58. {epyt_flow-0.13.1.dist-info → epyt_flow-0.14.1.dist-info}/WHEEL +1 -1
  59. epyt_flow/EPANET/EPANET/SRC_engines/Readme_SRC_Engines.txt +0 -18
  60. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.def +0 -131
  61. epyt_flow/EPANET/EPANET/SRC_engines/main.c +0 -93
  62. {epyt_flow-0.13.1.dist-info → epyt_flow-0.14.1.dist-info}/licenses/LICENSE +0 -0
  63. {epyt_flow-0.13.1.dist-info → epyt_flow-0.14.1.dist-info}/top_level.txt +0 -0
@@ -5,13 +5,13 @@
5
5
  /*
6
6
  ******************************************************************************
7
7
  Project: OWA EPANET
8
- Version: 2.2
8
+ Version: 2.3
9
9
  Module: epanet2.h
10
10
  Description: API function declarations
11
11
  Authors: see AUTHORS
12
12
  Copyright: see AUTHORS
13
13
  License: see LICENSE
14
- Last Updated: 10/29/2019
14
+ Last Updated: 04/25/2025
15
15
  ******************************************************************************
16
16
  */
17
17
 
@@ -48,11 +48,11 @@ extern "C" {
48
48
  */
49
49
  typedef struct Project *EN_Project;
50
50
 
51
- /********************************************************************
51
+ /*===================================================================
52
52
 
53
53
  Project Functions
54
54
 
55
- ********************************************************************/
55
+ ===================================================================*/
56
56
 
57
57
  /**
58
58
  @brief Creates an EPANET project.
@@ -113,7 +113,7 @@ typedef struct Project *EN_Project;
113
113
  int unitsType, int headLossType);
114
114
 
115
115
  /**
116
- @brief Opens an EPANET input file & reads in network data.
116
+ @brief Reads an EPANET input file with no errors allowed.
117
117
  @param ph an EPANET project handle.
118
118
  @param inpFile the name of an existing EPANET-formatted input file.
119
119
  @param rptFile the name of a report file to be created (or "" if not needed).
@@ -121,11 +121,27 @@ typedef struct Project *EN_Project;
121
121
  @return an error code.
122
122
 
123
123
  This function should be called immediately after ::EN_createproject if an EPANET-formatted
124
- input file will be used to supply network data.
124
+ input file will be used to supply network data. If errors are detected then the project is
125
+ not opened and will not accept toolkit function calls.
125
126
  */
126
127
  int DLLEXPORT EN_open(EN_Project ph, const char *inpFile, const char *rptFile,
127
128
  const char *outFile);
128
129
 
130
+ /**
131
+ @brief Reads an EPANET input file with errors allowed.
132
+ @param ph an EPANET project handle.
133
+ @param inpFile the name of an existing EPANET-formatted input file.
134
+ @param rptFile the name of a report file to be created (or "" if not needed).
135
+ @param outFile the name of a binary output file to be created (or "" if not needed).
136
+ @return an error code.
137
+
138
+ This function should be called immediately after ::EN_createproject if an EPANET-formatted
139
+ input file will be used to supply network data. If formatting errors are detected (error
140
+ code = 200) then the project remains open and will accept toolkit function calls.
141
+ */
142
+ int DLLEXPORT EN_openX(EN_Project ph, const char *inpFile, const char *rptFile,
143
+ const char *outFile);
144
+
129
145
  /**
130
146
  @brief Retrieves the title lines of the project
131
147
  @param ph an EPANET project handle.
@@ -144,7 +160,8 @@ typedef struct Project *EN_Project;
144
160
  @param line3 third title line
145
161
  @return an error code
146
162
  */
147
- int DLLEXPORT EN_settitle(EN_Project ph, char *line1, char *line2, char *line3);
163
+ int DLLEXPORT EN_settitle(EN_Project ph, const char *line1, const char *line2,
164
+ const char *line3);
148
165
 
149
166
  /**
150
167
  @brief Retrieves a descriptive comment assigned to a Node, Link, Pattern or Curve.
@@ -161,32 +178,54 @@ typedef struct Project *EN_Project;
161
178
  @param ph an EPANET project handle.
162
179
  @param object a type of object (either EN_NODE, EN_LINK, EN_TIMEPAT or EN_CURVE)
163
180
  @param index the object's index starting from 1
164
- @param[out] comment the comment string assigned to the object
181
+ @param comment the comment string assigned to the object
165
182
  @return an error code
166
183
  */
167
- int DLLEXPORT EN_setcomment(EN_Project ph, int object, int index, char *comment);
184
+ int DLLEXPORT EN_setcomment(EN_Project ph, int object, int index,
185
+ const char *comment);
186
+
187
+ /**
188
+ @brief Retrieves a tag string assigned to a Node or Link.
189
+ @param ph an EPANET project handle.
190
+ @param object a type of object (either EN_NODE or EN_LINK)
191
+ @param index the object's index starting from 1
192
+ @param[out] out_tag the tag string assigned to the object
193
+ @return an error code
194
+ */
195
+ int DLLEXPORT EN_gettag(EN_Project ph, int object, int index, char *out_tag);
196
+
197
+ /**
198
+ @brief Assigns a tag string to a Node or Link.
199
+ @param ph an EPANET project handle.
200
+ @param object a type of object (either EN_NODE or EN_LINK)
201
+ @param index the object's index starting from 1
202
+ @param tag the tag string assigned to the object
203
+ @return an error code
204
+ */
205
+ int DLLEXPORT EN_settag(EN_Project ph, int object, int index,
206
+ const char *tag);
168
207
 
169
208
  /**
170
209
  @brief Retrieves the number of objects of a given type in a project.
171
210
  @param ph an EPANET project handle.
172
211
  @param object a type of object to count (see @ref EN_CountType)
173
- @param[out] count number of objects of the specified type
212
+ @param[out] out_count number of objects of the specified type
174
213
  @return an error code
175
214
  */
176
- int DLLEXPORT EN_getcount(EN_Project ph, int object, int *count);
215
+ int DLLEXPORT EN_getcount(EN_Project ph, int object, int *out_count);
177
216
 
178
217
  /**
179
218
  @brief Saves a project's data to an EPANET-formatted text file.
180
219
  @param ph an EPANET project handle.
181
220
  @param filename the name of the file to create.
182
- @return Error code
221
+ @return an error code
183
222
  */
184
223
  int DLLEXPORT EN_saveinpfile(EN_Project ph, const char *filename);
185
224
 
186
225
  /**
187
226
  @brief Closes a project and frees all of its memory.
188
227
  @param ph an EPANET project handle.
189
- @return Error code
228
+ @return an error code
190
229
 
191
230
  This function clears all existing data from a project but does not delete the
192
231
  project, so it can be re-used with another set of network data. Use ::EN_deleteproject
@@ -194,11 +233,11 @@ typedef struct Project *EN_Project;
194
233
  */
195
234
  int DLLEXPORT EN_close(EN_Project ph);
196
235
 
197
- /********************************************************************
236
+ /*===================================================================
198
237
 
199
238
  Hydraulic Analysis Functions
200
239
 
201
- ********************************************************************/
240
+ ===================================================================*/
202
241
 
203
242
  /**
204
243
  @brief Runs a complete hydraulic simulation with results for all time periods
@@ -288,31 +327,31 @@ typedef struct Project *EN_Project;
288
327
  /**
289
328
  @brief Computes a hydraulic solution for the current point in time.
290
329
  @param ph an EPANET project handle.
291
- @param[out] currentTime the current simulation time in seconds.
330
+ @param[out] out_currentTime the current simulation time in seconds.
292
331
  @return an error or warning code.
293
332
 
294
333
  This function is used in a loop with ::EN_nextH to run an extended period hydraulic
295
- simulation. This process automatically updates the simulation clock time so \b currentTime
334
+ simulation. This process automatically updates the simulation clock time so `currentTime`
296
335
  should be treated as a read-only variable.
297
336
 
298
337
  ::EN_initH must have been called prior to running the ::EN_runH - ::EN_nextH loop.
299
338
 
300
339
  See ::EN_nextH for an example of using this function.
301
340
  */
302
- int DLLEXPORT EN_runH(EN_Project ph, long *currentTime);
341
+ int DLLEXPORT EN_runH(EN_Project ph, long *out_currentTime);
303
342
 
304
343
  /**
305
344
  @brief Determines the length of time until the next hydraulic event occurs in an
306
345
  extended period simulation.
307
346
  @param ph an EPANET project handle.
308
- @param[out] tStep the time (in seconds) until the next hydraulic event or 0 if at
347
+ @param[out] out_tStep the time (in seconds) until the next hydraulic event or 0 if at
309
348
  the end of the full simulation duration.
310
349
  @return an error code.
311
350
 
312
351
  This function is used in a loop with ::EN_runH to run an extended period hydraulic
313
352
  simulation.
314
353
 
315
- The value of \b tstep should be treated as a read-only variable. It is automatically
354
+ The value of `out_tstep` should be treated as a read-only variable. It is automatically
316
355
  computed as the smaller of:
317
356
  - the time interval until the next hydraulic time step begins
318
357
  - the time interval until the next reporting time step begins
@@ -333,7 +372,7 @@ typedef struct Project *EN_Project;
333
372
  EN_closeH(ph);
334
373
  \endcode
335
374
  */
336
- int DLLEXPORT EN_nextH(EN_Project ph, long *tStep);
375
+ int DLLEXPORT EN_nextH(EN_Project ph, long *out_tStep);
337
376
 
338
377
  /**
339
378
  @brief Transfers a project's hydraulics results from its temporary hydraulics file
@@ -361,7 +400,7 @@ typedef struct Project *EN_Project;
361
400
 
362
401
  Before calling this function hydraulic results must have been generated and saved by having
363
402
  called ::EN_solveH or the ::EN_initH - ::EN_runH - ::EN_nextH sequence with the initflag
364
- argument of ::EN_initH set to \b EN_SAVE or \b EN_SAVE_AND_INIT.
403
+ argument of ::EN_initH set to `EN_SAVE` or `EN_SAVE_AND_INIT`.
365
404
  */
366
405
  int DLLEXPORT EN_savehydfile(EN_Project ph, const char *filename);
367
406
 
@@ -374,11 +413,11 @@ typedef struct Project *EN_Project;
374
413
  */
375
414
  int DLLEXPORT EN_closeH(EN_Project ph);
376
415
 
377
- /********************************************************************
416
+ /*===================================================================
378
417
 
379
418
  Water Quality Analysis Functions
380
419
 
381
- ********************************************************************/
420
+ ===================================================================*/
382
421
 
383
422
  /**
384
423
  @brief Runs a complete water quality simulation with results at uniform
@@ -401,7 +440,7 @@ typedef struct Project *EN_Project;
401
440
 
402
441
  /**
403
442
  @brief Opens a project's water quality solver.
404
- @param ph n EPANET project handle.
443
+ @param ph an EPANET project handle.
405
444
  @return an error code.
406
445
 
407
446
  Call ::EN_openQ prior to running the first water quality analysis using an
@@ -417,8 +456,8 @@ typedef struct Project *EN_Project;
417
456
  /**
418
457
  @brief Initializes a network prior to running a water quality analysis.
419
458
  @param ph an EPANET project handle.
420
- @param saveFlag set to \b EN_SAVE (1) if results are to be saved to the project's
421
- binary output file, or to \b EN_NOSAVE (0) if not.
459
+ @param saveFlag set to `EN_SAVE` (1) if results are to be saved to the project's
460
+ binary output file, or to `EN_NOSAVE` (0) if not.
422
461
  @return an error code.
423
462
 
424
463
  Call ::EN_initQ prior to running a water quality analysis using ::EN_runQ in
@@ -434,7 +473,7 @@ typedef struct Project *EN_Project;
434
473
  @brief Makes hydraulic and water quality results at the start of the current time
435
474
  period available to a project's water quality solver.
436
475
  @param ph an EPANET project handle.
437
- @param[out] currentTime current simulation time in seconds.
476
+ @param[out] out_currentTime current simulation time in seconds.
438
477
  @return an error code.
439
478
 
440
479
  Use ::EN_runQ along with ::EN_nextQ in a loop to access water quality results at the
@@ -445,16 +484,16 @@ typedef struct Project *EN_Project;
445
484
  ::EN_initQ must have been called prior to running an ::EN_runQ - ::EN_nextQ
446
485
  (or ::EN_stepQ) loop.
447
486
 
448
- The current time of the simulation is determined from information saved with the
449
- hydraulic analysis that preceded the water quality analysis. Treat it as a read-only
450
- variable.
487
+ The current time of the simulation, `out_currentTime`, is determined from information
488
+ saved with the hydraulic analysis that preceded the water quality analysis. Treat it
489
+ as a read-only variable.
451
490
  */
452
- int DLLEXPORT EN_runQ(EN_Project ph, long *currentTime);
491
+ int DLLEXPORT EN_runQ(EN_Project ph, long *out_currentTime);
453
492
 
454
493
  /**
455
494
  @brief Advances a water quality simulation over the time until the next hydraulic event.
456
495
  @param ph an EPANET project handle.
457
- @param[out] tStep time (in seconds) until the next hydraulic event or 0 if at the end
496
+ @param[out] out_tStep time (in seconds) until the next hydraulic event or 0 if at the end
458
497
  of the full simulation duration.
459
498
  @return an error code.
460
499
 
@@ -463,7 +502,7 @@ typedef struct Project *EN_Project;
463
502
  time step determined by when the next hydraulic event occurs. Use ::EN_stepQ instead
464
503
  if you wish to generate results over each water quality time step.
465
504
 
466
- The value of \b tStep is determined from information produced by the hydraulic analysis
505
+ The value of `out_tStep` is determined from information produced by the hydraulic analysis
467
506
  that preceded the water quality analysis. Treat it as a read-only variable.
468
507
 
469
508
  <b>Example:</b>
@@ -481,12 +520,12 @@ typedef struct Project *EN_Project;
481
520
  EN_closeQ(ph);
482
521
  \endcode
483
522
  */
484
- int DLLEXPORT EN_nextQ(EN_Project ph, long *tStep);
523
+ int DLLEXPORT EN_nextQ(EN_Project ph, long *out_tStep);
485
524
 
486
525
  /**
487
526
  @brief Advances a water quality simulation by a single water quality time step.
488
527
  @param ph an EPANET project handle.
489
- @param[out] timeLeft time left (in seconds) to the overall simulation duration.
528
+ @param[out] out_timeLeft time left (in seconds) to the overall simulation duration.
490
529
  @return an error code.
491
530
 
492
531
  This function is used in a loop with ::EN_runQ to perform an extended period water
@@ -494,10 +533,10 @@ typedef struct Project *EN_Project;
494
533
  quality time step of the simulation, rather than over each hydraulic event period
495
534
  as with ::EN_nextQ.
496
535
 
497
- Use the argument \b timeLeft to determine when no more calls to ::EN_runQ are needed
498
- because the end of the simulation period has been reached (i.e., when \b timeLeft = 0).
536
+ Use the argument `out_timeLeft` to determine when no more calls to ::EN_runQ are needed
537
+ because the end of the simulation period has been reached (i.e., when `out_timeLeft` = 0).
499
538
  */
500
- int DLLEXPORT EN_stepQ(EN_Project ph, long *timeLeft);
539
+ int DLLEXPORT EN_stepQ(EN_Project ph, long *out_timeLeft);
501
540
 
502
541
  /**
503
542
  @brief Closes the water quality solver, freeing all of its allocated memory.
@@ -511,19 +550,54 @@ typedef struct Project *EN_Project;
511
550
  */
512
551
  int DLLEXPORT EN_closeQ(EN_Project ph);
513
552
 
514
- /********************************************************************
553
+ /*===================================================================
515
554
 
516
555
  Reporting Functions
517
556
 
518
- ********************************************************************/
557
+ ===================================================================*/
558
+
559
+ /**
560
+ @brief Sets a user-supplied callback function for reporting
561
+ @param ph an EPANET project handle.
562
+ @param callback a function pointer used for reporting.
563
+ @return an error code.
564
+
565
+ The callback function replaces the project's report file as
566
+ the destination for all output written by ::EN_writeline. It must have
567
+ the following signature:
568
+
569
+ `void(void *userData, void *EN_projectHandle p, const char* s)`
570
+
571
+ The `userData` parameter is a pointer to a client-side data object.
572
+ It can be changed using the ::EN_setreportcallbackuserdata function.
573
+ The parameter `s` is a placeholder for the EPANET-generated string
574
+ that was passed into ::EN_writeline. Setting the callback function to
575
+ NULL reverts to having ::EN_writeline use the project's report file.
576
+ */
577
+ int DLLEXPORT EN_setreportcallback(EN_Project ph, void(*callback)(void *userData, void *EN_projectHandle, const char*));
578
+
579
+ /**
580
+ @brief Sets a pointer to a client-side data object
581
+ @param ph an EPANET project handle.
582
+ @param userData a pointer to a client-side data object.
583
+ @return an error code.
584
+
585
+ The data pointer supplied by this function is passed into the callback
586
+ function declared in ::EN_setreportcallback that replaces a project's
587
+ report file as the destination for output written with ::EN_writeline.
588
+ */
589
+ int DLLEXPORT EN_setreportcallbackuserdata(EN_Project ph, void *userData);
519
590
 
520
591
  /**
521
592
  @brief Writes a line of text to a project's report file.
522
593
  @param ph an EPANET project handle.
523
594
  @param line a text string to write.
524
595
  @return an error code.
596
+
597
+ ::EN_setreportcallback can be used to assign an alternative destination
598
+ to write `line` to in place of the project's report file.
525
599
  */
526
- int DLLEXPORT EN_writeline(EN_Project ph, char *line);
600
+ int DLLEXPORT EN_writeline(EN_Project ph, const char *line);
527
601
 
528
602
  /**
529
603
  @brief Writes simulation results in a tabular format to a project's report file.
@@ -548,7 +622,7 @@ typedef struct Project *EN_Project;
548
622
  This function allows toolkit clients to retrieve the contents of a project's
549
623
  report file while the project is still open.
550
624
  */
551
- int DLLEXPORT EN_copyreport(EN_Project ph, char *filename);
625
+ int DLLEXPORT EN_copyreport(EN_Project ph, const char *filename);
552
626
 
553
627
  /**
554
628
  @brief Clears the contents of a project's report file.
@@ -586,7 +660,7 @@ typedef struct Project *EN_Project;
586
660
  Formatted results of a simulation can be written to a project's report file
587
661
  using the ::EN_report function.
588
662
  */
589
- int DLLEXPORT EN_setreport(EN_Project ph, char *format);
663
+ int DLLEXPORT EN_setreport(EN_Project ph, const char *format);
590
664
 
591
665
  /**
592
666
  @brief Sets the level of hydraulic status reporting.
@@ -596,27 +670,27 @@ typedef struct Project *EN_Project;
596
670
 
597
671
  Status reporting writes changes in the hydraulics status of network elements to a
598
672
  project's report file as a hydraulic simulation unfolds. There are three levels
599
- of reporting: \b EN_NO_REPORT (no status reporting), \b EN_NORMAL_REPORT (normal
600
- reporting) \b EN_FULL_REPORT (full status reporting).
673
+ of reporting: `EN_NO_REPORT` (no status reporting), `EN_NORMAL_REPORT` (normal
674
+ reporting) `EN_FULL_REPORT` (full status reporting).
601
675
 
602
676
  The full status report contains information at each trial of the solution to the
603
677
  system hydraulic equations at each time step of a simulation. It is useful mainly
604
678
  for debugging purposes.
605
679
 
606
680
  If many hydraulic analyses will be run in the application it is recommended that
607
- status reporting be turned off (<b>level = EN_NO_REPORT</b>).
681
+ status reporting be turned off (`level` = `EN_NO_REPORT`).
608
682
  */
609
683
  int DLLEXPORT EN_setstatusreport(EN_Project ph, int level);
610
684
 
611
685
  /**
612
686
  @brief Retrieves the toolkit API version number.
613
- @param[out] version the version of the OWA-EPANET toolkit.
687
+ @param[out] out_version the version of the OWA-EPANET toolkit.
614
688
  @return an error code.
615
689
 
616
690
  The version number is to be interpreted with implied decimals, i.e.,
617
691
  "20100" == "2(.)01(.)00"
618
692
  */
619
- int DLLEXPORT EN_getversion(int *version);
693
+ int DLLEXPORT EN_getversion(int *out_version);
620
694
 
621
695
  /**
622
696
  @brief Returns the text of an error message generated by an error code.
@@ -625,7 +699,7 @@ typedef struct Project *EN_Project;
625
699
  @param maxLen maximum number of characters that errmsg can hold
626
700
  @return an error code
627
701
 
628
- Error message strings should be at least @ref EN_SizeLimits "EN_MAXMSG" characters in length.
702
+ Error message strings should be greater than @ref EN_SizeLimits "EN_MAXMSG" characters in length.
629
703
  */
630
704
  int DLLEXPORT EN_geterror(int errcode, char *out_errmsg, int maxLen);
631
705
 
@@ -633,17 +707,27 @@ typedef struct Project *EN_Project;
633
707
  @brief Retrieves a particular simulation statistic.
634
708
  @param ph an EPANET project handle.
635
709
  @param type the type of statistic to retrieve (see @ref EN_AnalysisStatistic).
636
- @param[out] value the value of the statistic.
710
+ @param[out] out_value the value of the statistic.
637
711
  @return an error code
638
712
  */
639
- int DLLEXPORT EN_getstatistic(EN_Project ph, int type, double* value);
713
+ int DLLEXPORT EN_getstatistic(EN_Project ph, int type, double* out_value);
714
+
715
+
716
+ /**
717
+ @brief Gets information about when the next hydraulic time step occurs.
718
+ @param ph an EPANET project handle.
719
+ @param[out] eventType the type of event that will occur (see @ref EN_TimestepEvent).
720
+ @param[out] duration the amount of time in the future this event will occur
721
+ @param[out] elementIndex the index of the element causing the event.
722
+ **/
723
+ int DLLEXPORT EN_timetonextevent(EN_Project ph, int *eventType, long *duration, int *elementIndex);
640
724
 
641
725
  /**
642
726
  @brief Retrieves the order in which a node or link appears in an @ref OutFile "output file".
643
727
  @param ph an EPANET project handle.
644
728
  @param type a type of element (either @ref EN_NODE or @ref EN_LINK).
645
729
  @param index the element's current index (starting from 1).
646
- @param[out] value the order in which the element's results were written to file.
730
+ @param[out] out_value the order in which the element's results were written to file.
647
731
  @return an error code.
648
732
 
649
733
  If the element does not appear in the file then its result index is 0.
@@ -652,25 +736,25 @@ typedef struct Project *EN_Project;
652
736
  after the order of nodes or links in a network's database has been changed due to editing
653
737
  operations.
654
738
  */
655
- int DLLEXPORT EN_getresultindex(EN_Project ph, int type, int index, int *value);
739
+ int DLLEXPORT EN_getresultindex(EN_Project ph, int type, int index, int *out_value);
656
740
 
657
- /********************************************************************
741
+ /*===================================================================
658
742
 
659
743
  Analysis Options Functions
660
744
 
661
- ********************************************************************/
745
+ ===================================================================*/
662
746
 
663
747
  /**
664
748
  @brief Retrieves the value of an analysis option.
665
749
  @param ph an EPANET project handle.
666
750
  @param option a type of analysis option (see @ref EN_Option).
667
- @param[out] value the current value of the option.
751
+ @param[out] out_value the current value of the option.
668
752
  @return an error code
669
753
  */
670
- int DLLEXPORT EN_getoption(EN_Project ph, int option, double *value);
754
+ int DLLEXPORT EN_getoption(EN_Project ph, int option, double *out_value);
671
755
 
672
756
  /**
673
- @brief Sets the value for an anlysis option.
757
+ @brief Sets the value for an analysis option.
674
758
  @param ph an EPANET project handle.
675
759
  @param option a type of analysis option (see @ref EN_Option).
676
760
  @param value the new value assigned to the option.
@@ -682,13 +766,13 @@ typedef struct Project *EN_Project;
682
766
  /**
683
767
  @brief Retrieves a project's flow units.
684
768
  @param ph an EPANET project handle.
685
- @param[out] units a flow units code (see @ref EN_FlowUnits)
769
+ @param[out] out_units a flow units code (see @ref EN_FlowUnits)
686
770
  @return an error code.
687
771
 
688
772
  Flow units in liters or cubic meters implies that SI metric units are used for all
689
773
  other quantities in addition to flow. Otherwise US Customary units are employed.
690
774
  */
691
- int DLLEXPORT EN_getflowunits(EN_Project ph, int *units);
775
+ int DLLEXPORT EN_getflowunits(EN_Project ph, int *out_units);
692
776
 
693
777
  /**
694
778
  @brief Sets a project's flow units.
@@ -705,10 +789,10 @@ typedef struct Project *EN_Project;
705
789
  @brief Retrieves the value of a time parameter.
706
790
  @param ph an EPANET project handle.
707
791
  @param param a time parameter code (see @ref EN_TimeParameter).
708
- @param[out] value the current value of the time parameter (in seconds).
792
+ @param[out] out_value the current value of the time parameter (in seconds).
709
793
  @return an error code.
710
794
  */
711
- int DLLEXPORT EN_gettimeparam(EN_Project ph, int param, long *value);
795
+ int DLLEXPORT EN_gettimeparam(EN_Project ph, int param, long *out_value);
712
796
 
713
797
  /**
714
798
  @brief Sets the value of a time parameter.
@@ -722,23 +806,23 @@ typedef struct Project *EN_Project;
722
806
  /**
723
807
  @brief Gets information about the type of water quality analysis requested.
724
808
  @param ph an EPANET project handle.
725
- @param[out] qualType type of analysis to run (see @ref EN_QualityType).
809
+ @param[out] out_qualType type of analysis to run (see @ref EN_QualityType).
726
810
  @param[out] out_chemName name of chemical constituent.
727
811
  @param[out] out_chemUnits concentration units of the constituent.
728
- @param[out] traceNode index of the node being traced (if applicable).
812
+ @param[out] out_traceNode index of the node being traced (if applicable).
729
813
  @return an error code.
730
814
  */
731
- int DLLEXPORT EN_getqualinfo(EN_Project ph, int *qualType, char *out_chemName,
732
- char *out_chemUnits, int *traceNode);
815
+ int DLLEXPORT EN_getqualinfo(EN_Project ph, int *out_qualType, char *out_chemName,
816
+ char *out_chemUnits, int *out_traceNode);
733
817
 
734
818
  /**
735
819
  @brief Retrieves the type of water quality analysis to be run.
736
820
  @param ph an EPANET project handle.
737
- @param[out] qualType the type of analysis to run (see @ref EN_QualityType).
738
- @param[out] traceNode the index of node being traced, if <b>qualType = EN_TRACE</b>.
821
+ @param[out] out_qualType the type of analysis to run (see @ref EN_QualityType).
822
+ @param[out] out_traceNode the index of node being traced if `out_qualType` = `EN_TRACE`.
739
823
  @return an error code.
740
824
  */
741
- int DLLEXPORT EN_getqualtype(EN_Project ph, int *qualType, int *traceNode);
825
+ int DLLEXPORT EN_getqualtype(EN_Project ph, int *out_qualType, int *out_traceNode);
742
826
 
743
827
  /**
744
828
  @brief Sets the type of water quality analysis to run.
@@ -746,7 +830,7 @@ typedef struct Project *EN_Project;
746
830
  @param qualType the type of analysis to run (see @ref EN_QualityType).
747
831
  @param chemName the name of the quality constituent.
748
832
  @param chemUnits the concentration units of the constituent.
749
- @param traceNode the ID name of the node being traced if <b>qualType = EN_TRACE</b>.
833
+ @param traceNode the ID name of the node being traced if `qualType` = `EN_TRACE`.
750
834
  @return an error code.
751
835
 
752
836
  Chemical name and units can be an empty string if the analysis is not for a chemical.
@@ -754,26 +838,26 @@ typedef struct Project *EN_Project;
754
838
 
755
839
  Note that the trace node is specified by ID name and not by index.
756
840
  */
757
- int DLLEXPORT EN_setqualtype(EN_Project ph, int qualType, char *chemName,
758
- char *chemUnits, char *traceNode);
841
+ int DLLEXPORT EN_setqualtype(EN_Project ph, int qualType, const char *chemName,
842
+ const char *chemUnits, const char *traceNode);
759
843
 
760
- /********************************************************************
844
+ /*===================================================================
761
845
 
762
846
  Node Functions
763
847
 
764
- ********************************************************************/
848
+ ===================================================================*/
765
849
 
766
850
  /**
767
851
  @brief Adds a new node to a project.
768
852
  @param ph an EPANET project handle.
769
853
  @param id the ID name of the node to be added.
770
854
  @param nodeType the type of node being added (see @ref EN_NodeType)
771
- @param[out] index the index of the newly added node
855
+ @param[out] out_index the index of the newly added node
772
856
  @return an error code.
773
857
 
774
858
  When a new node is created all of its properties (see @ref EN_NodeProperty) are set to 0.
775
859
  */
776
- int DLLEXPORT EN_addnode(EN_Project ph, char *id, int nodeType, int *index);
860
+ int DLLEXPORT EN_addnode(EN_Project ph, const char *id, int nodeType, int *out_index);
777
861
 
778
862
  /**
779
863
  @brief Deletes a node from a project.
@@ -782,9 +866,9 @@ typedef struct Project *EN_Project;
782
866
  @param actionCode the action taken if any control contains the node and its links.
783
867
  @return an error code.
784
868
 
785
- If \b actionCode is \b EN_UNCONDITIONAL then the node, its incident links and all
869
+ If `actionCode` is `EN_UNCONDITIONAL` then the node, its incident links and all
786
870
  simple and rule-based controls that contain them are deleted. If set to
787
- \b EN_CONDITIONAL then the node is not deleted if it or its incident links appear
871
+ `EN_CONDITIONAL` then the node is not deleted if it or its incident links appear
788
872
  in any controls and error code 261 is returned.
789
873
 
790
874
  */
@@ -794,10 +878,10 @@ typedef struct Project *EN_Project;
794
878
  @brief Gets the index of a node given its ID name.
795
879
  @param ph an EPANET project handle.
796
880
  @param id a node ID name.
797
- @param[out] index the node's index (starting from 1).
881
+ @param[out] out_index the node's index (starting from 1).
798
882
  @return an error code
799
883
  */
800
- int DLLEXPORT EN_getnodeindex(EN_Project ph, char *id, int *index);
884
+ int DLLEXPORT EN_getnodeindex(EN_Project ph, const char *id, int *out_index);
801
885
 
802
886
  /**
803
887
  @brief Gets the ID name of a node given its index.
@@ -806,7 +890,7 @@ typedef struct Project *EN_Project;
806
890
  @param[out] out_id the node's ID name.
807
891
  @return an error code
808
892
 
809
- The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID" characters.
893
+ The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID+1" characters.
810
894
  */
811
895
  int DLLEXPORT EN_getnodeid(EN_Project ph, int index, char *out_id);
812
896
 
@@ -819,29 +903,43 @@ typedef struct Project *EN_Project;
819
903
 
820
904
  The ID name must not be longer than @ref EN_SizeLimits "EN_MAXID" characters.
821
905
  */
822
- int DLLEXPORT EN_setnodeid(EN_Project ph, int index, char *newid);
906
+ int DLLEXPORT EN_setnodeid(EN_Project ph, int index, const char *newid);
823
907
 
824
908
  /**
825
909
  @brief Retrieves a node's type given its index.
826
910
  @param ph an EPANET project handle.
827
911
  @param index a node's index (starting from 1).
828
- @param[out] nodeType the node's type (see @ref EN_NodeType).
912
+ @param[out] out_nodeType the node's type (see @ref EN_NodeType).
829
913
  @return an error code.
830
914
  */
831
- int DLLEXPORT EN_getnodetype(EN_Project ph, int index, int *nodeType);
915
+ int DLLEXPORT EN_getnodetype(EN_Project ph, int index, int *out_nodeType);
832
916
 
833
917
  /**
834
918
  @brief Retrieves a property value for a node.
835
919
  @param ph an EPANET project handle.
836
920
  @param index a node's index.
837
921
  @param property the property to retrieve (see @ref EN_NodeProperty).
838
- @param[out] value the current value of the property.
922
+ @param[out] out_value the current value of the property.
923
+ @return an error code.
924
+
925
+ Values are returned in units that depend on the units used for flow rate
926
+ (see @ref Units).
927
+ */
928
+
929
+ int DLLEXPORT EN_getnodevalue(EN_Project ph, int index, int property, double *out_value);
930
+
931
+ /**
932
+ @brief Retrieves an array of property values for all nodes.
933
+ @param ph an EPANET project handle.
934
+ @param property the property to retrieve (see @ref EN_NodeProperty).
935
+ @param[out] out_values an array of values for all nodes.
839
936
  @return an error code.
840
937
 
841
938
  Values are returned in units that depend on the units used for flow rate
842
939
  (see @ref Units).
843
940
  */
844
- int DLLEXPORT EN_getnodevalue(EN_Project ph, int index, int property, double *value);
941
+
942
+ int DLLEXPORT EN_getnodevalues(EN_Project ph, int property, double *out_values);
845
943
 
846
944
  /**
847
945
  @brief Sets a property value for a node.
@@ -867,7 +965,7 @@ typedef struct Project *EN_Project;
867
965
  These properties have units that depend on the units used for flow rate (see @ref Units).
868
966
  */
869
967
  int DLLEXPORT EN_setjuncdata(EN_Project ph, int index, double elev, double dmnd,
870
- char *dmndpat);
968
+ const char *dmndpat);
871
969
 
872
970
  /**
873
971
  @brief Sets a group of properties for a tank node.
@@ -885,17 +983,17 @@ typedef struct Project *EN_Project;
885
983
  These properties have units that depend on the units used for flow rate (see @ref Units).
886
984
  */
887
985
  int DLLEXPORT EN_settankdata(EN_Project ph, int index, double elev, double initlvl,
888
- double minlvl, double maxlvl, double diam, double minvol, char *volcurve);
986
+ double minlvl, double maxlvl, double diam, double minvol, const char *volcurve);
889
987
 
890
988
  /**
891
989
  @brief Gets the (x,y) coordinates of a node.
892
990
  @param ph an EPANET project handle.
893
991
  @param index a node index (starting from 1).
894
- @param[out] x the node's X-coordinate value.
895
- @param[out] y the node's Y-coordinate value.
992
+ @param[out] out_x the node's X-coordinate value.
993
+ @param[out] out_y the node's Y-coordinate value.
896
994
  @return an error code.
897
995
  */
898
- int DLLEXPORT EN_getcoord(EN_Project ph, int index, double *x, double *y);
996
+ int DLLEXPORT EN_getcoord(EN_Project ph, int index, double *out_x, double *out_y);
899
997
 
900
998
  /**
901
999
  @brief Sets the (x,y) coordinates of a node.
@@ -907,25 +1005,25 @@ typedef struct Project *EN_Project;
907
1005
  */
908
1006
  int DLLEXPORT EN_setcoord(EN_Project ph, int index, double x, double y);
909
1007
 
910
- /********************************************************************
1008
+ /*===================================================================
911
1009
 
912
1010
  Nodal Demand Functions
913
1011
 
914
- ********************************************************************/
1012
+ ===================================================================*/
915
1013
 
916
1014
  /**
917
1015
  @brief Retrieves the type of demand model in use and its parameters.
918
1016
  @param ph an EPANET project handle.
919
- @param[out] type Type of demand model (see @ref EN_DemandModel).
920
- @param[out] pmin Pressure below which there is no demand.
921
- @param[out] preq Pressure required to deliver full demand.
922
- @param[out] pexp Pressure exponent in demand function.
1017
+ @param[out] out_type Type of demand model (see @ref EN_DemandModel).
1018
+ @param[out] out_pmin Pressure below which there is no demand.
1019
+ @param[out] out_preq Pressure required to deliver full demand.
1020
+ @param[out] out_pexp Pressure exponent in demand function.
923
1021
  @return an error code.
924
1022
 
925
- Parameters <b>pmin, preq,</b> and \b pexp are only used when the demand model is \b EN_PDA.
1023
+ Parameters `out_pmin`, `out_preq`, and `out_pexp` are only used when the demand model is `EN_PDA`.
926
1024
  */
927
- int DLLEXPORT EN_getdemandmodel(EN_Project ph, int *type, double *pmin,
928
- double *preq, double *pexp);
1025
+ int DLLEXPORT EN_getdemandmodel(EN_Project ph, int *out_type, double *out_pmin,
1026
+ double *out_preq, double *out_pexp);
929
1027
 
930
1028
  /**
931
1029
  @brief Sets the type of demand model to use and its parameters.
@@ -936,15 +1034,13 @@ typedef struct Project *EN_Project;
936
1034
  @param pexp Pressure exponent in demand function.
937
1035
  @return an error code.
938
1036
 
939
- Set \b type to \b EN_DDA for a traditional demand driven analysis (in which case the
940
- remaining three parameter values are ignored) or to \b EN_PDA for a pressure driven
941
- analysis. In the latter case a node's demand is computed as:
942
- > `Dfull * [ (P - pmin) / (preq - pmin) ] ^ pexp`
1037
+ Set `type` to `EN_DDA` for a traditional demand driven analysis (in which case the
1038
+ remaining three parameter values are ignored) or to `EN_PDA` for a pressure driven
1039
+ analysis. In the latter case a node's demand is 0 when pressure is below `pmin`, is at full demand when pressure is above `preq`, or is otherwise computed as:\n
1040
+ `Dfull * [ (P - pmin) / (preq - pmin) ] ^ pexp`\n
943
1041
  where `Dfull` is the full demand and `P` is the current pressure.
944
1042
 
945
- Setting \b preq equal to \b pmin will result in a solution with the smallest amount of
946
- demand reductions needed to insure that no node delivers positive demand at a pressure
947
- below \b pmin.
1043
+ A valid value for `preq` must be at least 0.1 pressure units larger than `pmin`.
948
1044
  */
949
1045
  int DLLEXPORT EN_setdemandmodel(EN_Project ph, int type, double pmin,
950
1046
  double preq, double pexp);
@@ -963,7 +1059,7 @@ typedef struct Project *EN_Project;
963
1059
  that no time pattern or category name is associated with the demand.
964
1060
  */
965
1061
  int DLLEXPORT EN_adddemand(EN_Project ph, int nodeIndex, double baseDemand,
966
- char *demandPattern, char *demandName);
1062
+ const char *demandPattern, const char *demandName);
967
1063
 
968
1064
  /**
969
1065
  @brief deletes a demand from a junction node.
@@ -979,31 +1075,31 @@ typedef struct Project *EN_Project;
979
1075
  @param ph an EPANET project handle.
980
1076
  @param nodeIndex the index of a node (starting from 1)
981
1077
  @param demandName the name of a demand category for the node
982
- @param[out] demandIndex the index of the demand being sought
1078
+ @param[out] out_demandIndex the index of the demand being sought
983
1079
  @return an error code
984
1080
  */
985
- int DLLEXPORT EN_getdemandindex(EN_Project ph, int nodeIndex, char *demandName,
986
- int *demandIndex);
1081
+ int DLLEXPORT EN_getdemandindex(EN_Project ph, int nodeIndex, const char *demandName,
1082
+ int *out_demandIndex);
987
1083
 
988
1084
  /**
989
1085
  @brief Retrieves the number of demand categories for a junction node.
990
1086
  @param ph an EPANET project handle.
991
1087
  @param nodeIndex the index of a node (starting from 1).
992
- @param[out] numDemands the number of demand categories assigned to the node.
1088
+ @param[out] out_numDemands the number of demand categories assigned to the node.
993
1089
  @return an error code.
994
1090
  */
995
- int DLLEXPORT EN_getnumdemands(EN_Project ph, int nodeIndex, int *numDemands);
1091
+ int DLLEXPORT EN_getnumdemands(EN_Project ph, int nodeIndex, int *out_numDemands);
996
1092
 
997
1093
  /**
998
1094
  @brief Gets the base demand for one of a node's demand categories.
999
1095
  @param ph an EPANET project handle.
1000
1096
  @param nodeIndex a node's index (starting from 1).
1001
1097
  @param demandIndex the index of a demand category for the node (starting from 1).
1002
- @param[out] baseDemand the category's base demand.
1098
+ @param[out] out_baseDemand the category's base demand.
1003
1099
  @return an error code.
1004
1100
  */
1005
1101
  int DLLEXPORT EN_getbasedemand(EN_Project ph, int nodeIndex, int demandIndex,
1006
- double *baseDemand);
1102
+ double *out_baseDemand);
1007
1103
 
1008
1104
  /**
1009
1105
  @brief Sets the base demand for one of a node's demand categories.
@@ -1021,14 +1117,14 @@ typedef struct Project *EN_Project;
1021
1117
  @param ph an EPANET project handle.
1022
1118
  @param nodeIndex the node's index (starting from 1).
1023
1119
  @param demandIndex the index of a demand category for the node (starting from 1).
1024
- @param[out] patIndex the index of the category's time pattern.
1120
+ @param[out] out_patIndex the index of the category's time pattern.
1025
1121
  @return an error code.
1026
1122
 
1027
1123
  A returned pattern index of 0 indicates that no time pattern has been assigned to the
1028
1124
  demand category.
1029
1125
  */
1030
1126
  int DLLEXPORT EN_getdemandpattern(EN_Project ph, int nodeIndex, int demandIndex,
1031
- int *patIndex);
1127
+ int *out_patIndex);
1032
1128
 
1033
1129
  /**
1034
1130
  @brief Sets the index of a time pattern used for one of a node's demand categories.
@@ -1051,7 +1147,7 @@ typedef struct Project *EN_Project;
1051
1147
  @param[out] out_demandName The name of the selected category.
1052
1148
  @return an error code.
1053
1149
 
1054
- \b demandName must be sized to contain at least @ref EN_SizeLimits "EN_MAXID" characters.
1150
+ `out_demandName` must be sized to contain at least @ref EN_SizeLimits "EN_MAXID+1" characters.
1055
1151
  */
1056
1152
  int DLLEXPORT EN_getdemandname(EN_Project ph, int nodeIndex, int demandIndex, char *out_demandName);
1057
1153
 
@@ -1061,17 +1157,18 @@ typedef struct Project *EN_Project;
1061
1157
  @param nodeIndex a node's index (starting from 1).
1062
1158
  @param demandIdx the index of one of the node's demand categories (starting from 1).
1063
1159
  @param demandName the new name assigned to the category.
1064
- @return Error code.
1160
+ @return an error code.
1065
1161
 
1066
1162
  The category name must contain no more than @ref EN_SizeLimits "EN_MAXID" characters.
1067
1163
  */
1068
- int DLLEXPORT EN_setdemandname(EN_Project ph, int nodeIndex, int demandIdx, char *demandName);
1164
+ int DLLEXPORT EN_setdemandname(EN_Project ph, int nodeIndex, int demandIdx,
1165
+ const char *demandName);
1069
1166
 
1070
- /********************************************************************
1167
+ /*===================================================================
1071
1168
 
1072
1169
  Link Functions
1073
1170
 
1074
- ********************************************************************/
1171
+ ===================================================================*/
1075
1172
 
1076
1173
  /**
1077
1174
  @brief Adds a new link to a project.
@@ -1080,7 +1177,7 @@ typedef struct Project *EN_Project;
1080
1177
  @param linkType The type of link being added (see @ref EN_LinkType)
1081
1178
  @param fromNode The ID name of the link's starting node.
1082
1179
  @param toNode The ID name of the link's ending node.
1083
- @param[out] index the index of the newly added link.
1180
+ @param[out] out_index the index of the newly added link.
1084
1181
  @return an error code.
1085
1182
 
1086
1183
  A new pipe is assigned a diameter of 10 inches (254 mm) and a length of 330
@@ -1091,15 +1188,15 @@ typedef struct Project *EN_Project;
1091
1188
 
1092
1189
  All other pipe properties are set to 0.
1093
1190
 
1094
- A new pump has a status of \b EN_OPEN, a speed setting of 1, and has no pump
1191
+ A new pump has a status of `EN_OPEN`, a speed setting of 1, and has no pump
1095
1192
  curve or power rating assigned to it.
1096
1193
 
1097
1194
  A new valve has a diameter of 10 inches (254 mm) and all other properties set to 0.
1098
1195
 
1099
1196
  See @ref EN_LinkProperty.
1100
1197
  */
1101
- int DLLEXPORT EN_addlink(EN_Project ph, char *id, int linkType, char *fromNode,
1102
- char *toNode, int *index);
1198
+ int DLLEXPORT EN_addlink(EN_Project ph, const char *id, int linkType, const char *fromNode,
1199
+ const char *toNode, int *out_index);
1103
1200
 
1104
1201
  /**
1105
1202
  @brief Deletes a link from the project.
@@ -1108,8 +1205,8 @@ typedef struct Project *EN_Project;
1108
1205
  @param actionCode The action taken if any control contains the link.
1109
1206
  @return an error code.
1110
1207
 
1111
- If \b actionCode is \b EN_UNCONDITIONAL then the link and all simple and rule-based
1112
- controls that contain it are deleted. If set to \b EN_CONDITIONAL then the link
1208
+ If `actionCode` is `EN_UNCONDITIONAL` then the link and all simple and rule-based
1209
+ controls that contain it are deleted. If set to `EN_CONDITIONAL` then the link
1113
1210
  is not deleted if it appears in any control and error 261 is returned.
1114
1211
  */
1115
1212
  int DLLEXPORT EN_deletelink(EN_Project ph, int index, int actionCode);
@@ -1118,10 +1215,10 @@ typedef struct Project *EN_Project;
1118
1215
  @brief Gets the index of a link given its ID name.
1119
1216
  @param ph an EPANET project handle.
1120
1217
  @param id a link's ID name.
1121
- @param[out] index the link's index (starting from 1).
1218
+ @param[out] out_index the link's index (starting from 1).
1122
1219
  @return an error code.
1123
1220
  */
1124
- int DLLEXPORT EN_getlinkindex(EN_Project ph, char *id, int *index);
1221
+ int DLLEXPORT EN_getlinkindex(EN_Project ph, const char *id, int *out_index);
1125
1222
 
1126
1223
  /**
1127
1224
  @brief Gets the ID name of a link given its index.
@@ -1130,7 +1227,7 @@ typedef struct Project *EN_Project;
1130
1227
  @param[out] out_id The link's ID name.
1131
1228
  @return an error code.
1132
1229
 
1133
- The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID" characters.
1230
+ The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID+1" characters.
1134
1231
  */
1135
1232
  int DLLEXPORT EN_getlinkid(EN_Project ph, int index, char *out_id);
1136
1233
 
@@ -1139,20 +1236,20 @@ typedef struct Project *EN_Project;
1139
1236
  @param ph an EPANET project handle.
1140
1237
  @param index a link's index (starting from 1).
1141
1238
  @param newid the new ID name for the link.
1142
- @return Error code.
1239
+ @return an error code.
1143
1240
 
1144
1241
  The ID name must not be longer than @ref EN_SizeLimits "EN_MAXID" characters.
1145
1242
  */
1146
- int DLLEXPORT EN_setlinkid(EN_Project ph, int index, char *newid);
1243
+ int DLLEXPORT EN_setlinkid(EN_Project ph, int index, const char *newid);
1147
1244
 
1148
1245
  /**
1149
1246
  @brief Retrieves a link's type.
1150
1247
  @param ph an EPANET project handle.
1151
1248
  @param index a link's index (starting from 1).
1152
- @param[out] linkType the link's type (see @ref EN_LinkType).
1249
+ @param[out] out_linkType the link's type (see @ref EN_LinkType).
1153
1250
  @return an error code.
1154
1251
  */
1155
- int DLLEXPORT EN_getlinktype(EN_Project ph, int index, int *linkType);
1252
+ int DLLEXPORT EN_getlinktype(EN_Project ph, int index, int *out_linkType);
1156
1253
 
1157
1254
  /**
1158
1255
  @brief Changes a link's type.
@@ -1162,10 +1259,12 @@ typedef struct Project *EN_Project;
1162
1259
  @param actionCode the action taken if any controls contain the link.
1163
1260
  @return an error code.
1164
1261
 
1165
- If \b actionCode is \b EN_UNCONDITIONAL then all simple and rule-based controls that
1262
+ If `actionCode` is `EN_UNCONDITIONAL` then all simple and rule-based controls that
1166
1263
  contain the link are deleted when the link's type is changed. If set to
1167
- \b EN_CONDITIONAL then the type change is cancelled if the link appears in any
1264
+ `EN_CONDITIONAL` then the type change is cancelled if the link appears in any
1168
1265
  control and error 261 is returned.
1266
+
1267
+ To only change a valve's type (such as from PRV to PSV) use ::EN_setlinkvalue with property `EN_VALVE_TYPE` whose value is selected from the valves in @ref EN_LinkType.
1169
1268
  */
1170
1269
  int DLLEXPORT EN_setlinktype(EN_Project ph, int *inout_index, int linkType, int actionCode);
1171
1270
 
@@ -1173,11 +1272,11 @@ typedef struct Project *EN_Project;
1173
1272
  @brief Gets the indexes of a link's start- and end-nodes.
1174
1273
  @param ph an EPANET project handle.
1175
1274
  @param index a link's index (starting from 1).
1176
- @param[out] node1 the index of the link's start node (starting from 1).
1177
- @param[out] node2 the index of the link's end node (starting from 1).
1275
+ @param[out] out_node1 the index of the link's start node (starting from 1).
1276
+ @param[out] out_node2 the index of the link's end node (starting from 1).
1178
1277
  @return an error code.
1179
1278
  */
1180
- int DLLEXPORT EN_getlinknodes(EN_Project ph, int index, int *node1, int *node2);
1279
+ int DLLEXPORT EN_getlinknodes(EN_Project ph, int index, int *out_node1, int *out_node2);
1181
1280
 
1182
1281
  /**
1183
1282
  @brief Sets the indexes of a link's start- and end-nodes.
@@ -1194,12 +1293,23 @@ typedef struct Project *EN_Project;
1194
1293
  @param ph an EPANET project handle.
1195
1294
  @param index a link's index (starting from 1).
1196
1295
  @param property the property to retrieve (see @ref EN_LinkProperty).
1197
- @param[out] value the current value of the property.
1296
+ @param[out] out_value the current value of the property.
1198
1297
  @return an error code.
1199
1298
 
1200
1299
  Values are returned in units that depend on the units used for flow rate (see @ref Units).
1201
1300
  */
1202
- int DLLEXPORT EN_getlinkvalue(EN_Project ph, int index, int property, double *value);
1301
+ int DLLEXPORT EN_getlinkvalue(EN_Project ph, int index, int property, double *out_value);
1302
+
1303
+ /**
1304
+ @brief Retrieves an array of property values for all links.
1305
+ @param ph an EPANET project handle.
1306
+ @param property the property to retrieve (see @ref EN_LinkProperty).
1307
+ @param[out] out_values an array of values for all links.
1308
+ @return an error code.
1309
+
1310
+ Values are returned in units that depend on the units used for flow rate (see @ref Units).
1311
+ */
1312
+ int DLLEXPORT EN_getlinkvalues(EN_Project ph, int property, double *out_values);
1203
1313
 
1204
1314
  /**
1205
1315
  @brief Sets a property value for a link.
@@ -1232,21 +1342,32 @@ typedef struct Project *EN_Project;
1232
1342
  @brief Retrieves the number of internal vertex points assigned to a link.
1233
1343
  @param ph an EPANET project handle.
1234
1344
  @param index a link's index (starting from 1).
1235
- @param[out] count the number of vertex points that describe the link's shape.
1345
+ @param[out] out_count the number of vertex points that describe the link's shape.
1236
1346
  @return an error code.
1237
1347
  */
1238
- int DLLEXPORT EN_getvertexcount(EN_Project ph, int index, int *count);
1348
+ int DLLEXPORT EN_getvertexcount(EN_Project ph, int index, int *out_count);
1239
1349
 
1240
1350
  /**
1241
- @brief Retrieves the coordinate's of a vertex point assigned to a link.
1351
+ @brief Retrieves the coordinates of a vertex point assigned to a link.
1242
1352
  @param ph an EPANET project handle.
1243
1353
  @param index a link's index (starting from 1).
1244
1354
  @param vertex a vertex point index (starting from 1).
1245
- @param[out] x the vertex's X-coordinate value.
1246
- @param[out] y the vertex's Y-coordinate value.
1355
+ @param[out] out_x the vertex's X-coordinate value.
1356
+ @param[out] out_y the vertex's Y-coordinate value.
1247
1357
  @return an error code.
1248
1358
  */
1249
- int DLLEXPORT EN_getvertex(EN_Project ph, int index, int vertex, double *x, double *y);
1359
+ int DLLEXPORT EN_getvertex(EN_Project ph, int index, int vertex, double *out_x, double *out_y);
1360
+
1361
+ /**
1362
+ @brief Sets the coordinates of a vertex point assigned to a link.
1363
+ @param ph an EPANET project handle.
1364
+ @param index a link's index (starting from 1).
1365
+ @param vertex a vertex point index (starting from 1).
1366
+ @param x the vertex's X-coordinate value.
1367
+ @param y the vertex's Y-coordinate value.
1368
+ @return an error code.
1369
+ */
1370
+ int DLLEXPORT EN_setvertex(EN_Project ph, int index, int vertex, double x, double y);
1250
1371
 
1251
1372
  /**
1252
1373
  @brief Assigns a set of internal vertex points to a link.
@@ -1261,29 +1382,29 @@ typedef struct Project *EN_Project;
1261
1382
  */
1262
1383
  int DLLEXPORT EN_setvertices(EN_Project ph, int index, double *x, double *y, int count);
1263
1384
 
1264
- /********************************************************************
1385
+ /*===================================================================
1265
1386
 
1266
1387
  Pump Functions
1267
1388
 
1268
- ********************************************************************/
1389
+ ===================================================================*/
1269
1390
 
1270
1391
  /**
1271
1392
  @brief Retrieves the type of head curve used by a pump.
1272
1393
  @param ph an EPANET project handle.
1273
1394
  @param linkIndex the index of a pump link (starting from 1).
1274
- @param[out] pumpType the type of head curve used by the pump (see @ref EN_PumpType).
1395
+ @param[out] out_pumpType the type of head curve used by the pump (see @ref EN_PumpType).
1275
1396
  @return an error code.
1276
1397
  */
1277
- int DLLEXPORT EN_getpumptype(EN_Project ph, int linkIndex, int *pumpType);
1398
+ int DLLEXPORT EN_getpumptype(EN_Project ph, int linkIndex, int *out_pumpType);
1278
1399
 
1279
1400
  /**
1280
1401
  @brief Retrieves the curve assigned to a pump's head curve.
1281
1402
  @param ph an EPANET project handle.
1282
1403
  @param linkIndex the index of a pump link (starting from 1).
1283
- @param[out] curveIndex the index of the curve assigned to the pump's head curve.
1404
+ @param[out] out_curveIndex the index of the curve assigned to the pump's head curve.
1284
1405
  @return an error code.
1285
1406
  */
1286
- int DLLEXPORT EN_getheadcurveindex(EN_Project ph, int linkIndex, int *curveIndex);
1407
+ int DLLEXPORT EN_getheadcurveindex(EN_Project ph, int linkIndex, int *out_curveIndex);
1287
1408
 
1288
1409
  /**
1289
1410
  @brief Assigns a curve to a pump's head curve.
@@ -1294,11 +1415,11 @@ typedef struct Project *EN_Project;
1294
1415
  */
1295
1416
  int DLLEXPORT EN_setheadcurveindex(EN_Project ph, int linkIndex, int curveIndex);
1296
1417
 
1297
- /********************************************************************
1418
+ /*===================================================================
1298
1419
 
1299
1420
  Time Pattern Functions
1300
1421
 
1301
- ********************************************************************/
1422
+ ===================================================================*/
1302
1423
 
1303
1424
  /**
1304
1425
  @brief Adds a new time pattern to a project.
@@ -1308,7 +1429,7 @@ typedef struct Project *EN_Project;
1308
1429
 
1309
1430
  The new pattern contains a single time period whose factor is 1.0.
1310
1431
  */
1311
- int DLLEXPORT EN_addpattern(EN_Project ph, char *id);
1432
+ int DLLEXPORT EN_addpattern(EN_Project ph, const char *id);
1312
1433
 
1313
1434
  /**
1314
1435
  @brief Deletes a time pattern from a project.
@@ -1322,10 +1443,10 @@ typedef struct Project *EN_Project;
1322
1443
  @brief Retrieves the index of a time pattern given its ID name.
1323
1444
  @param ph an EPANET project handle.
1324
1445
  @param id the ID name of a time pattern.
1325
- @param[out] index the time pattern's index (starting from 1).
1446
+ @param[out] out_index the time pattern's index (starting from 1).
1326
1447
  @return an error code.
1327
1448
  */
1328
- int DLLEXPORT EN_getpatternindex(EN_Project ph, char *id, int *index);
1449
+ int DLLEXPORT EN_getpatternindex(EN_Project ph, const char *id, int *out_index);
1329
1450
 
1330
1451
  /**
1331
1452
  @brief Retrieves the ID name of a time pattern given its index.
@@ -1334,7 +1455,7 @@ typedef struct Project *EN_Project;
1334
1455
  @param[out] out_id the time pattern's ID name.
1335
1456
  @return an error code.
1336
1457
 
1337
- The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID" characters.
1458
+ The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID+1" characters.
1338
1459
  */
1339
1460
  int DLLEXPORT EN_getpatternid(EN_Project ph, int index, char *out_id);
1340
1461
 
@@ -1347,26 +1468,26 @@ typedef struct Project *EN_Project;
1347
1468
 
1348
1469
  The new ID name must not exceed @ref EN_SizeLimits "EN_MAXID" characters.
1349
1470
  */
1350
- int DLLEXPORT EN_setpatternid(EN_Project ph, int index, char *id);
1471
+ int DLLEXPORT EN_setpatternid(EN_Project ph, int index, const char *id);
1351
1472
 
1352
1473
  /**
1353
1474
  @brief Retrieves the number of time periods in a time pattern.
1354
1475
  @param ph an EPANET project handle.
1355
1476
  @param index a time pattern index (starting from 1).
1356
- @param[out] len the number of time periods in the pattern.
1477
+ @param[out] out_len the number of time periods in the pattern.
1357
1478
  @return an error code.
1358
1479
  */
1359
- int DLLEXPORT EN_getpatternlen(EN_Project ph, int index, int *len);
1480
+ int DLLEXPORT EN_getpatternlen(EN_Project ph, int index, int *out_len);
1360
1481
 
1361
1482
  /**
1362
1483
  @brief Retrieves a time pattern's factor for a given time period.
1363
1484
  @param ph an EPANET project handle.
1364
1485
  @param index a time pattern index (starting from 1).
1365
1486
  @param period a time period in the pattern (starting from 1).
1366
- @param[out] value the pattern factor for the given time period.
1487
+ @param[out] out_value the pattern factor for the given time period.
1367
1488
  @return an error code.
1368
1489
  */
1369
- int DLLEXPORT EN_getpatternvalue(EN_Project ph, int index, int period, double *value);
1490
+ int DLLEXPORT EN_getpatternvalue(EN_Project ph, int index, int period, double *out_value);
1370
1491
 
1371
1492
  /**
1372
1493
  @brief Sets a time pattern's factor for a given time period.
@@ -1382,10 +1503,10 @@ typedef struct Project *EN_Project;
1382
1503
  @brief Retrieves the average of all pattern factors in a time pattern.
1383
1504
  @param ph an EPANET project handle.
1384
1505
  @param index a time pattern index (starting from 1).
1385
- @param[out] value The average of all of the time pattern's factors.
1506
+ @param[out] out_value The average of all of the time pattern's factors.
1386
1507
  @return an error code.
1387
1508
  */
1388
- int DLLEXPORT EN_getaveragepatternvalue(EN_Project ph, int index, double *value);
1509
+ int DLLEXPORT EN_getaveragepatternvalue(EN_Project ph, int index, double *out_value);
1389
1510
 
1390
1511
  /**
1391
1512
  @brief Sets the pattern factors for a given time pattern.
@@ -1395,18 +1516,27 @@ typedef struct Project *EN_Project;
1395
1516
  @param len the number of factor values supplied.
1396
1517
  @return an error code.
1397
1518
 
1398
- \b values is a zero-based array that contains \b len elements.
1519
+ `values` is a zero-based array that contains `len` elements.
1399
1520
 
1400
1521
  Use this function to redefine (and resize) a time pattern all at once;
1401
1522
  use @ref EN_setpatternvalue to revise pattern factors one at a time.
1402
1523
  */
1403
1524
  int DLLEXPORT EN_setpattern(EN_Project ph, int index, double *values, int len);
1525
+
1526
+ /**
1527
+ @brief Loads time patterns from a file into a project under a specific pattern ID.
1528
+ @param ph an EPANET project handle.
1529
+ @param filename the name of the file containing pattern data.
1530
+ @param id the ID name of the new pattern to load.
1531
+ @return an error code.
1532
+ */
1533
+ int DLLEXPORT EN_loadpatternfile(EN_Project ph, const char *filename, const char *id);
1404
1534
 
1405
- /********************************************************************
1535
+ /*===================================================================
1406
1536
 
1407
1537
  Data Curve Functions
1408
1538
 
1409
- ********************************************************************/
1539
+ ===================================================================*/
1410
1540
 
1411
1541
  /**
1412
1542
  @brief Adds a new data curve to a project.
@@ -1416,7 +1546,7 @@ typedef struct Project *EN_Project;
1416
1546
 
1417
1547
  The new curve contains a single data point (1.0, 1.0).
1418
1548
  */
1419
- int DLLEXPORT EN_addcurve(EN_Project ph, char *id);
1549
+ int DLLEXPORT EN_addcurve(EN_Project ph, const char *id);
1420
1550
 
1421
1551
  /**
1422
1552
  @brief Deletes a data curve from a project.
@@ -1430,10 +1560,10 @@ typedef struct Project *EN_Project;
1430
1560
  @brief Retrieves the index of a curve given its ID name.
1431
1561
  @param ph an EPANET project handle.
1432
1562
  @param id the ID name of a curve.
1433
- @param[out] index The curve's index (starting from 1).
1563
+ @param[out] out_index The curve's index (starting from 1).
1434
1564
  @return an error code.
1435
1565
  */
1436
- int DLLEXPORT EN_getcurveindex(EN_Project ph, char *id, int *index);
1566
+ int DLLEXPORT EN_getcurveindex(EN_Project ph, const char *id, int *out_index);
1437
1567
 
1438
1568
  /**
1439
1569
  @brief Retrieves the ID name of a curve given its index.
@@ -1442,7 +1572,7 @@ typedef struct Project *EN_Project;
1442
1572
  @param[out] out_id the curve's ID name.
1443
1573
  @return an error code.
1444
1574
 
1445
- The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID" characters.
1575
+ The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID+1" characters.
1446
1576
  */
1447
1577
  int DLLEXPORT EN_getcurveid(EN_Project ph, int index, char *out_id);
1448
1578
 
@@ -1455,37 +1585,46 @@ typedef struct Project *EN_Project;
1455
1585
 
1456
1586
  The new ID name must not exceed @ref EN_SizeLimits "EN_MAXID" characters.
1457
1587
  */
1458
- int DLLEXPORT EN_setcurveid(EN_Project ph, int index, char *id);
1588
+ int DLLEXPORT EN_setcurveid(EN_Project ph, int index, const char *id);
1459
1589
 
1460
1590
  /**
1461
1591
  @brief Retrieves the number of points in a curve.
1462
1592
  @param ph an EPANET project handle.
1463
1593
  @param index a curve's index (starting from 1).
1464
- @param[out] len The number of data points assigned to the curve.
1594
+ @param[out] out_len The number of data points assigned to the curve.
1465
1595
  @return an error code.
1466
1596
  */
1467
- int DLLEXPORT EN_getcurvelen(EN_Project ph, int index, int *len);
1597
+ int DLLEXPORT EN_getcurvelen(EN_Project ph, int index, int *out_len);
1468
1598
 
1469
1599
  /**
1470
1600
  @brief Retrieves a curve's type.
1471
1601
  @param ph an EPANET project handle.
1472
1602
  @param index a curve's index (starting from 1).
1473
- @param[out] type the curve's type (see @ref EN_CurveType).
1603
+ @param[out] out_type the curve's type (see @ref EN_CurveType).
1604
+ @return an error code.
1605
+ */
1606
+ int DLLEXPORT EN_getcurvetype(EN_Project ph, int index, int *out_type);
1607
+
1608
+ /**
1609
+ @brief Sets a curve's type.
1610
+ @param ph an EPANET project handle.
1611
+ @param index a curve's index (starting from 1).
1612
+ @param type the curve's type (see @ref EN_CurveType).
1474
1613
  @return an error code.
1475
1614
  */
1476
- int DLLEXPORT EN_getcurvetype(EN_Project ph, int index, int *type);
1615
+ int DLLEXPORT EN_setcurvetype(EN_Project ph, int index, int type);
1477
1616
 
1478
1617
  /**
1479
1618
  @brief Retrieves the value of a single data point for a curve.
1480
1619
  @param ph an EPANET project handle.
1481
1620
  @param curveIndex a curve's index (starting from 1).
1482
1621
  @param pointIndex the index of a point on the curve (starting from 1).
1483
- @param[out] x the point's x-value.
1484
- @param[out] y the point's y-value.
1622
+ @param[out] out_x the point's x-value.
1623
+ @param[out] out_y the point's y-value.
1485
1624
  @return an error code.
1486
1625
  */
1487
1626
  int DLLEXPORT EN_getcurvevalue(EN_Project ph, int curveIndex, int pointIndex,
1488
- double *x, double *y);
1627
+ double *out_x, double *out_y);
1489
1628
 
1490
1629
  /**
1491
1630
  @brief Sets the value of a single data point for a curve.
@@ -1504,17 +1643,17 @@ typedef struct Project *EN_Project;
1504
1643
  @param ph an EPANET project handle.
1505
1644
  @param index a curve's index (starting from 1).
1506
1645
  @param[out] out_id the curve's ID name.
1507
- @param[out] nPoints the number of data points on the curve.
1508
- @param[out] xValues the curve's x-values.
1509
- @param[out] yValues the curve's y-values.
1646
+ @param[out] out_nPoints the number of data points on the curve.
1647
+ @param[out] out_xValues the curve's x-values.
1648
+ @param[out] out_yValues the curve's y-values.
1510
1649
  @return an error code.
1511
1650
 
1512
- The calling program is responsible for making `xValues` and `yValues` large enough
1513
- to hold `nPoints` number of data points and for sizing `id` to hold at least
1514
- @ref EN_SizeLimits "EN_MAXID" characters.
1651
+ The calling program is responsible for making `out_xValues` and `out_yValues` large enough
1652
+ to hold `out_nPoints` number of data points and for sizing `out_id` to hold at least
1653
+ @ref EN_SizeLimits "EN_MAXID+1" characters.
1515
1654
  */
1516
- int DLLEXPORT EN_getcurve(EN_Project ph, int index, char *out_id, int *nPoints,
1517
- double *xValues, double *yValues);
1655
+ int DLLEXPORT EN_getcurve(EN_Project ph, int index, char *out_id, int *out_nPoints,
1656
+ double *out_xValues, double *out_yValues);
1518
1657
 
1519
1658
  /**
1520
1659
  @brief assigns a set of data points to a curve.
@@ -1525,7 +1664,7 @@ typedef struct Project *EN_Project;
1525
1664
  @param nPoints the new number of data points for the curve.
1526
1665
  @return an error code.
1527
1666
 
1528
- \b xValues and \b yValues are zero-based arrays that contains \b nPoints elements.
1667
+ `xValues` and `yValues` are zero-based arrays that contains `nPoints` elements.
1529
1668
 
1530
1669
  Use this function to redefine (and resize) a curve all at once;
1531
1670
  use @ref EN_setcurvevalue to revise a curve's data points one at a time.
@@ -1533,11 +1672,11 @@ typedef struct Project *EN_Project;
1533
1672
  int DLLEXPORT EN_setcurve(EN_Project ph, int index, double *xValues,
1534
1673
  double *yValues, int nPoints);
1535
1674
 
1536
- /********************************************************************
1675
+ /*===================================================================
1537
1676
 
1538
1677
  Simple Controls Functions
1539
1678
 
1540
- ********************************************************************/
1679
+ ===================================================================*/
1541
1680
 
1542
1681
  /**
1543
1682
  @brief Adds a new simple control to a project.
@@ -1546,14 +1685,14 @@ typedef struct Project *EN_Project;
1546
1685
  @param linkIndex the index of a link to control (starting from 1).
1547
1686
  @param setting control setting applied to the link.
1548
1687
  @param nodeIndex index of the node used to control the link
1549
- (0 for \b EN_TIMER and \b EN_TIMEOFDAY controls).
1688
+ (0 for `EN_TIMER` and `EN_TIMEOFDAY` controls).
1550
1689
  @param level action level (tank level, junction pressure, or time in seconds)
1551
1690
  that triggers the control.
1552
- @param[out] index index of the new control.
1691
+ @param[out] out_index index of the new control.
1553
1692
  @return an error code.
1554
1693
  */
1555
1694
  int DLLEXPORT EN_addcontrol(EN_Project ph, int type, int linkIndex,
1556
- double setting, int nodeIndex, double level, int *index);
1695
+ double setting, int nodeIndex, double level, int *out_index);
1557
1696
 
1558
1697
  /**
1559
1698
  @brief Deletes an existing simple control.
@@ -1567,17 +1706,17 @@ typedef struct Project *EN_Project;
1567
1706
  @brief Retrieves the properties of a simple control.
1568
1707
  @param ph an EPANET project handle.
1569
1708
  @param index the control's index (starting from 1).
1570
- @param[out] type the type of control (see @ref EN_ControlType).
1571
- @param[out] linkIndex the index of the link being controlled.
1572
- @param[out] setting the control setting applied to the link.
1573
- @param[out] nodeIndex the index of the node used to trigger the control
1574
- (0 for \b EN_TIMER and \b EN_TIMEOFDAY controls).
1575
- @param[out] level the action level (tank level, junction pressure, or time in seconds)
1709
+ @param[out] out_type the type of control (see @ref EN_ControlType).
1710
+ @param[out] out_linkIndex the index of the link being controlled.
1711
+ @param[out] out_setting the control setting applied to the link.
1712
+ @param[out] out_nodeIndex the index of the node used to trigger the control
1713
+ (0 for `EN_TIMER` and `EN_TIMEOFDAY` controls).
1714
+ @param[out] out_level the action level (tank level, junction pressure, or time in seconds)
1576
1715
  that triggers the control.
1577
1716
  @return an error code.
1578
1717
  */
1579
- int DLLEXPORT EN_getcontrol(EN_Project ph, int index, int *type, int *linkIndex,
1580
- double *setting, int *nodeIndex, double *level);
1718
+ int DLLEXPORT EN_getcontrol(EN_Project ph, int index, int *out_type, int *out_linkIndex,
1719
+ double *out_setting, int *out_nodeIndex, double *out_level);
1581
1720
 
1582
1721
  /**
1583
1722
  @brief Sets the properties of an existing simple control.
@@ -1587,7 +1726,7 @@ typedef struct Project *EN_Project;
1587
1726
  @param linkIndex the index of the link being controlled.
1588
1727
  @param setting the control setting applied to the link.
1589
1728
  @param nodeIndex the index of the node used to trigger the control
1590
- (0 for \b EN_TIMER and \b EN_TIMEOFDAY controls).
1729
+ (0 for `EN_TIMER` and `EN_TIMEOFDAY` controls).
1591
1730
  @param level the action level (tank level, junction pressure, or time in seconds)
1592
1731
  that triggers the control.
1593
1732
  @return an error code.
@@ -1595,12 +1734,29 @@ typedef struct Project *EN_Project;
1595
1734
  int DLLEXPORT EN_setcontrol(EN_Project ph, int index, int type, int linkIndex,
1596
1735
  double setting, int nodeIndex, double level);
1597
1736
 
1737
+ /**
1738
+ @brief Gets the enabled status of a simple control.
1739
+ @param ph an EPANET project handle.
1740
+ @param index the control's index (starting from 1).
1741
+ @param out_enabled `EN_TRUE` (= 1) if the control is enabled or `EN_FALSE` (= 0) if it is disabled.
1742
+ @return an error code.
1743
+ */
1744
+ int DLLEXPORT EN_getcontrolenabled(EN_Project ph, int index, int *out_enabled);
1598
1745
 
1599
- /********************************************************************
1746
+ /**
1747
+ @brief Sets the enabled status of a simple control.
1748
+ @param ph an EPANET project handle.
1749
+ @param index the control's index (starting from 1).
1750
+ @param enabled `EN_TRUE` (= 1) sets the control to enabled, `EN_FALSE` (= 0) sets it to disabled.
1751
+ @return an error code.
1752
+ */
1753
+ int DLLEXPORT EN_setcontrolenabled(EN_Project ph, int index, int enabled);
1754
+
1755
+ /*===================================================================
1600
1756
 
1601
1757
  Rule-Based Controls Functions
1602
1758
 
1603
- ********************************************************************/
1759
+ ===================================================================*/
1604
1760
 
1605
1761
  /**
1606
1762
  @brief Adds a new rule-based control to a project.
@@ -1625,23 +1781,23 @@ typedef struct Project *EN_Project;
1625
1781
  @brief Retrieves summary information about a rule-based control.
1626
1782
  @param ph an EPANET project handle.
1627
1783
  @param index the rule's index (starting from 1).
1628
- @param[out] nPremises number of premises in the rule's IF section.
1629
- @param[out] nThenActions number of actions in the rule's THEN section.
1630
- @param[out] nElseActions number of actions in the rule's ELSE section.
1631
- @param[out] priority the rule's priority value.
1784
+ @param[out] out_nPremises number of premises in the rule's IF section.
1785
+ @param[out] out_nThenActions number of actions in the rule's THEN section.
1786
+ @param[out] out_nElseActions number of actions in the rule's ELSE section.
1787
+ @param[out] out_priority the rule's priority value.
1632
1788
  @return an error code.
1633
1789
  */
1634
- int DLLEXPORT EN_getrule(EN_Project ph, int index, int *nPremises,
1635
- int *nThenActions, int *nElseActions, double *priority);
1790
+ int DLLEXPORT EN_getrule(EN_Project ph, int index, int *out_nPremises,
1791
+ int *out_nThenActions, int *out_nElseActions, double *out_priority);
1636
1792
 
1637
1793
  /**
1638
1794
  @brief Gets the ID name of a rule-based control given its index.
1639
1795
  @param ph an EPANET project handle.
1640
1796
  @param index the rule's index (starting from 1).
1641
1797
  @param[out] out_id the rule's ID name.
1642
- @return Error code.
1798
+ @return an error code.
1643
1799
 
1644
- The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID" characters.
1800
+ The ID name must be sized to hold at least @ref EN_SizeLimits "EN_MAXID+1" characters.
1645
1801
  */
1646
1802
  int DLLEXPORT EN_getruleID(EN_Project ph, int index, char *out_id);
1647
1803
 
@@ -1651,26 +1807,26 @@ typedef struct Project *EN_Project;
1651
1807
  @param ruleIndex the rule's index (starting from 1).
1652
1808
  @param premiseIndex the position of the premise in the rule's list of premises
1653
1809
  (starting from 1).
1654
- @param[out] logop the premise's logical operator ( \b IF = 1, \b AND = 2, \b OR = 3 ).
1655
- @param[out] object the type of object the premise refers to (see @ref EN_RuleObject).
1656
- @param[out] objIndex the index of the object (e.g. the index of a tank).
1657
- @param[out] variable the object's variable being compared (see @ref EN_RuleVariable).
1658
- @param[out] relop the premise's comparison operator (see @ref EN_RuleOperator).
1659
- @param[out] status the status that the object's status is compared to
1810
+ @param[out] out_logop the premise's logical operator (`IF` = 1, `AND` = 2, `OR` = 3` ).
1811
+ @param[out] out_object the type of object the premise refers to (see @ref EN_RuleObject).
1812
+ @param[out] out_objIndex the index of the object (e.g. the index of a tank).
1813
+ @param[out] out_variable the object's variable being compared (see @ref EN_RuleVariable).
1814
+ @param[out] out_relop the premise's comparison operator (see @ref EN_RuleOperator).
1815
+ @param[out] out_status the status that the object's status is compared to
1660
1816
  (see @ref EN_RuleStatus).
1661
- @param[out] value the value that the object's variable is compared to.
1817
+ @param[out] out_value the value that the object's variable is compared to.
1662
1818
  @return an error code.
1663
1819
  */
1664
1820
  int DLLEXPORT EN_getpremise(EN_Project ph, int ruleIndex, int premiseIndex,
1665
- int *logop, int *object, int *objIndex, int *variable,
1666
- int *relop, int *status, double *value);
1821
+ int *out_logop, int *out_object, int *out_objIndex, int *out_variable,
1822
+ int *out_relop, int *out_status, double *out_value);
1667
1823
 
1668
1824
  /**
1669
1825
  @brief Sets the properties of a premise in a rule-based control.
1670
1826
  @param ph an EPANET project handle.
1671
1827
  @param ruleIndex the rule's index (starting from 1).
1672
1828
  @param premiseIndex the position of the premise in the rule's list of premises.
1673
- @param logop the premise's logical operator ( \b IF = 1, \b AND = 2, \b OR = 3 ).
1829
+ @param logop the premise's logical operator (`IF` = 1, `AND` = 2, `OR` = 3 ).
1674
1830
  @param object the type of object the premise refers to (see @ref EN_RuleObject).
1675
1831
  @param objIndex the index of the object (e.g. the index of a tank).
1676
1832
  @param variable the object's variable being compared (see @ref EN_RuleVariable).
@@ -1723,13 +1879,13 @@ typedef struct Project *EN_Project;
1723
1879
  @param ph an EPANET project handle.
1724
1880
  @param ruleIndex the rule's index (starting from 1).
1725
1881
  @param actionIndex the index of the THEN action to retrieve (starting from 1).
1726
- @param[out] linkIndex the index of the link in the action (starting from 1).
1727
- @param[out] status the status assigned to the link (see @ref EN_RuleStatus)
1728
- @param[out] setting the value assigned to the link's setting.
1882
+ @param[out] out_linkIndex the index of the link in the action (starting from 1).
1883
+ @param[out] out_status the status assigned to the link (see @ref EN_RuleStatus)
1884
+ @param[out] out_setting the value assigned to the link's setting.
1729
1885
  @return an error code.
1730
1886
  */
1731
1887
  int DLLEXPORT EN_getthenaction(EN_Project ph, int ruleIndex, int actionIndex,
1732
- int *linkIndex, int *status, double *setting);
1888
+ int *out_linkIndex, int *out_status, double *out_setting);
1733
1889
 
1734
1890
  /**
1735
1891
  @brief Sets the properties of a THEN action in a rule-based control.
@@ -1749,13 +1905,13 @@ typedef struct Project *EN_Project;
1749
1905
  @param ph an EPANET project handle.
1750
1906
  @param ruleIndex the rule's index (starting from 1).
1751
1907
  @param actionIndex the index of the ELSE action to retrieve (starting from 1).
1752
- @param[out] linkIndex the index of the link in the action.
1753
- @param[out] status the status assigned to the link (see @ref EN_RuleStatus).
1754
- @param[out] setting the value assigned to the link's setting.
1908
+ @param[out] out_linkIndex the index of the link in the action.
1909
+ @param[out] out_status the status assigned to the link (see @ref EN_RuleStatus).
1910
+ @param[out] out_setting the value assigned to the link's setting.
1755
1911
  @return an error code.
1756
1912
  */
1757
1913
  int DLLEXPORT EN_getelseaction(EN_Project ph, int ruleIndex, int actionIndex,
1758
- int *linkIndex, int *status, double *setting);
1914
+ int *out_linkIndex, int *out_status, double *out_setting);
1759
1915
 
1760
1916
  /**
1761
1917
  @brief Sets the properties of an ELSE action in a rule-based control.
@@ -1779,6 +1935,24 @@ typedef struct Project *EN_Project;
1779
1935
  */
1780
1936
  int DLLEXPORT EN_setrulepriority(EN_Project ph, int index, double priority);
1781
1937
 
1938
+ /**
1939
+ @brief Gets the enabled status of a rule-based control.
1940
+ @param ph an EPANET project handle.
1941
+ @param index the rule's index (starting from 1).
1942
+ @param out_enabled the rule will be either EN_TRUE=enabled or EN_FALSE=disabled.
1943
+ @return an error code.
1944
+ */
1945
+ int DLLEXPORT EN_getruleenabled(EN_Project ph, int index, int *out_enabled);
1946
+
1947
+ /**
1948
+ @brief Sets the enabled status of a rule-based control.
1949
+ @param ph an EPANET project handle.
1950
+ @param index the rule's index (starting from 1).
1951
+ @param enabled set the rule to either EN_TRUE=enabled or EN_FALSE=disabled.
1952
+ @return an error code.
1953
+ */
1954
+ int DLLEXPORT EN_setruleenabled(EN_Project ph, int index, int enabled);
1955
+
1782
1956
  #if defined(__cplusplus)
1783
1957
  }
1784
1958
  #endif