I am using Ignition version 8.1.3 and Vision.
The customer wants Ignition to tell the PLC if there are alarms active so that a buzzer/horn will sound when there are active alarms. A discussion with a coworker produced the following script:
#tag.quality needs to be "Good" or else the value cannot be trusted #tag.value is the 'value' you would proceed to use, if the .quality was found to be "Good" #logger = system.util.getLogger("MiscDebug") #logger.info("Misc -Start-") tagPath = "[Modicon]HR1005.2" #Flat Robot E Stop tagPath2 = "[Modicon]HR1005.3" #Vial Robot E Stop tagPath3 = "[Modicon]HR1005.4" #PB2519 E Stop tagPath4 = "[Modicon]HR1005.5" #PB2520 E Stop tagPath5 = "[Modicon]HR1005.6" #PB2521 E Stop tagPath6 = "[Modicon]HR1005.7" #PB2522 E Stop tagPath7 = "[Modicon]HR1005.8" #PB2532 E Stop tagPath8 = "[Modicon]HR1005.9" #PB2533 E Stop tagPath9 = "[Modicon]HR1005.10" #PB2534 E Stop tagPath10 = "[Modicon]HR1005.11" #PB2535 E Stop tagPath11 = "[Modicon]HR1005.12" #PB2536 E Stop tagPath12 = "[Modicon]HR1000.8" #Label Printer Fault tagPath13 = "[Modicon]HR1000.9" #Label Printer Out of Ink tagPath14 = "[Modicon]HR1004.9" #Safety Enabled tagPath15 = "[Modicon]HR1004.3" #Tray with No ID tagPath16 = "[Modicon]HR1005.0" #HMI Alarm Present (Tells PLC there is an alarm) #read tag readTag = system.tag.readBlocking(tagpath) if str(readTag.quality) == "Good": tagValue = readTag.value #logger.info("tagValue : " + str(tagValue)) if tagValue: #if true or non-zero #update value to be written to tagPath16 result = true #write tag system.tag.writeBlocking("[Modicon]HR1005.0", 1) else: #update value to be written to tagPath16 result = false #write tag system.tag.writeBlocking("[Modicon]HR1005.0", 0) #logger.info("Misc -Done-")
I’ve tried it as a Gateway Timer Script and a Client Timer Script. Both set to run every 1,000 ms or 1 second. We make an alarm go off and nothing happens as far as the audible for alarms being active.
My questions are
A) should this be in the gateway or the client?
B) what is wrong with the code or what code should I be using?