AvgSpa (Spatial Average)
The AvgSpa function computes the spatial average of a measurement.
Syntax
AvgSpa ( Dest, Swath, Source )
This example uses AvgSpa to find the average value of three variables and store the result in the variable AvgVolts.
Public HiVolts(3), AvgVolts
BeginProg
Scan(1,Sec,1,0)
VoltDiff(HiVolts(),3,mV
AvgSpa(AvgVolts,3,HiVolts())
NextScan
EndProg
This example uses AvgSpa to find the average value of the five elements HiVolt( 2 ) through HiVolts( 6 ) and store the result in the variable AvgVolts.
Public HiVolts(6), AvgVolts
BeginProg
Scan( 1,Sec, 1, 0 ) 'Scan 1(mSec), no fast buffer
'______________________ Volt Blocks ______________________
AvgSpa( AvgVolts,5,HiVolts(2)) 'Store avg of HiVolts(2..6) in AvgVolts
NextScan
EndProg
Remarks
The AvgSpa is calculated as:
Where X(j) = Source
If a NAN Not a number. A data word indicating a measurement or processing error. Voltage overrange, SDI-12 sensor error, and undefined mathematical results can produce NAN. is returned by the datalogger it is not included in the spatial average.
Source and/or Dest can be a Float Four-byte floating-point data type. Default datalogger data type for Public or Dim variables. Same format as IEEE4. or Long Data type used when declaring a variable as an integer. data type, but not a String A data type used when declaring a variable consisting of alphanumeric characters..
Parameters
Dest (Destination)
The Variable in which to store the results of the instruction. Right-click the parameter to display a list of defined variables.
If this instruction has a Repetitions parameter and it is greater than 1, the results are stored in an array with the variable name. The array must be dimensioned large enough to hold all of the values returned from all of the Reps.
Type: Variable or Array
Swath
The number of values of the array over which to perform the specified operation.
Type: Constant (or expression that evaluates as a constant)
For the AvgSpa function, the Swath parameter is the number of elements to include in the average.
Source
The name of the Variable that is the input for the instruction. Right-click the parameter to display a list of defined variables.
Type: Variable
For the AvgSpa function, the Source is the first variable in the array for which the spatial average should be calculated.
In the case where the Source used is a multidimensional array, a one-dimensional representation of the value is used in the Source.
Example: If the array is declared Public Source(3,4), to indicate Source(3,1) use Source(7).
Column 1 Column 2 Column 3 Row 1 1 2 3 Row 2 4 5 6 Row 3 7 8 9 Row 4 10 11 12
See also Multi-dimensional Arrays.
This instruction uses high precision math A normal single precision float has 24 bits of mantissa. With high precision, a 32 bit extension of the mantissa is saved and used internally, resulting in 56 bits of precision. Instructions that use high precision are Average, AvgRun, AvgSpa, CovSpa, MovePrecise, RMSSpa, StdDev, StdDevSpa, TotalRun, and Totalize.. A normal single precision float has 24 bits of mantissa. With high precision, a 32 bit extension of the mantissa is saved and used internally, resulting in 56 bits of precision. Instructions that use high precision are