mbsim 4.0.0 MBSim Kernel

generalized_gear.h
1 /* Copyright (C) 2004-2015 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@gmail.com
18 */
19
20 #ifndef _GENERALIZED_GEAR_H_
21 #define _GENERALIZED_GEAR_H_
22
23 #include "mbsim/links/rigid_body_link.h"
24
25 namespace MBSim {
26
27 class GeneralizedForceLaw;
28 class GeneralizedImpactLaw;
29
30 class GeneralizedGear : public RigidBodyLink {
31 friend class GeneralizedGearConstraint;
32 protected:
33 GeneralizedForceLaw *fl{nullptr};
34 GeneralizedImpactLaw *il{nullptr};
35 std::string saved_gearOutput;
36 std::vector<std::string> saved_gearInput;
37 public:
38 GeneralizedGear(const std::string &name="") : RigidBodyLink(name) { body.resize(1); ratio.resize(1); }
39 ~GeneralizedGear() override;
40 void updateGeneralizedForces() override;
41 void setGearOutput(RigidBody* body_) { body[0] = body_; ratio[0] = -1; }
42 void addGearInput(RigidBody* body_, double ratio_) { body.push_back(body_); ratio.push_back(ratio_); }
43
44 bool isActive() const override { return true; }
45 bool gActiveChanged() override { return false; }
46 void init(InitStage stage, const InitConfigSet &config) override;
47 bool isSetValued() const override;
48 bool isSingleValued() const override { return not(isSetValued()); }
49
50 void setGeneralizedForceLaw(GeneralizedForceLaw * fl_);
51
52 void initializeUsingXML(xercesc::DOMElement * element) override;
53 };
54
55 }
56
57 #endif
MBSim::GeneralizedForceLaw
basic force law on acceleration level for constraint description
Definition: generalized_force_law.h:34
MBSim::GeneralizedGear::isActive
bool isActive() const override
Definition: generalized_gear.h:44
MBSim::GeneralizedGear::init
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: generalized_gear.cc:57
MBSim::GeneralizedGear::isSetValued
bool isSetValued() const override
asks the link if it contains force laws that contribute to the lagrange multiplier and is therefore s...
Definition: generalized_gear.cc:40
MBSim::RigidBodyLink
Definition: rigid_body_link.h:30
MBSim::GeneralizedGear::gActiveChanged
bool gActiveChanged() override
Definition: generalized_gear.h:45
MBSim::Element::InitStage
InitStage
The stages of the initialization.
Definition: element.h:62
MBSim::GeneralizedImpactLaw
basic force law on velocity level for constraint description
Definition: generalized_impact_law.h:32
MBSim::Element::name
std::string name
name of element
Definition: element.h:260
MBSim::GeneralizedGear
Definition: generalized_gear.h:30
MBSim::GeneralizedGearConstraint
Definition: generalized_gear_constraint.h:28
MBSim::RigidBody
rigid bodies with arbitrary kinematics
Definition: rigid_body.h:50
MBSim::GeneralizedGear::isSingleValued
bool isSingleValued() const override
asks the link if it contains single valued force laws that contribute to the right-hand side vector h
Definition: generalized_gear.h:48
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30