All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
kinetic_excitation.h
1 /* Copyright (C) 2004-2013 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@googlemail.com
18  */
19 
20 #ifndef _KINETICEXCITATION_H_
21 #define _KINETICEXCITATION_H_
22 
23 #include <mbsim/link_mechanics.h>
24 #include <mbsim/frame.h>
25 #include <mbsim/functions/function.h>
26 
27 #ifdef HAVE_OPENMBVCPPINTERFACE
28 #include "mbsim/utils/boost_parameters.h"
29 #include "mbsim/utils/openmbv_utils.h"
30 #endif
31 
32 namespace MBSim {
33 
41  public:
46  KineticExcitation(const std::string &name="");
47 
51  virtual ~KineticExcitation();
52 
53  /* INHERITED INTERFACE OF LINKINTERFACE */
54  virtual void updateh(double t, int i=0);
55  virtual void updateg(double) {}
56  virtual void updategd(double) {}
57  /***************************************************/
58 
59  /* INHERITED INTERFACE OF EXTRADYNAMICINTERFACE */
60  virtual void init(InitStage stage);
61  /***************************************************/
62 
63  /* INHERITED INTERFACE OF LINK */
64  void calclaSize(int j);
65  bool isActive() const { return true; }
66  bool isSingleValued() const { return true; }
67  bool gActiveChanged() { return false; }
68  /***************************************************/
69 
70  /* INHERITED INTERFACE OF ELEMENT */
71  virtual void plot(double t, double dt = 1);
72  /***************************************************/
73 
77  void setForceDirection(const fmatvec::Mat3xV& fd);
78 
82  void setMomentDirection(const fmatvec::Mat3xV& md);
83 
88  void setForceFunction(Function<fmatvec::VecV(double)> *func);
89 
91  void setMomentFunction(Function<fmatvec::VecV(double)> *func);
92 
96  void setFrameOfReferenceID(int ID) { refFrameID=ID; }
97 
99 
104  void connect(MBSim::Frame *frame1, MBSim::Frame *frame2);
105 
106 #ifdef HAVE_OPENMBVCPPINTERFACE
107 
108  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVForce, tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::toPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
109  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
110  std::vector<bool> which; which.resize(2, false);
111  which[1]=true;
112  LinkMechanics::setOpenMBVForceArrow(ombv.createOpenMBV(), which);
113  }
114 
116  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVMoment, tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::toPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
117  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toDoubleHead,referencePoint,scaleLength,scaleSize);
118  std::vector<bool> which; which.resize(2, false);
119  which[1]=true;
120  LinkMechanics::setOpenMBVMomentArrow(ombv.createOpenMBV(), which);
121  }
122 #endif
123 
124  void initializeUsingXML(xercesc::DOMElement *element);
125  virtual xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *element);
126 
127  virtual std::string getType() const { return "KineticExcitation"; }
128 
129  protected:
134  int refFrameID;
135 
139  fmatvec::Mat3xV forceDir, momentDir;
140 
144  Function<fmatvec::VecV(double)> *F, *M;
145 
150 
151  private:
152  std::string saved_ref, saved_ref1, saved_ref2;
153  };
154 
155 }
156 
157 #endif /* _KINETICEXCITATION_H_ */
158 
void setMomentDirection(const fmatvec::Mat3xV &md)
Definition: kinetic_excitation.cc:142
virtual void connect(Frame *frame_)
Definition: link_mechanics.cc:226
Frame C
own frame located in second partner with same orientation as first partner
Definition: kinetic_excitation.h:149
void connect(MBSim::Frame *frame1, MBSim::Frame *frame2)
Definition: kinetic_excitation.cc:83
void setForceDirection(const fmatvec::Mat3xV &fd)
Definition: kinetic_excitation.cc:134
kinetic excitations given by time dependent functions
Definition: kinetic_excitation.h:40
KineticExcitation(const std::string &name="")
constructor
Definition: kinetic_excitation.cc:36
virtual ~KineticExcitation()
destructor
Definition: kinetic_excitation.cc:38
void setMomentFunction(Function< fmatvec::VecV(double)> *func)
see setForce
Definition: kinetic_excitation.cc:156
void setForceFunction(Function< fmatvec::VecV(double)> *func)
Set the force excitation. forceDir*func(t) is the applied force vector in space. This force vector is...
Definition: kinetic_excitation.cc:150
bool gActiveChanged()
Definition: kinetic_excitation.h:67
InitStage
The stages of the initialization.
Definition: element.h:97
bool isSingleValued() const
asks the link if it contains single valued force laws that contribute to the right-hand side vector h...
Definition: kinetic_excitation.h:66
std::string name
name of element
Definition: element.h:290
virtual void plot(double t, double dt=1)
plots time dependent data
Definition: kinetic_excitation.cc:118
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 setFrameOfReferenceID(int ID)
The frame of reference ID for the force/moment direction vectors. If ID=0 the first frame...
Definition: kinetic_excitation.h:96
Function< fmatvec::VecV(double)> * F
portions of the force / moment in the specific directions
Definition: kinetic_excitation.h:144
virtual std::string getType() const
Definition: kinetic_excitation.h:127
fmatvec::Mat3xV forceDir
directions of force and moment in frame of reference
Definition: kinetic_excitation.h:139
Frame * refFrame
frame of reference the force is defined in
Definition: kinetic_excitation.h:133
bool isActive() const
Definition: kinetic_excitation.h:65
void calclaSize(int j)
calculates size of contact force parameters
Definition: kinetic_excitation.cc:113
virtual void init(InitStage stage)
plots time series header
Definition: kinetic_excitation.cc:43

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML