pSeven Enterprise allows you to automate engineering calculations and analysis by interfacing various CAD/CAE systems, product data management (PDM) systems, and others. It also provides wide capabilities for leveraging its own algorithmic library in combination with third-party design tools. Their interaction and data exchange occur without human intervention, which can significantly speed up the computation process and reduce the likelihood of errors, especially when performing complex, multidisciplinary projects.
The central concept in using pSeven Enterprise is workflow, which represents the computation process as a set of blocks and links between them. Each block in a workflow can be considered as a part of a certain task, and the entire workflow as the decomposition of that task. The implementation of complex projects often requires the joint use of several workflows, representing different tasks, for example:
- Designing product components in CAD systems, which specifies their geometry, composition and internal characteristics.
- Calculating and optimizing the characteristics of individual components using CAE systems, usually carried out in several stages.
- Aggregate analysis and interpretation of results.
The implementation of a project in the form of several interconnected workflows ensures the preservation of knowledge and expertise, practices and design methods, as well as reusing existing field data and computational experiments. Each individual workflow can be created and maintained by a separate team of specialists, and all workflows are combined into a complete multidisciplinary workflow. At that, different teams are working in the same environment, in which the sharing of workflows, resources, and computation results is easily controlled by setting access rights.
The described approach assumes the composition of the main workflow referencing child workflows created and maintained by different enterprise teams. Referencing child workflows enables the enterprise to flexibly compose a complete workflow, while providing the ability to edit and run child workflows independently, as well as to reuse a certain workflow by referencing it from multiple workflows.
Understanding workflow reference¶
A straightforward way of making some child workflow a part of the main one is copying: group all blocks of the child workflow along with their links into a single Composite block (see Managing composite blocks), and then copy that Composite block into the main workflow. Combining workflows in this way has a number of drawbacks, such as:
- The main workflow actually contains a duplicate of the child one in the state as of the time it was copied. This duplicate is detached from its source, making it difficult to update when modifying the child workflow.
- If the same workflow needs to be made a part of several larger workflows, copying creates several independent duplicates. Synchronizing changes to independent duplicates requires additional effort.
- The duplicate does not contain workflow run results, which makes it impossible to reuse the data of computational experiments performed using that workflow. Each run of the main workflow causes a new run of the child workflow duplicate.
To overcome these drawbacks, the main workflow can reference rather than copy the child workflow. The key difference between referencing and copying is the elimination of a static duplicate: the Composite block that encloses the child workflow is created not while editing the main workflow, but when initializing its run. Thus, each run of the main workflow gets the child workflow in its current state, including all changes made at the moment. The same applies to publishing the main workflow to AppsHub: the published app contains a copy of the child workflow as of the time of publication.
Workflow reference block¶
A child workflow reference is a special Workflow reference block in the main workflow. This block is the constructor of the child workflow's enclosing Composite block, created anew at each run of the main workflow. The reference block holds all the information needed to create the enclosing Composite block and connect its ports to the inputs and outputs of the referenced workflow within that block.
When creating a workflow reference block, you select the workflow to be referenced. This can be a workflow from your home folder, or a shared workflow owned by a different user. This block creates and maintains a reference to the selected workflow without creating its duplicate in the main workflow. A Composite block with a copy of the referenced workflow is created on the fly when you run the main workflow.
The Composite block for the referenced workflow is derived from the workflow reference block, therefore the latter has the same attributes as the Composite block, including:
- Working directory setting.
The Composite block that holds the referenced workflow inherits the
working directory setting of the workflow reference block. For example, if
the working directory of the workflow reference block is set to
indexed, the generated Composite block will also have the
Input and output ports. Parameters of the referenced workflow map to input ports of the workflow reference block, and results of the referenced workflow map to output ports of the workflow reference block. In this way, you can pass input data and retrieve output data from the referenced workflow. Parameter values of the referenced workflow become values assigned to input ports of the workflow reference block. Input ports of the workflow reference block can be made parameters of the main workflow, output ports of that block can be added to results of the main workflow.
Note that the workflow reference block has output ports only for outputs of the referenced workflow's root block that are added to results in the referenced workflow.
Batch mode setting. Input ports of the workflow reference block can be switched to batch mode. As a result, batch mode is set for the corresponding ports of the generated Composite block. Also, the workflow reference block automatically enables batch mode on the ports that have batch mode enabled in the referenced workflow.
During a main workflow run, the workflow reference block is replaced by the Composite block that executes a copy of the referenced workflow and issues the results through its output ports. In this way the results of the referenced workflow can be passed to other blocks as well as saved in the results of the main workflow. The workflow reference block is also replaced by the Composite block containing a copy of the referenced workflow when you publish the main workflow to AppsHub.
The main workflow can include several referenced workflows by using a separate block to reference each one. A referenced workflow can also include a block referencing another workflow, thus building a hierarchy of references to child workflows in the main workflow.
When initializing a run or publishing the main workflow, a Composite block is created in it, containing a copy of the referenced workflow. Converting a workflow reference to a Composite block containing a copy of the referenced workflow has the following features:
- The Composite block replaces the workflow reference block, inheriting its input and output ports along with all their links within the main workflow.
- Ports representing parameters in the referenced workflow become input ports of the Composite block. If the referenced workflow contains blocks that have input ports added to workflow parameters, those ports are uplinked to the corresponding input ports of the Composite block. The current parameter values are assigned to the Composite block input ports as their initial values. All ports that were parameters in the referenced workflow lose the status of parameters in the main workflow. Only those input ports of the Composite block that are declared parameters in the workflow reference block become parameters of the main workflow.
- Output ports on the root block of the referenced workflow that represent results become output ports of the Composite block. All result ports of the referenced workflow lose the status of results in the main workflow. Only those output ports of the Composite block that are declared results in the workflow reference block become results of the main workflow.
- The generated Composite block has the working directory setting the same as the workflow reference block. Its batch mode and other port settings are also the same as on the workflow reference block.
The referenced workflow may require access to certain resources stored in its run directory. To provide access to such resources, the contents of the referenced workflow's Files folder are copied to the main workflow's Files folder during run initialization.
Using workflow reference¶
You can create a workflow reference block in your main workflow in a few ways:
- In the Explorer pane, locate the workflow to be referenced and drag it from Explorer to the main workflow.
- From the menu on the workflow edit toolbar, select the Add workflow reference... command to open the workflow reference dialog. There, select the workflow to be referenced, or input its path.
When you select the workflow reference block in the main workflow, the Workflow reference properties pane displays the current path to the referenced workflow. You can select a different workflow to be referenced by using the Reference another workflow... command from the menu on the workflow edit toolbar.
Unlike a Composite block, a workflow reference block itself does not contain any workflow, therefore, its referenced workflow opens on a separate tab. To open the referenced workflow for editing, double-click its reference block on the tab where you are editing the main workflow, or select the Open referenced workflow command from the menu on the workflow edit toolbar.
The workflow reference block has the same configuration elements as any Composite block. In the block properties pane, you can:
- Set the working directory. The available options are the same as with a Composite block, see Working directory settings for details.
Add ports and manage their settings. Port settings for a workflow reference block are similar to Composite block port settings, see Configuring inputs and outputs of a composite block for details.
Input ports of the workflow reference block have batch mode always enabled, if batch mode is enabled for the corresponding ports of the referenced workflow. If you need to disable batch mode on the workflow reference block, in this case you must edit the referenced workflow, disabling batch mode for its inputs.
During a main workflow run, the workflow reference block actually turns into a Composite block with settings inherited from the workflow reference block. This Composite block contains a copy of the referenced workflow (see Workflow as a composite block). The same happens when the main workflow is published to AppsHub.
Sharing main and referenced workflows¶
In the case of a shared workflow that includes a referenced workflow, the behavior of the workflow reference block depends on the access rights setting. Let's assume the owner of the main workflow shares it with Alice, granting her either read-only or read-write access to that workflow. As a result:
- Alice can run the main workflow regardless of her rights to access the referenced workflow. The computations using the referenced workflow are performed even if Alice has no access to that workflow.
- Having no access to the referenced workflow, Alice cannot open it from the main workflow, but she can contact the owner of the referenced workflow with a request to provide access or make changes, if needed. The referenced workflow is identified by its path and name, which is displayed in the properties pane for the workflow reference block.
- If Alice has read-write access to the main workflow, she can make any changes to the workflow reference block. Specifically, she can manage the settings and initial values of the ports, select a different workflow to be referenced, etc.
It is possible for the main workflow to reference a shared one. Main workflow users with read-write access to the referenced workflow can edit it by double-clicking its workflow reference block. Those with read-only access can open the referenced workflow for viewing this way.