Skip to content

Commit

Permalink
test syntax highlighting?
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed Aug 17, 2020
1 parent dc41707 commit a44e847
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions _docs/alarm.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Alarm
==========

Alarm System Overview
----------------------

Alarms are represented as :class:`~.alarm.Alarm` objects, which are created and managed by the
:class:`~.alarm.Alarm_Manager`. A collection of :class:`~.alarm.Alarm_Rule` s
define the :class:`~.alarm.Condition` s
Expand All @@ -10,9 +13,60 @@ continuously fed :class:`~.message.SensorValues` objects during :meth:`.PVP_Gui.
:meth:`.PVP_Gui.handle_alarm` method. The alarm manager also updates alarm thresholds set as :attr:`.Condition.depends`
when control parameters are set (eg. updates the ``HIGH_PRESSURE`` alarm to be triggered 15% above some set ``PIP`` ).

Alarm Rule Example
~~~~~~~~~~~~~~~~~~~

One :class:`~.alarm.Alarm_Rule` is defined for each :class:`~.alarm.AlarmType` in :data:`.alarm.ALARM_RULES`.

An alarm rule defines:

* The conditions for raising different severities of an alarm
* The dependencies between set values and alarm thresholds
* The behavior of the alarm, specifically whether it is :attr:`~.Alarm_Rule.latch` ed or :attr:`~.Alarm_Rule.persistent`

::

Alarm_Rule(
name = AlarmType.LOW_PRESSURE,
latch = False,
persistent = False,
conditions = (
(
AlarmSeverity.LOW,
condition.ValueCondition(
value_name=ValueName.PIP,
limit=VALUES[ValueName.PIP]['safe_range'][0],
mode='min',
depends={
'value_name': ValueName.PIP,
'value_attr': 'value',
'condition_attr': 'limit',
'transform': lambda x : x-(x*0.10)
}
)
),
(
AlarmSeverity.MEDIUM,
condition.ValueCondition(
value_name=ValueName.PIP,
limit=VALUES[ValueName.PIP]['safe_range'][0]- \
VALUES[ValueName.PIP]['safe_range'][0]*0.15,
depends={
'value_name': ValueName.PIP,
'value_attr': 'value',
'condition_attr': 'limit',
'transform': lambda x: x - (x * 0.15)
},
mode='min'
) + \
condition.CycleAlarmSeverityCondition(
alarm_type = AlarmType.LOW_PRESSURE,
severity = AlarmSeverity.LOW,
n_cycles = 2
)
)
)
)


Main Alarm Module
Expand Down

0 comments on commit a44e847

Please sign in to comment.