Skip to main content

Use Cases

. Within CODESYS, you can use class diagrams for the following:
  • Design and development tool

  • Analysis of an existing project

  • Navigation within a project

Use as a design and development tool

  1. To extend you application in the device tree or in the POUs view, click Project → Add Object → UML Class Diagram.

  2. In the Add UML Class Diagram dialog, specify a name. Clear the Import project structure to active class diagram option.

    The new object is added in the tree view and the class diagram editor opens an empty class diagram.

  3. . Edit the class diagram:
    • Insert a new element in the class diagram from the ToolBox view.

    • Drag an existing object (type: POU, INTERFACE, GVL, or DUT) from the device tree to the class diagram. Drop it at a suitable location to visualize it there.

    • Generate relationships using the command icons directly in the class diagram.

    All entries also apply to the objects in the project and are immediately visible in the device tree.

Tip

As soon as you have created a new object, the Edit → Undo and Edit → Redo commands are disabled.

Use as an analysis tool of an existing project

For small projects with few objects, it makes sense to create a class diagram of the entire project. Then you can analyze the relationships between the objects in the class diagram. With complex projects, the creation of the entire class diagram does not always make sense, because the view becomes very complicated and confusing. In this case, you should start from the main program and drag individual objects one after the other into an empty class diagram. Then you can use the incoming and outgoing cross-references in the ToolBox view to add more elements.

Procedure. Analysis of a small project
  1. To extend you application in the device tree or in the POUs view, click Project → Add Object → UML Class Diagram.

  2. In the Add UML Class Diagram dialog, specify a name. Select the Import project structure to active class diagram option.

    The new element is inserted in the device tree and the class diagram editor shows the class diagram of the entire project.

Procedure. Analysis of a complex project
  1. To extend you application in the device tree or in the POUs view, click Project → Add Object → UML Class Diagram.

  2. In the Add UML Class Diagram dialog, specify a name. Clear the Import project structure to active class diagram option.

    The new object is inserted in the device tree and the class diagram editor opens.

  3. Drag the main program from the device view or POU view to the class diagram editor.

    The class diagram element is added. The incoming and outgoing cross-references of the object are displayed In the ToolBox view.

  4. Drag the desired element from the Incoming cross references or Outgoing cross references to the editor.

    This element is added in the class diagram editor. The relationships to existing elements are represented by connecting lines.

  5. Drag more elements to the editor and analyze the program step by step.

Procedure. Generating a class diagram from the project structure

You can import all objects from the Devices view or POUs view of the device tree all together into a class diagram.

  1. In the Devices view (device tree) or in the POUs view, click Project → Add Object → UML Class Diagram.

  2. In the Add UML Class Diagram dialog, specify a name. Select the Import project structure to active class diagram option.

    The class diagram opens with all relevant objects that are contained in the Devices view or POUs view.

Navigating within the project

You can use the class diagram as a navigator.

  1. To extend you application in the device tree or in the POUs view, click Project → Add Object → UML Class Diagram.

  2. In the Add UML Class Diagram dialog, specify a name. Select the Import project structure to active class diagram option.

    The new object is inserted in the device tree and the class diagram editor shows the class diagram of the entire project.

  3. Double-click the class diagram element to open the editor of individual objects. Edit the declaration and implementation as usual.

    Changes are visible immediately in the class diagram.