Chrono::Engine C++ API
Public Member Functions
chrono::ChShaft Class Reference

#include <ChShaft.h>

Inheritance diagram for chrono::ChShaft:
Inheritance graph
Collaboration diagram for chrono::ChShaft:
Collaboration graph

List of all members.

Public Member Functions

 ChShaft ()
 ~ChShaft ()
void Copy (ChShaft *source)
void SetShaftFixed (bool mev)
bool GetShaftFixed ()
void SetLimitSpeed (bool mlimit)
bool GetLimitSpeed ()
void SetUseSleeping (bool ms)
bool GetUseSleeping ()
void SetSleeping (bool ms)
bool GetSleeping ()
bool TrySleeping ()
bool IsActive ()
virtual int GetDOF ()
ChLcpVariablesGenericVariables ()
void VariablesFbReset ()
void VariablesFbLoadForces (double factor=1.)
void VariablesQbLoadSpeed ()
void VariablesFbIncrementMq ()
void VariablesQbSetSpeed (double step=0.)
void VariablesQbIncrementPosition (double step)
virtual void InjectVariables (ChLcpSystemDescriptor &mdescriptor)
void SetNoSpeedNoAcceleration ()
void SetAppliedTorque (double mtorque)
double GetAppliedTorque ()
void SetPos (double mp)
double GetPos ()
void SetPos_dt (double mp)
double GetPos_dt ()
void SetPos_dtdt (double mp)
double GetPos_dtdt ()
void SetInertia (double newJ)
double GetInertia ()
void SetMaxSpeed (float m_max_speed)
float GetMaxSpeed ()
void ClampSpeed ()
void SetSleepTime (float m_t)
float GetSleepTime ()
void SetSleepMinSpeed (float m_t)
float GetSleepMinSpeed ()
void SetSleepMinWvel (float m_t)
float GetSleepMinWvel ()
virtual void Update (double mytime)
void StreamIN (ChStreamInBinary &mstream)
void StreamOUT (ChStreamOutBinary &mstream)

Detailed Description

Class for one-degree-of-freedom mechanical parts with associated inertia (mass, or J moment of intertial for rotating parts). In most cases these represent shafts that can be used to build 1D models of power trains. This is more efficient than simulating power trains modeled with full 3D ChBody objects.

Constructor & Destructor Documentation

chrono::ChShaft::ChShaft ( )

Build a shaft.


Member Function Documentation

void chrono::ChShaft::ClampSpeed ( )

When this function is called, the speed of the shaft is clamped into limits posed by max_speed and max_wvel - but remember to put the shaft in the SetLimitSpeed(true) mode.

void chrono::ChShaft::InjectVariables ( ChLcpSystemDescriptor mdescriptor) [virtual]

Tell to a system descriptor that there are variables of type ChLcpVariables in this object (for further passing it to a LCP solver)

Reimplemented from chrono::ChPhysicsItem.

bool chrono::ChShaft::IsActive ( )

Tell if the body is active, i.e. it is neither fixed to ground nor it is in sleep mode.

void chrono::ChShaft::SetInertia ( double  newJ)

Inertia of the shaft. Must be positive. Try not to mix bodies with too high/too low values of mass, for numerical stability.

void chrono::ChShaft::SetLimitSpeed ( bool  mlimit)

Trick. Set the maximum shaft velocity (beyond this limit it will be clamped). This is useful in virtual reality and real-time simulations. The realism is limited, but the simulation is more stable.

void chrono::ChShaft::SetMaxSpeed ( float  m_max_speed)

Trick. Set the maximum velocity (beyond this limit it will be clamped). This is useful in virtual reality and real-time simulations, to increase robustness at the cost of realism. This limit is active only if you set SetLimitSpeed(true);

void chrono::ChShaft::SetShaftFixed ( bool  mev)

Sets the 'fixed' state of the shaft. If true, it does not rotate despite constraints, forces, etc.

void chrono::ChShaft::SetSleeping ( bool  ms)

Force the shaft in sleeping mode or not (usually this state change is not handled by users, anyway, because it is mostly automatic).

void chrono::ChShaft::SetSleepTime ( float  m_t)

Set the amount of time which must pass before going automatically in sleep mode when the shaft has very small movements.

void chrono::ChShaft::SetUseSleeping ( bool  ms)

Trick. If use sleeping= true, shafts which do not rotate for too long time will be deactivated, for optimization. The realism is limited, but the simulation is faster.

void chrono::ChShaft::StreamIN ( ChStreamInBinary mstream) [virtual]

Method to allow deserializing a persistent binary archive (ex: a file) into transient data.

Reimplemented from chrono::ChPhysicsItem.

void chrono::ChShaft::StreamOUT ( ChStreamOutBinary mstream) [virtual]

Method to allow serializing transient data into a persistent binary archive (ex: a file).

Reimplemented from chrono::ChPhysicsItem.

void chrono::ChShaft::VariablesFbIncrementMq ( ) [virtual]

Adds M*q (masses multiplied current 'qb') to Fb, ex. if qb is initialized with v_old using VariablesQbLoadSpeed, this method can be used in timestepping schemes that do: M*v_new = M*v_old + forces*dt

Reimplemented from chrono::ChPhysicsItem.

void chrono::ChShaft::VariablesQbIncrementPosition ( double  step) [virtual]

Increment shaft position by the 'qb' part of the ChLcpVariables, multiplied by a 'step' factor. pos+=qb*step

Reimplemented from chrono::ChPhysicsItem.

void chrono::ChShaft::VariablesQbLoadSpeed ( ) [virtual]

Initialize the 'qb' part of the ChLcpVariables with the current value of shaft speed. Note: since 'qb' is the unknown of the LCP, this function seems unuseful, unless used before VariablesFbIncrementMq()

Reimplemented from chrono::ChPhysicsItem.

void chrono::ChShaft::VariablesQbSetSpeed ( double  step = 0.) [virtual]

Fetches the shaft speed from the 'qb' part of the ChLcpVariables (does not updates the full shaft state) and sets it as the current shaft speed. If 'step' is not 0, also computes the approximate acceleration of the shaft using backward differences, that is accel=(new_speed-old_speed)/step.

Reimplemented from chrono::ChPhysicsItem.