Kepware Knowledge Base: Solution
How Do Average Tags Work?
Last Update: 2018/11/07
Average Tags calculate the running average value of a Source Tag. The calculation is controlled using a separate Run or Trigger Tag (usually Boolean). The calculation will begin when the Run Tag's value transitions from a zero (Off) to a non-zero (On) state. When the Run Tag transitions back to zero, the calculation will stop and the Average Tag will retain the last calculated average value. When the Run Tag returns to a non-zero state, the calculations will start new. The calculation takes two samples of the scan rate of the tag being averaged, and then averages them. At the next sample, the previous average value and the new sample value will be averaged. This process repeats until the Run Tag transitions to a non-zero value. If the Source Tag's value does not change after the second sample, all subsequent calculations will produce a value that slowly creeps towards the static sample value. The table below displays the averaging process when the sample values are always changing.
Run Tag | Source Tag | Average Tag |
0 | 1 | UNK |
1 | 3 | UNK |
1 | 8 | 5.5 |
1 | 25 | 15.25 |
1 | 11 | 13.125 |
0 | 75 | 13.125 |
0 | 19 | 13.125 |
0 | 12 | 13.125 |
1 | 14 | 13.125 |
1 | 7 | 10.5 |
Note: The table below displays the averaging process when the first two samples are different, but the sample value remains the same during subsequent samples.
Run Tag | Source Tag | Average Tag |
0 | 1 | UNK |
1 | 0 | UNK |
1 | 0 | 0 |
1 | 10 | 5 |
1 | 10 | 7.5 |
1 | 10 | 8.75 |
1 | 10 | 9.375 |
1 | 10 | 9.6875 |
Note 1: If the server starts and the Run Tag is a non-zero value, the average value's calculation will not begin because the Run Tag never transitioned from zero to non-zero. To start, the Run Tag must transition to zero and then back to non-zero.
Note 2: If the Run Tag has never transitioned to a non-zero value to start calculations, the Average Tag's value will be unknown.
©
2021
PTC Inc. All Rights Reserved.