Tuesday, September 19, 2017

Simple ICS Lab - Part 3 - PLCopen Editor

UPDATED 2019-02-16 to properly reference PLCopen Editor v1.3. (Previous version was 1.2.)  Also updated to include additional required package python-zeroconf.

Now that the basics are out of the way via Part 1, covering Lubuntu VM installation, and Part 2, handling the Raspbian Stretch Lite setup, we can move on to more specific ICS related software. The set of steps in this blog post will walk through the installation of PLCopen Editor and take care of a modification necessary to run the provided test project with the Raspberry Pi 3 (RPi) hardware.


As described on the PLCopen Editor web page, PLCopen Editor is software that allows you to write Programmable Logic Controller (PLC) programs according to the IEC 61131-3 standard. What this means is that you can create a program for your process logic using programming language standards like ladder diagram, function block diagram, structured text, instruction list, or sequential function chart. We will need PLCopen Editor installed on the Lubuntu ICS VM for use later when programming a project. But first, we'll install it and make sure the example "Hello World" test project is setup properly for the RPi.

Install PLCopen Editor
  • Start up the Lubuntu ICS VM if it is not already running and log in if necessary to reach the desktop.
  • Click on the "Web Browser" icon in the taskbar near the bottom-left of the desktop screen to open a browser window.
  • Scroll almost to the bottom of the web page and find the icon to download the most recent version of "PLCopen Editor v1.3 for Linux". (As of 2019-02-16 the most recent version is 1.3.)

  • Click on the download image icon to save the ZIP file. Ensure that the option "Open with Archive Manager (default)" is selected and click the "OK" button.

  • A new window should appear looking similar to the screenshot below. Click the "Extract" button near the top-left corner.

  • On the "Extract" window, accept the selected defaults (should look similar to below) and click on the "Extract" button near the bottom-right.

  • Click on the "Quit" button when the "Extraction completed successfully" window appears.
  • Before we run PLCopen Editor for the first time we will make sure that a few required software packages are installed. The required packages were documented in the text below the download icon on the PLCopen Editor web page. The next set of steps will walk through installing them.
  • Click on the menu icon in the taskbar near the bottom-left of the desktop. Select "System Tools" and then click on "LXTerminal". (Or start LXTerminal from the desktop shortcut if you previously set it up.)
  • In the LXTerminal window enter the following command to install the required software packages. Enter your password if prompted.
    • sudo apt-get -y install python-wxgtk3.0 pyro python-numpy python-nevow python-matplotlib python-lxml python-zeroconf

  • You will be returned to a command prompt once the installation of the required packages is complete.

  • Now that all required software packages are installed we can test running PLCopen Editor. Enter the commands below to run PLCopen Editor. (Note the backslash "\" escaping the space in the PLCopen Editor directory.)
    • cd PLCopen\ Editor
    • python PLCOpenEditor.py

  • After a few moments the PLCOpenEditor window should appear.

  • The installation is complete once you see the PLCOpenEditor window. You should check the LXTerminal window for error messages and try to resolve them if you do not see the window appear. Also review the steps above to ensure nothing was missed.
Prepare the "Hello World" Project

Now that PLCopen Editor is working on the Lubuntu ICS VM we will create the test project "Hello World". This project needs to be created so that OpenPLC, that will run on the RPi, can be tested once it is installed in an upcoming Part 4 - OpenPLC blog post.

  • Scroll down to the section "Running the first project" near the bottom of the page.

  • A few things to note:
    • There is an image showing what the project will look like once it is opened in PLCopen Editor.
    • There is a "Hello World" image that can be clicked on to download the project.
    • A "PS" note states that we will have to make a modification to the project file so that it will work properly on the RPi.
  • Click in the "Hello World" image to download the project. When the "Opening Hello_World.xml" dialog window appears select "Save File" and click on "OK".

  • Return to the PLCopen Editor window when the download completes. You can do so by clicking on the PLCOpenEditor item in the taskbar along the bottom of the desktop.

  • Click on "File" in the PLCopen Editor menu bar and select "Open".
  • In the file chooser window click on "Downloads" at the bottom of the "Places" list along the left side.
  • The file chooser will update the listing on the right side. Click on "Hello_World.xml" and then click the "Open" button.
  • The "Project" listing near the top-left should be updated in the main window. Double-click on "My_Program". The middle section should then update to show details of "My_Program".
  • If needed, drag the table columns of the "My_Program" listing wider so you can see all the information.
  • Double-click on the "Location" value in row 1. Update the field to be %IX0.2 (You can press "Enter" on your keyboard or click somewhere off of the "Location" field for the update to take effect.)
  • Click on "File" in the menu bar and then select "Save".

  • The "Hello World" program is now updated to work properly with the RPi.
  • The final step is to compile an ST file. Click on "File" in the menu bar and then select "Generate Program".
  • When the file chooser dialog window appears, enter the name "Hello_World.st" and click on the "Save" button.
  • Once the ST file "Hello_World.st" is generated a "Done" window will appear. Click "OK" to acknowledge the message.
  • PLCopen Editor can be closed now.
  • You may want to take a snapshot of the Lubuntu ICS VM now that PLCopen Editor has been installed successfully.
This completes the creation of the ST file from our "Hello World" project which is needed to test OpenPLC once it is fully installed on the RPi.

Simple ICS Lab - Part 3 - PLCopen editor is also complete now! We're finally in the land of ICS having now installed relevant software.