Module SENSORM :: GENPOLY
Generic polynomial conversion function.
Syntax
GENPOLY( VIN, [NORDER,] VCOEFFS, VOUT )
Parameters
- VIN
- Input data values
- FLOAT PIPE
- NORDER
- Order of the polynomial function
- WORD CONSTANT
- VCOEFFS
- Coefficients of the polynomial
- FLOAT VECTOR
- VOUT
- Output data values
- FLOAT PIPE
Description
The GENPOLY command is a general purpose
mapping from a stream of input data received from pipe
VIN , to produce a stream of output data in
pipe VOUT. One common application of this command
is mapping measurements of an arbitrary nonlinear sensor into
the equivalent measurement in the desired physical units.
The polynomial mapping is determined by the VCOEFFS
vector. The coefficients specified in this vector start
with the zero-order term, followed by the first-order term,
followed by the second-order term, etc. up to the order
specified by the NORDER parameter. If you omit
the NORDER parameter, the command will count
terms and assume the corresponding maximum order.
Using only a first-order polynomial, this command becomes
equivalent to a SCALE command. From the opposite
point of view, this command covers the functionality of the
SCALE command at the same time that it performs
nonlinear mappings. When using this command for "linearizing"
the response of a nonlinear sensor, it can at the same time
provide gain and offset corrections.
Examples
VECTOR VCOEFFS FLOAT = ( 1.0, 3.085e-3, -5.707e-7 )
CONSTANT ORDER WORD = 2
...
GENPOLY( PIN, ORDER, VCOEFFS, POUT )
Take values X from the PIN
pipe one at a time, and for each one apply the
second-order polynomial mapping
Y = 1.0 + 3.085e-3*X + -5.707e-7*X2
to obtain the values Y that are placed into
the output data stream POUT.
See also:
SCALE, RTD, THERMPOLY
|