OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk::RuleRuntime

Per-rule evaluation state. POD, one per rule.

Public attributes

state

AlarmState state = AlarmState::kUnknown

Where the last Evaluate() left the rule. This is the field to read and to show; the rest of this struct is the machinery that produced it.

on_count

uint32_t on_count = 0

Consecutive observations qualifying for a higher level than the current one. The rise happens on the observation where this exceeds the count Condition::on_delay works out to at the observed interval: a delay of three intervals rises on the fourth qualifying observation in a row, which is the first one taken three intervals after the condition began to hold. Any observation that does not qualify resets it, as do kDisabled, kOrphaned and kInhibited.

The first observation after kUnknown, kDisabled, kOrphaned or kInhibited adopts its level immediately and bypasses both delays -- a delay shapes a change, not an arrival.

off_count

uint32_t off_count = 0

The same, for observations qualifying for a lower level, and counted against Condition::off_delay. Independent of on_count, and only one of the two is ever non-zero, which is what makes a slow-to-arm, fast-to-drop alarm expressible.

last_value

double last_value = 0.0

The previous observation's value, kept only so Compare::kChanged has something to subtract from. Updated on every observation with a valid input, including while the rule is inhibited, so releasing an inhibit does not present the rule with an apparent jump. Not updated while kDisabled or kOrphaned.

has_last_value

bool has_last_value = false

False until the first valid observation. A kChanged rule therefore cannot fire on its first observation: there is nothing to compare against, and it reports kClear rather than a change from zero.

latched

bool latched = false

Set while a latching rule is holding kActive after its condition released. Acknowledge() clears it; the state then falls on the next evaluation and only if the condition really has released, so acknowledging a still-ringing alarm re-arms the latch instead of silencing it. Always false for a non-latching rule.

held_by_latch

bool held_by_latch = false

True when state is kActive only because the latch held it there: the bands and the delays had settled below kActive on this observation and step 6 raised it back.

This is the difference between "the value is still outside the limit" and "the value came back and an operator has not acknowledged yet". Acknowledging clears the first case's latch and the condition immediately re-arms it, so the alarm keeps ringing; acknowledging the second releases the alarm. Without this an application has to re-implement the evaluator -- bands, hysteresis and both delays -- to tell the two apart, and that copy drifts.

Always false for a non-latching rule, and false in kDisabled, kOrphaned and kInhibited: those are not kActive, whatever the latch holds. See RuleEngine::StatusOf().