MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Wheel2 Class Reference
Inheritance diagram for Wheel2:
Collaboration diagram for Wheel2:

Public Member Functions

 Wheel2 (unsigned uLabel, const DofOwner *pDO, DataManager *pDM, MBDynParser &HP)
 
virtual ~Wheel2 (void)
 
virtual void Output (OutputHandler &OH) const
 
virtual void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
unsigned int iGetNumPrivData (void) const
 
int iGetNumConnectedNodes (void) const
 
void GetConnectedNodes (std::vector< const Node * > &connectedNodes) const
 
void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph)
 
std::ostream & Restart (std::ostream &out) const
 
virtual unsigned int iGetInitialNumDof (void) const
 
virtual void InitialWorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
VariableSubMatrixHandlerInitialAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
SubVectorHandlerInitialAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr)
 
- Public Member Functions inherited from Elem
 Elem (unsigned int uL, flag fOut)
 
virtual ~Elem (void)
 
virtual unsigned int iGetNumDof (void) const
 
virtual std::ostream & DescribeDof (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeDof (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual std::ostream & DescribeEq (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeEq (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual DofOrder::Order GetDofType (unsigned int) const
 
virtual void AssMats (VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual bool bInverseDynamics (void) const
 
void SetInverseDynamicsFlags (unsigned uIDF)
 
unsigned GetInverseDynamicsFlags (void) const
 
bool bIsErgonomy (void) const
 
bool bIsRightHandSide (void) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, const VectorHandler &XPrimePrimeCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
 
virtual int GetNumConnectedNodes (void) const
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 
- Public Member Functions inherited from SimulationEntity
 SimulationEntity (void)
 
virtual ~SimulationEntity (void)
 
virtual bool bIsValidIndex (unsigned int i) const
 
virtual DofOrder::Order GetEqType (unsigned int i) const
 
virtual HintParseHint (DataManager *pDM, const char *s) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
virtual void Update (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void DerivativesUpdate (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Update (const VectorHandler &XCurr, InverseDynamics::Order iOrder)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, const VectorHandler &XPP)
 
virtual unsigned int iGetPrivDataIdx (const char *s) const
 
virtual doublereal dGetPrivData (unsigned int i) const
 
virtual std::ostream & OutputAppend (std::ostream &out) const
 
virtual void ReadInitialState (MBDynParser &HP)
 
- Public Member Functions inherited from ToBeOutput
 ToBeOutput (flag fOut=fDefaultOut)
 
virtual ~ToBeOutput (void)
 
virtual void OutputPrepare (OutputHandler &OH)
 
virtual void Output (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
virtual flag fToBeOutput (void) const
 
virtual bool bToBeOutput (void) const
 
virtual void SetOutputFlag (flag f=flag(1))
 
- Public Member Functions inherited from UserDefinedElem
 UserDefinedElem (unsigned uLabel, const DofOwner *pDO)
 
virtual ~UserDefinedElem (void)
 
bool NeedsAirProperties (void) const
 
void NeedsAirProperties (bool yesno)
 
virtual Elem::Type GetElemType (void) const
 
virtual AerodynamicElem::Type GetAerodynamicElemType (void) const
 
- Public Member Functions inherited from InitialAssemblyElem
 InitialAssemblyElem (unsigned int uL, flag fOut)
 
virtual ~InitialAssemblyElem (void)
 
- Public Member Functions inherited from SubjectToInitialAssembly
 SubjectToInitialAssembly (void)
 
virtual ~SubjectToInitialAssembly (void)
 
- Public Member Functions inherited from AerodynamicElem
 AerodynamicElem (unsigned int uL, const DofOwner *pDO, flag fOut)
 
virtual ~AerodynamicElem (void)
 
virtual const InducedVelocitypGetInducedVelocity (void) const
 
- Public Member Functions inherited from ElemWithDofs
 ElemWithDofs (unsigned int uL, const DofOwner *pDO, flag fOut)
 
virtual ~ElemWithDofs (void)
 
- Public Member Functions inherited from DofOwnerOwner
 DofOwnerOwner (const DofOwner *pDO)
 
virtual ~DofOwnerOwner ()
 
virtual const DofOwnerpGetDofOwner (void) const
 
virtual integer iGetFirstIndex (void) const
 
virtual void SetInitialValue (VectorHandler &X)
 
- Public Member Functions inherited from AirPropOwner
 AirPropOwner (void)
 
virtual ~AirPropOwner (void)
 
virtual void PutAirProperties (const AirProperties *pAP)
 
virtual flag fGetAirVelocity (Vec3 &Velocity, const Vec3 &X) const
 
virtual doublereal dGetAirDensity (const Vec3 &X) const
 
virtual doublereal dGetAirPressure (const Vec3 &X) const
 
virtual doublereal dGetAirTemperature (const Vec3 &X) const
 
virtual doublereal dGetSoundSpeed (const Vec3 &X) const
 
virtual bool GetAirProps (const Vec3 &X, doublereal &rho, doublereal &c, doublereal &p, doublereal &T) const
 
- Public Member Functions inherited from ElemGravityOwner
 ElemGravityOwner (unsigned int uL, flag fOut)
 
virtual ~ElemGravityOwner (void)
 
virtual doublereal dGetM (void) const
 
Vec3 GetS (void) const
 
Mat3x3 GetJ (void) const
 
Vec3 GetB (void) const
 
Vec3 GetG (void) const
 
- Public Member Functions inherited from GravityOwner
 GravityOwner (void)
 
virtual ~GravityOwner (void)
 
void PutGravity (const Gravity *pG)
 
virtual bool bGetGravity (const Vec3 &X, Vec3 &Acc) const
 

Private Attributes

const StructNodepWheel
 
Vec3 WheelAxle
 
const StructNodepGround
 
Vec3 GroundPosition
 
Vec3 GroundDirection
 
doublereal dRadius
 
doublereal dInternalRadius
 
doublereal dVolCoef
 
doublereal dRefArea
 
doublereal dRNP
 
doublereal dV0
 
doublereal dP0
 
doublereal dGamma
 
doublereal dHystVRef
 
bool bSlip
 
const DriveCallerpMuX0
 
const DriveCallerpMuY0
 
const DriveCallerpMuY1
 
doublereal dvThreshold
 
Vec3 F
 
Vec3 M
 
doublereal dInstRadius
 
doublereal dDeltaL
 
doublereal dVn
 
doublereal dSr
 
doublereal dAlpha
 
doublereal dAlphaThreshold
 
doublereal dMuX
 
doublereal dMuY
 
doublereal dVa
 
doublereal dVc
 

Additional Inherited Members

- Public Types inherited from Elem
enum  Type {
  UNKNOWN = -1, AIRPROPERTIES = 0, INDUCEDVELOCITY, AUTOMATICSTRUCTURAL,
  GRAVITY, BODY, JOINT, JOINT_REGULARIZATION,
  BEAM, PLATE, FORCE, INERTIA,
  ELECTRICBULK, ELECTRIC, THERMAL, HYDRAULIC,
  BULK, LOADABLE, DRIVEN, EXTERNAL,
  AEROMODAL, AERODYNAMIC, GENEL, SOCKETSTREAM_OUTPUT,
  RTAI_OUTPUT = SOCKETSTREAM_OUTPUT, LASTELEMTYPE
}
 
- Public Types inherited from SimulationEntity
typedef std::vector< Hint * > Hints
 
- Public Types inherited from ToBeOutput
enum  { OUTPUT = 0x1U, OUTPUT_MASK = 0xFU, OUTPUT_PRIVATE = 0x10U, OUTPUT_PRIVATE_MASK = ~OUTPUT_MASK }
 
- Public Types inherited from AerodynamicElem
enum  Type {
  UNKNOWN = -1, INDUCEDVELOCITY = 0, AEROMODAL, AERODYNAMICBODY,
  AERODYNAMICBEAM, AERODYNAMICEXTERNAL, AERODYNAMICEXTERNALMODAL, AERODYNAMICLOADABLE,
  AIRCRAFTINSTRUMENTS, GENERICFORCE, LASTAEROTYPE
}
 
- Protected Member Functions inherited from ElemGravityOwner
virtual Vec3 GetS_int (void) const
 
virtual Mat3x3 GetJ_int (void) const
 
virtual Vec3 GetB_int (void) const
 
virtual Vec3 GetG_int (void) const
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from UserDefinedElem
bool needsAirProperties
 
- Protected Attributes inherited from AirPropOwner
const AirPropertiespAirProperties
 
- Protected Attributes inherited from GravityOwner
GravitypGravity
 

Detailed Description

Definition at line 44 of file module-wheel2.cc.

Constructor & Destructor Documentation

Wheel2::Wheel2 ( unsigned  uLabel,
const DofOwner pDO,
DataManager pDM,
MBDynParser HP 
)

Definition at line 130 of file module-wheel2.cc.

References bSlip, dAlphaThreshold, dGamma, dHystVRef, dInternalRadius, Vec3::Dot(), dP0, dRadius, dRefArea, dRNP, dV0, dVolCoef, dvThreshold, DataManager::fReadOutput(), MBDynParser::GetDriveCaller(), WithLabel::GetLabel(), IncludeParser::GetLineData(), DataManager::GetLogFile(), MBDynParser::GetPosRel(), HighParser::GetReal(), MBDynParser::GetVecRel(), GroundDirection, GroundPosition, HighParser::IsArg(), HighParser::IsKeyWord(), Elem::LOADABLE, M_PI, MBDYN_EXCEPT_ARGS, pGround, pMuX0, pMuY0, pMuY1, pWheel, DataManager::ReadNode(), ToBeOutput::SetOutputFlag(), grad::sqrt(), Node::STRUCTURAL, and WheelAxle.

132 : Elem(uLabel, flag(0)),
134 {
135  // help
136  if (HP.IsKeyWord("help")) {
137  silent_cout(
138 " \n"
139 "Module: wheel2 \n"
140 "Author: Stefania Gualdi <gualdi@aero.polimi.it> \n"
141 " Pierangelo Masarati <masarati@aero.polimi.it> \n"
142 "Organization: Dipartimento di Ingegneria Aerospaziale \n"
143 " Politecnico di Milano \n"
144 " http://www.aero.polimi.it \n"
145 " \n"
146 " All rights reserved \n"
147 " \n"
148 "Connects 2 structural nodes: \n"
149 " - Wheel \n"
150 " - Ground \n"
151 " \n"
152 "Note: \n"
153 " - The Axle and the Wheel structural nodes must be connected \n"
154 " by a joint that allows relative rotations only about \n"
155 " one axis (the axle) \n"
156 " - The center of the wheel is assumed coincident with \n"
157 " the position of the wheel structural node \n"
158 " - The Ground structural node supports a plane defined \n"
159 " a point and a direction orthogonal to the plane (future \n"
160 " versions might use an arbitrary, deformable surface) \n"
161 " - The forces are applied at the \"contact point\", that \n"
162 " is defined according to geometrical properties \n"
163 " of the system and according to the relative position \n"
164 " and orientation of the Wheel and Ground structural nodes \n"
165 " \n"
166 " - Input: \n"
167 " <wheel structural node label> , \n"
168 " <wheel axle direction> , \n"
169 " <ground structural node label> , \n"
170 " <reference point position of the ground plane> , \n"
171 " <direction orthogonal to the ground plane> , \n"
172 " <wheel radius> , \n"
173 " <torus radius> , \n"
174 " <volume coefficient (black magic?)> , \n"
175 " <tire pressure> , \n"
176 " <tire polytropic exponent> , \n"
177 " <reference velocity for tire hysteresis> \n"
178 " [ slip , \n"
179 " <longitudinal friction coefficient drive> \n"
180 " <lateral friction coefficient drive for s.r.=0> \n"
181 " <lateral friction coefficient drive for s.r.=1> \n"
182 " [ , threshold , <slip ratio velocity threshold> , \n"
183 " <slip angle velocity threshold> ] ] \n"
184 " \n"
185 " - Output: \n"
186 " 1) element label \n"
187 " 2-4) tire force in global reference frame \n"
188 " 5-7) tire couple in global reference frame \n"
189 " 8) effective radius \n"
190 " 9) tire radial deformation \n"
191 " 10) tire radial deformation velocity \n"
192 " 11) slip ratio \n"
193 " 12) slip angle \n"
194 " 13) longitudinal friction coefficient \n"
195 " 14) lateral friction coefficient \n"
196 " 15) axis relative tangential velocity \n"
197 " 16) point of contact relative tangential velocity \n"
198  << std::endl);
199 
200  if (!HP.IsArg()) {
201  /*
202  * Exit quietly if nothing else is provided
203  */
204  throw NoErr(MBDYN_EXCEPT_ARGS);
205  }
206  }
207 
208  // read wheel node
209  pWheel = dynamic_cast<const StructNode *>(pDM->ReadNode(HP, Node::STRUCTURAL));
210 
211  // read wheel axle
213  WheelAxle = HP.GetVecRel(RF);
214 
215  // read ground node
216  pGround = dynamic_cast<const StructNode *>(pDM->ReadNode(HP, Node::STRUCTURAL));
217 
218  // read ground position/orientation
219  RF = ReferenceFrame(pGround);
220  GroundPosition = HP.GetPosRel(RF);
221  GroundDirection = HP.GetVecRel(RF);
222 
223  // normalize ground orientation
225  if (d <= std::numeric_limits<doublereal>::epsilon()) {
226  silent_cerr("Wheel2(" << uLabel << "): "
227  "null direction at line " << HP.GetLineData()
228  << std::endl);
230  }
231  GroundDirection /= sqrt(d);
232 
233  // wheel geometry
234  dRadius = HP.GetReal();
235  dInternalRadius = HP.GetReal();
236  dVolCoef = HP.GetReal();
237 
238  // reference area
240 
241  // parameter required to compute Delta L
243 
244  // reference volume
247 
248  // tyre properties
249  dP0 = HP.GetReal();
250  dGamma = HP.GetReal();
251  dHystVRef = HP.GetReal();
252 
253  // friction
254  bSlip = false;
255  if (HP.IsKeyWord("slip")) {
256  bSlip = true;
257 
258  /*
259  * Parametri di attrito
260  */
261  pMuX0 = HP.GetDriveCaller();
262  pMuY0 = HP.GetDriveCaller();
263  pMuY1 = HP.GetDriveCaller();
264 
265  dvThreshold = 0.;
266  dAlphaThreshold = 0.;
267  if (HP.IsKeyWord("threshold")) {
268  dvThreshold = HP.GetReal();
269  if (dvThreshold < 0.) {
270  silent_cerr("Wheel2(" << uLabel << "): "
271  "illegal velocity threshold " << dvThreshold
272  << " at line " << HP.GetLineData() << std::endl);
273  dvThreshold = std::abs(dvThreshold);
274  }
275 
276  dAlphaThreshold = HP.GetReal();
277  if (dvThreshold < 0.) {
278  silent_cerr("Wheel2(" << uLabel << "): "
279  "illegal slip angle threshold " << dAlphaThreshold
280  << " at line " << HP.GetLineData() << std::endl);
281  dAlphaThreshold = std::abs(dAlphaThreshold);
282  }
283  }
284  }
285 
287 
288  std::ostream& out = pDM->GetLogFile();
289  out << "wheel2: " << uLabel
290  << " " << pWheel->GetLabel() //node label
291  << " " << WheelAxle //wheel axle
292  << " " << pGround->GetLabel() //ground label
293  << " " << GroundDirection //ground direction
294  << " " << dRadius //wheel radius
295  << " " << dInternalRadius //wheel internal radius
296  << std::endl;
297 }
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
Vec3 GroundPosition
#define M_PI
Definition: gradienttest.cc:67
long int flag
Definition: mbdyn.h:43
const DriveCaller * pMuX0
const DriveCaller * pMuY1
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
doublereal Dot(const Vec3 &v) const
Definition: matvec3.h:243
const StructNode * pGround
bool bSlip
doublereal dP0
doublereal dvThreshold
const StructNode * pWheel
const DriveCaller * pMuY0
Vec3 GetPosRel(const ReferenceFrame &rf)
Definition: mbpar.cc:1331
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
doublereal dVolCoef
doublereal dAlphaThreshold
doublereal dRadius
doublereal dGamma
doublereal dRNP
unsigned int uLabel
Definition: withlab.h:44
doublereal dV0
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
Definition: except.h:79
doublereal dHystVRef
Vec3 WheelAxle
Vec3 GetVecRel(const ReferenceFrame &rf)
Definition: mbpar.cc:1584
Vec3 GroundDirection
virtual bool IsArg(void)
Definition: parser.cc:807
std::ostream & GetLogFile(void) const
Definition: dataman.h:326
doublereal dRefArea
UserDefinedElem(unsigned uLabel, const DofOwner *pDO)
Definition: userelem.cc:152
DriveCaller * GetDriveCaller(bool bDeferred=false)
Definition: mbpar.cc:2033
doublereal dInternalRadius
virtual void SetOutputFlag(flag f=flag(1))
Definition: output.cc:896
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
double doublereal
Definition: colamd.c:52
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
unsigned int GetLabel(void) const
Definition: withlab.cc:62
Node * ReadNode(MBDynParser &HP, Node::Type type) const
Definition: dataman3.cc:2309
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:

Wheel2::~Wheel2 ( void  )
virtual

Definition at line 299 of file module-wheel2.cc.

References NO_OP.

300 {
301  NO_OP;
302 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

VariableSubMatrixHandler & Wheel2::AssJac ( VariableSubMatrixHandler WorkMat,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 334 of file module-wheel2.cc.

References VariableSubMatrixHandler::SetNullMatrix().

338 {
339  WorkMat.SetNullMatrix();
340 
341  return WorkMat;
342 }
void SetNullMatrix(void)
Definition: submat.h:1159

Here is the call graph for this function:

SubVectorHandler & Wheel2::AssRes ( SubVectorHandler WorkVec,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 345 of file module-wheel2.cc.

References VectorHandler::Add(), grad::atan2(), bSlip, copysign(), Vec3::Cross(), grad::Cross(), dAlpha, dAlphaThreshold, dDeltaL, dGamma, DriveCaller::dGet(), dHystVRef, dInstRadius, dInternalRadius, dMuX, dMuY, Vec3::Dot(), dP0, dRadius, dRefArea, dRNP, dSr, dV0, dVa, dVc, dVn, dvThreshold, F, WithLabel::GetLabel(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), GroundDirection, GroundPosition, StructDispNode::iGetFirstMomentumIndex(), M, MBDYN_EXCEPT_ARGS, grad::Norm(), pGround, pMuX0, pMuY0, pMuY1, grad::pow(), SubVectorHandler::PutRowIndex(), pWheel, VectorHandler::Resize(), VectorHandler::ResizeReset(), grad::sqrt(), VectorHandler::Sub(), grad::tanh(), WheelAxle, WorkSpaceDim(), and Zero3.

349 {
350  // ground orientation in the absolute frame
352 
353  // wheel-ground distance in the absolute frame
354  Vec3 x = pWheel->GetXCurr() - pGround->GetXCurr();
355 
356  // contact when dDeltaL > 0
357  dDeltaL = dRNP - x*n;
358 
359  // reset output data
361 
362  dSr = 0.;
363  dAlpha = 0.;
364 
365  dMuX = 0.;
366  dMuY = 0.;
367 
368  dVa = 0.;
369  dVc = 0.;
370 
371  if (dDeltaL < 0.) {
372 
373  F = Zero3;
374  M = Zero3;
375 
377  dDeltaL = 0.;
378 
379  // no need to assemble residual contribution
380  WorkVec.Resize(0);
381 
382  return WorkVec;
383  }
384 
385  // resize residual
386  integer iNumRows = 0;
387  integer iNumCols = 0;
388  WorkSpaceDim(&iNumRows, &iNumCols);
389 
390  WorkVec.ResizeReset(iNumRows);
391 
392  integer iGroundFirstMomIndex = pGround->iGetFirstMomentumIndex();
393  integer iWheelFirstMomIndex = pWheel->iGetFirstMomentumIndex();
394 
395  // equations indexes
396  for (int iCnt = 1; iCnt <= 6; iCnt++) {
397  WorkVec.PutRowIndex(iCnt, iGroundFirstMomIndex + iCnt);
398  WorkVec.PutRowIndex(6 + iCnt, iWheelFirstMomIndex + iCnt);
399  }
400 
401  // relative speed between wheel axle and ground
402  Vec3 va = pWheel->GetVCurr() - pGround->GetVCurr()
404 
405  dVa = (va - n*(n*va)).Norm();
406 
407  // relative speed between wheel and ground at contact point
408  Vec3 v = va - (pWheel->GetWCurr()).Cross(n*dInstRadius);
409 
410  // normal component of relative speed
411  // (positive when wheel departs from ground)
412  dVn = n*v;
413 
414  dVc = (v - n*dVn).Norm();
415 
416  // estimated contact area
417  doublereal dA = dRefArea*(dDeltaL/dInternalRadius);
418 
419  // estimated intersection volume
420  doublereal dDeltaV = .5*dA*dDeltaL;
421 
422  // estimated tyre pressure (polytropic)
423  doublereal dP = dP0*pow(dV0/(dV0 - dDeltaV), dGamma);
424 
425  // we assume the contact point lies at the root of the normal
426  // to the ground that passes through the center of the wheel
427  // this means that the axle needs to remain parallel to the ground
428  Vec3 pc = pWheel->GetXCurr() - (n*dInstRadius);
429 
430  // force
431  doublereal dFn = (dA*dP*(1. - tanh(dVn/dHystVRef)));
432  F = n*dFn;
433 
434  if (bSlip) {
435  // "forward" direction: axle cross normal to ground
436  Vec3 fwd = (pWheel->GetRCurr()*WheelAxle).Cross(n);
437  doublereal d = fwd.Dot();
438  if (d < std::numeric_limits<doublereal>::epsilon()) {
439  silent_cerr("Wheel2(" << GetLabel() << "): "
440  "wheel axle is (neraly) orthogonal "
441  "to the ground" << std::endl);
443  }
444  fwd /= sqrt(d);
445 
446  // slip ratio
447  doublereal dvx = fwd.Dot(v);
448  doublereal sgn = copysign(1., dvx);
449  doublereal dfvx = std::abs(dvx);
450  doublereal dvax = fwd.Dot(va);
451  doublereal dfvax = std::abs(dvax);
452 
453  // FIXME: if vax ~ 0 (e.g. because the vehicle stopped)
454  // the "sleep" ratio needs to be small, right?
455  dSr = dfvx/(dfvax + dvThreshold);
456  if (dSr > 1.) {
457  dSr = 1.;
458  }
459 
460  // "lateral" direction: normal to ground cross forward
461  Vec3 lat = n.Cross(fwd);
462 
463  // lateral speed of wheel center
464  doublereal dvay = lat.Dot(va);
465 
466  // wheel center drift angle
467  // NOTE: the angle is restricted to the first quadran
468  // the angle goes to zero when the velocity is below threshold
469  dAlpha = atan2(dvay, std::abs(dvax));
470  if (dAlphaThreshold > 0.) {
471  doublereal dtmp = tanh(sqrt(dvax*dvax + dvay*dvay)/dAlphaThreshold);
472  dAlpha *= dtmp*dtmp;
473  }
474 
475  // longitudinal friction coefficient
476  doublereal dMuX0 = pMuX0->dGet(dSr);
477 
478  // NOTE: -1 < alpha/(pi/2) < 1
479  dMuX = dMuX0*sgn*(1. - std::abs(dAlpha)/M_PI_2);
480 
481  // force correction: the longitudinal friction coefficient
482  // is used with the sign of the contact point relative speed
483  F -= fwd*dFn*dMuX;
484 
485  if (dvay != 0.) {
486  doublereal dMuY0 = pMuY0->dGet(dAlpha);
487  doublereal dMuY1 = pMuY1->dGet(dAlpha);
488 
489  dMuY = dMuY0 + (dMuY1 - dMuY0)*dSr;
490 
491  // force correction
492  F -= lat*dFn*dMuY;
493  }
494  }
495 
496  // moment
497  M = (pc - pWheel->GetXCurr()).Cross(F);
498 
499  WorkVec.Sub(1, F);
500  WorkVec.Sub(4, (pc - pGround->GetXCurr()).Cross(F));
501  WorkVec.Add(7, F);
502  WorkVec.Add(10, M);
503 
504  return WorkVec;
505 }
GradientExpression< UnaryExpr< FuncTanh, Expr > > tanh(const GradientExpression< Expr > &u)
Definition: gradient.h:2982
Vec3 GroundPosition
doublereal dInstRadius
const Vec3 Zero3(0., 0., 0.)
doublereal dVn
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
const DriveCaller * pMuX0
GradientExpression< BinaryExpr< FuncPow, LhsExpr, RhsExpr > > pow(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2961
const DriveCaller * pMuY1
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
doublereal Dot(const Vec3 &v) const
Definition: matvec3.h:243
doublereal dDeltaL
const StructNode * pGround
bool bSlip
doublereal dP0
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
doublereal dVc
doublereal dMuX
doublereal dVa
doublereal dvThreshold
const StructNode * pWheel
const DriveCaller * pMuY0
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
doublereal copysign(doublereal x, doublereal y)
Definition: gradient.h:97
doublereal dAlphaThreshold
doublereal dRadius
doublereal dGamma
doublereal dRNP
virtual integer iGetFirstMomentumIndex(void) const =0
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
doublereal dV0
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
VectorExpression< VectorCrossExpr< VectorLhsExpr, VectorRhsExpr >, 3 > Cross(const VectorExpression< VectorLhsExpr, 3 > &u, const VectorExpression< VectorRhsExpr, 3 > &v)
Definition: matvec.h:3248
doublereal dMuY
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
doublereal dHystVRef
virtual doublereal dGet(const doublereal &dVar) const =0
Vec3 WheelAxle
VectorExpression< VectorExpr, N_rows >::ScalarType Norm(const VectorExpression< VectorExpr, N_rows > &u)
Definition: matvec.h:3163
Vec3 GroundDirection
doublereal dAlpha
doublereal dRefArea
doublereal dSr
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
doublereal dInternalRadius
GradientExpression< BinaryExpr< FuncAtan2, LhsExpr, RhsExpr > > atan2(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2962
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62
virtual void Resize(integer iNewSize)=0

Here is the call graph for this function:

void Wheel2::GetConnectedNodes ( std::vector< const Node * > &  connectedNodes) const
virtual

Reimplemented from Elem.

Definition at line 521 of file module-wheel2.cc.

References pGround, and pWheel.

522 {
523  // wheel + ground
524  connectedNodes.resize(2);
525 
526  connectedNodes[0] = pWheel;
527  connectedNodes[1] = pGround;
528 }
const StructNode * pGround
const StructNode * pWheel
unsigned Wheel2::iGetInitialNumDof ( void  ) const
virtual

Implements SubjectToInitialAssembly.

Definition at line 545 of file module-wheel2.cc.

546 {
547  return 0;
548 }
int Wheel2::iGetNumConnectedNodes ( void  ) const

Definition at line 514 of file module-wheel2.cc.

515 {
516  // wheel + ground
517  return 2;
518 }
unsigned int Wheel2::iGetNumPrivData ( void  ) const
virtual

Reimplemented from SimulationEntity.

Definition at line 508 of file module-wheel2.cc.

509 {
510  return 0;
511 }
VariableSubMatrixHandler & Wheel2::InitialAssJac ( VariableSubMatrixHandler WorkMat,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 558 of file module-wheel2.cc.

References VariableSubMatrixHandler::SetNullMatrix().

560 {
561  WorkMat.SetNullMatrix();
562  return WorkMat;
563 }
void SetNullMatrix(void)
Definition: submat.h:1159

Here is the call graph for this function:

SubVectorHandler & Wheel2::InitialAssRes ( SubVectorHandler WorkVec,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 566 of file module-wheel2.cc.

References VectorHandler::Resize().

567 {
568  WorkVec.Resize(0);
569  return WorkVec;
570 }
virtual void Resize(integer iNewSize)=0

Here is the call graph for this function:

void Wheel2::InitialWorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
virtual

Implements SubjectToInitialAssembly.

Definition at line 551 of file module-wheel2.cc.

552 {
553  *piNumRows = 0;
554  *piNumCols = 0;
555 }
void Wheel2::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 305 of file module-wheel2.cc.

References ToBeOutput::bToBeOutput(), dAlpha, dDeltaL, dInstRadius, dMuX, dMuY, dSr, dVa, dVc, dVn, F, WithLabel::GetLabel(), OutputHandler::Loadable(), M, and M_PI.

306 {
307  if (bToBeOutput()) {
308  std::ostream& out = OH.Loadable();
309 
310  out << std::setw(8) << GetLabel() // 1: label
311  << " " << F // 2-4: force
312  << " " << M // 5-7: moment
313  << " " << dInstRadius // 8: inst. radius
314  << " " << dDeltaL // 9: radial deformation
315  << " " << dVn // 10: radial deformation velocity
316  << " " << dSr // 11: slip ratio
317  << " " << 180./M_PI*dAlpha // 12: slip angle
318  << " " << dMuX // 13: longitudinal friction coefficient
319  << " " << dMuY // 14: lateral friction coefficient
320  << " " << dVa // 15: axis relative velocity
321  << " " << dVc // 16: POC relative velocity
322  << std::endl;
323  }
324 }
doublereal dInstRadius
#define M_PI
Definition: gradienttest.cc:67
doublereal dVn
virtual bool bToBeOutput(void) const
Definition: output.cc:890
doublereal dDeltaL
doublereal dVc
doublereal dMuX
doublereal dVa
std::ostream & Loadable(void) const
Definition: output.h:506
doublereal dMuY
doublereal dAlpha
doublereal dSr
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

std::ostream & Wheel2::Restart ( std::ostream &  out) const
virtual

Implements Elem.

Definition at line 539 of file module-wheel2.cc.

540 {
541  return out << "# not implemented yet" << std::endl;
542 }
void Wheel2::SetValue ( DataManager pDM,
VectorHandler X,
VectorHandler XP,
SimulationEntity::Hints ph 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 531 of file module-wheel2.cc.

References NO_OP.

534 {
535  NO_OP;
536 }
#define NO_OP
Definition: myassert.h:74
void Wheel2::WorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
virtual

Implements Elem.

Definition at line 327 of file module-wheel2.cc.

Referenced by AssRes().

328 {
329  *piNumRows = 12;
330  *piNumCols = 12;
331 }

Member Data Documentation

bool Wheel2::bSlip
private

Definition at line 77 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

doublereal Wheel2::dAlpha
private

Definition at line 90 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

doublereal Wheel2::dAlphaThreshold
private

Definition at line 91 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

doublereal Wheel2::dDeltaL
private

Definition at line 87 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

doublereal Wheel2::dGamma
private

Definition at line 73 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

doublereal Wheel2::dHystVRef
private

Definition at line 74 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

doublereal Wheel2::dInstRadius
private

Definition at line 86 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

doublereal Wheel2::dInternalRadius
private

Definition at line 64 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

doublereal Wheel2::dMuX
private

Definition at line 92 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

doublereal Wheel2::dMuY
private

Definition at line 93 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

doublereal Wheel2::dP0
private

Definition at line 72 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

doublereal Wheel2::dRadius
private

Definition at line 63 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

doublereal Wheel2::dRefArea
private

Definition at line 67 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

doublereal Wheel2::dRNP
private

Definition at line 68 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

doublereal Wheel2::dSr
private

Definition at line 89 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

doublereal Wheel2::dV0
private

Definition at line 69 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

doublereal Wheel2::dVa
private

Definition at line 94 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

doublereal Wheel2::dVc
private

Definition at line 95 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

doublereal Wheel2::dVn
private

Definition at line 88 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

doublereal Wheel2::dVolCoef
private

Definition at line 65 of file module-wheel2.cc.

Referenced by Wheel2().

doublereal Wheel2::dvThreshold
private

Definition at line 81 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

Vec3 Wheel2::F
private

Definition at line 84 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

Vec3 Wheel2::GroundDirection
private

Definition at line 60 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

Vec3 Wheel2::GroundPosition
private

Definition at line 59 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

Vec3 Wheel2::M
private

Definition at line 85 of file module-wheel2.cc.

Referenced by AssRes(), and Output().

const StructNode* Wheel2::pGround
private

Definition at line 56 of file module-wheel2.cc.

Referenced by AssRes(), GetConnectedNodes(), and Wheel2().

const DriveCaller* Wheel2::pMuX0
private

Definition at line 78 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

const DriveCaller* Wheel2::pMuY0
private

Definition at line 79 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

const DriveCaller* Wheel2::pMuY1
private

Definition at line 80 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().

const StructNode* Wheel2::pWheel
private

Definition at line 50 of file module-wheel2.cc.

Referenced by AssRes(), GetConnectedNodes(), and Wheel2().

Vec3 Wheel2::WheelAxle
private

Definition at line 53 of file module-wheel2.cc.

Referenced by AssRes(), and Wheel2().


The documentation for this class was generated from the following file: