EPANET  3.0
EPANET Development Project
ggasolver.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 GGASOLVER_H_
12 #define GGASOLVER_H_
13 
14 #include "Solvers/hydsolver.h"
15 #include "Core/hydbalance.h"
16 
17 #include <vector>
18 
19 class HydSolver;
20 
23 
24 class GGASolver : public HydSolver
25 {
26  public:
27 
28  GGASolver(Network* nw, MatrixSolver* ms);
29  ~GGASolver();
30  int solve(double tstep, int& trials);
31 
32  private:
33 
34  int nodeCount; // number of network nodes
35  int linkCount; // number of network links
36  int hLossEvalCount; // number of head loss evaluations
37 
38  int trialsLimit; // limit on number of trials
39  bool reportTrials; // report summary of each trial
40  double headErrLimit; // allowable head error (ft)
41  double flowErrLimit; // allowable flow error (cfs)
42  double flowChangeLimit; // allowable flow change (cfs)
43  double flowRatioLimit; // allowable total flow change / total flow
44  double tstep; // time step (sec)
45  double theta; // time weighting constant
46 
47  double errorNorm; // solution error norm
48  double oldErrorNorm; // previous error norm
49  HydBalance hydBalance; // hydraulic balance results
50 
51  std::vector<double> dH; // head change at each node (ft)
52  std::vector<double> dQ; // flow change in each link (cfs)
53  std::vector<double> xQ; // node flow imbalances (cfs)
54 
55  // Functions that assemble linear equation coefficients
56  void setFixedGradeNodes();
57  void setMatrixCoeffs();
58  void setLinkCoeffs();
59  void setNodeCoeffs();
60  void setValveCoeffs();
61 
62  // Functions that update the hydraulic solution
63  int findHeadChanges();
64  void findFlowChanges();
65  double findStepSize(int trials);
66  void updateSolution(double lamda);
67 
68  // Functions that check for convergence
69  void setConvergenceLimits();
70  double findErrorNorm(double lamda);
71  bool linksChangedStatus();
72  bool flowThresholdsReduced();
73  void reportTrial(int trials, double lamda);
74 };
75 
76 #endif
Describes the HydBalance class.
Abstract class for solving a set of linear equations.
Definition: matrixsolver.h:27
A hydraulic solver based on Todini&#39;s Global Gradient Algorithm.
Definition: ggasolver.h:24
Computes the degree to which a network solution is unbalanced.
Definition: hydbalance.h:23
Describes the HydSolver class.
Interface for an equilibrium network hydraulic solver.
Definition: hydsolver.h:26
Contains the data elements that describe a pipe network.
Definition: network.h:41