Basic principles

The UML class diagram can be used to document, analyze, design and expand the structure of a (sophisticated) system. In the process, classes can be designed and relationships between them can be mapped. The clear representation of PLC program elements includes, among other things, inheritance and implementation relationships, so as to clearly visualizing interrelationships. A UML class diagram is therefore ideal for graphical system documentation and offers a comprehensible basis for conveying technical content.

The class diagram editor provides elements that map the object orientation of the project. Since the editor is embedded in the PLC area of the TwinCAT 3 development environment, automatic generation of code is possible. An extensive range of features and tools is integrated.

The class diagram can be used in two directions. The existing project structure can be imported into the class diagram, or selected elements of the existing project structure can be added to the class diagram. As a result, the already existing software architecture can be documented and analyzed. Secondly, the class diagram offers the possibility to change and expand existing PLC elements or the existing project structure. This modification can be carried out with the aid of the class diagram editor and the associated elements of the toolbox. These allow the software architecture to be changed and expanded and at the same time to be documented and analyzed.

Terms from the object orientation

Synonym in IEC 61131-3

Class (UML: class)

POU types:

  • Program (PRG): PROGRAM
  • Function block (FB): FUNCTION_BLOCK
  • Function (FUN): FUNCTION

Attribute (UML: attribute)

  • Internal variable
  • Parameter: {input}
  • Property: {property}
  • Output parameter: {output}

Variable types:

  • Variables: VAR
  • Input variables: VAR_INPUT
  • Property: PROPERTY
  • Output variables: VAR_OUTPUT

Operation (UML: operation)

  • Method: METHOD
  • Action

Interface (UML: interface)

Interface: INTERFACE

 

Global variable list (GVL): VAR_GLOBAL

 

User-defined data type (DUT): TYPE

Synchronicity

Objects in the class diagram and the project are kept identical, so that user inputs affect both views. This means the corresponding objects in the project tree are changed automatically when objects are changed via the class diagram. On the other hand, modifications in the project tree automatically become visible in the class diagram, if the corresponding objects are shown in the class diagram.

Application options

In general, the following applies:

In the interest of clarity it is generally preferable to show only a few objects in a class diagram. In this way it is possible to create subject-related or project section-related class diagrams, as sample. The objects shown can have particular dependencies, so that the objects and their dependencies are clearly displayed. On the other hand, objects without explicit dependencies to one another can also be shown in a diagram, so that they can be compared in parallel.

Based on this, the class diagram can be used for various purposes:

Information on which commands or actions can be used for the individual purposes is provided below.

As design and development tool

As analysis tool for existing projects

As project navigator

Commands

The following commands or action options are available for the class diagram:

Also note the commands, which are available for all UML diagrams: Common commands for all UML diagrams

Access modifier

Basic principles 1:

Available from TC3.1 Build 4026

The access modifier of a method or a property is displayed in the class diagram by means of a symbol. The following table shows which symbol stands for which access modifier.

Symbol

Access modifier

+

PUBLIC

#

PROTECTED

-

PRIVATE

~

INTERNAL