mbsimhydraulics 4.0.0 MBSim Hydraulics Module

leakage_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 _LEAKAGE_LINE_H_
21 #define _LEAKAGE_LINE_H_
22
23 #include "mbsimHydraulics/hline.h"
24 #include <mbsim/functions/function.h>
25
26 namespace MBSimHydraulics {
27
28 class LeakagePressureLoss;
29 class PlaneLeakagePressureLoss;
30 class CircularLeakagePressureLoss;
31
33 class LeakageLine : public RigidHLine {
34 public:
35 LeakageLine(const std::string &name) : RigidHLine(name), lpl(nullptr), s1vFunction(nullptr), s2vFunction(nullptr), glFunction(nullptr) {}
36 ~LeakageLine() override;
37
38 void setGapLengthFunction(MBSim::Function<double(double)> * s) {
39 glFunction=s;
40 glFunction->setParent(this);
41 glFunction->setName("glFunction");
42 }
43 double evalGapLength() const;
44 void setSurface1VelocityFunction(MBSim::Function<double(double)> * s) {
45 s1vFunction=s;
46 s1vFunction->setParent(this);
47 s1vFunction->setName("s1vFunction");
48 }
49 double evalSurface1Velocity() const;
50 void setSurface2VelocityFunction(MBSim::Function<double(double)> * s) {
51 s2vFunction=s;
52 s2vFunction->setParent(this);
53 s2vFunction->setName("s2vFunction");
54 }
55 double evalSurface2Velocity() const;
56
57 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
58
59 void initializeUsingXML(xercesc::DOMElement * element) override;
60 protected:
61 LeakagePressureLoss * lpl;
62 private:
63 MBSim::Function<double(double)> *s1vFunction, *s2vFunction, *glFunction;
64 };
65
67 class PlaneLeakageLine : public LeakageLine {
68 public:
69 PlaneLeakageLine(const std::string &name="") : LeakageLine(name) {};
70
71 void setGapWidth(double wGap_) {wGap=wGap_; }
72 double getGapWidth() const {return wGap; }
73 void setGapHeight(double hGap_) {hGap=hGap_; }
74 double getGapHeight() const {return hGap; }
75 void setPlaneLeakagePressureLoss(PlaneLeakagePressureLoss * plpl);
76
77 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
78
79 void initializeUsingXML(xercesc::DOMElement * element) override;
80 private:
81 double hGap{0}, wGap{0};
82 };
83
85 class CircularLeakageLine : public LeakageLine {
86 public:
87 CircularLeakageLine(const std::string &name="") : LeakageLine(name) {}
88
89 void setInnerRadius(double rI_) {rI=rI_; }
90 double getInnerRadius() const {return rI; }
91 void setGapHeight(double hGap_) {hGap=hGap_; }
92 double getGapHeight() const {return hGap; }
93 double getOuterRadius() const {return rO; }
94 void setCircularLeakagePressureLoss(CircularLeakagePressureLoss * clpl);
95
96 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
97
98 void initializeUsingXML(xercesc::DOMElement * element) override;
99 private:
100 double rI{0}, rO{0}, hGap{0};
101 };
102
103 }
104
105 #endif /* ----- #ifndef _LEAKAGE_H_ ----- */
106
MBSimHydraulics::LeakageLine
Definition: leakage_line.h:33
MBSimHydraulics::RigidHLine
Definition: hline.h:97
MBSimHydraulics::LeakagePressureLoss
Definition: pressure_loss.h:274
MBSim::Element::InitStage
InitStage
MBSim::Function
MBSim::Element::name
std::string name
MBSim::Element::setName
void setName(const std::string &str)
MBSimHydraulics::PlaneLeakagePressureLoss
Definition: pressure_loss.h:283
MBSimHydraulics::CircularLeakageLine
Definition: leakage_line.h:85
MBSimHydraulics::PlaneLeakageLine
Definition: leakage_line.h:67
MBSimHydraulics::CircularLeakagePressureLoss
Definition: pressure_loss.h:294