|
 |
Using Array Variables
Array variables are real or complex symbolic variables accessed by an index variable which selects an
element of the array. Here is the syntax for one dimensional arrays.
.ARRAY arrayname V1[,V2 [,V3...[,Vn]]...]
Note that there must be at least one element (V1) in the array and that a one-dimensional array of size
N+1 has values located at 0, 1, 2, ...N.
You can define a one-dimensional array of real values like this:
.ARRAY CV 1n, 3n, 6n
To access the values you use an index variable that typically is created like this:
.DEFINE M 1
The index name may be any non-reserved name. You access the array contents like this:
CV(M)
For example, you could set the CAPACITANCE attribute of a capacitor to CV(M) and then the
capacitor value takes on the CV array element that M is set to. If M is set with the .define statement
to 1, then the capacitor value would be 3n.
If M is stepped through the values 0, 1, and 2, the capacitor value would take on the values 1n, 3n,
and 6n respectively.
To illustrate how array variables can be used, we'll use this example.
|

|
Here we have a circuit that uses several array variables to capture the beta values for two different
transistors. The devices that use model N1 specify the forward beta as
BF=BETA_N1(M)
The devices that use model N2 specify the forward beta as
BF=BETA_N2(M)
So if M takes on the values 0, 1, and 2, the BF values will take on these values.
M N1 N2
0 300 60
1 250 70
2 200 90
In this way you can use the M variable to select unique sets of BF values for the two types of bipolar
transistors. These sets may represent worst case, or merely interesting, combinations of parameters.
Typically the index variable is stepped so that one run can show the effects of the BF combinations.
Here is the Stepping dialog box for transient analysis. Its settings step M from 0 through 4 accessing
all of the defined array values.
|
Here is the transient run.
|
You can label the branches using the Scope Menu / Label Branches option. The Automatic option usually works well but you can override it and specify where to place the labels by picking the X-axis location where there is a nice separation between the curves.
Here is the run with the branches labelled. Note that you must select the Label Branches option for each plot group in turn.
|
Here is the AC analysis run using the same Stepping dialog box settings as used in transient analysis.
|
And here is the DC analysis run, again using the same Stepping dialog box settings as used in transient
analysis.
|
Array variables are powerful devices to specify complex simulation and stepping settings.
|
|
|
|
|