I am trying to have the Client ID and Current Window Ignition system values sent to an AllenBradley Guardlogix controller. Via OPC tags. If I understand the syntax of the system.tag.writeBlocking system function correctly. The client timer script that I have created should accomplish this, but no values are appearing. I am unsure if I am specifying the value argument of the writeBlocking function correctly. It’s supposed to be targeted at a tag defined within the script. Attached are photos of the timer script and the OPC tags that are the targets to be written to. I am aware that the getCurrentWindow function returns a value only when the window is maximized. Any help would be appreciated.
What happens when two or more clients are open? And a designer, perhaps?
Please share more about your task so we can help you solve it without racy hacks.
My thought was to use those values within the AB PLC. In order to restrict control over equipment that multiple clients have access to. This would be accomplished by using the getClientID system function to identify what client is currently on a specific window, and the getCurrentWindow function to know whether or not two clients are on the same window. There would be a request control button on each window, that all clients that are assigned to that Ignition project would have access to. When that button is pressed from whichever client. An integer value would be sent to the Ignition project from the AB PLC. That value would be evaluated for within a script that would disable access to certain functionalities if the another client is also on that window.
No need to write to the PLC, as all of the enforcement will have to be in Ignition. You cannot use
getCurrentWindow() for this, as it won’t reliably catch the situation if multiple windows are open and the target window is one of them.
I recommend using a gateway message handler to write the clientID to a memory tag, but only if the tag is empty (or stale). The window would use a timer component that sends a message every second or so while the window is open trying to claim control. If it succeeds, the tag will match the client’s ID, and that can propagate to enable the controls on the window. If another client already has control, it will keep trying so that it can gain control when the other client closes.
The message handler would need to keep a timestamp of the last successful claim, so it can accept a fresh claim.