AGX Dynamics  2.35.0.1
GearBox.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agxPowerLine/PowerLine.h>
21 #include <agxPowerLine/Connector.h>
22 
23 namespace agxDriveTrain
24 {
30  {
31  public:
38 
43  GearBox(const agx::RealVector& gears);
44 
48  void setGearRatios(const agx::RealVector& gearRatios);
49 
53  size_t getNumGears( ) const;
54 
60 
64  bool gearUp();
65 
69  bool gearDown();
70 
74  bool setGear(int gearIndex);
75 
79  int getGear() const;
80 
84  agx::Real getGearRatio(int gearIndex) const;
85 
90 
91  virtual void initConstraint() override;
92 
94  const agx::Real timeStep, agx::Real& compliance, agx::Real& damping) override;
95 
96 #ifndef SWIG
100  virtual bool store(agxStream::StorageStream& str) const override;
101 
105  virtual bool restore(agxStream::StorageStream& str) override;
106 
108 #endif
109 
110  protected:
111  virtual ~GearBox();
112 
115 
118  };
120 }
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXMODEL_EXPORT
The gear box can have an arbitrary number of gears.
Definition: GearBox.h:30
virtual void initConstraint() override
virtual agx::RegularizationParameters::VariableType calculateComplianceAndDamping(const agx::Real timeStep, agx::Real &compliance, agx::Real &damping) override
Calculate a compliance that will result in the wanted efficiency.
GearBox(const agx::RealVector &gears)
Create a gear box with the given gear ratios.
agx::Real getTorque() const
Get current load torque, i.e., the torque applied on the output.
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
bool setGear(int gearIndex)
Change to the gear at the given index.
bool gearDown()
Change to the previous gear, if there is one.
agx::Real getCurrentGearRatio() const
GearBox()
Create an empty gear box.
bool gearUp()
Change to the next gear, if there is one.
void setGearRatios(const agx::RealVector &gearRatios)
Set the gear ratios.
size_t getNumGears() const
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
agx::Real getGearRatio(int gearIndex) const
agx::Real getCurrentRatio() const
agx::RealVector m_gearTable
Definition: GearBox.h:116
Defines a stiff gear constraint between two rotational dimensions.
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
A library of agxPowerLine components designed to model the various parts of a vehicle drive train.
agx::ref_ptr< GearBox > GearBoxRef
Definition: GearBox.h:119
double Real
Definition: Real.h:42