About Variable Substitutions

You can use variable substitutions to change the content of a string, such as a file name, at run time. For example, the value of a variable substitution can be based on a parameter value or it can be derived from the name of the user that is executing the model and their home directory.

You can use variable substitutions for the following:

  • To define a path and/or a file name in a file parameter. For example, you can include a unique number to prevent multiple runs from interfering with each other.

  • To define a URL address or an FTP site in a file parameter, including the user name, password, and server name.

  • To specify the path to the executable that will be run by the OS Command component. For more information, see OS Command Component in the Isight Component Guide.

  • To define From, Subject, and To entries in the Mail component. For more information, see Mail Component in the Isight Component Guide.

Available Variable Substitutions

You can enter a variable substitution directly into a file, a path name, or any other place that supports substitutions.

You use the first four variable substitutions listed below to define a file path. You must enter the variable substitution exactly as shown, including the brackets.

{localhost}
This variable substitution is replaced at run time with the host name of the machine from which the job was submitted. For execution in standalone mode, this is localhost, the generic network name for the current machine. For execution on SIMULIA Execution Engine stations, this is the domain name of the machine from which the job was submitted. For execution from the WebTop, there is no host name and this substitution is replaced with an invalid domain name.
{modeldir}
This variable substitution is replaced at run time with the path to the directory in which the model file is saved. You can use this variable substitution by selecting Model directory when defining the source. By default, Model directory is selected if you set the Define files and directories relative to the model directory preference option. For more information, see Setting Files and Directories Preferences. This variable substitution is done only at the start of the file path or as the entire file path.
{rundir}
This variable substitution is replaced at run time with the name of the runtime working directory. You can use this variable substitution by selecting Runtime directory when defining the source. This variable substitution is done only at the start of the file path or as the entire file path.
{root name}
This variable substitution is replaced at run time with a reference to a shared file system (see Creating a SIMULIA Execution Engine Connection Profile), where name represents the name of your file system. You can use this variable substitution by selecting Shared file system when defining the Source. This variable substitution is done only at the start of the file path or as the entire file path.
{homedir}
This variable substitution is replaced at run time with the path to the home directory of the user who ran the model. It is done only at the start of the file path or as the entire file path.
{jobid}
This variable substitution is replaced at run time with the alphanumeric job identifier generated during execution of the component. This variable substitution can be used as a part of the file path, as part of the file name, as all of the file name, or in other places inside components where substitution features are supported.
{workid}
This variable substitution is replaced at run time with the unique work item ID (a string of letters) of this execution of the component. You can type this variable substitution into a file name or path to guarantee that the name is unique. It can be used as part of the file path, as part of the file name, or as all of the file name.
{user}
This variable substitution is replaced at run time with the name of the user who submitted the job. This variable substitution can be used as part of the file path, as part of the file name, or as all of the file name.
{var param}
This variable substitution is replaced at run time with the value of a parameter, where param is the name of a parameter, a reference to a member of an aggregate parameter (aggregate.member), or an element of an array parameter (array[3,5]). This option is most useful for string and integer parameters, but it will work with other parameters. This variable substitution can be used as part of the file path, as the whole file path, or as part of or all of the file name.

Nested Variable Substitutions

Nested variable substitutions are supported.

For example:

{var Arr[{var Idx}]}

The above statement substitutes the element of parameter Arr selected by the value of parameter Idx.

Use for Input and Output File Parameters

For input file parameters, you can substitute only input parameters into the file name.

For output file parameters, both input and output parameters can be substituted into the file name. The value of an output file parameter is substituted the first time the file parameter is referenced. For the local name of an output file parameter, the substitution can occur at any time depending on how the component is coded. For the destination of an output file parameter, the substitution occurs after the component executes.

Variable Substitutions Examples

You can use variable substitutions in a file name or file path.

The following examples can be used in the path of a file handler (source) or in the local name of a file parameter.

  • The following file path can be used if a shared file system named SharedDir was defined in your preferences and on any SIMULIA Execution Engine station on which the model can run. This variable substitution allows an absolute path to be used across both Windows and Linux systems or where the same file system is mounted on different drive letters on Windows:

     {root SharedDir}/path/file.txt
    
  • The following example expands the previous example for a shared working directory, where user-specific subdirectories have to be used to prevent different models from interfering with each other:
    {root SharedDir}/workspace/{user}/file.txt
  • The following example expands the previous examples for a shared working directory, where unique file names are created using the WorkID numbers created automatically during Isight execution:
    {root SharedDir}/workspace/{user}/xxFile{workid}.txt
  • The following example shows how to use an input parameter (the string parameter IN_NAME) to create an input file to a model. The {modeldir} variable substitution is used because this input file is always found in the same directory as the model:
    {modeldir}/{var IN_NAME}.dat
  • The following example expands the previous example. If you want to save the output of each DOE run that uses the previously defined input file into a separate file with a user-understandable name, configure an output file parameter as shown below:
    {modeldir}/{var IN_NAME}_outdir/result_{var Run #}.out