MBSim

Project Page
isotropic_rotational_spring_damper.h
00001 /* Copyright (C) 2004-2012 MBSim Development Team
00002  * This library is free software; you can redistribute it and/or 
00003  * modify it under the terms of the GNU Lesser General Public 
00004  * License as published by the Free Software Foundation; either 
00005  * version 2.1 of the License, or (at your option) any later version. 
00006  *  
00007  * This library is distributed in the hope that it will be useful, 
00008  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00010  * Lesser General Public License for more details. 
00011  *  
00012  * You should have received a copy of the GNU Lesser General Public 
00013  * License along with this library; if not, write to the Free Software 
00014  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
00015  *
00016  * Contact: ghorst@amm.mw.tum.de
00017  */
00018 
00019 #ifndef _ISOTROPICROTATIONALSPRINGDAMPER_H_
00020 #define _ISOTROPICROTATIONALSPRINGDAMPER_H_
00021 
00022 #include "mbsim/link_mechanics.h"
00023 #include "mbsim/frame.h"
00024 
00025 namespace MBSim {
00026 
00037   class IsotropicRotationalSpringDamper : public LinkMechanics {
00038     public:
00043       IsotropicRotationalSpringDamper(const std::string &name);
00044 
00048       virtual ~IsotropicRotationalSpringDamper();
00049 
00050       /* INHERITED INTERFACE OF LINKINTERFACE */
00051       virtual void updateh(double t, int i = 0);
00052       virtual void updateg(double t);
00053       virtual void updategd(double t);
00054       /***************************************************/
00055 
00056       /* INHERITED INTERFACE OF EXTRADYNAMICINTERFACE */
00057       virtual void init(InitStage stage);
00058       /***************************************************/
00059 
00060       /* INHERITED INTERFACE OF LINK */
00061       virtual bool isActive() const {
00062         return true;
00063       }
00064       virtual bool gActiveChanged() {
00065         return false;
00066       }
00067       virtual bool isSingleValued() const {
00068         return true;
00069       }
00070       /***************************************************/
00071 
00072       void connect(Frame *frame1, Frame* frame2);
00073 
00074       /* SETTER */
00075       void setParameters(double c_, double d_, double alpha0_) {
00076         c = c_;
00077         d = d_;
00078         alpha0 = alpha0_;
00079       }
00080       void setMomentDirection(const fmatvec::Mat& md);
00081 
00082     private:
00086       double c, d, alpha0;
00087 
00091       fmatvec::Mat momentDir;
00092       fmatvec::Index IR;
00093 
00097       fmatvec::Mat Wm;
00098 
00099   };
00100 
00101 }
00102 
00103 #endif /* _ISOTROPICROTATIONALSPRINGDAMPER_H_ */
00104