EPANET  3.0
EPANET Development Project
hydengine.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 HYDENGINE_H_
12 #define HYDENGINE_H_
13 
14 class Network;
15 class HydSolver;
16 class MatrixSolver;
17 
24 
25 class HydEngine
26 {
27  public:
28 
29  // Constructor/Destructor
30 
31  HydEngine();
32  ~HydEngine();
33 
34  // Public Methods
35 
36  void open(Network* nw);
37  void init(bool initFlows);
38  int solve(int* t);
39  void advance(int* tstep);
40  void close();
41 
42  int getElapsedTime() { return currentTime; }
43  double getPeakKwatts() { return peakKwatts; }
44 
45  private:
46 
47  // Engine state
48 
49  enum EngineState {CLOSED, OPENED, INITIALIZED};
50  EngineState engineState;
51 
52  // Engine components
53 
54  Network* network;
55  HydSolver* hydSolver;
56  MatrixSolver* matrixSolver;
57 // HydFile* hydFile; //!< hydraulics file accessor
58 
59  // Engine properties
60 
61  bool saveToFile;
62  bool halted;
63  int startTime;
64  int rptTime;
65  int hydStep;
66  int currentTime;
67  int timeOfDay;
68  double peakKwatts;
69 
70  // Simulation sub-tasks
71 
72  void initMatrixSolver();
73 
74  int getTimeStep();
75  int timeToPatternChange();
76  int timeToActivateControl();
77  int timeToCloseTank();
78 
79  void updateCurrentConditions();
80  void updateTanks();
81  void updatePatterns();
82  void updateEnergyUsage();
83 
84  bool isPressureDeficient();
85  int resolvePressureDeficiency(int& trials);
86  void reportDiagnostics(int statusCode, int trials);
87 };
88 
89 #endif
Abstract class for solving a set of linear equations.
Definition: matrixsolver.h:27
Simulates extended period hydraulics.
Definition: hydengine.h:25
Interface for an equilibrium network hydraulic solver.
Definition: hydsolver.h:26
Contains the data elements that describe a pipe network.
Definition: network.h:41