Placeholder Examples

The following are typical use cases for the placeholder functionality.

Expose Basic Workflow Component Properties to optiSLang App Users

You can use placeholders to directly expose basic workflow component properties for external modification (for example, by a user of an optiSLang App or the command line interface). Use cases in this category include:

Selecting the Load-case

You can implement multiple load-cases for a workflow/analysis by using different script or input files which contain a specific load-case. Using placeholders, you can expose the selection of the load-case file so it can be modified externally. The end-user then selects the file to execute a certain load-case.

The following example uses the Text Input node.

  1. Create or use two different text input files (for example load_case_1.inp and load_case_2.inp).

  2. From the Modules pane, drag a Text Input node onto the Scenery pane and let it drop.

    If a Text Input node is already available in the project you can skip this step.

  3. Double-click the Text Input node to open the dialog box.

  4. To load one of the text input files, click  .

  5. Browse to the location of the text input file, select it, and click Open.

    The input file is loaded.

  6. To save the changes and close the dialog box, click OK.

  7. To open the Project overview dialog box, select Project > Project overview from the menu bar.

  8. Navigate to the FilePath property of the Text Input node.

  9. Drag the FilePath property to the project placeholders table.

  10. In the Minimum user level cell, set the value to Computational Engineer to expose the placeholder to the end-user.

  11. To save the changes and close the dialog box, click OK.

  12. To use this project in an optiSLang App, save it as an application.

Workflow Component Concurrency

Many workflow components share a property which specifies the concurrency (maximum executions in parallel). You can expose this property using a placeholder so it can be modified externally. The end-user is then able to modify this specific concurrency property of a certain component without having to edit the whole workflow.

The following example uses the Batch Script node.

  1. From the Modules pane, drag a Batch Script node onto the Scenery pane and let it drop.

    If a Batch Script node is already available in the project you can skip this step.

  2. To open the Project overview dialog box, select Project > Project overview from the menu bar.

  3. Navigate to the MaxParallel property of the Batch Script node.

  4. Drag the MaxParallel property to the project placeholders table.

  5. In the Minimum user level cell, set the value to Computational Engineer to expose the placeholder to the end-user.

  6. To save the changes and close the dialog box, click OK.

  7. To use this project in an optiSLang App, save it as an application.

Expose Specific Parts of Batch/Bash Script Node Contents to optiSLang App Users

You can use placeholders to directly expose parts of complex workflow component properties for external modification (for example, by a user of an optiSLang App or the command line interface). A common use-case is to expose parts of batch/bash scripts to the end-user. Instead of specifying a placeholder for the whole script content or file, the end-user is then able to modify only the desired part of the script. This is done using Placeholder Macro Expression Language which allows you to nest placeholders. For each of the nested placeholders, the minimum user level can be set independently.

The following example uses the Batch Script node.

  1. From the Modules pane, drag a Batch Script node onto the Scenery pane and let it drop.

    If a Batch Script node is already available in the project you can skip this step.

  2. Double-click the Batch Script node to open the dialog box.

  3. In the Script tab, enter the following:

    @echo off 
    SET a = world
    SET b = universe
    echo hello %a
    
  4. To save the changes and close the dialog box, click OK.

  5. To open the Project overview dialog box, select Project > Project overview from the menu bar.

  6. Navigate to the Content property of the Batch Script node.

  7. Drag the Content property to the project placeholders table.

    Leave the minimum user level at Flow Engineer so that the entire script content is not exposed to the end-user.

  8. Create a new placeholder:

    1. Double-click the Id cell in an empty row of the table and enter p1.

    2. In the Minimum user level cell, set the value to Computational Engineer..

    3. Double-click the Value cell and set the type to String.

    4. In the Expression field, enter b.

  9. Double-click the Value cell of the Content placeholder.

  10. Select the Expression check box.

  11. Click Edit expression ( )

  12. Change the expression to:

    @echo off 
    SET a = world
    SET b = universe
    echo hello %$(p1)
    
  13. To save the expression changes and close the dialog box, click OK.

  14. To save the placeholder changes and close the dialog box, click OK.

Expose Full Project or System Parameters to optiSLang App Users

The previous method can even be used to expose parts of even more complex properties, for example the parametrization of analysis systems or the project. A common use-case is to expose the reference values of a desired set of parameters to the end user.

The following example uses the Sensitivity system.

  1. From the Modules pane, drag a Sensitivity system onto the Scenery pane and let it drop.

    If a Sensitivity system is already available in the project you can skip steps 1-4.

  2. Double-click the Sensitivity system to open the dialog box.

  3. Add parameters by right-clicking in the Parameter tab and selcting Add parameter from the context menu, or by importing them from another system or file.

  4. To save the changes and close the dialog box, click OK.

  5. To open the Project overview dialog box, select Project > Project overview from the menu bar.

  6. Navigate to the ParameterManager property of the Sensitivity system.

  7. Drag the ParameterManager property to the project placeholders table.

    Leave the minimum user level at Flow Engineer so that the entire script content is not exposed to the end-user.

  8. Create a new placeholder:

    1. Double-click the Id cell in an empty row of the table and enter p1_ref_value.

    2. In the Minimum user level cell, set the value to Computational Engineer..

    3. Double-click the Value cell and set the type to Real.

    4. In the Expression field, enter 5.

  9. Double-click the Value cell of the ParameterManager placeholder.

  10. Select the Expression check box.

  11. Click Edit expression ( )

  12. Change the expression to:

    {
        "correlations" : [],
        "parameter_container" : 
        [
            {
                "active" : true,
                "const" : false,
                "deterministic_property" : 
                {
                    "domain_type" : 
                    {
                        "enum" : [ "uninitialized", "bool", "real", "integer", "string", "variant" ],
                        "value" : "real"
                    },
                    "kind" : "continuous",
                    "lower_bound" : 0.10000000000000001,
                    "upper_bound" : 20.0
                },
                "id" : "cbdd72e2-7179-4a7f-b64e-6a2caed4ade6",
                "modifiable" : false,
                "name" : "area01",
                "reference_value" : $(p1_ref_value),
                "removable" : true,
                "type" : 
                {
                    "enum" : [ "deterministic", "stochastic", "mixed", "dependent" ],
                    "value" : "deterministic"
                },
                "unit" : ""
            },
            {
                "active" : true,
                "const" : false,
                "deterministic_property" : 
                {
                    "domain_type" : 
                    {
                        "enum" : [ "uninitialized", "bool", "real", "integer", "string", "variant" ],
                        "value" : "real"
                    },
                    "kind" : "continuous",
                    "lower_bound" : 0.10000000000000001,
                    "upper_bound" : 20.0
                },
                "id" : "d4832619-f878-454e-a85a-b3d197675410",
                "modifiable" : false,
                "name" : "area02",
                "reference_value" : 10.0,
                "removable" : true,
                "type" : 
                {
                    "enum" : [ "deterministic", "stochastic", "mixed", "dependent" ],
                    "value" : "deterministic"
                },
                "unit" : ""
            },
            {
                "active" : true,
                "const" : false,
                "deterministic_property" : 
                {
                    "domain_type" : 
                    {
                        "enum" : [ "uninitialized", "bool", "real", "integer", "string", "variant" ],
                        "value" : "real"
                    },
                    "kind" : "continuous",
                    "lower_bound" : 0.10000000000000001,
                    "upper_bound" : 20.0
                },
                "id" : "9df0cb60-cb51-49cf-82e8-7fd24c269ff4",
                "modifiable" : false,
                "name" : "area03",
                "reference_value" : 10.0,
                "removable" : true,
                "type" : 
                {
                    "enum" : [ "deterministic", "stochastic", "mixed", "dependent" ],
                    "value" : "deterministic"
                },
                "unit" : ""
            }
        ]
    }
    
  13. To save the expression changes and close the dialog box, click OK.

  14. To save the placeholder changes and close the dialog box, click OK.