Shuxia Ning
2025-01-07 5f51a2fe3461e1f88e75b0b6959719d25f657ef3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
//using System.Threading.Tasks;
 
namespace Yw.WinFrmUI.Q3d
{
    public class EpanetEnum
    {
        public enum NodeValueType
        {
            标高 = 0,  //  { Mode parameters }
            基本需水量 = 1,
            需水量模式 = 2,
            扩散器系数 = 3,
            初始物质浓度 = 4,
            输入物质浓度 = 5,
            浓度模式 = 6,
            水源类型 = 7,
            水池水位 = 8,
            需水量 = 9,
            绝对压力 = 10,
            自由压力 = 11,
            物质浓度 = 12,
            物质扩散浓度 = 13,
            初始容积 = 14,
            多物质混合模型 = 15,
            多物质混合容积 = 16,
        }
        public enum LinkValueType
        {
            管径 = 0,  // { Link parameters }
            管长 = 1,
            海森威廉系数 = 2,
            局部水头损失 = 3,
            初始状态 = 4,
            初始设置 = 5,
            水体反应系数 = 6,
            管壁反应系数 = 7,
            流量 = 8,
            流速 = 9,
            水损 = 10,
            状态 = 11,
            设置 = 12,
            功率 = 13,
        }
 
        public enum TimeParameter
        {
            /// <summary>0 - Simulation duration</summary>
            Duration = 0,
 
            /// <summary>1 - Hydraulic time step</summary>
            HydStep = 1,
 
            /// <summary>2 - Water quality time step</summary>
            QualStep = 2,
 
            /// <summary>3 - Time pattern time step</summary>
            PatternStep = 3,
 
            /// <summary>4 - Time pattern start time</summary>
            PatternStart = 4,
 
            /// <summary>5 - Reporting time step</summary>
            ReportStep = 5,
 
            /// <summary>6 - Report starting time</summary>
            ReportStart = 6,
 
            /// <summary>7 - Time step for evaluating rule-based controls</summary>
            RuleStep = 7,
 
            /// <summary>8 - Type of time series post-processing to use (see <see cref="TstatType" />)</summary>
            Statistic = 8,
 
            /// <summary>9 - Periods</summary>
            Periods = 9
        }
 
        /// <summary>Component counts.</summary>
        /// <remarks>
        ///     The number of junctions in a network equals the number of
        ///     nodes minus the number of tanks and reservoirs.
        /// </remarks>
        /// <remarks>
        ///     There is no facility within the Toolkit to add to or delete
        ///     from the components described in the Input file.
        /// </remarks>
        public enum CountType
        {
            /// <summary>0 - Nodes</summary>
            Node = 0,
 
            /// <summary>1 - Reservoirs and tank nodes</summary>
            Tank = 1,
 
            /// <summary>2 - Links</summary>
            Link = 2,
 
            /// <summary>3 - Time patterns</summary>
            Pattern = 3,
 
            /// <summary>4 - Curves</summary>
            Curve = 4,
 
            /// <summary>5 - Simple controls</summary>
            Control = 5
        }
 
        /// <summary>Node types</summary>
        public enum NodeType
        {
            /// <summary>0 - Junction node</summary>
            Junction = 0,
 
            /// <summary>1 - Reservoir node</summary>
            Reservoir = 1,
 
            /// <summary>2 - Tank node</summary>
            Tank = 2
        }
 
        /// <summary>Link types</summary>
        public enum LinkType
        {
            /// <summary>0 - pipe with check valve</summary>
            CVPipe = 0,
 
            /// <summary>1 - regular pipe</summary>
            Pipe = 1,
 
            /// <summary>2 - pump</summary>
            Pump = 2,
 
            /// <summary>3 - pressure reducing valve</summary>
            PRV = 3,
 
            /// <summary>4 - pressure sustaining valve</summary>
            PSV = 4,
 
            /// <summary>5 - pressure breaker valve</summary>
            PBV = 5,
 
            /// <summary>6 - flow control valve</summary>
            FCV = 6,
 
            /// <summary>7 - throttle control valve</summary>
            TCV = 7,
 
            /// <summary>8 - general purpose valve</summary>
            GPV = 8
        }
 
        /// <summary>Water quality analysis codes</summary>
        public enum QualType
        {
            /// <summary>0 - no quality analysis</summary>
            None = 0,
 
            /// <summary>1 - analyze a chemical</summary>
            Chem = 1,
 
            /// <summary>2 - analyze water age</summary>
            Age = 2,
 
            /// <summary>3 - trace % of flow from a source</summary>
            Trace = 3
        }
 
        /// <summary>Type of source quality input.</summary>
        /// <remarks>See <c>[SOURCES]</c> for a description of these source types.</remarks>
        /// <remarks>
        ///     Used in functions <see cref="UnsafeNativeMethods.ENgetnodevalue" /> and
        ///     <see cref="UnsafeNativeMethods.ENsetnodevalue" /> with <see cref="NodeValue.SourceType" />
        ///     parameter.
        /// </remarks>
        public enum SourceType
        {
            /// <summary>0 - inflow concentration</summary>
            Concen = 0,
 
            /// <summary>1 - mass inflow booster</summary>
            Mass = 1,
 
            /// <summary>2 - setpoint booster</summary>
            SetPoint = 2,
 
            /// <summary>3 - flow paced booster</summary>
            FlowPaced = 3
        }
 
        /// <summary>Flow units codes</summary>
        /// <remarks>
        ///     Flow units are specified in the <c>[OPTIONS]</c> section of the EPANET Input file.
        /// </remarks>
        /// <remarks>
        ///     Flow units in liters or cubic meters implies that metric
        ///     units are used for all other quantities in addition to flow.
        ///     Otherwise US units are employed. (See Units of Measurement).
        /// </remarks>
        public enum FlowUnitsType
        {
            /// <summary>0 - cubic feet per second</summary>
            Cfs = 0,
 
            /// <summary>1 - gallons per minute</summary>
            Gpm = 1,
 
            /// <summary>2 - million gallons per day</summary>
            Mgd = 2,
 
            /// <summary>3 - imperial million gal. per day</summary>
            Imgd = 3,
 
            /// <summary>4 - acre-feet per day</summary>
            Afd = 4,
 
            /// <summary>5 - liters per second</summary>
            Lps = 5,
 
            /// <summary>6 - liters per minute</summary>
            Lpm = 6,
 
            /// <summary>7 - megaliters per day</summary>
            Mld = 7,
 
            /// <summary>8 - cubic meters per hour</summary>
            Cmh = 8,
 
            /// <summary>9 - cubic meters per day</summary>
            Cmd = 9
        }
 
        /// <summary>Misc. options.</summary>
        public enum MiscOption
        {
            /// <summary>0 - Trials</summary>
            MaxTrials = 0,
 
            /// <summary>1 - Accuracy</summary>
            Accuracy = 1,
 
            /// <summary>2 - Tolerance</summary>
            Tolerance = 2,
 
            /// <summary>3 - Emitter exponent</summary>
            EmitExpon = 3,
 
            /// <summary>4 - Demandmult</summary>
            DemandMult = 4
        }
 
        /// <summary>Control types.</summary>
        /// <remarks>
        ///     For pipes, a setting of 0 means the pipe is closed
        ///     and 1 means it is open. For a pump, the setting contains
        ///     the pump's speed, with 0 meaning the pump is closed and 1
        ///     meaning it is open at its normal speed. For a valve, the
        ///     setting refers to the valve's pressure, flow, or loss
        ///     coefficient value, depending on valve type.
        /// </remarks>
        /// <remarks>For Timer or Time-of-Day controls the nindex parameter equals 0.</remarks>
        /// <remarks>
        ///     See <see cref="UnsafeNativeMethods.ENsetcontrol" /> for an example of
        ///     using this function.
        /// </remarks>
        public enum ControlType
        {
            /// <summary>0 - Low Level Control.</summary>
            /// <remarks>Applies when tank level or node pressure drops below specified level.</remarks>
            LowLevel = 0,
 
            /// <summary>1 - High Level Control.</summary>
            /// <remarks>Applies when tank level or node pressure rises above specified level.</remarks>
            HiLevel = 1,
 
            /// <summary>2 - Timer Control.</summary>
            /// <remarks>Applies at specific time into simulation.</remarks>
            Timer = 2,
 
            /// <summary>3 - Time-of-Day Control.</summary>
            /// <remarks>Applies at specific time of day.</remarks>
            TimeOfDay = 3
        }
 
        /// <summary>Time series statistics types.</summary>
        /// <remarks>
        ///     Used as value in <see cref="UnsafeNativeMethods.ENgettimeparam" /> and
        ///     <see cref="UnsafeNativeMethods.ENsettimeparam" /> functions
        ///     with <see cref="TimeParameter.Statistic" /> code.
        /// </remarks>
        public enum TstatType
        {
            /// <summary>0 - none</summary>
            None = 0,
 
            /// <summary>1 - time-averages</summary>
            Average = 1,
 
            /// <summary>2 - minimum values</summary>
            Minimum = 2,
 
            /// <summary>3 - maximum values</summary>
            Maximum = 3,
 
            /// <summary>4 - max - min values</summary>
            Range = 4
        }
 
        /// <summary>
        ///     Tank mixing models.
        ///     The codes for the various tank mixing model choices are as follows:
        /// </summary>
        public enum MixType
        {
            /// <summary>0 - Single compartment, complete mix model</summary>
            Mix1 = 0,
 
            /// <summary>1 - Two-compartment, complete mix model</summary>
            Mix2 = 1,
 
            /// <summary>2 - Plug flow, first in, first out model</summary>
            Fifo = 2,
 
            /// <summary>3 - Stacked plug flow, last in, first out model</summary>
            Lifo = 3
        }
 
        /// <summary>Re-initialize flow flags</summary>
        /// <remarks>
        ///     2-digit flag where 1st (left) digit indicates if link flows should be re-initialized (1) or
        ///     not (0) and 2nd digit indicates if hydraulic results should be saved to file (1) or not (0)
        /// </remarks>
        [System.Flags]
        public enum SaveOptions
        {
            /// <summary>None</summary>
            None = 0,
 
            /// <summary>Save-results-to-file flag</summary>
            SaveToFile = 1,
 
            /// <summary>Re-initialize flow flag</summary>
            InitFlow = 10,
        }
 
        /// <summary>StatusLevel</summary>
        public enum StatusLevel
        {
            /// <summary>None</summary>
            None = 0,
 
            /// <summary>Normal</summary>
            Normal = 1,
 
            /// <summary>Full</summary>
            Full = 2
        }
 
        /// <summary>Result for link properties Initstatus and Status. (0 = closed, 1 = open)</summary>
        public enum LinkStatus
        {
            Closed = 0,
            Open = 1
        }
 
        /// <summary>Epanet error codes</summary>
        public enum ErrorCode
        {
            /// <summary>No error</summary>
            Ok = 0,
 
            /// <summary> WARNING: System hydraulically unbalanced.</summary>
            Warn1 = 1,
 
            /// <summary> WARNING: System may be hydraulically unstable.</summary>
            Warn2 = 2,
 
            /// <summary> WARNING: System disconnected.</summary>
            Warn3 = 3,
 
            /// <summary> WARNING: Pumps cannot deliver enough flow or head.</summary>
            Warn4 = 4,
 
            /// <summary> WARNING: Valves cannot deliver enough flow.</summary>
            Warn5 = 5,
 
            /// <summary> WARNING: System has negative pressures.</summary>
            Warn6 = 6,
 
            /// <summary>System Error 101: insufficient memory available.</summary>
            Err101 = 101,
 
            /// <summary>System Error 102: no network data available.</summary>
            Err102 = 102,
 
            /// <summary>System Error 103: hydraulics not initialized.</summary>
            Err103 = 103,
 
            /// <summary>System Error 104: no hydraulics for water quality analysis.</summary>
            Err104 = 104,
 
            /// <summary>System Error 105: water quality not initialized.</summary>
            Err105 = 105,
 
            /// <summary>System Error 106: no results saved to report on.</summary>
            Err106 = 106,
 
            /// <summary>System Error 107: hydraulics supplied from external file.</summary>
            Err107 = 107,
 
            /// <summary>System Error 108: cannot use external file while hydraulics solver is active.</summary>
            Err108 = 108,
 
            /// <summary>System Error 109: cannot change time parameter when solver is active.</summary>
            Err109 = 109,
 
            /// <summary>System Error 110: cannot solve network hydraulic equations.</summary>
            Err110 = 110,
 
            /// <summary>System Error 120: cannot solve water quality transport equations.</summary>
            Err120 = 120,
 
            /// <summary>Input Error 200: one or more errors in input file.</summary>
            Err200 = 200,
 
            /// <summary>Input Error 201: syntax error in following line of [%s] section:</summary>
            Err201 = 201,
 
            /// <summary>Input Error 202: %s %s contains illegal numeric value.</summary>
            Err202 = 202,
 
            /// <summary>Input Error 203: %s %s refers to undefined node.</summary>
            Err203 = 203,
 
            /// <summary>Input Error 204: %s %s refers to undefined link.</summary>
            Err204 = 204,
 
            /// <summary>Input Error 205: %s %s refers to undefined time pattern.</summary>
            Err205 = 205,
 
            /// <summary>Input Error 206: %s %s refers to undefined curve.</summary>
            Err206 = 206,
 
            /// <summary>Input Error 207: %s %s attempts to control a CV.</summary>
            Err207 = 207,
 
            /// <summary>Input Error 208: %s specified for undefined Node %s.</summary>
            Err208 = 208,
 
            /// <summary>Input Error 209: illegal %s value for Node %s.</summary>
            Err209 = 209,
 
            /// <summary>Input Error 210: %s specified for undefined Link %s.</summary>
            Err210 = 210,
 
            /// <summary>Input Error 211: illegal %s value for Link %s.</summary>
            Err211 = 211,
 
            /// <summary>Input Error 212: trace node %.0s %s is undefined.</summary>
            Err212 = 212,
 
            /// <summary>Input Error 213: illegal option value in [%s] section:</summary>
            Err213 = 213,
 
            /// <summary>Input Error 214: following line of [%s] section contains too many characters:</summary>
            Err214 = 214,
 
            /// <summary>Input Error 215: %s %s is a duplicate ID.</summary>
            Err215 = 215,
 
            /// <summary>Input Error 216: %s data specified for undefined Pump %s.</summary>
            Err216 = 216,
 
            /// <summary>Input Error 217: invalid %s data for Pump %s.</summary>
            Err217 = 217,
 
            /// <summary>Input Error 219: %s %s illegally connected to a tank.</summary>
            Err219 = 219,
 
            /// <summary>Input Error 220: %s %s illegally connected to another valve.</summary>
            Err220 = 220,
 
            /*** Updated on 10/25/00 ***/
 
            /// <summary>Input Error 222: %s %s has same start and end nodes.</summary>
            Err222 = 222,
 
            /// <summary>Input Error 223: not enough nodes in network</summary>
            Err223 = 223,
 
            /// <summary>Input Error 224: no tanks or reservoirs in network.</summary>
            Err224 = 224,
 
            /// <summary>Input Error 225: invalid lower/upper levels for Tank %s.</summary>
            Err225 = 225,
 
            /// <summary>Input Error 226: no head curve supplied for Pump %s.</summary>
            Err226 = 226,
 
            /// <summary>Input Error 227: invalid head curve for Pump %s.</summary>
            Err227 = 227,
 
            /// <summary>Input Error 230: Curve %s has nonincreasing x-values.</summary>
            Err230 = 230,
 
            /// <summary>Input Error 233: Node %s is unconnected.</summary>
            Err233 = 233,
 
            /// <summary>Input Error 240: %s %s refers to undefined source.</summary>
            Err240 = 240,
 
            /// <summary>Input Error 241: %s %s refers to undefined control.</summary>
            Err241 = 241,
 
            /// <summary>Input Error 250: function call contains invalid format.</summary>
            Err250 = 250,
 
            /// <summary>Input Error 251: function call contains invalid parameter code.</summary>
            Err251 = 251,
 
            /// <summary>File Error 301: identical file names.</summary>
            Err301 = 301,
 
            /// <summary>File Error 302: cannot open input file.</summary>
            Err302 = 302,
 
            /// <summary>File Error 303: cannot open report file.</summary>
            Err303 = 303,
 
            /// <summary>File Error 304: cannot open binary output file.</summary>
            Err304 = 304,
 
            /// <summary>File Error 305: cannot open hydraulics file.</summary>
            Err305 = 305,
 
            /// <summary>File Error 306: hydraulics file does not match network data.</summary>
            Err306 = 306,
 
            /// <summary>File Error 307: cannot read hydraulics file.</summary>
            Err307 = 307,
 
            /// <summary>File Error 308: cannot save results to file.</summary>
            Err308 = 308,
 
            /// <summary>File Error 309: cannot save results to report file.</summary>
            Err309 = 309,
        }
    }
}