Use the search and browse feature to view Kepware's repository of more than 500 Knowledge Base articles. Narrow your results or type your query into the search field below.

Search Solutions Results By: View All Solutions

Kepware Knowledge Base: Solution


How Do Average Tags Work?


Last Update: 11/7/2018

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 TagSource TagAverage Tag
01UNK
13UNK
185.5
12515.25
11113.125
07513.125
01913.125
01213.125
11413.125
1710.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 TagSource TagAverage Tag
01UNK
10UNK
100
1105
1107.5
1108.75
1109.375
1109.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.

Related Products
Advanced Tags