OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Python API referencev12.0

alarms — functions

Rules over signals, and the one model behind all of them.

An alarm is a Rule: one signal, one Condition, and what to do about it. That is the whole model, and it is the same model whether the signal is a region's maximum temperature, the camera's own chip temperature, or a PIF input -- only SignalId differs. Everything that used to be spread across three unrelated mechanisms -- the warning band, the hysteresis dead-band, the delay in frames, latching -- is on the condition.

Attaching a rule to a region

camera.alarms.add(rule, region_id=...) fills the rule's signal slot in from the region id, so the index on a region-domain SignalId is discarded and should be left at zero. Passing a "real" number there reads as if it identified the region, and it does not -- a signal slot is not a region id.

camera.alarms.add(rule) with no region does no such filling in, and there the slot has to be right. That form is for a rule on the device itself, where there is no region to take it from.

What an event carries

An AlarmEvent carries its own cause: which region, which rule, which limit, and the value that crossed it. Only a transition that actually crossed something carries a limit, though: settling to ALARM_CLEAR on the first frame reports limit_kind == LIMIT_NONE with limit left at zero (NaN in Fahrenheit), and printing that zero as if it were a threshold is how "(limit 0.0)" ends up on every line of a log. Check AlarmEvent.has_limit first.

Units

A limit, a hysteresis and an event's value are in the unit of the signal the rule watches. For a temperature (a region's minimum, maximum, mean, median or percentile, the camera's probe temperatures, the scene's extremes) that is the SDK's temperature unit: Celsius unless optris_sdk.set_temperature_unit chose Fahrenheit. A hysteresis, a delta, a region's standard deviation and every limit of a rule with a reference (which are offsets) are temperature differences, in degrees of that unit with no offset: 2 K is 3.6 F. A PIF channel is in its own unit, which follows the SDK's only for a channel whose kind is a temperature. A coverage, an area, a count and a value the application publishes itself are never converted.

The callback fires on the SDK's action thread, never on the frame thread -- but it is still an SDK thread, so every rule in optris_sdk.callbacks applies.

limit_kind_name(kind)

Which limit a transition crossed, spelled out.

action_outcome_name(outcome)

What became of an alarm action, in words.

state_name(state)

An alarm state, spelled out rather than as an ordinal.