Robotran C Documentation
Enumerations | Functions
mbs_dirdyn.h File Reference
#include "mbs_dirdyn_struct.h"
#include "mbs_data.h"

Go to the source code of this file.

Enumerations

enum  { COMPUTE_ALL_QC, COMPUTE_NO_QC, COMPUTE_CUSTOM_QC }
 Enumeration of the possible computation of Qc in dirdyn. More...
 

Functions

MbsDirdynmbs_new_dirdyn (MbsData *mbs_data)
 Create a new direct dynamic structure. More...
 
MbsDirdynmbs_new_dirdyn_aux (MbsData *mbs_data, MbsAux *mbs_aux)
 Create MbsDirdyn strucure and fill it with auxiliary structure. More...
 
int mbs_run_dirdyn (MbsDirdyn *dirdyn, MbsData *mbs_data)
 Run the direct dynamic simulation. More...
 
int mbs_dirdyn_init (MbsDirdyn *dirdyn, MbsData *mbs_data)
 Run the startup operations of the run_dirdyn function. More...
 
int mbs_dirdyn_loop (MbsDirdyn *dirdyn, MbsData *mbs_data)
 Time loop of the run_dirdyn function: More...
 
int mbs_dirdyn_finish (MbsDirdyn *dirdyn, MbsData *mbs_data)
 Run the finalization operations of the run_dirdyn function. More...
 
void mbs_delete_dirdyn (MbsDirdyn *dirdyn, MbsData *mbs_data)
 Free memory of the direct dynamic structure The options (MbsDirdynOptions) and MbsAux structures are also freed. More...
 
int mbs_dirdyn_write_buffers (MbsDirdyn *dd)
 Compute the derivatives of the system (1st derivatives to be given to the ODE integrator) More...
 
int check_user_dirdyn_options (MbsDirdyn *dd, MbsData *mbs_data)
 check that the dirdyn options performed by the user are correct More...
 
int mbs_dirdyn_save (MbsDirdyn *dd, MbsData *mbs_data, double t)
 save the dirdyn results through the buffer More...
 

Detailed Description

This header defines functions of the dirdyn module in C.

Creation date: 19/11/2014

Author
Nicolas Docquier (based on the work of other from CEREM: nvdn, av, ...)

(c) Universite catholique de Louvain

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Enumeration of the possible computation of Qc in dirdyn.

Set the choice in main, for example if Qc(2) is wanted :

  • MbsDirdyn->options->flag_compute_Qc = COMPUTE_CUSTOM_QC;
  • MbsDirdyn->options->compute_Qc[2] = 1;

The following value of MbsDirdynOptions::flag_compute_Qc produce:

  • COMPUTE_ALL_QC (default) will compute all Qc largange multipliers.
  • COMPUTE_NO_QC will produce no computation of Qc at all during the dirdynared process, and the results file related to Qc will be filled by 0.
  • COMPUTE_CUSTOM_QC will compute only some Qc that the user can chose by setting MbsDirdynOptions::compute_Qc[index] to 1 when the Qc at index is wanted. MbsDirdynOptions::compute_Qc is of size MbsData::nqc+1 and will be like the following [nqc 0 0 1 0 0] if the third Qc is wanted and MbsData::nqc = 5
Enumerator
COMPUTE_ALL_QC 

To compute the force applied in all driven joints.

COMPUTE_NO_QC 

To not compute the force applied in driven joints.

COMPUTE_CUSTOM_QC 

To compute the force applied in specified driven joints.

Function Documentation

◆ check_user_dirdyn_options()

int check_user_dirdyn_options ( MbsDirdyn dd,
MbsData mbs_data 
)

check that the dirdyn options performed by the user are correct

Parameters
[in]dddirect dynamics module
[in]mbs_dataRobotran main structure
Returns
Error status, <0 in case of failure.

◆ mbs_delete_dirdyn()

void mbs_delete_dirdyn ( MbsDirdyn dirdyn,
MbsData mbs_data 
)

Free memory of the direct dynamic structure The options (MbsDirdynOptions) and MbsAux structures are also freed.

◆ mbs_dirdyn_finish()

int mbs_dirdyn_finish ( MbsDirdyn dirdyn,
MbsData mbs_data 
)

Run the finalization operations of the run_dirdyn function.

Returns
Error status, <0 in case of failure.

◆ mbs_dirdyn_init()

int mbs_dirdyn_init ( MbsDirdyn dirdyn,
MbsData mbs_data 
)

Run the startup operations of the run_dirdyn function.

◆ mbs_dirdyn_loop()

int mbs_dirdyn_loop ( MbsDirdyn dirdyn,
MbsData mbs_data 
)

Time loop of the run_dirdyn function:

The sequence of one iteration is:

  • call the time integrator
  • call the discrete state functions
  • call the storing function
Parameters
[in,out]dirdynthe MbsDirdyn to be run
[in,out]mbs_datathe MbsData structure of the model for which the direct dynamic is computed
Returns
Error status, <0 in case of failure.

◆ mbs_dirdyn_save()

int mbs_dirdyn_save ( MbsDirdyn dd,
MbsData mbs_data,
double  t 
)

save the dirdyn results through the buffer

Parameters
[in]dddirect dynamics module
[in]mbs_dataRobotran main structure
[in]tthe time at which to save the dirdyn results
Returns
Error status, <0 in case of failure.

◆ mbs_dirdyn_write_buffers()

int mbs_dirdyn_write_buffers ( MbsDirdyn dd)

Compute the derivatives of the system (1st derivatives to be given to the ODE integrator)

t the integration variable (time in the case of MBS time integration) y the state vector for which the derivative must be computed dydt the state derivative vector in which the derivative must be returned s the MbsData of the system mbs_aux the local data structure Write the content of buffer associated to the given MbsDirdyn to disk. This is usefull for writing simulation results at the end of the simulation. This sepcific function is written to be able to ask for writing buffer from python.

dd the MbsDirdyn struct for which the buffers must be written

Returns
error (0 if no error)

◆ mbs_new_dirdyn()

MbsDirdyn* mbs_new_dirdyn ( MbsData mbs_data)

Create a new direct dynamic structure.

This function also initialize the options structures and the MbsAux for storing computational info during simulation.

Fields are allocated to default value.

Parameters
mbs_datathe data structure of the model for which the time integration will be computed.
Returns
An allocated MbsDirdyn structure.

◆ mbs_new_dirdyn_aux()

MbsDirdyn* mbs_new_dirdyn_aux ( MbsData mbs_data,
MbsAux *  mbs_aux 
)

Create MbsDirdyn strucure and fill it with auxiliary structure.

This function also initialize the options structures. A pointer to the given MbsAux structure is kept by the returned structure.

The field of MbsDirdyn are set to default values.

mbs_data the data structure of the model for which the time integration will be computed mbs_aux the MbsAux structure related to the model for which the time integration will be computed.

Returns
An allocated MbsDirdyn structure.

◆ mbs_run_dirdyn()

int mbs_run_dirdyn ( MbsDirdyn dirdyn,
MbsData mbs_data 
)

Run the direct dynamic simulation.

The MbsData structure associated to dirdyn is modified

Parameters
[in,out]dirdynthe MbsDirdyn to be run
[in,out]mbs_datathe MbsData structure of the model for which the direct dynamic is computed
Returns
Error status, <0 in case of failure.

calls once user loop