mbsimcontrol  4.0.0
massless_spring_damper.h
00001 /* Copyright (C) 2011 Markus Schneider
00002 
00003  * This library is free software; you can redistribute it and/or 
00004  * modify it under the terms of the GNU Lesser General Public 
00005  * License as published by the Free Software Foundation; either 
00006  * version 2.1 of the License, or (at your option) any later version. 
00007  *  
00008  * This library is distributed in the hope that it will be useful, 
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00011  * Lesser General Public License for more details. 
00012  *  
00013  * You should have received a copy of the GNU Lesser General Public 
00014  * License along with this library; if not, write to the Free Software 
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
00016 
00017  *
00018  *
00019  * Contact:
00020  *   schneidm@amm.mw.tu-muenchen.de
00021  *
00022  */ 
00023 
00024 #ifndef _MASSLESS_SPRING_DAMPER_
00025 #define _MASSLESS_SPRING_DAMPER_
00026 
00027 #include "mbsimControl/signal_processing_system.h"
00028 
00029 namespace MBSimControl {
00030 
00035   class MasslessSpringDamper : public SignalProcessingSystem {
00036 
00037     public:   
00038       MasslessSpringDamper(const std::string& name="");
00039       virtual std::string getType() const {return "MasslessSpringDamper"; }
00040       void initializeUsingXML(xercesc::DOMElement * element);
00041       
00042       void calcxSize() {xSize=1; }
00043       fmatvec::VecV calculateOutput() {return x.copy(); }
00044       
00045       void init(InitStage stage);
00046 
00047       void updatedx(double t, double dt);
00048       void updatexd(double t);
00049       
00050       void plot(double t,double dt);
00051       
00052       void setSpringStiffness(double c_) {c=c_; }
00053       void setBasicSpringForce(double F0_) {F0=F0_; }
00054       void setDampingCoefficient(double d_) {dPos=d_; }
00055       void setNegativeDampingCoefficient(double d_) {dNeg=d_; }
00056       void setFrictionForce(double FFric_) {FFricPos=FFric_; }
00057       void setNegativeFrictionForce(double FFric_) {FFricNeg=FFric_; }
00058       void setMinimumPositionValue(double xMin_) {xMin=xMin_; }
00059       void setMaximumPositionValue(double xMax_) {xMax=xMax_; }
00060 
00061     private:
00062       double c, F0, dPos, dNeg, FFricPos, FFricNeg, xMin, xMax;
00063       double xdLocal;
00064   };
00065 }
00066 
00067 #endif