AGX Dynamics  2.35.0.1
DriveTrainComponents.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>
22 #include <agxDriveTrain/Shaft.h>
23 #include <agxDriveTrain/Gear.h>
24 #include <agxDriveTrain/GearBox.h>
25 
26 #include <agx/Hinge.h>
27 #include <agx/Constraint.h>
28 
29 namespace agxDriveTrain
30 {
31  class Clutch;
32 
33  namespace deprecated
34  {
35 
41  {
42  public:
44 
51 
54 
55 
58 
59  virtual void setInertia( agx::Real inertia ) override;
60  virtual agx::Real getInertia( ) const override;
61 
63 
66 
67  using RotationalUnit::getRotationalDimension;
68 
69 
70  virtual const agxPowerLine::Connector* getConnector( ) const;
71 
75  virtual bool store( agxStream::StorageStream& str ) const override;
76 
80  virtual bool restore( agxStream::StorageStream& str ) override;
81 
82  virtual void getConnectorsRecursive( agxPowerLine::ConnectorPtrVector& connectors ) override;
83  virtual void getUnitsRecursive( agxPowerLine::UnitPtrVector& units ) override;
84 
85  void store( agxStream::OutputArchive& out ) const override;
86  void restore( agxStream::InputArchive& in ) override;
87 
89 
90  protected:
93 
97 
98  };
99 
104  {
105  public:
110 
112 
114 
119  void setMaxMultiplication( agx::Real maxMultiplication );
120 
125 
130  void setPumpTorqueTable( agx::Vector<std::pair<agx::Real, agx::Real> > const& nu_torques );
131 
135  void setMuTable( agx::Vector<std::pair<agx::Real, agx::Real> > const& nu_to_mu );
136 
141 
147 
152 
156  void clearMuTable( );
157 
162 
169 
174 
175  // virtual void createConnector();
176 
177 
181  virtual bool store( agxStream::StorageStream& str ) const override;
182 
186  virtual bool restore( agxStream::StorageStream& str ) override;
187 
189  protected:
190 
192 
194 
195  };
197 
198 
211  {
212  public:
217 
218  explicit FixedGear( agx::Real ratio );
219 
223  void setGearRatio( agx::Real ratio );
224 
225 
226 
228 
229  // Removed because we're now passing the correct connector to the DriveTrain-
230  // Component constructor.
231  // void createConnector() override;
232 
233  virtual bool preUpdate( agx::Real timeStep ) override;
234 
238  virtual bool store( agxStream::StorageStream& str ) const override;
239 
243  virtual bool restore( agxStream::StorageStream& str ) override;
244 
246  protected:
247  virtual ~FixedGear( );
249 
250  };
252 
253 
268  {
269  public:
274 
279  GearBox( const agx::RealVector& gears );
280 
284  void setGearRatios( const agx::RealVector& gear_ratios );
285 
289  bool gearUp( );
290  bool gearDown( );
291  bool setGear( int gearIndex );
292 
296  int getGear( ) const;
297 
301  agx::Real getGearRatio( int gearIndex ) const;
302 
304 
306 
310  virtual bool preUpdate( agx::Real timeStep ) override;
311 
315  virtual bool store( agxStream::StorageStream& str ) const override;
316 
320  virtual bool restore( agxStream::StorageStream& str ) override;
321 
323  protected:
324  virtual ~GearBox( );
325  void createBox( const agx::RealVector& gears );
327  };
329 
330 
331 
333  {
334  public:
338  Clutch( );
339 
345  void setEfficiency( agx::Real efficiency );
346 
349 
350 
363 
368  void setForcedCompliance( agx::Real compliance );
370 
371 
374 
375  /*
376  Function that have to be public since it is called by static functions. Do NOT use.
377  */
378 
382  virtual bool store( agxStream::StorageStream& str ) const override;
383 
387  virtual bool restore( agxStream::StorageStream& str ) override;
388 
390 
391  protected:
392  virtual ~Clutch( );
393 
394  protected:
395  // The reference is owned by DriveTrainComponent, a base class of Clutch.
397  };
398 
400  }
401 
402 }
403 
404 
#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
Defines a viscous coupling between two rotational dimensions.
Definition: Clutch.h:33
The gear box can have an arbitrary number of gears.
Definition: GearBox.h:30
A Shaft is the most basic PowerLine Unit.
Definition: Shaft.h:35
void setEfficiency(agx::Real efficiency)
Specify the efficiency of the clutch: 0 is freely coupled 1 is tightly coupled.
agx::Real getTorqueTransferConstant() const
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
void setTorqueTransferConstant(agx::Real constant)
The torque transfer constant (ttc) determines how fast the possible torque transfer goes to infinity.
agx::Real getForcedCompliance() const
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
agxDriveTrain::Clutch * getClutchConnector()
const agxDriveTrain::Clutch * getClutchConnector() const
void setForcedCompliance(agx::Real compliance)
Setting the forced compliance to a non negative overrides the Clutch internal compliance and torque l...
agxDriveTrain::Clutch * m_clutchConnector
A DriveTrainComponent is a Shaft that comes with a Connector and an input shaft.
virtual void getUnitsRecursive(agxPowerLine::UnitPtrVector &units) override
Fill the given vector with the Units that are held by this SubGraph.
void restore(agxStream::InputArchive &in) override
virtual void setInertia(agx::Real inertia) override
set the inertia for the rotational dimension of the rotational unit.
virtual void getConnectorsRecursive(agxPowerLine::ConnectorPtrVector &connectors) override
Fill the given vector with the Connectors that are held by this SubGraph.
bool replaceConnector(agxPowerLine::Connector *connector)
void store(agxStream::OutputArchive &out) const override
virtual agxPowerLine::DimensionAndSide getConnectableDimension(agxPowerLine::PhysicalDimension::Type type, agxPowerLine::Side side) override
virtual agxPowerLine::Connector * getConnector()
virtual agx::Real getInertia() const override
virtual void getConnectableDimensionTypes(agxPowerLine::PhysicalDimension::TypeVector &types, agxPowerLine::Side side) const override
agxPowerLine::RotationalDimension * getRotationalDimension(agxPowerLine::Side side)
virtual const agxPowerLine::Connector * getConnector() const
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
const agxPowerLine::RotationalDimension * getRotationalDimension(agxPowerLine::Side side) const
const agxDriveTrain::Shaft * getInputShaft() const
DriveTrainComponent(agxPowerLine::Connector *internalConnector)
const agxDriveTrain::Shaft * getOutputShaft() const
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agxDriveTrain::deprecated::DriveTrainComponent)
The gear box can have an arbitrary number of gears.
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
void setGearRatio(agx::Real ratio)
Set the fixed gear ratio.
virtual bool preUpdate(agx::Real timeStep) override
Functions called by a static function.
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
The gear box can have an arbitrary number of gears.
void setGearRatios(const agx::RealVector &gear_ratios)
Set the gear ratio for gear indexed like -2, -1, 0, 1, 2, 3, 4 (negative is reverse gears,...
agx::Real getCurrentGearRatio() const
agx::Real getGearRatio(int gearIndex) const
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
const agxDriveTrain::GearBox * getGearBox() const
void createBox(const agx::RealVector &gears)
GearBox(const agx::RealVector &gears)
Create a gear box.
virtual bool preUpdate(agx::Real timeStep) override
Functions called by a static function.
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
agxDriveTrain::GearBoxRef m_gearBoxConnector
Base Torque converter for an automatic transmission.
void insertNuMuLookupValue(agx::Real nu, agx::Real mu)
Insert value in the table mapping angular velocity ratio to torque multiplication.
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
const agxPowerLine::LinearLookupTable * getPumpTorqueTable() const
agx::Real getCurrentMultiplication() const
Return the torque multiplication given the current state.
void setMaxMultiplication(agx::Real maxMultiplication)
When the efficiency goes to zero, the torque multiplication goes to infinity set/get the largest poss...
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
void setMuTable(agx::Vector< std::pair< agx::Real, agx::Real > > const &nu_to_mu)
Set table mapping velocity ratio to torque multiplication.
void setPumpTorqueReferenceRPM(agx::Real rpm)
Set the pump torque reference rpm for the table.
void setPumpTorqueTable(agx::Vector< std::pair< agx::Real, agx::Real > > const &nu_torques)
Set the pump torque table.
agxDriveTrain::deprecated::TorqueConverterRef m_torqueConverterConnector
const agxPowerLine::LinearLookupTable * getMuTable() const
Return pointer to table mapping angular velocity ratio to torque multiplication.
agxPowerLine::LinearLookupTable * getPumpTorqueTable()
void clearMuTable()
Clear the table mapping angular velocity ratio to torque multiplication.
Links two connections together.
Definition: Connector.h:54
Linear interpolation between the inserted variable/value pairs.
The rotational has one rotational degree of freedom.
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:52
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
Templated vector class.
Definition: agx/Vector.h:53
agx::ref_ptr< TorqueConverterTable > TorqueConverterTableRef
agx::ref_ptr< FixedGear > FixedGearRef
agx::ref_ptr< GearBox > GearBoxRef
agx::ref_ptr< Clutch > ClutchRef
A library of agxPowerLine components designed to model the various parts of a vehicle drive train.
std::pair< agxPowerLine::PhysicalDimension *, agxPowerLine::Side > DimensionAndSide
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
double Real
Definition: Real.h:42