Generalization

A generalization is a UML relationship that expresses an inheritance or specialization. The inheriting element has the attributes and operations of the element from which it inherits. In IEC coding this relationship corresponds to the keyword EXTENDS.

Generalization 1:

A generalization indicated by an arrow with a solid tip, pointing from the inheriting class to the base class from which it inherits. The direction of the arrow indicates which component inherits from which.

Inheritance is possible between classes, interfaces and user-defined data types:

Property

“Property”

Description

“Relationship”

Generalization (not editable)

Edit generalization

User input in the class diagram

Response in the class diagram

Description

Select the tool “Generalization”:

Generalization 2:

Select the object that is to inherit, then click on the parent object.

A generalization is created, pointing from the inheriting element to the parent element.

The IEC code is automatically adapted to indicate the parent element in the declaration section of the inheriting class. Example:

FUNCTION_BLOCK FB_Sample EXTENDS FB_BaseExistent

Select the tool “Generalization”:

Generalization 3:

Select the object that is to inherit, and then click on an empty area in the diagram.
A dialog for creating a new object opens. Enter a name, adjust the settings and close the dialog with "Add".

A generalization is created, pointing from the inheriting element to the new parent element.

The IEC code is automatically adapted by creating a new object and indicating the parent object in the declaration section of the inheriting object. Example:

FUNCTION_BLOCK FB_Sample EXTENDS FB_BaseNew

Select the tool "Pointer“.
Click on a generalization and move the line with the mouse.

 

The selected (and therefore blue) generalization runs at the new position.

Select the tool "Pointer“.
Click on a realization and use the [Del] key or click on "Delete" in the context menu.

 

The generalization is removed from the diagram and the IEC code. The EXTENDS statement is removed from the declaration section of the inheriting object

Samples

Generalization 4:

FUNCTION_BLOCK FB_Sub EXTENDS FB_Base

Generalization 5:

INTERFACE I_Cylinder EXTENDS I_Base

Generalization 6:

TYPE ST_Sub EXTENDS ST_Sample :
STRUCT
aMessages : ARRAY[1..10] OF STRING;
END_STRUCT
END_TYPE