Is there a system tag that shows the OPC connection status?

Is there a system tag that shows the OPC connection status? I found the function

system.opc.getServerState(opcServer)

Currently, here is how I’m doing it with an expression tag

switch( runScript("system.opc.getServerState('OPCConnection')", 5000), // value 'FAULTED', // case 1 1, // return 1 0 // default )

but i wanted to monitor a tag, not have a script where i convert text to an int. I looked through the system tags but i didn’t see anything that caught my eye.

Thanks!

Hi,

there isn´t tags to monitor it. You can use an expression tag and write the following code:

if((runScript(“system.opc.getServerState(‘Matrikon UCS’)”,5000)) = “CONNECTED”,
“1”,
“0”)

Thanks, i guess we did the same thing just in different ways.

most opc servers have system tags that should always have good quality as long as the connection is up. checking quality on these is another way you could verify a good connection.

Thanks, I am checking the system tag in Kepware to verify that the connection to the PLC is up. But if the connection is down to kepware i wont get any tags.

You could use the Sever/ServerStatus/State tag