00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _GEARING_H_
00021 #define _GEARING_H_
00022
00023 #include "mbsim/link_mechanics.h"
00024 #include "mbsim/rigid_body.h"
00025 #include "mbsim/frame.h"
00026
00027 namespace MBSim {
00028
00029 class Gearing : public LinkMechanics {
00030 protected:
00031 Function2<double,double,double> *func;
00032 double r0, r1;
00033 bool flag;
00034 Frame Z0, Z1;
00035 Frame *P0, *P1;
00036 fmatvec::Vec3 WrP0Z, WrP1Z;
00037 fmatvec::Vec3 Wt;
00038 public:
00039 Gearing(const std::string &name, bool flag = false);
00040 void updateh(double, int i=0);
00041 void updateW(double, int i=0);
00042 void updateJacobians(double t, int j=0);
00043 void updateg(double);
00044 void updategd(double);
00045 void updatewb(double t, int i=0);
00046 void updatehRef(const fmatvec::Vec &hParent, int j=0);
00047 void updateWRef(const fmatvec::Mat &WParent, int j=0);
00048 void connect(double r1, Frame* frame1_, double r2, Frame* frame2_);
00049 virtual void updatexd(double t);
00050 virtual void updatedx(double t, double dt);
00051 virtual void calcxSize();
00052
00053 bool isActive() const { return true; }
00054 bool gActiveChanged() { return false; }
00055 std::string getType() const { return "Gearing"; }
00056 void init(InitStage stage);
00057 bool isSetValued() const;
00058 virtual void calclaSize(int j);
00059 virtual void calcgSize(int j);
00060 virtual void calcgdSize(int j);
00061
00062 void setForceFunction(Function2<double,double,double> *func_) { func=func_; }
00063
00064 void plot(double t, double dt=1);
00065
00066 private:
00067 };
00068
00069 }
00070
00071 #endif