mbsim 4.0.0 MBSim Kernel

cylindrical_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 CYLINDRICAL_GEAR_H_
21 #define CYLINDRICAL_GEAR_H_
22
23 #include "mbsim/contours/rigid_contour.h"
24 #include "mbsim/utils/boost_parameters.h"
25 #include "mbsim/utils/openmbv_utils.h"
26 #include <openmbvcppinterface/cylindricalgear.h>
27
28 namespace MBSim {
29
34 class CylindricalGear : public RigidContour {
35 public:
36
37 CylindricalGear(const std::string& name="", Frame *R=nullptr) : RigidContour(name,R) { }
38
42 ~CylindricalGear() override = default;
43
44 /* INHERITED INTERFACE OF ELEMENT */
45 void init(InitStage stage, const InitConfigSet &config) override;
46 /***************************************************/
47
48 /* INHERITED INTERFACE OF CONTOUR */
49 fmatvec::Vec3 evalKrPS(const fmatvec::Vec2 &zeta) override;
50 fmatvec::Vec3 evalKs(const fmatvec::Vec2 &zeta) override;
51 fmatvec::Vec3 evalKt(const fmatvec::Vec2 &zeta) override;
52 fmatvec::Vec3 evalParDer1Ks(const fmatvec::Vec2 &zeta) override;
53 fmatvec::Vec3 evalParDer2Ks(const fmatvec::Vec2 &zeta) override;
54 fmatvec::Vec3 evalParDer1Kt(const fmatvec::Vec2 &zeta) override;
55 fmatvec::Vec3 evalParDer2Kt(const fmatvec::Vec2 &zeta) override;
56 /***************************************************/
57
58 /* GETTER / SETTER */
59 void setNumberOfTeeth(int N_) { N = N_; }
60 int getNumberOfTeeth() { return N; }
61 void setWidth(double w_) { w = w_; }
62 double getWidth() { return w; }
63 void setHelixAngle(double be_) { be = be_; }
64 double getHelixAngle() { return be; }
65 void setModule(double m_) { m = m_; }
66 double getModule() { return m; }
67 void setPressureAngle(double al_) { al = al_; }
68 double getPressureAngle() { return al; }
69 void setBacklash(double b_) { b = b_; }
70 double getBacklash() { return b; }
71 void setExternalToothed(bool ext_=true) { ext = ext_; }
72 double getOutsideRadius() const { return R; }
73 void setOutsideRadius(double R_) { R = R_; }
74 bool getExternalToothed() const { return ext; }
75 void setFlank(int flank) { signi = flank; }
76 void setTooth(int tooth) { k = tooth; }
77 double getEtaMax(double r, double s);
78 double getPhiMaxHigh(int i) { return phiHigh[i]; }
79 double getPhiMaxLow(int i) { return phiLow[i]; }
80 double getPhiMinHigh(int i) { return -phiHigh[not i]; }
81 double getPhiMinLow(int i) { return -phiLow[not i]; }
82 double getSPhiMaxHigh(int i) { return sPhiHigh; }
83 double getSPhiMinHigh(int i) { return -sPhiHigh; }
84 /***************************************************/
85
86 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))) {
87 OpenMBVColoredBody ombv(diffuseColor,transparency,pointSize,lineWidth);
88 openMBVRigidBody=ombv.createOpenMBV<OpenMBV::CylindricalGear>();
89 }
90
91 void initializeUsingXML(xercesc::DOMElement *element) override;
92
93 protected:
94 int N{15};
95 double w{5e-2};
96 double be{0};
97 double m{16e-3};
98 double al{0.349065850398866};
99 double b{0};
100 bool ext{true};
101 double R{0};
102
103 int signi{0};
104 int k{0};
105 double delh;
106 double r0;
107
108 double phiHigh[2], phiLow[2], sPhiHigh;
109 };
110
111 }
112
113 #endif
MBSim::CylindricalGear::init
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: cylindrical_gear.cc:122
MBSim::RigidContour
basic class for rigid contours
Definition: rigid_contour.h:37
MBSim::RigidContour::RigidContour
RigidContour(const std::string &name, Frame *R_=nullptr)
constructor
Definition: rigid_contour.h:43
MBSim::OpenMBVColoredBody
Definition: openmbv_utils.h:49
MBSim::CylindricalGear::~CylindricalGear
~CylindricalGear() override=default
destructor
MBSim::CylindricalGear
cylindrical gear contour
Definition: cylindrical_gear.h:34
MBSim::Element::InitStage
InitStage
The stages of the initialization.
Definition: element.h:62
MBSim::Element::name
std::string name
name of element
Definition: element.h:260
MBSim::Frame
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
OpenMBV::CylindricalGear
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30