# World

World coordinate system + gravity field + default animation definition

## Library

Modelica/Mechanics/MultiBody

## Description

Model **World** represents a global coordinate system fixed in
ground. This model serves several purposes:

- It is used as
**inertial system**in which the equations of all elements of the MultiBody library are defined. - It is the world frame of an
**animation window**in which all elements of the MultiBody library are visualized. - It is used to define the
**gravity field**in which a multi-body model is present. Default is a uniform gravity field where the gravity acceleration vector g is the same at every position. Additionally, a point gravity field or no gravity can be selected. Also, function gravityAcceleration can be redeclared to a user-defined function that computes the gravity acceleration, see example Examples.Elementary.UserDefinedGravityField. - It is used to define
**default settings**of animation properties (e.g., the diameter of a sphere representing by default the center of mass of a body, or the diameters of the cylinders representing a revolute joint). - It is used to define a
**visual representation**of the world model (= 3 coordinate axes with labels), of the defined gravity field and of a ground plane perpendicular to the gravity direction.

Since the gravity field function is required from all bodies with mass and the default settings of animation properties are required from nearly every component, exactly one instance of model World needs to be present in every model on the top level. The basic declaration needs to be:

innerModelica.Mechanics.MultiBody.World world

Note, it must be an **inner** declaration with instance name **world**
in order that this world object can be accessed from all objects in the
model. When dragging the "World" object from the package browser into
the diagram layer, this declaration is automatically generated
(this is defined via annotations in model World).

All vectors and tensors of a mechanical system are resolved in a
frame that is local to the corresponding component. Usually,
if all relative joint coordinates vanish, the local frames
of all components are parallel to each other, as well as to the
world frame (this holds as long as a Parts.FixedRotation,
component is **not** used). In this "reference configuration"
it is therefore
alternatively possible to resolve all vectors in the world
frame, since all frames are parallel to each other.
This is often very convenient. In order to give some visual
support in such a situation, in the icon of a World instance
two axes of the world frame are shown and the labels
of these axes can be set via parameters.

## Parameters

Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|

| enableAnimation | = true, if animation of all components is enabled | Scalar | true |

| animateWorld | = true, if world coordinate system shall be visualized | Scalar | true |

| animateGravity | = true, if gravity field shall be visualized (acceleration vector or field center) | Scalar | true |

| animateGround | = true, if ground plane shall be visualized | Scalar | true |

| label1 | Label of horizontal axis in icon | String | |

| label2 | Label of vertical axis in icon | String | |

| gravityType | Type of gravity field | Structure | |

| No gravity field | Number | 0 | |

| Uniform gravity field | Number | 0 | |

| Point gravity field | Number | 0 | |

| g | Constant gravity acceleration | Scalar | |

| n | Direction of gravity resolved in world frame (gravity = g*n/length(n)) | Vector of size 3 | |

| mue | Gravity field constant (default = field constant of earth) | Scalar | |

| driveTrainMechanics3D | = true, if 3-dim. mechanical effects of Parts.Mounting1D/Rotor1D/BevelGear1D shall be taken into account | Scalar | true |

| gravityAcceleration | Function to compute the gravity acceleration, resolved in world frame | FromModelica('Modelica.Mechanics.MultiBody.Forces.Internal.standardGravityAcceleration') | |

| ndim | Scalar | ||

| ndim2 | Scalar | ||

| headLength | Scalar | ||

| headWidth | Scalar | ||

| lineLength | Scalar | ||

| lineWidth | Scalar | ||

| scaledLabel | Scalar | ||

| labelStart | Scalar | ||

| gravityHeadLength | Scalar | ||

| gravityHeadWidth | Scalar | ||

| gravityLineLength | Scalar | ||

| ndim_pointGravity | Scalar |

Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|

| axisLength | Length of world axes arrows | Scalar | |

| axisDiameter | Diameter of world axes arrows | Scalar | |

| axisShowLabels | = true, if labels shall be shown | Scalar | true |

| axisColor_x | Color of x-arrow | Vector of size 3 | |

| axisColor_y | Vector of size 3 | ||

| axisColor_z | Color of z-arrow | Vector of size 3 | |

| gravityArrowTail | Position vector from origin of world frame to arrow tail, resolved in world frame | Vector of size 3 | |

| gravityArrowLength | Length of gravity arrow | Scalar | |

| gravityArrowDiameter | Diameter of gravity arrow | Scalar | |

| gravityArrowColor | Color of gravity arrow | Vector of size 3 | |

| gravitySphereDiameter | Diameter of sphere representing gravity center (default = mean diameter of earth) | Scalar | |

| gravitySphereColor | Color of gravity sphere | Vector of size 3 | |

| groundAxis_u | Vector along 1st axis (called u) of ground plane, resolved in world frame (should be perpendicular to gravity direction) | Vector of size 3 | |

| groundLength_u | Length of ground plane along groundAxis_u | Scalar | |

| groundLength_v | Length of ground plane perpendicular to groundAxis_u | Scalar | |

| groundColor | Color of ground plane | Vector of size 3 |

Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|

| nominalLength | "Nominal" length of multi-body system | Scalar | |

| defaultAxisLength | Default for length of a frame axis (but not world frame) | Scalar | |

| defaultJointLength | Default for the fixed length of a shape representing a joint | Scalar | |

| defaultJointWidth | Default for the fixed width of a shape representing a joint | Scalar | |

| defaultForceLength | Default for the fixed length of a shape representing a force (e.g., damper) | Scalar | |

| defaultForceWidth | Default for the fixed width of a shape representing a force (e.g., spring, bushing) | Scalar | |

| defaultBodyDiameter | Default for diameter of sphere representing the center of mass of a body | Scalar | |

| defaultWidthFraction | Default for shape width as a fraction of shape length (e.g., for Parts.FixedTranslation) | Scalar | |

| defaultArrowDiameter | Default for arrow diameter (e.g., of forces, torques, sensors) | Scalar | |

| defaultFrameDiameterFraction | Default for arrow diameter of a coordinate system as a fraction of axis length | Scalar | |

| defaultSpecularCoefficient | Default reflection of ambient light (= 0: light is completely absorbed) | Scalar | |

| defaultN_to_m | Default scaling of force arrows (length = force/defaultN_to_m) | Scalar | |

| defaultNm_to_m | Default scaling of torque arrows (length = torque/defaultNm_to_m) | Scalar |

## Ports

Name | Type | Description | IO Type | Number |
---|---|---|---|---|

| implicit | Coordinate system fixed in the origin of the world frame | output | 1 |