Panic-The Alba Alarm System

PyTango is unable to create the Database device because it can detect the TANGO_HOST. Did you set the TANGO_HOST environment variable?

I sincerely advice you to read the Tango docs and previous posts in this topic. All the information regarding Panic assumes that the reader has a good level of Tango programming. You'll need some try and error to develop these skills; so please follow the documentation and practice with Tango so you'll get the knowledge to follow the most advanced guides.

Most PYALARM options are explained in the presentations/links I pasted before in this same post:

http://plone.tango-controls.org/tools/panic
http://plone.tango-controls.org/tools/panic/PANIC_at_PCAPAC_2014_FCO206_TALK.pdf
http://plone.tango-controls.org/tools/panic/pyalarm-device-server

Anyway, most of options don't need to be modified unless you have a deeper knowledge of Tango. I advice you to use the default values and play just with AlarmThreshold, PollingPeriod and Enable.

Don't modify the other properties until you'll have a better knowledge on how devices interact with each others (timeouts and exceptions).

Sergi

ADD: I migrated Panic docs to http://www.tango-controls.org/community/projects/panic/
Keep on dancing,

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

I have set the TAnGO_HOST environement variable and read the documents of PyAlarm device server.
1.) There no where i can found about how to link Panic GUI with Taurus
2.) I have to use Panic GUI over network.
I connected 2 PCS.
In PC-1, I am running the PyAlarm Device and Panic GUI
In PC-2, I set the tango host as the "IP oF PC-1:10000".
Now i am running the gui.py file and it is producing the following error

INFO 2015-08-04 11:44:09,226 TaurusRootLogger: Using "PyQt4" for Qt
MainThread INFO 2015-08-04 11:44:09,226 TaurusRootLogger: Using "PyQt4" for Qt
PyTangoArchiving.snap not available
loading devattrchange …
__main__ …
================================================================================
2015-08-04 11:44:10: Launching Panic …
================================================================================
2015-08-04 11:44:11: launching AlarmGUI … ['gui.py']
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2015-08-04 11:44:11: In AlarmGUI(): {}
showing splash … PyQt4.QtCore.QSize()
In AlarmAPI(*)
Tue Aug 4 11:44:11 2015: Loading PyAlarm devices matching *
Traceback (most recent call last):
File "gui.py", line 1001, in <module>
n = main(sys.argv[1:] or ([os.getenv('PANIC_DEFAULT')] if os.getenv('PANIC_DEFAULT') else [])).exec_()
File "gui.py", line 933, in main
alarmApp = AlarmGUI(filters='|'.join(a for a in sys.argv[1:] if not a.startswith('–')),options=opts,mainwindow=tmw)
File "gui.py", line 69, in __init__
self.api = panic.AlarmAPI()
File "/opt/TangoSoftwares/Panic_Alarm_Suite/fandango/objects.py", line 346, in __new__
cls.init_single(__instance,*p,**k) #If no __init__ or init_single has been defined it may trigger an object.__init__ warning!
File "/opt/TangoSoftwares/Panic_Alarm_Suite/panic/panic.py", line 558, in __init__
self.load(self.filters)
File "/opt/TangoSoftwares/Panic_Alarm_Suite/panic/panic.py", line 583, in load
all_devices = map(str.lower,fandango.tango.get_database_device().DbGetDeviceList(['*','PyAlarm']))
File "/usr/lib64/python2.7/site-packages/PyTango/device_proxy.py", line 211, in __DeviceProxy__getattr
raise AttributeError(name)
AttributeError: DbGetDeviceList



If I install it in single pc ,its running perfectly fine but I have to use over network
So How to use the Panic gui over network ?

Regards,
TCS_GMRT
Dear TCS-TEAM,

as Sergi says the problem seems to be due to panic gui not being able to connect to the database server from the pc where you are running it from. The stack dump basically says this:

all_devices = map(str.lower,fandango.tango.get_database_device().DbGetDeviceList(['*','PyAlarm']))
File "/usr/lib64/python2.7/site-packages/PyTango/device_proxy.py", line 211, in __DeviceProxy__getattr
raise AttributeError(name)
AttributeError: DbGetDeviceList

You should try to connect to the database from a python shell e.g. ipython or itango. Alternatively you can debug the application at this point.

Do you have any TANGO expert in your team who can help you? This is a fairly basic problem and not really specific to Panic.

Andy
Could you try this code in both PC-1 and PC-2 and paste here the output you get?


#!/usr/bin/python

import PyTango
db = PyTango.Database()
print(db.get_db_host())
print(db.get_db_port())
print(db.get_info())

import fandango
dbd = fandango.get_database_device()
print(dbd.DbInfo())
Keep on dancing,

http://www.tango-controls.org/resources/howto/how-fandango/
Edited 3 years ago
Hi Serbi/Andy

Now I am able to run Panic gui from other PC also. It was my mistake. I didnot set the path of PyTango in python path, thats why the above error was coming.

Thanks for the solution.


Thanks and Regards
TCS-GMRT Team
Regards,
TCS_GMRT

Then … what do you mean by "connecting Panic with Taurus"?

You can add the boolean attributes of the alarms to any Taurus widget,

Sergi
Keep on dancing,

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

Linking Panic with taurus means:

I have made one gui in taurus and there is one button in which I have to display the overall status of alarm.
If alarm comes it should be red and on recovery it should be green so the operator who uses taurus gui comes to know about the alarm status.
So how to achieve this ? Also what does "Use Taurus" specify ? It should be put "false" or "true" or "anything else" ?
How to add boolean attribute of alarm to taurus widget ?

My team is new to Tango so we are finding it bit difficult. You guys are the only people whom we can reach for help. And trust me you guys are doing amazing job, even after having so much work pressure , you take out time and reply to our/others queries.

Thanks and Regards
TCS-GMRT Team
Regards,
TCS_GMRT
Hi,

To display all alarms in a given control system I can use this code:

import taurus,PyQt4,panic
from taurus.qt.qtgui.panel import TaurusForm
qapp = PyQt4.Qt.QApplication([])

#Obtain all alarm attributes (get_attribute() returns just attr name, with full=True returns device/attr)
alarms = panic.api()
my_alarm_attribute = alarms['MY_ALARM'].get_attribute(full=True)
all_alarm_attributes = [a.get_attribute(full=True) for a in alarms.values()]

#Then create a taurusform and display the attributes
tf = TaurusForm()
tf.setWithButtons(False)
tf.addModels(all_alarm_attributes)

tf.show()
qapp.exec_()


The UseTaurus property is related to how each PyAlarm device connects to Tango, whether using the taurus.core classes or PyTango proxies instead.

It is an internal feature of the device server and it is still under test, so I advice you to keep it always equal to False. When the usage of taurus.core will be fully tested it will become True by default (if taurus is available).

Sergi


Keep on dancing,

http://www.tango-controls.org/resources/howto/how-fandango/
Well, the previous example will display leds in GREEN for active and "dull" green for inactive.

To display leds in RED you must execute a TaurusLed color replacement in all the models you added to the form

import taurus,PyQt4,panic
from taurus.qt.qtgui.panel import TaurusForm
qapp = PyQt4.Qt.QApplication([])

#Obtain all alarm attributes (get_attribute() returns just attr name, with full=True returns device/attr)
alarms = panic.api()
all_alarm_attributes = [a.get_attribute(full=True) for a in sorted(alarms.values())]

#Then create a taurusform and display the attributes
tf = TaurusForm()
tf.setWindowTitle('My Alarms')
tf.setWithButtons(False)
tf.addModels(all_alarm_attributes)

from taurus.qt.qtgui.display import TaurusBoolLed
for attr in sorted(all_alarm_attributes):
  #Get the widget in the form linked to this alarm attribute
  widget = tf.getItemByModel(attr)
  #Replacing the default Led in forms by a TaurusBoolLed
  widget.setReadWidgetClass(TaurusBoolLed)
  #Assigning RED as ON/True color
  widget.readWidget().setLedColor('RED')

tf.show()
qapp.exec_()
(if any taurus guru feels chest pain after reading that, please reply with a better recipe).

The code I pasted should display something like the attached screenshot.
Keep on dancing,

http://www.tango-controls.org/resources/howto/how-fandango/
Edited 3 years ago
I don't think this is correct ;)

The setLedColor will set RED for ON and "dull" RED for OFF.

There is setOnColor and setOffColor available for TaurusLed.

For having your screenshot, we must type :

widget.readWidget().setOnColor('RED')

With that, normally it will be like the screenshot.
Edited 3 years ago
 
Register or login to create to post a reply.