Average of a tag, and estimation for a calculated value

Discussion created by lachlanholmes on Aug 17, 2010
Latest reply on Aug 19, 2010 by lachlanholmes

I have three tags defined in AF. Tag A provides a new value every 10 seconds or so, tag B is updated irregularly, sometimes only after 20 minutes, and tag C is calculated based on both: A * B.


Using the AF SDK, is there a way to get interpolated values for tag B? It is partly to get a better average, and also to use in calculating tag C.


Regarding the averaging, here's my thinking: If the value of tag B varies much, and the times it provides a value are not evenly spaced, then a reasonable estimate of the average is not equal to the sum of the points, divided by the number of points. For example, if I get the value 1 at 10am, and the values 30 and 29 at 10:58am and 10:59am, the average for 10-11am is not 1+30+29/3=20, it would be closer to 15 (1 at the start of the hour, ~30 at the end of the hour).


Regarding tag C, it seems that I can only get a value from it when tag B has a value. Not sure why it is working like that, because tag A doesn't have a value at that same second.


Any help would be greatly appreciated.