MultiBondLib.Mechanics3D.RollingObjects

part and joint elements of ideal rolling wheels and marbles

MultiBondLib.Mechanics3D.RollingObjects.WheelJoint MultiBondLib.Mechanics3D.RollingObjects.MarbleJoint MultiBondLib.Mechanics3D.RollingObjects.Wheel MultiBondLib.Mechanics3D.RollingObjects.Marble

Information


This package contains models of ideal rolling marbles and wheels.

The models exist in two variants: as complete models or as rudimental joint models.

The complete models, represent the wheel or marble as complete object with mass and potential movement joints. They also contain all parameters for initialization.

The rudimental joint models just model the movement constraints of the ideal rolling. They have to be connected to body and joint models.

NameDescription
WheelJoint models the joint characteristics of a wheel
MarbleJoint models the joint characteristics of a marble
Wheel complete model of a wheel
Marble complete model of a marble


MultiBondLib.Mechanics3D.RollingObjects.WheelJoint MultiBondLib.Mechanics3D.RollingObjects.WheelJoint

models the joint characteristics of a wheel

MultiBondLib.Mechanics3D.RollingObjects.WheelJoint

Information


This component models the movement constraints for an ideal rolling wheel.

General parameter

The radius of the wheel can be defined by the parameter r.

The rolling plane can be specified by the vector n (pointing upwards) and the distance of the plane from the origin d.

The parameter animation toggles the visualization

Visualization

A full animation of the wheel is supported. Color and basic geometry can be changed by the corresponding parameters.

Remarks

Ideal rolling establishes one holonomic constraint and two non-holonomic constraints. A freely rolling wheel therefore has 3 degrees of freedom on the level of velocity on five degrees of freedom on the level of position.

Parameters

NameDefaultDescription
animationtrueanimate wheel
r1radius of wheel [m]
n[3]{0,1,0}vector normal to rolling plane, pointing upwards
d0distance of rolling plane o origin [m]
Animation
rRim0.9*r radius of rim [m]
wWheel0.1*r width of the wheel [m]
tireColor{64,64,64} Color of the tire
rodColor{128,0,0} Color of the rods
contactColor{128,128,128} Color of the contactpoint

Modelica definition

model WheelJoint "models the joint characteristics of a wheel" 
  import SI = Modelica.SIunits;
  import MB = Modelica.Mechanics.MultiBody;
  
  parameter Boolean animation = true "animate wheel";
  
  parameter SI.Radius r=1 "radius of wheel";
  parameter Real n[3] = {0,1,0} 
    "vector normal to rolling plane, pointing upwards";
  parameter SI.Distance d=0 "distance of rolling plane o origin";
  
  parameter SI.Radius rRim = 0.9*r "|Animation|| radius of rim";
  parameter SI.Diameter wWheel = 0.1*r "|Animation|| width of the wheel";
  parameter MB.Types.Color tireColor= {64,64,64} 
    "|Animation|| Color of the tire";
  parameter MB.Types.Color rodColor= {128,0,0} "|Animation|| Color of the rods";
  parameter MB.Types.Color contactColor= {128,128,128} 
    "|Animation|| Color of the contactpoint";
  
  final parameter Real eN[3] = n/sqrt(n*n) "normalization of n";
  final parameter Real notN[3] = if abs(eN[1]) > 0.1 then {0,1,0} else (if abs(eN[2])
       > 0.1 then {0,0,1} else {1,0,0}) 
    "Arbitrary vector that is not aligned with eN";
  final parameter Real vec_a[3] = cross(eN,notN) "vector in rolling plane";
  final parameter Real eA[3] = {1,0,0} "normalized vector in rolling plane";
  final parameter Real eB[3] = cross(eA,eN) 
    "normalized vector in rolling plane orthogonal to eA";
  
  SI.AngularVelocity w[3] "angular velocity";
  SI.AngularAcceleration z[3] "angular acceleration";
  
  SI.Position x[3] "Position of the frame";
  SI.Velocity v[3] "Velocity";
  SI.Acceleration a[3] "Acceleration";
  
  Real d_cp[3] 
    "vector pointing in direction of the contact point from wheel center res. in inertial frame";
  
  SI.Force fN;
  
protected 
  Real eAxis[3] "unit vector aligned to wheel Axis in inertial frame";
  SI.Position r_cp[3] 
    "Vector from wheel center to contact point res. in inertial frame";
  
public 
  Interfaces.Frame_b frame_b;
  
protected 
  Interfaces.MBG2Mech MBG2Mech1;
  inner Defaults MBG_defaults(n=3);
  Junctions.J0 J0_1;
  Bonds.MultiBond MultiBond2;
  Bonds.MultiBond MultiBond5;
  Bonds.MultiBond MultiBond13;
  Bonds.MultiBond MultiBond14;
  Bonds.Utilities.MultiBondTail MultiBondTail2;
  Bonds.Utilities.MultiBondTail MultiBondTail3;
  Bonds.Utilities.MultiBondTail MultiBondTail4;
  Passive.mTF_effort mTF_effort1;
  
protected 
  outer World3D world3D;
  
 parameter Integer ndim=if world3D.enableAnimation and animation then 1 else 0;
MB.Visualizers.Advanced.Shape tirePipe[ndim](
    each shapeType="pipe",
    each color=tireColor,
    each length= wWheel,
    each width=2*r,
    each height=2*r,
    each lengthDirection={0,0,1},
    each widthDirection={0,1,0},
    each extra=rRim/r,
    each r_shape=-{0,0,1}*(2*r/40),
    each r=MBG2Mech1.x,
    each R=MB.Frames.Orientation(T=MBG2Mech1.R,w=zeros(3)));
  
MB.Visualizers.Advanced.Shape cylindery[ndim](
    each shapeType="cylinder",
    each color=rodColor,
    each length= 2*rRim,
    each width=wWheel,
    each height=wWheel,
    each lengthDirection={0,1,0},
    each widthDirection={0,0,1},
    each r_shape=-{0,1,0}*rRim,
    each r=MBG2Mech1.x,
    each R=MB.Frames.Orientation(T=MBG2Mech1.R,w=zeros(3)));
  
MB.Visualizers.Advanced.Shape cylinderx[ndim](
    each shapeType="cylinder",
    each color=rodColor,
    each length= 2*rRim,
    each width=wWheel,
    each height=wWheel,
    each lengthDirection={1,0,0},
    each widthDirection={0,0,1},
    each r_shape=-{1,0,0}*rRim,
    each r=MBG2Mech1.x,
    each R=MB.Frames.Orientation(T=MBG2Mech1.R,w=zeros(3)));
  
MB.Visualizers.Advanced.Shape cylinderxy[ndim](
    each shapeType="cylinder",
    each color=rodColor,
    each length= 2*rRim,
    each width=wWheel,
    each height=wWheel,
    each lengthDirection={1,1,0},
    each widthDirection={0,0,1},
    each r_shape=-{0.706,0.706,0}*rRim,
    each r=MBG2Mech1.x,
    each R=MB.Frames.Orientation(T=MBG2Mech1.R,w=zeros(3)));
  
MB.Visualizers.Advanced.Shape cylinderyx[ndim](
    each shapeType="cylinder",
    each color=rodColor,
    each length= 2*rRim,
    each width=wWheel,
    each height=wWheel,
    each lengthDirection={1,-1,0},
    each widthDirection={0,0,1},
    each r_shape=-{0.706,-0.706,0}*rRim,
    each r=MBG2Mech1.x,
    each R=MB.Frames.Orientation(T=MBG2Mech1.R,w=zeros(3)));
  
MB.Visualizers.Advanced.Shape contactPoint[ndim](
    each shapeType="cylinder",
    each color=contactColor,
    each length= r/20,
    each width=wWheel*3,
    each height=wWheel*3,
    each lengthDirection=eN,
    each widthDirection=eA,
    each r=MBG2Mech1.x,
    each r_shape=r_cp,
    each specularCoefficient = 0.1);
  
  
  Bonds.MultiBond MultiBond3;
  AdditionalMBG.translational_mTF2 translational_mTF2_1;
  Sources.Sf Sf1(f0={0});
  Bonds.Utilities.MultiBondTail MultiBondTail5;
  Bonds.MultiBond MultiBond4(n=1);
  Bonds.MultiBond MultiBond6;
public 
  Sources.mSe mSe1(n=1);
  
  Passive.TF2_effort projectiveTF(
    nA=3,
    nB=1,
    M={eN});
equation 
//  defineRoot(frame_b.P);
  
  w = MBG2Mech1.MultiBondConRot.f;
  z = der(w);
  
  x = MBG2Mech1.x;
  v = MBG2Mech1.MultiBondConTrans.f;
  a = der(v);
  
// holonomic constraint
  x*eN  = (d - r_cp*eN);
    fN = mSe1.s[1];
  
// contact point computation
  eAxis = transpose(MBG2Mech1.R)*{0,0,1};
  d_cp = (-eN) - ((-eN)*eAxis)*eAxis;
  r_cp = r* d_cp/sqrt(d_cp*d_cp);
  translational_mTF2_1.r = r_cp;
  
  connect(MBG2Mech1.frame_b,frame_b);
  connect(MultiBond2.MultiBondCon2, MBG2Mech1.MultiBondConTrans);
  connect(MultiBond13.MultiBondCon1, J0_1.MultiBondCon3);
  connect(mTF_effort1.MultiBondCon2, MultiBond5.MultiBondCon1);
  connect(mTF_effort1.MultiBondCon1, MultiBond14.MultiBondCon2);
  connect(MultiBond3.MultiBondCon2, J0_1.MultiBondCon1);
  connect(translational_mTF2_1.MultiBondCon1, MultiBond14.MultiBondCon1);
  connect(translational_mTF2_1.MultiBondCon2, MultiBond13.MultiBondCon2);
  connect(Sf1.MultiBondCon1, MultiBond3.MultiBondCon1);
  connect(mTF_effort1.M, MBG2Mech1.R);
  connect(MultiBond5.MultiBondCon2, MBG2Mech1.MultiBondConRot);
  connect(MultiBond2.MultiBondCon1, J0_1.MultiBondCon2);
  connect(MultiBond6.MultiBondCon2, J0_1.MultiBondCon4);
  connect(mSe1.MultiBondCon1, MultiBond4.MultiBondCon1);
  connect(projectiveTF.MultiBondConB, MultiBond4.MultiBondCon2);
  connect(projectiveTF.MultiBondConA, MultiBond6.MultiBondCon1);
end WheelJoint;

MultiBondLib.Mechanics3D.RollingObjects.MarbleJoint MultiBondLib.Mechanics3D.RollingObjects.MarbleJoint

models the joint characteristics of a marble

MultiBondLib.Mechanics3D.RollingObjects.MarbleJoint

Information


This component models the movement constraints for an ideal rolling marble.

General parameter

The radius of the marble can be defined by the parameter r.

The rolling plane can be specified by the vector n (pointing upwards) and the distance of the plane from the origin d.

The parameter animation toggles the visualization

Visualization

The element is visualized by a blue sphere with magenta stripes.

Remarks

Ideal rolling establishes one holonomic constraint and two non-holonomic constraints. A freely rolling marble therefore has 3 degrees of freedom on the level of velocity on five degrees of freedom on the level of position.

Parameters

NameDefaultDescription
animationtrueanimate marble
r1radius of marble [m]
n[3]{0,1,0}vector normal to rolling plane, pointing upwards
d0distance of rolling plane o origin [m]

Modelica definition

model MarbleJoint "models the joint characteristics of a marble" 
  import SI = Modelica.SIunits;
  import MB = Modelica.Mechanics.MultiBody;
  
  parameter Boolean animation = true "animate marble";
  
  parameter SI.Radius r=1 "radius of marble";
  parameter Real n[3] = {0,1,0} 
    "vector normal to rolling plane, pointing upwards";
  parameter SI.Distance d=0 "distance of rolling plane o origin";
  
  final parameter Real eN[3] = n/sqrt(n*n) "normalization of n";
  final parameter Real notN[3] = if abs(eN[1]) > 0.1 then {0,1,0} else (if abs(eN[2])
       > 0.1 then {0,0,1} else {1,0,0}) 
    "Arbitrary vector that is not aligned with eN";
  final parameter Real vec_a[3] = cross(eN,notN) "vector in rolling plane";
  final parameter Real eA[3] = {1,0,0} "normalized vector in rolling plane";
  final parameter Real eB[3] = cross(eA,eN) 
    "normalized vector in rolling plane orthogonal to eA";
  
  SI.AngularVelocity w[3] "angular velocity";
  SI.AngularAcceleration z[3] "angular acceleration";
  
  SI.Position x[3] "Position of the frame";
  SI.Velocity v[3] "Velocity";
  SI.Acceleration a[3] "Acceleration";
  
  SI.Force fN;
  
public 
  Interfaces.Frame_b frame_b;
  
protected 
  Interfaces.MBG2Mech MBG2Mech1;
  inner Defaults MBG_defaults(n=3);
  Junctions.J0 J0_1;
  Bonds.MultiBond MultiBond2;
  Bonds.MultiBond MultiBond5;
  Bonds.MultiBond MultiBond13;
  Bonds.MultiBond MultiBond14;
  Bonds.Utilities.MultiBondTail MultiBondTail2;
  Bonds.Utilities.MultiBondTail MultiBondTail3;
  Bonds.Utilities.MultiBondTail MultiBondTail4;
  Passive.mTF_effort mTF_effort1;
  
protected 
  outer World3D world3D;
  
 parameter Integer ndim=if world3D.enableAnimation and animation then 1 else 0;
  
MB.Visualizers.Advanced.Shape cylinderz[ndim](
    each shapeType="cylinder",
    each color={192,0,192},
    each length= 2*r/10,
    each width=2*r,
    each height=2*r,
    each lengthDirection={0,0,1},
    each widthDirection={0,1,0},
    each r_shape=-{0,0,1}*(2*r/20),
    each r=MBG2Mech1.x,
    each R=MB.Frames.Orientation(T=MBG2Mech1.R,w=zeros(3)));
  
MB.Visualizers.Advanced.Shape cylindery[ndim](
    each shapeType="cylinder",
    each color={192,0,192},
    each length= 2*r/10,
    each width=2*r,
    each height=2*r,
    each lengthDirection={0,1,0},
    each widthDirection={0,0,1},
    each r_shape=-{0,1,0}*(2*r/20),
    each r=MBG2Mech1.x,
    each R=MB.Frames.Orientation(T=MBG2Mech1.R,w=zeros(3)));
  
MB.Visualizers.Advanced.Shape cylinderx[ndim](
    each shapeType="cylinder",
    each color={192,0,192},
    each length= 2*r/10,
    each width=2*r,
    each height=2*r,
    each lengthDirection={1,0,0},
    each widthDirection={0,1,0},
    each r_shape=-{1,0,0}*(2*r/20),
    each r=MBG2Mech1.x,
    each R=MB.Frames.Orientation(T=MBG2Mech1.R,w=zeros(3)));
  
  MB.Visualizers.Advanced.Shape sphere[ndim](
    each shapeType="sphere",
    each color={0,0,255},
    each length=1.8*r,
    each width=1.8*r,
    each height=1.8*r,
    each lengthDirection={1,0,0},
    each widthDirection={0,1,0},
    each r_shape=-{1,0,0}*1.8*r/2,
    each r=MBG2Mech1.x,
    each R=MB.Frames.Orientation(T=MBG2Mech1.R,w=zeros(3)));
  
  
  Bonds.MultiBond MultiBond3;
  Sources.Sf Sf1(f0={0});
  Bonds.Utilities.MultiBondTail MultiBondTail5;
  Bonds.MultiBond MultiBond4(n=1);
  Bonds.MultiBond MultiBond6;
public 
  Sources.mSe mSe1(n=1);
protected 
  AdditionalMBG.translationalTF translationalTF1(r=-r*eN);
  
public 
  Passive.TF2_effort projectiveTF(
    nA=3,
    nB=1,
    M={eN});
equation 
  w = MBG2Mech1.MultiBondConRot.f;
  z = der(w);
  
  x = MBG2Mech1.x;
  v = MBG2Mech1.MultiBondConTrans.f;
  a = der(v);
  
// holonomic constraint
  -x*eN  = (d - r);
    fN = mSe1.s[1];
  
  connect(MBG2Mech1.frame_b,frame_b);
  connect(MultiBond2.MultiBondCon2, MBG2Mech1.MultiBondConTrans);
  connect(MultiBond13.MultiBondCon1, J0_1.MultiBondCon3);
  connect(mTF_effort1.MultiBondCon2, MultiBond5.MultiBondCon1);
  connect(mTF_effort1.MultiBondCon1, MultiBond14.MultiBondCon2);
  connect(MultiBond3.MultiBondCon2, J0_1.MultiBondCon1);
  connect(Sf1.MultiBondCon1, MultiBond3.MultiBondCon1);
  connect(mTF_effort1.M, MBG2Mech1.R);
  connect(MultiBond5.MultiBondCon2, MBG2Mech1.MultiBondConRot);
  connect(MultiBond2.MultiBondCon1, J0_1.MultiBondCon2);
  connect(MultiBond6.MultiBondCon2, J0_1.MultiBondCon4);
  connect(mSe1.MultiBondCon1, MultiBond4.MultiBondCon1);
  connect(translationalTF1.MultiBondCon1, MultiBond14.MultiBondCon1);
  connect(translationalTF1.MultiBondCon2, MultiBond13.MultiBondCon2);
  connect(projectiveTF.MultiBondConB, MultiBond4.MultiBondCon2);
  connect(projectiveTF.MultiBondConA, MultiBond6.MultiBondCon1);
end MarbleJoint;

MultiBondLib.Mechanics3D.RollingObjects.Wheel MultiBondLib.Mechanics3D.RollingObjects.Wheel

complete model of a wheel

MultiBondLib.Mechanics3D.RollingObjects.Wheel

Information


This is the model of a wheel.
The movement of the wheel is restricted to be ideally rolling on a straight plane.
The model is composed out of the corresponding rudimental joint model and the body model.

General parameter

The mass of the wheel can be specified by the parameter m.

The inertia tensor of the wheel is a symmetric 3x3 matrix and can be specified by the parameters I11, I12, ...

The radius of the wheel can be defined by the parameter r.

The rolling plane can be specified by the vector n (pointing upwards) and the distance of the plane from the origin d.

The parameter animation toggles the visualization

Initialization

In general, you can specify... Which of these variables do effectively appear in the inital equations can be defined by the parameter initType and useTransVelocity.

The ideal rolling restricts the wheel's position on the plane and the statement of the initial position is overdetermined. Therefore the initial position is automatically projected on the rolling plane.

The ideal rolling restricts the wheel's movement. The initial velocities and angular velocities form an overdetermined initial statement.
By the activation of useTransVelocity, all velocities are defined by the translational movement on the plane and the rotation around the plane's normal vector. Otherwise all initial angular velocities are taken to define the initial movement.

Visualization

A full animation of the wheel is supported. Color and basic geometry can be changed by the corresponding parameters.

Advanced settings

The activation of enforceStates enforces the model to explicitely define integrators. This parameter is useful to choose the state variables in a kinematic loop.

The orientation can either be expressed by the three cardan angles or by quaternions.

Which of these two variants is used, can be specified by the parameter useQuaternions.


Parameters

NameDefaultDescription
animationtrueanimate wheel
r1radius of wheel [m]
n[3]{0,1,0}vector normal to rolling plane, pointing upwards
d0distance of rolling plane o origin [m]
m1mass of body [kg]
Inertia tensor (resolved in center of mass, parallel to frame_a)
I_110.001 (1,1) element of inertia tensor [kg.m2]
I_220.001 (2,2) element of inertia tensor [kg.m2]
I_330.001 (3,3) element of inertia tensor [kg.m2]
I_210 (2,1) element of inertia tensor [kg.m2]
I_310 (3,1) element of inertia tensor [kg.m2]
I_320 (3,2) element of inertia tensor [kg.m2]
Initialization
initTypeMB.Types.Init.Free Type of initialization (defines usage of start values below)
useTransVelocitiesfalse use the translational velocities (defines usage of start values below)
phi_start[3]{0,0,0}initial cardan angles in degree [deg]
w_start[3]{0,0,0}initial angular velocity in deg/s [deg/s]
z_start[3]{0,0,0}initial angular acceleration in deg/s2 [deg/s2]
x_start[3]{0,0,0}initial position [m]
v_start[3]{0,0,0}initial velocity [m/s]
a_start[3]{0,0,0}initial acceleration [m/s2]
Animation
rRim0.9*r radius of rim [m]
wWheel0.1*r width of the wheel [m]
tireColor{64,64,64} Color of the tire
rodColor{128,0,0} Color of the rods
contactColor{128,128,128} Color of the contactpoint
Advanced
enforceStatesfalseenforce Quaternions or cardan angles and w as states
useQuaternionsfalseuse Quaternions instead of cardan angles

Modelica definition

model Wheel "complete model of a wheel" 
  import SI = Modelica.SIunits;
  import MB = Modelica.Mechanics.MultiBody;
  import Cv = Modelica.SIunits.Conversions;
  
  parameter Boolean animation = true "animate wheel";
  
  parameter SI.Radius r=1 "radius of wheel";
  parameter Real n[3] = {0,1,0} 
    "vector normal to rolling plane, pointing upwards";
  parameter SI.Distance d=0 "distance of rolling plane o origin";
  
  parameter SI.Mass m = 1 "mass of body";
  
  parameter SI.Inertia I_11=0.001 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (1,1) element of inertia tensor";
  parameter SI.Inertia I_22=0.001 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (2,2) element of inertia tensor";
  parameter SI.Inertia I_33=0.001 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (3,3) element of inertia tensor";
  parameter SI.Inertia I_21=0 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (2,1) element of inertia tensor";
  parameter SI.Inertia I_31=0 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (3,1) element of inertia tensor";
  parameter SI.Inertia I_32=0 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (3,2) element of inertia tensor";
  final parameter SI.Inertia Inert[3, 3]=[I_11, I_21, I_31; I_21, I_22, I_32;
      I_31, I_32, I_33] "inertia tensor";
  
  parameter MB.Types.Init.Temp initType=MB.Types.Init.Free 
    "|Initialization|| Type of initialization (defines usage of start values below)";
  parameter Boolean useTransVelocities = false 
    "|Initialization|| use the translational velocities (defines usage of start values below)";
  parameter Cv.NonSIunits.Angle_deg phi_start[3] = {0,0,0} 
    "|Initialization||initial cardan angles in degree";
  parameter Types.AngularVelocity_deg w_start[3] = {0,0,0} 
    "|Initialization||initial angular velocity in deg/s";
  parameter Types.AngularAcceleration_deg z_start[3] = {0,0,0} 
    "|Initialization||initial angular acceleration in deg/s2";
  parameter SI.Position x_start[3] = {0,0,0} 
    "|Initialization||initial position";
  parameter SI.Velocity v_start[3] = {0,0,0} 
    "|Initialization||initial velocity";
  parameter SI.Acceleration a_start[3] = {0,0,0} 
    "|Initialization||initial acceleration";
  
  final parameter SI.Angle phi_start_rad[3] = Cv.from_deg(phi_start) 
    "initial cardan angles";
  final parameter SI.AngularVelocity w_start_rad[3] = Cv.from_deg(w_start) 
    "initial angular velocity";
  final parameter SI.AngularAcceleration z_start_rad[3] = Cv.from_deg(z_start) 
    "initial angular acceleration";
  
  parameter SI.Radius rRim = 0.9*r "|Animation|| radius of rim";
  parameter SI.Diameter wWheel = 0.1*r "|Animation|| width of the wheel";
  parameter MB.Types.Color tireColor= {64,64,64} 
    "|Animation|| Color of the tire";
  parameter MB.Types.Color rodColor= {128,0,0} "|Animation|| Color of the rods";
  parameter MB.Types.Color contactColor= {128,128,128} 
    "|Animation|| Color of the contactpoint";
  
  parameter Boolean enforceStates =  false 
    "|Advanced||enforce Quaternions or cardan angles and w as states";
  parameter Boolean useQuaternions =  false 
    "|Advanced||use Quaternions instead of cardan angles";
  final parameter Types.RotationSequence sequence_angles = {2,1,3} 
    "|Advanced||sequence of the cardan angles";
  final parameter Types.Quaternion Q_start = Utilities.AxesRotQ(phi_start_rad,sequence_angles);
  
  SI.Position xA(stateSelect=if enforceStates then StateSelect.always else StateSelect.prefer) 
    "Position in direction of eA";
  
  SI.Position xB(stateSelect=if enforceStates then StateSelect.always else StateSelect.prefer) 
    "Position in direction of eB";
  
  SI.Position x[3] "Position of the frame";
  SI.Velocity v[3] "Velocity";
  
  Types.Quaternion Q(stateSelect=if useQuaternions then StateSelect.prefer else StateSelect.never,start = Q_start, fixed = false) 
    "quaternions";
  SI.Angle phi[3](stateSelect=if not useQuaternions then (if enforceStates then 
                  StateSelect.always else StateSelect.prefer) else  StateSelect.never) 
    "cardan angles";
  SI.Angle phi_d[3](stateSelect=if not useQuaternions then (if enforceStates then 
                  StateSelect.always else StateSelect.prefer) else  StateSelect.never) 
    "cardan angles derivatives";
  SI.AngularVelocity w[3](stateSelect=if useQuaternions then (if enforceStates then 
                  StateSelect.always else StateSelect.prefer) else  StateSelect.default) 
    "angular velocity";
  
  SI.Acceleration a[3] "Acceleration";
  SI.AngularAcceleration z[3] "angular acceleration";
  
public 
  Interfaces.Frame_b frame_b;
  WheelJoint WheelJoint1(
    animation=animation,
    r=r,
    n=n,
    d=d,
    rRim=rRim,
    wWheel=wWheel,
    tireColor=tireColor,
    rodColor=rodColor,
    contactColor=contactColor);
  Parts.Body WheelBody(
    animation=false,
    m=m,
    I_11=I_11,
    I_22=I_22,
    I_33=I_33,
    I_21=I_21,
    I_31=I_31,
    I_32=I_32,
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    enforceStates=false,
    useQuaternions=useQuaternions,
    sequence_angles={2,1,3});
initial equation 
  if initType == MB.Types.Init.Position or initType == MB.Types.Init.
      PositionVelocity or initType == MB.Types.Init.PositionVelocityAcceleration then
    // Initialize positional variables
    xA = x_start*WheelJoint1.eA;
    xB = x_start*WheelJoint1.eB;
    if useQuaternions then
      Q[1:3] = Q_start[1:3];
    else
      phi = phi_start_rad;
    end if;
  end if;
  
  if initType == MB.Types.Init.PositionVelocity or initType == MB.Types.Init.
      PositionVelocityAcceleration or initType == MB.Types.Init.Velocity or 
      initType == MB.Types.Init.VelocityAcceleration then
    // Initialize velocity variables
    if useTransVelocities then
      v*WheelJoint1.eA = v_start*WheelJoint1.eA;
      v*WheelJoint1.eB = v_start*WheelJoint1.eB;
      w*WheelJoint1.eN = w_start_rad*WheelJoint1.eN;
    else
      w = w_start_rad;
    end if;
  end if;
  
  if initType == MB.Types.Init.VelocityAcceleration or initType == MB.Types.Init.
      PositionVelocityAcceleration then
    // Initialize acceleration variables
    if useTransVelocities then
      a*WheelJoint1.eA = a_start*WheelJoint1.eA;
      a*WheelJoint1.eB = a_start*WheelJoint1.eB;
      z*WheelJoint1.eN = z_start_rad*WheelJoint1.eN;
    else
      z = z_start_rad;
    end if;
  end if;
  
  if initType == MB.Types.Init.SteadyState then
    w = zeros(3);
    z = zeros(3);
  end if;
  
equation 
  x = WheelBody.PotentialFBM1.x;
  v = WheelBody.PotentialFBM1.v;
  a = WheelBody.PotentialFBM1.a;
  phi = WheelBody.PotentialFBM1.phi;
  phi_d = WheelBody.PotentialFBM1.phi_d;
  Q = WheelBody.PotentialFBM1.Q;
  w = WheelBody.PotentialFBM1.w;
  z = WheelBody.PotentialFBM1.z;
  
  xA = x*WheelJoint1.eA;
  xB = x*WheelJoint1.eB;
  
  connect(WheelBody.frame_a, frame_b);
  connect(WheelJoint1.frame_b, frame_b);
end Wheel;

MultiBondLib.Mechanics3D.RollingObjects.Marble MultiBondLib.Mechanics3D.RollingObjects.Marble

complete model of a marble

MultiBondLib.Mechanics3D.RollingObjects.Marble

Information


This is the model of a marble.
The movement of the marble is restricted to be ideally rolling on a straight plane.
The model is composed out of the corresponding rudimental joint model and the body model.

General parameter

The mass of the marble can be specified by the parameter m.

The inertia tensor of the marble is a symmetric 3x3 matrix and can be specified by the parameters I11, I12, ...

The radius of the marble can be defined by the parameter r.

The rolling plane can be specified by the vector n (pointing upwards) and the distance of the plane from the origin d.

The parameter animation toggles the visualization

Initialization

In general, you can specify... Which of these variables do effectively appear in the inital equations can be defined by the parameter initType and useTransVelocity.

The ideal rolling restricts the marble's position on the plane and the statement of the initial position is overdetermined. Therefore the initial position is automatically projected on the rolling plane.

The ideal rolling restricts the marble's movement. The initial velocities and angular velocities form an overdetermined initial statement.
By the activation of useTransVelocity, all velocities are defined by the translational movement on the plane and the rotation around the plane's normal vector. Otherwise all initial angular velocities are taken to define the initial movement.

Visualization

The element is visualized by a blue sphere with magenta stripes.

Advanced settings

The activation of enforceStates enforces the model to explicitely define integrators. This parameter is useful to choose the state variables in a kinematic loop.

The orientation can either be expressed by the three cardan angles or by quaternions.

Which of these two variants is used, can be specified by the parameter useQuaternions.


Parameters

NameDefaultDescription
animationtrueanimate marble
r1radius of wheel [m]
n[3]{0,1,0}vector normal to rolling plane, pointing upwards
d0distance of rolling plane o origin [m]
m1mass of body [kg]
Inertia tensor (resolved in center of mass, parallel to frame_a)
I_110.001 (1,1) element of inertia tensor [kg.m2]
I_220.001 (2,2) element of inertia tensor [kg.m2]
I_330.001 (3,3) element of inertia tensor [kg.m2]
I_210 (2,1) element of inertia tensor [kg.m2]
I_310 (3,1) element of inertia tensor [kg.m2]
I_320 (3,2) element of inertia tensor [kg.m2]
Initialization
initTypeMB.Types.Init.Free Type of initialization (defines usage of start values below)
useTransVelocitiesfalse use the translational velocities (defines usage of start values below)
phi_start[3]{0,0,0}initial cardan angles in degree [deg]
w_start[3]{0,0,0}initial angular velocity in deg/s [deg/s]
z_start[3]{0,0,0}initial angular acceleration in deg/s2 [deg/s2]
x_start[3]{0,0,0}initial position [m]
v_start[3]{0,0,0}initial velocity [m/s]
a_start[3]{0,0,0}initial acceleration [m/s2]
Advanced
enforceStatesfalseenforce Quaternions or cardan angles and w as states
useQuaternionsfalseuse Quaternions instead of cardan angles

Modelica definition

model Marble "complete model of a marble" 
  import SI = Modelica.SIunits;
  import MB = Modelica.Mechanics.MultiBody;
  import Cv = Modelica.SIunits.Conversions;
  
  parameter Boolean animation = true "animate marble";
  
  parameter SI.Radius r=1 "radius of wheel";
  parameter Real n[3] = {0,1,0} 
    "vector normal to rolling plane, pointing upwards";
  parameter SI.Distance d=0 "distance of rolling plane o origin";
  
  parameter SI.Mass m = 1 "mass of body";
  
  parameter SI.Inertia I_11=0.001 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (1,1) element of inertia tensor";
  parameter SI.Inertia I_22=0.001 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (2,2) element of inertia tensor";
  parameter SI.Inertia I_33=0.001 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (3,3) element of inertia tensor";
  parameter SI.Inertia I_21=0 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (2,1) element of inertia tensor";
  parameter SI.Inertia I_31=0 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (3,1) element of inertia tensor";
  parameter SI.Inertia I_32=0 
    "|Inertia tensor (resolved in center of mass, parallel to frame_a)| (3,2) element of inertia tensor";
  final parameter SI.Inertia Inert[3, 3]=[I_11, I_21, I_31; I_21, I_22, I_32;
      I_31, I_32, I_33] "inertia tensor";
  
  parameter MB.Types.Init.Temp initType=MB.Types.Init.Free 
    "|Initialization|| Type of initialization (defines usage of start values below)";
  parameter Boolean useTransVelocities = false 
    "|Initialization|| use the translational velocities (defines usage of start values below)";
  parameter Cv.NonSIunits.Angle_deg phi_start[3] = {0,0,0} 
    "|Initialization||initial cardan angles in degree";
  parameter Types.AngularVelocity_deg w_start[3] = {0,0,0} 
    "|Initialization||initial angular velocity in deg/s";
  parameter Types.AngularAcceleration_deg z_start[3] = {0,0,0} 
    "|Initialization||initial angular acceleration in deg/s2";
  parameter SI.Position x_start[3] = {0,0,0} 
    "|Initialization||initial position";
  parameter SI.Velocity v_start[3] = {0,0,0} 
    "|Initialization||initial velocity";
  parameter SI.Acceleration a_start[3] = {0,0,0} 
    "|Initialization||initial acceleration";
  
  final parameter SI.Angle phi_start_rad[3] = Cv.from_deg(phi_start) 
    "initial cardan angles";
  final parameter SI.AngularVelocity w_start_rad[3] = Cv.from_deg(w_start) 
    "initial angular velocity";
  final parameter SI.AngularAcceleration z_start_rad[3] = Cv.from_deg(z_start) 
    "initial angular acceleration";
  
  parameter Boolean enforceStates =  false 
    "|Advanced||enforce Quaternions or cardan angles and w as states";
  parameter Boolean useQuaternions =  false 
    "|Advanced||use Quaternions instead of cardan angles";
  final parameter Types.RotationSequence sequence_angles = {2,1,3} 
    "|Advanced||sequence of the cardan angles";
  final parameter Types.Quaternion Q_start = Utilities.AxesRotQ(phi_start_rad,sequence_angles);
  
  SI.Position xA(stateSelect=if enforceStates then StateSelect.always else StateSelect.prefer) 
    "Position in direction of eA";
  
  SI.Position xB(stateSelect=if enforceStates then StateSelect.always else StateSelect.prefer) 
    "Position in direction of eB";
  
  SI.Position x[3] "Position of the frame";
  SI.Velocity v[3] "Velocity";
  
  Types.Quaternion Q(stateSelect=if useQuaternions then StateSelect.prefer else StateSelect.never,start = Q_start, fixed = false) 
    "quaternions";
  SI.Angle phi[3](stateSelect=if not useQuaternions then (if enforceStates then 
                  StateSelect.always else StateSelect.prefer) else  StateSelect.never) 
    "cardan angles";
  SI.Angle phi_d[3](stateSelect=if not useQuaternions then (if enforceStates then 
                  StateSelect.always else StateSelect.prefer) else  StateSelect.never) 
    "cardan angles derivatives";
  SI.AngularVelocity w[3](stateSelect=if useQuaternions then (if enforceStates then 
                  StateSelect.always else StateSelect.prefer) else  StateSelect.default) 
    "angular velocity";
  
  SI.Acceleration a[3] "Acceleration";
  SI.AngularAcceleration z[3] "angular acceleration";
  
public 
  Interfaces.Frame_b frame_b;
  Parts.Body WheelBody(
    animation=false,
    m=m,
    I_11=I_11,
    I_22=I_22,
    I_33=I_33,
    I_21=I_21,
    I_31=I_31,
    I_32=I_32,
    initType=Modelica.Mechanics.MultiBody.Types.Init.Free,
    enforceStates=false,
    useQuaternions=useQuaternions,
    sequence_angles={2,1,3});
  MarbleJoint MarbleJoint1;
initial equation 
  if initType == MB.Types.Init.Position or initType == MB.Types.Init.
      PositionVelocity or initType == MB.Types.Init.PositionVelocityAcceleration then
    // Initialize positional variables
    xA = x_start*MarbleJoint1.eA;
    xB = x_start*MarbleJoint1.eB;
    if useQuaternions then
      Q[1:3] = Q_start[1:3];
    else
      phi = phi_start_rad;
    end if;
  end if;
  
  if initType == MB.Types.Init.PositionVelocity or initType == MB.Types.Init.
      PositionVelocityAcceleration or initType == MB.Types.Init.Velocity or 
      initType == MB.Types.Init.VelocityAcceleration then
    // Initialize velocity variables
    if useTransVelocities then
      v*MarbleJoint1.eA = v_start*MarbleJoint1.eA;
      v*MarbleJoint1.eB = v_start*MarbleJoint1.eB;
      w*MarbleJoint1.eN = w_start_rad*MarbleJoint1.eN;
    else
      w = w_start_rad;
    end if;
  end if;
  
  if initType == MB.Types.Init.VelocityAcceleration or initType == MB.Types.Init.
      PositionVelocityAcceleration then
    // Initialize acceleration variables
    if useTransVelocities then
      a*MarbleJoint1.eA = a_start*MarbleJoint1.eA;
      a*MarbleJoint1.eB = a_start*MarbleJoint1.eB;
      z*MarbleJoint1.eN = z_start_rad*MarbleJoint1.eN;
    else
      z = z_start_rad;
    end if;
  end if;
  
  if initType == MB.Types.Init.SteadyState then
    w = zeros(3);
    z = zeros(3);
  end if;
  
equation 
  x = WheelBody.PotentialFBM1.x;
  v = WheelBody.PotentialFBM1.v;
  a = WheelBody.PotentialFBM1.a;
  phi = WheelBody.PotentialFBM1.phi;
  phi_d = WheelBody.PotentialFBM1.phi_d;
  Q = WheelBody.PotentialFBM1.Q;
  w = WheelBody.PotentialFBM1.w;
  z = WheelBody.PotentialFBM1.z;
  
  xA = x*MarbleJoint1.eA;
  xB = x*MarbleJoint1.eB;
  
  connect(WheelBody.frame_a, frame_b);
  connect(MarbleJoint1.frame_b, frame_b);
end Marble;

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