general practice for setting up a heartbeat

rscott9399

Member
Join Date
Aug 2017
Location
in space
Posts
114
Hey guys

Pretty common i know but most often im oly working with one CPU

Current work involves 2 so im needing a heartbeat

What is the common process for this?

Any example code anywhere?

Is this just like a 1 sec pulse counter that resets at some point.

Thanks in advance
 
I have two methods I often use. One is to have a counter that increments each time a message succeeds. The other is to exchange a copy of the free running clock. In either case, on each end I will have a timer that times when the "heartbeat" value hasn't changed, and on the next branch, make a copy of the heartbeat value for use in the comparison block. If the data changes, the timer gets reset. If the timer times out, then communication has failed or the other PLC has stopped running.

The incrementing counter method gives the viewer an intuitive way of seeing the rate at which communications is happening. The copy of the free running clock is easier because there is almost always a system tag already there to be picked up and used.
 
Last edited:
I like to analyze the 'heartbeat' for a high or low condition over a set amount of time (lets say 1second) then latch a fault- this way a signal loss or 'freeze' will all produce the same end result
 
is there anything wrong with doing a simple addition of a number and comparing old numbers with new?

Everytime a rung executes and do the addition

Send the new number to the other PLC

other plc checks if new number is the same as the old number.

If it is it starts a time to trigger a fault.

If its not the same the program continues.

I have heard of this method before

Anything wrong with it?
 
is there anything wrong with doing a simple addition of a number and comparing old numbers with new?

Everytime a rung executes and do the addition

Send the new number to the other PLC

other plc checks if new number is the same as the old number.

If it is it starts a time to trigger a fault.

If its not the same the program continues.

I have heard of this method before

Anything wrong with it?

That is basically the same as the free running clock, except using an address of your choosing. Just be sure that your PLC can properly handle overflow when the value gets out of range, or add code to prevent it from doing so.
 
The way I always do a heartbeat is generate a flashing bit at whatever frequency you want and send it to the receiving CPU. There, use the normally open of the bit to enable a Time Delay On, and a the normally closed of the bit to enable a Time Delay Off. The timers should be set at a period less than the period of the flashing bit. If either timer times out, then you know that the link has been lost.

I usually have the receiving CPU just send back the same pulse bit to the originating CPU, and have the originating CPU use the same timing logic.
 
That is basically the same as the free running clock, except using an address of your choosing. Just be sure that your PLC can properly handle overflow when the value gets out of range, or add code to prevent it from doing so.

yea i am trying this method

I set it up as an INT so basically its doing an EQU operation at the same time

if it gets to 32767 it resets the accumulated number to zero

I think this should work.

If anyone one see anything catastrophic here please let me know lol

They let the Siemens guy start playing with AB....... o lord what could possibly go wrong

:D
 
In the ML1400, the free running clock is S:4. Just copy it to a member of the block of data being messaged. Then you don't have to worry about math overflow or the ADD instruction. The attached example is for a ML1100 that is a radio telemetry master so it also has logic to enable and disable nodes on the network and alarms for if they lose communication. Note that my timeout alarm is five minutes. This is the nice thing about the water industry, "fast" is counted in minutes, not microseconds.

heartbeat.png
 
Last edited:
In the ML1400, the free running clock is S:4. Just copy it to a member of the block of data being messaged. Then you don't have to worry about math overflow or the ADD instruction. The attached example is for a ML1100 that is a radio telemetry master so it also has logic to enable and disable nodes on the network and alarms for if they lose communication. Note that my timeout alarm is five minutes. This is the nice thing about the water industry, "fast" is counted in minutes, not microseconds.

Thanks for the no on S:4

I wrote a few things i think i like and should work
Thanks for the support.

What a great forum
 
You need a few references in pdf format just in case:
Micrologix 1400 Instruction Set Reference 1766-rm001-en
Micrologix 1400 User Manual 1766-um001_-en-p

But I normally just use F1 and jump in the Help file and search, or open up the Status file in the software where they are all documented. Note that the default view of the status file is "structured" where it's laid out graphically with multiple tabs, but you can switch to a binary radix and see the "S" file as a data table from which you can drag and drop elements into your code.
 
Last edited:
Simple method for heartbeat, no timers needed for generation, cannot get "in sync".


In one PLC ....
XIC heartbeat_in OTE heartbeat_out


In the other ....
XIO heartbeat_in OTE heartbeat_out


... it sets up a "round-robin" that will always be toggling on and off.



Simply monitor any bit in both PLCs for "stuck" high or low for a period.


works like magic...
 

Similar Topics

Hi guys, Doing a conversion from PLC5 to Controllogix, and so far it's going smoothly. The programs are fairly simple, the errors are minimal...
Replies
2
Views
2,205
What is your perspective? Are you a Maintenance Tech? Systems Integrator? OEM Engineer? What are your thoughts on the topic of source...
Replies
24
Views
1,148
Wizards, It has been a few, but you all have always done me well. I have acquired a 1769-L33ER and want to use it as my collection PLC to...
Replies
5
Views
506
Hi! I recently discovered how to get to configuration mode and disable printing for connecting to PanelBuilder32 and updating my Panelview...
Replies
1
Views
443
Hello Guys, Hope everyone is doing well. I have a general doubt about ladder programming. The outputs are not getting energized when I used the...
Replies
13
Views
1,856
Back
Top Bottom