23 #include "mbsim/links/link.h" 24 #include <mbsim/functions/function.h> 26 #include <mbsim/utils/boost_parameters.h> 27 #include <mbsim/utils/openmbv_utils.h> 34 class GeneralizedForceLaw;
35 class GeneralizedImpactLaw;
38 namespace MBSimHydraulics {
40 BOOST_PARAMETER_NAME(size)
41 BOOST_PARAMETER_NAME(minimalPressure)
42 BOOST_PARAMETER_NAME(maximalPressure)
43 BOOST_PARAMETER_NAME(position)
45 class HydraulicEnvironment;
61 void calcSize()
override;
63 BOOST_PARAMETER_MEMBER_FUNCTION( (
void), enableOpenMBVSphere, tag, (optional (size,(
double),1)(minimalPressure,(
double),0e5)(maximalPressure,(
double),10e5)(position,(
const fmatvec::Vec3&),fmatvec::Vec3()))) {
64 enableOpenMBV(size,minimalPressure,maximalPressure,position);
66 virtual void enableOpenMBV(
double size,
double pMin,
double pMax,
const fmatvec::Vec3 &WrON);
68 void addInFlow(
HLine * in);
69 void addOutFlow(
HLine * out);
71 void calcgdSize(
int j)
override {
gdSize=1; }
73 void init(
InitStage stage,
const MBSim::InitConfigSet &config)
override;
75 void updateWRef(fmatvec::Mat& WRef,
int i=0)
override;
76 void updateVRef(fmatvec::Mat& VRef,
int i=0)
override;
77 void updatehRef(fmatvec::Vec& hRef,
int i=0)
override;
78 void updaterRef(fmatvec::Vec& rRef,
int i=0)
override;
79 void updatedhdqRef(fmatvec::Mat& dhdqRef,
int i=0);
80 void updatedhduRef(fmatvec::SqrMat& dhduRef,
int i=0);
81 void updatedhdtRef(fmatvec::Vec& dhdtRef,
int i=0);
83 double evalQHyd() {
if(updQHyd) updateQHyd();
return QHyd; }
84 double getQHyd(
bool check=
true)
const { assert((not check) or (not updQHyd));
return QHyd; }
85 virtual void updateQHyd();
87 void updateh(
int j=0)
override;
89 void updategd()
override;
90 bool isActive()
const override {
return false; }
91 bool gActiveChanged()
override {
return false; }
95 void initializeUsingXML(xercesc::DOMElement *element)
override;
97 void resetUpToDate()
override { MBSim::Link::resetUpToDate(); updQHyd =
true; }
101 std::vector<connectedLinesStruct> connectedLines;
102 std::vector<connectedLinesStruct> connected0DOFLines;
103 std::vector<std::string> refInflowString;
104 std::vector<std::string> refOutflowString;
108 std::shared_ptr<OpenMBV::Group> openMBVGrp;
109 std::shared_ptr<OpenMBV::Sphere> openMBVSphere;
122 pFun->setParent(
this);
126 void updateGeneralizedForces()
override;
127 void init(
InitStage stage,
const MBSim::InitConfigSet &config)
override;
128 void initializeUsingXML(xercesc::DOMElement *element)
override;
129 bool isSingleValued()
const override {
return true;}
141 void init(
InitStage stage,
const MBSim::InitConfigSet &config)
override;
143 bool isSingleValued()
const override {
return true;}
153 void setVolume(
double V_) {V=V_; }
154 void setFracAir(
double fracAir_) {fracAir=fracAir_; }
155 void setp0(
double p0_) {p0=p0_; }
157 void calcxSize()
override {
xSize=1; }
159 void init(
InitStage stage,
const MBSim::InitConfigSet &config)
override;
160 void initializeUsingXML(xercesc::DOMElement *element)
override;
162 void updateGeneralizedForces()
override;
164 void updatexd()
override;
166 void plot()
override;
168 bool isSingleValued()
const override {
return true;}
184 bool isSetValued()
const override {
return true; }
185 bool isActive()
const override {
return true; }
187 void init(
InitStage stage,
const MBSim::InitConfigSet &config)
override;
189 void calclaSize(
int j)
override;
191 void calcrFactorSize(
int j)
override {
rFactorSize=1; }
192 void calccorrSize(
int j)
override;
194 void updateGeneralizedForces()
override;
196 void updategd()
override;
197 void updateW(
int j=0)
override;
199 void updaterFactors()
override;
200 void solveImpactsFixpointSingle()
override;
201 void solveConstraintsFixpointSingle()
override;
202 void solveImpactsGaussSeidel()
override;
203 void solveConstraintsGaussSeidel()
override;
204 void solveImpactsRootFinding()
override;
205 void solveConstraintsRootFinding()
override;
206 void jacobianImpacts()
override;
207 void jacobianConstraints()
override;
208 void checkImpactsForTermination()
override;
209 void checkConstraintsForTermination()
override;
210 const double& evalgdn();
211 const double& evalgdd();
225 void setCavitationPressure(
double pCav_) {pCav=pCav_; }
227 bool isSetValued()
const override {
return true; }
228 bool isSingleValued()
const override {
return true; }
229 bool isActive()
const override {
return active; }
231 void calcxSize()
override {
xSize=1; }
232 void calcgSize(
int j)
override {
gSize=1; }
234 void calclaSize(
int j)
override {
laSize=1; }
236 void calcrFactorSize(
int j)
override {
rFactorSize=1; }
237 void calcsvSize()
override {
svSize=1; }
239 void init(
InitStage stage,
const MBSim::InitConfigSet &config)
override;
240 void initializeUsingXML(xercesc::DOMElement *element)
override;
241 void plot()
override;
243 void checkActive(
int j)
override;
245 bool gActiveChanged()
override;
247 void updateGeneralizedForces()
override;
248 void updateg()
override;
249 void updateW(
int j=0)
override;
250 void updatexd()
override;
251 void updateStopVector()
override;
252 void checkRoot()
override;
254 void updaterFactors()
override;
255 void solveImpactsFixpointSingle()
override;
256 void solveConstraintsFixpointSingle()
override;
257 void solveImpactsGaussSeidel()
override;
258 void solveConstraintsGaussSeidel()
override;
259 void solveImpactsRootFinding()
override;
260 void solveConstraintsRootFinding()
override;
261 void jacobianImpacts()
override;
262 void jacobianConstraints()
override;
263 void checkImpactsForTermination()
override;
264 void checkConstraintsForTermination()
override;
265 const double& evalgdn();
266 const double& evalgdd();
271 bool active, active0;
283 void setpFunction(
MBSim::Function<
double(
double)> *pFunction_) { pFunction=pFunction_; }
285 void init(
InitStage stage,
const MBSim::InitConfigSet &config)
override;
287 void updateGeneralizedForces()
override;
288 void initializeUsingXML(xercesc::DOMElement *element)
override;
Definition: environment.h:95
void setName(const std::string &str)
Definition: environment.h:31