EPANET  3.0
EPANET Development Project
control.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 CONTROL_H_
12 #define CONTROL_H_
13 
14 #include "Elements/element.h"
15 
16 #include <string>
17 #include <ostream>
18 
19 class Node;
20 class Tank;
21 class Link;
22 class Network;
23 
26 
27 class Control: public Element
28 {
29  public:
30  enum ControlType {TANK_LEVEL, PRESSURE_LEVEL, ELAPSED_TIME, TIME_OF_DAY,
31  RULE_BASED};
32  enum StatusType {CLOSED_STATUS, OPEN_STATUS, NO_STATUS};
33  enum LevelType {LOW_LEVEL, HI_LEVEL, NO_LEVEL};
34 
35  // Constructor/Destructor
36  Control(int type_, std::string name_);
37  ~Control();
38 
39  // Applies all pressure controls to the pipe network
40  static void applyPressureControls(Network* network);
41 
42  // Sets the properties of a control
43  void setProperties(
44  int controlType,
45  Link* controlLink,
46  int linkStatus,
47  double linkSetting,
48  Node* controlNode,
49  double nodeSetting,
50  int controlLevelType,
51  int timeSetting);
52 
53  // Produces a string representation of the control
54  std::string toStr(Network* network);
55 
56  // Converts the control's properties to internal units
57  void convertUnits(Network* network);
58 
59  // Returns the control's type (see ControlType enum)
60  int getType()
61  { return type; }
62 
63  // Finds the time until the control is next activated
64  int timeToActivate(Network* network, int t, int tod);
65 
66  // Checks if the control's conditions are met
67  void apply(Network* network, int t, int tod);
68 
69  private:
70  int type;
71  Link* link;
72  int status;
73  double setting;
74  Node* node;
75  double head;
76  double volume;
77  LevelType levelType;
78  int time;
79 
80  // Activates the control's action
81  bool activate(bool makeChange, std::ostream& msgLog);
82 
83 };
84 
85 #endif
Abstract parent class for all pipe network components.
Definition: element.h:19
Describes the Element class.
A connection point between links in a network.
Definition: node.h:30
A fixed head Node with storage volume.
Definition: tank.h:27
A class that controls pumps and valves based on a single condition.
Definition: control.h:27
Contains the data elements that describe a pipe network.
Definition: network.h:41