AvgInTime('Expression','Interval',' Reset=0')

Arguments

'Expression'

Measurement value for which the average is formed

'Interval'

Specification of the length of the interval in seconds

'Reset'

Optional parameter (default = 0) to stop and restart the calculation:

'Reset' = 0

Perform calculation

'Reset' = 1

Stop calculation and set result to 0

'Reset' = 2

Stop calculation and keep result

'Reset' = 3

Calculate now and then stop calculation

Description

This function returns the average value per time segment of the 'interval' length of 'Expression' as its result. The signal is written to the RAM of the computer. After an interval has passed, the arithmetic average value over this interval is evaluated.

Example

Effects of the 'Reset' parameter

Task description

The 'Reset' parameter should switch from 0 to 1, 2, or 3 in 5-second intervals in order to make the effects of the parameter visible.

Solution

Three if-queries relay, via a modulo function of the time, the value 0 and the values 1, 2, 3 in intervals of five seconds on the 'Reset' parameter of the AvgInTime function.