The following script changes the SimulationMode property in the database. The new value is in effect, after the servers have been restarted.
#!/usr/bin/python
#
# this script sets the SimulationMode property for all devices
# of the specified classes that belong to PETRA-3 servers. If the
# mode is not specified, the current value of the property is displayed
#
import string
from PyTango import *
classes = [ 'DGG2', 'MCA8715', 'OmsVme58', 'SIS3610',
'SIS3820', 'TIP551', 'TIP830u20', 'VFCADC']
db = Database()
if len( sys.argv) == 1:
print( "\n usage: ./setSim.py [0|1]\n")
for clss in classes:
devices = db.get_device_name( clss + "/PETRA-3", clss)
for dev in devices:
print( dev, "sim:", db.get_device_property( dev, ['SimulationMode']))
print( "\n usage: ./setSim.py [0|1]\n")
sys.exit()
if (len( sys.argv) != 2) or (sys.argv[1] != '0' and sys.argv[1] != '1'):
print( "\n usage: ./setSim.py [0|1]\n")
sys.exit()
flag = string.atoi( sys.argv[1])
for clss in classes:
devices = db.get_device_name( clss + "/PETRA-3", clss)
for dev in devices:
db.put_device_property( dev,{'SimulationMode': [ flag]})
print( dev, db.get_device_property( dev, ['SimulationMode']))