FORTRAN example for tire force user subroutine

 

C---- SUB. TIRE_FORCE

      SUBROUTINE TIRE_FORCE

     &          (TIME,ITIME,CONPROP,TIREPROP,MASSPROP,UPAR,NPAR,

     &           JFLAG,IFLAG,TFSAE,RFSAE,FCOEF)

C---- TO EXPORT * SUBROUTINE

      !DEC$ ATTRIBUTES DLLEXPORT,C::TIRE_FORCE

 

C---- INCLUDE SYSTEM CALL

      INCLUDE 'SYSCAL.F'

 

C---- DEFINE VARIABLES

C     Parameter Information

C     TIME     : Simulation time of RD/Solver. (Input)

C     ITIME    : Past time for saved values. (Input)

C     CONPROP  : Contact property for computung Tire force. (Input)

C     TIREPROP : Geometry and Material property of TIRE. (Input)

C     MASSPROP : Mass property of TIRE. (Input)

C     UPAR     : Parameters defined by user. (Input)

C     NPAR     : Number of user parameters. (Input)

C     JFLAG    : When RD/Solver evaluates a Jacobian, the flag is true. (Input)

C     IFLAG    : When RD/Solver initializes arrays, the flag is true. (Input)

C     TFSAE    : Returned froce vector acting at the contact point in the SAE coordinate system. (Output, Size : 3)

C     RFSAE    : Returned torque vector acting at the contact point in the SAE coordinate system. (Output, Size : 3)

C     FCOEF    : Returned friction coefficients. (Output, Size : 2)

 

      DOUBLE PRECISION TIME, ITIME, UPAR(*)

      DOUBLE PRECISION CONPROP(*), TIREPROP(*), MASSPROP(*)

      INTEGER NPAR

      LOGICAL JFLAG, IFLAG

      DOUBLE PRECISION TFSAE[REFERENCE](3), RFSAE[REFERENCE](3)

      DOUBLE PRECISION FCOEF[REFERENCE](2)

 

C---- USER STATEMENT

      DOUBLE PRECISION VALUE1

      DOUBLE PRECISION zkForce, zcForce, new_zcForce

      DOUBLE PRECISION ver_stiff, pen, mass, damping, dot_pen, max_pen

      LOGICAL errflg

 

c     step function

      pen = CONPROP(4)

      max_pen = 0.01* TIREPROP(2)

      CALL rd_step(pen, 0, 0, max_pen, 1, 1, VALUE1, errflg)

 

c     CACLULATION FOR NORMAL FORCE

      ver_stiff = TIREPROP(3);

      zkForce = -ver_stiff*pen;

 

      mass = MASSPROP(1)

      damping = TIREPROP(8)

      dot_pen = CONPROP(5)

 

      new_zcForce = -2.0*sqrt(mass*abs(ver_stiff))*damping*dot_pen

      zcForce = VALUE1*new_zcForce

 

c     Z AXIS NORMAL FORCE

      TFSAE(3) = min(0.0, zkForce+zcForce)

 

      RETURN

      END