Moving Average


We are curretly using a moving average over 5min at a rate of 1 sec for the machine speed.
I use to log this average speed with rsview 32.
Now with Ignition things could be much easier to log this value but I want to push the envelope. :smiling_imp: 

 :arrow_right:  Can I execute a moving average in ignition with script and sqltag and use this tag in my loggin strategy?

  This will give me the opportunity to remove code use for data logging with no real automation purpose.


Iā€™m not sure you even need to log a moving average - seems like you can just derive it on the fly when you retrieve the data.

Hi Gary,

To do this Ill need a DB tag that as a script to do the Movin average.

MVA = SUM(Xn) / n
ex MVA 5 min scan at 1sec n=300
so I need an array of 300 with a roll over last value on a full array get drop.

 :question: Can I do something like this with script  :question: 


Yes, you could write a script that gets the average of a value over the last 5 minutes, and then make a DB tag that uses a runScript expression to drive its value.