Tolerances for Monte Carlo analysis may be specified by one of the following methods:
- Using a distribution function in an expression.
- Using device tolerances.
- Using a tolerance model.
Using a distribution function is new to Pulsonix-Spice version 2 and is the most general and flexible. The other two are provided primarily for backward compatibility but may also be more convenient in some circumstances.
Distribution Functions
To specify Monte Carlo tolerance for a model or device parameter, define the parameter using an expression containing one of the following 12 functions:
Name | Distribution | Lot? |
GAUSS | Gaussian (3-sigma) | No |
GAUSSL | Gaussian (3-sigma) | Yes |
UNIF | Uniform | No |
UNIFL | Uniform | Yes |
WC | Worst case | No |
WCL | Worst case | Yes |
GAUSSE | Gaussian logarithmic (3-sigma) | No |
GAUSSEL | Gaussian logarithmic (3-sigma) | Yes |
UNIFE | Uniform logarithmic | No |
UNIFEL | Uniform logarithmic | Yes |
WCE | Worst case logarithmic | No |
WCEL | Worst case logarithmic | Yes |
The logarithmic versions are included for compatibility with Pulsonix-Spice Version 1 but are nevertheless useful for some parameters which are logarithmic in nature such as the IS parameter for PN junctions.
The graphs below show the characteristics of the various distributions. The curves were plotted by performing an actual Monte Carlo run with 10000 steps.
Example
Apply 50% tolerance to BF parameter of BJT with Gaussian distribution.
.MODEL NPN1 NPN IS=1.5e-15 BF={180*GAUSS(0.5)}
Lot Tolerances
The lot versions of the functions specify a distribution to be applied to devices whose tolerances track. These functions will return the same random value for all devices that reference the same model. For example, to specify 50% uniform lot tolerance and 5% Gaussian device tolerance for BF parameter:
.MODEL NPN1 NPN IS=1.5e-15 BF={180*GAUSS(0.05)*UNIFL(0.5)}
Alternatively, a device can be given a lot value as was required with earlier versions of Pulsonix-Spice. Devices must have the same lot value, and also reference the same model, in order to track. This allows, for example, two or more chips using the same process to be simulated together without having to rename the models.
Arguments to Distribution Functions - the “key” Value
Each of the distribution functions takes 1 or 2 arguments. The first argument is the tolerance while the second is an optional key value. The key is an arbitrary number, preferably an integer, which in effect names a random variable for which the results of that distribution function will be based. Another call to the same distribution function in the same model and with the same key value, will also be based on the same random variable and return the same value for each Monte Carlo step. The key make it possible to accommodate parameters that tend to track each other possibly because they depend on the same physical characteristic of the device.
For example, suppose the BF and TF parameters of a BJJT tend to track each other. That is a 50% increase in BF tends to be accompanied by a 50% increase in TF (there is no physical basis for this; it’s just an example). The following model definition would implement this:
.MODEL NPN1 NPN BF={UNIF(0.5,1)*180} TF={1e-11*UNIF(0.5,1)}
For all devices using that model, BF and TF will always have a fixed relationship to each other even though each parameter can vary by +/-50% from one device to the next.
Distribution Functions and .PARAM
The key mechanism described above only works for parameters within the same model. If you wish to define a fixed relationship between parameters of different models then you can define a random variable using .PARAM.
Using a distribution function in a .PARAM expression in effect creates a global random variable. .PARAM expressions are only evaluated once for each Monte Carlo step so the parameter it defines will be the same value wherever it is used.
Note that .PARAM values used for this purpose should be defined at the top level i.e. not in a sub-circuit. If defined in a sub-circuit they will be local to that sub-circuit so each instance of the sub-circuit will use its own random variable.
Device Tolerances
Device tolerances are applied directly to a component and are specified using the Set Tolerance option. These tolerances are appended to the end of the Spice netlist entry for each component.
Device tolerances have the benefit of being easy to apply. Using the multiple selection capabilities of the schematic editor it is possible to apply the same tolerance to a set of components in one operation.
Device tolerances can be applied to the following component types:
Capacitors
Resistors
Inductors
Fixed voltage sources
Fixed current sources
Voltage controlled voltage sources
Voltage controlled current sources
Current controlled voltage sources
Current controlled current sources
Lossless transmission lines (applied to Z0 parameter)
Model Tolerances
Tolerance models are an alternative method of applying tolerances to device models to the distribution function method described in an earlier section. They are specified using a tolerance model. This has the same format as the normal model and the same parameter names but with a device name appended with “.tol”.
Model tolerances require more work than device tolerances, but can vary any model parameter whereas device tolerances only effect one chosen for that type of device. (Resistance for resistors, capacitance for capacitors etc.)
The format for a tolerance models is:
.model modelname modeltype.tol parameter_list
modelname must be the same name as the normal model for the device while modeltype must be the same type. So for example a tolerance model for a Q2N2222 transistor might be:
.model Q2N2222 npn.tol BF=0.5
This will vary the BF parameter over a +/- 50% range (but see notes below about how tolerances are applied) for all BJT’s referring to the Q2N2222 model. The above model only specifies one parameter but you can place any parameter specified for that device in a tolerance model.
For MOSFET’s the level number must be included with the tolerance model otherwise the model will be ignored.
The model may be placed in the Extra Simulation Data or in a file referenced as a library. See Device Library and Parts Management in the Simulator Help. If placed in a library the Simulator will search for it in the usual way.
Important note:
Note that tolerances will only be applied to parameters explicitly specified in the base model for the device. Tolerances will not be applied to default values. If the base model for the Q2N2222 device in the above example is:
.model Q2N2222 npn ( IS=2.48E-13 VAF=73.9 NE=1.2069 TF=4.00E-10)
The BF parameter in the tolerance model would not be used as it is not specified in the base model. If the base model was modified to:
.model Q2N2222 npn ( IS=2.48E-13 VAF=73.9 NE=1.2069 TF=4.00E-10)
-
BF=400
Then the BF tolerance would be applied.
Model Match Tolerances
For information on matching devices see Matching Components.
The format for a matching tolerance models is:
.model modelname modeltype.match parameter_list
modelname must be the same name as the normal model for the device while modeltype must be the same type. So for example a matching tolerance model for a Q2N2222 transistor might be:
.model Q2N2222 npn.match BF=0.5
Default Model Tolerances
It is possible to specify default tolerance models that will apply to all devices of a particular type. These have the name “default_tol” for absolute tolerances and “default_match” for matching tolerances. E.g.
.model default_tol npn.tol IS=9 BF=1 TF=0.5
The above model will be applied to all BJT’s in the circuit that do not have an explicit tolerance model defined. The above will apply to both NPN and PNP devices even though the example states NPN. The same rules about polarity also apply to MOSFET’s, JFET’s and GAASFET’s.
The Pulsonix-Spice Simulator will not search the model library for default tolerance models unless you explicitly ask it to using the “SearchDefaultTol” Simulator option. To do this put the line:
.option SearchDefaultTol
in the schematic’s Extra Simulation Data.
Note that this option only controls the model library searching mechanism, and not whether or not the models are used. If a default or explicit tolerance model is placed in the Extra Simulation Data or directly in a netlist it will always be used if there are devices that refer to them.
Related Topics
Define Component Value | Define Spice Type | Extra Simulation Data | Matching Components | Monte Carlo Simulation | Set Device Tolerance | Set Device Match Tolerance