Description

Base class for all MBS nodes.

#include <ChVehicleCosimMBSNode.h>

Inheritance diagram for chrono::vehicle::ChVehicleCosimMBSNode:
Collaboration diagram for chrono::vehicle::ChVehicleCosimMBSNode:

Public Member Functions

virtual NodeType GetNodeType () const override
 Return the node type as NodeType::MBS.
 
void SetNumThreads (int num_threads)
 Set the number of OpenMP threads used in Chrono simulation (default: 1).
 
void SetIntegratorType (ChTimestepper::Type int_type, ChSolver::Type slv_type)
 Set integrator and solver types. More...
 
void SetChassisFixed (bool val)
 Fix the chassis to ground (default: false).
 
void AttachDrawbarPullRig (std::shared_ptr< ChVehicleCosimDBPRig > rig)
 Attach a drawbar pull rig to the MBS system.
 
std::shared_ptr< ChVehicleCosimDBPRigGetDrawbarPullRig () const
 Return the drawbar-pull rig, if one is attached.
 
virtual void Initialize () override final
 Initialize this node. More...
 
virtual void Synchronize (int step_number, double time) override final
 Synchronize this node. More...
 
virtual void Advance (double step_size) override final
 Advance simulation. More...
 
virtual void OutputData (int frame) override final
 Output logging and debugging data.
 
virtual void OutputVisualizationData (int frame) override final
 Output post-processing visualization data.
 
- Public Member Functions inherited from chrono::vehicle::ChVehicleCosimBaseNode
std::string GetNodeTypeString () const
 Return the node type as a string.
 
bool IsCosimNode () const
 Return true if this node is part of the co-simulation infrastructure.
 
void SetStepSize (double step)
 Set the integration step size (default: 1e-4).
 
double GetStepSize () const
 Get the integration step size.
 
void SetOutDir (const std::string &dir_name, const std::string &suffix)
 Set the name of the output directory and an identifying suffix. More...
 
void SetVerbose (bool verbose)
 Enable/disable verbose messages during simulation (default: true).
 
const std::string & GetOutDirName () const
 Get the output directory name for this node.
 
double GetStepExecutionTime () const
 Get the simulation execution time for the current step on this node. More...
 
double GetTotalExecutionTime () const
 Get the cumulative simulation execution time on this node.
 
virtual void WriteCheckpoint (const std::string &filename) const
 Write checkpoint to the specified file (which will be created in the output directory).
 

Protected Member Functions

 ChVehicleCosimMBSNode ()
 Construct a base class MBS node.
 
virtual void InitializeMBS (const std::vector< ChVector<>> &tire_info, const ChVector2<> &terrain_size, double terrain_height)=0
 Initialize the underlying MBS. More...
 
virtual void PreAdvance ()
 Perform any required operations before advancing the state of the MBS. More...
 
virtual void PostAdvance ()
 Perform any required operations after advancing the state of the MBS. More...
 
virtual void OnOutputData (int frame)
 Perform additional output at the specified frame (called from within OutputData). More...
 
virtual void ApplySpindleForce (unsigned int i, const TerrainForce &spindle_force)=0
 Apply the provided force to the i-th spindle body. More...
 
virtual int GetNumSpindles () const =0
 Get the number of spindles/wheels defined by the underlying MBS. More...
 
virtual std::shared_ptr< ChBodyGetSpindleBody (unsigned int i) const =0
 Get the spindle body to which the i-th wheel/tire is attached.
 
virtual double GetSpindleLoad (unsigned int i) const =0
 Get the load weight on the i-th wheel/tire. More...
 
virtual BodyState GetSpindleState (unsigned int i) const =0
 Get the body state of the spindle body to which the i-th wheel/tire is attached.
 
virtual std::shared_ptr< ChBodyGetChassisBody () const =0
 Get the "chassis" body. More...
 
virtual void OnInitializeDBPRig (std::shared_ptr< ChFunction > func)=0
 Impose spindle angular speed function. More...
 
- Protected Member Functions inherited from chrono::vehicle::ChVehicleCosimBaseNode
 ChVehicleCosimBaseNode (const std::string &name)
 

Protected Attributes

ChSystemSMCm_system
 containing system
 
ChTimestepper::Type m_int_type
 integrator type
 
ChSolver::Type m_slv_type
 solver type
 
std::shared_ptr< ChTimestepperHHTm_integrator
 HHT integrator object.
 
std::shared_ptr< ChVehicleCosimDBPRigm_DBP_rig
 DBP rig.
 
std::ofstream m_DBP_outf
 DBP output file stream.
 
- Protected Attributes inherited from chrono::vehicle::ChVehicleCosimBaseNode
int m_rank
 MPI rank of this node (in MPI_COMM_WORLD)
 
double m_step_size
 integration step size
 
std::string m_name
 name of the node
 
std::string m_out_dir
 top-level output directory
 
std::string m_node_out_dir
 node-specific output directory
 
std::ofstream m_outf
 output file stream
 
unsigned int m_num_mbs_nodes
 
unsigned int m_num_terrain_nodes
 
unsigned int m_num_tire_nodes
 
ChTimer< double > m_timer
 timer for integration cost
 
double m_cum_sim_time
 cumulative integration cost
 
bool m_verbose
 verbose messages during simulation?
 

Additional Inherited Members

- Public Types inherited from chrono::vehicle::ChVehicleCosimBaseNode
enum  NodeType { NodeType::MBS, NodeType::TERRAIN, NodeType::TIRE }
 Type of node participating in co-simulation. More...
 
enum  InterfaceType { InterfaceType::BODY, InterfaceType::MESH }
 Type of the tire-terrain communication interface. More...
 
- Static Public Member Functions inherited from chrono::vehicle::ChVehicleCosimBaseNode
static std::string OutputFilename (const std::string &dir, const std::string &root, const std::string &ext, int frame, int frame_digits)
 Utility function for creating an output file name. More...
 
- Static Protected Attributes inherited from chrono::vehicle::ChVehicleCosimBaseNode
static const double m_gacc = -9.81
 

Member Function Documentation

◆ Advance()

void chrono::vehicle::ChVehicleCosimMBSNode::Advance ( double  step_size)
finaloverridevirtual

Advance simulation.

This function is called after a synchronization to allow the node to advance its state by the specified time step. A node is allowed to take as many internal integration steps as required, but no inter-node communication should occur.

Implements chrono::vehicle::ChVehicleCosimBaseNode.

◆ ApplySpindleForce()

virtual void chrono::vehicle::ChVehicleCosimMBSNode::ApplySpindleForce ( unsigned int  i,
const TerrainForce spindle_force 
)
protectedpure virtual

Apply the provided force to the i-th spindle body.

This function is called during synchronization when the force is received from the corresponding tire node.

◆ GetChassisBody()

virtual std::shared_ptr<ChBody> chrono::vehicle::ChVehicleCosimMBSNode::GetChassisBody ( ) const
protectedpure virtual

Get the "chassis" body.

Only used is a drawbar-pull rig is attached.

◆ GetNumSpindles()

virtual int chrono::vehicle::ChVehicleCosimMBSNode::GetNumSpindles ( ) const
protectedpure virtual

Get the number of spindles/wheels defined by the underlying MBS.

A co-simulation must have a matching number of TIRE nodes.

◆ GetSpindleLoad()

virtual double chrono::vehicle::ChVehicleCosimMBSNode::GetSpindleLoad ( unsigned int  i) const
protectedpure virtual

Get the load weight on the i-th wheel/tire.

Note: this must also include the mass of the tire itself.

◆ Initialize()

void chrono::vehicle::ChVehicleCosimMBSNode::Initialize ( )
finaloverridevirtual

Initialize this node.

This function allows the node to initialize itself and, optionally, perform an initial data exchange with any other node.

Reimplemented from chrono::vehicle::ChVehicleCosimBaseNode.

◆ InitializeMBS()

virtual void chrono::vehicle::ChVehicleCosimMBSNode::InitializeMBS ( const std::vector< ChVector<>> &  tire_info,
const ChVector2<> &  terrain_size,
double  terrain_height 
)
protectedpure virtual

Initialize the underlying MBS.

Parameters
tire_infomass, radius, width for each tire
terrain_sizeterrain length x width
terrain_heightinitial terrain height

◆ OnInitializeDBPRig()

virtual void chrono::vehicle::ChVehicleCosimMBSNode::OnInitializeDBPRig ( std::shared_ptr< ChFunction func)
protectedpure virtual

Impose spindle angular speed function.

This function is called (during initialization, after the call to InitializeMBS) only if a drawbar-pull rig is attached. A derived class must enforce the specified angular speed on all spindles and, if appropriate, disconnect any other power transmission mechanism (such as a powertrain/driveline).

◆ OnOutputData()

virtual void chrono::vehicle::ChVehicleCosimMBSNode::OnOutputData ( int  frame)
inlineprotectedvirtual

Perform additional output at the specified frame (called from within OutputData).

For example, output mechanism-specific data for post-procesing.

◆ PostAdvance()

virtual void chrono::vehicle::ChVehicleCosimMBSNode::PostAdvance ( )
inlineprotectedvirtual

Perform any required operations after advancing the state of the MBS.

This function is called after every integration step.

◆ PreAdvance()

virtual void chrono::vehicle::ChVehicleCosimMBSNode::PreAdvance ( )
inlineprotectedvirtual

Perform any required operations before advancing the state of the MBS.

This function is called before every integration step.

◆ SetIntegratorType()

void chrono::vehicle::ChVehicleCosimMBSNode::SetIntegratorType ( ChTimestepper::Type  int_type,
ChSolver::Type  slv_type 
)

Set integrator and solver types.

For the MKL solver, use slv_type = ChSolver::Type::CUSTOM.

Parameters
int_typeintegrator type (default: HHT)
slv_typesolver type (default:: MKL)

◆ Synchronize()

void chrono::vehicle::ChVehicleCosimMBSNode::Synchronize ( int  step_number,
double  time 
)
finaloverridevirtual

Synchronize this node.

This function is called at every co-simulation synchronization time to allow the node to exchange information with any other node.

Implements chrono::vehicle::ChVehicleCosimBaseNode.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_vehicle/cosim/ChVehicleCosimMBSNode.h
  • /builds/uwsbel/chrono/src/chrono_vehicle/cosim/ChVehicleCosimMBSNode.cpp