Class Smoother
Smooths a noisy reading by weighting each new sample against the running value.
public sealed class Smoother : IDisposable
- Inheritance
-
Smoother
- Implements
- Inherited Members
Remarks
One noisy reading is rarely worth acting on. Feeding samples through a smoother lets a trend show without a single spike triggering a pump or an alarm.
Constructors
Smoother(float)
Creates a smoother at the given weight.
public Smoother(float weight)
Parameters
weightfloatHow much each new sample counts, between 0 and 1.
Properties
Value
Gets the current value, or null before the first sample.
public float? Value { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Reset()
Clears the smoother back to its initial state.
public void Reset()
Update(float)
Folds a sample in and returns the smoothed value.
public float Update(float sample)
Parameters
samplefloatThe latest raw reading.
Returns
- float
The smoothed value.