All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
gearing.h
1 /* Copyright (C) 2004-2015 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@gmail.com
18  */
19 
20 #ifndef _GEARING_H_
21 #define _GEARING_H_
22 
23 #include "mbsim/link_mechanics.h"
24 #include "mbsim/rigid_body.h"
25 #include "mbsim/frame.h"
26 
27 namespace MBSim {
28 
29  class Gearing : public LinkMechanics {
30  protected:
31  Function<double(double,double)> *func;
32  double r0, r1;
33  bool reverse;
34  Frame Z0, Z1;
35  Frame *P0, *P1;
36  fmatvec::Vec3 WrP0Z, WrP1Z;
37  fmatvec::Vec3 Wt;
38  public:
39  Gearing(const std::string &name);
40  void updateh(double, int i=0);
41  void updateW(double, int i=0);
42  void updateJacobians(double t, int j=0);
43  void updateg(double);
44  void updategd(double);
45  void updatewb(double t, int i=0);
46  void updatehRef(const fmatvec::Vec &hParent, int j=0);
47  void updateWRef(const fmatvec::Mat &WParent, int j=0);
48  void connect(double r1, Frame* frame1_, double r2, Frame* frame2_);
49  virtual void updatexd(double t);
50  virtual void updatedx(double t, double dt);
51  virtual void calcxSize();
52 
53  bool isActive() const { return true; }
54  bool gActiveChanged() { return false; }
55  std::string getType() const { return "Gearing"; }
56  void init(InitStage stage);
57  bool isSetValued() const;
58  virtual void calclaSize(int j);
59  virtual void calcgSize(int j);
60  virtual void calcgdSize(int j);
61 
62  void setForceFunction(Function<double(double,double)> *func_) {
63  func=func_;
64  func->setParent(this);
65  func->setName("Force");
66  }
67  void setReverse(bool reverse_) { reverse = reverse_; }
68 
69  void plot(double t, double dt=1);
70 
71  private:
72  };
73 
74 }
75 
76 #endif
std::string getType() const
Definition: gearing.h:55
virtual void calcgSize(int j)
calculates size of relative distances
Definition: gearing.cc:49
void init(InitStage stage)
plots time series header
Definition: gearing.cc:217
bool isSetValued() const
asks the link if it contains force laws that contribute to the lagrange multiplier and is therefore s...
Definition: gearing.cc:134
void updatehRef(const fmatvec::Vec &hParent, int j=0)
references to complete and link smooth force vector of dynamic system parent
Definition: gearing.cc:93
bool isActive() const
Definition: gearing.h:53
bool gActiveChanged()
Definition: gearing.h:54
void updateWRef(const fmatvec::Mat &WParent, int j=0)
references to contact force direction matrix of dynamic system parent
Definition: gearing.cc:82
Definition: gearing.h:29
InitStage
The stages of the initialization.
Definition: element.h:97
std::string name
name of element
Definition: element.h:290
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
general link to one or more objects
Definition: link_mechanics.h:48
void plot(double t, double dt=1)
plots time dependent data
Definition: gearing.cc:258
virtual void calcgdSize(int j)
calculates size of gap velocities
Definition: gearing.cc:52
virtual void calclaSize(int j)
calculates size of contact force parameters
Definition: gearing.cc:46

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML