GlobalVar()

In both SIMetrix and SIMPLIS mode, the GlobalVar() function allows you change parameter values. When you place a GlobalVar() function in a testplan, the variable statement is automatically written to the simulator command (F11) window.

Important: The GlobalVar() function parametrizes at all levels of the hierarchy. While this feature of the function is convenient, it can be dangerous. Global variables take precedence over any variables defined locally at the hierarchical component level. If you use the GlobalVar() function, make certain the variables being defined are not overwriting any local variables.

In this topic:

GlobalVar() Syntax

The GlobalVar() function has the following syntax:
GLOBALVAR(variable_name, value)
  • The variable_name is the parameter that you want to change.
  • The value argument indicates the value you want to assign to that variable.

▲ back to top

Inline vs. Header Row Function Behavior

The Var(), GlobalVar(), Change() and Temp() functions behave differently depending on whether they are used inline or in a header row.

  • To use the functions inline, leave the header entry for that column empty. When used inline, Var(), GlobalVar(), Change(), and Temp() perform the actions described above.
  • When used in a header row, the second argument, value, is interpreted to be the default value for the function and is used if the test has no value in its column.

    For example, the following testplan uses both inline and header row functions and performs the actions listed below:

    1 *?@ Var(MAX_Q,1n) GlobalVar(VIN,12)  
    2 2n   Change(U1.U3.GAIN,1) 
    3   5.0  
    4     Change(I1.LOAD_RESISTANCE,2.5)
    • The test on line 2 sets the variable MAX_Q  to 2n based on the value in line 2, column 1. Because column 2 is empty, the global variable VIN to the default of12. The third column uses the inline syntax, and changes the GAIN property on U1.U3 to 1.
    • The test on line 3 sets the global variable VIN to 5.0 using the value in the field, not the header entry. Column 1 is empty, and there is a variable header entry, so the MAX_Q variable is set to the default of 1n as defined in the header entry for the column. Note that column 3 is empty and also has an empty header row. No action is performed during test #3 for column #3.
    • The test on line 4 changes the LOAD_RESISTANCE property on I1 to2.5 using the inline syntax. Because columns 1 and 2 on line 4 are empty, MAX_Q  is set to 1n and VIN is set to 12. Both are the defaults defined in the header row.
    Note: In the above example, only Change() is used inline; however, you can use Var(), Globalvar() and Temp() inline as well. A schematic with parameterization requires all parameters defined for every test, so if you use Var() or Globalvar() inline, you must ensure that all parameters are defined for all tests, including those without the inline variable definitions. The example uses Var() and Globalvar() as header row entries, which in turn ensures the variable is defined for every test. Temp() may be used inline without these restrictions because a default temperature is built-into the SIMetrix simulator.

▲ back to top