Timer gateway script stops working after OPC Server restart

I am currently working on a customer project which consists of an Ignition Application (8.1) communicating with a machine PLC via OPC. A Kepware server is used to interface between Ignition and the PLC.

In the application there is a Gateway script which runs each second and updates a boolean opc tag (alternates True / False). This is processed by the PLC which in turn updates a second OPC Tag which can then be read in Ignition. The purpose is to verify that there is active communications from the gateway down to the plc and back up through kepware to the gateway.

However what I have noticed is that this works fine at first but if the Kepware server is restarted for any reason the write tag in the Ignition timer script stops working. The script will continue to try and write to this Tag but the value will not change. Also if I navigate to the tag in question in the Tag Browser the result is the same when i click on the tag to change it’s value it does not change.

There are no errors in the wrapper log when this occurs.

The situation can then be resolved by navigating to the gateway script disabling it, saving the project, re-enabling it and saving the project once again.

Any suggestions how to resolve this?

Start by adding some logging to your script that prints when it starts and prints the result of the write.

You might also see if there’s a difference when using system.opc to write vs system.tag.

Hi,

Yes, so this is my script:

image

Before the Kepware restart we have it operating correctly:

image

After, you can see the Tag values aren’t updating when the script runs, same story when the value is changed through the tag browser:

image

There does seem to be some errors related to the kepware server during the restart:

I also tried the system.opc.writeValue approach however the result was the same.

I did notice that when this issue is recreated (value can’t be changed from Ignition) that the tag value can be changed via Kepwares OPC client however this new value is not reflected in Ignition.