Skip to main content

Configuring a Network Variable Exchange with External Controllers

Configuring a cross-communication with controllers from different projects

Requirement: Some variables should be published as network variables from an existing project (Project1) with a safety controller. These variables should be used in the safety controller of another project (Project2).

  1. In the device tree, in the sender safety controller of Project1, select the SafetyApp safety application object, and then click Add Object → Safety network variable list (Sender) in the context menu.

  2. Add the variables to the Safety network variable list (Sender) that should be published to the receiver.

  3. If necessary, modify the settings of the Safety network variable list (Sender) on the Safety configuration and PLC network tabs.

  4. Modify the safety application of Project1 so that the network variables are assigned with the required internal values.

  5. Click Project → Export to export Project1 with the Safety network variable list (Sender) object. Specify the name Project1.export.

  6. Open the project Project2 and in the device tree select the top node with the project name.

  7. In the context menu, click Add Device and in the Add Device dialog select External NetVar Controller. Click Add Device to confirm the dialog.

    The External_NetVar_Controller and External_Safety_NetVar_Controller objects are added to the project.

  8. In Project2, below the External_Safety_NetVar_Controller node, select SafetyApp.

  9. Click Project → Import and in the file directory select the safety network variable list (sender) exported from Project1.

    The Import opens and displays the exported safety network variable list (sender) in the Insertable items field.

  10. Click OK to confirm the dialog.

    The sender variable list is added to the External_Safety_NetVar_Controller.

  11. Add a Safety network variable list (Receiver) object to the safety application of the Project2 receiver project.

  12. Open the Safety network variable list (Receiver) and select the previously imported sender in the Associated sender drop-down list.

    CODESYS displays the information about the associated sender in the Safety network variable list (Sender) object on the Safety configuration tab in the Safety address and Object version of sender fields. The variable list includes safety network variables that you declared in the Safety network variable list (Sender) of Project1.

  13. If necessary, modify the settings of the Safety network variable list (Receiver) on the Safety configuration and PLC network tabs.

  14. Click Build → Build to build the safety application with the Safety network variable list (Receiver). In the message view (View → Messages), check that you have configured the safety network variable exchange without any errors.

Important

If you intend to repeat this procedure for many separate projects, then you must modify the list identifiers manually in the respective PLC network tabs of the safety network variable list (receiver) so that the values of the list identifiers of the different receivers are different.

Configuring a cross-communication with cloned controllers

Requirement: Your project contains two safety controllers with one sender safety application SafetyApp1 and one receiver safety application SafetyApp2. The controller with SafetyApp1 is cloned and built into the same connected machine. The published network variables of all these cloned controllers should be used in SafetyApp2.

This use case has to be supported by the controller in a manner specific to the device. Ask your controller manufacturer.

  1. Open the project and in the device tree select the project name.

  2. In the context menu, click Add Device and in the Add Device dialog select External NetVar Controller. Click Add Device to confirm the dialog.

    The External_NetVar_Controller and External_Safety_NetVar_Controller objects are added to the project.

  3. Copy the sender variable lists from the cloned controllers to the project below the SafetyApp object of External_Safety_NetVar_Controller.

  4. In each sender variable list, you have to make the following adaptations:

    1. On the Safety Configuration tab, adapt the value of Safety address of sender so that the values are unique within the project.

    2. On the PLC Network tab, adapt the value of Group of list identifiers on main controller so that they are unique within the project.

    You have to set the same values on the cloned controllers in a manner specific to the device.

  5. For each copied sender variable list, add a Safety Network Variable List (Receiver) object to the receiver safety application SafetyApp2.

  6. Open each Safety Network Variable List (Receiver), and in the Associated sender list box select one of the copied Safety Network Variable List (Sender) so that each sender variable list is assigned to a receiver variable list.

  7. On the Safety Network tab, in the receiver network variable lists, set the IP addresses of the cloned controllers as the Destination network address.

  8. Click Build → Build to build the safety application with the Safety network variable list (Receiver). In the message view (View → Messages), check that you have configured the safety network variable exchange without any errors.