mbsim  4.0.0
MBSim Kernel
tyre_contact.h
1 /* Copyright (C) 2004-2022 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: martin.o.foerg@googlemail.com
18  */
19 
20 #ifndef _TYRE_CONTACT_H
21 #define _TYRE_CONTACT_H
22 
23 #include "mbsim/links/contour_link.h"
24 
25 namespace MBSim {
26 
27  class TyreModel;
28 
29  class TyreContact : public ContourLink {
30  public:
31  TyreContact(const std::string &name="");
32  ~TyreContact();
33 
34  void setTyreModel(TyreModel *model_);
35  TyreModel* getTyreModel() { return model; }
36 
37  void init(InitStage stage, const InitConfigSet &config) override;
38  void initializeUsingXML(xercesc::DOMElement *element) override;
39  void plot() override;
40 
41  void calcSize() override;
42  void calcxSize() override { xSize = 1; }
43  void calcisSize() override;
44 
45  const fmatvec::Vec3& evalForwardVelocity() { if(updfvel) updateForwardVelocity(); return RvC; }
46  fmatvec::Vec3& getForwardVelocity(bool check=true) { assert((not check) or (not updfvel)); return RvC; }
47  double evalsRelax() { if(updla) updateGeneralizedForces(); return sRelax; }
48  double& getsRelax(bool check=true) { assert((not check) or (not updla)); return sRelax; }
49  void updatePositions(Frame *frame) override;
50  void updateGeneralizedPositions() override;
51  void updateGeneralizedVelocities() override;
52  void updateForceDirections() override;
53  void updateForwardVelocity();
54  void updateGeneralizedForces() override;
55  void updateh(int i=0) override;
56 
57  void updatexd() override;
58 
59  bool isActive() const override { return false; }
60  bool gActiveChanged() override { return false; }
61  bool isSingleValued() const override { return true; }
62 
63  void setInitialGuess(const fmatvec::Vec2 &zeta0_) { zeta0 = zeta0_; }
64  void setTolerance(double tol_) { tol = tol_; }
65 
66  void resetUpToDate() override;
67 
68  protected:
69  TyreModel *model{nullptr};
70  fmatvec::Vec3 RvC;
71  double sRelax;
72  bool plane;
73  fmatvec::Vec2 zeta0;
74  double tol{1e-10};
75 
76  bool updfvel{true};
77  };
78 
79 }
80 
81 #endif
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: tyre_contact.cc:50
bool isActive() const override
Definition: tyre_contact.h:59
bool gActiveChanged() override
Definition: tyre_contact.h:60
InitStage
The stages of the initialization.
Definition: element.h:64
Definition: tyre_model.h:27
std::string name
name of element
Definition: element.h:251
void plot() override
plots time dependent data
Definition: tyre_contact.cc:87
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
Definition: tyre_contact.h:29
bool isSingleValued() const override
asks the link if it contains single valued force laws that contribute to the right-hand side vector h
Definition: tyre_contact.h:61
namespace MBSim
Definition: bilateral_constraint.cc:29