Device state not changing to ALARM
|
|
---|---|
Hi all, I have designed a device which has an attribute "temperature", which reads temperature from a board. When reading the attribute, I am outputting some information to the debug stream like so:
From some client code, I am configuring the attribute with the following:
This code sets alarm values of 40 (min) and 60 (max), and starts polling the attribute every second. This works, and I can see the debug_stream output every second, report temperature correctly. I then use Jive (or other client code) to reset the max_alarm value to 50 (from 60), to cause an alarm. The debug_stream shows the following:
As can be seen, the ERROR shows when MAX ALARM is caught, but I expect the device state to go into ALARM and not remain in ON state. Why could this be happening? 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, I guess you overloaded the dev_state method. Did you use Pogo to generate the code? In Python or PythonHL? It might be that there is something missing in the generated code? I did a quick test and I get the following generated code in python:
Pogo generates the following for PythonHL:
And the following in C++:
The Python and C++ code generation look very similar but a line seem to be missing in the Python version, the line equivalent to the following C++ line just after the protected region:
I am not a pyTango expert so this might be normal. I will let the pyTango experts confirm. As I am more used to work in C++, I can tell you that the code just after the protected region in C++ is the important part of the code which will check for attributes in alarm and change your state to ALARM if you've set the state to ON before. If you still have problems and if you overloaded the dev_state method, could you please send us your code for this method? Hoping this helps. Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new. |
|
|
---|---|
Hi Reynald, Thanks for your detailed reply. Let me try to answer as best I can. 1) I did not overload the dev_state method. 2) I am using PyTango8 8.1.1, with standard Python POGO code generation (not PythonHL) I am recreating the problem very easily with a minimal working example here. The following is the device code. It is a dumb device, with 2 states ON/ALARM, and a single attribute "temperature".
In order to test the code, I have the following client side code that I am debugging with. Essentially: (1) Create a device proxy. (2) Read current temperature attribute (starts at 0.0) (3) Set a fake temperature of 45 and read it again (correctly 45.0) (4) Configure the attribute a FIRST time with alarm settings of 40 (min) and 100 (max), and start polling every second. (5) Heat up the device a bit by putting it to 65 and read it again (correctly 65.0) (6) Reconfigure the alarm a SECOND time, with alarm settings of 40 (min) and 60 (max), whilst retaining the previous polling on.
From the debug stream:
If I open the device in AtkPanel, I can see the temperature attribute in orange colour (ALARM), but the device state is still green (ON). Something seems really wrong :( EDIT: If I simply start the device, and modify the temperature via AtkPanel, and set up alarm max/min via Jive, then the device works as expected - the device goes to ALARM state! So something is wrong with how the attribute/alarm is being configured via my code, or via PyTango…. 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 |
|
|
---|---|
I have created a workaround for the problem. In the device code itself, I have added the following command:
From the device proxy (client), the code to set an alarm for an attribute would be like:
Doing things this way, the ALARM state is triggered as expected! So essentially, something is possibly wrong with set_attribute_config() in PyTango? Cheers, 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 |
|
|
---|---|
Dear Andrea, you should not need the workaround but there is obviously a bug which is preventing you from using the correct approach. I wonder if you are suffering from this bug: https://sourceforge.net/p/tango-cs/bugs/645/ To be sure I ran your code in the Tango 9.2 VM which I am currently preparing with PyTango9 and Tango 9.2.0. The result is as you expect i.e. the bug has disappeared and your client and server display the alarm correctly as shown in this screenshot: Andy |
|
|
---|---|
Hi Andy, Thanks for the reply. It looks like it really is that bug! We're still using Tango8 until PyTango9 is released of course - so for now the workaround will do. Looking forward to having a full release of PyTango9 with all the goodies in there :) 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 |
|
|
---|---|
Not long to wait now - PyTango9 + Tango 9.2.1 will be released this Friday (so I am told) … |
|
|
---|---|
Excellent - thanks for the heads up! :)
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 guys, Never believe what a boss is saying when talking about future package availability Cheers Manu PS : I couldn't resist |
|
|
---|---|
Haha, Thanks :) For the time being Tango8 is good enough anyway :) 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 |