Skip to main content
13-Aquamarine
July 13, 2018
Solved

What's the mathematics logic of average tag?

  • July 13, 2018
  • 1 reply
  • 2464 views
Hi , I can't understand the mathematics logic of average tag in Kepware, as shown in the screenshot(screenshot from advanced tag help), How the following data transformed from 72.3 @ 10:00 72.5 @ 10:01 72.9 @ 10:02 73.4 @ 10:03 72.4 @ 10:04 71.6 @ 10:05 71.2 @ 10:06 70.5 @ 10:07 to 72.3 @ 10:00 72.4 @ 10:01 72.6 @ 10:02 72.8 @ 10:03 72.7 @ 10:04 72.6 @ 10:05 72.3 @ 10:06 72.1 @ 10:07 Please help. Thanks Tom
Best answer by ndionne-2

Hi, the example in the help file is showing that it is a rolling average.

(72.3+72.5)/2 = 72.4
(72.3+72.5+72.9)/3 = 72.6
(72.3+72.5+72.9+73.4)/4 = 72.8

And so on.

 

 

1 reply

ndionne-25-Regular MemberAnswer
5-Regular Member
July 16, 2018

Hi, the example in the help file is showing that it is a rolling average.

(72.3+72.5)/2 = 72.4
(72.3+72.5+72.9)/3 = 72.6
(72.3+72.5+72.9+73.4)/4 = 72.8

And so on.

 

 

5-Regular Member
July 16, 2018

Actually it is a running total. When the run tag transitions to a non zero value the input starts being sampled. The sample rate is based on the scan rate of the input tag.after the first 2 samples the samples are summed and divided by 2. The next sample value is added to the current average and that sum is divided by 2.

 

This continues untile the run tag transitions back to a zero value,

 

The average is done this way to save on memory resources. it would be impossible to maintain potentially hundreds of thousands of values in memory. The application memory usage would quickly reach the limits for a 32bit application.