Alarm Service

The Alarm Service DSL is a wrapper for the Alarm Service module provided by CSW. You can refer to detailed documentation of the Alarm Service provided by CSW here.

This DSL provides an API to set the severity of an alarm. This is the component API for CSW Alarm Service. While this API is available for special purposes, alarms should be maintained by lower-level Assemblies and HCDs, and not in the Sequencers. This is also a problem because Sequencers do not always execute.

setSeverity

This API sets alarm severity for an AlarmKey to the provided level and keeps refreshing it in the background with the interval of config value csw-alarm.refresh-interval. Default value for csw-alarm.refresh-interval config is 3 seconds which is configured in downstream CSW alarm modules reference.conf file.

The setSeverity API requires user to provide AlarmKey and AlarmSeverity.

AlarmKey

AlarmKey represents unique alarm in the given subsystem and component e.g. nfiraos.trombone.tromboneaxislowlimitalarm

The following example demonstrates the creation of an AlarmKey

Kotlin
sourceval tromboneTemperatureAlarm =
        AlarmKey(Prefix(NFIRAOS, "trombone"), "tromboneMotorTemperatureAlarm")

AlarmSeverity

The supported AlarmSeverity levels are:

  1. Okay
  2. Warning
  3. Major
  4. Critical
  5. Indeterminate

The following example demonstrates the usage of the setSeverity API. In this example, a temperature FSM is created, and based on the state of the FSM, the severity is set accordingly.

State Temperature Severity
OK Temperature less than or equal to 40 Okay
ERROR Temperature is greater than 40 Major
Kotlin
source/**
 * temp <= 40   => Severity.Okay
 * else        => Severity.Major
 */
val temperatureFsm = Fsm("TEMP", OK) {
    state(OK) {
        entry {
            setSeverity(tromboneTemperatureAlarm, Okay)
        }

        on(temperatureVar.first() > 40) {
            become(ERROR)
        }
    }

    state(ERROR) {
        entry {
            setSeverity(tromboneTemperatureAlarm, Major)
        }

        on(temperatureVar.first() <= 40) {
            become(OK)
        }
    }
}

Source code for examples