EPANET  3.0
EPANET Development Project
qualmodel.h
Go to the documentation of this file.
1 /* EPANET 3
2  *
3  * Copyright (c) 2016 Open Water Analytics
4  * Licensed under the terms of the MIT License (see the LICENSE file for details).
5  *
6  */
7 
10 
11 #ifndef QUALMODEL_H_
12 #define QUALMODEL_H_
13 
14 #include <string>
15 
16 class Network;
17 class Pipe;
18 class Tank;
19 class Node;
20 
27 
28 class QualModel
29 {
30  public:
31 
32  enum QualModelType {
33  NOQUAL, // no quality model
34  AGE, // water age
35  TRACE, // source tracing
36  CHEM}; // chemical constituent
37 
38  QualModel(int _type);
39  virtual ~QualModel() = 0;
40 
41  static QualModel* factory(const std::string model);
42 
43  virtual bool isReactive()
44  { return false; }
45 
46  virtual void init(Network* nw)
47  { }
48 
49  virtual void findMassTransCoeff(Pipe* pipe)
50  { }
51 
52  virtual double pipeReact(Pipe* pipe, double c, double tstep)
53  { return c; }
54 
55  virtual double tankReact(Tank* tank, double c, double tstep)
56  { return c; }
57 
58  virtual double findTracerAdded(Node* node, double qIn)
59  { return 0.0; }
60 
61  int type;
62 };
63 
64 
65 //-----------------------------------------------------------------------------
68 //-----------------------------------------------------------------------------
69 
70 class ChemModel : public QualModel
71 {
72  public:
73  ChemModel();
74  bool isReactive() { return reactive; }
75  void init(Network* nw);
76  void findMassTransCoeff(Pipe* pipe);
77  double pipeReact(Pipe* pipe, double c, double tstep);
78  double tankReact(Tank* tank, double c, double tstep);
79 
80  private:
81  bool reactive; // true if chemical is reactive
82  double diffus; // chemical's diffusuivity (ft2/sec)
83  double viscos; // water kin. viscosity (ft2/sec)
84  double Sc; // Schmidt number
85  double pipeOrder; // pipe bulk fluid reaction order
86  double tankOrder; // tank bulk fluid reaction order
87  double wallOrder; // pipe wall reaction order
88  double massTransCoeff; // a pipe's mass transfer coeff. (ft/sec)
89  double pipeUcf; // volume conversion factor for pipes
90  double tankUcf; // volume conversion factor for tanks
91  double cLimit; // min/max concentration limit (mass/ft3)
92 
93  bool setReactive(Network* nw);
94  double findBulkRate(double kb, double order, double c);
95  double findWallRate(double kw, double d, double order, double c);
96 };
97 
98 
99 //-----------------------------------------------------------------------------
102 //-----------------------------------------------------------------------------
103 
104 class TraceModel : public QualModel
105 {
106  public:
107  TraceModel() : QualModel(TRACE) { }
108  void init(Network* nw);
109  double findTracerAdded(Node* node, double qIn);
110 
111  private:
112  Node* traceNode;
113 };
114 
115 
116 //-----------------------------------------------------------------------------
119 //-----------------------------------------------------------------------------
120 
121 class AgeModel : public QualModel
122 {
123  public:
124  AgeModel() : QualModel(AGE) { }
125  bool isReactive() { return true; }
126  double pipeReact(Pipe* pipe, double age, double tstep);
127  double tankReact(Tank* tank, double age, double tstep);
128 };
129 
130 #endif
A connection point between links in a network.
Definition: node.h:30
Water age model.
Definition: qualmodel.h:121
Source tracing model.
Definition: qualmodel.h:104
A circular conduit Link through which water flows.
Definition: pipe.h:23
Reactive chemical model.
Definition: qualmodel.h:70
A fixed head Node with storage volume.
Definition: tank.h:27
The interface for a water quality analysis model.
Definition: qualmodel.h:28
Contains the data elements that describe a pipe network.
Definition: network.h:41