mbsimhydraulics 4.0.0 MBSim Hydraulics Module

checkvalve.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 _CHECKVALVE_H_
21 #define _CHECKVALVE_H_
22
23 #include "mbsim/group.h"
24 #include <mbsim/functions/function.h>
25
26 namespace MBSim {
27 class Frame;
28 class RigidBody;
29 class Contact;
30 class DirectionalSpringDamper;
31 class GeneralizedImpactLaw;
32 class GeneralizedForceLaw;
33 }
34
35 namespace MBSimControl {
36 class ObjectSensor;
37 }
38
39 namespace MBSimHydraulics {
40
41 class ClosableRigidLine;
42 class CheckvalveClosablePressureLoss;
43
45 class Checkvalve : public MBSim::Group {
46 public:
47 Checkvalve(const std::string &name="");
48
49 void setFrameOfReference(MBSim::Frame * ref);
50 void setLineLength(double lLine);
51 void setLineDiameter(double lDiameter);
52 void setLinePressureLoss(CheckvalveClosablePressureLoss * ccpl);
53 void setLineMinimalXOpen(double xMin);
54 void setLineSetValued(bool setValued=true);
55 void setBallMass(double mBall_);
56 void setBallInitialPosition(double x0Ball_);
57 void setSpringForceFunction(MBSim::Function<double(double,double)> *func);
58 void setSpringUnloadedLength(double l0);
59 void setSeatContactImpactLaw(MBSim::GeneralizedImpactLaw * seatGIL_);
60 void setSeatContactForceLaw(MBSim::GeneralizedForceLaw * seatGFL_);
61 void setMaximalOpening(double hMax_) {hMax=hMax_; }
62 void setMaximalContactImpactLaw(MBSim::GeneralizedImpactLaw * seatGIL_);
63 void setMaximalContactForceLaw(MBSim::GeneralizedForceLaw * seatGFL_);
64 void enableOpenMBVFrames() {openMBVFrames=true; }
65 void enableOpenMBVArrows() {openMBVArrows=true; }
66 void enableOpenMBVBodies() {openMBVBodies=true; }
67
68 ClosableRigidLine * getLine() {return line; }
69 MBSim::RigidBody * getBallSeat() {return ballSeat; }
70 MBSim::RigidBody * getBall() {return ball; }
71 MBSim::Contact * getSeatContact() {return seatContact; }
72 MBSim::Contact * getMaximalContact() {return maxContact; }
73 MBSim::DirectionalSpringDamper * getSpring() {return spring; }
74 MBSimControl::ObjectSensor * getXOpen() {return xOpen; }
75
76 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
77
78 void initializeUsingXML(xercesc::DOMElement * element) override;
79
80 private:
81 ClosableRigidLine * line;
82 MBSim::RigidBody * ballSeat;
83 MBSim::RigidBody * ball;
84 MBSim::Contact * seatContact;
85 MBSim::Contact * maxContact;
86 MBSim::DirectionalSpringDamper * spring;
87 MBSimControl::ObjectSensor * xOpen;
88 unsigned int fromNodeAreaIndex{0}, toNodeAreaIndex{0};
89 double hMax{0}, mBall{0};
90 std::string refFrameString;
91 bool openMBVBodies{false}, openMBVArrows{false}, openMBVFrames{false};
92 };
93
94 }
95
96 #endif /* ----- #ifndef _CHECKVALVE_H_ ----- */
MBSim::GeneralizedForceLaw
MBSimControl::ObjectSensor
MBSim::Contact
MBSim::DirectionalSpringDamper
MBSim::Group
MBSimHydraulics::Checkvalve
Definition: checkvalve.h:45
MBSimHydraulics::ClosableRigidLine
Definition: rigid_line.h:54
MBSim::Element::InitStage
InitStage
MBSim::GeneralizedImpactLaw
MBSim::Function
MBSim::Element::name
std::string name
MBSim::Frame
MBSimHydraulics::CheckvalveClosablePressureLoss
Definition: pressure_loss.h:224
MBSim::RigidBody