Class Trigger
Fires once when a reading crosses a line, and not again until it has come back past the release band.
public sealed class Trigger : IDisposable
- Inheritance
-
Trigger
- Implements
- Inherited Members
Remarks
A thermostat answers the same question as a level to hold; a trigger answers it as an event to act on, which is what a rule wants.
Properties
Hysteresis
Gets the release band on the far side of the line, as a magnitude.
public float Hysteresis { get; }
Property Value
IsSet
Gets whether the condition currently holds.
public bool IsSet { get; }
Property Value
Threshold
Gets the line the trigger watches.
public float Threshold { get; }
Property Value
WatchesAbove
Gets whether the trigger watches a rising reading, as Above(float, float) makes it.
public bool WatchesAbove { get; }
Property Value
Methods
Above(float, float)
Creates a trigger that fires when a reading rises above the line and clears once it has fallen below the line by the hysteresis.
public static Trigger Above(float threshold, float hysteresis)
Parameters
thresholdfloatThe line a rising reading crosses.
hysteresisfloatHow far below the line the reading must fall to clear.
Returns
- Trigger
The trigger, which starts cleared.
Below(float, float)
Creates a trigger that fires when a reading falls below the line and clears once it has risen above the line by the hysteresis.
public static Trigger Below(float threshold, float hysteresis)
Parameters
thresholdfloatThe line a falling reading crosses.
hysteresisfloatHow far above the line the reading must rise to clear.
Returns
- Trigger
The trigger, which starts cleared.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Update(float)
Feeds a reading in and reports the edge it caused.
public Edge? Update(float reading)
Parameters
readingfloatThe latest measured value. One that is not a finite number is ignored.