IEC 61131-3: The Decorator Pattern

With the help of the decorator pattern, new function blocks can be developed on the basis of existing function blocks without overstraining the principle of inheritance. In the following post, I will introduce the use of this pattern using a simple example.

Continue reading “IEC 61131-3: The Decorator Pattern”

IEC 61131-3: The Observer Pattern

The Observer Pattern is suitable for applications that require one or more function blocks to be notified when the state of a particular function block changes. The assignment of the communication participants can be changed at runtime of the program.

Continue reading “IEC 61131-3: The Observer Pattern”

IEC 61131-3: The Command Pattern

A command can be run on a function block by calling a method. Function block A calls a method of function block B. So far, so good, but how can such commands be exchanged flexibly between several function blocks. The command pattern provides an interesting approach.

Continue reading “IEC 61131-3: The Command Pattern”

IEC 61131-3: The Abstract Factory Pattern

If instances of a function block have to be created, the exact type of the function block should be known before compiling. Properties of an application can hardly be expanded by this fixed assignment. For example, this will be the case when the function block is located in a library and the access to the source code is thus not possible. The instance variable is constrained by a specific type. A class factory can help to break these stiff structures.

Continue reading “IEC 61131-3: The Abstract Factory Pattern”