This function block calculates the variance of a specified number of values.
Based on the formula
the following calculation has been implemented:
The function block supports two types of variances:
Type 1: Simple
Until the number of values is reached, the input signals are combined to intermediate results. When the last input signal is processed, the variance is calculated and written to the Varianc output. After that the process starts again. The previous variance is output until the new result is calculated. The number of values that was specified in the parameter dialog is available on the ValNbr output.
Type 2: Simple triggered
At this type, the function block receives an additional Trigger input. As long as a HI signal is written on this input, the input signals are combined to intermediate results and the counter for the number of values is incremented. After that, during the first cycle which has a LO signal on the Trigger input, the variance is calculated and output. The number of values is written to ValNbr. The previous values for the variance and the number of values remain on the outputs until the new results are calculated.
The type of variance can only be set in Edit mode. The number of values can be entered in Edit mode (then the entered value is used by the class and all new created instances) and in Run mode (the value is only used by the current instance).
If the type of variance is changed in the class, the same type will be assigned to all existing instances of the function block. If the new type is the simple variance, the number of values that was specified in the class will be written to all instances.
The dialog cannot be opened during online observation.
|Activate the calculation
|Number of values
The calculation is performed with FLOAT values. Therefore precision problems may occur at wide dispersion of the input signal.