Are you making the most of PLC programming standards from PLCopen?

IEC 61131-3 offers users a reliable framework to develop efficient solutions at all phases of their automation process, and is used to support PLCopen libraries.

By Dulce Maria Varela July 4, 2023
Courtesy: Yaskawa

 

Learning Objectives

  • Understand the types of programming languages supported by PLCopen and the roles they play.
  • Learn about the benefits of program optimization and how users can integrate and reuse code.
  • Understand how troubleshooting support can help users when they run into problems or issues.

PLC programming insights

  • Programmable logic controller (PLC) programming needs frameworks and structures that can help users make better decisions.
  • Knowing the fundamentals of supported programming languages, PLC program optimization and how to take advantage of troubleshooting support can go a long way.

In its third edition, the PLC programming language standards, IEC 61131-3, offers users a reliable framework to develop efficient solutions at all phases of their automation process. The standard is inclusive of three graphical and two textual programming languages used to support PLCopen libraries designed for various applications and communications with ongoing support, creating reusable code to exist for different builder needs. PLCopen offers three benefits for programmers: Multiple supported programming languages, program optimization and troubleshooting support.

1. Supported programming languages

While code portability or code interoperability among PLCs cannot be guaranteed, the standard supports commonly used languages:

  • Graphical programming languages

    • Ladder diagram (LD) – Composed of different types, contacts and coils

    • Function block diagram (FBD) – Consisting of functions and/or function blocks

    • Sequential function chart (SFC) – Composed of steps and transitions.

  • Textual programming languages

    • Structured text (ST) – Consists of statements and expressions

    • Instruction list (IL) – Sequence of instructions.

The flexibility allows users to remain consistent in their coding if they need to perform a retrofit. It also helps if they’re starting a new project by allowing them to choose their preferred method of programming. In some examples, users may find it beneficial to create function blocks (FBs) from their structured text subroutines, integrate PLCopen function blocks to their logic for better performance and/or restructure logic due to troubleshooting procedures.

The standard’s support for diverse languages makes it feasible to operate and implement the various application PLCopen libraries, while users program in their preferred language(s).

Figure 1: PLCopen FB Byte_To_Buf instantiated in ST: FB is used to process data swapping for the output/input command on a Modbus communicating sensor. Courtesy: Yaskawa

Figure 1: PLCopen FB Byte_To_Buf instantiated in ST: FB is used to process data swapping for the output/input command on a Modbus communicating sensor. Courtesy: Yaskawa

2. Program optimization: Integrate and reuse

Integrated PLCopen libraries on IEC 61131-3 compliant programming environment(s) provide users with guidelines and best practices to assist in developing efficient and reusable PLC programs, as well as other tools for users to adapt PLCopen guidelines into code for metrics like desired memory usage or performance of their PLC programs.

PLCopen libraries are designed and created to support and monitor a project’s logic, motion control, safety, OPC UA-HMI, and XML (project source code export), based on configuration needs, alongside application focused PLCopen libraries in homing, coordinated motion, torque control, camming and gearing. The wide range of functionalities is meant to support users in each step of their process, cutting down on programming time.

The PLC programming language standards IEC 61131-3 also allow users to create variables that can be applied to retain/constant values, while being assigned as a global, local, external, temp or input/output (I/O) mapping. The standard’s openness for variable creation makes customizing PLCopen libraries with standard FBs (counter, timer, etc.) and functions (Type convert, Bit-string, INTEGER, REAL, etc.) a feasible task. The adaptation of functions/FBs also can help projects run more efficiently while reducing code by granting users the potential to reuse them in other project sections.

When making the most of the PLC programming standards, users also may allocate CPU based configuration resources to assign programs to tasks based on default, cyclic, event or system. Users are able to assign task interval time, priority level and watchdog timing for the assigned programs. The configuration resource capability is a beneficial tool in ensuring applications meet desired timing and execution expectations.

PLCopen and PLC programming language IEC 61131-3 guidelines make it possible for users to optimize projects while providing additional measures to configure, customize and troubleshoot for completion.

Figure 2: PLCopen FB MC_ReadAxisError may be used to determine motion control axis errors with ErrorID values providing further description and resolutions. Courtesy: Yaskawa

Figure 2: PLCopen FB MC_ReadAxisError may be used to determine motion control axis errors with ErrorID values providing further description and resolutions. Courtesy: Yaskawa

3. Troubleshooting support

As part of its development, PLCopen, operating on complaint programming environment(s), provides users tools to troubleshoot applications issues with many PLCopen libraries including embedded logic to signal error alarms, error ID/codes with potential resolutions. Users also could use the standard’s tools to further troubleshoot PLCopen for syntax errors, logical mistakes, incorrect parameter settings and more.

In making the most of PLCopen troubleshooting capabilities, users may implement their own IEC 61131-3 compliant responses to act accordingly to their needs, such as monitoring external hardware issues (if they are aware of the necessary parameter), data type and values. They can also create error alarms and warnings for production processing. Specific to motion instruction, PLCopen specifies a state diagram, of which transitions are possible for various states, alongside a function block, for users to determine what state an axis/group is in.  This allows for ongoing state monitoring for an extra measure of preventive care.

In IEC 61131-3 compliant programming environments, users may have various tools that can be used to debug in both offline and online formats. Online tools may monitor input or output values, while checking status updates from devices or sensors, or for execution flow in user programs. If users need further diagnostics, using compliant graphing tools can also help address unexpected behavior. In an offline setting, users have the ability to compare projects, which can be used to manage project versions and track modifications, ensuring projects remain correctly configured and variables have properly defined data types, ranges, memory allocations and initialization necessities.

While there are many tools within IEC 61131-3 compliant programming environments and PLCopen solutions, it is always best practice to revise project code for potential errors before downloading onto physical hardware.

Figure 3: Plcopen Motion State Diagram: Monitoring for Errors, Homing, Stopping, etc. Courtesy: Yaskawa

Figure 3: Plcopen Motion State Diagram: Monitoring for Errors, Homing, Stopping, etc. Courtesy: Yaskawa

Dulce Maria Varela is a regional motion engineer for Yaskawa America, Inc. Edited by Chris Vavra, web content manager, Control Engineering, CFE Media and Technology, cvavra@cfemedia.com.

MORE ANSWERS

Keywords: programmable logic controller, PLCopen

ONLINE

See additional PLC stories at https://www.controleng.com/control-systems/plcs-pacs/

CONSIDER THIS

How do you use PLCopen in your programming and what role does it play?


Author Bio: Dulce Maria Varela is a regional motion engineer for Yaskawa America, Inc., located in Los Angeles, California. She has a bachelor's degree in Mechanical Engineering from the University of Illinois at Chicago and her experience comes from time spent supporting various types of applications at different stages in their automation process.