MultiBondLib.Mechanics3D.Examples

Examples

MultiBondLib.Mechanics3D.Examples.FourBarLoop MultiBondLib.Mechanics3D.Examples.RollingMarble MultiBondLib.Mechanics3D.Examples.GyroscopicEffect MultiBondLib.Mechanics3D.Examples.SphericalSpring MultiBondLib.Mechanics3D.Examples.Bicycle MultiBondLib.Mechanics3D.Examples.PlanarLoop MultiBondLib.Mechanics3D.Examples.CentrifugalForce MultiBondLib.Mechanics3D.Examples.NewtonsCradleWeak MultiBondLib.Mechanics3D.Examples.ThreeBodySystem

Information


This package contains various examples.

These examples demonstrate the usage of the Mechanics3D library.

For all these examples the following simulation setup is proposed.

Don't forget to open an animation window.

NameDescription
FourBarLoop 3D kinematic loop
RollingMarble a marble rolling on a plane
GyroscopicEffect demonstration of the gyroscopic effect
SphericalSpring application of the spherical joint
Bicycle an uncontroled bicycle
PlanarLoop a planar kinematic loop
CentrifugalForce demonstration of the centrifugal force
NewtonsCradleWeak an implementation of Newton's cradle with weak collision models
ThreeBodySystem three bodies attracting each other


MultiBondLib.Mechanics3D.Examples.FourBarLoop MultiBondLib.Mechanics3D.Examples.FourBarLoop

3D kinematic loop

MultiBondLib.Mechanics3D.Examples.FourBarLoop

Information


This example presents a kinematic loop. It consist in 4 bars.
It is equivalent to the example in the Modelica.Mechanics.MultiBody library.

The loop is automatically closed. It has one degree of freedom. and leads to 6 non-linear equations.


Modelica definition

model FourBarLoop "3D kinematic loop" 
           extends Modelica.Icons.Example;
  
  inner World3D world3D(nominalLength=1, g=9.81);
  Parts.Fixed Fixed1;
  Parts.FixedTranslation FixedTranslation1(r={0,0.5,0.1}, width=0.05);
  Joints.Revolute Revolute1(initType=Modelica.Mechanics.MultiBody.Types.Init.
        PositionVelocity,
    n={1,0,0},
    phi_start=0,
    w_start=Modelica.SIunits.Conversions.from_deg(300),
    enforceStates=true);
  Parts.FixedTranslation FixedTranslation2(r={0,0.2,0}, width=0.05);
  Parts.FixedTranslation FixedTranslation3(r={1,-0.3,-0.1}, width=0.05);
  Parts.FixedTranslation FixedTranslation4(r={1.2,0,0}, animation=false);
  Parts.Body Body2(
    m=0.5,
    I_11=0.05,
    I_22=0.05,
    I_33=0.05,
    I_21=0,
    I_31=0,
    I_32=0,
    animation=false);
  Joints.Prismatic Prismatic1(
    s_start=0,
    v_start=0,
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free);
  Joints.Revolute Revolute4(
    n={0,0,1}, initType=Modelica.Mechanics.MultiBody.Types.Init.Free);
  Joints.Revolute Revolute6(
    n={0,1,0}, initType=Modelica.Mechanics.MultiBody.Types.Init.Free);
  Parts.FixedTranslation FixedTranslation5(r={0,0.25,0.05}, animation=
        false);
  Parts.Body Body1(
    m=0.5,
    I_11=0.05,
    I_22=0.05,
    I_33=0.05,
    I_21=0,
    I_31=0,
    I_32=0,
    animation=false);
  Parts.Body Body3(
    m=0.5,
    I_11=0.05,
    I_22=0.05,
    I_33=0.05,
    I_21=0,
    I_31=0,
    I_32=0,
    animation=false);
  Parts.FixedTranslation FixedTranslation6(r={0.5,-0.15,-0.05}, animation=
       false);
  Parts.FixedTranslation FixedTranslation7(r={0,0.1,0}, animation=false);
  Joints.Spherical Spherical1(useQuaternions=false);
equation 
  connect(Revolute1.frame_a, Fixed1.frame_b);
  connect(FixedTranslation4.frame_a, Fixed1.frame_b);
  connect(FixedTranslation1.frame_a, Revolute1.frame_b);
  connect(FixedTranslation4.frame_b, Prismatic1.frame_a);
  connect(Prismatic1.frame_b, FixedTranslation2.frame_a);
  connect(FixedTranslation2.frame_b, Revolute4.frame_a);
  connect(FixedTranslation5.frame_a, FixedTranslation1.frame_a);
  connect(Body1.frame_a, FixedTranslation5.frame_b);
  connect(FixedTranslation6.frame_a, FixedTranslation3.frame_a);
  connect(Body2.frame_a, FixedTranslation6.frame_b);
  connect(FixedTranslation7.frame_a, FixedTranslation2.frame_a);
  connect(Body3.frame_a, FixedTranslation7.frame_b);
  connect(Spherical1.frame_b, FixedTranslation3.frame_a);
  connect(Spherical1.frame_a, FixedTranslation1.frame_b);
  connect(Revolute6.frame_a, Revolute4.frame_b);
  connect(Revolute6.frame_b, FixedTranslation3.frame_b);
end FourBarLoop;

MultiBondLib.Mechanics3D.Examples.RollingMarble MultiBondLib.Mechanics3D.Examples.RollingMarble

a marble rolling on a plane

MultiBondLib.Mechanics3D.Examples.RollingMarble

Information


This example presents an ideal rolling marble.

The marble is attached to the origin by a spring. The tangential intial velocity leads to an elliptic trajectory.

A ideal rolling marble has 5 degrees of freedom on positional level and 3 degrees of freedom on velocity level.


Modelica definition

model RollingMarble "a marble rolling on a plane" 
           extends Modelica.Icons.Example;
  
  inner World3D world3D(nominalLength=5, g=9.81);
  Parts.Fixed Fixed1;
  Forces.Spring Spring1(s0=0, c=5);
  RollingObjects.Marble Marble2(
    m=2,
    I_11=0.02,
    I_22=0.02,
    I_33=0.02,
    r=0.3,
    d=0,
    w_start=2*{0,0,360},
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    useTransVelocities=true,
    x_start={2,0,-2},
    v_start={0,0,6});
equation 
  connect(Spring1.frame_a, Fixed1.frame_b);
  connect(Marble2.frame_b, Spring1.frame_b);
end RollingMarble;

MultiBondLib.Mechanics3D.Examples.GyroscopicEffect MultiBondLib.Mechanics3D.Examples.GyroscopicEffect

demonstration of the gyroscopic effect

MultiBondLib.Mechanics3D.Examples.GyroscopicEffect

Information


This example demonstrates the gyroscopic effect.

The mass at the end of the spherical pendulum is heavily rotating. The mass then starts to turn around due to its rotation and enters a circular trajectory.

The efficiency of the simulation is drastically influenced by the choice of the sequence of cardan angles. These can be set in the advanced group of the parameter menu.

In addition the model is confronted with an identical variant of the Modelica.Mechanics.Multibody library. Both models behave exaclty the same.


Modelica definition

model GyroscopicEffect "demonstration of the gyroscopic effect" 
           extends Modelica.Icons.Example;
  
  inner World3D world3D(nominalLength=5,
    animateWorld=true,
    animateGravity=true);
  Parts.Body Body1(
    m=2,
    I_11=0.12,
    I_22=0.06,
    I_33=0.06,
    I_21=0,
    I_31=0,
    I_32=0);
  Parts.Fixed Fixed1;
  Parts.FixedTranslation FixedTranslation2(r={0,0,1});
  Parts.FixedTranslation FixedTranslation3(r={0,1,0});
  inner Modelica.Mechanics.MultiBody.World world(nominalLength=5, g=9.81,
    animateWorld=false,
    animateGravity=false);
  Modelica.Mechanics.MultiBody.Parts.Fixed Fixed2(r={0,0,-2}, animation=
        false);
  Parts.FixedTranslation FixedTranslation1(r={2,0,0});
  Modelica.Mechanics.MultiBody.Parts.Body Body2(
    m=2,
    I_11=0.12,
    I_22=0.06,
    I_33=0.06);
  Modelica.Mechanics.MultiBody.Parts.FixedTranslation FixedTranslation4(r={2,0,
        0});
  Modelica.Mechanics.MultiBody.Parts.FixedTranslation FixedTranslation5(r={0,0,
        1});
  Modelica.Mechanics.MultiBody.Parts.FixedTranslation FixedTranslation6(r={0,1,
        0});
  Modelica.Mechanics.MultiBody.Joints.Spherical Spherical2(
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    w_rel_a_start=40*360*{1,0,0},
    enforceStates=true,
    useQuaternions=false,
    sequence_angleStates={2,3,1});
  Joints.Spherical Spherical1(
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    useQuaternions=false,
    w_start=40*360*{1,0,0},
    sequence_angles={2,3,1});
  Parts.FixedTranslation FixedTranslation7(r={0,0,-1});
  Parts.FixedTranslation FixedTranslation8(r={0,-1,0});
  Modelica.Mechanics.MultiBody.Parts.FixedTranslation FixedTranslation9(r=
       {0,0,-1});
  Modelica.Mechanics.MultiBody.Parts.FixedTranslation FixedTranslation10(
      r={0,-1,0});
equation 
  connect(FixedTranslation3.frame_a, FixedTranslation2.frame_a);
  connect(FixedTranslation2.frame_a, Body1.frame_a);
  connect(FixedTranslation5.frame_a, Body2.frame_a);
  connect(FixedTranslation6.frame_a, Body2.frame_a);
  connect(FixedTranslation4.frame_b, Body2.frame_a);
  connect(FixedTranslation1.frame_b, Body1.frame_a);
  connect(Spherical2.frame_b, FixedTranslation4.frame_a);
  connect(Spherical2.frame_a, Fixed2.frame_b);
  connect(Spherical1.frame_b, FixedTranslation1.frame_a);
  connect(Spherical1.frame_a, Fixed1.frame_b);
  connect(FixedTranslation7.frame_a, Body1.frame_a);
  connect(FixedTranslation8.frame_a, Body1.frame_a);
  connect(FixedTranslation9.frame_a, Body2.frame_a);
  connect(FixedTranslation10.frame_a, Body2.frame_a);
end GyroscopicEffect;

MultiBondLib.Mechanics3D.Examples.SphericalSpring MultiBondLib.Mechanics3D.Examples.SphericalSpring

application of the spherical joint

MultiBondLib.Mechanics3D.Examples.SphericalSpring

Information


This example presents the model of a spherical pendulum attached to a spring-damper.

The rotation of the spherical joint is described by quaternions. This can be selected in the advanced tab of the parameter menu.

The usage of quaternions leads to the need for dynamic state selection, because the 3 degrees of freedom are described by the 4 potential variables of the quaternion. Also a set of non-linear equations arises, but these equations are solved robustly.


Modelica definition

model SphericalSpring "application of the spherical joint" 
           extends Modelica.Icons.Example;
  
  inner World3D world3D(nominalLength=5);
  Parts.Body Body1(
    m=2,
    I_11=0.01,
    I_22=0.01,
    I_33=0.01,
    I_21=0.1,
    I_31=0.1,
    I_32=0.1);
  Parts.Fixed Fixed1;
  Parts.FixedTranslation FixedTranslation1(r={2,0,2});
  Joints.Spherical Spherical1(                 initType=Modelica.Mechanics.
        MultiBody.Types.Init.Free, w_start={0,0,0},
    useQuaternions=true);
  Parts.Fixed Fixed2(r={1.5,0,0.5});
  Forces.Spring Spring1(c=10, s0=1);
  Forces.Damping Damping1(d=0.5);
equation 
  connect(FixedTranslation1.frame_b, Body1.frame_a);
  connect(Fixed2.frame_b, Spring1.frame_a);
  connect(Spring1.frame_b, FixedTranslation1.frame_b);
  connect(Damping1.frame_a, Fixed2.frame_b);
  connect(Damping1.frame_b, FixedTranslation1.frame_b);
  connect(Fixed1.frame_b, Spherical1.frame_a);
  connect(Spherical1.frame_b, FixedTranslation1.frame_a);
end SphericalSpring;

MultiBondLib.Mechanics3D.Examples.Bicycle MultiBondLib.Mechanics3D.Examples.Bicycle

an uncontroled bicycle

MultiBondLib.Mechanics3D.Examples.Bicycle

Information


This example presents the model of a bicycle.

The joints of the bicycle are frictionless and the wheels are ideally rolling. The bicycle is uncontrolled, but due to its initial velocity it is self-stabilizing. Within a certain a range of driving velocity a bicycle is stable.

A bicycle has 7 degrees of freedom on positional level and 3 degrees of freedom on velocity level.


Parameters

NameDefaultDescription
Animation
saddlepipeAngle75 angle of saddlepipe [rad]
saddlenodeHeight0.3 height of the saddle node [m]
saddleHeight0.15 height of the saddle above the saddlenode [m]
chainwheelPos1.3*0.3 xposition of the chainwheel [m]
ladyFactor0 factor for low entrance: Pushes down the upper frame bar.
handlebarAngle110 angle of the handlebar [rad]

Modelica definition

model Bicycle "an uncontroled bicycle" 
extends Modelica.Icons.Example;
  
  import SI = Modelica.SIunits;
  import MB = Modelica.Mechanics.MultiBody;
  
  parameter SI.Angle saddlepipeAngle = 75 "|Animation || angle of saddlepipe";
  final parameter SI.Angle saddlepipeAngleRad = SI.Conversions.from_deg(saddlepipeAngle);
  parameter SI.Position saddlenodeHeight = 0.3 
    "|Animation || height of the saddle node";
  parameter SI.Position saddleHeight = 0.15 
    "|Animation || height of the saddle above the saddlenode";
  parameter SI.Position chainwheelPos = 1.3*0.3 
    "|Animation || xposition of the chainwheel";
  parameter Real ladyFactor = 0 
    "|Animation || factor for low entrance: Pushes down the upper frame bar.";
  parameter SI.Angle handlebarAngle = 110 
    "|Animation || angle of the handlebar";
  final parameter SI.Angle handlebarAngleRad = SI.Conversions.from_deg(handlebarAngle);
  
  final parameter SI.Position chainwheel[3] = {-chainwheelPos,0,0};
  final parameter SI.Position saddlenode[3] = {chainwheel[1]+(1/tan(saddlepipeAngleRad))*saddlenodeHeight,saddlenodeHeight,0};
  final parameter SI.Position upperframenode[3] = ladyFactor*chainwheel + (1-ladyFactor)*saddlenode;
  
  inner World3D world3D(                 g=9.81,
    n={0,-1,0},
    nominalLength=2);
  Joints.Revolute FWRevolute(
    phi(stateSelect=StateSelect.always),
    initType=Modelica.Mechanics.MultiBody.Types.Init.Position,
    phi_start=0,
    animation=true,
    cylinderLength=0.05,
    cylinderDiameter=0.08,
    cylinderColor={255,0,0});
  Joints.Revolute RWRevolute(
    enforceStates=false,
    phi_start=0,
    w_start=0,
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    animation=true,
    cylinderLength=0.05,
    cylinderDiameter=0.08,
    cylinderColor={255,0,0});
  Parts.FixedTranslation RearFrame(               animation=false, r={1.02,
        -0.48,0});
  Parts.FixedTranslation FrontFrame(                animation=false, r={0.18,
        0.48,0});
  Parts.FixedTranslation RearMassPos(r={-0.3,0.9,0}, animation=false);
  Parts.FixedTranslation FrontMassPos(r={0.12,0.7,0}, animation=false);
  Joints.Revolute Steering(
    phi(stateSelect=StateSelect.always),
    initType=Modelica.Mechanics.MultiBody.Types.Init.Position,
    phi_start=0,
    n={0.258,0.965,0},
    cylinderLength=0.07,
    cylinderDiameter=0.07,
    cylinderColor={255,0,0});
  Parts.SimpleBody FrontMass(
    I_31=0,
    I_32=0,
    animation=false,
    m=4,
    I_11=0.0546,
    I_22=0.0114,
    I_33=0.06,
    I_21=-0.0162);
  Parts.SimpleBody RearMass(
    I_31=0,
    I_32=0,
    animation=false,
    m=85,
    I_11=9.2,
    I_22=2.8,
    I_33=11,
    I_21=2.4);
  RollingObjects.Wheel RWheel(
    m=2,
    I_11=0.06,
    I_22=0.06,
    I_33=0.12,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    phi_start={0,5,0},
    w_start=2.2*{0,0,360},
    r=0.3,
    enforceStates=true);
  RollingObjects.WheelJoint FWheelJoint(r=0.35);
  Parts.SimpleBody FWheelMass(
    I_21=0,
    I_31=0,
    I_32=0,
    animation=false,
    m=3,
    I_11=0.14,
    I_22=0.14,
    I_33=0.28);
 Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape RWSuspRight(
     lengthDirection=chainwheel,
     length=sqrt(chainwheel*chainwheel),
     shapeType="cylinder",
     color={255,255,0},
     width=0.03,
     height=0.03,
     r_shape={0,0,0.050},
     r=RearFrame.frame_b.P.x,
     R=MB.Frames.Orientation(T=RearFrame.frame_b.P.R,w=zeros(3)));
  
 Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape RWSusp2Right(
     length=sqrt(saddlenode*saddlenode),
     shapeType="cylinder",
     color={255,255,0},
     lengthDirection=saddlenode,
     width=0.03,
     height=0.03,
     r_shape={0,0,0.050},
     r=RearFrame.frame_b.P.x,
     R=MB.Frames.Orientation(T=RearFrame.frame_b.P.R,w=zeros(3)));
  
 Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape RWSuspLeft(
     lengthDirection=chainwheel,
     length=sqrt(chainwheel*chainwheel),
     shapeType="cylinder",
     color={255,255,0},
     width=0.03,
     height=0.03,
     r_shape={0,0,-0.050},
     r=RearFrame.frame_b.P.x,
     R=MB.Frames.Orientation(T=RearFrame.frame_b.P.R,w=zeros(3)));
  
 Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape RWSusp2Left(
     length=sqrt(saddlenode*saddlenode),
     shapeType="cylinder",
     color={255,255,0},
     lengthDirection=saddlenode,
     width=0.03,
     height=0.03,
     r_shape={0,0,-0.050},
     r=RearFrame.frame_b.P.x,
     R=MB.Frames.Orientation(T=RearFrame.frame_b.P.R,w=zeros(3)));
  
  Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape SaddlePipe(
    shapeType="cylinder",
    color={255,255,0},
    r_shape=chainwheel,
    lengthDirection=saddlenode-chainwheel,
    width=0.06,
    height=0.06,
    length=(saddlenodeHeight+saddleHeight)*(1/sin(saddlepipeAngleRad)),
    r=RearFrame.frame_b.P.x,
    R=MB.Frames.Orientation(T=RearFrame.frame_b.P.R,w=zeros(3)));
  
   Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape lowerframepipe(
     shapeType="cylinder",
     color={255,255,0},
     r_shape=chainwheel,
     width=0.06,
     height=0.06,
     lengthDirection=-RearFrame.r-chainwheel,
     widthDirection={0,0,1},
     length=sqrt((-RearFrame.r-chainwheel)*(-RearFrame.r-chainwheel)),
     r=RearFrame.frame_b.P.x,
     R=MB.Frames.Orientation(T=RearFrame.frame_b.P.R,w=zeros(3)));
  
   Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape upperframepipe(
     shapeType="cylinder",
     color={255,255,0},
     width=0.06,
     height=0.06,
     widthDirection={0,0,1},
     r_shape=upperframenode,
     lengthDirection=(-RearFrame.r-upperframenode),
     length=sqrt((-RearFrame.r-upperframenode)*(-RearFrame.r-upperframenode)),
     r=RearFrame.frame_b.P.x,
     R=MB.Frames.Orientation(T=RearFrame.frame_b.P.R,w=zeros(3)));
  
  Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape chainwheelpipe(
    shapeType="cylinder",
    color={255,255,0},
    widthDirection={1,0,0},
    r_shape=chainwheel+{0,0,-0.08},
    lengthDirection={0,0,1},
    width=0.1,
    height=0.1,
    length=0.16,
    r=RearFrame.frame_b.P.x,
    R=MB.Frames.Orientation(T=RearFrame.frame_b.P.R,w=zeros(3)));
  
 Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape Saddle(
    color={0,0,0},
    shapeType="box",
    lengthDirection={-1,0,0},
    widthDirection={0,0,1},
    length=0.2,
    width=0.1,
    height=0.05,
    r_shape={saddlenode[1]+(saddleHeight/tan(saddlepipeAngleRad))+0.07,saddleHeight+saddlenodeHeight,0},
    r=RearFrame.frame_b.P.x,
    R=MB.Frames.Orientation(T=RearFrame.frame_b.P.R,w=zeros(3)));
  
  Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape ForkPipe1(
    shapeType="cylinder",
    color={255,255,0},
    lengthDirection={cos(handlebarAngleRad),sin(handlebarAngleRad),0},
    r_shape={0,0,0},
    length=0.134,
    width=0.05,
    height=0.05,
    r=FrontFrame.frame_b.P.x,
    R=MB.Frames.Orientation(T=FrontFrame.frame_b.P.R,w=zeros(3)));
  
  Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape ForkPipe2(
    shapeType="cylinder",
    color={255,255,0},
    lengthDirection={0,0,1},
    width=0.04,
    height=0.04,
    r_shape={cos(handlebarAngleRad),sin(handlebarAngleRad),0}*0.134+{0,0,-0.22},
    length=0.44,
    r=FrontFrame.frame_b.P.x,
    R=MB.Frames.Orientation(T=FrontFrame.frame_b.P.R,w=zeros(3)));
  
  Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape FWSuspLeft(
    shapeType="cylinder",
    r_shape={0,0,-0.050},
    color={255,255,0},
    width=0.03,
    height=0.03,
    lengthDirection=Steering.n,
    length=-FrontFrame.r*Steering.n/sqrt(Steering.n*Steering.n),
    r=FrontFrame.frame_b.P.x,
    R=MB.Frames.Orientation(T=FrontFrame.frame_b.P.R,w=zeros(3)));
  
  Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape FWSuspRight(
    shapeType="cylinder",
    color={255,255,0},
    width=0.03,
    height=0.03,
    lengthDirection=Steering.n,
    r_shape={0,0,0.050},
    length=-FrontFrame.r*Steering.n/sqrt(Steering.n*Steering.n),
    r=FrontFrame.frame_b.P.x,
    R=MB.Frames.Orientation(T=FrontFrame.frame_b.P.R,w=zeros(3)));
  
equation 
  connect(RWRevolute.frame_a, RearFrame.frame_b);
  connect(FrontFrame.frame_a, FWRevolute.frame_b);
  connect(Steering.frame_a, FrontFrame.frame_b);
  connect(RearFrame.frame_a, Steering.frame_b);
  connect(RearMassPos.frame_a, RWRevolute.frame_a);
  connect(RearMass.frame_a, RearMassPos.frame_b);
  connect(FrontMassPos.frame_a, FWRevolute.frame_b);
  connect(FrontMass.frame_a, FrontMassPos.frame_b);
  connect(RWheel.frame_b, RWRevolute.frame_b);
  connect(FWRevolute.frame_a, FWheelJoint.frame_b);
  connect(FWheelJoint.frame_b, FWheelMass.frame_a);
end Bicycle;

MultiBondLib.Mechanics3D.Examples.PlanarLoop MultiBondLib.Mechanics3D.Examples.PlanarLoop

a planar kinematic loop

MultiBondLib.Mechanics3D.Examples.PlanarLoop

Information


This example presents a planar kinematic loop. It is equivalent to the example in the PlanarMechanics library.

The planar loop is formed out of three revolute joints and one prismatic joint. Attached to this loop is a pendulum that is dissipating its energy through the damper.

This model contains one planar loops that is closed by the usage of the planar revolute: a special cut joint for planar loops. The loops lead to 2 non-linear equations.


Modelica definition

model PlanarLoop "a planar kinematic loop" 
           extends Modelica.Icons.Example;
  
  inner World3D world3D(                 g=9.81, nominalLength=5);
  Parts.Fixed Fixed1;
  Joints.Revolute Revolute1(
    phi_start=0,
    w_start=Modelica.SIunits.Conversions.from_deg(300),
    n={0,0,1},
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    enforceStates=true);
  Parts.FixedTranslation FixedTranslation4(r={0,-3,0}, animation=true);
  Parts.Body Body2(
    animation=true,
    I_11=0.05,
    I_22=0.05,
    I_33=0.05,
    I_21=0,
    I_31=0,
    I_32=0,
    m=2);
  Joints.Prismatic Prismatic1(
    v_start=0,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    s_start=2);
  Forces.Damping Damping1(d=2);
  Forces.Spring Spring1(c=50, s0=1.6);
  Joints.Revolute Revolute2(
    n={0,0,1},
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    enforceStates=false);
  Parts.FixedTranslation FixedTranslation1(r={0,-3,0}, animation=true);
  Joints.CutJoints.PlanarRevolute PlanarRevolute1;
  Joints.Revolute Revolute3(
    n={0,0,1},
    enforceStates=false,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity);
  Parts.FixedTranslation FixedTranslation2(            animation=true, r={-2,0,
        0});
equation 
  connect(Prismatic1.frame_a, Fixed1.frame_b);
  connect(Damping1.frame_a, Fixed1.frame_b);
  connect(Spring1.frame_a, Fixed1.frame_b);
  connect(Revolute1.frame_b, Fixed1.frame_b);
  connect(Prismatic1.frame_b, Revolute2.frame_b);
  connect(FixedTranslation1.frame_a, Revolute2.frame_a);
  connect(FixedTranslation4.frame_a, Revolute1.frame_a);
  connect(Damping1.frame_b, Revolute2.frame_b);
  connect(Spring1.frame_b, Revolute2.frame_b);
  connect(PlanarRevolute1.frame_b, FixedTranslation1.frame_b);
  connect(PlanarRevolute1.frame_a, FixedTranslation4.frame_b);
  connect(Revolute3.frame_a, FixedTranslation1.frame_b);
  connect(Revolute3.frame_b, FixedTranslation2.frame_b);
  connect(Body2.frame_a, FixedTranslation2.frame_a);
end PlanarLoop;

MultiBondLib.Mechanics3D.Examples.CentrifugalForce MultiBondLib.Mechanics3D.Examples.CentrifugalForce

demonstration of the centrifugal force

MultiBondLib.Mechanics3D.Examples.CentrifugalForce

Information


This example demonstrates the influence of the centrifugal froce. 
It also presents how to handle planar loops.

The centrifugal forces tear the two body elements apart and are therefore squeezing the spring.

This model contains two planar loops that are closed by the usage of the planar revolute joints: a special cut joint for planar loops. The two loops lead to 4 non-linear equations.


Modelica definition

model CentrifugalForce "demonstration of the centrifugal force" 
           extends Modelica.Icons.Example;
  
  inner World3D world3D(                 g=9.81, nominalLength=5,
    animateGravity=false,
    animateWorld=true);
  Parts.Fixed Fixed1;
  Joints.Revolute Revolute1(
    phi_start=0,
    w_start=Modelica.SIunits.Conversions.from_deg(300),
    n={0,0,1},
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    enforceStates=true);
  Parts.FixedTranslation FixedTranslation4(animation=true, r={1.3,0,0});
  Parts.Body Body2(
    animation=true,
    I_11=0.05,
    I_22=0.05,
    I_33=0.05,
    I_21=0,
    I_31=0,
    I_32=0,
    m=2);
  Joints.Prismatic Prismatic1(
    v_start=0,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    n={0,1,0},
    s_start=1.45);
  Forces.Damping Damping1(d=16);
  Forces.Spring Spring1(s0=1.6, c=160);
  Joints.Revolute Revolute2(
    n={0,0,1},
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    enforceStates=false);
  Parts.FixedTranslation FixedTranslation1(animation=true, r={1.3,0,0});
  Joints.CutJoints.PlanarRevolute PlanarRevolute1;
  Joints.Revolute Revolute3(
    n={0,1,0},
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    cylinderDiameter=world3D.defaultJointWidth*3,
    enforceStates=true,
    cylinderLength=world3D.defaultJointLength/5);
  Parts.Body Body1(
    I_11=0.05,
    I_22=0.05,
    I_33=0.05,
    I_21=0,
    I_31=0,
    I_32=0,
    m=4,
    animation=false);
  Forces.WorldTorque WorldTorque1(t={0,10,0});
  Joints.Revolute Revolute4(
    phi_start=0,
    w_start=Modelica.SIunits.Conversions.from_deg(300),
    n={0,0,1},
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    enforceStates=false);
  Joints.Revolute Revolute5(
    n={0,0,1},
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    enforceStates=false);
  Parts.FixedTranslation FixedTranslation2(animation=true, r={-1.3,0,0});
  Parts.FixedTranslation FixedTranslation3(animation=true, r={-1.3,0,0});
  Joints.CutJoints.PlanarRevolute PlanarRevolute2;
  Parts.Body Body3(
    animation=true,
    I_11=0.05,
    I_22=0.05,
    I_33=0.05,
    I_21=0,
    I_31=0,
    I_32=0,
    m=2);
equation 
  connect(Prismatic1.frame_b, Revolute2.frame_b);
  connect(FixedTranslation1.frame_a, Revolute2.frame_a);
  connect(FixedTranslation4.frame_a, Revolute1.frame_a);
  connect(Damping1.frame_b, Revolute2.frame_b);
  connect(Spring1.frame_b, Revolute2.frame_b);
  connect(Body2.frame_a, FixedTranslation1.frame_b);
  connect(PlanarRevolute1.frame_b, FixedTranslation1.frame_b);
  connect(PlanarRevolute1.frame_a, FixedTranslation4.frame_b);
  connect(Revolute3.frame_a, Fixed1.frame_b);
  connect(Body1.frame_a, Revolute3.frame_b);
  connect(Revolute3.frame_b, Revolute1.frame_b);
  connect(Prismatic1.frame_a, Revolute3.frame_b);
  connect(Damping1.frame_a, Revolute3.frame_b);
  connect(Spring1.frame_a, Revolute3.frame_b);
  connect(WorldTorque1.frame_b, Body1.frame_a);
  connect(Revolute4.frame_a, Revolute3.frame_b);
  connect(Revolute5.frame_a, Prismatic1.frame_b);
  connect(FixedTranslation2.frame_a, Revolute4.frame_b);
  connect(FixedTranslation3.frame_b, Revolute5.frame_b);
  connect(PlanarRevolute2.frame_b, FixedTranslation3.frame_a);
  connect(Body3.frame_a, PlanarRevolute2.frame_b);
  connect(FixedTranslation2.frame_b, PlanarRevolute2.frame_a);
end CentrifugalForce;

MultiBondLib.Mechanics3D.Examples.NewtonsCradleWeak MultiBondLib.Mechanics3D.Examples.NewtonsCradleWeak

an implementation of Newton's cradle with weak collision models

MultiBondLib.Mechanics3D.Examples.NewtonsCradleWeak

Information


This example presents an implementation of newton's cradle
using a continuous collision model.

Although the virtual springs of the collision elements are chosen to be very stiff, the results are extremly poor.This example demonstrates the need for impuls modeling.


Modelica definition

model NewtonsCradleWeak 
  "an implementation of Newton's cradle with weak collision models" 
           extends Modelica.Icons.Example;
  
  inner World3D world3D(nominalLength=5,
    animateWorld=false,
    animateGravity=false);
  Parts.Body Body1(
    m=2,
    I_21=0,
    I_31=0,
    I_32=0,
    sphereDiameter=0.5,
    I_11=0,
    I_22=0,
    I_33=0);
  Parts.Fixed Fixed1;
  Joints.Revolute Revolute1(initType=Modelica.Mechanics.MultiBody.Types.Init.
        PositionVelocity,
    w_start=0,
    enforceStates=true,
    n={0,0,1},
    phi_start=-1);
  Parts.FixedTranslation FixedTranslation1(r={0,-2,0});
  Joints.Revolute Revolute2(
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    n={0,0,1},
    w_start=0,
    enforceStates=true,
    phi_start=-1);
  Parts.Body Body2(
    m=2,
    I_21=0,
    I_31=0,
    I_32=0,
    sphereDiameter=0.5,
    I_11=0,
    I_22=0,
    I_33=0);
  Parts.Fixed Fixed2(r={0.5,0,0});
  Parts.FixedTranslation FixedTranslation6(r={0,-2,0});
  Forces.SoftImpuls_SphereSphere SoftImpuls_SphereSphere1(
    ra=0.25,
    rb=0.25,
    c=1e09);
  Joints.Revolute Revolute3(
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    n={0,0,1},
    w_start=0,
    enforceStates=true,
    phi_start=0);
  Parts.Body Body3(
    m=2,
    I_21=0,
    I_31=0,
    I_32=0,
    sphereDiameter=0.5,
    I_11=0,
    I_22=0,
    I_33=0);
  Parts.Fixed Fixed3(r={1,0,0});
  Parts.FixedTranslation FixedTranslation2(r={0,-2,0});
  Forces.SoftImpuls_SphereSphere SoftImpuls_SphereSphere2(
    ra=0.25,
    rb=0.25,
    c=1e09);
  Joints.Revolute Revolute4(
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    n={0,0,1},
    w_start=0,
    enforceStates=true,
    phi_start=0);
  Parts.Body Body4(
    m=2,
    I_21=0,
    I_31=0,
    I_32=0,
    sphereDiameter=0.5,
    I_11=0,
    I_22=0,
    I_33=0);
  Parts.Fixed Fixed4(r={1.5,0,0});
  Parts.FixedTranslation FixedTranslation3(r={0,-2,0});
  Forces.SoftImpuls_SphereSphere SoftImpuls_SphereSphere3(
    ra=0.25,
    rb=0.25,
    c=1e09);
  Joints.Revolute Revolute5(
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    n={0,0,1},
    w_start=0,
    enforceStates=true,
    phi_start=0);
  Parts.Body Body5(
    m=2,
    I_21=0,
    I_31=0,
    I_32=0,
    sphereDiameter=0.5,
    I_11=0,
    I_22=0,
    I_33=0);
  Parts.Fixed Fixed5(r={2,0,0});
  Parts.FixedTranslation FixedTranslation4(r={0,-2,0});
  Forces.SoftImpuls_SphereSphere SoftImpuls_SphereSphere4(
    ra=0.25,
    rb=0.25,
    c=1e09);
  Parts.FixedTranslation FixedTranslation5(r={2,0,0});
equation 
  connect(Body2.frame_a, FixedTranslation6.frame_b);
  connect(FixedTranslation1.frame_b, Body1.frame_a);
  connect(Revolute1.frame_a, Fixed1.frame_b);
  connect(Revolute2.frame_a, Fixed2.frame_b);
  connect(FixedTranslation1.frame_a, Revolute1.frame_b);
  connect(FixedTranslation6.frame_a, Revolute2.frame_b);
  connect(SoftImpuls_SphereSphere1.frame_b, Body2.frame_a);
  connect(SoftImpuls_SphereSphere1.frame_a, Body1.frame_a);
  connect(Body3.frame_a,FixedTranslation2. frame_b);
  connect(Revolute3.frame_a,Fixed3. frame_b);
  connect(FixedTranslation2.frame_a,Revolute3. frame_b);
  connect(SoftImpuls_SphereSphere2.frame_b, Body3.frame_a);
  connect(SoftImpuls_SphereSphere2.frame_a, Body2.frame_a);
  connect(Body4.frame_a,FixedTranslation3. frame_b);
  connect(Revolute4.frame_a,Fixed4. frame_b);
  connect(FixedTranslation3.frame_a,Revolute4. frame_b);
  connect(SoftImpuls_SphereSphere3.frame_b, Body4.frame_a);
  connect(Body5.frame_a,FixedTranslation4. frame_b);
  connect(Revolute5.frame_a,Fixed5. frame_b);
  connect(FixedTranslation4.frame_a,Revolute5. frame_b);
  connect(SoftImpuls_SphereSphere4.frame_b, Body5.frame_a);
  connect(SoftImpuls_SphereSphere4.frame_a, Body4.frame_a);
  connect(SoftImpuls_SphereSphere3.frame_a, Body3.frame_a);
  connect(FixedTranslation5.frame_a, Fixed1.frame_b);
end NewtonsCradleWeak;

MultiBondLib.Mechanics3D.Examples.ThreeBodySystem MultiBondLib.Mechanics3D.Examples.ThreeBodySystem

three bodies attracting each other

MultiBondLib.Mechanics3D.Examples.ThreeBodySystem

Information


This example presents a system of three freely moving, mutually attracting bodies. The attraction is due to gravity.

This model demonstrates the usage of the gravity pool, which is included in the world model. The gravityPoolSize of the world model is set to 3 and each body element has a unique value of the parameter GPIndex in the range of 1 to 3.

You can also observe in this example, that freely moving body elements do not need to be connected to a free body movement joint.


Modelica definition

model ThreeBodySystem "three bodies attracting each other" 
           extends Modelica.Icons.Example;
  
  inner World3D world3D(nominalLength=5, g=0,
    gravityPoolSize=3);
  Parts.Body Body1(
    I_11=0.02,
    I_22=0.02,
    I_33=0.02,
    I_21=0,
    I_31=0,
    I_32=0,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    useQuaternions=true,
    m=1e11,
    GPIndex=1,
    v_start={0,0.8,0},
    x_start={3,0,0});
  Parts.Body Body2(
    I_11=0.02,
    I_22=0.02,
    I_33=0.02,
    I_21=0,
    I_31=0,
    I_32=0,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    useQuaternions=true,
    m=1e11,
    GPIndex=2,
    v_start={0,-0.8,0},
    x_start={-3,0,0});
  Parts.Body Body3(
    I_11=0.02,
    I_22=0.02,
    I_33=0.02,
    I_21=0,
    I_31=0,
    I_32=0,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    useQuaternions=true,
    m=1e11,
    GPIndex=3,
    v_start={0,0,0.8},
    x_start={0,0,-3});
end ThreeBodySystem;

HTML-documentation generated by Dymola Thu Feb 23 12:19:58 2006.