Attention

You are viewing an older version of the documentation. The latest version is v3.3.

CODESYS Software PLC

CODESYS is the leading manufacturer-independent IEC 61131-3 automation software for engineering control systems. It is used in ECI to provide a software PLC (programmable logic controller) for executing real-time control applications. The CODESYS Runtime is capable of performing complex tasks and communicating with industrial communication protocols such as PLCopen OPC UA Transport Layer, Profinet, and EtherCAT. CODESYS global website can be accessed from: https://www.codesys.com/

CODESYS IDE

The following section is applicable to:

../_images/windows.png

CODESYS provides an integrated development environment (IDE) for Windows. Using the CODESYS IDE, control applications can be developed, tested, and compiled for the CODESYS Linux runtime. The following figure shows a typical IDE project environment.

../_images/29.jpg

For instructions on installing the CODESYS IDE to a Windows PC, refer to Installing CODESYS IDE.

CODESYS Linux Runtime

CODESYS provides a Linux runtime that allows control applications to execute on Linux-based systems. The CODESYS Linux runtime is free to use without a license, however it will automatically stop execution after two hours. If you want to use CODESYS Linux runtime beyond the two-hour limit, purchase and install it. For information on licensing CODESYS, refer to Licensing CODESYS Linux Runtime.

Building CODESYS Linux Runtime into ECI

The following section is applicable to:

../_images/linux3.png

ECI can be built with the CODESYS Linux Runtime ready for use. Do the following:

  1. Download the CODESYS Control for Linux SL package (CODESYS Control for Linux SL x.x.x.x.package) from the following website:

    Note: CODESYS Control for Linux SL package is free to download and evaluate. The price listed on the website is for a License Key, which is not required for evaluation purposes. Without the License Key, the CODESYS Linux runtime will operate for up to two hours before requiring a restart.

    Attention

    ECI was validated against CODESYS Control for Linux SL version 4.2.0.0.

    ../_images/0210.png
  2. Copy “CODESYS Control for Linux SL #.#.#.#.package” to the eci-release/codesys_packages directory of the Linux build system.

  3. Run the setup.sh script to build ECI (for more information, refer to Building ECI). When prompted to select feature options, select CODESYS Software PLC to enable CODESYS features.

    ../_images/option_codesys.png

Licensing CODESYS Linux Runtime

See also

For information on licensing CODESYS: https://www.codesys.com/the-system/licensing.html

There are two primary licensing methods for the CODESYS Linux runtime:

License Method

USB Dongle

License Soft Container

You can purchase a license for the CODESYS Linux runtime from the either of the following links, based on your location:

Restarting CODESYS Linux Runtime

The CODESYS Linux runtime will continue to run without a license for up to two hours. If the CODESYS Linux runtime stops running after the two-hour time limit, run the following command to restart:

systemctl restart codesyscontrol

Installing CODESYS IDE

The following section is applicable to:

../_images/windows.png
  1. Setup a PC with a 64-bit version of Windows [ 7 (Service Pack 1 or higher) / 8 / 10 ] installed.

  2. On the Windows PC, open a web browser and download the 64 bit version of CODESYS from the following website:

    Note: You need to create a free account for the download to be available.

    Attention

    ECI was validated against CODESYS version: V3.5 SP17 Patch 2 + (64-bit).

    ../_images/0112.png
  3. Download the CODESYS Control for Linux SL package (CODESYS Control for Linux SL x.x.x.x.package) from the following website:

    Note: CODESYS Control for Linux SL package is free to download and evaluate. The price listed on the website is for a License Key, which is not required for evaluation purposes. Without the License Key, the CODESYS Linux runtime will operate for up to 2 hours before requiring a restart.

    Attention

    ECI was validated against CODESYS Control for Linux SL version 4.2.0.0.

    ../_images/0210.png
  4. Download the CODESYS Edge Gateway for Linux (CODESYS Edge Gateway for Linux x.x.x.x.package) from the following website:

  5. Run the installer, downloaded earlier (name format should be: “CODESYS 64 #.#.#.#.exe”), to install CODESYS.

  6. Make sure that “CODESYS Control for Linux SL x.x.x.x.package” and “CODESYS Edge Gateway for Linux x.x.x.x.package” are in the same directory. Double-click “CODESYS Control for Linux SL #.#.#.#.package”. This will initiate the CODESYS package manager.

    ../_images/0410.png
  7. The prompt should show both “CODESYS Control for Linux SL” and “CODESYS Edge Gateway for Linux” packages queued for installation. Follow the installation prompts to install these packages.

    ../_images/0510.png
  8. Open the CODESYS Package Manager (available in the Start Menu under the CODESYS group), and verify whether both “CODESYS Control for Linux SL” and “CODESYS Edge Gateway for Linux” packages are successfully installed.

    ../_images/066.png

CODESYS Runtime Optimizations

The following section is applicable to:

../_images/target1.png

ECI images are built with number of useful scripts for improving the real-time performance of the CODESYS Linux runtime. On the target system, navigate to /opt/benchmarking/codesys to find the applicable scripts.

The scripts available at /opt/benchmarking/codesys include:

  • start_CODESYS_native.sh: Optimizes the system (see the list below), stops non-essential services, and restarts the CODESYS runtime

  • start_CODESYS_container.sh: Optimizes the system (see the list below) and starts the containerized CODESYS Linux runtime with RT priority

    Note: The start_CODESYS_container.sh script assumes that you have completed the CODESYS Containerization section: Microservice: CODESYS Linux Runtime & CODESYS Edge Gateway

  • taskset_CODESYS.sh: Optimizes the system (see the list below)

The provided scripts also perform the following runtime optimizations:

  • Uses Cache allocation technology (CAT) to allocate the entire L2 cache of physical CPU 1 to core 3

  • Assigns benchmark thread affinity to cores 1-3

  • Assigns non-benchmark thread affinity to core 0

  • Disables kernel machine check interrupt

  • Increases thread runtime utilization to infinity

CODESYS Example Applications

ECI is bundled with CODESYS example applications:


OPC UA Publish/Subscribe Example

The OPC UA Publish/Subscribe Example makes use of CODESYS and the ECI Edge Control Protocol Bridge to showcase bridging OPC UA Client/Server Model to OPC UA Publish/Subscribe Model. In this example topology, the EC Protocol Bridge establishes a connection as an OPC UA client to the CODESYS Linux Runtime OPC UA server. Data on this OPC UA client/server protocol is bridged to an OPC UA publish/subscribe protocol, which the EC Protocol Bridge makes available.

../_images/30.jpg

CODESYS Benchmark Application

The CODESYS benchmark is an example application that allows deterministic control and test of the CODESYS SoftPLC. The application is defined such that a main task occurs every 250us. Within the main task is a configurable workload which iterates a number of user defined times. The specific workload is configurable to either: “floating point”, “arithmetic”, or “boolean” operations. Cycle execution times are measured from which minimum, maximum, and jitter measurements are derived. These measurements allow performance characterization of the CODESYS SoftPLC on the target system.

../_images/web.png

CODESYS Example Projects

Explore the following topics to learn more about CODESYS:

Section

Description

Tutorial demonstrating how to setup, configure, and control a PROFINET device using CODESYS.

CODESYS project for measuring system performance.