Robotran C Documentation
Macros | Functions
mbs_modal.c File Reference
#include "mbs_modal.h"
#include "mbs_linalg.h"
#include "mbs_errors_names.h"
#include "math.h"
#include "mbs_statespace.h"
#include "mbs_message.h"
#include "mbs_check.h"
#include "mbs_trigo.h"

Macros

#define _USE_MATH_DEFINES
 

Functions

MbsModalmbs_new_modal (MbsData *s)
 Create a new modal structure. More...
 
MbsModalmbs_new_modal_aux (MbsData *s, MbsAux *mbs_aux)
 Create a new modal structure. More...
 
int mbs_run_modal (MbsModal *mo, MbsData *s)
 Run the Modal Analysis. More...
 
int mbs_modal_init (MbsModal *mo, MbsData *s)
 Initialize the Modal structure variables. More...
 
int mbs_modal_loop (MbsModal *mo, MbsData *s)
 Perform the Modal analysis. More...
 
int mbs_modal_finish (MbsModal *mo, MbsData *s)
 Set Modal flag to done in MbsData structure and save the modal analysis. More...
 
void mbs_delete_modal (MbsModal *mo, MbsData *s)
 Free the MbsModal structure (pointers table, ...) More...
 
int mbs_modal_norm_evec (double **mat_r, double **mat_phi, int nqu, int Nux, int ind, double *evec_r, double *evec_phi)
 Additional function necessary for modal analysis post-process. More...
 
int mbs_modal_save_result (MbsModal *mo, MbsData *s, char *filename)
 Write the modal analysis results (eigenmode, eigenfrequencies, mode type, ...) into a ASCII text file. More...
 
int mbs_modal_save_anim (MbsModal *mo, MbsData *s, char *filepath)
 Save the modes animations in the MbSysPad format. More...
 

Detailed Description

This file implements the functions of the modal module in C.

Creation date: 26/11/2015

Author
Quentin Docquier (based on the work of Aubain Verle and Paul Fisette)

(c) Universite catholique de Louvain

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Function Documentation

◆ mbs_delete_modal()

void mbs_delete_modal ( MbsModal mo,
MbsData s 
)

Free the MbsModal structure (pointers table, ...)

The MbsModalOptions (MbsModal::options), the MbsLpk (MbsModal::lpk) and MbsAux (MbsModal::aux) structures are also freed.

Parameters
[in,out]moThe MbsModal to be freed.
[in]sThe MbsData structure related to the parameter mo.

◆ mbs_modal_finish()

int mbs_modal_finish ( MbsModal mo,
MbsData s 
)

Set Modal flag to done in MbsData structure and save the modal analysis.

The Modal analysis results are saved in .txt file:

  • the A matrix
  • the modal analysis (with UNSORTED MODES !!!)
  • the mode animation (to read with the MBSysPad)
Parameters
[in,out]mothe MbsModal to be saved.
[in]sthe MbsData structure related to the parameter mo.
Returns
Error status, <0 in case of failure.

◆ mbs_modal_init()

int mbs_modal_init ( MbsModal mo,
MbsData s 
)

Initialize the Modal structure variables.

It allocates the memory based on the number of independant (nqu) variables in the MBS system

Parameters
[in,out]mothe MbsModal to be run
[in]sthe MbsData structure of the model for which the modal analysis is computed
Returns
Error status, <0 in case of failure.

◆ mbs_modal_loop()

int mbs_modal_loop ( MbsModal mo,
MbsData s 
)

Perform the Modal analysis.

The modal analysis requires the following operations:

  1. Linearization of the Rr term into the stiffness matrix Kr, and the damping matrix Gr (see Basics)
  2. Compution of matrix A (see basics)
  3. Modal analysis (through gcl libraries)
  4. Post processing:
    • 4.1. EigenModes
    • 4.2. EigenModes ordering by types and frequencies

Based on the solvepk algorithm (see Numerics)

Parameters
[in,out]mothe MbsModal to be run
[in]sthe MbsData structure of the model for which the modal analysis is computed
Returns
Error status, <0 in case of failure.

◆ mbs_modal_norm_evec()

int mbs_modal_norm_evec ( double **  mat_r,
double **  mat_phi,
int  nqu,
int  Nux,
int  ind,
double *  evec_r,
double *  evec_phi 
)

Additional function necessary for modal analysis post-process.

It allows to normalize the position nqu part of the eigenvector based on the position part of the vector (vel is ommited). To avoid complication this features is only available when Nux=0 (because for multiphysics, order of magnitude can be different depending on the units chosen...).

Parameters
[in]mat_rnorm of the eigen vectors.
[in]mat_phiphase of the eigen vectors.
[in]nqunumber of independant joints.
[in]Nuxnumber of extra ODE variables.
[in]indindex of the eigen value processed.
[out]evec_rNorm of the eigen vector associated to the mode.
[out]evec_phiPhase of the eigen vector associated to the mode.
Returns
0

◆ mbs_modal_save_anim()

int mbs_modal_save_anim ( MbsModal mbs_modal,
MbsData s,
char *  filepath 
)

Save the modes animations in the MbSysPad format.

Parameters
[in]mbs_modalthe MbsModal to be run
[in]sthe MbsData structure of the model for which the modal analysis is computed
[in]filepaththe path and basename of the file to write.
Returns
Error status, <0 in case of failure.

◆ mbs_modal_save_result()

int mbs_modal_save_result ( MbsModal mbs_modal,
MbsData s,
char *  filename 
)

Write the modal analysis results (eigenmode, eigenfrequencies, mode type, ...) into a ASCII text file.

The modes are not sorted.

Parameters
[in]mbs_modalthe MbsModal to be run
[in]sthe MbsData structure of the model for which the modal analysis is computed
[in]filenamethe path and full name of the file to write.
Returns
Error status, <0 in case of failure.

◆ mbs_new_modal()

MbsModal* mbs_new_modal ( MbsData mbs_data)

Create a new modal structure.

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

mbs_data the data structure of the model for which the modal analysis will be computed

◆ mbs_new_modal_aux()

MbsModal* mbs_new_modal_aux ( MbsData s,
MbsAux *  mbs_aux 
)

Create a new modal structure.

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

mbs_data the data structure of the model for which the modal analysis will be computed

◆ mbs_run_modal()

int mbs_run_modal ( MbsModal mo,
MbsData s 
)

Run the Modal Analysis.

The modal analysis consists in the following function

The MbsData structure associated should not be modified if the process success.

Parameters
[in,out]mothe MbsModal to be run
[in]sthe MbsData structure of the model for which the modal analysis is computed
Returns
Error status, <0 in case of failure.