PLC Programming Quickstart Guide : First 60 minutes of most PLC Programming Environments – Part 1

 

Most control engineers and PLC users are going to encounter several PLC platforms over a career span. Whether through jobs at different companies or through migration of control platforms, the need to adapt and learn new programming environment is an essential part of the job.  As I go through this process with a new platform, the following checklist was developed as a ‘quickstart guide’ when programming in a new PLC platform.

 

The good news is that most PLC programming platforms use a very similar set of features. The features are called using different names by different vendors. In many cases, even the layout of the program is similar. There is usually a directory on the left side of the screen, a message window at the bottom…etc.

 

So, this post will be Part 1 of a multi-part series about the key things to look out for in a new PLC programming environment. The way this will be set up is as follows:

 

  • Several programming platforms will be referenced in examples; SoMachine (CODESYS), SoMachine HVAC and Rockwell CCW. I’m very familiar with SoMachine and CODESYS, new to SoMachine HVAC and never used Rockwell Automation’s CCW before.

 

  • The intent would be to get proficient enough in a new environment to write simple to intermediate programs. We will save more advanced features for another discussion.

 

  1. I/O Declaration

 

The basic function of a PLC is to be able to accept inputs and control outputs. In most current PLC programming environments, the inputs and outputs are referred to in the logic using variable/tag names or pre-assigned terminal designations.

If a PLC program is to be looked upon as a story, the main characters would be the variables and the I/O. They are the subject.

 

So, the key questions when encountered with a new environment is:

Where are input and output variables or tag names assigned?

How are they called in the program- pre-assigned name or user-defined names?

 

Common approaches:

The I/O tags or their user assigned tag/symbol names are declared in one place and then available to be called throughout the program. They are essentially similar to global variables.

Some of the terms used for these names include symbols (CODESYS), tags (often used in SCADA environments and aliases (alternate references to a I/O point in Rockwell controllers)

 

In SoMachine the input and output mapping can be addressed using either the address assigned to the terminal input( this is referred to as direct addressing) or a user-defined symbol name.

I/O declaration in SoMachine
I/O declaration in SoMachine

 

In CCW, I/O is addressable in code using either the pre-assigned name or an alias.

I/O Declaration in CCW
I/O Declaration in CCW

 

Between the pre-assigned name and the user-defined name, both are usable in this case. With the usage of the pre-assigned name in SoMachine, a pop-up usually occurs to advise the user to use symbolic addressing for ease of maintenance and modification.

 

 

  1. Variable declaration

 

Once the I/O is declared and accessible in the program, the next point of interest would be to figure out where and how variables are declared. Some variables can be pre-planned if we know the functions they will be plugged into. Others may be added on the fly.

 

The two main types of variables are the local and global variables. Local variables can be called from the POU that it is declared in. Global variables are accessible anywhere in the project.

 

Some environments allow for variables to be declared textually. Others require a tabular declaration with a pull down for the data type. The textual declaration may involve a little more typing, however, the benefit is that it is more flexible and supports copy and pasting variable names. For larger projects, variables can be created in a spreadsheet separately and then pasted into the PLC program project. The benefit of a separate variable creation is that variations of the variable name for SCADA purposes and also the generation of memory locations can be performed easily and quickly in a spreadsheet.

For textual declarations, observe the syntax used for various data types. Some key questions here are:

How are variables given an initial value?

How are persistent or retain variables created ( to keep values through power cycles)?

How are arrays declared?

 

Regarding the point about retain and persistent variables. In CODESYS, the retain variables holds a value through power cycles. Persistent variables hold a value through program downloads.

In SoMachine, retain variables are declared using the VAR_RETAIN header in the variable declaration section.

Declaring Retain Variables
Declaring Retain Variables in SoMachine

Variables to be kept through program downloads are declared in a separate object.

 

Persistent Variables to hold a value through program downloads
Persistent Variables to hold a value through program downloads

 

Next part will cover the program types or POU’s as referenced by the IEC 61131-3 standard…

Share

Leave a Reply

Your email address will not be published. Required fields are marked *