system.opc.writeValue slow?

Hi peeps,

I am running into an intermittent issue where sometimes a script executing system.opc.writeValue can take up to 20 odd seconds to execute and this can disrupt the production when it happens. All the script does is the following:

def HSK_Write(writeValue):
	WriteSuccess = -1
	server = "Ignition OPC-UA Server"
	path = "ns=1;s=[PLC]Global.Ignition_StatusUpdated"
	for i in range(3):
			returnQuality = system.opc.writeValue(server, path, writeValue)
			if returnQuality.isGood():
				system.tag.write("[default]Retry_Tags/Value_Update_Handshake", -99)			#-99 means write success
				WriteSuccess = -99

	if WriteSuccess != -99:
		system.tag.write("[default]Retry_Tags/Value_Update_Handshake", writeValue)	#This triggers timer script for retries

The tag “Retry_Tags/Value_Update_Handshake” is only a memory tag so I wouldn’t imagine it will take long to write to that tag. There’s no sign of the server hardware overloading when this occurs either.

So just wondering if anyone has any suggestions on what I should be looking for in the gateway for fault finding/diagnostics or if there’s any suggestions on common practice that would bring down the time required to do an OPC write? As I thought using the system.opc.writeValue is generally faster than writing through scan classes.

Could it be a network issue or something on the PLC end?

The gateway version is 8.0.1 and the tag count on this specific device is only 44 tags.

Many thanks.

My guess would be a network dropped packet followed by TCP retries. If the device is lightly loaded, there might be enough dead time that a random missed packet isn’t noticed quickly by the underlying TCP stack.

1 Like

Could also be that the device was reconnecting or re-browsing at the time. Maybe you can add some logging to this script that measures the execution time and logs when it starts and finishes, and then you can correlate slow executions with other things happening in the gateway logs.

1 Like