Attribute Alarms

Dear all,

I have an attribute called "port" that I can read and write to from a client successfully. As shown below, when this attribute is read (I have set up polling on it), it will print the name of this attribute, as well as the current attribute quality (which by default is ATTR_VALID.


    def read_port(self, attr):
        self.debug_stream("In read_port()")
        attr.set_value(self.attr_port_read)
        self.info_stream("Attribute: %s has quality: %s" %(attr.get_name(), attr.get_quality()))

I have also set up alarm levels for this attribute e.g.
min_value' = '1'
max_value' = '50000'
min_warning' = '100'
max_warning' = '20000'
min_alarm' = '10'
max_alarm' = '30000'

Externally from a client, I am changing the value of this port to test out the alarm system. When I change the values below/above these thresholds, I get an INFO log from the device server e.g.

"1431509771 [139644008130304] WARN test/device/1 MIN WARNING for attribute port"
"1431509819 [139644008130304] ERROR test/device/1 MAX ALARM for attribute port"

Based on the documentation here, I expect the attribute quality to change to ATTR_WARNING or ATTR_ALARM respectively. But this is not happening and the attribute still has an ATTR_VALID quality. On the other hand, the device state IS switching to Alarm (when previous state is ON). So something is definitely working as it should, except for attribute quality.

Any thoughts? Thanks! smile
Dr Andrea DeMarco, BSc (Hons) (Melita), MSc (Melita), DPhil (UEA)
Lecturer | Researcher
Department of Physics
Institute of Space Sciences and Astronomy

Room 220, Maths and Physics Building
University of Malta, Msida MSD2080, MALTA
Hello Drea,

Could you check the attribute quality factor on the client side?
Is it still ATTR_VALID whatever the attribute value is?

Cheers

Emmanuel
Hi Manu,

Thanks - I have checked and on the client side, the quality factor is as expected:
quality = PyTango._PyTango.AttrQuality.ATTR_ALARM

Here is some sample output, before and after causing an alarm from the client side

In[5]: data = tpm_instance["port"]
In[6]: print data
DeviceAttribute[
data_format = PyTango._PyTango.AttrDataFormat.SCALAR
      dim_x = 1
      dim_y = 0
 has_failed = False
   is_empty = False
       name = 'port'
    nb_read = 1
 nb_written = 1
    quality = PyTango._PyTango.AttrQuality.ATTR_VALID
r_dimension = AttributeDimension(dim_x = 1, dim_y = 0)
       time = TimeVal(tv_nsec = 0, tv_sec = 1431523008, tv_usec = 988076)
       type = PyTango._PyTango.CmdArgType.DevULong
      value = 10000
    w_dim_x = 1
    w_dim_y = 0
w_dimension = AttributeDimension(dim_x = 1, dim_y = 0)
    w_value = 10000]

In[7]: tpm_instance.port = 50000
In[8]: data = tpm_instance["port"]
In[9]: print data
DeviceAttribute[
data_format = PyTango._PyTango.AttrDataFormat.SCALAR
      dim_x = 1
      dim_y = 0
 has_failed = False
   is_empty = False
       name = 'port'
    nb_read = 1
 nb_written = 1
    quality = PyTango._PyTango.AttrQuality.ATTR_ALARM
r_dimension = AttributeDimension(dim_x = 1, dim_y = 0)
       time = TimeVal(tv_nsec = 0, tv_sec = 1431523029, tv_usec = 988169)
       type = PyTango._PyTango.CmdArgType.DevULong
      value = 50000
    w_dim_x = 1
    w_dim_y = 0
w_dimension = AttributeDimension(dim_x = 1, dim_y = 0)
    w_value = 50000]

On the other hand, the info stream keeps reporting:
1431523107 [140294393669376] INFO test/tpm_board/1 Attribute: port has quality: ATTR_VALID
Dr Andrea DeMarco, BSc (Hons) (Melita), MSc (Melita), DPhil (UEA)
Lecturer | Researcher
Department of Physics
Institute of Space Sciences and Astronomy

Room 220, Maths and Physics Building
University of Malta, Msida MSD2080, MALTA
Hello Drea,

Thsi is the Tango kernel which is changing the attribute value from ATTR_VALID to ATTR_ALARM on the server side but after
the execution of your read_port() method and before the data are sent back on the network to the client. This is why in your
method you still see it as ATTR_VALID

Hoping this help

Emmanuel
Hi Manu,

But this may happen (maybe) the first time the quality changes from ATTR_VALID to ATTR_ALARM. Since I am re-polling read_port() continuously after the actual ATTR_ALARM is raised, I wonder why it is kept on being reported as ATTR_VALID in the device server, whilst it is correct AATR_ALARM when retrieved from the client. I keep polling read_port() every 3000 milliseconds, and yet the INFO stream keeps reporting ATTR_VALID.

Thanks,
Andrea
Dr Andrea DeMarco, BSc (Hons) (Melita), MSc (Melita), DPhil (UEA)
Lecturer | Researcher
Department of Physics
Institute of Space Sciences and Astronomy

Room 220, Maths and Physics Building
University of Malta, Msida MSD2080, MALTA
Hi all,

I was wondering if you could give me generic advice on writing a Tango device. Assuming I have set alarm levels for certain attributes, the device state changes to ALARM when these levels are skipped. Assuming I take corrective measures on the same attribute, to bring the levels back down to an acceptable state, with a valid Quality for the attribute, the device state, by default, remains in ALARM mode.

What would be the ideal way of "listening" to what caused the alarm in the first place, taking measures to fix the alarm on the client side, and reverting the state of the device back to something like ON? Any sample code for such a listener is appreciated. I would like a sort of central listener for ALARMS that I can handle asynchronously when/if alarms occur.

Thanks,
Andrea
Dr Andrea DeMarco, BSc (Hons) (Melita), MSc (Melita), DPhil (UEA)
Lecturer | Researcher
Department of Physics
Institute of Space Sciences and Astronomy

Room 220, Maths and Physics Building
University of Malta, Msida MSD2080, MALTA
Hi Andrea,

Did you checked TANGO Device Server Guidelines:
http://ftp.esrf.fr/pub/cs/tango/tangodesignguidelines-revision-6.pdf

If there is something missing, could you please create an issue on github documentation project:
https://github.com/tango-controls/tango-doc/issues

Best regards,
Lukasz
Kind Regards,
Lukasz Zytniak

Control Software Engineer
—————————————————————
 
Register or login to create to post a reply.