-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
whup whup - narrative documentation for software overview, all gui modules, all alarm modules, common.values , common.message (except for stuff manuel needs ta do), common.loggers (except for stuff manuel needs to do), common.prefs, common.unit_conversion - API documentation, docstrings for every method, user-facing attribute, function and constant in all the above. Only exception is gui.widgets.components which are p self explanatory - Figures for software overview, gui overview, gui screenshot - cleaned up dead/obsolete code with no uses in all the above * common module overview * testing module-level docstrings * Docstrings for values.py * splitting alarm into multiple files * basic description of alarms * actually adding to toctree * test syntax highlighting? * broken toctree * finding the right objects maybe? * continuing alarm docs removing persistent alarm rule attribute * moving example to alarm rule page adding docstring to alarm definition * toc in the main page * breaking into list * correct titles in alarm toc * link to alarm rule source * spacing in list * alarm manager documentation * test inheritance diagram alarm object documentation, condition documentation * condition documentation * importing correctly * add link to raw alarm definitions * prefs documentation * messages docs * put prefs below header so lists render right??? * test order of class and init docstrings * loggers documentation removing old log_exception function * unit conversions docs * alarm bar documentation * class style * source link color * control panel docs * display docs * plot docs * statement on components * wrapped supposed to raise exceptions my b
- Loading branch information
1 parent
5348009
commit 8197f67
Showing
34 changed files
with
1,332 additions
and
554 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Alarm Objects | ||
================ | ||
|
||
Alarm objects represent the state and severity of active alarms, but are otherwise intentionally quite featureless. | ||
|
||
They are created and maintained by the :class:`.Alarm_Manager` and sent to any listeners registered in :class:`.Alarm_Manager.callbacks` . | ||
|
||
.. automodule:: pvp.alarm.alarm | ||
:members: | ||
:undoc-members: | ||
:autosummary: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Alarm Manager | ||
================ | ||
|
||
The alarm manager is responsible for checking the :class:`.Alarm_Rule` s and maintaining | ||
the :class:`.Alarm` s active in the system. | ||
|
||
Only one instance of the :class:`.Alarm_Manager` can be created at once, and if it is | ||
instantiated again, the existing object will be returned. | ||
|
||
|
||
|
||
.. automodule:: pvp.alarm.alarm_manager | ||
:members: | ||
:undoc-members: | ||
:autosummary: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
Alarm Rule | ||
============ | ||
|
||
One :class:`.Alarm_Rule` is defined for each :class:`~.alarm.AlarmType` in :data:`.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. | ||
|
||
Example | ||
---------- | ||
|
||
As an example, we'll define a ``LOW_PRESSURE`` alarm with escalating severity. A ``LOW`` severity alarm | ||
will be raised when measured ``PIP`` falls 10% below set ``PIP``, which will escalate to a | ||
``MEDIUM`` severity alarm if measured ``PIP`` falls 15% below set ``PIP`` **and** the ``LOW`` severity | ||
alarm has been active for at least two breath cycles. | ||
|
||
First we define the name and behavior of the alarm:: | ||
|
||
Alarm_Rule( | ||
name = AlarmType.LOW_PRESSURE, | ||
latch = False, | ||
|
||
In this case, ``latch == False`` means that the alarm will disappear (or be downgraded in severity) | ||
whenever the conditions for that alarm are no longer met. If ``latch == True``, an alarm requires manual dismissal before | ||
it is downgraded or disappears. | ||
|
||
Next we'll define a tuple of :class:`.Condition` objects for ``LOW`` and ``MEDIUM`` severity objects. | ||
|
||
Starting with the ``LOW`` severity alarm:: | ||
|
||
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) | ||
}) | ||
), | ||
# ... continued in next block | ||
|
||
Each condition is a tuple of an (:class:`.AlarmSeverity`, :class:`.Condition`). In this case, | ||
we use a :class:`.ValueCondition` which tests whether a value is above or below a set ``'max'`` or ``'min'``, respectively. | ||
For the low severity ``LOW_PRESSURE`` alarm, we test if ``ValueName.PIP`` is below (``mode='min'``) some ``limit``, which | ||
is initialized as the low-end of ``PIP``'s safe range. | ||
|
||
We also define a condition for updating the ``'limit'`` of the condition (``'condition_attr' : 'limit'``), from the | ||
:attr:`.ControlSetting.value`` field whenever ``PIP`` is updated. Specifically, we set the ``limit`` to be 10% less than the | ||
set ``PIP`` value by 10% with a lambda function (``lambda x : x-(x*0.10)``). | ||
|
||
Next, we define the ``MEDIUM`` severity alarm condition:: | ||
|
||
( | ||
AlarmSeverity.MEDIUM, | ||
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.15) | ||
}, | ||
) + \ | ||
condition.CycleAlarmSeverityCondition( | ||
alarm_type = AlarmType.LOW_PRESSURE, | ||
severity = AlarmSeverity.LOW, | ||
n_cycles = 2 | ||
)) | ||
|
||
The first ``ValueCondition`` is the same as in the ``LOW`` alarm severity condition, except that it is | ||
set 15% below ``PIP``. | ||
|
||
A second :class:`.CycleAlarmSeverityCondition` has been added (with ``+``) to the :class:`.ValueCondition` | ||
When conditions are added together, they will only return ``True`` (ie. trigger an alarm) if all of the conditions are met. | ||
This condition checks that the ``LOW_PRESSURE`` alarm has been active at a ``LOW`` severity for at least two cycles. | ||
|
||
Full source for this example and all alarm rules can be found `here <_modules/pvp/alarm.html>`_ | ||
|
||
|
||
Module Documentation | ||
-------------------- | ||
|
||
.. automodule:: pvp.alarm.rule | ||
:members: | ||
:undoc-members: | ||
:autosummary: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Alarm Condition | ||
=================== | ||
|
||
Condition objects define conditions that can raise alarms. They are used by :class:`.Alarm_Rule` s. | ||
|
||
Each has to define a :meth:`.Condition.check` method that accepts :class:`.SensorValues` . | ||
The method should return ``True`` if the alarm condition is met, and ``False`` otherwise. | ||
|
||
Conditions can be added (``+``) together to make compound conditions, and a single call to ``check`` will only return true | ||
if both conditions return true. If any condition in the chain returns false, evaluation is stopped and | ||
the alarm is not raised. | ||
|
||
Conditions can | ||
|
||
.. inheritance-diagram:: pvp.alarm.condition | ||
|
||
.. automodule:: pvp.alarm.condition | ||
:members: | ||
:undoc-members: | ||
:autosummary: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
alarm | ||
Alarm | ||
========== | ||
|
||
Main Alarm Module | ||
------------------- | ||
|
||
.. automodule:: pvp.alarm | ||
:members: | ||
:undoc-members: | ||
:autosummary: | ||
Alarm System Overview | ||
---------------------- | ||
|
||
Alarm Manager | ||
---------------- | ||
* Alarms are represented as :class:`~.alarm.Alarm` objects, which are created and managed by the :class:`.Alarm_Manager`. | ||
* A collection of :class:`.Alarm_Rule` s define the :class:`.Condition` s for raising :class:`~.alarm.Alarm` s of different :class:`~.alarm.AlarmSeverity` . | ||
* The alarm manager is continuously fed :class:`~.message.SensorValues` objects during :meth:`.PVP_Gui.update_gui`, which it uses to :meth:`~.Alarm_Rule.check` each alarm rule. | ||
* The alarm manager emits :class:`~.alarm.Alarm` objects to the :meth:`.PVP_Gui.handle_alarm` method. | ||
* The alarm manager also updates alarm thresholds set as :attr:`.Condition.depends` to :meth:`.PVP_Gui.limits_updated` when control parameters are set (eg. updates the ``HIGH_PRESSURE`` alarm to be triggered 15% above some set ``PIP`` ). | ||
|
||
.. automodule:: pvp.alarm.alarm_manager | ||
:members: | ||
:undoc-members: | ||
:autosummary: | ||
Alarm Modules | ||
--------------- | ||
|
||
Alarm | ||
------------ | ||
.. toctree:: | ||
:hidden: | ||
|
||
.. automodule:: pvp.alarm.alarm | ||
:members: | ||
:undoc-members: | ||
:autosummary: | ||
Alarm Manager <alarm.alarm_manager> | ||
Alarm <alarm.alarm> | ||
Alarm Rule <alarm.alarm_rule> | ||
Alarm Condition <alarm.condition> | ||
|
||
Condition | ||
----------- | ||
.. raw:: html | ||
|
||
<div class="software-summary"> | ||
<a href="alarm.alarm_manager.html"><h2>Alarm Manager</h2></a> <p>Computes alarm logic and emits alarms to the GUI</p> | ||
<a href="alarm.alarm.html"><h2>Alarm</h2></a> <p>Objects used to represent alarms</p> | ||
<a href="alarm.alarm_rule.html"><h2>Alarm Rule</h2></a> <p>Define conditions for triggering alarms and their behavior</p> | ||
<a href="alarm.condition.html"><h2>Condition</h2></a> <p>Objects to check for alarm state</p> | ||
</div> | ||
|
||
.. automodule:: pvp.alarm.condition | ||
:members: | ||
:undoc-members: | ||
:autosummary: | ||
|
||
Alarm Rule | ||
----------- | ||
Main Alarm Module | ||
------------------- | ||
|
||
.. automodule:: pvp.alarm.rule | ||
.. automodule:: pvp.alarm | ||
:members: | ||
:undoc-members: | ||
:autosummary: | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
loggers | ||
Loggers | ||
========= | ||
|
||
|
||
|
||
.. automodule:: pvp.common.loggers | ||
:members: | ||
:undoc-members: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.