Panic-The Alba Alarm System


Hi Andy, I think that you've found a bug in last version of fandango. I'm still trying to reproduce and I'll notify you as soon as I found the fix.

Sergi
Keep on dancing,

http://www.tango-controls.org/resources/howto/how-fandango/
And regarding Ambar … I have to clarify some usage of the API.

The Alarm.severity is just a classification of the alarm in a category (ALARM,SEVERITY,DEBUG,…) ; but it doesn't tell you if the alarm is active or not.

To know if the alarm has been activated you must use the Alarm.get_active() method; that will connect to the PyAlarm device server and return the time when the alarm was activated; or 0 if it is not active.

The Alarm.active value will cache the last get_active() result; but will not update the value unless you call get_active().

All non-callable members of the Alarm class are just passive variables, not python properties. Thus, you need to call the get_…() methods to updated them.

Hope this solved your issue,

Sergi Rubio

Keep on dancing,

http://www.tango-controls.org/resources/howto/how-fandango/
Hi Andy,

Andy
I have a problem with an alarm formula that does not work as I would like it to. The formula is
elin/master/op != ON
which evaluates to True even when the linac is ON. Any ideas why this is so? Here is the output from the report:

TAG: LINAC
Formula: elin/master/op != ON

Values are:
elin/master/op: DeviceAttribute[
name = 'State'
value = PyTango._PyTango.DevState.ON

Definitely this problem with the state it's the same that you experienced with <pre>sim/motor/1/position</pre>: an AttributeValue object is being returned instead of the attribute value itself.

The fact is that I'm completely unable to reproduce your problem.


import PyTango
adp = PyTango.DeviceProxy('test/alarms/1')
d = 'lab/cpd/temperatures'
PyTango.DeviceProxy(d).state()
Out: PyTango._PyTango.DevState.ON
adp.evaluateFormula(d)
Out: '0'
adp.evaluateFormula(d+'/State')
Out: '0'
adp.evaluateFormula(d+' ==  ON')
Out: 'True'
adp.evaluateFormula(d+' !=  ON')
Out: 'False'

I'm using PyTango 8.1.6 and a fresh checkout of fandango and PyAlarm from repository … could you confirm me if you are using exactly the same packages?


svn co https://svn.code.sf.net/p/tango-cs/code/share/fandango/trunk/fandango fandango
svn co https://svn.code.sf.net/p/tango-ds/code/DeviceClasses/SoftwareSystem/PyAlarm/trunk .
python PyAlarm.py $INSTANCE &

Sergi

Keep on dancing,

http://www.tango-controls.org/resources/howto/how-fandango/
Edited 8 years ago
Hi Sergi

Thanks for the above solution for the max function. It worked.

I have one more query

Can we set the quality of attribute using receiver ? If Yes, How ?

Thanks and Regards
TCS-GMRT Team

Regards,
TCS_GMRT
TCS_GMRT
Can we set the quality of attribute using receiver ? If Yes, How ?

Sorry, but no. The quality (as a part of the value) of an attribute must be set within the device owning that attribute.

Of course you can write a value to an attribute from an alarm, but the read quality of the attribute must be set by the device (or as a combination of the value and the Tango configuration of the attribute).


Keep on dancing,

http://www.tango-controls.org/resources/howto/how-fandango/
Hi Sergi

I studied the document for Panic-Alarm provided.

I am not getting the meaning of following configurations:

1. Enabled
2. EvalTimeout
3. Startup Delay
4. RethrowAttribute
5. RethrowState
6. AlarmThreshold
7. UseProcess

I set the reminder = 20. It doesn't throw the reminder after 20 second also.

Also can we set action if alarms recovers in AlarmReceiver.
Suppose rule is l/m/n/Speed>34
Lets say now value of Speed is 36. Thus rule is true. I have set the action in alarmreceiver as ACTION(alarm:attribute,l/m/n/Alarm_Status,"Alarm occured")
Now Value of speed becomes 30. Now can I set the action to set the alarm status as "Alarm recovered".

Thanks and Regards
TCS-GMRT Team
Regards,
TCS_GMRT
Edited 8 years ago
Meanings are:

* StartupDelay: the device will wait before starting to evaluate the alarms (e.g. giving some time to the system to recover from a powercut).

* Enabled: if False or 0 the PyAlarm it equals to disabling all alarm actions of the device; if it is True the behavior will be the normal expected; if it has a numeric value (e.g. 120) it means that the device will evaluate the alarms but not execute actions during the first 120 seconds (thus alarms can be activated but no action executed). It is used to prevent a restart of the device to re-execute all alarms that were already active.

* EvalTimeout: The proxy timeout used when evaluating the attributes (any read attribute slower than timeout will raise exception).

* AlarmThreshold: number of cycles that an alarm must evaluate to True to be considered active (to avoid alarms on "glitches").

* RethrowAttribute/RethrowState: Whether exceptions on reading attributes or states should be rethrown to higher levels, thus causing the alarm to be triggered. By default alarms are enabled if an State attribute is not readable (RethrowState=True), but when a numeric attribute is not readable its value is just replaced by None (RethowAttribute=False) and the formula evaluated normally.

* Reminder: A new email will be sent every XX seconds if the alarm remains active. When AlertOnRecovery is True an email will be sent also every time when the formula result oscillates from True to False.

* UseProcess: This is an experimental feature, like UseTaurus and others. In general, I advice you to not modify any parameter that is not detailed in the PyAlarm user guide as you may obtain unexpected results. Some parameters are used to test new features still under development and their behavior may vary between commits.

Regarding actions on recovery … this option is planned but not yet fully available. Actually just emails are sent when AlertOnRecovery is True. This feature may be implemented in the next 6 months or so but the syntax is still to be decided.

Sergi

ALBA Synchrotron
Keep on dancing,

http://www.tango-controls.org/resources/howto/how-fandango/
Edited 8 years ago
Hi Sergi,

I have the latest PyTango (8.1.7) and fandango and panic from SF. I can try to get the again. Anyway here is the output I get from python when I try the same as you did:

>>> import PyTango
>>> adp = PyTango.DeviceProxy('test/alarms/1')
>>> d = 'elin/master/op'
>>> PyTango.DeviceProxy(d).state()
PyTango._PyTango.DevState.ON
>>> adp.evaluateFormula(d)
"DeviceAttribute[\ndata_format = PyTango._PyTango.AttrDataFormat.SCALAR\n      dim_x = 1\n      dim_y = 0\n has_failed = False\n   is_empty = False\n       name = 'State'\n    nb_read = 1\n nb_written = 0\n    quality = PyTango._PyTango.AttrQuality.ATTR_VALID\nr_dimension = AttributeDimension(dim_x = 1, dim_y = 0)\n       time = TimeVal(tv_nsec = 0, tv_sec = 1441902343, tv_usec = 305273)\n       type = PyTango._PyTango.CmdArgType.DevState\n      value = PyTango._PyTango.DevState.ON\n    w_dim_x = 0\n    w_dim_y = 0\nw_dimension = AttributeDimension(dim_x = 0, dim_y = 0)\n    w_value = None]\n"
>>> adp.evaluateFormula(d+'/State')
"DeviceAttribute[\ndata_format = PyTango._PyTango.AttrDataFormat.SCALAR\n      dim_x = 1\n      dim_y = 0\n has_failed = False\n   is_empty = False\n       name = 'State'\n    nb_read = 1\n nb_written = 0\n    quality = PyTango._PyTango.AttrQuality.ATTR_VALID\nr_dimension = AttributeDimension(dim_x = 1, dim_y = 0)\n       time = TimeVal(tv_nsec = 0, tv_sec = 1441902343, tv_usec = 305273)\n       type = PyTango._PyTango.CmdArgType.DevState\n      value = PyTango._PyTango.DevState.ON\n    w_dim_x = 0\n    w_dim_y = 0\nw_dimension = AttributeDimension(dim_x = 0, dim_y = 0)\n    w_value = None]\n"
>>> adp.evaluateFormula(d+' ==  ON')
'False'
>>> adp.evaluateFormula(d+' !=  ON')
'True'
>>> 
>>> print PyTango.__version__
8.1.7
>>>


Thanks for your help!

Andy
Sergi,

I checked out the latest versions of fandango and PyAlarm and have the same result as in my previous post. If you have any other ideas how I can track down the problem let me know.

Andy
Hi Sergi

I have three devices : a/a/a/Speed
a/a/b/Speed
a/a/c/Speed
I have to group them.
Syntax is:any([t>10 for t in FIND(a/a/*/Speed)])

But now i have to group 2 of them, not 3.
I am using the below syntax
Syntax: any([t>10 for t in [a/a/a/Speed,a/a/b/Speed]])


Following error comes:
NameError: name 'a' is not defined


What is the correct syntax ?

Thanks and Regards
TCS-GMRT Team
Regards,
TCS_GMRT
Edited 8 years ago
 
Register or login to create to post a reply.