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 or in TwinCAT 3.1 |
---|---|
Class (UML: class) | POU types:
|
Attribute (UML: attribute)
| Variable types:
|
Operation (UML: operation) |
|
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:
- Not all elements of a project have to be shown in the class diagram.
- Several class diagrams can be added to a project.
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:
- As design and development tool
- As analysis tool for existing projects
- As project navigator
Information on which commands or actions can be used for the individual purposes is provided below.
As design and development tool
- Create a new, empty class diagram.
- The class diagram can be edited by means of various action options.
→ All inputs also affect the objects in the project and are immediately visible in the project tree.
As analysis tool for existing projects
- Add existing elements to the class diagram.
- Analyze the existing project structure with the aid of the class diagram you created and edit the diagram if required.
→ All inputs also affect the objects in the project and are immediately visible in the project tree.
As project navigator
- Open a class diagram and double-click on an element in the class diagram to open the corresponding editor.
- The declaration and implementation can be edited as usual, if required.
→ Any changes of the declaration are automatically updated in the class diagram.
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