Modelica.Mechanics.MultiBody.Visualizers.Advanced

Visualizers that require basic knowledge about Modelica in order to use them

Information


Package Visualizers.Advanced contains components to visualize 3-dimensional shapes with dynamical sizes. None of the components has a frame connector. The position and orientation is set via modifiers. Basic knowledge of Modelica is needed in order to utilize the components of this package. These components have also to be used for models, where the forces and torques in the frame connector are set via equations (in this case, the models of the Visualizers package cannot be used, since they all have frame connectors).

Content

Arrow Visualizing an arrow where all parts of the arrow can vary dynamically:
model Visualizers.Advanced.Arrow
DoubleArrow Visualizing a double arrow where all parts of the arrow can vary dynamically:
model Visualizers.Advanced.DoubleArrow
Shape Animation shape of a part with dynamically varying sizes. The following shape types are supported:
 
model Visualizers.Advanced.Shape

Extends from Modelica.Icons.Library (Icon for library).

Package Content

NameDescription
Modelica.Mechanics.MultiBody.Visualizers.Advanced.Arrow Arrow Visualizing an arrow with variable size; all data have to be set as modifiers (see info layer)
Modelica.Mechanics.MultiBody.Visualizers.Advanced.DoubleArrow DoubleArrow Visualizing a double arrow with variable size; all data have to be set as modifiers (see info layer)
Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape Shape Different visual shapes with variable size; all data have to be set as modifiers (see info layer)


Modelica.Mechanics.MultiBody.Visualizers.Advanced.Arrow Modelica.Mechanics.MultiBody.Visualizers.Advanced.Arrow

Visualizing an arrow with variable size; all data have to be set as modifiers (see info layer)

Information


Model Arrow defines an arrow that is dynamically visualized at the defined location (see variables below).

model Visualizers.Advanced.Arrow

The variables under heading Parameters below are declared as (time varying) input variables. If the default equation is not appropriate, a corresponding modifier equation has to be provided in the model where an Arrow instance is used, e.g., in the form

    Visualizers.Advanced.Arrow arrow(diameter = sin(time));

Variable color is an Integer 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 in the range 0 .. 255. The predefined type MultiBody.Types.Color contains a menu definition of the colors used in the MultiBody library (will be replaced by a color editor).

Parameters

TypeNameDefaultDescription
OrientationRFrames.nullRotation()Orientation object to rotate the world frame into the arrow frame.
Positionr[3]{0,0,0}Position vector from origin of world frame to origin of arrow frame, resolved in world frame [m]
Positionr_tail[3]{0,0,0}Position vector from origin of arrow frame to arrow tail, resolved in arrow frame [m]
Positionr_head[3]{0,0,0}Position vector from arrow tail to the head of the arrow, resolved in arrow frame [m]
Diameterdiameterworld.defaultArrowDiameterDiameter of arrow line [m]
ColorcolorModelica.Mechanics.MultiBody...Color of arrow
SpecularCoefficientspecularCoefficientworld.defaultSpecularCoeffic...Material property describing the reflecting of ambient light (= 0 means, that light is completely absorbed)

Modelica definition

model Arrow 
  "Visualizing an arrow with variable size; all data have to be set as modifiers (see info layer)"

  import SI = Modelica.SIunits;
  import Modelica.Mechanics.MultiBody.Types;
  import Modelica.Mechanics.MultiBody.Frames;

  input Frames.Orientation R=Frames.nullRotation() 
    "Orientation object to rotate the world frame into the arrow frame.";
  input SI.Position r[3]={0,0,0} 
    "Position vector from origin of world frame to origin of arrow frame, resolved in world frame";
  input SI.Position r_tail[3]={0,0,0} 
    "Position vector from origin of arrow frame to arrow tail, resolved in arrow frame";
  input SI.Position r_head[3]={0,0,0} 
    "Position vector from arrow tail to the head of the arrow, resolved in arrow frame";
  input SI.Diameter diameter=world.defaultArrowDiameter 
    "Diameter of arrow line";
  input Modelica.Mechanics.MultiBody.Types.Color color=Modelica.Mechanics.MultiBody.Types.Defaults.ArrowColor 
    "Color of arrow";
  input Types.SpecularCoefficient specularCoefficient = world.defaultSpecularCoefficient 
    "Material property describing the reflecting of ambient light (= 0 means, that light is completely absorbed)";

protected 
  outer Modelica.Mechanics.MultiBody.World world;
  SI.Length length=Modelica.Math.Vectors.length(
                                 r_head) "Length of arrow";
  Visualizers.Advanced.Shape arrowLine(
    length=noEvent(max(0, length - diameter*Types.Defaults.
        ArrowHeadLengthFraction)),
    width=diameter,
    height=diameter,
    lengthDirection=r_head,
    widthDirection={0,1,0},
    shapeType="cylinder",
    color=color,
    specularCoefficient=specularCoefficient,
    r_shape=r_tail,
    r=r,
    R=R) if world.enableAnimation;
  Visualizers.Advanced.Shape arrowHead(
    length=noEvent(max(0, min(length, diameter*Types.Defaults.
        ArrowHeadLengthFraction))),
    width=noEvent(max(0, diameter*MultiBody.Types.Defaults.
        ArrowHeadWidthFraction)),
    height=noEvent(max(0, diameter*MultiBody.Types.Defaults.
        ArrowHeadWidthFraction)),
    lengthDirection=r_head,
    widthDirection={0,1,0},
    shapeType="cone",
    color=color,
    specularCoefficient=specularCoefficient,
    r=arrowLine.rvisobj + arrowLine.rxvisobj*arrowLine.length,
    R=R) if world.enableAnimation;

end Arrow;

Modelica.Mechanics.MultiBody.Visualizers.Advanced.DoubleArrow Modelica.Mechanics.MultiBody.Visualizers.Advanced.DoubleArrow

Visualizing a double arrow with variable size; all data have to be set as modifiers (see info layer)

Information


Model DoubleArrow defines a double arrow that is dynamically visualized at the defined location (see variables below).

model Visualizers.Advanced.DoubleArrow

The variables under heading Parameters below are declared as (time varying) input variables. If the default equation is not appropriate, a corresponding modifier equation has to be provided in the model where an Arrow instance is used, e.g., in the form

    Visualizers.Advanced.DoubleArrow doubleArrow(diameter = sin(time));

Variable color is an Integer 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 in the range 0 .. 255. The predefined type MultiBody.Types.Color contains a menu definition of the colors used in the MultiBody library (will be replaced by a color editor).

Parameters

TypeNameDefaultDescription
OrientationRFrames.nullRotation()Orientation object to rotate the world frame into the arrow frame.
Positionr[3]{0,0,0}Position vector from origin of world frame to origin of arrow frame, resolved in world frame [m]
Positionr_tail[3]{0,0,0}Position vector from origin of arrow frame to double arrow tail, resolved in arrow frame [m]
Positionr_head[3]{0,0,0}Position vector from double arrow tail to the head of the double arrow, resolved in arrow frame [m]
Diameterdiameterworld.defaultArrowDiameterDiameter of arrow line [m]
ColorcolorModelica.Mechanics.MultiBody...Color of double arrow
SpecularCoefficientspecularCoefficientworld.defaultSpecularCoeffic...Material property describing the reflecting of ambient light (= 0 means, that light is completely absorbed)

Modelica definition

model DoubleArrow 
  "Visualizing a double arrow with variable size; all data have to be set as modifiers (see info layer)"

  import SI = Modelica.SIunits;
  import Modelica.Mechanics.MultiBody.Types;
  import Modelica.Mechanics.MultiBody.Frames;
  input Frames.Orientation R=Frames.nullRotation() 
    "Orientation object to rotate the world frame into the arrow frame.";
  input SI.Position r[3]={0,0,0} 
    "Position vector from origin of world frame to origin of arrow frame, resolved in world frame";
  input SI.Position r_tail[3]={0,0,0} 
    "Position vector from origin of arrow frame to double arrow tail, resolved in arrow frame";
  input SI.Position r_head[3]={0,0,0} 
    "Position vector from double arrow tail to the head of the double arrow, resolved in arrow frame";
  input SI.Diameter diameter=world.defaultArrowDiameter 
    "Diameter of arrow line";
  input Modelica.Mechanics.MultiBody.Types.Color color=Modelica.Mechanics.MultiBody.Types.Defaults.ArrowColor 
    "Color of double arrow";
  input Types.SpecularCoefficient specularCoefficient = world.defaultSpecularCoefficient 
    "Material property describing the reflecting of ambient light (= 0 means, that light is completely absorbed)";

protected 
  outer Modelica.Mechanics.MultiBody.World world;
  SI.Length length=Modelica.Math.Vectors.length(
                                 r_head) "Length of arrow";
  SI.Length headLength=noEvent(max(0, min(length, diameter*MultiBody.Types.
      Defaults.ArrowHeadLengthFraction)));
  SI.Length headWidth=noEvent(max(0, diameter*MultiBody.Types.Defaults.
      ArrowHeadWidthFraction));
  Visualizers.Advanced.Shape arrowLine(
    length=noEvent(max(0, length - 1.5*diameter*MultiBody.Types.Defaults.
        ArrowHeadLengthFraction)),
    width=diameter,
    height=diameter,
    lengthDirection=r_head,
    widthDirection={0,1,0},
    shapeType="cylinder",
    color=color,
    specularCoefficient=specularCoefficient,
    r_shape=r_tail,
    r=r,
    R=R) if world.enableAnimation;
  Visualizers.Advanced.Shape arrowHead1(
    length=headLength,
    width=headWidth,
    height=headWidth,
    lengthDirection=r_head,
    widthDirection={0,1,0},
    shapeType="cone",
    color=color,
    specularCoefficient=specularCoefficient,
    r=arrowLine.rvisobj + arrowLine.rxvisobj*arrowLine.length,
    R=R) if world.enableAnimation;
  Visualizers.Advanced.Shape arrowHead2(
    length=headLength,
    width=headWidth,
    height=headWidth,
    lengthDirection=r_head,
    widthDirection={0,1,0},
    shapeType="cone",
    color=color,
    specularCoefficient=specularCoefficient,
    r=arrowLine.rvisobj + arrowLine.rxvisobj*(arrowLine.length + 0.5*
        arrowHead1.length),
    R=R) if world.enableAnimation;

end DoubleArrow;

Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape

Different visual shapes with variable size; all data have to be set as modifiers (see info layer)

Information


Model Shape defines a visual shape that is shown at the location of its reference coordinate system, called 'object frame' below. All describing variables such as size and color can vary dynamically (with the only exception of parameter shapeType). The default equations in the declarations should be modified by providing appropriate equations. Model Shape is usually used as a basic building block to implement simpler to use graphical components.

The following shapes are 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 Shape component.

Additionally, external shapes are specified as DXF-files (only 3-dim.Face is supported). External shapes must be named "1", "2" etc.. The corresponding definitions should be in files "1.dxf", "2.dxf" etc.Since the DXF-files contain color and dimensions for the individual faces, the corresponding information in the model is currently ignored. The DXF-files must be found either in the current directory or in the directory where the Shape instance is stored that references the DXF file.

Via input variable extra additional sizing data is defined according to:

shapeTypeMeaning of variable 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 gear.
"spring" extra is the number of windings of the spring. Additionally, "height" is not the "height" but 2*coil-width.

Parameter color is an Integer 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 in the range 0 .. 255. The predefined type MultiBody.Types.Color contains a menu definition of the colors used in the MultiBody library (will be replaced by a color editor).

The variables under heading Parameters below are declared as (time varying) input variables. If the default equation is not appropriate, a corresponding modifier equation has to be provided in the model where a Shape instance is used, e.g., in the form

    Visualizers.Advanced.Shape shape(length = sin(time));

Extends from Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialShape (Different visual shapes with variable size; all data have to be set as modifiers), ModelicaServices.Animation.Shape (Different visual shapes with variable size; all data have to be set as modifiers (see info layer)).

Parameters

TypeNameDefaultDescription
ShapeTypeshapeType"box"Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring)
OrientationRFrames.nullRotation()Orientation object to rotate the world frame into the object frame
Positionr[3]{0,0,0}Position vector from origin of world frame to origin of object frame, resolved in world frame [m]
Positionr_shape[3]{0,0,0}Position vector from origin of object frame to shape origin, resolved in object frame [m]
ReallengthDirection[3]{1,0,0}Vector in length direction, resolved in object frame [1]
RealwidthDirection[3]{0,1,0}Vector in width direction, resolved in object frame [1]
Lengthlength0Length of visual object [m]
Lengthwidth0Width of visual object [m]
Lengthheight0Height of visual object [m]
ShapeExtraextra0.0Additional size data for some of the shape types
Realcolor[3]{255,0,0}Color of shape
SpecularCoefficientspecularCoefficient0.7Reflection of ambient light (= 0: light is completely absorbed)

Modelica definition

model Shape 
  "Different visual shapes with variable size; all data have to be set as modifiers (see info layer)"

   extends Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialShape;
   extends ModelicaServices.Animation.Shape;

end Shape;

HTML-documentation generated by Dymola Sun Jan 17 21:11:41 2010.