Attention

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

OpenPLC Software

OpenPLC* is an open-source Programmable Logic Controller (PLC) that is based on an easy-to-use software. It is the first fully functional standardized open source PLC, both in software and hardware. The OpenPLC project was created in accordance with the IEC 61131-3 standard, which defines the basic software architecture and programming languages for PLCs.

For more information, refer to the OpenPLC Project.

Install OpenPLC Editor and Runtime

The following section is applicable to:

../_images/target1.png

The OpenPLC Project consists of two parts: Runtime and Editor. Do the following to install OpenPLC editor and runtime:

  1. Install and enable a graphical Desktop Environment.

  2. Setup the ECI repository

  3. Run the following command to install the OpenPLC components:

    $ sudo apt install eci-softplc-plcopen
    
  4. Set up the IgH EtherCAT Master Stack.

  5. Run the OpenPLC installation script:

    $ sudo /opt/plcopen/openplc-editor/install_openplc_editor.sh
    $ sudo /opt/plcopen/openplc-runtime/install_openplc_runtime.sh
    
    Note:

    OpenPLC Editor uses Python* 2.7 to build its GUI, which depends on the deprecated packages in Debian 11 (Bullseye) or Canonical® Ubuntu® 22.04 (Jammy Jellyfish). You need to manually download python-wxgtk3.0 and python-wxversion and install from Deb package.

After the installation is complete, a warning message Compilation finished with errors! might be displayed. You can ignore this warning, since this will not prevent OpenPLC from running with EtherCAT* and RTmotion*.

OpenPLC Sample Applications

This section describes the procedure to build a demo to drive a single motor with OpenPLC.

Write PLC Program

The following figure shows a sample demo of driving a single motor to a specific velocity.

../_images/solo-motor-program.png

You can drag RTmotion function blocks from the Library tab, on the right, and place it in the program.

To enable the PLC control program work smoothly with EtherCAT, add a global variable called ENIFile to resource (For example, Res0 in the Project tab). The initial value of ENIFile should be the same as the name of XML file that describes the EtherCAT slave topology.

../_images/program-resource.png

Click Generate program for OpenPLC Runtime, available on the toolbar, to generate an ST file as normalized PLC program.

Execute PLC Program in OpenPLC Runtime

The OpenPLC runtime has a built-in web server, which provides a web UI for configuration. To access the web UI, open a browser and use the machine IP address on port 8080 as the URL.

For the initial login page, the default username and password is openplc and openplc respectively.

After logging in, from the left menu, click Hardware and choose EtherCAT. The OpenPLC runtime will be able to control EtherCAT slaves with EtherCAT as a hardware layer.

Then, from the left menu, click Programs and upload the ST program generated from Write PLC Program.

Copy the ENI XML file, with the name same as that of the initial value of global variable ENIFile, in PLC program to OpenPLC_v3/webserver. If all configurations are correct, click Start PLC from the left menu to cause OpenPLC to drive the motor.