About the Script Component

The Script component is useful when you need to apply a complex operation to the parameters in your model that cannot be defined by the Calculator component. It is used to manipulate array and string parameters in ways that the Calculator component cannot handle. You can use the Script component to create Jython or DynamicJava scripts. Jython is recommended; DynamicJava is provided for backward compatibility with existing scripts.

For more information on using these scripting languages, including examples, see Scripting in Isight Models

You can use the Script component editor to create new parameters. In addition, you can use the following in your scripts:

  • Parameters that are mode “output” in the components that appear before the Script component in the simulation process flow.

  • Parameters that are mode “input” in the components that appear after the Script component in the simulation process flow.

  • Parameters from the parent (top level) component.

The following parameter types are used by the Script component:

Input Provides a value to the component, either a default value or a value mapped from some other component.
Output Captures information from the component for subsequent use via mapping or viewing in the Runtime Gateway.
In/Out Serves both functions at the same time and has two values in the Runtime Gateway. One value is created before each execution of the component, and the other value is created after each execution of the component.
Local Used inside of a component or as an output result from a component that should not be exposed to other components in the simulation process flow.

For more information on creating, using, and mapping parameters, see Defining and Mapping Parameters and File Parameters in the Isight User’s Guide.

Your scripts are executed when you run the model that contains the Script component. When the script is running, it cannot create new parameters or change the type of a parameter. Model customization scripts can be used to modify a model before it is executed. For more information on model customization, see Customizing Models in the Isight User’s Guide.

The following figure shows an example of the Script Component Editor:



You write your script in the upper portion of the editor. The lower portion lists the existing parameters from other components in the model along with parameters you have created. The list includes those parameters that can be meaningfully mapped to the Script component based on where they are in the simulation process flow, their mode, and whether there already exists a parameter with the same name in the Script component.

The list also contains pre-defined variables (underlined in the editor), such as localDir, which points to the component’s working directory. For more information on variables in Isight scripting, see Using Global Variables. The name of the variable and its type are displayed (the editor displays [] after the name to indicate the variable is an array).

To start the Script Component Editor, double-click the Script component icon . When you have finished configuring the Script Component Editor, click OK to close the editor. For more information about inserting components and accessing component editors, see Working with Components in the Isight User’s Guide.