Deriv

Description:              This function returns the derivative (rate of change) of a value.

Returns:                    Numeric

Usage:                       Steady State

Format:                      Deriv(Value, Time)

Parameters:             Value     { numeric }  { required }  { no default }
          Normally, the name of a variable holding a numeric value for which the derivative will be taken.

                                    Time     { numeric }  { required }  { no default }
          Any numeric expression giving the maximum time in seconds between derivative function updates.

Comments:               This function takes the change in the Value parameter between two successive evaluations and divides by the elapsed time interval between these evaluations. If the Value changes from invalid to valid, it will take two evaluations before the function's result becomes valid. This function is the inverse of Intgr.

                             The time parameter is necessary because of VTS's evaluation method of not doing any calculations unless necessitated by a change in a parameter. This means that if the Value remains unchanged, the Deriv function will be recalculated after the time interval specified by the Time parameter and return 0.

                             This function is often used in control functions such as PID loops where it makes up the "D" in the "PID".

Example:

Alarm(Deriv(pressure, 0.1) > 10 ||

      Deriv(pressure, 0.1) < 5 { Alarm trigger }, 

      0, 0, 0, 32768, 0, 0 { Alarm attributes }, 

      "PRESS. RATE!", pressure, "PSI/SEC"{ Messages }); 

This triggers an alarm when pressure increases at a rate faster than 10 psi/sec or decreases faster than 5 psi/sec. The rate of change of pressure is checked every 0.1 seconds. To make this an absolute rate of change alarm, use the Abs function as follows:

Alarm(Abs(Deriv(pressure, 0.1)) > 10 { Alarm trigger },

      0, 0, 0, 32768, 0, 0 { Alarm attributes }, 

      "PRESSURE RATE!", pressure, "PSI/SEC" 

      { Messages }); 

This triggers an alarm when pressure increases or decreases faster than 10 psi/sec.

See Also:

Intgr | PID