mbsimhydraulics 4.0.0 MBSim Hydraulics Module

rigid_line.h
1 /* Copyright (C) 2004-2009 MBSim Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact: markus.ms.schneider@gmail.com
18 */
19
20 #ifndef _RIGID_LINE_H_
21 #define _RIGID_LINE_H_
22
23 #include "mbsimHydraulics/hline.h"
24
25 namespace MBSimHydraulics {
26
27 class LinePressureLoss;
28
30 class RigidLine : public RigidHLine {
31 public:
32 RigidLine(const std::string &name="") : RigidHLine(name) {}
33 ~RigidLine() override;
34
35 void setDiameter(double diameter_) {diameter=diameter_; }
36 double getDiameter() const {return diameter; }
37 void setLinePressureLoss(LinePressureLoss * pL_);
38
39 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
40
41 void plot() override;
42
43 void initializeUsingXML(xercesc::DOMElement *element) override;
44 private:
45 double diameter{0};
46 LinePressureLoss * pL{nullptr};
47 double ReynoldsFactor{0};
48 };
49
50
51 class ClosablePressureLoss;
52
54 class ClosableRigidLine : public RigidLine {
55 public:
56 ClosableRigidLine(const std::string &name="") : RigidLine(name) {}
57 ~ClosableRigidLine() override;
58
59 void setClosablePressureLoss(ClosablePressureLoss * cpL_);
60 ClosablePressureLoss * getClosablePressureLoss() const {return cpL; }
61 void setFunction(MBSim::Function<double(double)> * s) {
62 cpLFunction = s;
63 cpLFunction->setParent(this);
64 cpLFunction->setName("cpLFunction");
65 }
66 MBSim::Function<double(double)> * getFunction() const {return cpLFunction; }
67 void setMinimalValue(double v) {cpLMinValue=v; }
68 double getMinimalValue() const {return cpLMinValue; }
69 void setBilateral(bool b=true) {cpLBilateral=b; }
70 bool isClosed() const;
71 double evalRegularizedValue() const;
72
73 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
74
75 void initializeUsingXML(xercesc::DOMElement *element) override;
76 private:
77 ClosablePressureLoss * cpL{nullptr};
78 MBSim::Function<double(double)> * cpLFunction{nullptr};
79 double cpLMinValue{0};
80 bool cpLBilateral{false};
81 };
82
83
84 class UnidirectionalPressureLoss;
85
87 class UnidirectionalRigidLine : public RigidLine {
88 public:
89 UnidirectionalRigidLine(const std::string &name="") : RigidLine(name) {}
90
91 void setUnidirectionalPressureLoss(UnidirectionalPressureLoss * upL_) {upL=upL_; }
92 UnidirectionalPressureLoss * getUnidirectionalPressureLoss() const {return upL; }
93 void setMinimalPressureDrop(double v) {dpMin=v; }
94 double getMinimalPressureDrop() const {return dpMin; }
95
96 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
97
98 void initializeUsingXML(xercesc::DOMElement *element) override;
99 private:
100 UnidirectionalPressureLoss * upL{nullptr};
101 double dpMin{0};
102 };
103
104 }
105
106 #endif /* ----- #ifndef _RIGID_LINE_H_ ----- */
107
MBSimHydraulics::RigidLine
Definition: rigid_line.h:30
MBSimHydraulics::UnidirectionalPressureLoss
Definition: pressure_loss.h:323
MBSimHydraulics::LinePressureLoss
Definition: pressure_loss.h:47
MBSimHydraulics::RigidHLine
Definition: hline.h:97
MBSimHydraulics::ClosablePressureLoss
Definition: pressure_loss.h:169
MBSimHydraulics::ClosableRigidLine
Definition: rigid_line.h:54
MBSim::Element::InitStage
InitStage
MBSim::Function
MBSim::Element::name
std::string name
MBSimHydraulics::UnidirectionalRigidLine
Definition: rigid_line.h:87
MBSim::Element::setName
void setName(const std::string &str)