Int('Expression','Reset')
Arguments
|
'Expression' |
Measured value |
|
|
'Reset' |
Optional digital parameter, which can be used to reset the integral or suppress the integration process. ‘Reset’ can be an expression as well. |
|
|
'Reset' > 0 |
Integral is reset. |
|
|
'Reset' = 0 |
Integration released (default) |
|
Description
This function returns the integral (y * dt) of 'Expression' as its result. The ‘Reset’ parameter can be used for resetting the integral to zero or suppressing the integration process, e.g. to integrate the same signal for periodical occurrences or reversing processes a number of times. ‘Reset’ can be an expression as well.
Examples:
|
Int([0:0]) |
No reset happens ('Reset' omitted) |
|
Int([0:0],If(Mod(T(),20)=0,TRUE(),FALSE())) |
The integral is reset every 20 seconds. |
|
Int([0:0], [3.1]) |
e.g. with [3.1] = If([0:0]>10, 1, 0) The integral is reset as soon as the expression [3.1] returns TRUE, i.e. if the expression [0:0] exceeds the limit value 10. |
Example 1
Tip |
|
|---|---|
|
This function can be used in a virtual retentive module. Its result values can thus be obtained via stopping and restarting the measurement. |
|
If 'Expression' is an acceleration signal, the distance covered can be determined by iteratively performing the Int-function.
Task description
The speed and distance covered should be determined with the help of an acceleration sensor.
Solution
In the figure below the blue curve shows the measured acceleration, the red curve shows the calculated course of speed and the green curve shows the calculated distance covered.

Tip |
|
|---|---|
|
If only the distance covered is of interest, this can also be determined by recursively
using the |
|
Example 2
The integral should be restarted at an interval of 20 seconds.
Task description
The modulo function can be used to reset the integral since every 20 seconds T() mod 20 = 0 applies.
Solution

|
Red |
Time function |
Blue |
Modulo20 of the time function |
|
Green |
Measured value |
Yellow |
Integral of the measured value with 20 seconds reset |