PowerOutage#

class lsst.ts.watcher.rules.PowerOutage(config, log=None)#

Bases: BaseRule

Monitor the PDUs for signs of a power outage.

Parameters:

Methods Summary

compute_alarm_severity(data, **kwargs)

Compute and set alarm severity and reason.

determine_schneider_severity_and_reason()

Determine the severity and reason for Schneider UPSs.

determine_ups_severity_and_reason(start_time)

Determine the severity and reason for all UPSs.

get_schema()

Return a jsonschema as a dict, to validate configuration.

Methods Documentation

compute_alarm_severity(data, **kwargs)#

Compute and set alarm severity and reason.

Parameters:
  • data (salobj.BaseMsgType) – Message from the topic described by topic_callback.

  • **kwargs (dict [str, typing.Any]) –

    Keyword arguments. If triggered by TopicCallback calling update_alarm_severity, the arguments will be as follows:

    • topic_callback : TopicCallback Topic callback wrapper.

Return type:

tuple[AlarmSeverity, str] | None

Returns:

  • None, if no change or unknown, or a tuple of two values

  • severity (lsst.ts.idl.enums.Watcher.AlarmSeverity) – The new alarm severity.

  • reason (str) – Detailed reason for the severity, e.g. a string describing what value is out of range, and what the range is. If severity is NONE then this value is ignored (but still required) and the old reason is retained until the alarm is reset to nominal state.

Notes

You may return NoneNoReason if the alarm state is NONE.

determine_schneider_severity_and_reason()#

Determine the severity and reason for Schneider UPSs.

Under normal circumstances Schneider UPSs emit telemetry with zeros in between telemetry with non-zero values. During a power outage only zeros are emitted. Therefore only after a certain amount of zeros the condition of a power outage can be ensured. This method checks for that condition before determining the severity and reason.

Returns:

  • severity (lsst.ts.idl.enums.Watcher.AlarmSeverity) – The new alarm severity.

  • reason (str) – Detailed reason for the severity, e.g. a string describing what value is out of range, and what the range is. If severity is NONE then this value is ignored (but still required) and the old reason is retained until the alarm is reset to nominal state.

determine_ups_severity_and_reason(start_time)#

Determine the severity and reason for all UPSs.

When a power outage starts, the generator will start. This takes a certain amount of time during which the severity will be WARNING. After that time the severity will be CRITICAL.

Parameters:

start_time (float) – The start time (TAI seconds) at which the power outage started.

Returns:

  • severity (lsst.ts.idl.enums.Watcher.AlarmSeverity) – The new alarm severity.

  • reason (str) – Detailed reason for the severity, e.g. a string describing what value is out of range, and what the range is. If severity is NONE then this value is ignored (but still required) and the old reason is retained until the alarm is reset to nominal state.

classmethod get_schema()#

Return a jsonschema as a dict, to validate configuration.

Notes

Please provide default values for all fields for which defaults make sense. This makes watcher configuration files easier to write.

If your rule has no configuration then return None.

We recommend that you write the schema as yaml, for compactness, then use yaml.safe_load to convert it to a dict. For example:

schema_yaml = """
    $schema: http://json-schema.org/draft-07/schema#
    description: Configuration for MyRule
    type: object
    properties:
    ...
    required: [...]
    additionalProperties: false
"""
return yaml.safe_load(schema_yaml)