Section 8. Processing and Math Instructions
8-4
Average Spatial Output Example
This example uses AvgSpa to find the average value of the five elements Temp(6)
through Temp(10) and store the result in the variable AvgTemp.
AvgSpa(
AvgTemp, 5, Temp(6)
)
Running Average
Calculates a running average of a measurement or calculated value.
Syntax
AvgRun(
Dest, Reps, Source, Number
)
Remarks
AvgRun is used to create a running average. A running average is the average
of the last N values where N is the number of values.
Dest
X
N
i
i
i N
=
=
=
∑
1
Where
X
N
is the most recent value of the source variable and
X
N
−
1
is the
previous value (
X
1
is the oldest value included in the average, i.e., N-1 values
back from the most recent).
Parameter
& Data Type
Enter
AvgRun Parameters
Dest
Variable 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
BeginProg
'Program begins here
Scan( RATE, RUNITS, 0, 0 )
'Scan 1(mSecs),
'______________________ Volt Blocks ______________________
VoltDiff(HiVolts, VREP1, VRNG1, 5, 1, 0, VDLY1, VINT1, VMULT1, VOSET1)
AvgRun(AvgOut,1,HiVolts,100 ) 'Put the average of 100 HiVolts in AvgOut
CallTable MAIN
'Go up and run Table MAIN
Next Scan
'Loop up for the next scan
EndProg
'Program ends here
Summary of Contents for CR9000
Page 6: ...CR9000 Table of Contents iv This is a blank page ...
Page 22: ...CR9000 Overview OV 16 This is a blank page ...
Page 26: ...Section 1 Installation 1 4 CR9000 FIGURE 1 1 3 CR9000 Battery Pack ...
Page 72: ...Section 3 CR9000 Measurement Details 3 28 This is a blank page ...
Page 88: ...Section 5 Program Declarations 5 6 This is a blank page ...
Page 217: ...This is a blank page ...