# Find ALL the devices with a String, set 1 to Enable, 0 to Disable them def UpdateAllDevices(target): deviceDataset = system.device.listDevices() for i in range(0, deviceDataset.getRowCount()): deviceName = deviceDataset.getValueAt(i, "Name") if target == 0: system.device.setDeviceEnabled(deviceName, target) print "Device: Disabled %s"%(deviceName) if target == 1: system.device.setDeviceEnabled(deviceName, target) print "Device: Enabled %s"%(deviceName) #Update the devices with a specific string in the name. 1 to enable - 0 to disable def UpdateDeviceType(taget, deviceType): deviceDataset = system.device.listDevices() for i in range(0, deviceDataset.getRowCount()): deviceName = deviceDataset.getValueAt(i, "Name") if deviceName.find(deviceType)>-1: if target == 0: system.device.setDeviceEnabled(deviceName, target) print "Device: Disabled %s"%(deviceName) if target == 1: system.device.setDeviceEnabled(deviceName, target) print "Device: Enabled %s"%(deviceName) def UpdatePanelParams(path, namespace, opc, tagname): subpaths = [{'name':'/AC Primary Power Fault', 'ext':'.JA_01'}, {'name':'/AC Secondary Power Fault', 'ext':'.JA_02'}, {'name':'/DC Power Supply 1 Fault', 'ext':'.JA_03'}, {'name':'/DC Power Supply 2 Fault', 'ext':'.JA_04'}, {'name':'/High Temperature', 'ext':'.TAH'}, {'name':'/Panel Intrusion', 'ext':'.XA'}] print "===== Updating Panel Parameters =====" for subtag in subpaths: tagpath = str(path) + str(subtag['name']) tag = system.tag.getConfiguration(tagpath) name = str(tagname) + str(subtag['ext']) tag[0]['parameters']['Namespace'] = namespace tag[0]['parameters']['OPC'] = opc tag[0]['parameters']['Tag'] = name system.tag.configure(path, tag, "o") print "updating: " + str(subtag) print "===== Panel Parameters Updated =====" def UpdateUTParams(path, namespace, opc, tagname): subpaths = [{'name':'/Liquid Level Alarm', 'ext':'.LA'}, {'name':'/Liquid Temperature Alarm High', 'ext':'.TAH'}, {'name':'/Liquid Temperature Alarm High High', 'ext':'.TAHH'}, {'name':'/Pressure Relief Device Alarm', 'ext':'.PRD_ALM'}, {'name':'/Pressure Switch', 'ext':'.PSW'}, {'name':'/Rapid Rise Relay Tripped', 'ext':'.RRR_TRIP'}, {'name':'/Rapid Rise Relay Warning', 'ext':'.RRR_ALM'}, {'name':'/Source 1 Switch', 'ext':'.ZSO01'}, {'name':'/Source 2 Switch', 'ext':'.ZSO02'}, {'name':'/Vacuum Fault Interrupter1 Tripped', 'ext':'.VFI01'}, {'name':'/Vacuum Fault Interrupter2 Tripped', 'ext':'.VFI02'}, {'name':'/Vacuum Switch', 'ext':'.VSW'}] for subtag in subpaths: tagpath = str(path) + str(subtag['name']) tag = system.tag.getConfiguration(tagpath) name = str(tagname) + str(subtag['ext']) tag[0]['parameters']['Namespace'] = namespace tag[0]['parameters']['OPC'] = opc tag[0]['parameters']['Tag'] = name system.tag.configure(path, tag, "o") #def setHistory(UDTNAme): #parentPath = "[default]_types_/Objects/TEST" #configs = system.tag.getConfiguration(parentPath, True) #for folder in configs[0]['tags']: # UDTName = [folder['name']][0] # print UDTName # UDTs = system.tag.getConfiguration(parentPath +'/'+ UDTName, True) # for tag in UDTs[0]['tags']: # if str(tag['tagType']) == 'AtomicTag': # tag['historyEnabled'] = True # print tag