Is it possible to use system.tag.writeBlocking on an OPC tag? I understand the tag could be written over, but if it is a leased tag that isn’t active and I want to get the value I can use system.opc.readValue to get it. Once I have the value it could be handy to update the OPC tag since it may not update anytime soon depending on the tag group settings. Maybe this isn’t considered a best practice and therefore isn’t allowed. It didn’t seem to work for me. I am using 8.0.14 of Perspective, but I assume this applies across all of Ignition.
Why not? What happened? Was there an error message?
I get [Good] back in the script console, but the value property does not update. The timestamp doesn’t either. Furthermore, if the tag is ‘Uncertain_InitValue’ it remains as such. As a test I took the tag off of leased and just on a slower direct tag and it still only updates on the tag group time. writeBlocking does not update it.
If I do the same thing to a memory tag both update right away.
Maybe the underlying value in the device is being overwritten then?
Can you do a write to this tag from the quick client or tag browser?
Well my original intent was to read the actual value using system.opc.readValue to avoid waiting for the tag group to update so then I would actually be writing to the tag with the value that is currently in the PLC. When the tag group updates next nothing would change. I was curious though if my test was being overwritten in the PLC, but the tag group setting has Read After Write off and to do another test I removed any rungs of logic in the PLC that would write to the tag. I then was able to toggle the value and also use writeBlocking BUT the changes wouldn’t take effect until the tag group time occurred again. So I could use writeBlocking but if the tag group updates ever 30000 ms I could wait 30 seconds to actually see it change in the tag browser. I just ran another test and it appears writeBlocking is changing the PLC value right away, but the Tag Browser does not update.
OK - after I realized that I turned on Read After Write and it does update the Tag Browser with the value. Problem solved. Thanks.