Applicable Model(s)

Graphic HMIs

Title

Auto Switching Between Redundant PLCs

Date

05/04-2015

Rev

01

P/N

0907-5081

Summary

This Technical Note explains how to set up automatic switching between PLCs of the same type using Ethernet communications when one PLC is unavailable.


Solution

Setup
If communication to a PLC is lost, the HMIs in the Maple Systems’ HMI5000 Series have the ability to look for, find, and establish communications with another PLC.  To do this, the PLCs on the network must all use the same protocol.  The network would look something like this:

1.

In EZware, in the System Parameter Settings under the Edit menu, choose the device that will normally be used.  Make sure to choose the device type that the PLCs will share and input the IP Address for the main PLC.


2.

Write the Macro:

a.

Go to the Tools menu and select Macro….  Once in the Macro window click the New… button. 

b.

This Macro retrieves the current PLC IP Address from the HMI, changes the IP Address to the IP Address not currently being used, and tries to reestablish communication.  The following example uses 192.168.1.1 and 192.168.1.2 as PLC IP Addresses for the PLCs being switched between.

In the Macro WorkSpace input the following code:

macro_command main()

 //Define your variables
short NewIP4, OldIP4
short ReEstablishComms = 1

//Get data from the HMI to check which PLC it is currently //communicating with

GetData(OldIP4, “Local HMI”, LW, 9603, 1)

//Checks which PLC the HMI is currently communicating with and //switches Addresses

if OldIP4 == 1 then                //if the current PLC IP Address ends in .1

NewIP4 = 2                 //change the PLC IP Address ending to .2

else

NewIP4 = 1                 //change the PLC IP Address ending to .1

end if

//Write the new PLC IP Address to the HMI

SetData(NewIP4, “Local HMI”, LW, 9603, 1)

//Retry communication

SetData(ReEstablishComms, “Local HMI”, LB, 10070, 1)

end macro_command


3.

Set up a PLC Control Object:

a.

Go into the Object menu and select PLC Control

b.

In the PLC Control Object window click the New… button.

c.

In the Attribute section of the PLC Control window, select Execute macro program from the drop down menu next to Type of control

d.

Next to Macro name select the Macro that was just created from the drop down menu. 

e.

In the Trigger address section, select Local HMI for PLC name.  Click the Setting… button. 

f.

Check the System tag check box and select LB-10100 : PLC 4 status (Ethernet), set on to retry connection for the Device type.  Click the OK button. 

g.

In the drop down menu next to Trigger mode select ON->OFF

h.

Click the OK button to close the PLC Control window. 

i.

Click the Exit button to close the PLC Control Object window.

Using this setup, the HMI project will automatically search for another PLC when communication is lost from a PLC that had previously established communication.

NOTE: If no PLC has communication established when the project is originally downloaded the HMI project will not automatically search for another PLC.

Scroll to Top