Package Modelica.​Mechanics.​MultiBody.​Examples.​Elementary
Elementary examples to demonstrate various features of the MultiBody library

Information

This package contains elementary example models to demonstrate the usage of the MultiBody library

Content

ModelDescription
DoublePendulum
DoublePendulumInitTip
Simple double pendulum with two revolute joints and two bodies. In DoublePendulumInitTip, the initial position of the pendulum tip is given instead of common initialization by pendulum angles.
ForceAndTorque Demonstrates usage of Forces.ForceAndTorque element.
FreeBody Free flying body attached by two springs to environment.
InitSpringConstant Determine spring constant such that system is in steady state at given position.
LineForceWithTwoMasses Demonstrates a line force with two point masses using a Joints.Assemblies.JointUPS and alternatively a Forces.LineForceWithTwoMasses component.
Pendulum Simple pendulum with one revolute joint and one body.
PendulumWithSpringDamper Simple spring/damper/mass system
PointGravity Two bodies in a point gravity field
PointGravityWithPointMasses Two point masses in a point gravity field (rotation of bodies is neglected)
PointGravityWithPointMasses2 Rigidly connected point masses in a point gravity field
RollingWheel Single wheel rolling on ground starting from an initial speed
RollingWheelSetDriving Rolling wheel set that is driven by torques driving the wheels
RollingWheelSetPulling Rolling wheel set that is pulled by a force
SpringDamperSystem Spring/damper system with a prismatic joint and attached on free flying body
SpringMassSystem Mass attached via a prismatic joint and a spring to the world frame
SpringWithMass Point mass hanging on a spring
ThreeSprings 3-dimensional springs in series and parallel connection
HeatLosses Demonstrate the modeling of heat losses.
UserDefinedGravityField Demonstrate the modeling of a user-defined gravity field.
Surfaces Demonstrate the visualization of a sine surface, as well as a torus and a wheel constructed from a surface

Extends from Modelica.​Icons.​ExamplesPackage (Icon for packages containing runnable examples).

Package Contents

NameDescription
DoublePendulumSimple double pendulum with two revolute joints and two bodies
DoublePendulumInitTipDemonstrate how to initialize a double pendulum so that its tip starts at a predefined position
ForceAndTorqueDemonstrate usage of ForceAndTorque element
FreeBodyFree flying body attached by two springs to environment
HeatLossesDemonstrate the modeling of heat losses
InitSpringConstantDetermine spring constant such that system is in steady state at given position
LineForceWithTwoMassesDemonstrate line force with two point masses using a JointUPS and alternatively a LineForceWithTwoMasses component
PendulumSimple pendulum with one revolute joint and one body
PendulumWithSpringDamperSimple spring/damper/mass system
PointGravityTwo point masses in a point gravity field
PointGravityWithPointMassesTwo point masses in a point gravity field (rotation of bodies is neglected)
PointGravityWithPointMasses2Rigidly connected point masses in a point gravity field
RollingWheelSingle wheel rolling on ground starting from an initial speed
RollingWheelSetDrivingRolling wheel set that is driven by torques driving the wheels
RollingWheelSetPullingRolling wheel set that is pulled by a force
SpringDamperSystemSimple spring/damper/mass system
SpringMassSystemMass attached with a spring to the world frame
SpringWithMassPoint mass hanging on a spring
SurfacesDemonstrate the visualization of a sine surface, as well as a torus and a wheel constructed from a surface
ThreeSprings3-dim. springs in series and parallel connection
UserDefinedGravityFieldDemonstrate the modeling of a user-defined gravity field
UtilitiesUtility classes used by elementary multi-body example models

Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​DoublePendulum
Simple double pendulum with two revolute joints and two bodies

Information

This example demonstrates that by using joint and body elements animation is automatically available. Also the revolute joints are animated. Note, that animation of every component can be switched of by setting the first parameter animation to false or by setting enableAnimation in the world object to false to switch off animation of all components.

model Examples.Elementary.DoublePendulum

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​DoublePendulumInitTip
Demonstrate how to initialize a double pendulum so that its tip starts at a predefined position

Information

This example demonstrates at hand of a double pendulum, how non-standard initialization can be defined: The absolute position of the pendulum tip, and its absolute speed shall be initially defined. This can be performed with the Joints.FreeMotionScalarInit joint that allows to initialize individual elements of its relative vectors. In this case, the x-, and y-coordinates of the relative position vector (visualized by the yellow arrow in the figure below) and of its derivative shall have a defined value at initial time. The configuration of the double pendulum at the initial time is shown below, where the tip position is required to have the coordinates x=0.7, y=0.3.

Setting only the tip's start position results in an ambiguous initialization since two valid solutions for revolute1.phi and revolute2.phi exist. Moreover, the calculated angles revolute1.phi and revolute2.phi can be a multiple of expected solution phi1 and phi2,

To clearly indicate the preferred solution, guess initial angles can be additionally given. In this example, it is simply done by revolute2.phi.start = Modelica.Constants.pi/2.

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​ForceAndTorque
Demonstrate usage of ForceAndTorque element

Information

In this example the usage of the general force element "ForceAndTorque" is shown. A "ForceAndTorque" element is connected between a body and a fixed point in the world system. The force and torque is defined by the "Constant" block. The two vectors are resolved in the coordinate system defined by the "fixedRotation" component that is fixed in the world system:

The animation view at time = 0 is shown in the figure below. The yellow line is directed from frame_a to frame_b of the forceAndTorque component. The green arrow characterizes the force acting at the body whereas the green double arrow characterizes the torque acting at the body. The lengths of the two vectors are proportional to the lengths of the force and torque vectors (constant scaling factors are defined as parameters in the forceAndTorque component):

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​FreeBody
Free flying body attached by two springs to environment

Information

This example demonstrates:

model Examples.Elementary.FreeBody

Extends from Modelica.​Icons.​Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Booleananimationtrue= true, if animation shall be enabled

Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​InitSpringConstant
Determine spring constant such that system is in steady state at given position

Information

This example demonstrates a non-standard type of initialization by calculating a spring constant such that a simple pendulum is at a defined position in steady state.

The goal is that the pendulum should be in steady state when the rotation angle of the pendulum is zero. The spring constant of the spring shall be calculated during initialization such that this goal is reached.

The pendulum has one degree of freedom, i.e., two states. Therefore, two additional equations have to be provided for initialization. However, parameter "c" of the spring component is defined with attribute "fixed = false", i.e., the value of this parameter is computed during initialization. Therefore, there is one additional equation required during initialization. The 3 initial equations are the rotational angle of the revolute joint and its first and second derivative. The latter ones are zero, in order to initialize in steady state. By setting the start values of phi, w, a to zero and their fixed attributes to true, the required 3 initial equations are defined.

After translation, this model is initialized in steady-state. The spring constant is computed as c = 49.05 N/m. An animation of this simulation is shown in the figure below.

model Examples.Elementary.InitSpringConstant

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​LineForceWithTwoMasses
Demonstrate line force with two point masses using a JointUPS and alternatively a LineForceWithTwoMasses component

Information

It is demonstrated how to implement line force components that shall have mass properties. Two alternative implementations are given:

In both cases, a linear 1-dimensional translational damper from the Modelica.Mechanics.Translational library is used as line force between the two attachment points. Simulate this system and plot the differences of the cut forces at both sides of the line force component ("rod_f_diff" and "body_f_diff"). Both vectors should be zero (depending on the chosen relative tolerance of the integration, the difference is in the order of 1e-10 ... 1e-15).

Note, that the implementation with the LineForceWithTwoMasses component is simpler and more convenient. An animation of this simulation is shown in the figure below. The system on the left side in the front is the animation with the LineForceWithTwoMasses component whereas the system on the right side in the back is the animation with the JointUPS component.

Extends from Modelica.​Icons.​Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Massm1Mass of point masses

Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​Pendulum
Simple pendulum with one revolute joint and one body

Information

This simple model demonstrates that by just dragging components default animation is defined that shows the structure of the assembled system.

model Examples.Elementary.Pendulum

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​PendulumWithSpringDamper
Simple spring/damper/mass system

Information

A body is attached on a revolute and prismatic joint. A 3-dim. spring and a 3-dim. damper are connected between the body and a point fixed in the world frame:

model Examples.Elementary.PendulumWithSpringDamper

Extends from Modelica.​Icons.​Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Booleananimationtrue= true, if animation shall be enabled

Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​PointGravity
Two point masses in a point gravity field

Information

This model demonstrates a point gravity field. Two bodies are placed in the gravity field. The initial positions and velocities of these bodies are selected such that one body rotates on a circle and the other body rotates on an ellipse around the center of the point gravity field.

model Examples.Elementary.PointGravity

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​PointGravityWithPointMasses
Two point masses in a point gravity field (rotation of bodies is neglected)

Information

This model demonstrates the usage of model Parts.PointMass in a point gravity field. The PointMass model has the feature that the rotation is not taken into account and can therefore also not be calculated. This example demonstrates two cases where this does not matter: If a PointMass is not connected (body1, body2), the orientation object in these point masses is set to a unit rotation. If a PointMass is connected by a line force element, such as the used Forces.LineForceWithMass component, then the orientation object is set to a unit rotation within the line force element. These are the two cases where the rotation is automatically set to a default value, when the physical system does not provide the equations.

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​PointGravityWithPointMasses2
Rigidly connected point masses in a point gravity field

Information

This model demonstrates the usage of model Parts.PointMass in a point gravity field. 6 point masses are connected rigidly together. Translating such a model results in an error, because point masses do not define an orientation object. The example demonstrates that in such a case (when the orientation object is not defined by an object that is connected to a point mass), a "MultiBody.Joints.FreeMotion" joint has to be used, to define the degrees of freedom of this structure.

In order to demonstrate that this approach is correct, in model "referenceSystem", the same system is again provided, but this time modeled with a generic body (Parts.Body) where the inertia tensor is set to zero. In this case, no FreeMotion object is needed because every body provides its absolute translational and rotational position and velocity as potential states.

The two systems should move exactly in the same way. The system with the PointMasses object visualizes the point masses in "red", whereas the "referenceSystem" shows its bodies in "blue".

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​SpringDamperSystem
Simple spring/damper/mass system

Information

This example demonstrates:

model Examples.Elementary.SpringDamperSystem

Extends from Modelica.​Icons.​Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Booleananimationtrue= true, if animation shall be enabled

Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​SpringMassSystem
Mass attached with a spring to the world frame

Information

This example shows the two different ways how force laws can be utilized:

model Examples.Elementary.SpringMassSystem

Extends from Modelica.​Icons.​Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Booleananimationtrue= true, if animation shall be enabled

Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​SpringWithMass
Point mass hanging on a spring

Information

This example shows that a force component may have a mass. The 3-dimensional spring as used in this example, has an optional point mass between the two points where the spring is attached. In the animation, this point mass is represented by a small, light blue, sphere.

model Examples.Elementary.SpringWithMass

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​ThreeSprings
3-dim. springs in series and parallel connection

Information

This example demonstrates that 3-dimensional line force elements (here: Modelica.Mechanics.MultiBody.Forces.Spring elements) can be connected together in series without having a body with mass at the connection point (as usually required by multi-body programs). This is advantageous since stiff systems can be avoided, say, due to a stiff spring and a small mass at the connection point.

model Examples.Elementary.ThreeSprings

For a more thorough explanation, see MultiBody.UsersGuide.Tutorial.ConnectionOfLineForces.

Extends from Modelica.​Icons.​Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Booleananimationtrue= true, if animation shall be enabled

Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​RollingWheel
Single wheel rolling on ground starting from an initial speed

Information

Demonstrates how a single wheel is rolling on ground (starting with an initial velocity).

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​RollingWheelSetDriving
Rolling wheel set that is driven by torques driving the wheels

Information

Demonstrates how a RollingWheelSet (two wheels rigidly coupled together) is rolling on ground when driven by some external torques.

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​RollingWheelSetPulling
Rolling wheel set that is pulled by a force

Information

Demonstrates how a RollingWheelSet (two wheels rigidly coupled together) is rolling on ground when pulled by an external force..

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​HeatLosses
Demonstrate the modeling of heat losses

Information

This model demonstrates how to model the dissipated power of a multi-body force element by enabling the heatPort of all components and connecting these heatPorts via a convection element to the environment. The total heat flow generated by the elements of this multi-body system and transported to the environment is present in variable convection.fluid.

Extends from Modelica.​Icons.​Example (Icon for runnable examples).


Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​UserDefinedGravityField
Demonstrate the modeling of a user-defined gravity field

Information

This example demonstrates a user defined gravity field. Function "world.gravityAcceleration" is redeclared to function theoreticalNormalGravityWGS84 that computes the theoretical gravity of the WGS84 ellipsoid earth model at and close to the earth ellipsoid surface. In the gravity field, a large, single pendulum is present. Via parameter "geodeticLatitude", the geodetic latitude on the earth can be defined, where the pendulum is present. The world frame is located at the WGS84 earth ellipsoid at this latitude. The result variable "gravity" is the gravity vector at the center of mass of the pendulum mass. Since the height of this mass is changing, the value of the gravity is also changing (the difference is in the order of 0.00001).

The result of the simulation is slightly different at the equator (geodeticLatitude=0) and at the poles (geodeticLatitude=90). For example, after 10 s of simulation time the rotation angle of the pendulum, rev.phi, has the following values:

latitude [deg] rev.phi [rad]
= 0 = -2.39 rad
= 90 = -2.42 rad

Extends from Modelica.​Icons.​Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Angle_deggeodeticLatitude0Geodetic latitude
Positionheight20Height of pendulum attachment point over WGS84 earth ellipsoid

Model Modelica.​Mechanics.​MultiBody.​Examples.​Elementary.​Surfaces
Demonstrate the visualization of a sine surface, as well as a torus and a wheel constructed from a surface

Information

This example demonstrates the use of the Surface visualizer that visualizes a moving, parameterized surface. The "sine-wave" surface is a direct application of the surface model. Furthermore, the "torus" surface is an instance of Torus, the "wheel" surface is an instance of VoluminousWheel, and the "pipeWithScalarField surface is an instance of PipeWithScalarField. All latter visual shapes are constructed with the surface model. The following image shows a screen-shot of this example model:

Extends from Modelica.​Icons.​Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Realx_min-1Minimum value of x
Realx_max1Maximum value of x
Realy_min-1Minimum value of y
Realy_max1Maximum value of y
Realz_min0Minimum value of z
Realz_max1Maximum value of z

Generated 2018-12-12 12:11:33 EST by MapleSim.