Graphical Scripts
Previous (Parametric Runs) | Back to Start
Graphical Scripts
Introduction
Graphical scripts can be created in IDA Tunnel 2 under Tools -> Graphical Scripts. They can be considered as special Macros that can be invoked under different conditions.
Graphical Scripts allow users to create different logical schemes by dragging, dropping, and connecting modules from the side panel. Most time-independent algorithmic components from the control library (like Adder, Switch, etc.) and extra models (like EqualTo and CustomScript) are available.

Figure 61. A schematic of the graphical script form
The components of graphical scripts contain variables and parameters. However, the scripts are executed by the IDA Modeler, not by the IDA solver, so the variables are not time-dependent. That means that the history of the time variation of the variables is not available in the GS.
Special components are defined for input and output.
Connected scripts
A graphical script is connected if all required input is connected via parameter mapping to appropriate sources outside the script macro. The output from the connected script may be used as a source for mapping to the target object outside the script macro.
Execution
A graphical script is executed either by demand or on events.
The supported events are
- CHANGE: the script is executed on any change in the script (parameter values, connections, etc.)
- BEFORE SIMULATION: the script is executed after creating the math model.
- RUN SIMULATION: the script is executed after simulation and composing result objects (but before removing the math model). The values of the variables are updated with the ones at the end of the time range of the simulation.
Only the connected scripts may be called on events.
The condition Demand invokes the graphical script only when the user manually opens and runs it.
Scripts called on-demand – simple
A connected graphical script may also be executed by calling the script function (run-script-macro reference_to_script). This way may be appropriate for a button in the script’s schematic view.
Input
A connected graphical script takes the input via
- parameter mapping
- custom script components that collect required data. This may not work for scripts called "on change"
Any parameter (incl. start values of variables) in a script macro may be mapped, but the particular components of type SCRIPT-INPUT
are preferable because of
- Better visualization of input
- Possibility to check if the input is actually connected
A non-connected graphical script may be prepared for input via interface references.
Output
The output signals from control models are defined as variables. This means that they cannot be used as sources for parameter mapping. Therefore, special components of the SCRIPT-OUTPUT type
should collect the output signals in connected graphics scripts.
A non-connected graphical script may be prepared to deliver some output via interface references.