Modeling and Simulation of 3D systems



Travis AppVoyer codecov.io Stable Latest The MIT License

Modia3D is a Julia package to model fixed and moving objects in 3D (e.g. visual shapes, rigid bodies). These objects are driven kinematically by pre-defined time functions or are moving dynamically by solving Differential Algebraic Equations (DAEs) with a variable-step DAE solver.

Collision handling with elastic response calculation is performed for objects that are defined with a contact material and (a) have a convex geometry, (b) can be approximated by a set of convex geometries, or (c) have a concave geometry that is (automatically) approximated by its convex hull. A more detailed overview of the available features is given in the Modia3D documentation. Papers about Modia3D:

Before releasing version 1.0, Modia3D shall be easily combinable with Modia, for example to define a controlled electrical motor with Modia, and add 3D behavior/visualization with Modia3D. By this approach the best of both worlds can be combined: Special 3D algorithms (Modia3D) + power/flexibility of equation based modeling (Modia).


Modia3D is registered in METADATA.jl and can be installed in the following way (Julia >= 1.0 is required):

julia> ]add Modia3D
        add ModiaMath  # in order to use simulate!(..) and plot(..)
        add PyPlot     # in order that plots are shown

Modia3D uses PyPlot for plotting. If PyPlot is not available in your current Julia environment an information message is printed and all plot(..) calls are ignored.

In order that plot windows are displayed, you need to add PyPlot to your current environment via ]add PyPlot. Often this automatic installation fails and it is recommended to follow the instructions Installing PyPlot in a robust way.

Modia3D visualizes the movement of 3D objects with a renderer. Currently, the (free) community or the (commercial) professional version of the DLR Visualization library are supported. To install the free version for Windows or for Linux perform the following steps:

  1. Go to https://visualization.ltx.de/, provide your contact information and click on Request download for Community Edition. Afterwards, you get a link to download the library and you need to unzip the file.

  2. In your Julia startup file (HOME/.julia/config/startup.jl) include the environment variable ENV["DLR_VISUALIZATION"] = "<path-to-library>/Visualization/Extras/SimVis". Make sure that the SimVis executable under this directory has execution rights. For example in Linux with command: chmod +x <path-to-library>/Visualization/Extras/SimVis

  3. Start Julia and run one of the examples, for example include("$(Modia3D.path)/examples/dynamics/Simulate_DoublePendulumWithDampers.jl")

If Modia3D cannot use one of the renderers above, it will continue with renderer NoRenderer that is animation is switched off.


  • STABLEdocumentation of the last released version.
  • LATESTin-development version of the documentation.


To define a model

import ModiaMath
using Modia3D

material1 = Modia3D.Material(color="LightBlue", transparency=0.3);
material2 = Modia3D.Material(color="Red");

@assembly Pendulum(;Lx = 1.0, Ly=0.2*Lx, Lz=0.2*Lx) begin
   world       = Object3D(Modia3D.CoordinateSystem(0.5*Lx))
   beam_frame0 = Object3D(Modia3D.Solid(Modia3D.SolidBeam(Lx,Ly,Lz), "Aluminium", material1))
   beam_frame1 = Object3D(beam_frame0; r=[-Lx/2, 0.0, 0.0])
   cylinder    = Object3D(beam_frame1,Modia3D.Cylinder(Ly/2,1.2*Ly; material=material2))
   revolute    = Modia3D.Revolute(world, beam_frame1)
simulationModel = Modia3D.SimulationModel(Pendulum(Lx=0.8),stopTime=5.0);

To simulate a model, animate and plot results

result = ModiaMath.simulate!(simulationModel);
ModiaMath.plot(result, ["revolute.phi", "revolute.w"]);


To run examples

  import Modia3D

To run tests

  import Modia3D


The package has been tested with Julia on Windows 7, via the TravisCL on Linux (x86_64-pc-linux-gnu) and macOS (x86_64-apple-darwin14.5.0) and via the Appveyor CL on Windows.

Note, the collision handling has still bugs and the elastic response calculation is not yet robust. This needs to be improved.

Furthermore, kinematic loops are currently only supported for 2D loops and if they are driven kinematically. The technique to handle kinematic loops for dynamic simulations is demonstrated in the example include("$(ModiaMath.path)/examples/withoutMacros_withoutVariables/Simulate_PendulumDAE.jl") and is described in the paper Transformation of Differential Algebraic Array Equations to Index One Form.

Issues and Contributions

Contributions are welcome, as are feature requests and suggestions. Please open an issue in this case and also if you encounter problems.

Main Developers and License

Andrea Neumayr and Martin Otter

DLR - Institute of System Dynamics and Control

License: MIT (expat)

First Commit


Last Touched

2 months ago


63 commits

Used By: