Class Calibration
Turns a raw sensor count into the units the reading is actually in.
public sealed class Calibration : IDisposable
- Inheritance
-
Calibration
- Implements
- Inherited Members
Remarks
A sensor reports counts, not litres or degrees; a calibration is the mapping between them, either stated outright or fitted through two known points.
Methods
Apply(float)
Converts a raw reading into calibrated units.
public float Apply(float raw)
Parameters
rawfloatThe raw sensor reading.
Returns
- float
The reading in real units.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Linear(float, float)
Creates a calibration applying raw * scale + offset.
public static Calibration Linear(float scale, float offset)
Parameters
scalefloatThe multiplier applied to the raw reading.
offsetfloatThe constant added after scaling.
Returns
- Calibration
The calibration.
TwoPoint(float, float, float, float)
Creates a calibration fitted through two known reference points.
public static Calibration TwoPoint(float rawLow, float valueLow, float rawHigh, float valueHigh)
Parameters
rawLowfloatThe raw reading at the low reference point.
valueLowfloatThe real value at the low reference point.
rawHighfloatThe raw reading at the high reference point.
valueHighfloatThe real value at the high reference point.
Returns
- Calibration
The calibration.