Intgr
(Engine-Level Function)
Description: | Time Integral. This function returns the time integral of a value. |
Returns: | Numeric |
Usage: | Steady State only. |
Function Groups: | Generic Math |
Related to: | Deriv | PID |
Format: | Intgr(Value, Time) |
Parameters: |
Value |
Required. Any numeric expression giving the value to integrate with respect to time. |
Time |
Required. Any numeric expression giving the maximum time in seconds between integral function updates. |
Comments: | The integral function takes the Value parameter, multiplies by the elapsed time and adds it to the accumulated value so far. If the Value changes from invalid to valid, the new valid result will start at zero. This function is the inverse of Deriv. The time parameter is necessary because of VTScada's evaluation method of not doing any calculations unless necessitated by a change in a parameter. This means that if Value remains unchanged, the Intgr function will be re-calculated after the time interval specified by the Time parameter. This function is often used in control functions such as PID loops where it makes up the "I" in the "PID." The Intgr function is reset when it appears in a true action trigger, when a state starts, or when it appears in a function which resets its parameters (e.g. Latch, Toggle, and Save). When Intgr is reset, the integral starts from zero again. |
Examples:
Speed = Intgr(Acceleration, 0.1);
This computes speed as the time integral of Acceleration. The integral starts when the state containing this function starts, and stops when the state stops. The integral is updated every 0.1 seconds.
RunTime = Intgr(MotorOn, 0.25);
This integrates a constant 1 while the motor is running, 0 otherwise. This computes the running time of the motor, accurate to 0.25 seconds.
This example illustrates how the function works. If you found this topic while searching for a way to monitor the run-time of equipment you are advised to use a History Statistics Tag, monitoring the non-zero time rather than building an expression.