Direct dynamics analysis ======================== .. container:: python .. highlight:: python Introduction ------------ This tutorial introduces additional features of the Direct Dynamics module in Robotran. For the basics use of direct dynamics, see the Pendulum-Spring tutorial `Getting Started `__. .. container:: python The programming language in this tutorial is **Python**. All the detailed informations is given in the `MBsysPy documentation `__. However, this tutorial gives some insights on some specific options. .. rubric:: Time integration :name: time-integration .. rubric:: Integrator type :name: integrator-type MBsysPy comes with different integrators (RK4, Dopri5…). The selection of the integrator is done by setting ``mbs_dirdyn.set_options(integrator)`` to the wanted value. The list of the available integrators is in the `MBsysPy documentation `__. .. code:: python #... # %%=========================================================================== # Direct Dynamics # ============================================================================= # dirdyn options (see documentations for additional options) mbs_dirdyn.set_options(integrator = "RK4") #... Other options have to follow the same syntax as above. REMARK: By default, the integrator is Runge Kutta with 4 steps .. rubric:: Integrators parameters :name: integrators-parameters Depending on the integrators, various parameters can be chosen (``toler``, ``dt_max``, …). See `MBsysPy documentation `__. .. rubric:: Force the integrator to pass at specific time values :name: force-the-integrator-to-pass-at-specific-time-values If you need an adaptive integrator to pass at some fixed time stepped value (for example for a synchronization), you can activate the ``flag_waypoint`` in the options. Then the step size is defined in the ``delta_t_wp`` field. .. .. rubric:: Stiff systems :name: stiff-systems It is also possible to perform numerical stabilization based on `Baumgarte method `__ at the velocities and accelerations levels. See ``flag_baumgarte_stabilization`` and ``baumgarte_alpha`` ``baumgarte_beta`` options. .. rubric:: Jacobian calculation :name: jacobian-calculation For the implicit integrators, option ``n_freeze`` may stop the computation and compute it only each ``n_freeze``\ time. For example, if ``n_freeze = 1``, the Jacobian will be computed every two time steps. Besides, the flag ``flag_ongoing_jac_computation`` says when the integrator is computing the Jacobian (==1) or when an internal step is processed (==0). It allows to separate calculation between the two situations. For example, if a FSM is used, it could be better not to change the FSM state during the Jacobian computation. .. rubric:: Animation :name: animation Various options are available for customizing the animations saving (see ``resfilename``, ``respath``, ``save_anim``, …). .. rubric:: Various :name: various To make the computation time smaller, several flags allow to prevent Robotran from computing useless values. - ``flag_compute_Qc`` and ``compute_Qc``: computation of the driven joint Lagrange multipliers - ``compute_all_uxd``: computation of the user derivative