Alarming Loss of Comms to Devices

This seems like a straight forward thing to want to do, but I can’t seem to find anything to tell me the best way to do it.

Firstly, I’m using version 8.1.11 of Ignition.

I have several devices connected using different protocols (OPC-UA, Modbus, DNP3). I want to issue an alarm when we lose comms to a device. It seems that the best way for OPC-UA devices is to alarm the System tag Gateway/OPC/Connections/devicename/Connected. Of course, we probably don’t want to alarm if the device is disabled.

For the Modbus and DNP3 devices, I’ve considered the System tag Gateway/Devices/devicename/Status. However, this is a text string and it seems strange to alarm on this tag (not)equal to a string.

What’s the Ignition way of alarming loss of comms to these devices? Thanks.

2 Likes

Welcome, Craig!

You will find with Ignition there is no ‘one-way’ of doing things, there are multiple ways this can be done.

This is how I do it, note the version is 7.9 so scripts will need slight updates for best performance on 8.1.x

You seem to be concerned with loss to a single device, the following is for an overview of all devices but it might give you some ideas.

I have a tag that counts the total number of connected devices:

import system
		
cDS = system.dataset.toPyDataSet(deviceDataset)

c=0
for r in cDS:
	if r['State']=="Connected":
		c = c + 1

system.tag.write("Diagnostics/Devices_Connected", c)

I have an alarm set on this tag saying if below X count and for Y duration then send an email out.

Further to that I have a power table with a ‘refresh’ button with the following script:

deviceDataset = system.device.listDevices()
 
# Assign the deviceDataset to a Power Table. This example assumes
# the Power Table is in the same container as the component that called this script
event.source.parent.getComponent('Power Table').data = deviceDataset

This allows you to see at a glance what devices are connected/connecting/disconnected/disabled and the driver type, easier than the gateway status page as it is constantly refreshing.

Further to that I have a periodic script that pings each device and records the status to a DB, this then lets me see if there are drops in the diagnostic count which sites were not responding at that time historically;

def ping(address,timeout=2000):
	global pingStat
	from java.net import InetAddress
	ip = InetAddress.getByName(address)
	if ip.isReachable(timeout) == True:
		pingStat = 1
	elif ip.isReachable(timeout) == False:
		pingStat = 0


def dev_ping():
	dlist = system.device.listDevices()
	for row in range(dlist.getRowCount()):
		# Check if device uses ModbusTCP driver and device is enabled
		if dlist.getValueAt(row,3) == "ModbusTcp" and dlist.getValueAt(row,1) == 1:
			# Get device host name.
			devSite = dlist.getValueAt(row,0)
			print devSite
			devIP = system.device.getDeviceHostname(dlist.getValueAt(row,0))
			print devIP
			ping(devIP)
			if pingStat == 1:
				print "Dev ok"
				system.db.runSFPrepUpdate("insert into ign.dev_stat (dev_site, dev_ip, dev_state) values (?,?,?)",[devSite, devIP, pingStat],datasources=["MySQL"])
			
			elif pingStat == 0:
				print "no conn"
				system.db.runSFPrepUpdate("insert into ign.dev_stat (dev_site, dev_ip, dev_state) values (?,?,?)",[devSite, devIP, pingStat],datasources=["MySQL"])
				
dev_ping()

As usual, YMMV.

1 Like

If the end device is capable, we use a counter in the PLC that counts up every X amount of time. For ControlLogix based devices we use the WallClockTime, but the same can be done with a counter that rolls over in the PLC.

Then in Ignition we use two tags. One to read that counter that is running in the PLC and another that uses the hasChanged - Ignition User Manual 8.1 - Ignition Documentation expression. If the expression returns false for X seconds then we assume that either we can’t communicate, or the PLC is not in run mode.

2 Likes

I appreciate the replies and suggestions, but I am very confused. Does Ignition not have a built in way of issuing an alarm to the operator when comms are lost to a device in the field? Seems like a fundamental thing that I’ve seen in other SCADA systems. Thanks for your help.

1 Like

Nope, there isn’t a standard way to do this. I normally create a UDT for each of my Device types (e.g. LogixDriver, AB Legacy, Modbus, etc.) using the Diagnostics tags provided by the OPC-UA server adding alarms to the comms status tags, then create instances of those UDTs for each device.
The diagnostics tags usually also include other useful things like the IP address, processor info, etc.
I also have Templates or View templates for each device type as well and popups for them to display all the info.

1 Like

Is there any reason NOT to just alarm the “Connected” system tag for OPC-UA or the “Status” system tag for other devices?

For an Ethernet I/P device the connected bit, as far as I understand it, only means that Ignition is connected to the first hop. So if you were communicating with a PLC over an Ethernet card the connected would only mean you are able to hit the Ethernet card.

And there are other things to think about… Just because you can communicate doesn’t mean that the device is active. Hence checking that the device is actually doing something.

2 Likes

You’re right, we also use a handshaked heartbeat as well to check for PLCs accidentally in programme mode. I like your method better though which combines the two into one, although I think I’d want to make these two fail states raise independent alarms as a ‘no comms to PLC’ alarm for a PLC in programme mode would be deceptive.

RE this, most other SCADA platforms i’ve used do raise hardware alarms when devices are disconnected, but none will raise an alarm if the PLC isn’t actually running (is in programme mode).

While Ignition doesn’t default to alarming on disconnected state, it offers the flexibility to configure this yourself. With great power comes great responsibility and sometimes out-of-the-box features are missed out on in favour of flexibility.

What are those diagnostics tags you’re talking about ?

Most operators though don’t really understand the difference, and I don’t expect them too. We do show both errors though… we have an Ignition page that shows all the Ignitions stuff… OPC status, database status, and then device status from an Ignition view. Then on the system diagnostic details we use the heartbeat bit. Most operator Ignore the Ignition page and head to the system diagnostic, however when maintenance gets involved then they know where to look to start diagnosing. Or they just don’t even bother and call me at 2 am like today… for a networking issue by corporate. Oh well. :smiley:

1 Like