Modal analysis
==============
.. container:: python
.. highlight:: python
Introduction
------------
This tutorial introduces the modal Analysis module in Robotran. You have
to be comfortable with the basics modelling features of the `Getting
started tutorial `__ of
Robotran.
.. figure:: figure/AnalysisModules_modal.png
:alt: Summary of tutorial contents
Features summary
.. container:: python
The programming language in this tutorial is **Python**. The same
tutorial for **C** is available, but not for **Matlab** at the
moment.
REMARK:
For more details of the parameters, please refer to the `MBsysPy
Documentation `__.
A modal Analysis is the study of the dynamic properties of systems in
the frequency domain. Through the modal analysis, the eigen modes and
eigen frequencies of the system are calculated. In the case of multibody
system, it is particularly interesting for control purpose as it allows
to identify the stable and unstable modes of the system. It is also
useful to study the vibration behaviour of the system and identify
critical frequencies of excitation that could lead to resonances in the
system.
A modal analysis concerns the linear behaviour (small displacements) of
the system around a given configuration. Therefore, it is mandatory to
start from an equilibrium configuration which can be calculated with the
`Equilibrium module <./equilibrium.html>`__.
Example - the cart pendulum without spring…
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In this tutorial, the multibody system used is the same as the one for
the equilibrium tutorial: a four-bar pendulum mounted on a cart with a
suspended mass.
.. figure:: figure/robotran.png
:alt: *MBsysPad* Diagram for the four bar pendulum mounted on a cart
MBSysPad diagram of the four-bar pendulum mounted on a cart
Modal Analysis Theory
---------------------
As the linear behaviour of the system around a given configuration is of
interest, the equations of motion need to be linearized around this
configuration. Generally, the equations to linearize are the reduced set
of equations obtained through the coordinate partitioning technique:
\ :math:`\mathbf{F_r}(\mathbf{q_u}, \dot{\mathbf{q}}_\mathbf{u}) = \mathbf{0}`\
For a general MBS model, the linearization is performed numerically,
producing the following linearized system around the equilibrium
configuration characterized by \ :math:`\mathbf{q}_\mathbf{u}^*`\ .
\ :math:`\mathbf{M_r}(\mathbf{q}_\mathbf{u}^*) \Delta \ddot{\mathbf{q}}_\mathbf{u} + \mathbf{G_r}(\mathbf{q}_\mathbf{u}^*,\dot{\mathbf{q}}_\mathbf{u}^*) \Delta \dot{\mathbf{q}}_\mathbf{u} + \mathbf{K_r}(\mathbf{q}_\mathbf{u}^*) \Delta \mathbf{q}_\mathbf{u} = \mathbf{0}`\
in which
\ :math:`\Delta \mathbf{q}_\mathbf{u} = \mathbf{q}_\mathbf{u} − \mathbf{q}_\mathbf{u}^∗`\ ,
\ :math:`\mathbf{M_r}`\ ,
\ :math:`\mathbf{G_r}`\ ,\ :math:`\mathbf{K_r}`\ respectively stand for
the constant mass, gyroscopic/damping and stiffness tangent matrices
(size \ :math:`n−m=n_u`\ , the number of d.o.f.). This second-order
linear system can be transformed into the following first order form:
\ :math:`\dot{\mathbf{x}}= \mathbf{A} \mathbf{x}`\
with
\ :math:`\mathbf{x}=\begin{bmatrix} \dot{\mathbf{q}}_{\mathbf{u}} \\ \mathbf{q}_{\mathbf{u}} \end{bmatrix}\rightarrow \dot{\mathbf{x}} =\begin{bmatrix} \ddot{\mathbf{q}}_{\mathbf{u}} \\ \dot{\mathbf{q}}_{\mathbf{u}} \end{bmatrix} \phantom{.....................} \mathbf{A} = \begin{bmatrix} -\mathbf{M_r}^{-1}\mathbf{G_r} & -\mathbf{M_r}^{-1}\mathbf{K_r} \\ \mathbf{I} & \mathbf{0} \end{bmatrix}`\
On this form, the eigenvalue problem can be solved determining the
eigenfrequencies and the eigenmodes of the multibody system.
Modal Analysis Results
----------------------
Solving the associated eigenvalue Problem, a total of \ :math:`2 n_u`\
eigenvalues \ :math:`\lambda`\ can be found. Each of these eigenvalues
\ :math:`\lambda_i`\ can be :
- purely real (\ :math:`im(\lambda_i`)=0), corresponding to a
*non-oscillatory stable* (\ :math:`\lambda_i`\ <0) or
*non-oscillatory unstable* (\ :math:`\lambda_i`>0) eigenmode.
- purely imaginary (\ :math:`re(\lambda_i`)=0),conjugate pair,
corresponding to *infinitively oscillating* undamped eigenmode.
- complex, conjugate pair, corresponding to *oscillatory stable*
(\ :math:`re(\lambda_i`)<0) or *oscillatory unstable*
(\ :math:`re(\lambda_i`)>0) eigenmode.
- null, corresponding to a *rigid* mode.
A maximum of \ :math:`2 n_u`\ eigenvectors \ :math:`v_i`\ can be also
found. Let us note that in case of multiple eigenvalues, there is only
eigenvector and thus the number of eigenvectors will be less than
\ :math:`2 n_u`\ . Moreover, in case of conjugate eigenvalues, a pair of
complex conjugate eigenvectors is produced, giving rise to a single (and
not two) eigenmode.
Example - the cart pendulum with spring
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For the cart pendulum, there are three 3 independent variables:
\ :math:`\mathbf{q_u} = \left[ q_1,q_2,q_3 \right]`\ and 2 dependent
variables: \ :math:`\mathbf{q_v} = \left[ q_4,q_5 \right]`\ . The
linearization then results in 3 matrices of size 3 by 3.
The modal analysis (linearization, eigenvalue problem solving,
post-process) are done by the *modal* module which is based on a
structure similar to the *direct dynamic* module and the *equilibrium*
module.
.. container:: python
- Just after the equilibrium in the *main* function, execute the
modal analysis by writing the following lines.
- Option *save_mat* allows to specify whether the matrices
\ :math:`\mathbf{M_r}`\ ,
\ :math:`\mathbf{G_r}`\ ,\ :math:`\mathbf{K_r}`\ and
\ :math:`\mathbf{A}`\ have to be saved.
- Option *save_anim* allows to specify whether animation files of
the mode (readable with *MBSysPad*) have to be generated.
- Option *mode_ampl* allows to amplify the mode in the animation
files for a better visualization (default is 0.2).
- Option *verbose* displays the steps of the Modal Analysis
(linearization, modal analysis, post-process).
.. code:: python
#...
#==============================================================================
# Some equilibrium
#==============================================================================
# equilibrium lines of code
#==============================================================================
# Modal
#==============================================================================
mbs_data.process = 4
mbs_modal = Robotran.MbsModal(mbs_data)
mbs_modal.set_options(save_mat = 1, save_eval = 1, save_evec = 1, save_result = 1)
mbs_modal.set_options(save_anim = 1, mode_ampl = 0.5, norm_evec = 0, verbose = 1)
mbs_modal.run()
..
Remarks :
- The modal analysis computation is based on the *mbs_data*
structure but it does not affect the values previously written
in the structure.
- The generation of the animation files for the modes can
sometimes be time-consuming which is the reason why by default
they are not generated.
There you can see the printout of the modal analysis. All the different
steps are correctly done.
.. figure:: figure/modal_printout.png
:alt: Printout of the modal analysis
Printout for a modal analysis
A summary of the results are saved in the file *modal_result.res* (in
the resultR folder). The first two eigenvalues are zero which correspond
to one rigid mode (1 and 2). The third and forth eigenvalues are complex
(conjugate pair) and correspond to a the stable oscillation of the
slider on the pendulum (3 and 4). Eventually, eigenvalue 5 and 6 are
also complex (conjugate pair) and correspond to the stable oscillation
of both the cart and the pendulum out of phase. (Check the animationR
folder and read the animated modes with MBsysPad viewer)
.. figure:: figure/modal_summary.png
:alt: Summary of modal results
Summary of modal results
.. figure:: figure/mode_1.gif
:alt: test gif
modes 1 and 2
.. figure:: figure/mode_3.gif
:alt: test gif2
modes 3 and 4
.. figure:: figure/mode_5.gif
:alt: test gif3
modes 5 and 6
..
REMARK:
In our implementation, multiple eigenmodes are produced (their
animation as well).
..
REMARK:
It is also possible to perform a modal analysis around a quasistatic
equilibrium.