mbsim  4.0.0
MBSim Kernel
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
bevel_gear.h
1 /* Copyright (C) 2004-2019 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 BEVELGEAR_H_
21 #define BEVELGEAR_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/bevelgear.h>
28 
29 namespace MBSim {
30 
35  class BevelGear : public RigidContour {
36  public:
37 
38  BevelGear(const std::string& name="", Frame *R=nullptr) : RigidContour(name,R) { }
39 
43  ~BevelGear() 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  fmatvec::Vec3 evalParDer1Ks(const fmatvec::Vec2 &zeta) override;
54  fmatvec::Vec3 evalParDer2Ks(const fmatvec::Vec2 &zeta) override;
55  fmatvec::Vec3 evalParDer1Kt(const fmatvec::Vec2 &zeta) override;
56  fmatvec::Vec3 evalParDer2Kt(const fmatvec::Vec2 &zeta) override;
57  /***************************************************/
58 
59  /* GETTER / SETTER */
60  void setNumberOfTeeth(int N_) { N = N_; }
61  int getNumberOfTeeth() { return N; }
62  void setWidth(double w_) { w = w_; }
63  double getWidth() { return w; }
64  void setHelixAngle(double be_) { be = be_; }
65  double getHelixAngle() { return be; }
66  void setPitchAngle(double ga_) { ga = ga_; }
67  double getPitchAngle() { return ga; }
68  void setModule(double m_) { m = m_; }
69  double getModule() { return m; }
70  void setPressureAngle(double al_) { al = al_; }
71  double getPressureAngle() { return al; }
72  void setBacklash(double b_) { b = b_; }
73  double getBacklash() { return b; }
74  void setFlank(int flank) { signi = flank; }
75  void setTooth(int tooth) { k = tooth; }
76  double getEtaMax(double h, double s, int signi);
77  double getPhiMaxHigh(int i) { return phiMaxHigh[i]; }
78  double getPhiMaxLow(int i) { return phiMaxLow[i]; }
79  double getPhiMinHigh(int i) { return phiMinHigh[i]; }
80  double getPhiMinLow(int i) { return phiMinLow[i]; }
81  double getSPhiMaxHigh(int i) { return sPhiMaxHigh[i]; }
82  double getSPhiMinHigh(int i) { return sPhiMinHigh[i]; }
83  /***************************************************/
84 
85  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))) {
86  OpenMBVColoredBody ombv(diffuseColor,transparency,pointSize,lineWidth);
87  openMBVRigidBody=ombv.createOpenMBV<OpenMBV::BevelGear>();
88  }
89 
90  void initializeUsingXML(xercesc::DOMElement *element) override;
91 
92  protected:
93  class Residuum : public Function<double(double)> {
94  private:
95  double h, s, r0, r1, al, be, ga;
96  int signi;
97  public:
98  Residuum(double h_, double s_, double r0_, double r1_, double al_, double be_, double ga_, int signi_) : h(h_), s(s_), r0(r0_), r1(r1_), al(al_), be(be_), ga(ga_), signi(signi_) { }
99  double operator()(const double &phi) override;
100  };
101 
102  int N{15};
103  double w{5e-2};
104  double be{0};
105  double ga{0.785398163397448};
106  double m{16e-3};
107  double al{0.349065850398866};
108  double b{0};
109 
110  int signi{0};
111  int k{0};
112  double delh;
113  double r0;
114  double r1;
115  double d;
116 
117  double phiMaxHigh[2], phiMaxLow[2], phiMinHigh[2], phiMinLow[2], sPhiMaxHigh[2], sPhiMinHigh[2];
118  };
119 
120 }
121 
122 #endif
basic class for rigid contours
Definition: rigid_contour.h:37
~BevelGear() override=default
destructor
bevel gear contour
Definition: bevel_gear.h:35
RigidContour(const std::string &name, Frame *R_=nullptr)
constructor
Definition: rigid_contour.h:43
Definition: openmbv_utils.h:49
InitStage
The stages of the initialization.
Definition: element.h:62
Definition: contact_kinematics.h:32
std::string name
name of element
Definition: element.h:260
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
Definition: bevel_gear.h:93
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: bevel_gear.cc:148
Frame * R
coordinate system of contour
Definition: rigid_contour.h:133