Dependency (Select) Queries

Dependency (Select) Queries

The following queries are available by default (by EcoStruxure Machine Expert installation).

Group: Misc

Name

Description

Call Graph

Description: This query chain generates a dependency view with the POUs acting as callers or are called by another POU of the selected scope (for example, defined below the Application).

Results: Assumed that only one task is defined and only one program (PRG) is executed, the resulting graph is a tree of POUs connected via call edges.

If multiple tasks are defined or multiple programs (PRGs) are executed, it depends on the implementation whether a common POU is called by both or not. Then the result shows multiple call trees in one dependency view (as a graph).

Use Case: The dependency view can be used to analyze the call tree in a graphical way and see which POUs are used by which POU and which POUs are used more than once.

If POU is called more than once, a bug fix in this POU is automatically established in both call trees.

Source code example:

fbMyFunctionBlock.TestMethod();

Extend (FunctionBlock)

Description: This query chain generates a dependency view with the function blocks (FBs) of the selected scope (for example, defined below the Application) that extend another FB.

As an example, a basic function block is called FB_DriveBase. This FB_DriveBase can be extended by concrete FB_LXM52 and FB_LXM62.

Results: The result is a graph of function blocks connected via extend edges.

From a subnode function block (FB not extended by another FB like FB_LMX62), you get the chain of FBs to its basic FBs.

For the FBs in a project, you see the FB siblings using the same basic FB.

Use Case: The dependency view can be used to visualize the extend chain for FBs. You can see if there are siblings extending the same basic FB with a similar functionality and could be replaced by another. For example, you can use FB_LXM62 and FB_LXM52 as a method input argument based on FB_DriveBase. This method can handle both type of drives.

Source code example:

FUNCTION_BLOCK FB_MyTest EXTENDS FB_MyTestBase

Extend (Interface)

Description: This query chain generates a dependency view with the interfaces of the selected scope (for example, defined below the Application) that extend another interface.

As an example, a basic interface is called IF_DriveBase. This IF_DriveBase can be extended concrete by IF_LXM52 and IF_LXM62.

Results: The result is a graph of interfaces connected via extend edges.

From a subnode interface (interface not extended by another interface like IF_LMX62), you get the chain of interfaces to its basic Interface.

For the interfaces in a project, you see the interface siblings using the same basic interface.

Use Case: The dependency view can be used to visualize the extend chain for interfaces. You can see if there are siblings extending the same basic interface with a similar functionality and could be replaced by another. For example, you can use FB instances implementing IF_LXM62 or IF_LXM52 as a method input argument based on IF_DriveBase. This method can handle both type of drives.

Source code example:

INTERFACE IF_MyTest EXTENDS IF_MyTestBase

Extend Graph

Description: This query chain generates a dependency view with the interfaces and function blocks (FBs) of the selected scope (for example, defined below the Application) that extend another Interface.

As an example, a basic interface is called IF_DriveBase. This IF_DriveBase can be extended concrete by IF_LXM52 and IF_LXM62 (same for FBs).

Results: The result is a graph of Interfaces and FBs connected via extend edges.

From a subnode interface / FB (interface / FB not extended by another interface / FB like IF_LMX62), you get the chain of interfaces / FBs to its basic interface / FB.

For the interfaces / FBs in a project, you see the interface / FB siblings using the same basic interface / FB.

Use Case: The dependency view can be used to visualize the extend chain for interfaces and FBs together. You can see if there are siblings extending the same basic interface / FB with a similar functionality and could be replaced by another. For example, you can use FB instances implementing IF_LXM62 or IF_LXM52 as a method input argument based on IF_DriveBase. This method can handle both type of drives.

Source code example:

FUNCTION_BLOCK FB_MyTest EXTENDS FB_MyTestBase

or

INTERFACE IF_MyTest EXTENDS IF_MyTestBase

GVL Graph

Description: This query chain generates a dependency view with the defined Global Variable Lists (GVLs) of the selected scope (for example, defined below the Application).

Results: The result is a graph of nodes (GVLs) without edges between each other.

Use Case: This dependency view can be used to explore the GVLs. You can add for example, the variables connected to the GVL you are interested in.

Source code example:

VAR_GLOBAL
     G_iGVLTestVar: INT;
END_VAR

GVL+Variable Graph

Description: This query chain generates a dependency view with the defined Global Variable Lists (GVLs) of the selected scope (for example, defined below the Application) and the variables defined in these GVLs.

Results: The result is a graph of nodes (GVLs + variables) and its dependencies. If multiple GVLs are defined in an application, you see groups of nodes (a GVL and its variables). The groups are in most cases not connected to each other.

Use Case: This dependency view can be used to explore the GVLs + variable of the project. You can add, for example, reading and writing nodes to visualize if a variable is used by multiple code snippets or only used by one node to be declared more locally in for example, a PRG.

Source code example:

VAR_GLOBAL
     G_iGVLTestVar: INT;
END_VAR

Implement Graph

Description: This query chain generates a dependency view with the function blocks (FBs) implementing interfaces of the selected scope (for example, defined below the Application).

Results: The result is a graph of FBs and interfaces connected via implement edges.

For the FBs in a project, you see which other FB is also an implementation of the linked interfaces.

Use Case: The dependency view can be used to visualize the implement dependencies of FBs. You can use it to visualize for example, missing interface implementations if, for example, multiple FB types must meet the same specification to be used by a method.

Source code example:

FUNCTION_BLOCK FB_MyTest IMPLEMENTS IF_MyTest, IF_MyTest2

Implement+Extend Graph

Description: This query chain generates a dependency view with the function blocks (FBs) and interfaces of the selected scope (for example, defined below the Application) and how they are linked together.

Results: The result is a graph of FBs and interfaces connected via implements edges or extends edges.

Use Case: This dependency view can be used to visualize the implements and extends dependencies at once.

Source code example:

FUNCTION_BLOCK FB_MyTest EXTENDS FB_MyTestBase IMPLEMENTS IF_MyTest, IF_MyTest2

Library Stack

Description: This query chain generates a dependency view with the used libraries in the project.

Results: From application point of view, you generate the library stack your application is based on. You see the directly referenced libraries and the indirectly referenced libraries.

Use Case: This dependency view can be used to visualize the library stack at once in a graphical way. You can see the library layers.

For example, Application > Technology Libraries > PacDrive Library > System Libraries (Firmware API).

Node Graph

Description: This query chain generates a complete dependency view of the nodes of the selected scope (for example, defined below the Application) and how they are linked together.

Results: The result graph contains the nodes of any type (FBs, PRGs, FCs, variables, libraries, DUTs, and so on) with the different kind of edges between these nodes.

Use Case: This dependency view can be used to visualize the complete project at once. Keep in mind that this dependency view contains many different node and edge types at the same time and you are not able to see your code from a specific view (for example, compared to the call tree).

POU Graph

Description: This query chain generates a dependency view with the defined function blocks / functions (POUs) of the selected scope (for example, defined below the Application).

Results: The result is a graph of nodes (POUs). If the POUs are linked, for example, via a call edge, this edge is also part of the result.

Use Case: This dependency view can be used to explore the POUs. You can add for example, the variables connected to the POU you are interested in.

POU+Variable Graph

Description: This query chain generates a dependency view with the defined programs / function blocks / functions (POUs) of the selected scope (for example, defined below the Application) and the variables defined in these POUs.

Results: The result is a graph of nodes (PRGs + variables) and its dependencies.

Use Case: This dependency view can be used to explore the POUs + variable of the project. You can add for example, reading and writing nodes to visualize if a variable is used by multiple code snippets or only used by one node to be declared more locally in for example, a POU.

Source code example:

PROGRAM SR_MyTest
VAR
    iSRTestVar: INT;
END_VAR

Read Graph

Description: This query chain generates a dependency view with the read operations of the selected scope (for example, defined below the Application) to a variable.

Results: The result is a graph of POUs (programs / functions / function blocks, and so on) and the variables which are liked via a read edge.

Use Case: This dependency view can be used to explore the read operations to variables and to see if it is read multiple times or only once in the project.

Source code example:

dummy0 := iSRTestVar;

Read+Write Graph

Description: This query chain generates a dependency view with the read and write operations of the selected scope (for example, defined below the Application) to a variable.

Results: The result is a graph of POUs (programs / functions / function blocks, and so on) and the variables which are liked via a read or write edge.

Use Case: This dependency view can be used for example, to explore the read and write operations to variables and to see if it is read multiple times or only once in the project but never written.

Source code example:

dummy0 := iSRTestVar;
iSRTestVar := dummy0;

Write Graph

Description: This query chain generates a dependency view with the write operations of the selected scope (for example, defined below the Application) to a variable.

Results: The result is a graph of POUs (programs / functions / function blocks, and so on) and the variables which are liked via a write edge.

Use Case: This dependency view can be used to explore the write operations to variables and to see if it is written multiple times or only once in the project.

Source code example:

iSRTestVar := dummy0;

Device Graph

Description: This query chain generates a dependency view of the device tree.

Results: The device tree with the device instances and their subnode dependencies.

Use Case: This dependency view can be used to visualize the device tree and explore the linkage to variables representing the devices inside the application

Test Element Graph

Description: This query chain generates a dependency view of the test elements (TestCases, TestResources, TestSets, and so on).

Results: The test elements and how they are linked.

Use Case: This dependency view can be used to get an overview of which TestCase reuses TestResources or TestSets, and to navigate to the tested elements (functions, methods, function blocks, and so on).