34 enum LinkType {PIPE, PUMP, VALVE};
35 enum LinkStatus {LINK_CLOSED, LINK_OPEN, VALVE_ACTIVE, TEMP_CLOSED};
36 enum LinkReaction {BULK, WALL};
38 Link(std::string name_);
43 virtual int type() = 0;
44 virtual std::string typeStr() = 0;
45 virtual void convertUnits(
Network* nw) = 0;
46 virtual double convertSetting(
Network* nw,
double s) {
return s; }
47 virtual void validate(
Network* nw) { }
48 virtual bool isReactive() {
return false; }
51 virtual void initialize(
bool initFlow);
52 virtual void setInitFlow() {}
53 virtual void setInitStatus(
int s) {}
54 virtual void setInitSetting(
double s) {}
55 virtual void setResistance(
Network* nw) {}
56 virtual void setFlowThreshold(
const double viscos);
57 virtual bool reduceFlowThreshold();
60 virtual double getVelocity() {
return 0.0;}
61 virtual double getRe(
const double q,
const double viscos) {
return 0.0;}
62 virtual double getResistance() {
return 0.0;}
63 virtual double getUnitHeadLoss();
67 virtual void findHeadLoss(
Network* nw,
double q) = 0;
68 virtual double updateEnergyUsage(
Network* nw,
int dt) {
return 0.0; }
69 virtual bool canLeak() {
return false; }
70 virtual double findLeakage(
Network* nw,
double h,
double& dqdh) {
return 0.0; }
74 virtual bool isPRV() {
return false;}
75 virtual bool isPSV() {
return false;}
76 virtual bool isHpPump() {
return false;}
79 virtual void updateStatus(
double q,
double h1,
double h2) { }
80 virtual bool changeStatus(
int newStatus,
82 const std::string reason,
85 virtual bool changeSetting(
double newSetting,
87 const std::string reason,
90 virtual void validateStatus(
Network* nw,
double qTol) { }
91 virtual void applyControlPattern(std::ostream& msgLog) { }
92 std::string writeStatusChange(
int oldStatus);
95 virtual double getVolume() {
return 0.0; }
double initSetting
initial pump speed or valve setting
Definition: link.h:104
double hGrad
head loss gradient (ft/cfs)
Definition: link.h:113
Abstract parent class for all pipe network components.
Definition: element.h:19
Describes the Element class.
double flow
flow rate (cfs)
Definition: link.h:110
A connection point between links in a network.
Definition: node.h:30
Node * fromNode
pointer to the link's start node
Definition: link.h:99
double setting
current setting
Definition: link.h:114
double quality
avg. quality concen. (mass/ft3)
Definition: link.h:115
double hLoss
head loss (ft)
Definition: link.h:112
double flowThresh0
initial flow threshold (cfs)
Definition: link.h:108
A simple pooled memory allocator.
Definition: mempool.h:21
double flowThresh
current flow threshold (cfs)
Definition: link.h:109
virtual ~Link()
Destructor.
Definition: link.cpp:54
int status
current status
Definition: link.h:107
static Link * factory(int type_, std::string name_, MemPool *memPool)
Factory Method.
Definition: link.cpp:61
Node * toNode
pointer to the link's end node
Definition: link.h:100
Link(std::string name_)
Constructor.
Definition: link.cpp:32
bool rptFlag
true if results are reported
Definition: link.h:98
double lossCoeff
minor head loss coefficient
Definition: link.h:103
double diameter
link diameter (ft)
Definition: link.h:102
int initStatus
initial Open/Closed status
Definition: link.h:101
double leakage
leakage rate (cfs)
Definition: link.h:111
Contains the data elements that describe a pipe network.
Definition: network.h:41
A conveyance element that connects two nodes together.
Definition: link.h:30