Modelica.Mechanics.MultiBody.Visualizers

3-dimensional visual objects used for animation

Information

Package Visualizers contains components to visualize 3-dimensional shapes. These components are the basis for the animation features of the MultiBody library.

Content

FixedShape
FixedShape2
Visualizing an elementary shape with dynamically varying shape attributes. FixedShape has one connector frame_a, whereas FixedShape2 has additionally a frame_b for easier connection to further visual objects. The following shape types are supported:
 
model Visualizers.FixedShape
FixedFrame Visualizing a coordinate system including axes labels with fixed sizes:
model Visualizers.FixedFrame2
FixedArrow,
SignalArrow
Visualizing an arrow. Model "FixedArrow" provides a fixed sized arrow, model "SignalArrow" provides an arrow with dynamically varying length that is defined by an input signal vector:
Torus Visualizing a torus:
VoluminousWheel Visualizing a wheel:
PipeWithScalarField Visualizing a pipe with a scalar field represented by a color coding:
Advanced Package that contains components to visualize 3-dimensional shapes where all parts of the shape can vary dynamically. Basic knowledge of Modelica is needed in order to utilize the components of this package.

The colors of the visualization components are declared with the predefined type MultiBody.Types.Color. This is a vector with 3 elements, {r, g, b}, and specifies the color of the shape. {r,g,b} are the "red", "green" and "blue" color parts. Note, r g, b are given as Integer[3] in the ranges 0 … 255, respectively.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Modelica.Mechanics.MultiBody.Visualizers.FixedShape FixedShape Visualizing an elementary shape with dynamically varying shape attributes (has one frame connector)
Modelica.Mechanics.MultiBody.Visualizers.FixedShape2 FixedShape2 Visualizing an elementary shape with dynamically varying shape attributes (has two frame connectors)
Modelica.Mechanics.MultiBody.Visualizers.FixedFrame FixedFrame Visualizing a coordinate system including axes labels (visualization data may vary dynamically)
Modelica.Mechanics.MultiBody.Visualizers.FixedArrow FixedArrow Visualizing an arrow with dynamically varying size in frame_a
Modelica.Mechanics.MultiBody.Visualizers.SignalArrow SignalArrow Visualizing an arrow with dynamically varying size in frame_a based on input signal
Modelica.Mechanics.MultiBody.Visualizers.Torus Torus Visualizing a torus
Modelica.Mechanics.MultiBody.Visualizers.VoluminousWheel VoluminousWheel Visualizing a voluminous wheel
Modelica.Mechanics.MultiBody.Visualizers.PipeWithScalarField PipeWithScalarField Visualizing a pipe with scalar field quantities along the pipe axis
Modelica.Mechanics.MultiBody.Visualizers.Rectangle Rectangle Visualizing a planar rectangular surface
Modelica.Mechanics.MultiBody.Visualizers.Colors Colors Library of functions operating on color
Modelica.Mechanics.MultiBody.Visualizers.Advanced Advanced Visualizers that require basic knowledge about Modelica in order to use them
Modelica.Mechanics.MultiBody.Visualizers.Internal Internal Makeshift visualizers for display of three-dimensional fonts using cylinders

Modelica.Mechanics.MultiBody.Visualizers.FixedShape Modelica.Mechanics.MultiBody.Visualizers.FixedShape

Visualizing an elementary shape with dynamically varying shape attributes (has one frame connector)

Information

Model FixedShape defines a visual shape that is shown at the location of its frame_a. All describing data such as size and color can vary dynamically by providing appropriate expressions in the input fields of the parameter menu. The only exception is parameter shapeType that cannot be changed during simulation. The following shapes are currently supported via parameter shapeType (e.g., shapeType="box"):
 

model Visualizers.FixedShape

The dark blue arrows in the figure above are directed along variable lengthDirection. The light blue arrows are directed along variable widthDirection. The coordinate systems in the figure represent frame_a of the FixedShape component.

Additionally, external shapes can be specified as (not all options might be supported by all tools):

The supported file formats are tool dependent. Most tools support at least DXF-files but may support other format as well (such as stl, obj, 3ds). Since visualization files contain color and other data, the corresponding information in the model is usually ignored. For information about DXF files, see Wikipedia. As a default it is assumed that the DXF coordinates are in the "frame_a"-system and in meters, and that the 3dfaces are two-sided. Some tools support only 3dface (for geometry) and layer (for advanced coloring).

The sizes of any of the above components are specified by the length, width and height variables. Via variable extra additional data can be defined:

shapeTypeMeaning of parameter extra
"cylinder" if extra > 0, a black line is included in the cylinder to show the rotation of it.
"cone" extra = diameter-left-side / diameter-right-side, i.e.,
extra = 1: cylinder
extra = 0: "real" cone.
"pipe" extra = outer-diameter / inner-diameter, i.e,
extra = 1: cylinder that is completely hollow
extra = 0: cylinder without a hole.
"gearwheel" extra is the number of teeth of the (external) gear. If extra < 0, an internal gear is visualized with |extra| teeth. The axis of the gearwheel is along "lengthDirection", and usually: width = height = 2*radiusOfGearWheel.
"spring" extra is the number of windings of the spring. Additionally, "height" is not the "height" but 2*coil-width.
external shape extra = 0: Visualization from file is not scaled.
extra = 1: Visualization from file is scaled with "length", "width" and "height" of the shape

Parameter color is a vector with 3 elements, {r, g, b}, and specifies the color of the shape. {r, g, b} are the "red", "green" and "blue" color parts. Note, r, g and b are given as Integer[3] in the ranges 0 … 255, respectively. The predefined type MultiBody.Types.Color contains a menu definition of the colors used in the MultiBody library together with a color editor.

Extends from Modelica.Mechanics.MultiBody.Interfaces.PartialVisualizer (Base model for visualizers (has a frame_a on the left side + outer world + assert to guarantee that the component is connected)).

Parameters

NameDescription
animation= true, if animation shall be enabled
if animation = true
shapeTypeType of shape
r_shape[3]Vector from frame_a to shape origin, resolved in frame_a [m]
lengthDirectionVector in length direction of shape, resolved in frame_a [1]
widthDirectionVector in width direction of shape, resolved in frame_a [1]
lengthLength of shape [m]
widthWidth of shape [m]
heightHeight of shape [m]
colorColor of shape
extraAdditional data for cylinder, cone, pipe, gearwheel and spring
specularCoefficientReflection of ambient light (= 0: light is completely absorbed)

Connectors

NameDescription
frame_aCoordinate system in which visualization data is resolved

Modelica.Mechanics.MultiBody.Visualizers.FixedShape2 Modelica.Mechanics.MultiBody.Visualizers.FixedShape2

Visualizing an elementary shape with dynamically varying shape attributes (has two frame connectors)

Information

Model FixedShape2 defines a visual shape that is shown at the location of its frame_a. This model is identical to FixedShape with the only difference that an additional frame_b is present which is parallel to frame_a. This makes it more convenient to connect several visual shapes together when building up more complex visual objects. All describing data such as size and color can vary dynamically by providing appropriate expressions in the input fields of the parameter menu. The only exception is parameter shapeType that cannot be changed during simulation. The following shapes are currently supported via parameter shapeType (e.g., shapeType="box"):
 

model Visualizers.FixedShape2

 
The dark blue arrows in the figure above are directed along variable lengthDirection. The light blue arrows are directed along variable widthDirection. The coordinate systems in the figure represent frame_a of the FixedShape component.

Additionally, external shapes can be specified as (not all options might be supported by all tools):

The supported file formats are tool dependent. Most tools support at least DXF-files but may support other format as well (such as stl, obj, 3ds). Since visualization files contain color and other data, the corresponding information in the model is usually ignored. For information about DXF files, see Wikipedia. As a default it is assumed that the DXF coordinates are in the "frame_a"-system and in meters, and that the 3dfaces are two-sided. Some tools support only 3dface (for geometry) and layer (for advanced coloring).

The sizes of any of the above components are specified by the length, width and height variables. Via variable extra additional data can be defined:

shapeTypeMeaning of parameter extra
"cylinder" if extra > 0, a black line is included in the cylinder to show the rotation of it.
"cone" extra = diameter-left-side / diameter-right-side, i.e.,
extra = 1: cylinder
extra = 0: "real" cone.
"pipe" extra = outer-diameter / inner-diameter, i.e,
extra = 1: cylinder that is completely hollow
extra = 0: cylinder without a hole.
"gearwheel" extra is the number of teeth of the (external) gear. If extra < 0, an internal gear is visualized with |extra| teeth. The axis of the gearwheel is along "lengthDirection", and usually: width = height = 2*radiusOfGearWheel.
"spring" extra is the number of windings of the spring. Additionally, "height" is not the "height" but 2*coil-width.
external shape extra = 0: Visualization from file is not scaled.
extra = 1: Visualization from file is scaled with "length", "width" and "height" of the shape

Parameter color is a vector with 3 elements, {r, g, b}, and specifies the color of the shape. {r, g, b} are the "red", "green" and "blue" color parts. Note, r, g, b are given as Integer[3] in the ranges 0 … 255, respectively. The predefined type MultiBody.Types.Color contains a menu definition of the colors used in the MultiBody library together with a color editor.

In the following figure the relationships between frame_a and frame_b are shown. The origin of frame_b with respect to frame_a is specified via parameter vector r.

Parts.FixedTranslation

Parameters

NameDescription
animation= true, if animation shall be enabled
if animation = true
shapeTypeType of shape
r_shape[3]Vector from frame_a to shape origin, resolved in frame_a [m]
lengthDirectionVector in length direction of shape, resolved in frame_a [1]
widthDirectionVector in width direction of shape, resolved in frame_a [1]
lengthLength of shape [m]
widthWidth of shape [m]
heightHeight of shape [m]
extraAdditional data for cylinder, cone, pipe, gearwheel and spring
colorColor of shape
specularCoefficientReflection of ambient light (= 0: light is completely absorbed)

Connectors

NameDescription
frame_aCoordinate system a (all shape definition vectors are resolved in this frame)
frame_bCoordinate system b

Modelica.Mechanics.MultiBody.Visualizers.FixedFrame Modelica.Mechanics.MultiBody.Visualizers.FixedFrame

Visualizing a coordinate system including axes labels (visualization data may vary dynamically)

Information

Model FixedFrame visualizes the three axes of its coordinate system frame_a together with appropriate axes labels. A typical example is shown in the following figure:
 

model Visualizers.FixedFrame

The sizes of the axes, the axes colors and the specular coefficient (= reflection factor for ambient light) can vary dynamically by providing appropriate expressions in the input fields of the parameter menu.

Extends from Modelica.Mechanics.MultiBody.Interfaces.PartialVisualizer (Base model for visualizers (has a frame_a on the left side + outer world + assert to guarantee that the component is connected)).

Parameters

NameDescription
animation= true, if animation shall be enabled
if animation = true
showLabels= true, if labels shall be shown
lengthLength of axes arrows [m]
diameterDiameter of axes arrows [m]
color_xColor of x-arrow
color_yColor of y-arrow
color_zColor of z-arrow
specularCoefficientReflection of ambient light (= 0: light is completely absorbed)

Connectors

NameDescription
frame_aCoordinate system in which visualization data is resolved

Modelica.Mechanics.MultiBody.Visualizers.FixedArrow Modelica.Mechanics.MultiBody.Visualizers.FixedArrow

Visualizing an arrow with dynamically varying size in frame_a

Information

Model FixedArrow defines an arrow that is shown at the location of its frame_a.
 

model Visualizers.FixedArrow

The direction of the arrow specified with vector n is with respect to frame_a, i.e., the local frame to which the arrow component is attached. The direction, length and color of the arrow can vary dynamically by providing appropriate expressions in the input fields of the parameter menu.

The quantity parameter defines what the vector represents, allowing tools to scale e.g. forces and torques differently in a consistent way. For the default value RelativePosition the obvious scaling is 1 and the relative position is shown as is.

Extends from Modelica.Mechanics.MultiBody.Interfaces.PartialVisualizer (Base model for visualizers (has a frame_a on the left side + outer world + assert to guarantee that the component is connected)).

Parameters

NameDescription
animation= true, if animation shall be enabled
if animation = true
r_tail[3]Vector from frame_a to arrow tail, resolved in frame_a [m]
nVector in arrow direction, resolved in frame_a [1]
lengthLength of complete arrow [m]
colorColor of arrow
specularCoefficientReflection of ambient light (= 0: light is completely absorbed)
quantityKind of physical quantity represented by the vector
headAtOrigin= true, if the vector is pointing towards the origin of vector frame

Connectors

NameDescription
frame_aCoordinate system in which visualization data is resolved

Modelica.Mechanics.MultiBody.Visualizers.SignalArrow Modelica.Mechanics.MultiBody.Visualizers.SignalArrow

Visualizing an arrow with dynamically varying size in frame_a based on input signal

Information

Model SignalArrow defines an arrow that is dynamically visualized at the location where its frame_a is attached. The vector from the tail to the head of the arrow, resolved in frame_a, is defined via the signal vector of the connector r_head (Real r_head[3]):
 

model Visualizers.SignalArrow

The quantity parameter defines what the vector represents, allowing tools to scale e.g. forces and torques differently in a consistent way. For the default value RelativePosition the obvious scaling is 1 and the relative position is shown as is.

The tail of the arrow is defined with input r_tail with respect to frame_a (vector from the origin of frame_a to the arrow tail).

Extends from Modelica.Mechanics.MultiBody.Interfaces.PartialVisualizer (Base model for visualizers (has a frame_a on the left side + outer world + assert to guarantee that the component is connected)).

Parameters

NameDescription
animation= true, if animation shall be enabled
if animation = true
r_tail[3]Vector from frame_a to arrow tail, resolved in frame_a [m]
colorColor of arrow
specularCoefficientReflection of ambient light (= 0: light is completely absorbed)
quantityKind of physical quantity represented by the vector
headAtOrigin= true, if the vector is pointing towards the origin of vector frame

Connectors

NameDescription
frame_aCoordinate system in which visualization data is resolved
r_head[3]Vector resolved in frame_a

Modelica.Mechanics.MultiBody.Visualizers.Torus Modelica.Mechanics.MultiBody.Visualizers.Torus

Visualizing a torus

Information

Model Torus visualizes a torus. The center of the torus is located at connector frame_a (visualized by the red coordinate system in the figure below). The left image below shows a torus with R = 0.5 m and r = 0.2 m. The right images below shows the torus with the additional parameter settings:

opening    =   45 degree
startAngle = -135 degree
stopAngle  =  135 degree

In the advanced menu the discretization of the surface visualization can be defined by the number nR of points along the major radius of the torus and by the number nr of points along the minor radius of the torus. In case the torus is closed (that is, opening = 0 degree), the actual number of points is one less (that is nR - 1, nr - 1), because the first and the last point of the parametrization coincide in this case.

Extends from Modelica.Mechanics.MultiBody.Interfaces.PartialVisualizer (Base model for visualizers (has a frame_a on the left side + outer world + assert to guarantee that the component is connected)).

Parameters

NameDescription
animation= true, if animation shall be enabled
RMajor radius (distance from center of torus to center of tube) [m]
rMinor radius (radius of tube) [m]
openingOpening angle of torus [rad]
startAngleStart angle of torus slice [rad]
stopAngleEnd angle of torus slice [rad]
Material properties
wireframe= true: 3D model will be displayed without faces
colorColor of surface
specularCoefficientReflection of ambient light (= 0: light is completely absorbed)
transparencyTransparency of shape: 0 (= opaque) ... 1 (= fully transparent)
Discretization
n_RNumber of points along major radius R
n_rNumber of points along minor radius r

Connectors

NameDescription
frame_aCoordinate system in which visualization data is resolved

Modelica.Mechanics.MultiBody.Visualizers.VoluminousWheel Modelica.Mechanics.MultiBody.Visualizers.VoluminousWheel

Visualizing a voluminous wheel

Information

Model VoluminousWheel provides a simple visualization of a tire using a torus and a pipe shape object. The center of the wheel is located at connector frame_a (visualized by the red coordinate system in the figure below).

Extends from Modelica.Mechanics.MultiBody.Interfaces.PartialVisualizer (Base model for visualizers (has a frame_a on the left side + outer world + assert to guarantee that the component is connected)).

Parameters

NameDescription
animation= true, if animation shall be enabled
rTireRadius of the tire [m]
rRimRadius of the rim [m]
widthWidth of the tire [m]
rCurvatureRadius of the tire's cross section [m]
Material properties
colorColor of tire
specularCoefficientReflection of ambient light (= 0: light is completely absorbed)
Discretization
n_rTireNumber of points along rTire
n_rCurvatureNumber of points along rCurvature

Connectors

NameDescription
frame_aCoordinate system in which visualization data is resolved

Modelica.Mechanics.MultiBody.Visualizers.PipeWithScalarField Modelica.Mechanics.MultiBody.Visualizers.PipeWithScalarField

Visualizing a pipe with scalar field quantities along the pipe axis

Information

Model PipeWithScalarField visualizes a pipe and a scalar field along the pipe axis. The latter is shown by mapping the scalar field to color values with a color map and utilizing this color at the perimeter associated with the corresponding axis location. Typically the scalar field value is a temperature, but might be also another quantity. Predefined color maps are available from MultiBody.Visualizers.Colors.ColorMaps and can be selected via parameter "colorMap". A color map with the corresponding scalar field values can be exported as vector-graphics in svg-format with function MultiBody.Visualizers.Colors.colorMapToSvg. Connector frame_a of this component is located in the center of the circle at the left side of the pipe and the pipe axis is oriented along the x-axis of frame_a, see figure below in which frame_a is visualized with a coordinate system:

The color coding is shown in the next figure. It was generated with MultiBody.Visualizers.Colors.colorMapToSvg using the following call:

colorMapToSvg(Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.jet(),
              height=50, nScalars=6, T_max=100, caption="Temperature in C");

Extends from Modelica.Mechanics.MultiBody.Interfaces.PartialVisualizer (Base model for visualizers (has a frame_a on the left side + outer world + assert to guarantee that the component is connected)).

Parameters

NameDescription
animation= true, if animation shall be enabled
rOuterOuter radius of pipe [m]
lengthLength of pipe [m]
xsi[:]Vector of relative positions along the pipe with x[1] = 0, x[end] = 1
T[size(xsi, 1)]Vector of values at positions xsi*length (will be visualized by color)
T_minMinimum value of T that corresponds to colorMap[1,:]
T_maxMaximum value of T that corresponds to colorMap[end,:]
Color coding
replaceable function colorMapFunction defining the color map
n_colorsNumber of colors in the colorMap
specularCoefficientReflection of ambient light (= 0: light is completely absorbed)
transparencyTransparency of shape: 0 (= opaque) ... 1 (= fully transparent)
Discretization
n_rOuterNumber of points along outer radius
n_lengthNumber of points along length

Connectors

NameDescription
frame_aCoordinate system in which visualization data is resolved
Color coding
replaceable function colorMapFunction defining the color map

Modelica.Mechanics.MultiBody.Visualizers.Rectangle Modelica.Mechanics.MultiBody.Visualizers.Rectangle

Visualizing a planar rectangular surface

Information

This model visualizes a planar rectangle. The center of the rectangle is located at connector frame_a (visualized by the red coordinate system in the figure below). The figure below shows two rectangles of the same parameters

nu = 8,
nv = 3,
length_u = 3,
length_v = 2.

The green rectangle on the right is visualized in wireframe thus highlighting the influence of the discretization. Moreover, the u-axis of this rectangle is modified so that the rectangle is rotated about the z-axis of frame_a.

Extends from Modelica.Mechanics.MultiBody.Interfaces.PartialVisualizer (Base model for visualizers (has a frame_a on the left side + outer world + assert to guarantee that the component is connected)).

Parameters

NameDescription
animation= true, if animation shall be enabled
direction_uVector along u-axis of rectangle resolved in frame_a [1]
direction_vVector along v-axis of rectangle resolved in frame_a [1]
length_uLength of rectangle in direction u [m]
length_vLength of rectangle in direction v [m]
Discretization
nuNumber of points in direction u
nvNumber of points in direction v
Material properties
wireframe= true: 3D model will be displayed without faces
colorColor of surface
specularCoefficientReflection of ambient light (= 0: light is completely absorbed)
transparencyTransparency of shape: 0 (= opaque) ... 1 (= fully transparent)

Connectors

NameDescription
frame_aCoordinate system in which visualization data is resolved
Automatically generated Thu Oct 1 16:07:54 2020.