PLCopen Guidelines for Object Orientation - application example for Motion Control

In November 2021 PLCopen released their Guidelines for Object Oriented Programming, version 1.0. This is a document within the framework of the PLCopen Software Construction Guidelines. It shows how to convert a “classical” program to an OO program.

The PLCopen Promotional Committee on Training is now working on a side document showing an application example for Motion Control.

With the PLCopen specification “Function blocks for Motion Control (formerly Part 1 and Part 2)”, the PLCopen Task Force Motion Control provided a set of standardized Function Blocks to ease modularization and reuse of motion control software.
The new document that PLCopen is now working on presents an object-oriented implementation of the motion control specification, which can be combined with the set of procedural standard Function Blocks (FBs). The general design of the proposed object-oriented (OO) implementation is a single Axis Class implementing different functions as Methods instead of formerly used multiple FBs. A benefit of the proposed software design is the compatibility with procedural motion control FBs: the standard FBs can call the Axis Class internally to combine both approaches in one application. Thus, the user of the OO implementation does not need to be familiar with the detailed OO principles or language elements for using it.

As common in object-oriented programming (OOP), an interface is used to define the motion standard since it describes how a class is presented to the outside (sometimes including the behavior). More precisely, an interface is the definition of the functionalities that a class may implement. The class is the actual implementation of the defined functionalities, including vendor-specific aspects. Correspondingly, this document standardizes a motion interface. For using this standard, an axis class needs to be implemented, which follows (“implements”) this standardized motion interface. In short: the interface defines the functionalities, but not how they are implemented (their content), which is done vendor-specific in an axis class.

Utilizing two application examples, this document shows how the standardized FBs from the PLCopen motion control specification can be ported to OOP by using a standardized interface itfAxis as introduced below. To apply the standard in a vendor-specific implementation, the programmer develops a class, which implements the interfaces itfAxis and, thus, has all the functions standardized in itfAxis without implementation. Then the actual, vendor-specific implementation of these functions is programmed. The advantage of the proposed interface itfAxis is that one can decide how to program: on one hand, the standard FBs can be used, and they can internally call the itfAxis methods. On the other hand, it is possible to program in OOP by using the defined methods to start a new command, get the current status of an axis, and update or abort a command. The details on the proposed interface and the contained methods as well as several user-defined data types are introduced in the document.

This document focuses on the motion control part of the axes only. In real projects, the axis class will have many other properties and methods for communication, hardware configuration, and additional aspects. For simplicity, these are not explained in this document.