Definition of the functions related to forces in the multibody system. More...
#include <math.h>#include "mbs_1D_array.h"#include "mbs_data.h"#include "mbs_define.h"#include "mbs_matrix.h"#include "mbs_project_interface.h"#include "mbs_message.h"#include "mbs_errors_names.h"#include "mbs_sensor.h"#include "useful_functions.h"#include "MBSfun.h"Macros | |
| #define | MSG_ERR ">> FORCES>> " |
| #define | MSG_PRE " >> " |
Functions | |
| int | mbs_calc_force (MbsData *s) |
| compute the force and torques applied on the multibody system. More... | |
| double * | get_ball_force (MbsData *mbs_data, MbsSensor *sens, int ancestor, int ball_id, double forces_I[3]) |
| Express the force component of a ball constraint in the inertial frame. More... | |
| double * | get_rod_force (MbsData *mbs_data, MbsSensor *sens, int rod_id, int body_1_id, int pt_1_id, int body_2_id, int pt_2_id, double forces_I[3]) |
| Return the forces components of a rod constraints in inertial frame. More... | |
| double * | get_link_force (MbsData *mbs_data, MbsSensor *sens, int link_id, int body_1_id, int pt_1_id, int body_2_id, int pt_2_id, double *trsh, double forces_I[3]) |
| Compute the component of the forces in a link force in the inertial frame. More... | |
Definition of the functions related to forces in the multibody system.
| #define MSG_ERR ">> FORCES>> " |
| #define MSG_PRE " >> " |
| double* get_ball_force | ( | MbsData * | mbs_data, |
| MbsSensor * | sens, | ||
| int | ancestor, | ||
| int | ball_id, | ||
| double | forces_I[3] | ||
| ) |
Express the force component of a ball constraint in the inertial frame.
The function needs that the Lagrangre's multipliers in MbsData::lambda are already computed. They are computed during the computation of the system dynamic.
| [in] | mbs_data | Pointer to the multibody model structure. |
| [out] | sens | Pointer to the sensor available for computation. A new sensor is allocated (and freed) if the provided pointer is NULL. |
| [in] | ancestor | The index of the first common ancestor to the two ball extremities. The base index is 0. |
| [in] | ball_id | Index of the ball cut. |
| [out] | forces_I | The array where to fill the forces components in inertial frame. If NULL a new array is allocated and must be freed by the caller. |
forces_I except if NULL was provided. NULL is returned in case of error. | double* get_link_force | ( | MbsData * | mbs_data, |
| MbsSensor * | sens, | ||
| int | link_id, | ||
| int | body_1_id, | ||
| int | pt_1_id, | ||
| int | body_2_id, | ||
| int | pt_2_id, | ||
| double * | trsh, | ||
| double | forces_I[3] | ||
| ) |
Compute the component of the forces in a link force in the inertial frame.
The function needs that the link force amplitude in MbsData::Fl is already computed. It is computed during the computation of the system dynamic. The sign convention of the link forces are currently:
The computed force is applied at the point pt_2_id located on the body body_2_id.
The components of the force applied on the other point are simply the opposite of the returned force. It can also be obtained by inversing the bodies and points indices.
| [in] | mbs_data | Pointer to the multibody model structure. |
| [out] | sens | Pointer to the sensor available for computation. A new sensor is allocated (and freed) if the provided pointer is NULL. |
| [in] | link_id | The index of the link. |
| [in] | body_1_id | The index of the body with the first extremity of the link. The base is referenced by index 0. |
| [in] | pt_1_id | The index of the anchor point which is the first extremity of the link force. If the extremity is located on a body origin, the index 0 must be provided. |
| [in] | body_2_id | The index of the body with the second extremity of the link. The base is referenced by index 0. The returned force component are applied on this body. |
| [in] | pt_2_id | The index of the anchor point which is the second extremity of the link force. If the extremity is located on a body origin, the index 0 must be provided. The returned force component are applied on this point. |
| [in] | trsh | Pointer to the minimal link length allowed when computed. A default value of 1e-14 is used if NULL is provided. If the lenght of the rod is lower than this value, NULL is returned. |
A pointer to a negative value (ie `trsh[0] < 0) will allow any link length which can lead to division by zero.
| [out] | forces_I | The array where to fill the forces components in inertial frame. It is filled with INFINITY if an error occurs. If NULL a new array is allocated and must be freed by the caller. |
forces_I except if NULL was provided. NULL is returned in case of error. | double* get_rod_force | ( | MbsData * | mbs_data, |
| MbsSensor * | sens, | ||
| int | rod_id, | ||
| int | body_1_id, | ||
| int | pt_1_id, | ||
| int | body_2_id, | ||
| int | pt_2_id, | ||
| double | forces_I[3] | ||
| ) |
Return the forces components of a rod constraints in inertial frame.
The function needs that the Lagrangre's multipliers in MbsData::lambda are already computed. They are computed during the computation of the system dynamic. The sign convention of the Lagrange multiplier assiciate to rod are:
The computed force is applied at the point pt_2_id located on the body body_2_id.
The components of the force applied on the other point are simply the opposite of the returned force. It can also be obtained by inversing the bodies and points indices.
The length of the rod is not required in input as the computation multiply:
| [in] | mbs_data | Pointer to the multibody model structure. |
| [out] | sens | Pointer to the sensor available for computation. A new sensor is allocated (and freed) if the provided pointer is NULL. |
| [in] | rod_id | The index of the rod cut. |
| [in] | body_1_id | The index of the body with the first extremity of the link. The base is referenced by index 0. |
| [in] | pt_1_id | The index of the anchor point which is the first extremity of the link force. If the extremity is located on a body origin, the index 0 must be provided. |
| [in] | body_2_id | The index of the body with the second extremity of the link. The base is referenced by index 0. The returned force component are applied on this body. |
| [in] | pt_2_id | The index of the anchor point which is the second extremity of the link force. If the extremity is located on a body origin, the index 0 must be provided. The returned force component are applied on this point. |
| [out] | forces_I | The array where to fill the forces components in inertial frame. It is filled with INFINITY if an error occurs. If NULL a new array is allocated and must be freed by the caller. |
forces_I except if NULL was provided. NULL is returned in case of error. | int mbs_calc_force | ( | MbsData * | s | ) |
compute the force and torques applied on the multibody system.
Set the matrices MbsData::frc and MbsData::trq at zero, then compute the contribution of:
| [in,out] | s | the MbsData structure. |
MBS_INFO_SUCCESS if everything went well, <0 if an error has occured
1.8.17