ABSTRACT concept

The keyword ABSTRACT is available for function blocks, methods and properties. It enables the implementation of a PLC project with abstraction levels.
Abstraction is a key concept of object-oriented programming. Different abstraction levels contain general or specific implementation aspects.

ABSTRACT concept 1:

Available from TC3.1 Build 4024

Application of the abstraction

It is useful to implement basic functions or commonalities of different classes in an abstract basic class. You implement specific aspects in non-abstract sub-classes.
The principle is similar to the use of an interface. Interfaces correspond to purely abstract classes that contain only abstract methods and properties. An abstract class can also contain non-abstract methods and properties.

Rules for the use of the keyword ABSTRACT

Sample

Abstract basic class:

FUNCTION_BLOCK ABSTRACT FB_System_Base

The commonalities of all system modules are implemented in this abstract basic class. It contains the non-abstract property "nSystemID" and the abstract method "Execute" for this:

PROPERTY nSystemID : UINT
METHOD ABSTRACT Execute

whereas the implementation of "nSystemID" is the same for all systems, the implementation of the method "Execute" differs for the individual systems.

Non-abstract sub-class:

FUNCTION_BLOCK FB_StackSystem EXTENDS FB_System_Base

Non-abstract classes that are derived from the basic class are implemented for the specific systems. This subclass represents a stack. Since it is not abstract, it must implement the method "Execute" that defines the specific stack execution:

METHOD Execute