Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Averaging over the last 10 minutes of an interval


FSRG May 25, 2009 09:16 PM

I"m trying to get the CR1000 to scan every 3 seconds but only collect data for the last 10 minutes of the DataInterval. At the end of the 10 minutes, I'd like to write some statistics from the period. In other words, I'd like to write data every 30 minutes which are the average of the last 10 minute period.

Does Campbell (or anyone) have some elegant solution to this?

thanks


aps May 26, 2009 02:52 PM

Here is one out of several possible ways to do this. I uses the Disablevariable in the statistics calculations to block their inclusion in the stats, if set. (I am afraid some of the comments may wrap around)

'Declare Public Variables
'Example:
Public PTemp, batt_volt, donotusedata As Boolean

'Define Data Tables
DataTable (Test,True,1000)
DataInterval (0,30,min,10)
'The statistical instructions have a variable in the Disable parameter to allow
'statistics to be blcoked according to the variable - set in the main scan
Average (1,PTemp,FP2,donotusedata)
Minimum (1,batt_volt,FP2,donotusedata,False)
EndTable

'Main Program
BeginProg
donotusedata = true 'set to block initial use in stats.
Scan (3,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
'20 mins into the interval set the variable that blocks use of the data to false
If TimeIntoInterval (20,30,min) Then donotusedata=False
CallTable Test
'If the table has output then block use of the data again (for the first 20 mins)
If test.output Then donotusedata=True
NextScan
EndProg

Log in or register to post/reply in the forum.