Modia3D Tutorial

This tutorial sketches the main features of Modia3D with examples. A detailed description is available in Modia3D Components.

Plotting

Modia offers an interface to various plot packages. Please, read also the installation guide. Valid options are:

Environment optionModia packageDescription
"GLMakie"ModiaPlot_GLMakieinteractive plots in an OpenGL window
"WGLMakie"ModiaPlot_WGLMakieinteractive plots in a browser window
"CairoMakie"ModiaPlot_CairoMakiestatic plots on file with publication quality
"PyPlot"ModiaPlot_PyPlotplots with Matplotlib from Python
"NoPlot"all plot(...) calls are ignored
"SilentNoPlot"like "NoPlot" without messages

First, you need to add the corresponding Modia package, e.g.

julia> ] add ModiaPlot_GLMakie

A plot package can be either selected by setting ENV["MODIA_PLOT"] = "GLMakie", in the startup.jl file of Julia or with command Modia.usePlotPackage("GLMakie").

3D Renderer

Three.js

Modia3D animation can be exported in threejs-json-format and then imported in the open source web app threejs.org and use all the features of threejs, for example to export in the widely used glb format (= the binary version of the glTF format) and use any glb-viewer (for example 3D-Viewer of Windows 10).

Objects are visualized and exported for offline animation by defining animationFile = "Pendulum2.json" in Scene, see 2. Pendulum with Animation.

The DLR Visualization Library

Modia3D uses the (free) community or the (commercial) professional version of the DLR Visualization Library for 3D simulations. It provides online animation (during simulation) and the generation of mpg4-videos. If you don't use the DLR Visualization Library result animation is switched of. Download and install the free DLR SimVis Community Edition, e.g. with https://visualization.ltx.de/ .

  • Set an environment variable or add it to the startup.jl file. Please, read also the installation guide.
    • 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 ug+x <path-to-library>/Visualization/Extras/SimVis/linux/SimVis