VehicleDynamics.Utilities.Forces

Modelica library to model forces and torques between interacting bodies, such as e.g. springs and dampers

VehicleDynamics.Utilities.Forces.SpringDamperTable1D VehicleDynamics.Utilities.Forces.Utilities VehicleDynamics.Utilities.Forces.SpringDamperTable3D VehicleDynamics.Utilities.Forces.SpringDamperTableLine3D VehicleDynamics.Utilities.Forces.SpringDamperTableRot1D VehicleDynamics.Utilities.Forces.SpringDamperLinear3D VehicleDynamics.Utilities.Forces.ElastoGap VehicleDynamics.Utilities.Forces.Examples VehicleDynamics.Utilities.Forces.SpringDamperLinearBump3D_freeMotion VehicleDynamics.Utilities.Forces.SpringDamperLinearBump3D

Information

 

This library provides force generators such as non-linear spring-dampers of various kinds that are not included in the standard libraries for Mechanics.

Main Author:
Johan Andreasson
Division of Vehicle Dynamics (FDN)
Royal Institute of Technology (KTH)
Teknikringen 8c
100 44 Stockholm
Sweden
email: Johan@fkt.kth.se
 

NameDescription
SpringDamperTable1D  
Utilities  
SpringDamperTable3D SpringDamperTableLine3D - nonlinear translational and rotational spring-damper model to use with ModelicaAdditions.MultiBody
SpringDamperTableLine3D SpringDamperTableLine3D - nonlinear translational spring-damper model to use with ModelicaAdditions.MultiBody
SpringDamperTableRot1D SpringDamperTable1D - nonlinear spring-damper model to use with Modelica.Mechanics.Rotational
SpringDamperLinear3D  
ElastoGap 1D translational spring damper combination with gap
Examples  
SpringDamperLinearBump3D_freeMotion Spring-damper in parallel with bumps at ends.
SpringDamperLinearBump3D Spring-damper in parallel with bumps at ends.


VehicleDynamics.Utilities.Forces.SpringDamperTable1D VehicleDynamics.Utilities.Forces.SpringDamperTable1D

VehicleDynamics.Utilities.Forces.SpringDamperTable1D

Information


This class provides a 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
s_rel00Unstretched spring length [m]
fc[:, 2]data.fcTable to be interpolated
fd[:, 2]data.fdTable to be interpolated
tableName_Cdata.tableName_Ctable name on file or in function usertab(optional)
fileName_Cdata.fileName_Cfile where matrix is stored (optional)
icol_C[:]data.icol_Ccolumns of table to be interpolated
tableName_Ddata.tableName_Dtable name on file or in function usertab(optional)
fileName_Ddata.fileName_Dfile where matrix is stored (optional)
icol_D[:]data.icol_Dcolumns of table to be interpolated
data  

Modelica definition

model SpringDamperTable1D 
  extends Modelica.Mechanics.Translational.Interfaces.Compliant;
  
  parameter SI.Position s_rel0=0 "Unstretched spring length";
  
  parameter Real[:, 2] fc=data.fc "Table to be interpolated";
  parameter Real[:, 2] fd=data.fd "Table to be interpolated";
  
  parameter String tableName_C=data.tableName_C 
    "table name on file or in function usertab(optional)";
  parameter String fileName_C=data.fileName_C 
    "file where matrix is stored (optional)";
  parameter Real icol_C[:]=data.icol_C "columns of table to be interpolated";
  parameter String tableName_D=data.tableName_D 
    "table name on file or in function usertab(optional)";
  parameter String fileName_D=data.fileName_D 
    "file where matrix is stored (optional)";
  parameter Real icol_D[:]=data.icol_D "columns of table to be interpolated";
  SI.Velocity v_rel "relative velocity between flange L and R";
  
public 
  ModelicaAdditions.Tables.CombiTable1D Dt(
    tableName=tableName_D, 
    fileName=fileName_D, 
    icol=icol_D, 
    table=fd);
  ModelicaAdditions.Tables.CombiTable1D Ct(
    tableName=tableName_C, 
    fileName=fileName_C, 
    icol=icol_C, 
    table=fc);
  parameter Utilities.ForceTable1D data;
equation 
  v_rel = der(s_rel);
  
  Ct.inPort.signal[1] = s_rel - s_rel0;
  Dt.inPort.signal[1] = v_rel;
  
  f = Ct.outPort.signal[1] + Dt.outPort.signal[1];
end SpringDamperTable1D;

VehicleDynamics.Utilities.Forces.SpringDamperTableRot1D VehicleDynamics.Utilities.Forces.SpringDamperTableRot1D

SpringDamperTable1D - nonlinear spring-damper model to use with Modelica.Mechanics.Rotational

VehicleDynamics.Utilities.Forces.SpringDamperTableRot1D

Information


This class provides a rotational 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.

  phi_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 classVehicleDynamics.Utilities.Forces.Utilities.ForceTable1D to the model and write forceTable=[name] in the modifiers row
  Mass and inertia properties not yet solved!  

Parameters

NameDefaultDescription
phi_rel00Unstretched spring length [rad]
fc[:, 2]data.fcTable to be interpolated
fd[:, 2]data.fdTable to be interpolated
tableName_Cdata.tableName_Ctable name on file or in function usertab(optional)
fileName_Cdata.fileName_Cfile where matrix is stored (optional)
icol_C[:]data.icol_Ccolumns of table to be interpolated
tableName_Ddata.tableName_Dtable name on file or in function usertab(optional)
fileName_Ddata.fileName_Dfile where matrix is stored (optional)
icol_D[:]data.icol_Dcolumns of table to be interpolated
data  

Modelica definition

model SpringDamperTableRot1D 
  "SpringDamperTable1D - nonlinear spring-damper model to use with Modelica.Mechanics.Rotational"
   
  
  extends Modelica.Mechanics.Rotational.Interfaces.Compliant;
  
  parameter SI.Angle phi_rel0=0 "Unstretched spring length";
  
  parameter Real[:, 2] fc=data.fc "Table to be interpolated";
  parameter Real[:, 2] fd=data.fd "Table to be interpolated";
  
  parameter String tableName_C=data.tableName_C 
    "table name on file or in function usertab(optional)";
  parameter String fileName_C=data.fileName_C 
    "file where matrix is stored (optional)";
  parameter Real icol_C[:]=data.icol_C "columns of table to be interpolated";
  parameter String tableName_D=data.tableName_D 
    "table name on file or in function usertab(optional)";
  parameter String fileName_D=data.fileName_D 
    "file where matrix is stored (optional)";
  parameter Real icol_D[:]=data.icol_D "columns of table to be interpolated";
  
  SI.Velocity w_rel "relative velocity between flange L and R";
  
public 
  ModelicaAdditions.Tables.CombiTable1D Dr(
    tableName=tableName_D, 
    fileName=fileName_D, 
    icol=icol_D, 
    table=fd);
  ModelicaAdditions.Tables.CombiTable1D Cr(
    tableName=tableName_C, 
    fileName=fileName_C, 
    icol=icol_C, 
    table=fc);
  parameter Utilities.ForceTable1D data;
equation 
  w_rel = der(phi_rel);
  
  Cr.inPort.signal[1] = phi_rel - phi_rel0;
  Dr.inPort.signal[1] = w_rel;
  
  tau = Cr.outPort.signal[1] + Dr.outPort.signal[1];
end SpringDamperTableRot1D;

VehicleDynamics.Utilities.Forces.SpringDamperTableLine3D VehicleDynamics.Utilities.Forces.SpringDamperTableLine3D

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

VehicleDynamics.Utilities.Forces.SpringDamperTableLine3D

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 classVehicleDynamics.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.09 Width of spring [m]
coilWidthwidth/10 Width of spring coil
numberOfWindings5 Number of spring windings
material[4]{0.5,0.5,0.5,0.8} Color and specular coefficient of spring
s_rel00Unstretched spring length [m]
fc[:, 2]data.fcTable to be interpolated
fd[:, 2]data.fdTable to be interpolated
tableName_Cdata.tableName_Ctable name on file or in function usertab(optional)
fileName_Cdata.fileName_Cfile where matrix is stored (optional)
icol_C[:]data.icol_Ccolumns of table to be interpolated
tableName_Ddata.tableName_Dtable name on file or in function usertab(optional)
fileName_Ddata.fileName_Dfile where matrix is stored (optional)
icol_D[:]data.icol_Dcolumns of table to be interpolated
n1[3]{0,0,1}orthogonal to y-axis of shapes

Modelica definition

model SpringDamperTableLine3D 
  "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.09 "|Animation|if animation = true| Width of spring";
  parameter Real coilWidth=width/10 
    "|Animation|if animation = true| Width of spring coil";
  parameter Integer numberOfWindings=5 
    "|Animation|if animation = true| Number of spring windings";
  parameter Real material[4]={0.5,0.5,0.5,0.8} 
    "|Animation|if animation = true| Color and specular coefficient of spring";
  
  parameter SI.Position s_rel0=0 "Unstretched spring length";
  
  parameter Real[:, 2] fc=data.fc "Table to be interpolated";
  parameter Real[:, 2] fd=data.fd "Table to be interpolated";
  
  parameter String tableName_C=data.tableName_C 
    "table name on file or in function usertab(optional)";
  parameter String fileName_C=data.fileName_C 
    "file where matrix is stored (optional)";
  parameter Real icol_C[:]=data.icol_C "columns of table to be interpolated";
  parameter String tableName_D=data.tableName_D 
    "table name on file or in function usertab(optional)";
  parameter String fileName_D=data.fileName_D 
    "file where matrix is stored (optional)";
  parameter Real icol_D[:]=data.icol_D "columns of table to be interpolated";
  
  parameter Real n1[3]={0,0,1} "orthogonal to y-axis of shapes";
  
protected 
  Real material2[4];
  extends ModelicaAdditions.MultiBody.Interfaces.LineForce;
public 
  Utilities.ForceTable1D data;
  ModelicaAdditions.Tables.CombiTable1D Dt(
    tableName=tableName_D, 
    fileName=fileName_D, 
    icol=icol_D, 
    table=fd);
  ModelicaAdditions.Tables.CombiTable1D Ct(
    tableName=tableName_C, 
    fileName=fileName_C, 
    icol=icol_C, 
    table=fc);
  
protected 
  Real nx[3];
  Real[3] b1;
  Real normb;
  Real[3] ny;
  Real[3] nz;
  Real[3, 3] S_relc;
  Real[3, 3] Sc;
  
protected 
  parameter Integer ndim=if animation then 1 else 0;
protected 
  Utilities.Shape shape[ndim](
    each shapeType="spring", 
    each Material=material, 
    each length=s, 
    each width=width, 
    each height=coilWidth*2, 
    each lengthDirection=na, 
    each widthDirection={1,1,-2}, 
    each Extra=numberOfWindings, 
    each r=frame_a.r0, 
    each S=Sc);
  Utilities.Shape damperShapeA[ndim](
    each length=s, 
    each lengthDirection=na, 
    each widthDirection={1,1,-2}, 
    each r=frame_a.r0, 
    each S=Sc, 
    each shapeType="cylinder", 
    each width=width/2, 
    each height=width/2, 
    each Material=material2);
public 
  VisualVector force(
    category="force", 
    r=r0a, 
    Size=fa, 
    S=Sa);
protected 
  Utilities.Shape damperShapeB[ndim](
    each Material=material, 
    each lengthDirection=na, 
    each widthDirection={1,1,-2}, 
    each S=Sc, 
    each shapeType="cylinder", 
    each length=-s_rel0/2, 
    each r=frame_b.r0, 
    each width=width*0.75, 
    each height=width*0.75);
equation 
  
  Ct.inPort.signal[1] = s - s_rel0;
  Dt.inPort.signal[1] = sd;
  
  nx = na;
  b1 = cross(n1, nx);
  normb = sqrt(b1*b1);
  ny = b1/normb;
  nz = cross(nx, ny);
  S_relc = transpose([nx, ny, nz]);
  Sc = Sa*transpose(S_relc);
  
  material2[1] = if (s < -s_rel0/2) then 0 else if (s < 1.5*s_rel0) then -0.5
     + s/s_rel0 else 1;
  material2[2] = 0.5;
  material2[3] = 1 - material2[1];
  material2[4] = 0.9;
  
  f = Ct.outPort.signal[1] + Dt.outPort.signal[1];
end SpringDamperTableLine3D;

VehicleDynamics.Utilities.Forces.SpringDamperLinearBump3D VehicleDynamics.Utilities.Forces.SpringDamperLinearBump3D

Spring-damper in parallel with bumps at ends.

VehicleDynamics.Utilities.Forces.SpringDamperLinearBump3D

Information


This class provides a translational and rotational linear spring damper with bumpstops. No correlation effects between rotation and translation is considered here. The bumps are modelled according to the following. If the relative distance r_rela exceeds the intervall set up by the parameters r_min and r_max, the spring-damper generated force is amplified with a factor bumpFactor. The reason that not only the spring force is amplified is because it tends to generate high velocities.


Parameters

NameDefaultDescription
r_rela0[3]{0,0,0}Unstretched translational spring vector [m]
r_min[3]{-0.05,-0.03,-0.06}vector to bump stop from reference point in negative direction [m]
r_max[3]{0.05,0.03,0.06}vector to bump stop from reference point in positive direction [m]
bumpFactor1000scaleFactor of spring force at after bump
phi_rela0[3]{0,0,0}Unstretched rotational spring vector [rad]
C[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]Stiffness matrix
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]Damping matrix
linearfalseturn on/off linearisation of cosine and sine in rotation vector equation
eps0.0000001Guard against division by zero
animationtrueTrue, if animation shall be enabled
widthr_max[2] - r_min[2] Width bushing [m]
lengthr_max[1] - r_min[1] Width bushing [m]
heightr_max[3] - r_min[3] Width bushing [m]
material[4]{0.2,0.2,0.2,0.2} Color and specular coefficient of spring

Modelica definition

model SpringDamperLinearBump3D 
  "Spring-damper in parallel with bumps at ends." 
  import SI = Modelica.SIunits;
  extends ModelicaAdditions.MultiBody.Interfaces.TwoNoTreeFrames;
  parameter SI.Position[3] r_rela0={0,0,0} "Unstretched translational spring vector";
  parameter SI.Position[3] r_min={-0.05,-0.03,-0.06} 
    "vector to bump stop from reference point in negative direction";
  parameter SI.Position[3] r_max={0.05,0.03,0.06} 
    "vector to bump stop from reference point in positive direction";
  parameter Real bumpFactor=1000 "scaleFactor of spring force at after bump";
  parameter SI.Angle[3] phi_rela0={0,0,0} "Unstretched rotational spring vector";
  
  parameter Real[6, 6] C=[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] "|Forces|Linear|Stiffness matrix";
  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] "|Forces|Linear|Damping matrix";
  
  parameter Boolean linear=false 
    "turn on/off linearisation of cosine and sine in rotation vector equation";
  
  parameter Real eps=0.0000001 "Guard against division by zero";
  
  parameter Boolean animation=true "True, if animation shall be enabled";
  parameter SI.Position width=r_max[2] - r_min[2] 
    "|Animation|if animation = true| Width bushing";
  parameter SI.Position length=r_max[1] - r_min[1] 
    "|Animation|if animation = true| Width bushing";
  parameter SI.Position height=r_max[3] - r_min[3] 
    "|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";
  
  Real S_rel[3, 3];
  SI.Position r_rela[3];
  SI.Velocity v_rela[3];
  SI.AngularVelocity w_rela[3];
  SI.Velocity vaux[3];
  
protected 
  parameter Integer ndim=if animation then 1 else 0;
public 
  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);
  
protected 
  SI.Angle[3] phi_rela;
  Real[3] f_bump;
public 
  Utilities.RotationVector rotationVector(linear=linear, eps=eps);
equation 
  
  S_rel = transpose(Sb)*Sa;
  r_rela = transpose(Sa)*(r0b - r0a);
  
  /*  
  if initial() then
    vaux = zeros(3);
    v_rela = zeros(3);
    w_rela = zeros(3);
    f_bump = zeros(3);
    [fa; ta] = -C*[r_rela - r_rela0; phi_rela - phi_rela0];
  else
*/
  vaux = cross(wa, r_rela);
  v_rela = transpose(S_rel)*vb - va - vaux;
  w_rela = transpose(S_rel)*wb - wa;
  f_bump[1] = if (r_rela[1] - r_rela0[1] > r_max[1]) then C[1, 1]*bumpFactor*(
    r_rela[1] - r_rela0[1] - r_max[1]) + D[1, 1]*bumpFactor*v_rela[1] else if (
    r_rela[1] - r_rela0[1] > r_min[1]) then 0 else C[1, 1]*bumpFactor*(r_rela[1]
     - r_min[1]) + D[1, 1]*bumpFactor*v_rela[1];
  f_bump[2] = if (r_rela[2] - r_rela0[2] > r_max[2]) then C[2, 2]*bumpFactor*(
    r_rela[2] - r_rela0[2] - r_max[2]) + D[2, 2]*bumpFactor*v_rela[2] else if (
    r_rela[2] - r_rela0[2] > r_min[2]) then 0 else C[2, 2]*bumpFactor*(r_rela[2]
     - r_min[2]) + D[2, 2]*bumpFactor*v_rela[2];
  f_bump[3] = if (r_rela[3] - r_rela0[3] > r_max[3]) then C[3, 3]*bumpFactor*(
    r_rela[3] - r_rela0[3] - r_max[3]) + D[3, 3]*bumpFactor*v_rela[3] else if (
    r_rela[3] - r_rela0[3] > r_min[3]) then 0 else C[3, 3]*bumpFactor*(r_rela[3]
     - r_min[3]) + D[3, 3]*bumpFactor*v_rela[3];
  
  [fa + f_bump; ta] = -C*[r_rela - r_rela0; phi_rela - phi_rela0] - D*[v_rela; 
    w_rela];
  /*
  end if;
*/
  
  fb = S_rel*fa;
  tb = S_rel*ta - S_rel*cross(r_rela, fa);
  
  rotationVector.S = S_rel;
  rotationVector.THETA = phi_rela;
  
end SpringDamperLinearBump3D;

VehicleDynamics.Utilities.Forces.SpringDamperLinearBump3D_freeMotion VehicleDynamics.Utilities.Forces.SpringDamperLinearBump3D_freeMotion

Spring-damper in parallel with bumps at ends.

VehicleDynamics.Utilities.Forces.SpringDamperLinearBump3D_freeMotion

Information


This class provides a translational and rotational linear spring damper with bumpstops. No correlation effects between rotation and translation is considered here. The bumps are modelled according to the following. If the relative distance r_rela exceeds the intervall set up by the parameters r_min and r_max, the spring-damper generated force is amplified with a factor bumpFactor. The reason that not only the spring force is amplified is because it tends to generate high velocities.


Parameters

NameDefaultDescription
r_rela0[3]{0,0,0}Unstretched translational spring vector [m]
r_min[3]{-0.05,-0.03,-0.06}vector to bump stop from reference point in negative direction [m]
r_max[3]{0.05,0.03,0.06}vector to bump stop from reference point in positive direction [m]
bumpFactor1000scaleFactor of spring force at after bump
phi_rela0[3]{0,0,0}Unstretched rotational spring vector [rad]
C[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]Stiffness matrix
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]Damping matrix
linearfalseturn on/off linearisation of cosine and sine in rotation vector equation
eps0.0000001Guard against division by zero
animationtrueTrue, if animation shall be enabled
widthr_max[2] - r_min[2] Width bushing [m]
lengthr_max[1] - r_min[1] Width bushing [m]
heightr_max[3] - r_min[3] Width bushing [m]
material[4]{0.2,0.2,0.2,0.2} Color and specular coefficient of spring

Modelica definition

model SpringDamperLinearBump3D_freeMotion 
  "Spring-damper in parallel with bumps at ends." 
  import SI = Modelica.SIunits;
  parameter SI.Position[3] r_rela0={0,0,0} "Unstretched translational spring vector";
  parameter SI.Position[3] r_min={-0.05,-0.03,-0.06} 
    "vector to bump stop from reference point in negative direction";
  parameter SI.Position[3] r_max={0.05,0.03,0.06} 
    "vector to bump stop from reference point in positive direction";
  parameter Real bumpFactor=1000 "scaleFactor of spring force at after bump";
  parameter SI.Angle[3] phi_rela0={0,0,0} "Unstretched rotational spring vector";
  
  parameter Real[6, 6] C=[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] "|Forces|Linear|Stiffness matrix";
  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] "|Forces|Linear|Damping matrix";
  
  parameter Boolean linear=false 
    "turn on/off linearisation of cosine and sine in rotation vector equation";
  
  parameter Real eps=0.0000001 "Guard against division by zero";
  
  parameter Boolean animation=true "True, if animation shall be enabled";
  parameter SI.Position width=r_max[2] - r_min[2] 
    "|Animation|if animation = true| Width bushing";
  parameter SI.Position length=r_max[1] - r_min[1] 
    "|Animation|if animation = true| Width bushing";
  parameter SI.Position height=r_max[3] - r_min[3] 
    "|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";
  Real S_rel[3, 3];
  SI.Position r_rela[3](start=zeros(3));
  SI.Velocity v_rela[3];
  SI.AngularVelocity w_rela[3];
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=frame_a.r0, 
    each S=frame_a.S);
  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=frame_b.r0, 
    each S=frame_b.S);
  
protected 
  SI.Angle[3] phi_rela;
  Real[3] f_bump;
  SI.Angle phi[3];
  Real s1;
  Real s2;
  Real s3;
  Real c1;
  Real c2;
  Real c3;
  
public 
  Utilities.RotationVector rotationVector(linear=linear, eps=eps);
  
public 
  ModelicaAdditions.MultiBody.Interfaces.Frame_a frame_a;
  ModelicaAdditions.MultiBody.Interfaces.Frame_b frame_b;
equation 
  /* Determine sines and cosines of the Cardan angles */
  s1 = Modelica.Math.sin(phi[1]);
  s2 = Modelica.Math.sin(phi[2]);
  s3 = Modelica.Math.sin(phi[3]);
  c1 = Modelica.Math.cos(phi[1]);
  c2 = Modelica.Math.cos(phi[2]);
  c3 = Modelica.Math.cos(phi[3]);
  
  /* Relative transformation matrix
       S_rel = [ c3, s3, 0; 
                -s3, c3, 0; 
                  0, 0, 1]*[c2, 0, -s2; 
                             0, 1, 0; 
                            s2, 0, c2]*[1, 0, 0; 
                                        0, c1, s1; 
                                        0, -s1, c1];
  */
  S_rel = [c2*c3, c1*s3 + s1*s2*c3, s1*s3 - c1*s2*c3; -c2*s3, c1*c3 - s1*s2*s3, 
     s1*c3 + c1*s2*s3; s2, -s1*c2, c1*c2];
  
  // Kinematic relationships
  frame_b.S = frame_a.S*transpose(S_rel);
  frame_b.r0 = frame_a.r0 + frame_a.S*r_rela;
  frame_b.a = zeros(3);
  frame_b.z = zeros(3);
  
  // Kinematic differential equations for translational motion
  der(r_rela) = v_rela;
  
  // Kinematic differential equations for rotational motion
  /*
  if initial() then
    der(phi) = w_rela;
    frame_b.v = zeros(3);
    frame_b.w = zeros(3);
    f_bump = zeros(3);
    [frame_a.f; frame_a.t] = -C*[r_rela - r_rela0; phi_rela - phi_rela0];
  else
*/
  /*
  der(phi) = {w_rela[1] + (s1*w_rela[2] - c1*w_rela[3])*s2/c2,c1*w_rela[2] + s1
    *w_rela[3],(-s1*w_rela[2] + c1*w_rela[3])/c2};
 */
  w_rela = {der(phi[1]) + s2*der(phi[3]),c1*der(phi[2]) - s1*c2*der(phi[3]),s1*
    der(phi[2]) + c1*c2*der(phi[3])};
  
  frame_b.v = S_rel*(frame_a.v + v_rela + cross(frame_a.w, r_rela));
  frame_b.w = S_rel*(frame_a.w + w_rela);
  
  f_bump[1] = if (r_rela[1] - r_rela0[1] > r_max[1]) then C[1, 1]*bumpFactor*(
    r_rela[1] - r_rela0[1] - r_max[1]) + D[1, 1]*bumpFactor*v_rela[1] else if (
    r_rela[1] - r_rela0[1] > r_min[1]) then 0 else C[1, 1]*bumpFactor*(r_rela[1]
     - r_min[1]) + D[1, 1]*bumpFactor*v_rela[1];
  f_bump[2] = if (r_rela[2] - r_rela0[2] > r_max[2]) then C[2, 2]*bumpFactor*(
    r_rela[2] - r_rela0[2] - r_max[2]) + D[2, 2]*bumpFactor*v_rela[2] else if (
    r_rela[2] - r_rela0[2] > r_min[2]) then 0 else C[2, 2]*bumpFactor*(r_rela[2]
     - r_min[2]) + D[2, 2]*bumpFactor*v_rela[2];
  f_bump[3] = if (r_rela[3] - r_rela0[3] > r_max[3]) then C[3, 3]*bumpFactor*(
    r_rela[3] - r_rela0[3] - r_max[3]) + D[3, 3]*bumpFactor*v_rela[3] else if (
    r_rela[3] - r_rela0[3] > r_min[3]) then 0 else C[3, 3]*bumpFactor*(r_rela[3]
     - r_min[3]) + D[3, 3]*bumpFactor*v_rela[3];
  [frame_a.f + f_bump; frame_a.t] = -C*[r_rela - r_rela0; phi_rela - phi_rela0]
     - D*[v_rela; {der(phi[1]) + s2*der(phi[3]),c1*der(phi[2]) - s1*c2*der(phi[
    3]),s1*der(phi[2]) + c1*c2*der(phi[3])}];
  /*
  end if;
*/
  
  -frame_b.f = S_rel*frame_a.f;
  -frame_b.t = S_rel*(frame_a.t - cross(r_rela, frame_a.f));
  
  rotationVector.S = S_rel;
  rotationVector.THETA = phi_rela;
  /*
initial equation 
  der(r_rela) = zeros(3);
  der(phi) = zeros(3);
*/
end SpringDamperLinearBump3D_freeMotion;

VehicleDynamics.Utilities.Forces.SpringDamperTable3D VehicleDynamics.Utilities.Forces.SpringDamperTable3D

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

VehicleDynamics.Utilities.Forces.SpringDamperTable3D

Information


This class provides a translational and rotational 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. In this version, no cross-coupling effects are considered, i.e. forces and torques are only generated in the direction of deflection.

This must be fixed together with the parameterisation.
  s_rel0a:      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 classVehicleDynamics.Utilities.Forces.Utilities.ForceTable1D to the model and write forceTable=[name] in the modifiers row
  Mass and inertia properties not yet solved!  

Parameters

NameDefaultDescription
r_rela0[3]{0,0,0}Unstretched translational spring vector [m]
phi_rela0[3]{0,0,0}Unstretched rotational spring vector [rad]
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 SpringDamperTable3D 
  "SpringDamperTableLine3D - nonlinear translational and rotational spring-damper model to use with ModelicaAdditions.MultiBody"
   
  
  extends ModelicaAdditions.MultiBody.Interfaces.Interact2;
  parameter SI.Position[3] r_rela0={0,0,0} "Unstretched translational spring vector";
  parameter SI.Angle[3] phi_rela0={0,0,0} "Unstretched rotational spring vector";
  
protected 
  SI.Angle[3] phi_rela;
public 
  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 
  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);
  
protected 
  VehicleDynamics.Utilities.Forces.Utilities.RotationVector rotationVector;
  ModelicaAdditions.Tables.CombiTable1D r1(table=data.r1);
  ModelicaAdditions.Tables.CombiTable1D phi1(table=data.phi1);
  ModelicaAdditions.Tables.CombiTable1D v1(table=data.v1);
  ModelicaAdditions.Tables.CombiTable1D w1(table=data.w1);
  Utilities.ForceTable3D data;
  ModelicaAdditions.Tables.CombiTable1D r2(table=data.r2);
  ModelicaAdditions.Tables.CombiTable1D r3(table=data.r3);
  ModelicaAdditions.Tables.CombiTable1D v2(table=data.v2);
  ModelicaAdditions.Tables.CombiTable1D v3(table=data.v3);
  ModelicaAdditions.Tables.CombiTable1D phi2(table=data.phi2);
  ModelicaAdditions.Tables.CombiTable1D phi3(table=data.phi3);
  ModelicaAdditions.Tables.CombiTable1D w2(table=data.w2);
  ModelicaAdditions.Tables.CombiTable1D w3(table=data.w3);
equation 
  
  fb = S_rel*fa;
  tb = S_rel*ta - S_rel*cross(r_rela, fa);
  
  {r1.inPort.signal[1],r2.inPort.signal[1],r3.inPort.signal[1]} = r_rela - 
    r_rela0;
  {v1.inPort.signal[1],v2.inPort.signal[1],v3.inPort.signal[1]} = v_rela;
  
  {phi1.inPort.signal[1],phi2.inPort.signal[1],phi3.inPort.signal[1]} = 
    phi_rela - phi_rela0;
  {w1.inPort.signal[1],w2.inPort.signal[1],w3.inPort.signal[1]} = w_rela;
  
  rotationVector.S = S_rel;
  rotationVector.THETA = phi_rela;
  
  fa = {r1.outPort.signal[1] + v1.outPort.signal[1],r2.outPort.signal[1] + v2.
    outPort.signal[1],r3.outPort.signal[1] + v3.outPort.signal[1]};
  ta = {phi1.outPort.signal[1] + w1.outPort.signal[1],phi2.outPort.signal[1] + 
    w2.outPort.signal[1],phi3.outPort.signal[1] + w3.outPort.signal[1]};
end SpringDamperTable3D;

VehicleDynamics.Utilities.Forces.SpringDamperLinear3D VehicleDynamics.Utilities.Forces.SpringDamperLinear3D

VehicleDynamics.Utilities.Forces.SpringDamperLinear3D

Information


This class provides a translational and rotational linear spring damper. No correlation effects between rotation and translation is considered here!

  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 classVehicleDynamics.Utilities.Forces.Utilities.ForceTable1D to the model and write forceTable=[name] in the modifiers row
  Mass and inertia properties not yet solved!  

Parameters

NameDefaultDescription
r_rela0[3]{0,0,0}Unstretched translational spring vector [m]
phi_rela0[3]{0,0,0}Unstretched rotational spring vector [rad]
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 SpringDamperLinear3D 
  extends ModelicaAdditions.MultiBody.Interfaces.Interact2;
  parameter SI.Position[3] r_rela0={0,0,0} "Unstretched translational spring vector";
  parameter SI.Angle[3] phi_rela0={0,0,0} "Unstretched rotational spring vector";
  
protected 
  SI.Angle[3] phi_rela;
public 
  VehicleDynamics.Utilities.Forces.Utilities.RotationVector rotationVector;
  
public 
  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 
  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);
  
protected 
  Utilities.Coefficients3DLinear data;
equation 
  
  [fa; ta] = -data.C*[phi_rela - phi_rela0; r_rela - r_rela0] - data.D*[v_rela; 
     w_rela];
  //fa = -data.Ct*(r_rela - r_rela0) - data.Dt*v_rela;
  //ta = -data.Cr*(phi_rela - phi_rela0) - data.Dr*w_rela;
  
  fb = S_rel*fa;
  tb = S_rel*ta - S_rel*cross(r_rela, fa);
  
  rotationVector.S = S_rel;
  rotationVector.THETA = phi_rela;
end SpringDamperLinear3D;

VehicleDynamics.Utilities.Forces.ElastoGap VehicleDynamics.Utilities.Forces.ElastoGap

1D translational spring damper combination with gap

VehicleDynamics.Utilities.Forces.ElastoGap

Information


A linear translational spring damper combination that can lose contact with flange_a, thus, the spring-damper can only push. Unlike the Modelica.Mechanics.Translational.ElastoGap this component takes the dynamics of the damper into account. This removes the problem with the ElastoGap generating unphysical force spikes in the pullinig direction. The difference is illustrated i the figures below.

Standard ElastoGap

Figure 1 The standard ElastoGap.

New ElastoGap

Figure 2 The new ElastoGap takes the dynamics of the damper into account which gives a different motion.

A suggestion is instead to make two verion, push and pull, wher push would be a proper ElastoGap and pull would be typically a "rubber spring."

Release Notes:


Parameters

NameDefaultDescription
s_rel00unstretched spring length [m]
c1spring constant [N/m]
d1damping constant [N/ (m/s)]

Modelica definition

model ElastoGap "1D translational spring damper combination with gap"
   
  
  extends Modelica.Mechanics.Translational.Interfaces.Compliant;
  parameter SI.Position s_rel0=0 "unstretched spring length";
  parameter Real c(
    final unit="N/m", 
    final min=0) = 1 "spring constant";
  parameter Real d(
    final unit="N/ (m/s)", 
    final min=0) = 1 "damping constant";
  SI.Velocity v_rel "relative velocity between flange L and R";
  Boolean Contact "false, if s_rel > l ";
  Real s1;
  Real v1;
  Real aux;
  
equation 
  
  v_rel = der(s_rel);
  //  Contact = s_rel < s_rel0;
  //  f = if Contact then (c*(s_rel - s_rel0) + d*v_rel) else 0;
  
  v1 = der(s1);
  aux = -s1*c/d;
  v1 = if (v_rel < -s1*c/d and Contact) then v_rel else -s1*c/d;
  
  Contact = s1 >= s_rel;
  
  f = if Contact then (c*(s_rel - s_rel0) + d*v_rel) else 0;
  
end ElastoGap;

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