mbsimhydraulics  3.0.0
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 MBSimControl {
26  class Signal;
27 }
28 
29 namespace MBSimHydraulics {
30 
31  class LinePressureLoss;
32 
34  class RigidLine : public RigidHLine {
35  public:
36  RigidLine(const std::string &name) : RigidHLine(name), diameter(0), pL(NULL), ReynoldsFactor(0) {}
37  virtual std::string getType() const { return "RigidLine"; }
38 
39  void setDiameter(double diameter_) {diameter=diameter_; }
40  double getDiameter() const {return diameter; }
41  void setLinePressureLoss(LinePressureLoss * pL_) {pL=pL_; }
42 
43  void init(MBSim::InitStage stage);
44 
45  void plot(double t, double dt);
46 
47  void initializeUsingXML(TiXmlElement *element);
48  private:
49  double diameter;
50  LinePressureLoss * pL;
51  double ReynoldsFactor;
52  };
53 
54 
56 
58  class ClosableRigidLine : public RigidLine {
59  public:
60  ClosableRigidLine(const std::string &name) : RigidLine(name), cpL(NULL), cpLSignal(NULL), cpLMinValue(0), cpLBilateral(false), refSignalString("") {}
61  virtual std::string getType() const { return "ClosableRigidLine"; }
62 
63  void setClosablePressureLoss(ClosablePressureLoss * cpL_) {cpL=cpL_; }
64  ClosablePressureLoss * getClosablePressureLoss() const {return cpL; }
65  void setSignal(MBSimControl::Signal * s) {cpLSignal = s; }
66  MBSimControl::Signal * getSignal() const {return cpLSignal; }
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 getRegularizedValue() const;
72 
73  void init(MBSim::InitStage stage);
74 
75  void initializeUsingXML(TiXmlElement *element);
76  private:
78  MBSimControl::Signal * cpLSignal;
79  double cpLMinValue;
80  bool cpLBilateral;
81  std::string refSignalString;
82  };
83 
84 
86 
89  public:
90  UnidirectionalRigidLine(const std::string &name) : RigidLine(name), upL(NULL), dpMin(0) {}
91  virtual std::string getType() const { return "UnidirectionalRigidLine"; }
92 
93  void setUnidirectionalPressureLoss(UnidirectionalPressureLoss * upL_) {upL=upL_; }
94  UnidirectionalPressureLoss * getUnidirectionalPressureLoss() const {return upL; }
95  void setMinimalPressureDrop(double v) {dpMin=v; }
96  double getMinimalPressureDrop() const {return dpMin; }
97 
98  void init(MBSim::InitStage stage);
99 
100  void initializeUsingXML(TiXmlElement *element);
101  private:
103  double dpMin;
104  };
105 
106 }
107 
108 #endif /* ----- #ifndef _RIGID_LINE_H_ ----- */
109