Skip to main content

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.

  1. In the device tree, select your application.

  2. Click Online → Login.

    A dialog prompt opens to ask how you want to log in.

  3. 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.

  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.

  2. Select the device for PLC 1 and click OK to confirm the selection.

    The device connection settings are configured.

  3. Click Online → Login.

    The application is downloaded to PLC 1.

  4. Debug → Start

    PLC 1 is running in standalone mode.

  5. 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

Procedure. Download to active PLC

Requirement: Both PLCs are running. A redundancy project is open in CODESYS.

  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.

  2. Select the device for PLC 1 and click OK to confirm the selection.

    The device connection settings are configured.

  3. Click the OnlineLogin command.

  4. 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.

  5. 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

  1. 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));
  2. 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.

  1. 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.

  2. Online → Login

    If no download message is displayed, then both applications are the same.

Simulating a PLC failure

  1. Stop PLC 1 during runtime.

    The system graphic indicates the Unknown state (rdncy_icon_state_unknown.png) for PLC 1. PLC 2 immediately switches to the Standalone state (rdncy_icon_state_standalone.png).

  2. Restart the PLC 1 device.

    PLC 1 switches to Standby (rdncy_icon_state_passive.png). PLC 2 switches to Active (rdncy_icon_state_active.png).

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.

Example 2. Example
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.

Example 3. Example

Port 1205 is set as the default.

Ports to be unlocked

UDP: Port 1205
TCP: Port 1206