MultiBondLib.Mechanics3DwithImpulses.Examples

Examples

Information


This package contains various examples.

These examples demonstrate the usage of the Mechanics3DwithImpulses library.

For all these examples the following simulation setup is proposed.

Don't forget to open an animation window.

Package Content

NameDescription
MultiBondLib.Mechanics3DwithImpulses.Examples.MixedModel MixedModel ball attached to a spring bouncing on the floor
MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingPendulum BouncingPendulum pendulum bouncing on the floor
MultiBondLib.Mechanics3DwithImpulses.Examples.NewtonsCradle NewtonsCradle An implementation of Newton's Cradle
MultiBondLib.Mechanics3DwithImpulses.Examples.BulletOnPendulum BulletOnPendulum a bullet hits a pendulum
MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingSpherical BouncingSpherical a spherical pendulum bouncing on the floor
MultiBondLib.Mechanics3DwithImpulses.Examples.FourBarLoop FourBarLoop a kinematic loops underlies hard impacts
MultiBondLib.Mechanics3DwithImpulses.Examples.CueStrikingBall CueStrikingBall a cue hitting a ball
MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingBall BouncingBall a rotating ball bouncing on the floor
MultiBondLib.Mechanics3DwithImpulses.Examples.CP1 CP1 modeling of mutual collisions
MultiBondLib.Mechanics3DwithImpulses.Examples.CP2 CP2 modeling of mutual collisions
MultiBondLib.Mechanics3DwithImpulses.Examples.PistonEngine PistonEngine pendulum bouncing on the floor


MultiBondLib.Mechanics3DwithImpulses.Examples.MixedModel MultiBondLib.Mechanics3DwithImpulses.Examples.MixedModel

ball attached to a spring bouncing on the floor

MultiBondLib.Mechanics3DwithImpulses.Examples.MixedModel

Information


This example demonstrates how to create a mixed model.

The fixation and the spring are continuous models of the Mechanics3D library. All other elements are taken from this library. Both types can be connected by the special interface element: "ConnectContinuousFrame".


Modelica definition

model MixedModel "ball attached to a spring bouncing on the floor" 
            extends Modelica.Icons.Example;
  inner Mechanics3D.World3D world3D(     n={0,-1,0}, g=9.81);
  Joints.FreeTranslationalMovement FreeTranslationalMovement1(initType=
        Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    enforceStates=false,
    reinitByImpulse=true,
    x_start={0.2,0.5,0});
  Parts.SimpleBody SimpleBody1(sphereDiameter=0.1);
  Contacts.CollisionSpherePlane CollisionSphereSphere1(ra=0.05);
  Interfaces.InsertImpulse InsertImpulse1;
  Mechanics3D.Parts.Fixed Fixed1(r={0,1,0});
  Mechanics3D.Forces.Spring Spring1(      s0=0.5,
    numberOfWindings=5,
    c=12,
    width=0.05);
  inner CollisionPool collisionPool;
  Interfaces.InsertImpulse InsertImpulse2;
  Parts.Fixed Fixed2;
  Interfaces.ConnectContinousFrame ConnectContinousFrame1;
equation 
  connect(InsertImpulse1.frame_a, FreeTranslationalMovement1.frame_b);
  connect(InsertImpulse1.frame_b, SimpleBody1.frame_a);
  connect(CollisionSphereSphere1.frame_a, SimpleBody1.frame_a);
  connect(Spring1.frame_a, Fixed1.frame_b);
  connect(CollisionSphereSphere1.y, InsertImpulse1.u);
  connect(InsertImpulse2.frame_b, CollisionSphereSphere1.frame_b);
  connect(Fixed2.frame_b, InsertImpulse2.frame_a);
  connect(InsertImpulse2.u, CollisionSphereSphere1.y);
  connect(ConnectContinousFrame1.frame_a, Spring1.frame_b);
  connect(ConnectContinousFrame1.frame_b, SimpleBody1.frame_a);
end MixedModel;

MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingPendulum MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingPendulum

pendulum bouncing on the floor

MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingPendulum

Information


This example presents a pendulum bouncing on the floor.


Modelica definition

model BouncingPendulum "pendulum bouncing on the floor" 
            extends Modelica.Icons.Example;
  Parts.SimpleBody SimpleBody1(sphereDiameter=0.1);
  Contacts.CollisionSpherePlane CollisionSphereSphere1(ra=0.05);
  Interfaces.InsertImpulse InsertImpulse1;
  Parts.Fixed Fixed2(r={0,0.5,0});
  Joints.Revolute Revolute1(enforceStates=true, initType=Modelica.
        Mechanics.MultiBody.Types.Init.PositionVelocity);
  Parts.FixedTranslation FixedTranslation1(r={-0.6,0,0});
  inner World3D world3D;
  Parts.Fixed Fixed1;
  Interfaces.InsertImpulse InsertImpulse2;
  inner CollisionPool collisionPool;
equation 
  connect(InsertImpulse1.frame_b, SimpleBody1.frame_a);
  connect(CollisionSphereSphere1.frame_a, SimpleBody1.frame_a);
  connect(FixedTranslation1.frame_b, InsertImpulse1.frame_a);
  connect(FixedTranslation1.frame_a, Revolute1.frame_b);
  connect(Fixed2.frame_b, Revolute1.frame_a);
  connect(CollisionSphereSphere1.y, InsertImpulse1.u);
  connect(InsertImpulse2.frame_b, Fixed1.frame_b);
  connect(InsertImpulse2.frame_a, CollisionSphereSphere1.frame_b);
  connect(InsertImpulse2.u, CollisionSphereSphere1.y);
end BouncingPendulum;

MultiBondLib.Mechanics3DwithImpulses.Examples.NewtonsCradle MultiBondLib.Mechanics3DwithImpulses.Examples.NewtonsCradle

An implementation of Newton's Cradle

MultiBondLib.Mechanics3DwithImpulses.Examples.NewtonsCradle

Information


This example presents the model of Newton's cadle.


Modelica definition

model NewtonsCradle "An implementation of Newton's Cradle" 
            extends Modelica.Icons.Example;
  inner Mechanics3D.World3D world3D(     n={0,-1,0}, g=9.81,
    nominalLength=5,
    animateWorld=false,
    animateGravity=false);
  Parts.SimpleBody SimpleBody1(sphereDiameter=0.5,
    I_11=0.01,
    I_22=0.01,
    I_33=0.01);
  Interfaces.InsertImpulse InsertImpulse1;
  Parts.Fixed Fixed2;
  Joints.Revolute Revolute1(enforceStates=true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    w_start=0,
    phi_start=-40);
  Parts.FixedTranslation FixedTranslation1(r={0,-2,0});
  Parts.SimpleBody SimpleBody2(m=1, sphereDiameter=0.5,
    I_11=0.01,
    I_22=0.01,
    I_33=0.01);
  Interfaces.InsertImpulse InsertImpulse2;
  Parts.Fixed Fixed1(r={0.5,0,0});
  Joints.Revolute Revolute2(enforceStates=true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    w_start=0,
    phi_start=-40);
  Parts.FixedTranslation FixedTranslation2(r={0,-2,0});
  Contacts.CollisionSphereSphere CollisionSphereSphere1(ra=0.2499, rb=
        0.2499,
    elasticity=1.0);
  Parts.SimpleBody SimpleBody3(m=1, sphereDiameter=0.5,
    I_11=0.01,
    I_22=0.01,
    I_33=0.01);
  Interfaces.InsertImpulse InsertImpulse3;
  Parts.Fixed Fixed3(r={1,0,0});
  Joints.Revolute Revolute3(enforceStates=true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    phi_start=0,
    w_start=0);
  Parts.FixedTranslation FixedTranslation3(r={0,-2,0});
  Contacts.CollisionSphereSphere CollisionSphereSphere2(ra=0.2499, rb=
        0.2499,
    elasticity=1.0);
  Modelica.Blocks.Logical.Or Or1;
  Parts.SimpleBody SimpleBody4(m=1, sphereDiameter=0.5,
    I_11=0.01,
    I_22=0.01,
    I_33=0.01);
  Interfaces.InsertImpulse InsertImpulse4;
  Parts.Fixed Fixed4(r={1.5,0,0});
  Joints.Revolute Revolute4(enforceStates=true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    phi_start=0,
    w_start=0);
  Parts.FixedTranslation FixedTranslation4(r={0,-2,0});
  Contacts.CollisionSphereSphere CollisionSphereSphere3(ra=0.2499, rb=
        0.2499,
    elasticity=1.0,
    muR=0);
  Modelica.Blocks.Logical.Or Or2;
  Parts.SimpleBody SimpleBody5(m=1, sphereDiameter=0.5,
    I_11=0.01,
    I_22=0.01,
    I_33=0.01);
  Interfaces.InsertImpulse InsertImpulse5;
  Parts.Fixed Fixed5(r={2,0,0});
  Joints.Revolute Revolute5(enforceStates=true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    w_start=0,
    phi_start=80);
  Parts.FixedTranslation FixedTranslation5(r={0,-2,0});
  Contacts.CollisionSphereSphere CollisionSphereSphere4(ra=0.2499, rb=
        0.2499,
    elasticity=1.0);
  Modelica.Blocks.Logical.Or Or3;
  inner CollisionPool collisionPool;
  Parts.FixedTranslation FixedTranslation6(r={2,0,0});
equation 
  connect(InsertImpulse1.frame_b, SimpleBody1.frame_a);
  connect(FixedTranslation1.frame_b, InsertImpulse1.frame_a);
  connect(FixedTranslation1.frame_a, Revolute1.frame_b);
  connect(Fixed2.frame_b, Revolute1.frame_a);
  connect(InsertImpulse2.frame_b,SimpleBody2. frame_a);
  connect(FixedTranslation2.frame_b,InsertImpulse2. frame_a);
  connect(FixedTranslation2.frame_a,Revolute2. frame_b);
  connect(Fixed1.frame_b,Revolute2. frame_a);
  connect(CollisionSphereSphere1.y, InsertImpulse1.u);
  connect(SimpleBody1.frame_a, CollisionSphereSphere1.frame_a);
  connect(SimpleBody2.frame_a, CollisionSphereSphere1.frame_b);
  connect(InsertImpulse3.frame_b,SimpleBody3. frame_a);
  connect(FixedTranslation3.frame_b,InsertImpulse3. frame_a);
  connect(FixedTranslation3.frame_a,Revolute3. frame_b);
  connect(Fixed3.frame_b,Revolute3. frame_a);
  connect(SimpleBody2.frame_a, CollisionSphereSphere2.frame_a);
  connect(SimpleBody3.frame_a, CollisionSphereSphere2.frame_b);
  connect(Or1.y, InsertImpulse2.u);
  connect(CollisionSphereSphere1.y, Or1.u2);
  connect(CollisionSphereSphere2.y, Or1.u1);
  connect(InsertImpulse4.frame_b,SimpleBody4. frame_a);
  connect(FixedTranslation4.frame_b,InsertImpulse4. frame_a);
  connect(FixedTranslation4.frame_a,Revolute4. frame_b);
  connect(Fixed4.frame_b,Revolute4. frame_a);
  connect(SimpleBody4.frame_a,CollisionSphereSphere3. frame_b);
  connect(CollisionSphereSphere2.y, Or2.u2);
  connect(Or2.y, InsertImpulse3.u);
  connect(CollisionSphereSphere3.y, Or2.u1);
  connect(SimpleBody3.frame_a, CollisionSphereSphere3.frame_a);
  connect(InsertImpulse5.frame_b,SimpleBody5. frame_a);
  connect(FixedTranslation5.frame_b,InsertImpulse5. frame_a);
  connect(FixedTranslation5.frame_a,Revolute5. frame_b);
  connect(Fixed5.frame_b,Revolute5. frame_a);
  connect(CollisionSphereSphere4.y,InsertImpulse5. u);
  connect(SimpleBody5.frame_a,CollisionSphereSphere4. frame_b);
  connect(SimpleBody4.frame_a, CollisionSphereSphere4.frame_a);
  connect(CollisionSphereSphere3.y, Or3.u2);
  connect(Or3.y, InsertImpulse4.u);
  connect(CollisionSphereSphere4.y, Or3.u1);
  connect(FixedTranslation6.frame_a, Fixed2.frame_b);
end NewtonsCradle;

MultiBondLib.Mechanics3DwithImpulses.Examples.BulletOnPendulum MultiBondLib.Mechanics3DwithImpulses.Examples.BulletOnPendulum

a bullet hits a pendulum

MultiBondLib.Mechanics3DwithImpulses.Examples.BulletOnPendulum

Information


This example presents a pendulum fully hit by a free flying bullet.


Modelica definition

model BulletOnPendulum "a bullet hits a pendulum" 
            extends Modelica.Icons.Example;
  inner Mechanics3D.World3D world3D(     n={0,-1,0}, g=0,
    animateGravity=false);
  Parts.SimpleBody SimpleBody1(sphereDiameter=0.5, m=1);
  Interfaces.InsertImpulse InsertImpulse1;
  Parts.SimpleBody SimpleBody2(sphereDiameter=0.5, m=1);
  Interfaces.InsertImpulse InsertImpulse2;
  Contacts.CollisionSphereSphere CollisionSphereSphere1(ra=0.25, rb=0.25,
    elasticity=1.0);
  Joints.FreeTranslationalMovement FreeTranslationalMovement1(initType=
        Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    v_start={4,0,0},
    enforceStates=false,
    reinitByImpulse=true,
    x_start={-2,-2,0});
  Parts.Fixed Fixed1(r={1,0,0});
  Joints.Revolute Revolute2(enforceStates=true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    phi_start=0,
    w_start=0,
    cylinderLength=0.5,
    cylinderDiameter=0.3);
  Parts.FixedTranslation FixedTranslation2(r={0,-2,0});
  
  inner CollisionPool collisionPool;
equation 
  connect(InsertImpulse1.frame_b, SimpleBody1.frame_a);
  connect(InsertImpulse2.frame_b,SimpleBody2. frame_a);
  connect(CollisionSphereSphere1.y, InsertImpulse1.u);
  connect(CollisionSphereSphere1.y, InsertImpulse2.u);
  connect(SimpleBody1.frame_a, CollisionSphereSphere1.frame_a);
  connect(SimpleBody2.frame_a, CollisionSphereSphere1.frame_b);
  connect(FreeTranslationalMovement1.frame_b, InsertImpulse1.frame_a);
  connect(FixedTranslation2.frame_a,Revolute2. frame_b);
  connect(Fixed1.frame_b,Revolute2. frame_a);
  connect(FixedTranslation2.frame_b, InsertImpulse2.frame_a);
end BulletOnPendulum;

MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingSpherical MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingSpherical

a spherical pendulum bouncing on the floor

MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingSpherical

Information


This example presents a spherical-pendulum bouncing on the floor.


Modelica definition

model BouncingSpherical "a spherical pendulum bouncing on the floor" 
            extends Modelica.Icons.Example;
  inner Mechanics3D.World3D world3D(     n={0,-1,0}, g=9.81,
    nominalLength=3);
  Parts.SimpleBody SimpleBody1(sphereDiameter=0.4);
  Contacts.CollisionSpherePlane CollisionSphereSphere1(ra=0.2);
  Interfaces.InsertImpulse InsertImpulse1;
  Parts.Fixed Fixed2;
  Parts.FixedTranslation FixedTranslation1(r={-1.3,0,0});
  Joints.Spherical Spherical1(
    reinitByImpulse=true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    w_start={0,80,0},
    useQuaternions=false);
  Interfaces.InsertImpulse InsertImpulse2;
  Parts.Fixed Fixed1(r={0,-1,0});
  inner CollisionPool collisionPool;
equation 
  connect(InsertImpulse1.frame_b, SimpleBody1.frame_a);
  connect(FixedTranslation1.frame_b, InsertImpulse1.frame_a);
  connect(Spherical1.frame_b, FixedTranslation1.frame_a);
  connect(Spherical1.frame_a, Fixed2.frame_b);
  connect(SimpleBody1.frame_a, CollisionSphereSphere1.frame_a);
  connect(InsertImpulse2.frame_b, CollisionSphereSphere1.frame_b);
  connect(InsertImpulse2.u, CollisionSphereSphere1.y);
  connect(CollisionSphereSphere1.y, InsertImpulse1.u);
  connect(Fixed1.frame_b, InsertImpulse2.frame_a);
end BouncingSpherical;

MultiBondLib.Mechanics3DwithImpulses.Examples.FourBarLoop MultiBondLib.Mechanics3DwithImpulses.Examples.FourBarLoop

a kinematic loops underlies hard impacts

MultiBondLib.Mechanics3DwithImpulses.Examples.FourBarLoop

Information


This example presents a model of a kinematic loop colliding to a plane.

Kinematic loops have to be closed manually.


Modelica definition

model FourBarLoop "a kinematic loops underlies hard impacts" 
           extends Modelica.Icons.Example;
  
  inner Mechanics3D.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,
    enforceStates=true,
    w_start=300);
  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.SimpleBody 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.SimpleBody 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.SimpleBody 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, sphereDiameter=0.1);
  Joints.CloseLoop CloseLoop1;
  Interfaces.InsertImpulse InsertImpulse1;
  Contacts.CollisionSpherePlane CollisionSpherePlane1(ra=0.05);
  Parts.Fixed Fixed2;
  Interfaces.InsertImpulse InsertImpulse2;
  inner CollisionPool collisionPool;
equation 
  connect(Revolute1.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(CloseLoop1.frame_a, FixedTranslation3.frame_b);
  connect(CloseLoop1.frame_b, Revolute6.frame_b);
  connect(Fixed1.frame_b, InsertImpulse1.frame_a);
  connect(InsertImpulse1.frame_b, FixedTranslation4.frame_a);
  connect(FixedTranslation1.frame_b, CollisionSpherePlane1.frame_a);
  connect(CollisionSpherePlane1.y, InsertImpulse1.u);
  connect(InsertImpulse2.frame_a, CollisionSpherePlane1.frame_b);
  connect(Fixed2.frame_b, InsertImpulse2.frame_b);
  connect(InsertImpulse1.u, InsertImpulse2.u);
end FourBarLoop;

MultiBondLib.Mechanics3DwithImpulses.Examples.CueStrikingBall MultiBondLib.Mechanics3DwithImpulses.Examples.CueStrikingBall

a cue hitting a ball

MultiBondLib.Mechanics3DwithImpulses.Examples.CueStrikingBall

Information


This example presents a cue striking at a ball.
The ball starts to rotate, due to friction.


Modelica definition

model CueStrikingBall "a cue hitting a ball" 
            extends Modelica.Icons.Example;
  inner Mechanics3D.World3D world3D(     n={0,-1,0},
    nominalLength=3,
    g=0,
    animateWorld=false,
    animateGravity=false);
  Parts.SimpleBody SimpleBody1(
    I_11=0.02,
    I_22=0.02,
    I_33=0.02,
    m=3,
    sphereDiameter=0.06);
  Interfaces.InsertImpulse InsertImpulse1;
  Interfaces.InsertImpulse InsertImpulse2;
  Contacts.CollisionSphereSphere CollisionSphereSphere1(
    contactDuration=1e-3,
    elasticity=0.8,
    muR=0.2,
    ra=0.03,
    rb=0.15);
  Parts.FixedTranslation FixedTranslation1(r={0,-0.25,0});
  Parts.FixedTranslation FixedTranslation2(r={-1.5,0,0}, color={100,90,0});
  Joints.FreeBodyMovement FreeBodyMovement2(
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    reinitByImpulse=true,
    v_start={4,0,0},
    x_start={-2,0.05,0});
  Parts.SimpleBody SimpleBody3(
    I_11=0.02,
    sphereDiameter=0.2,
    m=6,
    I_22=0.2,
    I_33=0.2,
    animation=false);
  Parts.Body Body1(
    animation=true,
    m=4,
    I_11=0.02,
    I_22=0.02,
    I_33=0.02,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    reinitByImpulse=true,
    sphereDiameter=0.3);
  inner CollisionPool collisionPool;
  Parts.FixedTranslation FixedTranslation3(r={0,0.25,0});
  Parts.FixedTranslation FixedTranslation4(r={-0.25,0,0});
  Parts.FixedTranslation FixedTranslation5(r={0.25,0,0});
equation 
  connect(InsertImpulse1.frame_b, SimpleBody1.frame_a);
  connect(CollisionSphereSphere1.frame_a, SimpleBody1.frame_a);
  connect(CollisionSphereSphere1.y, InsertImpulse2.u);
  connect(CollisionSphereSphere1.y, InsertImpulse1.u);
  connect(FixedTranslation2.frame_a, SimpleBody1.frame_a);
  connect(FreeBodyMovement2.frame_b, InsertImpulse1.frame_a);
  connect(SimpleBody3.frame_a, FixedTranslation2.frame_b);
  connect(FixedTranslation1.frame_a, Body1.frame_a);
  connect(InsertImpulse2.frame_b, Body1.frame_a);
  connect(CollisionSphereSphere1.frame_b, Body1.frame_a);
  connect(FixedTranslation1.frame_a, FixedTranslation3.frame_a);
  connect(FixedTranslation4.frame_a, Body1.frame_a);
  connect(FixedTranslation4.frame_a, FixedTranslation5.frame_a);
end CueStrikingBall;

MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingBall MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingBall

a rotating ball bouncing on the floor

MultiBondLib.Mechanics3DwithImpulses.Examples.BouncingBall

Information


A heavily rotating ball is bouncing on the floor. 
It picks up tranlsational velocity, due to friction.


Modelica definition

model BouncingBall "a rotating ball bouncing on the floor" 
            extends Modelica.Icons.Example;
  inner Mechanics3D.World3D world3D(     n={0,-1,0},
    nominalLength=3,
    g=9.81);
  Interfaces.InsertImpulse InsertImpulse1;
  Parts.SimpleBody SimpleBody2(sphereDiameter=0.5,
    m=1,
    I_11=0.04,
    I_22=0.04,
    I_33=0.04);
  Interfaces.InsertImpulse InsertImpulse2;
  Parts.FixedTranslation FixedTranslation1(r={0,0.35,0});
  Joints.FreeBodyMovement FreeBodyMovement1(
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    reinitByImpulse=true,
    x_start={-2,1.25,0},
    v_start={0,0,0},
    w_start=4*{0,0,-360});
  Contacts.CollisionSpherePlane CollisionSpherePlane1(
    ra=0.25,
    elasticity=1.0,
    contactDuration=1e-3,
    muR=0.1);
  Parts.Fixed Fixed1;
  inner CollisionPool collisionPool;
equation 
  connect(InsertImpulse2.frame_b,SimpleBody2. frame_a);
  connect(FixedTranslation1.frame_a, SimpleBody2.frame_a);
  connect(FreeBodyMovement1.frame_b, InsertImpulse2.frame_a);
  connect(CollisionSpherePlane1.frame_a, SimpleBody2.frame_a);
  connect(CollisionSpherePlane1.y, InsertImpulse2.u);
  connect(InsertImpulse1.u, CollisionSpherePlane1.y);
  connect(InsertImpulse1.frame_b, CollisionSpherePlane1.frame_b);
  connect(Fixed1.frame_b, InsertImpulse1.frame_a);
end BouncingBall;

MultiBondLib.Mechanics3DwithImpulses.Examples.CP1 MultiBondLib.Mechanics3DwithImpulses.Examples.CP1

modeling of mutual collisions

MultiBondLib.Mechanics3DwithImpulses.Examples.CP1

Information


Five freely flying bodies are colliding due to mutual gravitional attraction.

This example presents the collision pool. The collision pool is a tool to model all possible mutual collision between spherical objects in a generic manner.

Modelica definition

model CP1 "modeling of mutual collisions" 
            extends Modelica.Icons.Example;
  Interfaces.InsertImpulse InsertImpulse1(CPIndeces={2});
  Interfaces.InsertImpulse InsertImpulse2(CPIndeces={1});
  Parts.Body Body1(
    I_11=0.04,
    I_22=0.04,
    I_33=0.04,
    CPIndex=1,
    x_start={-1,0,0},
    sphereDiameter=0.2,
    GPIndex=1,
    v_start={0,0,0},
    m=1e10,
    reinitByImpulse=false,
    enforceStates=false,
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free);
  Parts.Body Body2(
    I_11=0.04,
    I_22=0.04,
    I_33=0.04,
    CPIndex=2,
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    sphereDiameter=0.2,
    GPIndex=2,
    x_start={1,1,0},
    m=1e10,
    reinitByImpulse=false,
    enforceStates=false);
  Interfaces.InsertImpulse InsertImpulse3(CPIndeces={3});
  Parts.Body Body3(
    I_11=0.04,
    I_22=0.04,
    I_33=0.04,
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    sphereDiameter=0.2,
    CPIndex=3,
    GPIndex=3,
    v_start={0,0,0},
    x_start={1.0,0.0,-0.5},
    m=1e10,
    reinitByImpulse=false);
  Interfaces.InsertImpulse InsertImpulse4(CPIndeces={4});
  Parts.Body Body4(
    I_11=0.04,
    I_22=0.04,
    I_33=0.04,
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    sphereDiameter=0.2,
    CPIndex=4,
    GPIndex=4,
    x_start={0,0,1},
    m=1e10,
    reinitByImpulse=false);
  Interfaces.InsertImpulse InsertImpulse5(CPIndeces={5});
  Parts.Body Body5(
    I_11=0.04,
    I_22=0.04,
    I_33=0.04,
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    sphereDiameter=0.2,
    v_start={0,0,0},
    CPIndex=5,
    GPIndex=5,
    x_start={0,-1,-0.8},
    m=1e10,
    reinitByImpulse=false);
  Joints.FreeTranslationalMovement FreeTranslationalMovement1(enforceStates=
        true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    x_start={-1,0,0});
  Joints.FreeTranslationalMovement FreeTranslationalMovement2(enforceStates=
        true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    x_start={1,1,0});
  Joints.FreeTranslationalMovement FreeTranslationalMovement3(enforceStates=
        true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    x_start={1.0,0.0,-0.5});
  Joints.FreeTranslationalMovement FreeTranslationalMovement4(enforceStates=
        true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    x_start={0,-0.2,0.8});
  Joints.FreeTranslationalMovement FreeTranslationalMovement5(enforceStates=
        true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    x_start={0,-1,-0.8});
  inner World3D world3D(
    g=0,
    gravityPoolSize=5);
  inner CollisionPool collisionPool(poolSize=5);
equation 
  connect(InsertImpulse2.frame_b, Body1.frame_a);
  connect(Body2.frame_a, InsertImpulse1.frame_b);
  connect(Body3.frame_a,InsertImpulse3. frame_b);
  connect(Body4.frame_a,InsertImpulse4. frame_b);
  connect(Body5.frame_a,InsertImpulse5. frame_b);
  connect(FreeTranslationalMovement1.frame_b, InsertImpulse2.frame_a);
  connect(FreeTranslationalMovement2.frame_b, InsertImpulse1.frame_a);
  connect(FreeTranslationalMovement3.frame_b, InsertImpulse3.frame_a);
  connect(FreeTranslationalMovement4.frame_b, InsertImpulse4.frame_a);
  connect(FreeTranslationalMovement5.frame_b, InsertImpulse5.frame_a);
end CP1;

MultiBondLib.Mechanics3DwithImpulses.Examples.CP2 MultiBondLib.Mechanics3DwithImpulses.Examples.CP2

modeling of mutual collisions

MultiBondLib.Mechanics3DwithImpulses.Examples.CP2

Information


Five freely flying bodies are colliding due to mutual gravitional attraction.

This example presents the collision pool. The collision pool is a tool to model all possible mutual collision between spherical objects in a generic manner. In constrast to the previous example, the rotation of the objects is modeled additionally.

Modelica definition

model CP2 "modeling of mutual collisions" 
            extends Modelica.Icons.Example;
  Interfaces.InsertImpulse InsertImpulse1(CPIndeces={2});
  Interfaces.InsertImpulse InsertImpulse2(CPIndeces={1});
  Parts.Body Body1(
    CPIndex=1,
    x_start={-1,0,0},
    sphereDiameter=0.2,
    GPIndex=1,
    v_start={0,0,0},
    m=1e10,
    reinitByImpulse=true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    useQuaternions=false,
    enforceStates=false,
    I_11=0.04e10,
    I_22=0.04e10,
    I_33=0.04e10);
  Parts.Body Body2(
    CPIndex=2,
    sphereDiameter=0.2,
    GPIndex=2,
    x_start={1,1,0},
    m=1e10,
    reinitByImpulse=true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    useQuaternions=false,
    enforceStates=false,
    I_11=0.04e10,
    I_22=0.04e10,
    I_33=0.04e10);
  Interfaces.InsertImpulse InsertImpulse3(CPIndeces={3});
  Parts.Body Body3(
    sphereDiameter=0.2,
    CPIndex=3,
    GPIndex=3,
    v_start={0,0,0},
    x_start={1.0,0.0,-0.5},
    m=1e10,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    reinitByImpulse=true,
    useQuaternions=false,
    enforceStates=false,
    I_11=0.04e10,
    I_22=0.04e10,
    I_33=0.04e10);
  Interfaces.InsertImpulse InsertImpulse4(CPIndeces={4});
  Parts.Body Body4(
    sphereDiameter=0.2,
    CPIndex=4,
    GPIndex=4,
    x_start={0,0,1},
    m=1e10,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    reinitByImpulse=true,
    useQuaternions=false,
    enforceStates=false,
    I_11=0.04e10,
    I_22=0.04e10,
    I_33=0.04e10);
  Interfaces.InsertImpulse InsertImpulse5(CPIndeces={5});
  Parts.Body Body5(
    sphereDiameter=0.2,
    v_start={0,0,0},
    CPIndex=5,
    GPIndex=5,
    x_start={0,-1,-0.8},
    m=1e10,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    reinitByImpulse=true,
    useQuaternions=false,
    enforceStates=false,
    I_11=0.04e10,
    I_22=0.04e10,
    I_33=0.04e10);
  inner World3D world3D(
    g=0,
    gravityPoolSize=5);
  inner CollisionPool collisionPool(poolSize=5);
equation 
  connect(InsertImpulse2.frame_b, Body1.frame_a);
  connect(Body2.frame_a, InsertImpulse1.frame_b);
  connect(Body3.frame_a,InsertImpulse3. frame_b);
  connect(Body4.frame_a,InsertImpulse4. frame_b);
  connect(Body5.frame_a,InsertImpulse5. frame_b);
end CP2;

MultiBondLib.Mechanics3DwithImpulses.Examples.PistonEngine MultiBondLib.Mechanics3DwithImpulses.Examples.PistonEngine

pendulum bouncing on the floor

MultiBondLib.Mechanics3DwithImpulses.Examples.PistonEngine

Information


This example presents a the model of a single piston engine. 
The powering explosions are modelled as force impulses.

This example demonstrates a planar loop and the usage of the EnergyInjection element.
This element contains a non-linear (quadratic) equation that leads to a large non-linear system.
The system can rapidly be solved through Newton-iteration.


Modelica definition

model PistonEngine "pendulum bouncing on the floor" 
            extends Modelica.Icons.Example;
  Parts.SimpleBody SimpleBody1(sphereDiameter=0.1,
    m=2,
    I_11=0.3,
    I_22=0.3,
    I_33=0.3);
  Interfaces.InsertImpulse InsertImpulse1;
  Parts.Fixed Fixed2(r={0,0.4,0});
  Joints.Revolute Revolute1(enforceStates=true,
    initType=Modelica.Mechanics.MultiBody.Types.Init.PositionVelocity,
    w_start=300);
  Parts.FixedTranslation FixedTranslation1(r={0.1,0,0}, width=0.04);
  Parts.Fixed Fixed1;
  Interfaces.InsertImpulse InsertImpulse2;
  inner CollisionPool collisionPool;
  Joints.Revolute Revolute2(enforceStates=false, reinitByImpulse=false);
  Joints.CutJoints.PlanarRevolute planarRevolute;
  Joints.Prismatic prismatic(
    n={0,1,0},
    enforceStates=false,
    reinitByImpulse=false);
  Parts.SimpleBody SimpleBody2(sphereDiameter=0.1,
    m=1,
    I_11=0.03,
    I_22=0.03,
    I_33=0.03);
  Parts.FixedTranslation FixedTranslation2(r={0,-0.25,0}, width=0.025);
  inner Mechanics3D.World3D world3D(g=0,
    animateGravity=false,
    axisShowLabels=false,
    axisLength=0.2,
    axisDiameter=0.01);
  Forces.Spring spring(s0=0.18, c=40,
    animation=false);
  Contacts.EnergyInjection energyInjection2_1(n={0,1,0}, E=2);
  
protected 
  Modelica.Blocks.Interfaces.BooleanOutput ignition;
  
initial equation 
  ignition = false;
  
equation 
  
algorithm 
  when ignition then
    ignition := false;
  end when;
  
  when prismatic.s > 0.07 then
    ignition :=true;
  end when;
  
equation 
  
  connect(FixedTranslation1.frame_a, Revolute1.frame_b);
  connect(InsertImpulse2.frame_b, Fixed1.frame_b);
  connect(SimpleBody1.frame_a, FixedTranslation1.frame_a);
  connect(prismatic.frame_a, InsertImpulse2.frame_a);
  connect(InsertImpulse1.frame_a, Fixed2.frame_b);
  connect(InsertImpulse1.frame_b, Revolute1.frame_a);
  connect(SimpleBody2.frame_a, prismatic.frame_b);
  connect(planarRevolute.frame_a, prismatic.frame_b);
  connect(Revolute2.frame_a, FixedTranslation1.frame_b);
  connect(Revolute2.frame_b, FixedTranslation2.frame_a);
  connect(FixedTranslation2.frame_b, planarRevolute.frame_b);
  connect(energyInjection2_1.frame_a, SimpleBody2.frame_a);
  connect(ignition, InsertImpulse1.u);
  connect(ignition, InsertImpulse2.u);
  
  connect(SimpleBody2.frame_a, spring.frame_a);
  connect(energyInjection2_1.u, ignition);
  connect(Fixed1.frame_b, spring.frame_b);
end PistonEngine;

HTML-documentation generated by Dymola Thu Aug 31 09:48:09 2006.