Avgrun parameters – Campbell Scientific CR9000X Measurement and Control System User Manual
Page 295

Section 8. Processing and Math Instructions
C:\Program Files\Campbell Scientific\PC9V5B2\DataFile\ACCEL07.DAT
Accel2
Accel2RA
11/22/2005
15:45:41.000
11/22/2005
15:45:40.000
3
2
1
0
-1
-2
-3
0.062
11/22/2005
15:45:41.290
-0.028
11/22/2005
15:45:41.286
Chart 8-2 Running Average Signal Attenuation
The resultant delay, Delay in Time = (Scan Rate)(N-1)/2, is:
Delay = 2 mSec(10-1)/2 = 9 mSecs.
This is about 1/3 of the input signal's period, and Chart 8-2 shows this delay.
Parameter
& Data Type
Enter
AVGRUN PARAMETERS
Dest
Var or Array
The variable or array in which to store the average(s).
Reps
Constant
When the source is an array, this is the number of variables in the array to calculate averages for. When
the source is not an array or only a single variable of the array is to be averaged, reps should be 1.
Number
Constant
The number of values to include in the running average..
Source
Array
The name of the variable or array that is to be averaged.
'Example: Following code performs a running average on 6 reps of V (each element of the array will
'have its own running average computed over 100 Scans), stores the results in the VRA variable array,
'and samples the 6 running average values to a data table.
Public V(6), VRA(6)
Const Rep1 = 6
DataTable(Table1,True,-1)
DataInterval(0,0,0,10)
Sample(6,VRA,IEEE4)
EndTable
BeginProg
'Program begins here
Scan( RATE, RUNITS, 0, 0 )
'Scan 1(mSecs),
'______________________ Volt Blocks ______________________
VoltDiff(V(), REP1, mV50, 5, 1, 0, 30, 40, 1, 0)
AVGRUN
(VRA(),Rep1,V(),100)
'Avg 100 elements for each rep of V in VRA
CallTable MAIN
'Go up and run Table MAIN
Next Scan
'Loop up for the next scan
EndProg
'Program ends here
8-9