VehicleDynamics.Utilities.Forces.Utilities

VehicleDynamics.Utilities.Forces.Utilities.RotationVector VehicleDynamics.Utilities.Forces.Utilities.Rotation VehicleDynamics.Utilities.Forces.Utilities.MatrixFromVector VehicleDynamics.Utilities.Forces.Utilities.ForceTable1D VehicleDynamics.Utilities.Forces.Utilities.Coefficients3DLinear VehicleDynamics.Utilities.Forces.Utilities.RotationVector2 VehicleDynamics.Utilities.Forces.Utilities.RotationVectorInterface VehicleDynamics.Utilities.Forces.Utilities.Shape

NameDescription
RotationVector  
Rotation  
MatrixFromVector  
MatrixFromVectorData  
ForceTable1D  
Coefficients3DLinear  
ForceTable3D  
RotationVector2  
RotationVectorInterface  
Shape Different visual shapes (box, cylinder, sphere, ...)
BushingAnimation SpringDamperTableLine3D - nonlinear translational spring-damper model to use with ModelicaAdditions.MultiBody


VehicleDynamics.Utilities.Forces.Utilities.ForceTable1D VehicleDynamics.Utilities.Forces.Utilities.ForceTable1D

Parameters

NameDefaultDescription
fc[:, 2][-1, -10000; -0.5, -3300; 0, 0; 0.5, 3300; 1, 10000] 
fd[:, 2][-1, -1000; -0.5, -330; 0, 0; 0.5, 330; 1, 1000] 
tableName_C"NoName"table name on file or in function usertab(optional)
fileName_C"NoName"file where matrix is stored (optional)
icol_C[:]{2}columns of table to be interpolated
tableName_D"NoName"table name on file or in function usertab(optional)
fileName_D"NoName"file where matrix is stored (optional)
icol_D[:]{2}columns of table to be interpolated

Modelica definition

record ForceTable1D 
  parameter Real[:, 2] fc=[-1, -10000; -0.5, -3300; 0, 0; 0.5, 3300; 1, 10000];
  parameter Real[:, 2] fd=[-1, -1000; -0.5, -330; 0, 0; 0.5, 330; 1, 1000];
  
  parameter String tableName_C="NoName" 
    "table name on file or in function usertab(optional)";
  parameter String fileName_C="NoName" "file where matrix is stored (optional)";
  parameter Real icol_C[:]={2} "columns of table to be interpolated";
  parameter String tableName_D="NoName" 
    "table name on file or in function usertab(optional)";
  parameter String fileName_D="NoName" "file where matrix is stored (optional)";
  parameter Real icol_D[:]={2} "columns of table to be interpolated";
  
  
end ForceTable1D;

VehicleDynamics.Utilities.Forces.Utilities.Shape VehicleDynamics.Utilities.Forces.Utilities.Shape

Different visual shapes (box, cylinder, sphere, ...)

Parameters

NameDefaultDescription
shapeType"box"Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, wirebox, spring)

Modelica definition

model Shape "Different visual shapes (box, cylinder, sphere, ...)" 
  parameter String shapeType="box" 
    "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, wirebox, spring)";
  input SI.Position r0[3]={0,0,0} 
    "Position vector from object frame origin to shape origin";
  input SI.Position lengthDirection[3]={1,0,0} 
    "Vector in length direction, resolved in object frame.";
  input SI.Position widthDirection[3]={0,1,0} 
    "Vector in width direction, resolved in object frame.";
  input SI.Position length=0 "length of visual object.";
  input SI.Position width=0 "Width of visual object.";
  input SI.Position height=0 "Height of visual object.";
  input Real Material[4]={1,0,0,0.5} "Color and specular coefficient.";
  input Real Extra=0.0 "Additional parameter for cone and pipe.";
  input Real S[3, 3] "Transformation matrix to inertial frame.";
  input SI.Position r[3] 
    "Position vector from origin of world frame to origin of object frame, resolved in world frame";
protected 
  output Real Form;
  output Real rxvisobj[3];
  output Real ryvisobj[3];
  output Real rvisobj[3];
  output Real size[3];
  output Real material;
  output Real extra;
equation 
  
  /* Outputs to file. */
  Form = (987000 + PackShape(shapeType))*1E20;
  rxvisobj = S[:, 1];
  ryvisobj = S[:, 2];
  rvisobj = r + S*r0;
  size = {length,width,height};
  material = PackMaterial(Material[1], Material[2], Material[3], Material[4]);
  extra = Extra;
end Shape;

VehicleDynamics.Utilities.Forces.Utilities.RotationVector VehicleDynamics.Utilities.Forces.Utilities.RotationVector

Information

This block calculates the rotation vector THETA 
from a transformation matrix S according to:
Assume  S=
    [nx, sx, ax;
     ny, sy, ay;
     nz, sz, az]=
    Rot(k,theta)=
    [kx*kx*vT+cT,    ky*kx*vT-kz*sT, kz*kx*vT+ky*sT;
     kx*ky*vT+kz*sT, ky*ky*vT+cT     kz*ky*vT-kx*sT;
     kx*kz*vT-ky*sT, ky*kz*vT+kx*sT, kz*kz*vT+cT];
where   vT=1-cT, cT=cos(theta) and sT=sin(theta).
Then    nx+sy+az=(kx*kx+ky*ky+kz*kz)*vT+3*cT 
    ->  
    cT=1/2*(nx+sy+az-1);
Additionally,
    sz-ay=(ky*kz*vT+kx*sT)-(kz*ky*vT-kx*sT)=2*kx*sT;
    ax-nz=(kz*kx*vT+ky*sT)-(kx*kz*vT-ky*sT)=2*ky*sT;
    ny-sx=(kx*ky*vT+kz*sT)-(ky*kx*vT-kz*sT)=2*kz*sT;
    ->
    sT*sT=1/4*((sz-ay)(sz-ay)+(ax-nz)(ax-nz)+(ny-sx)(ny-sx));
    and
    k=1/(2*sT)*{sz-ay,ax-nz,ny-sx};
Since   THETA=k*theta=(-k)*(-theta) any from the roots coult be coosen,
    choose positive root:
    ->
    sT=1/2*sqrt((sz-ay)(sz-ay)+(ax-nz)(ax-nz)+(ny-sx)(ny-sx));
Finnally,
    theta=atan2(sT,cT)
    ->
    THETA=k*theta.
    
    
    

Parameters

NameDefaultDescription
linearfalseturn on of linearisation of cosine and sine
eps0.0000001Guard against division by zero

Modelica definition

block RotationVector 
  input Real[3, 3] S;
  output Real[3] THETA;
  parameter Boolean linear=false "turn on of linearisation of cosine and sine";
  
  parameter Real eps=0.0000001 "Guard against division by zero";
  
protected 
  parameter Integer n3=if linear then 0 else 3;
  parameter Integer n1=if linear then 0 else 1;
  
  Real k[n3] "Direction of THETA";
  Real sinTHETA[n1] "sine of abs(THETA)";
  Real cosTHETA[n1] "cosine of abs(THETA)";
  Real aux[n3] "auxillary vector";
  
equation 
  
  if (linear) then
    //THETA = {S[2, 3],-S[1, 3],S[1, 2]};
    THETA = -{S[3, 2],S[1, 3],S[2, 1]};
    
  else
    /*Calculate cos(THETA)*/
    cosTHETA[1] = 0.5*(S[1, 1] + S[2, 2] + S[3, 3] - 1);
    
    /*Calculate sin(THETA)*/
    aux[1] = (S[3, 2] - S[2, 3]);
    aux[2] = (S[1, 3] - S[3, 1]);
    aux[3] = (S[2, 1] - S[1, 2]);
    
    sinTHETA[1] = 0.5*sqrt(aux*aux);
    
    /*Calculate k, prevent zero division*/
    if noEvent(abs(sinTHETA[1]) < eps) then
      k[1] = 1;
      k[2] = 0;
      k[3] = 0;
    else
      k[1] = 0.5/sinTHETA[1]*aux[1];
      k[2] = 0.5/sinTHETA[1]*aux[2];
      k[3] = 0.5/sinTHETA[1]*aux[3];
    end if;
    /*Calculate THETA*/
    identity(n3)*THETA = Modelica.Math.atan2(sinTHETA[1], cosTHETA[1])*k;
  end if;
  
end RotationVector;

VehicleDynamics.Utilities.Forces.Utilities.ForceTable3D

Parameters

NameDefaultDescription
r1[:, 2][-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000] 
r2[:, 2][-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000] 
r3[:, 2][-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000] 
v1[:, 2][-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000] 
v2[:, 2][-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000] 
v3[:, 2][-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000] 
phi1[:, 2][-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000][rad]
phi2[:, 2][-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000][rad]
phi3[:, 2][-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000][rad]
w1[:, 2][-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000] 
w2[:, 2][-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000] 
w3[:, 2][-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000] 

Modelica definition

record ForceTable3D 
  parameter Real[:, 2] r1=[-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 
       100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000];
  parameter Real[:, 2] r2=[-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 
       100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000];
  parameter Real[:, 2] r3=[-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 
       100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000];
  
  parameter Real v1[:, 2]=[-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 
       0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000];
  parameter Real v2[:, 2]=[-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 
       0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000];
  parameter Real v3[:, 2]=[-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 
       0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000];
  
  parameter SI.Angle phi1[:, 2]=[-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 
       100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000];
  parameter SI.Angle phi2[:, 2]=[-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 
       100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000];
  parameter SI.Angle phi3[:, 2]=[-0.1, 10000000; -0.08, 1000000; -0.06, 100000; -0.04, 
       100000; 0, 0; 0.04, -100000; 0.06, -100000; 0.08, -1000000; 0.1, -10000000];
  
  parameter Real w1[:, 2]=[-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 
       0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000];
  parameter Real w2[:, 2]=[-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 
       0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000];
  parameter Real w3[:, 2]=[-0.1, 200000; -0.08, 20000; -0.06, 2000; -0.04, 2000; 
       0, 0; 0.04, -2000; 0.06, -2000; 0.08, -20000; 0.1, -200000];
  
end ForceTable3D;

VehicleDynamics.Utilities.Forces.Utilities.Coefficients3DLinear VehicleDynamics.Utilities.Forces.Utilities.Coefficients3DLinear

Parameters

NameDefaultDescription
Ct[3, 3][10000, 0, 0; 0, 10000, 0; 0, 0, 10000] 
Dt[3, 3]0.0001*[10000, 0, 0; 0, 10000, 0; 0, 0, 10000] 
Cr[3, 3][10000, 0, 0; 0, 10000, 0; 0, 0, 10000] 
Dr[3, 3][10000, 0, 0; 0, 10000, 0; 0, 0, 10000] 
C[6, 6]10000*[10000, 0, 0, 0, 0, 0; 0, 10000, 0, 0, 0, 0; 0, 0, 10000, 0, 0, 0; 0, 0, 0, 10000, 0, 0; 0, 0, 0, 0, 10000, 0; 0, 0, 0, 0, 0, 10000] 
D[6, 6][10000, 0, 0, 0, 0, 0; 0, 10000, 0, 0, 0, 0; 0, 0, 10000, 0, 0, 0; 0, 0, 0, 10000, 0, 0; 0, 0, 0, 0, 10000, 0; 0, 0, 0, 0, 0, 10000] 

Modelica definition

record Coefficients3DLinear 
  parameter Real[3, 3] Ct=[10000, 0, 0; 0, 10000, 0; 0, 0, 10000];
  parameter Real[3, 3] Dt=0.0001*[10000, 0, 0; 0, 10000, 0; 0, 0, 10000];
  parameter Real[3, 3] Cr=[10000, 0, 0; 0, 10000, 0; 0, 0, 10000];
  parameter Real[3, 3] Dr=[10000, 0, 0; 0, 10000, 0; 0, 0, 10000];
  parameter Real[6, 6] C=10000*[10000, 0, 0, 0, 0, 0; 0, 10000, 0, 0, 0, 0; 0, 
      0, 10000, 0, 0, 0; 0, 0, 0, 10000, 0, 0; 0, 0, 0, 0, 10000, 0; 0, 0, 0, 0, 
       0, 10000];
  parameter Real[6, 6] D=[10000, 0, 0, 0, 0, 0; 0, 10000, 0, 0, 0, 0; 0, 0, 
      10000, 0, 0, 0; 0, 0, 0, 10000, 0, 0; 0, 0, 0, 0, 10000, 0; 0, 0, 0, 0, 0, 
       10000];
  
end Coefficients3DLinear;

VehicleDynamics.Utilities.Forces.Utilities.Rotation VehicleDynamics.Utilities.Forces.Utilities.Rotation

Parameters

NameDefaultDescription
linearfalse 

Modelica definition

block Rotation 
  parameter Boolean linear=false;
  
  input Real[2, 2] S;
  output Real THETA;
equation 
  
  THETA = if linear then S[1, 2] else Modelica.Math.atan2(S[1, 2], S[1, 1]);
end Rotation;

VehicleDynamics.Utilities.Forces.Utilities.MatrixFromVector VehicleDynamics.Utilities.Forces.Utilities.MatrixFromVector

VehicleDynamics.Utilities.Forces.Utilities.MatrixFromVector

Parameters

NameDefaultDescription
grid[1, :][-1, 0, 1] 
values[:, 9][10000, 0, 0, 0, 10000, 0, 0, 0, 10000; 5000, 0, 0, 0, 5000, 0, 0, 0, 5000; 10000, 0, 0, 0, 10000, 0, 0, 0, 10000] 

Modelica definition

model MatrixFromVector 
  input Real[3] x;
  //Temporarilly, this should be Real[:]
  output Real[size(x, 1), size(x, 1)] Y;
  
  parameter Real[1, :] grid=[-1, 0, 1];
  parameter Real[:, 9] values=[10000, 0, 0, 0, 10000, 0, 0, 0, 10000; 5000, 0, 
      0, 0, 5000, 0, 0, 0, 5000; 10000, 0, 0, 0, 10000, 0, 0, 0, 10000];
  
  //paramter handling must be improved
  
  
    //here should be added parameters so that tables from files could be read, see CombiTable1D 
  ModelicaAdditions.Tables.CombiTable1D x1(table=[transpose(grid), values[:, 
         1], values[:, 4], values[:, 7]], icol={2,3,4});
  ModelicaAdditions.Tables.CombiTable1D x2(table=[transpose(grid), values[:, 
         2], values[:, 5], values[:, 8]], icol={2,3,4});
  ModelicaAdditions.Tables.CombiTable1D x3(table=[transpose(grid), values[:, 
         3], values[:, 6], values[:, 9]], icol={2,3,4});
equation 
  x1.inPort.signal = {x[1],x[1],x[1]};
  x2.inPort.signal = {x[2],x[2],x[2]};
  x3.inPort.signal = {x[3],x[3],x[3]};
  
  Y = [x1.outPort.signal[1], x2.outPort.signal[1], x3.outPort.signal[1]; x1.
    outPort.signal[2], x2.outPort.signal[2], x3.outPort.signal[2]; x1.outPort.
    signal[3], x2.outPort.signal[3], x3.outPort.signal[3]];
  
end MatrixFromVector;

VehicleDynamics.Utilities.Forces.Utilities.MatrixFromVectorData

Modelica definition

record MatrixFromVectorData 
  //this record should provide the data neccessary for MatrixFromVector
end MatrixFromVectorData;

VehicleDynamics.Utilities.Forces.Utilities.RotationVector2 VehicleDynamics.Utilities.Forces.Utilities.RotationVector2

Information

This block calculates the rotation vector THETA 
from a transformation matrix S according to:
Assume  S=
    [nx, sx, ax;
     ny, sy, ay;
     nz, sz, az]=
    Rot(k,theta)=
    [kx*kx*vT+cT,    ky*kx*vT-kz*sT, kz*kx*vT+ky*sT;
     kx*ky*vT+kz*sT, ky*ky*vT+cT     kz*ky*vT-kx*sT;
     kx*kz*vT-ky*sT, ky*kz*vT+kx*sT, kz*kz*vT+cT];
where   vT=1-cT, cT=cos(theta) and sT=sin(theta).
Then    nx+sy+az=(kx*kx+ky*ky+kz*kz)*vT+3*cT 
    ->  
    cT=1/2*(nx+sy+az-1);
Additionally,
    sz-ay=(ky*kz*vT+kx*sT)-(kz*ky*vT-kx*sT)=2*kx*sT;
    ax-nz=(kz*kx*vT+ky*sT)-(kx*kz*vT-ky*sT)=2*ky*sT;
    ny-sx=(kx*ky*vT+kz*sT)-(ky*kx*vT-kz*sT)=2*kz*sT;
    ->
    sT*sT=1/4*((sz-ay)(sz-ay)+(ax-nz)(ax-nz)+(ny-sx)(ny-sx));
    and
    k=1/(2*sT)*{sz-ay,ax-nz,ny-sx};
Since   THETA=k*theta=(-k)*(-theta) any from the roots coult be coosen,
    choose positive root:
    ->
    sT=1/2*sqrt((sz-ay)(sz-ay)+(ax-nz)(ax-nz)+(ny-sx)(ny-sx));
Finnally,
    theta=atan2(sT,cT)
    ->
    THETA=k*theta.
    
    
    

Parameters

NameDefaultDescription
eps0.0000001Guard against division by zero

Modelica definition

block RotationVector2 
  input Real[3, 3] S;
  output Real[3] THETA;
  
  parameter Real eps=0.0000001 "Guard against division by zero";
protected 
  Real k[3] "Direction of THETA";
  Real sinTHETA "sine of abs(THETA)";
  Real cosTHETA "cosine of abs(THETA)";
  
  Real aux[3] "auxillary vector";
equation 
  
  /*Calculate cos(THETA)*/
  cosTHETA = 0.5*(S[1, 1] + S[2, 2] + S[3, 3] - 1);
  
  /*Calculate sin(THETA)*/
  aux = {(S[3, 2] - S[2, 3]),(S[1, 3] - S[3, 1]),(S[2, 1] - S[1, 2])};
  
  sinTHETA = 0.5*sqrt(aux*aux);
  
  /*Calculate k, prevent zero division*/
  k = noEvent(if (abs(sinTHETA) < eps) then {1,0,0} else 0.5/sinTHETA*aux);
  
  /*Calculate THETA*/
  THETA = Modelica.Math.atan2(sinTHETA, cosTHETA)*k;
  
end RotationVector2;

VehicleDynamics.Utilities.Forces.Utilities.RotationVectorInterface VehicleDynamics.Utilities.Forces.Utilities.RotationVectorInterface

Information

This block calculates the rotation vector THETA 
from a transformation matrix S according to:
Assume  S=
    [nx, sx, ax;
     ny, sy, ay;
     nz, sz, az]=
    Rot(k,theta)=
    [kx*kx*vT+cT,    ky*kx*vT-kz*sT, kz*kx*vT+ky*sT;
     kx*ky*vT+kz*sT, ky*ky*vT+cT     kz*ky*vT-kx*sT;
     kx*kz*vT-ky*sT, ky*kz*vT+kx*sT, kz*kz*vT+cT];
where   vT=1-cT, cT=cos(theta) and sT=sin(theta).
Then    nx+sy+az=(kx*kx+ky*ky+kz*kz)*vT+3*cT 
    ->  
    cT=1/2*(nx+sy+az-1);
Additionally,
    sz-ay=(ky*kz*vT+kx*sT)-(kz*ky*vT-kx*sT)=2*kx*sT;
    ax-nz=(kz*kx*vT+ky*sT)-(kx*kz*vT-ky*sT)=2*ky*sT;
    ny-sx=(kx*ky*vT+kz*sT)-(ky*kx*vT-kz*sT)=2*kz*sT;
    ->
    sT*sT=1/4*((sz-ay)(sz-ay)+(ax-nz)(ax-nz)+(ny-sx)(ny-sx));
    and
    k=1/(2*sT)*{sz-ay,ax-nz,ny-sx};
Since   THETA=k*theta=(-k)*(-theta) any from the roots coult be coosen,
    choose positive root:
    ->
    sT=1/2*sqrt((sz-ay)(sz-ay)+(ax-nz)(ax-nz)+(ny-sx)(ny-sx));
Finnally,
    theta=atan2(sT,cT)
    ->
    THETA=k*theta.
    
    
    

Parameters

NameDefaultDescription
linearfalseturn on of linearisation of cosine and sine
eps0.0000001Guard against division by zero

Modelica definition

block RotationVectorInterface 
  input Real[3, 3] S;
  output Real[3] THETA;
  parameter Boolean linear=false "turn on of linearisation of cosine and sine";
  
  parameter Real eps=0.0000001 "Guard against division by zero";
  
protected 
  parameter Integer n3=if linear then 0 else 3;
  parameter Integer n1=if linear then 0 else 1;
  
  Real k[n3] "Direction of THETA";
  Real sinTHETA[n1] "sine of abs(THETA)";
  Real cosTHETA[n1] "cosine of abs(THETA)";
  Real aux[n3] "auxillary vector";
  
equation 
  
  if (linear) then
    //THETA = {S[2, 3],-S[1, 3],S[1, 2]};
    THETA = -{S[3, 2],S[1, 3],S[2, 1]};
    
  else
    /*Calculate cos(THETA)*/
    cosTHETA[1] = 0.5*(S[1, 1] + S[2, 2] + S[3, 3] - 1);
    
    /*Calculate sin(THETA)*/
    aux[1] = (S[3, 2] - S[2, 3]);
    aux[2] = (S[1, 3] - S[3, 1]);
    aux[3] = (S[2, 1] - S[1, 2]);
    
    sinTHETA[1] = 0.5*sqrt(aux*aux);
    
    /*Calculate k, prevent zero division*/
    if noEvent(abs(sinTHETA[1]) < eps) then
      k[1] = 1;
      k[2] = 0;
      k[3] = 0;
    else
      k[1] = 0.5/sinTHETA[1]*aux[1];
      k[2] = 0.5/sinTHETA[1]*aux[2];
      k[3] = 0.5/sinTHETA[1]*aux[3];
    end if;
    /*Calculate THETA*/
    identity(n3)*THETA = Modelica.Math.atan2(sinTHETA[1], cosTHETA[1])*k;
  end if;
  
end RotationVectorInterface;

VehicleDynamics.Utilities.Forces.Utilities.BushingAnimation

SpringDamperTableLine3D - nonlinear translational spring-damper model to use with ModelicaAdditions.MultiBody

VehicleDynamics.Utilities.Forces.Utilities.BushingAnimation

Information


This class provides a translational spring damper where the forces generated by the spring and the damper is read from a table and interpolated. The table can be given as parameters or with a record.

  s_rel0:       Unstretched spring length
  tableName_C:  table name on file or in function usertab(optional) (spring force)
  fileName_C:   NoName" "file where matrix is stored (optional) (spring force)
  icol_C:       columns of table to be interpolated (spring force)
  tableName_D:  table name on file or in function usertab(optional) (damper force) 
  fileName_D:   NoName" "file where matrix is stored (optional) (damper force)
  icol_D:       columns of table to be interpolated (damper force)
  forceTable: To set the force generation via a record, add a component named [name] of class VehicleDynamics.Utilities.Forces.Utilities.ForceTable1D to the model and write forceTable=[name] in the modifiers row
  Mass and inertia properties not yet solved!  

Parameters

NameDefaultDescription
animationtrueTrue, if animation shall be enabled
width0.1 Width bushing [m]
length0.1 Width bushing [m]
height0.1 Width bushing [m]
material[4]{0.2,0.2,0.2,0.2} Color and specular coefficient of spring

Modelica definition

model BushingAnimation 
  "SpringDamperTableLine3D - nonlinear translational spring-damper model to use with ModelicaAdditions.MultiBody"
   
  
  parameter Boolean animation=true "True, if animation shall be enabled";
  parameter SI.Position width=0.1 "|Animation|if animation = true| Width bushing";
  parameter SI.Position length=0.1 "|Animation|if animation = true| Width bushing";
  parameter SI.Position height=0.1 "|Animation|if animation = true| Width bushing";
  parameter Real material[4]={0.2,0.2,0.2,0.2} 
    "|Animation|if animation = true| Color and specular coefficient of spring";
  
protected 
  Real material2[4];
  
  
  SI.Position r0a[3];
  SI.Position r0b[3];
  Real[3, 3] Sa;
  Real[3, 3] Sb;
  
protected 
  parameter Integer ndim=if animation then 1 else 0;
protected 
  Utilities.Shape shapeA[ndim](
    each shapeType="box", 
    each Material=material, 
    each length=length/2, 
    each width=width, 
    each height=width, 
    each lengthDirection={1,0,0}, 
    each widthDirection={0,1,0}, 
    each r=r0a, 
    each S=Sa);
  Utilities.Shape shapeB[ndim](
    each shapeType="box", 
    each Material=material, 
    each length=length/2, 
    each width=width, 
    each height=width, 
    each lengthDirection={1,0,0}, 
    each widthDirection={0,1,0}, 
    each r=r0b, 
    each S=Sb);
equation 
  
end BushingAnimation;

HTML-documentation generated by Dymola Tue Jul 15 13:23:56 2003 .