In desktop application development and in university education, OOP (object oriented programming) in languages like Java or C++ is common place now. OOP has demonstrated its capability for handling complex software development problems in an elegant way and for producing reusable, flexible software components. It has reduced the development time of new software and simplified the complex software tasks solution.
On the other hand industrial controller (PLC) are mostly programmed in the languages of the IEC 61131-3 standard. While some developers can not wait to use OOP for PLC programming, others may be skeptical about the adequacy of OOP for their PLC projects. In order to address both parties, an object oriented programming (OOP) tool should satisfy the following requirements:
• Integration in a PLC development environment: Integrated with the object oriented programming (OOP) itself, ones should have integrated direct access to I/O signals, configuration of I/Os and online debugging functionality with online change and variable forcing. Advantage PLC application development has many specifics which existing C++ development tools available for many targets CPU does not address.
• Multi paradigm programming: object orientation programming (OOP) should be optional. Code programmed in the classical, procedural way should be mixable with object oriented code. Advantage: this offers the skeptics a reversible and a stepwise transition.
• OOP by extension of the IEC: Object oriented programming (OOP) PLC programming should be supported by extending IEC programming with a small set of standard object oriented features. Advantage: not having to learn a new language completely avoids a steep learning curve for PLC programmers.
• Multi lingual: object oriented programming (OOP) should be supported in all languages of the IEC 61131-3, not just in the textual IEC language ST most similar to C++ and other known object oriented languages. Advantage: textual languages can not represent certain important aspects of PLC applications clearly, like state machines and complex Boolean connection networks.
The Element of Object Oriented Programming
OOP (Object Oriented Programming) is best explained not in terms of programming language features but by its specific approach to organizing the software. A language can be called object oriented if its linguistic elements allow the programmer to express such an organization.
These are the three accepted elements of the object oriented organization:
1. Classes organize objects by similarity.
2. Objects organize the system of computational into components.
3. Sub classing organizes classes by degrees of similarity.
The fundamental characteristic of Object Oriented Programming (OOP), as opposed to classical procedural programming (C, IEC), is a new way of thinking about the system of computational: the procedural view separates the representation of the system’s state through data components (variables) from the implementation of the system’s behavior through “procedure”. The system is composed of interconnected objects in the object oriented view. Each object is a small procedural system with its own behavior and state. An object’s method can operate on its state and call the methods of other objects, to which it is connected by object references.
Advantage: assume a virtual object or real object shall be managed by your system. Is it natural to think of this as an additional data structure, whose handle you have to pass into a Windows-API or a Devices-API? Or is it more natural to think of it as a new object that brings its behavior with it and that you invoke on that object directly?
Instances of function block diagram (FBD) programming with methods are objects in CoDeSys V3. Through the standard dot notation for invoking a method, the notion is support that the method as a part of the function block instance.
In CoDeSys as in most object oriented programming languages, beside objects there are still other entities in the system of computational, like global or ”static’ procedures and global or “static” variables.