Skip to main content

"The Safe House" Scenario: vPLC + vSafe + ProfiSafe + Time Provider + License Server

_rtsl_img_scenario_safe_house.png

Note

The documentation in the following sections is provided for informational purposes only. For restrictions and safety or certification information, please consult the safety documentation of the manufacturer of the device that you are programming.

Requirements

  • Scenarios:

    The requirement for this scenario is the successful setup of the "Virtual with Fieldbus" Scenario: vPLC + License Server + Edge Gateway + Fieldbus.

  • Hardware

    The following devices are also required:

    • Desktop PC with CODESYS Development System installed

    • Linux Host PC with virtual Edge Gateway, virtual PLC 1, and license server installed

    The following additional devices are also required:

    • Host for the time provider (named "Linux Host PC 2" in the diagram). Requirements for this host: Linux operating system and Docker must be installed and SSH configured.

    • Real-time-capable network to the Linux Host PC to ensure deterministic transmission of data packets.

    • Real-time-capable Linux systems, especially "Linux Host PC" and "Linux Host PC 2": Sending the timestamps of the time provider is just as critical in real time as processing the application on the safe controller.

      Note

      Failure to meet real-time capability leads to availability problems of the safe application ("Safety Exceptions"). To set up the Linux systems involved, follow the steps in Performance Optimization.

  • Add-on products

    CODESYS Virtual Safe Control SL must be installed on the desktop PC.

Linux Host PC 2

On Linux Host PC 2, set up the time provider.

The time provider sends the current time to a configured target and can be used to provide the second time required by the Virtual Safe Control SL.

  1. Run the Tools → Deploy Control SL command and establish a connection to the Linux Host PC 2 (Communication tab).

    For more information, see the following: Establishing a Connection

  2. Install the latest versions of the following images (Deployment tab):

    • CODESYS Virtual Safe Time Provider

    For more information, see the following: Installing an image

  3. Switch to the Deployment tab.

  4. In the Product list box, select CODESYS Virtual Safe Time Provider SL.

  5. In the Version list box, select the latest version.

  6. Click the Install button.

    The CODESYS Virtual Safe Time Provider SL image will be listed in the Installed Images section.

  7. Create the required instances.

    On the Linux Host PC 2, the timeprovider instance is required, which you create as follows on the Operation tab:

    1. In the VPLCs section, click the _visu_icon_plus.png button.

      The Add New Instance dialog will open.

    2. Specify timeprovider as the name.

    3. In the list box, select the Safety Timeprovider filter.

    4. Select the latest version of the CODESYS Virtual Safe Timeprovider SL image and click OK.

      The new instance will be listed in the VPLCs section.

  8. Configure the instances.

    The target IP address and the target port must be configured for the timeprovider instance. The target is the vHost and the port 60000 by default.

    Generic commands

    -e TARGET_IP=[IP oder Hostname des Linux Host PC]

    -e TARGET_PORT=60000

    Port 60000 is the default for a Virtual Safe Control SL to receive an external time source from the timer.

    Autostart

    Yes

    When Yes is selected, the instance is started automatically each time the system is booted.

    The generic commands can be used to configure additional aspects of the Time Provider instance, such as those related to logging or optimization.

    Generic Commands

    Default Value

    Explanation

    -e STAT_PRINT_TIME

    60

    Output interval (in seconds) of the statistics of the Time Provider

    -e PIN_CPU

    0

    Core where the Time Provider will be executed

    -e DEBUG

    FALSE

    Enable or disable the debug output

    -e SYSLOG

    FALSE

    Enable or disable writing log output to syslog

    -e PRIORITY

    55

    SCHED_FIFO scheduling priority

    -e REDUNDANCY

    FALSE/TRUE

    Enable or disable the redundancy function of the Time Provider. (Requires an additional CODESYS Safe Time Provider)

    -e CYCLETIME

    3

    The interval in which the Time Provider sends the timestamp packages

    1. In the VPLCs section, click the timeprovider instance.

      The settings for the timeprovider instance are displayed on the right side. The TARGET_IP and TARGET_PORT fields are already pre-assigned with the values vSafePLC1 and 60000 under Genericcommands.

    2. Change the TARGET_IP to the host name or the IP address of the Linux Host PC 1.

      For more information, see the following: Detecting the network address

    3. In the Autostart list box, select the value Yes.

    4. Click the Save button to save the changes.

    For more information, see the following: Creating and configuring a new instance

  9. Start the timeprovider instance by selecting it in the VPLCs section and then clicking the _prf_icon_start.png Start Selected button.

    In the State column, the status of all instances will change to Running.

Linux Host PC

On the Linux Host PC, set up the CODESYS Virtual Safe Control for Linux SL.

  1. Run the Tools → Deploy Control SL command and establish a connection to the Linux Host PC 2 (Communication tab).

  2. Switch to the Operation tab.

  3. Install the latest versions of the following images (Deployment tab):

    • CODESYS Virtual Safe Control SL

  4. Create the required instances.

    The vSafePLC instance is required on the Linux Host PC 1. On the Operation tab, create this as follows:

    1. In the VPLCs section, click the _visu_icon_plus.png button.

      The Add New Instance dialog will open.

    2. Specify vSafePLC as the name.

    3. In the Filter list box, select Safety runtime system.

    4. Then select the latest version of the CODESYS Virtual Safe Control for Linux SL image.

    5. Finally, click OK.

      The new instance will be listed in the VPLCs section.

  5. Together with the instances which you created on this device in the last scenario, the following instances should now be available in the VPLCs section:

    Instance

    State

    Product

    vGateway

    Stopped

    Gateway

    vPLC

    Stopped

    Runtime system

    vSafePLC

    Stopped

    Safety runtime system

  6. Check whether the following entry is available in the Services section:

    Product

    State

    CODESYS LicenseServer for Linux SL

    Running

  7. Before reconfiguring, click the Stop All button to stop the instances.

    The state of all instances will change to Stopped.

  8. In the VPLCs section, click the vSafePLC instance.

    The settings for the vSafePLC instance will be displayed on the right side.

  9. Configure the vSafePLC instance as follows:

    Ports:

    60000:60000/udp

    This is the default port of a Virtual Safe Control SL to receive an external time source from the time provider

    IPC:

    shareable

    Create an IPC namespace for this container, which other containers can also access. In this case, the vPLC instance should join the namespace so that both can communicate via Linux IPC (for example, shared memory).

    In addition to the instance parameters, with which the instance itself can be configured, there are also setting options for the runtime system of the instance of CODESYS Virtual Safe Control. The standard configuration of the CODESYS Safe Control SL should initially be usable for most applications.

    You can adjust the following parameters to suit your needs:

    Parameter

    Default Value

    Explanation

    Application priority

    35

    Runtime system priority (not Linux or IEC priority) for the application task

    CPU

    0

    Pin the CmpSIL3 tasks to the specified core

    External time task priority

    9

    Runtime system priority (not Linux or IEC priority) for the external time task

    Port

    60000

    UDP port used for the external Time Provider

  10. In the VPLCs section, click the vPLC instance.

    The settings for the vPLC instance are displayed on the right side.

  11. Configure the vPLC instance as follows:

    IPC

    container:vSafePLC

    Access to the IPC namespace of the vSafePLC instance for communication between these two instances.

    Dependencies

    vSafePLC

    The vSafePLC must be started first because this creates the IPC namespace that this instance wants to join. A dependency will ensure the correct starting order.

  12. In the VPLCs section, click the _prf_icon_start.png Start All button to start all instances.

    In the State column, the status of all instances will change to Running.

  13. Check the configuration.

    To make sure that the times of the time provider arrive at the vSafePLC as desired and configured, you can check this in the log of the instance.

    1. To do this, select the vSafePLCs instance in the VPLCs section.

    2. In the Actions section at the top right, click the Show Log button.

      The Runtime System log window will open.

      The message External Time Provider found will be written to the log.

All the required devices are now ready. The next steps for creating a project and integrating PROFIsafe are described in the CODESYS Safety Extension documentation.