BASIC COMPONENT Bungee

USE OF UNITS
  TIMEUNIT = [s]

DECLARATION OF ELEMENTS
  CONSTANTS
    m (REAL [kg]) := 60.0 [kg],
    D (REAL [N*s/m]) := 10.0 [N*s/m],
    k (REAL [N/m]) := 50.0 [N/m],
    g (REAL [m/s^2]) := 9.81 [m/s^2],
    l (REAL [m]) := 20.0 [m]

STATE VARIABLES
  CONTINUOUS
    y (REAL [m]) := 0.0 [m],
    v (REAL [m/s]) := 0.0 [m/s]

DEPENDENT VARIABLES
  CONTINUOUS
    f (REAL [N]) := 0.0 [N]

DYNAMIC BEHAVIOUR
  
  DIFFERENTIAL EQUATIONS 
    y' := -v;
    v' := g + f/m;
  END
  #IF (y < l) 
  #DO 
  #  f := 0.0 [N]; 
  #END 
  #ELSE DO 
    f := - k*(-y) - D*v; # ursprünglich: (y-1) statt (-y)
  #END

END OF Bungee
