Logix MSG, how to tell if the other PLC is down

AlfredoQuintero

Lifetime Supporting Member
Join Date
Feb 2015
Location
Yokohama
Posts
1,533
Hello: Working on a program that needs to read some data from other Rockwell PLCs. Every second my program sends "CIP Data Table Read" command and I get the expected data from the other side. I want to have a quality bit for this communication, in case there is a problem on the other side. But if I unplug the LAN cable of the other PLC, I cannot see any error in the MSG instruction. The ERR register is zero and the ER bit is always false. The only difference with the state in which the other PLC is communicating normally is that when the cable is unplugged the .EN bit is always true, whereas during normal communication the .DN and .EN bit alternate from true to false regularly.

Trying to think how to program a quality bit for the validity of the data in the destination of the MSG instruction. Something like "if the MSG instruction's .DN does not transition from false to true within X time, or if the .ER bit is true, the quality of the data in the destination tag is bad."

Is there a better way to do this and the above idea is completely stupid?

Note, at the moment I am thinking of MSG instruction because this is an application to get data from PLCs already in operation and it is not feasible to change the program in the PLCs in the factory floor, so it has to be something that is retrofitted to the plant without changes to the running PLCs, reason why I am not contemplating connected communications.

Another possibility I am entertaining would be to read some system variable that changes constantly on the other PLC, like getting some GSV wall clock info or something, however I have never done this on a remote PLC. So this is my plan B if I cannot find a solution only with MSG.


edit: Since I also would need to tell if the PLC is in fault state, I will have to figure out the way to send the GSV, I guess.


Thanks for reading down to this point.
 
Last edited:
@alfredo:
I did it the other day, two compact logix in the same cabinet.
I installed a safety relay that receives signals from both plcs and return signals to both. If for any reason one of the plcs does not respond the relay send and alarm. As you can see this is hard wired not Ethernet cabling.
 
Could you do this:

From the one PLC (the one being monitored for "up and running" state), write to a register in the "Monitoring PLC". In the Monitoring PLC, check on every scan or some time interval to see if that register value has changed. If the value hasn't changed since the last check, then the PLC is down.

I've done something similar from various PLCs on our floor to a Windows application, for continuous monitoring if the PLCs are running. Each of the PLCs continuously increment an integer variable in their own logic, and the Windows application goes out and reads each PLC's integer variable on a time interval, and if the variable/s hasn't changed since the last read, then that particular PLC is down. Of course there are other ways to do it, but this works just the same.
 
Last edited:
Hello, thanks for your comments. In other words it is necessary to chsnge the monitored PLC? I was trying to hava a solution that would require no changes on the PLC to read data from.
 
I think your first instinct was the best one: handle this in the CIP client that is reading data from the PLCs.

XIC msg.DN TOF tof 5000 0

or

XIO msg.DN TON ton 5000 0

With XIC/TOF, as long as the .DN bit of the message becomes 1 every 5s or less, the tof.DN bit will remain 1. So the "Quality OK" condition is tof.DN = 1 and the faulted condition is tof.DN = 0.

With XIO/TON, as long as the .DN bit of the message becomes 1 every 5s or less, the ton.DN bit will remain 0. So the "Quality OK" condition is ton.DN = 0 and the faulted condition is ton.DN = 1.

It might be worth running msg.DN to a one-shot and using the one-shot to feed the timers instead of msg.DN, because the MSG could conceivably complete (msg.DN becomes 1) and not restart (msg.DN stays 1, so neither circuit above indicates a fault) if the MSG's input rung does not see another rising edge.

I suppose you could also do something with the msg.EN bit, but I think the msg.DN should be adequate. Also, because these approaches work on the principle that for normal operation the msg.DN bit regularly becomes 1, these work whether or not the msg.ER bit becomes 1.
 
Last edited:
The connection timeout in a MSG instruction in any Logix-family controller is 30 seconds. It doesn't show up in the MSG configuration tabs, so many people overlook it. You can manually set the value in logic with a MOV to the timeout value (I think it's actually in microseconds !) or by manually poking a value into the subelement while viewing the MESSAGE control tag in the tag database.

I prefer to implement my own ordinary timer-based timeout and set the .TO bit, of the MESSAGE control tag, which causes the message to gracefully error out just like its internal timeout does.
 
Alfredo also correctly understands that most PLCs, including Logix family controllers, will happily respond to Data Table or Tag read/write commands even when in PROG mode or in a recoverable major fault state that hasn't actually crashed the communication stack or the operating system.

If you need to detect *that*, then you probably need an independent MSG instruction that is reading the controller's Mode object.

That's something I would have to do some research and testing to remind myself of it. I usually have control of both sides of this sort of function, so I add a free-running accumulator to the block of data that I am reading, which allows me to infer RUN mode and connectivity.
 
With a SLC or Micrologix, I typically put a copy of the free running clock as the first element of a message block. The PLC on the other end compares that value to a copy of it and if equal, runs a timer. If the incoming data doesn't change after so many seconds, either the communication has failed of the other PLC is not running. In Logix5K you could use a member of the WallClockTime since I don't think there's a free running clock.
 
we have done this before.
plc1 (master) writes a 1 to a word in in plc1.
that bit in plc1 starts a 1 second timer.
plc1 sends that word to plc2
plc 2 sees the 1 in the word bit and sets it back to zero
and sends that word back to plc1, which resets the timer.
plc2 starts a 1 second timer also.
if plc2 does not see a 1 in that word, an error message is also generated.

we have monitors on each line with a plc.
regards,
james
 
If it's a "logix" processor you can get the operating mode of the remote PLC by using a Generic CIP MSG service code "e" Class 0x01 Inst. 0x01 Attr 0x05
 
Thank you, chelton: I was just looking up my reference information on that object.

The Identity object (Class 0x01) is generally what RSLinx browses about a device. It includes the Vendor and Type and Class and firmware revisions, and a string with the name of the device.

The most common place you see this in action is when RSLinx Classic browses it: it sends a "Get Attributes All" for the whole Object and devices all reply with their Identities.

The object includes a 16-bit bitwise "Status" value, as Attribute 0x05, as well as a SINT value for "State" as Attribute 0x08.

It's fairly easy to find a general reference for the bits in Status (0x05), where the Major and Minor fault bits are well defined for various adapter objects. I don't have a full ODVA reference manual handy.

But I can't find a reliable reference on what each bit means when the target is a ControlLogix CPU, so you can parse out which bit combination means "Run/Remote Run/Prog". I think that's in the Extended Status (bits 4,5,6,7).

CIP_Identity_Wireshark.PNG
 
Last edited:

Similar Topics

hi , I need to sorry for my bad English first. I'm newbie at plc programming ,I had been asked about E/IP protocol information for some system...
Replies
3
Views
340
To sequence through multiple MSG instructions with a Studio 5k program what are some preferred methods?
Replies
6
Views
478
Does anyone know if is possible to read data out of a ProfaceHMI/PLC into a CompactLogix PLC? I have a bunch of OEM machines on our plant floor...
Replies
2
Views
468
Hey Guys Having some trouble again with message path, I thought I had these figured out but I've not been able to get this one working. I...
Replies
4
Views
538
I'm trying get information from another same PLC PLC1: CompactLogix 1769-L16ER-BB1B (192.168.0.133) PLC1: CompactLogix 1769-L16ER-BB1B...
Replies
17
Views
1,487
Back
Top Bottom