EPANET  3.0
EPANET Development Project
options.h
Go to the documentation of this file.
1 /* EPANET 3
2  *
3  * Copyright (c) 2016 Open Water Analytics
4  * Distributed under the MIT License (see the LICENSE file for details).
5  *
6  */
7 
10 
11 #ifndef OPTIONS_H_
12 #define OPTIONS_H_
13 
14 #include "Output/reportfields.h"
15 #include <string>
16 #include <sstream>
17 
18 class Network;
19 
22 
23 class Options
24 {
25  public:
26 
27  // ... Enumerated values for categorical options
28 
29  enum UnitSystem {US, SI};
30  enum FlowUnits {CFS, GPM, MGD, IMGD, AFD, LPS, LPM, MLD, CMH, CMD};
31  enum PressureUnits {PSI, METERS, KPA};
32  enum FileMode {SCRATCH, USE, SAVE};
33  enum IfUnbalanced {STOP, CONTINUE};
34  enum QualType {NOQUAL, AGE, TRACE, CHEM};
35  enum QualUnits {NOUNITS, HRS, PCNT, MGL, UGL};
36  enum ReportedItems {NONE, ALL, SOME};
37 
38  // ... Options with string values
39 
40  enum StringOption {
45 
53 
58 
59  MAX_STRING_OPTIONS
60  };
61 
62  // ... Options with integer, categorical or yes/no values
63 
64  enum IndexOption {
73 
77 
84 
85  MAX_INDEX_OPTIONS
86  };
87 
88  // ... Options with numerical values
89 
90  enum ValueOption {
91 
92  // Hydraulic properties
100  LEAKAGE_COEFF1,
101  LEAKAGE_COEFF2,
102 
103  // Hydraulic tolerances
107 
108  // Water quality options
118 
119  // Energy options
123 
124  MAX_VALUE_OPTIONS
125  };
126 
127  // ... Time options (in integer seconds)
128 
129  enum TimeOption {
140 
141  MAX_TIME_OPTIONS
142  };
143 
144  //... Constructor / Destructor
145 
146  Options();
147  ~Options() {}
148 
149  // ... Methods that return an option's value
150 
151  int flowUnits();
152  int pressureUnits();
153  std::string stringOption(StringOption option);
154  int indexOption(IndexOption option);
155  double valueOption(ValueOption option);
156  int timeOption(TimeOption option);
157 
158  // ... Methods that set an option's value
159 
160  void setDefaults();
161  void adjustOptions();
162  int setOption(StringOption option, const std::string& value);
163  int setOption(IndexOption option, const std::string& value, Network* nw);
164  void setOption(IndexOption option, int value);
165  void setOption(ValueOption option, double value);
166  void setOption(TimeOption option, int value);
167  void setReportFieldOption(int fieldType,
168  int fieldIndex,
169  int enabled,
170  int precision,
171  double lowerLimit,
172  double upperLimit);
173 
174  // ... Methods that write a collection of options to a string
175 
176  std::string hydOptionsToStr();
177  std::string qualOptionsToStr();
178  std::string demandOptionsToStr();
179  std::string timeOptionsToStr();
180  std::string reactOptionsToStr();
181  std::string energyOptionsToStr(Network* network);
182  std::string reportOptionsToStr();
183 
184  private:
185 
186  std::string stringOptions[MAX_STRING_OPTIONS];
187  int indexOptions[MAX_INDEX_OPTIONS];
188  double valueOptions[MAX_VALUE_OPTIONS];
189  int timeOptions[MAX_TIME_OPTIONS];
190  ReportFields reportFields;
191 };
192 
193 //-----------------------------------------------------------------------------
194 // Inline Functions
195 //-----------------------------------------------------------------------------
196 
197 inline int Options::flowUnits()
198  { return indexOptions[FLOW_UNITS]; }
199 
200 inline int Options::pressureUnits()
201  { return indexOptions[PRESSURE_UNITS]; }
202 
203 inline std::string Options::stringOption(StringOption option)
204  { return stringOptions[option]; }
205 
206 inline int Options::indexOption(IndexOption option)
207  { return indexOptions[option]; }
208 
209 inline double Options::valueOption(ValueOption option)
210  { return valueOptions[option]; }
211 
212 inline int Options::timeOption(TimeOption option)
213  { return timeOptions[option]; }
214 
215 #endif
Units of the quality constituent.
Definition: options.h:75
Simulation time at which reporting begins.
Definition: options.h:136
Specific Gravity.
Definition: options.h:93
Global rate coefficient for bulk reactions.
Definition: options.h:114
Choice of flow rate units.
Definition: options.h:66
Reporting time step.
Definition: options.h:135
StringOption
Definition: options.h:40
Global demand pattern index.
Definition: options.h:71
Total simulation duration.
Definition: options.h:138
User-supplied options for analyzing a pipe network.
Definition: options.h:23
Name of nodal demand model used.
Definition: options.h:47
Definition: reportfields.h:24
Fixed energy charge per peak kw.
Definition: options.h:121
Choice of pressure units.
Definition: options.h:67
Global pump efficiency (fraction)
Definition: options.h:122
Name of node for source tracing.
Definition: options.h:57
Name of binary file containing simulation results.
Definition: options.h:42
Name of text file containing nodal coordinates.
Definition: options.h:44
Global base demand multiplier.
Definition: options.h:95
Time of day at which all time patterns start.
Definition: options.h:134
Choice of units system.
Definition: options.h:65
Name of hydraulic solver method.
Definition: options.h:49
Binary hydraulics file mode.
Definition: options.h:70
Hydraulic simulation time step.
Definition: options.h:131
IndexOption
Definition: options.h:64
Global exponent in emitter discharge formula.
Definition: options.h:99
Name of sparse matrix eqn. solver.
Definition: options.h:51
Name of water quality model used.
Definition: options.h:54
Order of all bulk flow reactions in pipes.
Definition: options.h:111
Name of text file containing output report.
Definition: options.h:43
Tolerance for water quality comparisons.
Definition: options.h:110
Global pressure to supply full demand (ft)
Definition: options.h:97
Maximum concentration for growth reactions.
Definition: options.h:116
Largest flow change for convergence.
Definition: options.h:105
Kinematic viscosity (ft2/sec)
Definition: options.h:94
report input/output summary
Definition: options.h:78
Global energy price (per kwh)
Definition: options.h:120
Starting time of day.
Definition: options.h:130
Global exponent for power function demands.
Definition: options.h:98
Name of head loss model used.
Definition: options.h:46
Order of all pipe wall reactions.
Definition: options.h:112
TimeOption
Definition: options.h:129
Name of pipe leakage model used.
Definition: options.h:48
Water quality simulation time step.
Definition: options.h:132
Global rate coefficient for wall reactions.
Definition: options.h:115
Name of water quality constituent.
Definition: options.h:55
Global minimum pressure to supply demand (ft)
Definition: options.h:96
Name of global demand pattern.
Definition: options.h:52
sum of all |flow changes| / sum of all |flows|
Definition: options.h:104
report energy usage
Definition: options.h:79
Chemical&#39;s molecular diffusivity (ft2/sec)
Definition: options.h:109
Global time interval for time patterns.
Definition: options.h:133
Time step used to evaluate control rules.
Definition: options.h:137
report result of each trial
Definition: options.h:81
Type of water quality analysis.
Definition: options.h:74
Name of Newton step size method.
Definition: options.h:50
Global energy price pattern index.
Definition: options.h:72
report node results
Definition: options.h:82
Stop or continue if network is unbalanced.
Definition: options.h:69
ValueOption
Definition: options.h:90
Maximum hydraulic trials.
Definition: options.h:68
Relates wall reaction coeff. to pipe roughness.
Definition: options.h:117
Node index for source tracing.
Definition: options.h:76
Name of binary file containing hydraulic results.
Definition: options.h:41
report system status
Definition: options.h:80
Name of water quality units.
Definition: options.h:56
Order of all bulk water reactions in tanks.
Definition: options.h:113
Contains the data elements that describe a pipe network.
Definition: network.h:41
report link results
Definition: options.h:83
Time weighting for variable head tanks.
Definition: options.h:106
How results are reported (min, max, range)
Definition: options.h:139