Table of Contents

Class Trigger

Namespace
Pamoja.Kit
Assembly
Pamoja.Kit.dll

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

float

IsSet

Gets whether the condition currently holds.

public bool IsSet { get; }

Property Value

bool

Threshold

Gets the line the trigger watches.

public float Threshold { get; }

Property Value

float

WatchesAbove

Gets whether the trigger watches a rising reading, as Above(float, float) makes it.

public bool WatchesAbove { get; }

Property Value

bool

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

threshold float

The line a rising reading crosses.

hysteresis float

How 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

threshold float

The line a falling reading crosses.

hysteresis float

How 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

reading float

The latest measured value. One that is not a finite number is ignored.

Returns

Edge?

Set or Cleared the moment the state changes, or null while nothing changed.