mbsim  4.0.0
MBSim Kernel
planar_gear.h
1 /* Copyright (C) 2004-2018 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 PLANAR_GEAR_H_
21 #define PLANAR_GEAR_H_
22 
23 #include "mbsim/contours/rigid_contour.h"
24 #include "mbsim/functions/function.h"
25 #include "mbsim/utils/boost_parameters.h"
26 #include "mbsim/utils/openmbv_utils.h"
27 #include <openmbvcppinterface/planargear.h>
28 
29 namespace MBSim {
30 
35  class PlanarGear : public RigidContour {
36  public:
37 
38  PlanarGear(const std::string& name="", Frame *R=nullptr) : RigidContour(name,R) { }
39 
43  ~PlanarGear() override = default;
44 
45  /* INHERITED INTERFACE OF ELEMENT */
46  void init(InitStage stage, const InitConfigSet &config) override;
47  /***************************************************/
48 
49  /* INHERITED INTERFACE OF CONTOUR */
50  fmatvec::Vec3 evalKrPS(const fmatvec::Vec2 &zeta) override;
51  fmatvec::Vec3 evalKs(const fmatvec::Vec2 &zeta) override;
52  fmatvec::Vec3 evalKt(const fmatvec::Vec2 &zeta) override;
53  /***************************************************/
54 
55  /* GETTER / SETTER */
56  void setNumberOfTeeth(int N_) { N = N_; }
57  int getNumberOfTeeth() { return N; }
58  double getHeight() { return h; }
59  void setHeight(double h_) { h = h_; }
60  void setWidth(double w_) { w = w_; }
61  double getWidth() { return w; }
62  void setHelixAngle(double be_) { be = be_; }
63  double getHelixAngle() { return be; }
64  void setModule(double m_) { m = m_; }
65  double getModule() { return m; }
66  void setPressureAngle(double al_) { al = al_; }
67  double getPressureAngle() { return al; }
68  void setBacklash(double b_) { b = b_; }
69  double getBacklash() { return b; }
70  void setFlank(int flank) { signi = flank; }
71  void setTooth(int tooth) { k = tooth; }
72  double getPhiMax(double h, double s);
73  double getPhiMaxHigh(int i) { return phiMaxHigh; }
74  double getPhiMaxLow(int i) { return phiMaxLow; }
75  double getPhiMinHigh(int i) { return phiMinHigh; }
76  double getPhiMinLow(int i) { return phiMinLow; }
77  double getSPhiMaxHigh(int i) { return sPhiMaxHigh; }
78  double getSPhiMinHigh(int i) { return sPhiMinHigh; }
79  /***************************************************/
80 
81  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, tag, (optional (diffuseColor,(const fmatvec::Vec3&),fmatvec::Vec3(std::vector<double>{-1,1,1}))(transparency,(double),0)(pointSize,(double),0)(lineWidth,(double),0))) {
82  OpenMBVColoredBody ombv(diffuseColor,transparency,pointSize,lineWidth);
83  openMBVRigidBody=ombv.createOpenMBV<OpenMBV::PlanarGear>();
84  }
85 
86  void initializeUsingXML(xercesc::DOMElement *element) override;
87 
88  protected:
89  class Residuum : public Function<double(double)> {
90  private:
91  double h, s, r0, al, be;
92  public:
93  Residuum(double h_, double s_, double r0_, double al_, double be_) : h(h_), s(s_), r0(r0_), al(al_), be(be_) { }
94  double operator()(const double &phi) override;
95  };
96 
97  int N{15};
98  double h{5e-2};
99  double w{5e-2};
100  double be{0};
101  double m{16e-3};
102  double al{0.349065850398866};
103  double b{0};
104 
105  int signi{0};
106  int k{0};
107  double delh;
108  double r0;
109 
110  double phiMaxHigh, phiMaxLow, phiMinHigh, phiMinLow, sPhiMaxHigh, sPhiMinHigh;
111  };
112 
113 }
114 
115 #endif
basic class for rigid contours
Definition: rigid_contour.h:37
RigidContour(const std::string &name, Frame *R_=nullptr)
constructor
Definition: rigid_contour.h:43
Definition: openmbv_utils.h:49
Definition: planar_gear.h:89
~PlanarGear() override=default
destructor
InitStage
The stages of the initialization.
Definition: element.h:62
Definition: contact_kinematics.h:32
std::string name
name of element
Definition: element.h:249
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
planar gear contour
Definition: planar_gear.h:35
Frame * R
coordinate system of contour
Definition: rigid_contour.h:133
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: planar_gear.cc:71
namespace MBSim
Definition: eigenanalyzer.cc:47