Using a Redundant Control System
For more information, see: Behavior of the Redundancy System when Calling Commands
Loading and starting an application by means of an online change
Requirement: The PLCs which are configured as PLC 1 and PLC 2 are running and an updated application is ready for download.
In the device tree, select your application.
Click
.A dialog prompt opens to ask how you want to log in.
Select Login with Online Change.
The application is updated on PLC 1.
PLC 2 switches to simulation mode and synchronizes after about 10 seconds. After that, both PLCs are in active/standby mode again.
Tip
The Activate, Switch over, Synchronize, and Simulation commands are enabled on the Redundancy State tab.
Starting only when PLC 1 is running
Requirement: PLC 1 is running. A standard project is open in CODESYS Development System. The communication parameters are set for PLC 1.
In the device editor, open the Communication Settings tab and search the network.
The devices which are ready are listed in the Select Device dialog.
Select the device for PLC 1 and click OK to confirm the selection.
The device connection settings are configured.
Click
.The application is downloaded to PLC 1.
PLC 1 is running in standalone mode.
Start the runtime system on PLC 2.
The synchronization phase starts: The application and the redundancy data are applied. After that, PLC 1 switches to active and PLC 2 switches to standby.
Loading an application when active/standby mode is running
Requirement: Both PLCs are running. A redundancy project is open in CODESYS.
In the device editor, open the Communication Settings tab and search the network.
The devices which are ready are listed in the Select Device dialog.
Select the device for PLC 1 and click OK to confirm the selection.
The device connection settings are configured.
Click the Online → Login command.
In the dialog prompt which opens, select the Login with download option.
The application stops on PLC 1 as is also usual when loading on a single system. The application is removed and the operation to load a new application starts. During this time, PLC 2 switches to redundancy simulation mode. After some time, PLC 2 attempts to synchronize again. The attempt is repeated every 10 seconds. If more than 10 seconds have elapsed by the time PLC 1 starts, PLC 2 switches to error mode, but still attempts to synchronize.
Start PLC 1.
The synchronization starts and the application and the redundancy data are transmitted to PLC 2.
Tip
A download to a PLC which is running in standby mode is not supported. An error message indicates that you need to log in to the active PLC.
Implementing a programmatic query of the redundancy state
In the POU
PLC_PRG
, implement a query for the redundancy state.PROGRAM PRG_PLC VAR sReduState: RedundancyState; bResult: BOOL; END_VAR bResult := RDCY.GetRedundancyState(ADR(sReduState));
Log in to PLC 1 and confirm an online change.
PLC 1 and PLC 2 start in succession and switch to active/standby mode. Now the
state.eRedundancyState
variable gets the current state so that you can monitor it.Note
Hint: The current state is also displayed on the Redundancy State tab.
Testing an application for equality
Check whether or not the same application is executed on both PLCs.
Requirement: The redundancy system is in active/standby mode and an application is running.
Connect to PLC 2.
For this purpose, set the connection with the gateway of the device. Or, more conveniently, use the Swap PLC Paths button in the Redundancy Configuration.
If no download message is displayed, then both applications are the same.
Simulating a PLC failure
Stop PLC 1 during runtime.
The system graphic indicates the Unknown state (
) for PLC 1. PLC 2 immediately switches to the Standalone state (
).
Restart the PLC 1 device.
PLC 1 switches to Standby (
). PLC 2 switches to Active (
).
Reconnecting a PLC
No automatic Reconnect (disconnection and reconnection of the link) is included in the functional scope of the redundancy components. This is because specific conditions are relevant depending on the application and the device. However, you can program the triggering of a reconnect with the following implementation.
PROGRAM PLC_PRG VAR sReduState: RedundancyState; sSyncInfo: SYNC_INFO; sPlcIdent: PLC_IDENT; xConnectionState: BOOL; xResult: BOOL; END_VAR (* Collect information *) GetRedundancyState(ADR(sReduState)); xConnectionState := GetConnectionState(); sPlcIdent := GetPlcIdent(); (* If in standalone mode, and connection is possible, re-synchronize from PLC2 *) IF sReduState.eRedundancyState = RDCY.STATE.RS_CYCLE_STANDALONE AND xConnectionState AND xResult = FALSE AND sPlcIdent = RDCY.PLC_IDENT.PLC_ID_2 THEN xResult := RDCY.Synchronize(); END_IF
Configuring firewall settings
Both TCP and UDP are used for the redundancy synchronization. An IP port is set for the redundancy link. This is used for UDP. Port+1 is used for TCP.
Port 1205 is set as the default.
Ports to be unlocked
UDP: Port 1205 TCP: Port 1206