23 #include "mbsim/object.h"
24 #include <mbsim/functions/function.h>
30 namespace MBSimControl {
34 namespace MBSimHydraulics {
37 class HydlinePressureloss;
43 HLine(
const std::string &name) :
MBSim::Object(name), nFrom(NULL), nTo(NULL), nFromRelative(
false), nToRelative(
false), direction(
fmatvec::Vec(3, fmatvec::INIT, 0)), Mlocal(), Jacobian(), frameOfReference(NULL), saved_frameOfReference(
"") {};
44 virtual std::string getType()
const {
return "HLine"; }
47 virtual void updateStateDependentVariables(
double t) {};
48 virtual void updateJacobians(
double t,
int j=0) {};
49 virtual void updateInverseKineticsJacobians(
double t) {};
50 #ifdef HAVE_OPENMBVCPPINTERFACE
51 virtual boost::shared_ptr<OpenMBV::Group> getOpenMBVGrp() {
return boost::shared_ptr<OpenMBV::Group>(); }
56 void setFromNode(
HNode * nFrom_) {nFrom=nFrom_; }
57 void setToNode(
HNode * nTo_) {nTo=nTo_; }
59 HNode * getFromNode() {
return nFrom; }
60 HNode * getToNode() {
return nTo; }
61 void setOutflowRelative(
bool rel=
true) {nToRelative=rel; }
62 void setInflowRelative(
bool rel=
true) {nFromRelative=rel; }
70 void updateM(
double t,
int j=0) {M[j]=Mlocal; }
72 void init(InitStage stage);
73 void initializeUsingXML(xercesc::DOMElement *element);
78 bool nFromRelative, nToRelative;
84 std::string saved_frameOfReference;
91 virtual std::string getType()
const {
return "RigidHLine"; }
93 void setLength(
double length_) {length=length_; }
94 double getLength()
const {
return length; }
95 void addInflowDependencyOnOutflow(
RigidHLine* line);
96 void addInflowDependencyOnInflow(
RigidHLine* line);
102 void calcqSize() {qSize=0; }
103 void calcuSize(
int j=0) {uSize[j]=(dependency.size()?0:1); }
104 fmatvec::Mat calculateJacobian(std::vector<RigidHLine*> dep_check);
106 virtual void updateStateDependentVariables(
double t);
107 void updateh(
double t,
int j=0);
108 void updateM(
double t,
int j=0);
110 void initializeUsingXML(xercesc::DOMElement *element);
111 void init(InitStage stage);
112 void plot(
double t,
double dt);
115 double pressureLossGravity;
118 std::vector<RigidHLine*> dependencyOnOutflow, dependencyOnInflow;
119 std::vector<std::string> refDependencyOnOutflowString, refDependencyOnInflowString;
126 virtual std::string getType()
const {
return "ConstrainedLine"; }
128 void setQFunction(MBSim::Function<
double(
double)> * QFun_) {
130 QFun->setParent(
this);
138 void calcqSize() {qSize=0; }
139 void calcuSize(
int j) {uSize[j]=0; }
141 virtual void updateStateDependentVariables(
double t);
142 void updateh(
double t,
int j=0) {};
144 void initializeUsingXML(xercesc::DOMElement *element);
145 void init(InitStage stage);
148 MBSim::Function<double(double)> * QFun;
155 FluidPump(
const std::string &name=
"") :
HLine(name), QSignal(NULL), QSignalString(
""), Q(1) {}
156 virtual std::string getType()
const {
return "FluidPump"; }
164 void calcqSize() {qSize=0; }
165 void calcuSize(
int j) {uSize[j]=0; }
167 void updateh(
double t,
int j=0) {};
169 void initializeUsingXML(xercesc::DOMElement *element);
170 void init(InitStage stage);
174 std::string QSignalString;
181 StatelessOrifice(
const std::string &name=
"") :
HLine(name), inflowSignal(NULL), outflowSignal(NULL), openingSignal(NULL), inflowSignalString(
""), outflowSignalString(
""), openingSignalString(
""), diameter(0), alpha(0.), calcAreaModus(0) {}
182 virtual std::string getType()
const {
return "StatelessOrifice"; }
186 void setDiameter(
double diameter_) {diameter=diameter_; }
188 void setAlpha(
double alpha_) {alpha=alpha_; }
189 void setCalcAreaModus(
int calcAreaModus_) {calcAreaModus=calcAreaModus_; }
195 void calcqSize() {qSize=0; }
196 void calcuSize(
int j) {uSize[j]=0; }
198 void updateh(
double t,
int j=0) {};
200 void initializeUsingXML(xercesc::DOMElement *element);
201 void init(InitStage stage);
202 void plot(
double t,
double dt);
206 std::string inflowSignalString, outflowSignalString, openingSignalString;
207 double diameter, alpha;
211 double pIn, pOut, dp, sign, opening, area, sqrt_dp;
Vector< Ref, double > Vec