This library is used to model 3-dimensional mechanical systems, such as robots, satellites or vehicles. The components of the MultiBody library can be combined with the 1D-mechanical libraries Modelica.Mechanics.Rotational and Modelica.Mechanics.Translational. A unique feature of the MultiBody library is the efficient treatment of joint locking and unlocking. This allows e.g. easy modeling of friction or brakes in the joints.

A first example to model a simple pendulum is given in the next figure:


This system is built up by the following components:

The 3D-components are connected together at connectors Frame_a or Frame_b. Both connectors define a coordinate system (a frame) at a specific location of the component, which is fixed in the component. The frame, i.e., the corresponding connector, is defined by the following variables:

  S[3,3]: Rotation matrix describing the frame with respect to the inertial
          frame, i.e. if ha is vector h resolved in frame_a and h0 is
          vector h resolved in the inertial frame, h0 = S*ha.
  r0[3] : Vector from the origin of the inertial frame to the origin
          of the frame, resolved in the inertial frame in [m] !!! (note,
          that all other vector quantities are resolved in frame_a!!!).
  v[3]  : Absolute (translational) velocity of the frame, resolved in
          the frame in [m/s]:  v = transpose(S)*der(r0)
  w[3]  : Absolute angular velocity of the frame, resolved in the frame,
          in [rad/s]:  w = vec(transpose(S)*der(S)), where
                      |   0   -w[3]  w[2] |
            skew(w) = |  w[3]   0   -w[1] | and w=vec(skew(w))
                      | -w[2]  w[1]   0   |
  a[3]  : Absolute translational acceleration of the frame minus gravity
          acceleration, resolved in the frame, in [m/s^2]:
             a = transpose(S)*( der(S*v) - ng*g )
          (ng,g are defined in model MultiBody.Parts.InertialSystem).
  z[3]  : Absolute angular acceleration of the frame, resolved in the
          frame, in [rad/s^2]:  z = transpose(S)*der(S*w)
  f[3]  : Resultant cut-force acting at the origin of the frame,
          resolved in the frame, in [N].
  t[3]  : Resultant cut-torque with respect to the origin of the frame,
          resolved in the frame, in [Nm].

If two frame-connectors are connected together, the corresponding frames are rigidly fixed together, i.e., they are identical. Usually, all vectors of a component are expressed in frame_a of this component, i.e., in a coordinate system fixed in the component. For example, the vector from the origin of frame_a to the center-of-mass in component MultiBody.Parts.Body is resolved in frame_a.

Similiarily to the pendulum example above, most local frames are parallel to each other, if the generalized relative coordinates of the joints are zero. This means that in this configuration all vectors can be defined, as if the vectors would be expressed in the inertial frame (since all frames are parallel to each other). This view simplifies the definition. Only, if components Parts.FrameRotation, Parts.FrameAxes or Parts.FrameAngles are used, the frames are no longer parallel to each other in this nominal configuration.

A more advance example is shown in the next figure. It is the definition of the mechanical structure of the robot r3, defined in the MultiBody.Examples.Robots.r3 sublibrary. It consists of a robot with 6 degrees-of-freedoms constructed with 6 revolutes joints and 6 shape bodies (i.e., the mass and inertia data is computed from shape data). The flanges of the driving axes of the joints are defined as flanges external to the model (connectors axis1, axis2, ..., axis6).

robot r3 (diagram layer)

After processing the r3 model with a Modelica translator and simulating it, an animation can be performed:

robot r3 (animation)

It is also possible to define multibody systems which have kinematic loops. An example is given in the next two figures (as object diagram and as animation view) where a mechanism with two coupled loops and one degree of freedom is shown:

TwoLoops1 TwoLoops2

The ModelicaAdditions.MultiBody library consists of the following elements:

Connection Rules:
The elements of the multibody library cannot be connected arbitrarily together. Instead the following rules hold:

  1. Tree joint objects, body objects and the inertial system have to be connected together in such a way that a frame_a of an object (cut filled with blue color) is always connected to a frame_b of an object (non-filled cut). The connection structure has to form a tree with the inertial system as a root.
  2. Cut-joint, force, and sensor objects have to be always connected between two frames of a tree joint, body or inertial system object. E.g., it is not allowed to connect two force objects together.
  3. By using the input/output prefixes of Modelica in the corresponding connectors of the MultiBody library, it is guaranteed that only connections can be carried out, for which the library is designed.

This package is not part of the Modelica standard library, because a "truely object-oriented" 3D-mechanical library is under development. The essential difference is that the new library no longer has restrictions on connections and that the modeller does not have to handle systems with kinematic loops in a different way (as a consequence, sublibrary CutJoints will be removed; the structure of the remaining library will be not changed, only the implementation of the model classes).

Note, this library utilizes the non-standard function constrain(..) and assumes that this function is supported by the Modelica translator:

   Real r[:], rd[:], rdd[:];
   r   = ..
   rd  = ...
   rdd = ...

where r, rd and rdd are variables which need to be computed somewhere else. Function constrain() is used to explicitly inform the Modelica translator that rd is the derivative of r and rdd is the derivative of rd and that all derivatives need to be identical to zero. The Modelica translator can utilize this information to use rd and rdd whenever the Pantelides algorithm requires to compute the derivatives of r. This enhances the efficiency considerably. A simple, but inefficient, implementation of constrain() is:

   r = 0;

In the multibody library, function constrain() is used in the cut joints, i.e., whenever kinematic loops are present.


The following paper can be downloaded from
   http://www.dynasim.se/publications.html and

Algorithmic details of the multibody library are described in
    Otter M., Elmqvist H., and Cellier F.E:  Modeling of Multibody Systems
          with the Object-Oriented Modeling Language Dymola . Proceedings
          of the NATO-Advanced Study Institute on  Computer Aided
          Analysis of Rigid and Flexible Mechancial Systems , Volume II,
          pp. 91-110, Troia, Portugal, 27 June - 9 July, 1993. Also in:
          Nonlinear Dynamics, 9:91-112, 1996, Kluwer Academic Publishers.
Main Author:
Martin Otter
Deutsches Zentrum für Luft und Raumfahrt e.V. (DLR)
Institut für Robotik und Mechatronik
Postfach 1116
D-82230 Wessling
email: Martin.Otter@dlr.de

Release Notes:

Copyright © 2000-2002, DLR.

The ModelicaAdditions.MultiBody package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions and the accompanying disclaimer in the documentation of package Modelica in file "Modelica/package.mo".


Name Description
Visualizers For animation of across vector quantities.
Sensors Sensors for 3D mechanical components
Parts Parts with and without mass for 3D mechanical components
Joints Joints in the spanning tree
Interfaces Connectors and partial models for 3D mechanical components
Forces Force and torque elements for 3D mechanical components
Examples Examples for the 3D mechanical systems library
CutJoints Cut-joints for 3D mechanical components

Generated at 2019-07-20T01:38:23Z by OpenModelicaOpenModelica 1.14.0~dev-26614-ga75b5bf using GenerateDoc.mos