In this section of the tutorial, you will modify both a testplan template and a schematic to run a testplan that uses the Var() and GlobalVar() functions to change parameter values.
In this topic:
The best approach to creating a customized testplan is to start with one of the built-in testplans as a template.
To create a testplan to demonstrate the first method of changing schematic parameter values, follow these steps:
or
Open the updated testplan saved at this state in SIMPLIS_dvm_tutorial_examples.zip at this path: testplans/6.1_var_start.testplanThe modified testplan should look like the one below with the changes in red.
1 | *** | |||||
---|---|---|---|---|---|---|
2 | *** 6.1_var_start.testplan: starting var testplan for DVM tutorial section 6.1 | |||||
3 | *** | |||||
4 | *?@ Analysis | Objective | Source | Load | Label | |
5 | *** | |||||
6 | Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, Light) | Default Values|Bode Plot|Vin Nominal|Light Load | |
7 | Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 50%) | Default Values|Bode Plot|Vin Nominal|50% Load | |
8 | Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 100%) | Default Values|Bode Plot|Vin Nominal|100% Load | |
9 | *** |
Notes on 6.1_my_var_start.testplan
Header | Value | Description |
Analysis | AC | Tells the program to expect a valid AC analysis objective in the testplan row. |
Objective | BodePlot(OUTPUT:1) | Sets the input source to a DC source; sets the first managed load (OUTPUT:1) to a Bode type load; sets the analysis to run a POP and AC simulation; and measures the scalars for gain crossover frequency, gain margin, etc. |
Source | Source(INPUT:1,value) |
Sets the DC value of the first managed input source (INPUT:1). The nominal, minimum and maximum values are taken from the user entries in the DVM control symbol. The Source(INPUT:1,value) entry does not change the subcircuit definition. |
Load | Load(OUTPUT:1,value) | Sets the output load as a percentage of full load. The full load value is taken from the DVM control symbol. |
Label | Varies | A
description of the test with the pipe character (|) as the delimiter.
The label is used to populate the test selection dialog box. Each pipe
character (|) generates a new branch or sublevel in the test
selection dialog. Tests are run in the order in which they appear in the testplan file. Tests are presented in the test selection dialog by an alphanumeric sort of the label values of each test. |
To use the Var() and GlobalVar() statements in a testplan to change parameters, you need a schematic that has components supporting parametrization. This schematic (6.0_LTC3406B - DVM ADVANCED.sxsch) is electrically equivalent to the schematic in section 4.2, but has the inductor replaced with a newer version which accepts parameters.
In the following procedure, you will replace numerical values and units with an expression enclosed in curly braces { }. This syntax signals the program to evaluate the enclosed expression and to return a numeric value that is used for the simulation as if it were entered directly in the Edit Device Parameters dialog.
To parametrize the inductor L1 and the capacitor C1 on the top level schematic, follow these steps:
Now that you have added the variables L1_val and C1_val to the schematic, you are ready to modify the testplan that you created in 6.1.1 Modifying a Testplan Template.
To complete these modifications, follow these steps:
OR
Open the updated testplan from SIMPLIS_dvm_tutorial_examples.zip at this path: testplans/6.1_var_start.testplan.1 | *** | |||||
---|---|---|---|---|---|---|
2 | *** modified ( 6.1_var_start.testplan ) | |||||
3 | *** | |||||
4 | *?@ Analysis | Objective | Source | Load | Label | |
5 | *** | |||||
6 | Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, Light) | Default Values|Bode Plot|Vin Nominal|Light Load | |
7 | Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 50%) | Default Values|Bode Plot|Vin Nominal|50% Load | |
8 | Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 100%) | Default Values|Bode Plot|Vin Nominal|100% Load | |
9 | *** | |||||
10 | *** duplicated tests with new test labels | |||||
11 | *** | |||||
12 | Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, Light) | New Values |Bode Plot|Vin Nominal|Light Load | |
13 | Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 50%) | New Values |Bode Plot|Vin Nominal|50% Load | |
14 | Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 100%) | New Values |Bode Plot|Vin Nominal|100% Load |
The final step in modifying the testplan is to add two new columns to handle the variables L1_val and C1_val:
The final testplan, with added or changed values in red , now looks like this:
*** | ||||||
---|---|---|---|---|---|---|
*** 6.1_var_final.testplan: final var testplan for DVM tutorial section 6.1 | ||||||
*** | ||||||
*?@ Analysis | Objective | Var(L1_val, 2.2u) | Var(C1_val, 10u) | Source | Load | Label |
*** | ||||||
Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, Light) | Default Values|Bode Plot|Vin Nominal|Light Load | ||
Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 50%) | Default Values|Bode Plot|Vin Nominal|50% Load | ||
Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 100%) | Default Values|Bode Plot|Vin Nominal|100% Load | ||
*** | ||||||
*** these tests use the new modified values | ||||||
*** | ||||||
Ac | BodePlot(OUTPUT:1) | 1.8u | 12.5u | Source(INPUT:1, Nominal) | Load(OUTPUT:1, Light) | New Values |Bode Plot|Vin Nominal|Light Load |
Ac | BodePlot(OUTPUT:1) | 1.8u | 12.5u | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 50%) | New Values |Bode Plot|Vin Nominal|50% Load |
Ac | BodePlot(OUTPUT:1) | 1.8u | 12.5u | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 100%) | New Values |Bode Plot|Vin Nominal|100% Load |
You can save your testplan in the schematic directory, or this testplan is available from SIMPLIS_dvm_tutorial_examples.zip at the following path: testplans/6.1_var_final.testplan.
Before running this testplan, press F11 to open the simulator command (F11) window in the schematic. As the tests execute, notice the .VAR statements as they are written to and deleted from the F11 window. The entire contents of the F11 window are added to the beginning of the netlist before the simulation starts. After one of the default tests runs, the following variables are displayed in the F11 window:
.VAR L1_val = 2.2u .VAR C1_val = 10u
To illustrate the difference between local and global variables, note that if you assign {C1_val} to the capacitor C1 in the op-amp schematic, LTC3406B_EAMP.sxcmp, you get the following error when you run the simulation:
*** ERRORS REPORTED BY SIMPLIS *** **************************************** <<<<<<< error="" message="" id:="" 1038="">>>>>>>> input file \LTC3406B\SIMPLIS_Data/6.0_LTC3406B - DVM ADVANCED.deck, line 358: C1 6 9 {C1_val} IC=0 A number to represent the value for `capacitance' is expected at the location where `{C1_val}' occupies. *** END SIMPLIS ERROR REPORT ***
This error indicates that the variable {C1_val} was not defined in the netlist for the EAMP subcircuit. To use variables at lower levels of a hierarchical design, you must use the GlobalVar() function. If you change the Var() header entries in 6.1_var_final.testplan to GlobalVar() entries, then {L1_val} and {C1_val} would be available at the top level as well as at all lower levels of the hierarchy. A testplan using the GlobalVar() function looks like this with the modifications in red :
*** | ||||||
---|---|---|---|---|---|---|
*** 6.1_globalvar.testplan: GlobalVar() testplan for DVM tutorial section 6.1 | ||||||
*** | ||||||
*?@ Analysis | Objective | GlobalVar (L1_val, 2.2u) | GlobalVar (C1_val, 10u) | Source | Load | Label |
*** | ||||||
Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, Light) | Default Values|Bode Plot|Vin Nominal|Light Load | ||
Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 50%) | Default Values|Bode Plot|Vin Nominal|50% Load | ||
Ac | BodePlot(OUTPUT:1) | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 100%) | Default Values|Bode Plot|Vin Nominal|100% Load | ||
*** | ||||||
*** these tests use the new modified values | ||||||
*** | ||||||
Ac | BodePlot(OUTPUT:1) | 1.8u | 12.5u | Source(INPUT:1, Nominal) | Load(OUTPUT:1, Light) | New Values|Bode Plot|Vin Nominal|Light Load |
Ac | BodePlot(OUTPUT:1) | 1.8u | 12.5u | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 50%) | New Values|Bode Plot|Vin Nominal|50% Load |
Ac | BodePlot(OUTPUT:1) | 1.8u | 12.5u | Source(INPUT:1, Nominal) | Load(OUTPUT:1, 100%) | New Values|Bode Plot|Vin Nominal|100% Load |
The above version of the testplan is available from SIMPLIS_dvm_tutorial_examples.zip at this path: testplans/6.1_globalvar.testplan.