mbsim  4.0.0
MBSim Kernel
rack.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 RACK_H_
21#define RACK_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/rack.h>
27
28namespace MBSim {
29
34 class Rack : public RigidContour {
35 public:
36
37 Rack(const std::string& name="", Frame *R=nullptr) : RigidContour(name,R) { }
38
42 ~Rack() 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 /***************************************************/
53
54 /* GETTER / SETTER */
55 void setNumberOfTeeth(int N_) { N = N_; }
56 int getNumberOfTeeth() { return N; }
57 double getHeight() { return h; }
58 void setHeight(double h_) { h = h_; }
59 void setWidth(double w_) { w = w_; }
60 double getWidth() { return w; }
61 void setHelixAngle(double be_) { be = be_; }
62 double getHelixAngle() { return be; }
63 void setModule(double m_) { m = m_; }
64 double getModule() { return m; }
65 void setPressureAngle(double al_) { al = al_; }
66 double getPressureAngle() { return al; }
67 void setBacklash(double b_) { b = b_; }
68 double getBacklash() { return b; }
69 void setFlank(int flank) { signi = flank; }
70 void setTooth(int tooth) { k = tooth; }
71 double getXMaxHigh(int i) { return xHigh; }
72 double getXMaxLow(int i) { return xLow; }
73 double getXMinHigh(int i) { return -xHigh; }
74 double getXMinLow(int i) { return -xLow; }
75 double getSXMaxHigh(int i) { return sXHigh; }
76 double getSXMinHigh(int i) { return -sXHigh; }
77 /***************************************************/
78
79 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))) {
80 OpenMBVColoredBody ombv(diffuseColor,transparency,pointSize,lineWidth);
81 openMBVRigidBody=ombv.createOpenMBV<OpenMBV::Rack>();
82 }
83
84 void initializeUsingXML(xercesc::DOMElement *element) override;
85
86 protected:
87 int N{15};
88 double h{5e-2};
89 double w{5e-2};
90 double be{0};
91 double m{16e-3};
92 double al{0.349065850398866};
93 double b{0};
94
95 int signi{0};
96 int k{0};
97 double s0h;
98
99 double xHigh, xLow, sXHigh;
100 };
101
102}
103
104#endif
InitStage
The stages of the initialization.
Definition: element.h:62
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
rack contour
Definition: rack.h:34
~Rack() override=default
destructor
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: rack.cc:58
basic class for rigid contours
Definition: rigid_contour.h:37
Frame * R
coordinate system of contour
Definition: rigid_contour.h:135
RigidContour(const std::string &name, Frame *R_=nullptr)
constructor
Definition: rigid_contour.h:43
namespace MBSim
Definition: bilateral_constraint.cc:30