mbsimcontrol  4.0.0
MBSim Control Module
massless_spring_damper.h
1 /* Copyright (C) 2011 Markus Schneider
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  *
18  *
19  * Contact:
20  * schneidm@amm.mw.tu-muenchen.de
21  *
22  */
23 
24 #ifndef _MASSLESS_SPRING_DAMPER_
25 #define _MASSLESS_SPRING_DAMPER_
26 
27 #include "mbsimControl/signal_.h"
28 
29 namespace MBSimControl {
30 
35  class MasslessSpringDamper : public Signal {
36 
37  public:
38  MasslessSpringDamper(const std::string& name="");
39  void initializeUsingXML(xercesc::DOMElement * element);
40 
41  void calcxSize() {xSize=1; }
42 
43  void init(InitStage stage, const MBSim::InitConfigSet &config);
44 
45  void updateSignal() { s = x; upds = false; }
46 
47  void updatexd();
48 
49  void plot();
50 
51  void setSpringStiffness(double c_) {c=c_; }
52  void setBasicSpringForce(double F0_) {F0=F0_; }
53  void setDampingCoefficient(double d_) {dPos=d_; }
54  void setNegativeDampingCoefficient(double d_) {dNeg=d_; }
55  void setFrictionForce(double FFric_) {FFricPos=FFric_; }
56  void setNegativeFrictionForce(double FFric_) {FFricNeg=FFric_; }
57  void setMinimumPositionValue(double xMin_) {xMin=xMin_; }
58  void setMaximumPositionValue(double xMax_) {xMax=xMax_; }
59 
60  void setInputSignal(Signal * inputSignal_) { inputSignal=inputSignal_; }
61  int getSignalSize() const { return inputSignal->getSignalSize(); }
62 
63  private:
64  double c, F0, dPos, dNeg, FFricPos, FFricNeg, xMin, xMax;
65  double xdLocal;
66  Signal * inputSignal;
67  std::string inputSignalString;
68  };
69 }
70 
71 #endif
Signal.
Definition: signal_.h:38
Massless Spring Damper (PT1)
Definition: massless_spring_damper.h:35
std::string name