Skip to content

Commit e69d478

Browse files
committed
Add missing EPANET constants
1 parent 6c8136c commit e69d478

File tree

1 file changed

+58
-28
lines changed

1 file changed

+58
-28
lines changed

epanet_plus/epanet_toolkit.py

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,22 @@ class EpanetConstants:
9999
EN_QTIME = 12 # Elapsed time of current quality solution (read only)
100100
EN_HALTFLAG = 13 # Flag indicating if the simulation was halted (read only)
101101
EN_NEXTEVENT = 14 # Shortest time until a tank becomes empty or full (read only)
102-
EN_NEXTEVENTTANK = 15
102+
EN_NEXTEVENTTANK = 15 # Index of tank with shortest time to become empty or full (read only)
103+
104+
EN_STEP_REPORT = 0 # A reporting time step has ended
105+
EN_STEP_HYD = 1 # A hydraulic time step has ended
106+
EN_STEP_WQ = 2 # A water quality time step has ended
107+
EN_STEP_TANKEVENT = 3 # A tank has become empty or full
108+
EN_STEP_CONTROLEVENT = 4 # A link control needs to be activated
109+
110+
EN_ITERATIONS = 0 # Number of hydraulic iterations taken
111+
EN_RELATIVEERROR = 1 # Sum of link flow changes / sum of link flows
112+
EN_MAXHEADERROR = 2 # Largest head loss error for links
113+
EN_MAXFLOWCHANGE = 3 # Largest flow change in links
114+
EN_MASSBALANCE = 4 # Cumulative water quality mass balance ratio
115+
EN_DEFICIENTNODES = 5 # Number of pressure deficient nodes
116+
EN_DEMANDREDUCTION = 6 # % demand reduction at pressure deficient nodes
117+
EN_LEAKAGELOSS = 7 # % flow lost to system leakage
103118

104119
EN_ITERATIONS = 0 # Number of hydraulic iterations taken
105120
EN_RELATIVEERROR = 1 # Sum of link flow changes / sum of link flows
@@ -114,19 +129,19 @@ class EpanetConstants:
114129
EN_TIMEPAT = 2 # Time patterns
115130
EN_CURVE = 3 # Data curves
116131
EN_CONTROL = 4 # Simple controls
117-
EN_RULE = 5
132+
EN_RULE = 5 # Control rules
118133

119134
EN_NODECOUNT = 0 # Number of nodes (junctions + tanks + reservoirs)
120135
EN_TANKCOUNT = 1 # Number of tanks and reservoirs
121136
EN_LINKCOUNT = 2 # Number of links (pipes + pumps + valves)
122137
EN_PATCOUNT = 3 # Number of time patterns
123138
EN_CURVECOUNT = 4 # Number of data curves
124139
EN_CONTROLCOUNT = 5 # Number of simple controls
125-
EN_RULECOUNT = 6
140+
EN_RULECOUNT = 6 # Number of rule-based controls
126141

127142
EN_JUNCTION = 0 # Junction node
128143
EN_RESERVOIR = 1 # Reservoir node
129-
EN_TANK = 2
144+
EN_TANK = 2 # Storage tank node
130145

131146
EN_CVPIPE = 0 # Pipe with check valve
132147
EN_PIPE = 1 # Pipe
@@ -136,29 +151,30 @@ class EpanetConstants:
136151
EN_PBV = 5 # Pressure breaker valve
137152
EN_FCV = 6 # Flow control valve
138153
EN_TCV = 7 # Throttle control valve
139-
EN_GPV = 8
154+
EN_GPV = 8 # General purpose valve
155+
EN_PCV = 9 # Positional control valve
140156

141-
EN_CLOSED = 0
142-
EN_OPEN = 1
157+
EN_CLOSED = 0 # Link is closed and cannot convey any flow
158+
EN_OPEN = 1 # Link is open and is able to convey flow
143159

144160
EN_PUMP_XHEAD = 0 # Pump closed - cannot supply head
145161
EN_PUMP_CLOSED = 2 # Pump closed
146162
EN_PUMP_OPEN = 3 # Pump open
147-
EN_PUMP_XFLOW = 5
163+
EN_PUMP_XFLOW = 5 # Pump open - cannot supply flow
148164

149165
EN_NONE = 0 # No quality analysis
150166
EN_CHEM = 1 # Chemical fate and transport
151167
EN_AGE = 2 # Water age analysis
152-
EN_TRACE = 3
168+
EN_TRACE = 3 # Source tracing analysis
153169

154170
EN_CONCEN = 0 # Sets the concentration of external inflow entering a node
155171
EN_MASS = 1 # Injects a given mass/minute into a node
156172
EN_SETPOINT = 2 # Sets the concentration leaving a node to a given value
157-
EN_FLOWPACED = 3
173+
EN_FLOWPACED = 3 # Adds a given value to the concentration leaving a node
158174

159175
EN_HW = 0 # Hazen-Williams
160176
EN_DW = 1 # Darcy-Weisbach
161-
EN_CM = 2
177+
EN_CM = 2 # Chezy-Manning
162178

163179
EN_CFS = 0 # Cubic feet per second
164180
EN_GPM = 1 # Gallons per minute
@@ -169,10 +185,17 @@ class EpanetConstants:
169185
EN_LPM = 6 # Liters per minute
170186
EN_MLD = 7 # Million liters per day
171187
EN_CMH = 8 # Cubic meters per hour
172-
EN_CMD = 9
188+
EN_CMD = 9 # Cubic meters per day
189+
EN_CMS = 10 # Cubic meters per second
190+
191+
EN_PSI = 0 # Pounds per square inch
192+
EN_KPA = 1 # Kilopascals
193+
EN_METERS = 2 # Meters
194+
EN_BAR = 3 # Bar
195+
EN_FEET = 4 # Feet
173196

174197
EN_DDA = 0 # Demand driven analysis
175-
EN_PDA = 1
198+
EN_PDA = 1 # Pressure driven analysis
176199

177200
EN_TRIALS = 0 # Maximum trials allowed for hydraulic convergence
178201
EN_ACCURACY = 1 # Total normalized flow change for hydraulic convergence
@@ -196,50 +219,55 @@ class EpanetConstants:
196219
EN_BULKORDER = 19 # Bulk water reaction order for pipes
197220
EN_WALLORDER = 20 # Wall reaction order for pipes (either 0 or 1)
198221
EN_TANKORDER = 21 # Bulk water reaction order for tanks
199-
EN_CONCENLIMIT = 22
222+
EN_CONCENLIMIT = 22 # Limiting concentration for growth reactions
223+
EN_DEMANDPATTERN = 23 # Name of default demand pattern
224+
EN_EMITBACKFLOW = 24 # `EN_TRUE` (= 1) if emitters can backflow, `EN_FALSE` (= 0) if not
225+
EN_PRESS_UNITS = 25 # Pressure units (see @ref EN_PressUnits)
226+
EN_STATUS_REPORT = 26 # Type of status report to produce (see @ref EN_StatusReport)
200227

201228
EN_LOWLEVEL = 0 # Act when pressure or tank level drops below a setpoint
202229
EN_HILEVEL = 1 # Act when pressure or tank level rises above a setpoint
203230
EN_TIMER = 2 # Act at a prescribed elapsed amount of time
204-
EN_TIMEOFDAY = 3
231+
EN_TIMEOFDAY = 3 # Act at a particular time of day
205232

206233
EN_SERIES = 0 # Report all time series points
207234
EN_AVERAGE = 1 # Report average value over simulation period
208235
EN_MINIMUM = 2 # Report minimum value over simulation period
209236
EN_MAXIMUM = 3 # Report maximum value over simulation period
210-
EN_RANGE = 4
237+
EN_RANGE = 4 # Report maximum - minimum over simulation period
211238

212239
EN_MIX1 = 0 # Complete mix model
213240
EN_MIX2 = 1 # 2-compartment model
214241
EN_FIFO = 2 # First in, first out model
215-
EN_LIFO = 3
242+
EN_LIFO = 3 # Last in, first out model
216243

217244
EN_NOSAVE = 0 # Don't save hydraulics; don't re-initialize flows
218245
EN_SAVE = 1 # Save hydraulics to file, don't re-initialize flows
219246
EN_INITFLOW = 10 # Don't save hydraulics; re-initialize flows
220-
EN_SAVE_AND_INIT = 11
247+
EN_SAVE_AND_INIT = 11 # Save hydraulics; re-initialize flows
221248

222249
EN_CONST_HP = 0 # Constant horsepower
223250
EN_POWER_FUNC = 1 # Power function
224251
EN_CUSTOM = 2 # User-defined custom curve
225-
EN_NOCURVE = 3
252+
EN_NOCURVE = 3 # No curve
226253

227254
EN_VOLUME_CURVE = 0 # Tank volume v. depth curve
228255
EN_PUMP_CURVE = 1 # Pump head v. flow curve
229256
EN_EFFIC_CURVE = 2 # Pump efficiency v. flow curve
230257
EN_HLOSS_CURVE = 3 # Valve head loss v. flow curve
231-
EN_GENERIC_CURVE = 4
258+
EN_GENERIC_CURVE = 4 # Generic curve
259+
EN_VALVE_CURVE = 5 # % of fully open flow v. % open
232260

233261
EN_UNCONDITIONAL = 0 # Delete all controls and connecing links
234-
EN_CONDITIONAL = 1
262+
EN_CONDITIONAL = 1 # Cancel object deletion if it appears in controls or has connecting links
235263

236264
N_NO_REPORT = 0 # No status reporting
237-
EN_NORMAL_REPORT = 1 # Normal level of status reporting
238-
EN_FULL_REPORT = 2
265+
EN_NORMAL_REPORT = 1 # Normal level of status reporting
266+
EN_FULL_REPORT = 2 # Full level of status reporting
239267

240268
EN_R_NODE = 6 # Clause refers to a node
241269
EN_R_LINK = 7 # Clause refers to a link
242-
EN_R_SYSTEM = 8
270+
EN_R_SYSTEM = 8 # Clause refers to a system parameter (e.g., time)
243271

244272
EN_R_DEMAND = 0 # Nodal demand
245273
EN_R_HEAD = 1 # Nodal hydraulic head
@@ -253,7 +281,7 @@ class EpanetConstants:
253281
EN_R_TIME = 9 # Elapsed simulation time
254282
EN_R_CLOCKTIME = 10 # Time of day
255283
EN_R_FILLTIME = 11 # Time to fill a tank
256-
EN_R_DRAINTIME = 12
284+
EN_R_DRAINTIME = 12 # Time to drain a tank
257285

258286
EN_R_EQ = 0 # Equal to
259287
EN_R_NE = 1 # Not equal
@@ -264,13 +292,15 @@ class EpanetConstants:
264292
EN_R_IS = 6 # Is equal to
265293
EN_R_NOT = 7 # Is not equal to
266294
EN_R_BELOW = 8 # Is below
267-
EN_R_ABOVE = 9
295+
EN_R_ABOVE = 9 # Is above
268296

269297
EN_R_IS_OPEN = 1 # Link is open
270298
EN_R_IS_CLOSED = 2 # Link is closed
271-
EN_R_IS_ACTIVE = 3
299+
EN_R_IS_ACTIVE = 3 # Control valve is active
272300

273-
EN_MISSING = -1.E10
301+
EN_MISSING = -1.E10 # Missing value indicator
302+
EN_SET_CLOSED = -1.E10 # Link set closed indicator
303+
EN_SET_OPEN = 1.E10 # Link set open indicator
274304

275305
MSX_NODE = 0
276306
MSX_LINK = 1

0 commit comments

Comments
 (0)