13.4.4. Defining Process Variables

Variables can be used to define nodes and transitions and need to be defined up front before they can be used. This is typically the first step in defining a new process template.

Actions associated with process variables are presented in the following sections. These topics include:

13.4.4.1. Defining New Variables

To define a new variable, click   on the toolbar. Fill in the fields in the New Variable dialog box as described below. Once a variable is created, it will be listed under the Variables node in the Elements tree and its properties displayed on the Properties tab. Variables can be edited using the Edit context menu. See Editing Variables for details.

Figure 13.9:  New Variable Dialog Box

New Variable Dialog Box

Name

The name of the variable. This will be displayed in the diagram and the Elements tree.

Id

An identifier for the variable that must be unique. This will be used to reference the variable in an expression and can consist of any letter, digit, or the underscore (_) character. The following characters cannot be used:

/ \ : [ ] % * ' " |

Description

An optional description of the variable. It can help you understand the meaning of the variable and the value it contains. The description will be displayed on the Properties tab when the variable is selected in the Elements window.

Type

The type of the variable. Choose from the available options in the drop-down list: Boolean, Date, Double, Long, Reference, or String. The type you choose will dictate the additional options that can be set for the variable. For example, if you create a Boolean variable, then the Default Value choices will be “true” and “false”, and the Multi-valued, Enumeration and Constraint options will be grayed out as they do not apply. You can enter an enumerated list for String variables. Constraints are required for Long, Double and Reference types. For Long and Double types, you will need to enter the value of the minimum and maximum fields as constraints. For a Reference type you will need to enter the value of the baseType.

Multi-line value

For String variables, enables you to create a multi-line string. For example, you may need to specify two or more lines of text inside a text box.

Default value

The value that the variable is initialized to when the process is created. For Long and Double variables, the value should be expressed in accordance with the default unit system specified in your Preferences (for example SI units). This is conveniently indicated in the Default value field, as shown below.

Multi-valued

Specifies whether the variable is single or multi-valued. If you check this box, then you will be able to add multiple values through type-specific editor dialog boxes.

Enumeration

This list specifies one or more values that a variable can have (depending on whether it is single or multi-valued). For example, a single-valued variable (Multi-valued =false) named Solver Version may take only one of these values ['v160', 'v161', 'v162', ‘v170’] as its value. In this case, you can specify an enumeration list for the values. A multi-valued variable may take more than one value, but it only be selected from the enumeration list that you specify. An enumeration can be specified for any variable type (such as Double, Integer, String) except Boolean.

Constraint

For variables of type Double/Long, you can optionally specify Min/Max values that the variable can take. The value should be expressed in accordance with the default unit system specified in your Preferences. The default unit system is indicated in the Constraint field for your convenience.

For Reference type variables, you can optionally specify the baseType of the variable (such as for a File or FluentCase type).

Quantity

For variables of type Double, you can specify the Quantity of the variable only if the connection to the repository is opened (because this value depends on the connection).

Unit

For variables of type Double, you can specify the Unit of the variable only if the connection to the repository is opened (because this value depends on the connection). See the Units: Defining and Configuring Using XML chapter in the EKM Administration Guide for more details on specifying units.

Public

If the process template will be used as a nested process in other process templates, enabling this option will make the variable available when mapping process template variables to nested process template variables.

Refer to the section on Defining Variables in the EKM User's Guide for more details on these settings.

13.4.4.2. Viewing the Properties of Variables

When you select a variable in the Elements tree, its properties are displayed on the Properties tab in the lower right pane. In this view you can also see the nodes in which the variable is being used. Clicking on a node link opens the properties dialog box for that node.

13.4.4.3. Editing Variables

You can edit variables that have been previously defined. To edit a variable, right-click the element in the diagram or Elements tree and choose Edit from the context menu. Or double-click the element in the diagram or Elements tree to open the Edit Variable dialog box. Edit the variable settings as described in Defining New Variables and click OK when you are done.

The figure below shows a variable named Geometry File that is defined in the sample run-simulation.pt.xml template supplied in the /Data/Shared Data/Sample Files/process templates folder.

Figure 13.10:  Edit Variable Dialog Box

Edit Variable Dialog Box

13.4.4.4. Renaming Variables

You can rename a variable in the Elements tree by right-clicking it and selecting Rename from the context menu. The text box containing the variable label can then be edited.

13.4.4.5. Deleting Variables

To delete a variable in the Elements tree, right-click it and select Delete. The variable will also be removed from any process nodes in which it is used.


Release 18.2 - © ANSYS, Inc. All rights reserved.