SIMetrix/SIMPLIS ships with a scripting language (script documentation) that allows users to specify pre- and post-process scripts to be run with a test.
Pre- and post-process scripts can be assigned either in a testplan (testplan syntax documentation) or through the DVM control that is supported by both the basic and Full Power Assist symbols. Scripts called from the testplan can be assigned on a test-by-test basis while scripts assigned in the DVM Control Symbol are called during every test. Pre- and post-process scripts are launched with the /quiet and /noerr flags to prevent script errors from halting DVM execution.
In this topic:
Because the /noerr and /quiet flags suppress error generation, script debugging can be difficult; therefore, an unsupported option is available to execute the scripts without these flags.
To manage these flags options, follow these steps:
A standard interface for both pre-process and post-process scripts is set with the following line that you can copy line and paste it into each script file you use for both pre- and post-processing:
Arguments @retval label report_dir log_file controlhandle
The above arguments are described in the following table.
|retval||Return value for the script:
For additional information, see DVM Tutorial: 7.3 User-Defined Scalar and Spec Values.
|label||Label for the currently executing test. Since the label is passed to both the pre-process and post-process scripts, the script can decode the label and determine which test is currently executing. This allows the script to modify values or make measurements based on the currently executing test.|
|report_dir||Base directory for simulation results|
|log_file||Location of the overview log file|
|controlhandle||Value of the Handle property for the DVM control symbol on the top-level schematic. The PropValues2() script function can read values from the DVM control symbol using the this value.|
Multiple pre- and post-processing scripts can be assigned using the testplan headers Preprocess, PostProcess, and FinalProcess. If multiple scripts are assigned, the order of their execution is as follows:
Pre-process scripts are executed immediately before the simulation is launched. At this point, the simulation analysis has already been set in the F11 window of the schematic. This order of operations allows you to override any automatic DVM action with a pre-processing script.
Post-process scripts are executed after the simulation is complete and before any waveform processing is started. Final-process scripts are executed after DVM processes the waveforms; and in some test modes, before DVM creates new curves. If measurements on those curves are to be made, be certain your script is called from a FinalProcess testplan column.
Let retval = 'preprocess script executed properly'
To return scalar values from a post-process script, use the SimplisDVMAdvancedUtilCreateScalar function, which takes two required arguments and an optional third argument. All arguments are strings, which means that you should change your calculated scalar value to a string using the Str() or FormatNumber() SIMetrix script function. The two forms for the SimplisDVMAdvancedUtilCreateScalar function are:
SimplisDVMAdvancedUtilCreateScalar(scalar_name, scalar_value, existing scalar_names )
Let user_scalars = SimplisDVMAdvancedUtilCreateScalar 'my_pi', '3.1415927') Let retval = [user_scalars]
To return multiple scalar values, pass the existing scalars as the third argument to the function:
Let user_scalars = SimplisDVMAdvancedUtilCreateScalar('my_pi', '3.1415927') Let user_scalars = SimplisDVMAdvancedUtilCreateScalar('my_2pi','6.2831853', user_scalars) Let retval = [user_scalars]
Let retval = [user_scalars],assigns all the scalar values to the return value from the script. This line must come after all scalar values are assigned with the SimplisDVMAdvancedUtilCreateScalar function.
Returning specification values is similar to returning scalars. TheSimplisDVMAdvancedUtilCreateSpec
function creates the specification value and has three required arguments with an optional fourth argument. As with the scalar function, all arguments are strings. The two forms of theSimplisDVMAdvancedUtilCreateSpec
function are as follows:
The following example creates a single specification value:
Let user_specs = SimplisDVMAdvancedUtilCreateSpec( 'is_value_pi', 'PASS', '3.1415927 is pi') Let retval = [ '', user_specs ]
To return multiple spec values, follow the example below, passing the existing specs as the fourth argument:
Let user_specs = SimplisDVMAdvancedUtilCreateSpec('is_value_pi', 'PASS', '3.1415927 is pi') Let user_specs = SimplisDVMAdvancedUtilCreateSpec('is_value_2pi', 'FAIL', '3.1415927 is not 2*pi', user_specs) Let retval = ['', user_specs]
In these examples, only scalars or specs are returned using the two lines:
Let retval = [user_scalars]Let retval = ['', user_specs]
Of course, both scalars and specs can be returned by assigning both user_scalars and user_specs to the retval as follows:
Let retval = [user_scalars, user_specs]
A pre-prepared testplan which calls a pre- and post-process scripts is available from from SIMPLIS_dvm_tutorial_examples.zip at this path: testplans/7.3_pre_and_post_process.testplan
This testplan contains six tests, calling the pre-process script in one test, and the post-process script in the other five. Notice the relative path to the scripts: up two directories and then down one into the scripts directory. Both scripts are available from SIMPLIS_dvm_tutorial_examples.zip at the following paths: scripts/7.3_pre_process.sxscr: scripts/7.3_post_process.sxscr
The testplan is shown below:
|*** 7.3_pre_and_post_process.testplan: pre and post process testplan for DVM tutorial section 7.3|
|Post-Process 1 Scalar||../scripts/7.3_post_process.sxscr|
|Post-Process 2 Scalars||../scripts/7.3_post_process.sxscr|
|Post-Process 1 Spec||../scripts/7.3_post_process.sxscr|
|Post-Process 2 Specs||../scripts/7.3_post_process.sxscr|
|Post-Process w 2 Scalars and 2 Specs||../scripts/7.3_post_process.sxscr|
This testplan can be run on any of the schematics in the LTC3406B\Test Ckts directory. Running the entire testplan on LTC3406B/6.3_LTC3406B-DVM-ADVANCED.sxsch produces the following overview report which has six tests with tests #5 and #6 failing. These tests fail because the post process script returned a specification value which was 'FAIL.'.