heartbeat/watchdog

P

Thread Starter

panthri

How does the heartbeat or watchdog signal works in communication between two system. How can I program it in Siemens S7 PLC?
 
My favorite way to implement this is the following:

1. In the subservient system, create an up-counter that initializes at zero and increments once per second. Set up upper limit way out there, such as 99999. Set up a high trigger at 120 seconds, establishing a Boolean signal representing loss of communication that can be used as needed. Set the reset to be a tag that is written from the supervising system. Special note - put a single shot pulse between the supervising system command and the accumulator reset, in case is locks in at a logic one state.

2. In the supervisory system, read the accumulated value of the up-counter. Alarm on either of the following conditions, (a) rate of change is zero for 30 seconds; (b) accumulator value greater than 120 seconds. Also set a trigger at accumulator greater than 30, sending a up-counter reset command.

The benefits are:
1. Both the subservient and supervisory systems "know" that there is a problem with communication between the systems. Even in a master-slave protocol scenario such as Modbus.

2. Appropriate action can be taken at either or both systems based on loss of communication.

3. At the supervisory level, the (a) rate of change alarm indicates that either there is a break in the communications infrastructure or the subservient device is powered down or not executing. The (b) value >120 but counting means that there is some level of communication but the break is in the ability to issue a command from the supervisory to the subservient system.

4. When communication is back up, the alarms on both ends will clear.

Even though this sort of thing was pretty essential with older protocols, such as Modbus, I still today implement this in "modern" protocols. I find that some of the built-in "health" status tags don't always evaluate every condition. The logic above never fails to tell the truth.
 
Hello,

For me if both sides have a clock I take this approach.

On both sides, I put the seconds value of the clock in a memory location the other can read.

Then on each side I read the seconds from the other side and store it locally. Then X seconds later, I read the seconds again from the other side, compare it to the locally stored value and if the two values are the same then a problem has occurred.

You could increment an internal counter if you want to not raise the issue until X failures.

Just clear the counter on each success.

Good luck,

Mark
http://www.peakhmi.com/
 
Top