Package org.xtce.math
Class PolynomialCalibration
- java.lang.Object
-
- org.xtce.math.PolynomialCalibration
-
- All Implemented Interfaces:
Calibration
public class PolynomialCalibration extends Object implements Calibration
Class to apply a calibration specified in an XTCE document in the form of a Polynomial Calibrator.- Author:
- David Overeem
-
-
Constructor Summary
Constructors Constructor Description PolynomialCalibration(PolynomialType polynomialElement, XTCEValidRange validRange, int rawSizeInBits, XTCETypedObject.RawType rawTypeName)Constructs a Calibration object based on the PolynomialType element in the XTCE document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Numbercalibrate(Number xValue)Apply this Polynomial Calibrator to an uncalibrated value.Numberuncalibrate(Number yValue)Apply this Polynomial Calibrator to an already calibrated value.
-
-
-
Constructor Detail
-
PolynomialCalibration
public PolynomialCalibration(PolynomialType polynomialElement, XTCEValidRange validRange, int rawSizeInBits, XTCETypedObject.RawType rawTypeName)
Constructs a Calibration object based on the PolynomialType element in the XTCE document.- Parameters:
polynomialElement- PolynomialType containing the data.validRange- XTCEValidRange object associated with the typed object so that a "best" uncalibrated value can be deduced during the usage of the uncalibrate() method.rawSizeInBits- int containing the raw encoding size in bits to help deduce a "best" uncalibrated value when using the uncalibrate() method.rawTypeName- RawType enumeration containing the raw encoding type to help deduce a "best" uncalibrated value when using the uncalibrate() method.
-
-
Method Detail
-
calibrate
public Number calibrate(Number xValue) throws XTCEDatabaseException
Apply this Polynomial Calibrator to an uncalibrated value. This method doesn't care which order the coefficient/exponent terms appears because of the commutative property of addition, so any sequence of terms may be specified in XTCE and this function will apply them as they are specified. This function is not concerned with the encoding type (integer or float) when performing the calculation. The calculation is always done in the floating point space and if the engineering type is integer, then it will be later rounded back. This could be a point of controversy.- Specified by:
calibratein interfaceCalibration- Parameters:
xValue- Number containing the uncalibrated value.- Returns:
- Number containing the calibrated value after the calibration.
- Throws:
XTCEDatabaseException- in the event that the PolynomialCalibrator does not have any terms, which would also be invalid in the XTCE document when the schema is checked against the document.
-
uncalibrate
public Number uncalibrate(Number yValue) throws XTCEDatabaseException
Apply this Polynomial Calibrator to an already calibrated value. This method doesn't care which order the coefficient/exponent terms appears because of the commutative property of addition, so any sequence of terms may be specified in XTCE and this function will apply them as they are specified. This function is not concerned with the encoding type (integer or float) when performing the calculation. The calculation is always done in the floating point space and if the engineering type is integer, then it will be later rounded back. This could be a point of controversy.- Specified by:
uncalibratein interfaceCalibration- Parameters:
yValue- Number containing a calibrated value.- Returns:
- Number containing the uncalibrated value after the reverse calibration operation.
- Throws:
XTCEDatabaseException- in the event that the PolynomialCalibrator does not have any terms, which would also be invalid in the XTCE document when the schema is checked against the document. The exception can also be thrown in the event that there are no real roots for a quadratic uncalibrate or the polynomial has a higher order than a quadratic, which is not currently supported by this toolkit.
-
-