This section explains how to run a Monte Carlo simulation.
Shortcuts
Default Keys: None
Default Menu: Simulation
Command: Run Monte Carlo
What Is Monte Carlo Simulation?
Monte Carlo analysis is a procedure to assess manufacturing yields by repeating simulation runs with varying applied random variations to component parameters. The technique is very powerful and usually gives a more realistic result than “worst case” analysis which varies component values to their extremes in a manner which produces the worst possible result.
The implementation of Monte Carlo analysis in Pulsonix has been designed to be quick to set up for simple cases while still providing the required flexibility for more advanced requirements as might be required for integrated circuit design.
In this help page we cover the aspects of setting up a Monte Carlo analysis from the front end. This includes setting device tolerances in the schematic, setting up and running a Monte Carlo simulation and analysing the results.
Setting Pulsonix-Spice model tolerances is not covered here but in the Monte Carlo Analysis chapter in the Pulsonix-Spice Users Guide. For more information on applying tolerances to devices in the schematic see Monte Carlo Tolerances.
Plots of Monte Carlo analyses are performed in exactly the same manner as for normal runs. When you probe a circuit point curves for each run in the Monte Carlo analysis will be created. You will notice, however, that only one label for each set of curves will be displayed.
Pulsonix-Spice has a facility to create histograms of measured data from Monte Carlo results. For this you need a reasonable number of runs, 25 at an absolute minimum and preferably 100 or more. See Plot Histogram for more details.
All the Monte Carlo functionality within Pulsonix is on the Monte Carlo sub-menu on the Simulation menu:
How To Run A Monte Carlo Simulation
There are actually two types of Monte Carlo analyses. These are:
- Single step Monte Carlo sweep.
- Multi step Monte Carlo run.
The first one is applicable to AC, DC, Noise and Transfer Function analyses and creates a single curve. The second can be applied to the same analyses in addition to transient analysis and creates multiple curves.
Setting up a Single Step Monte Carlo Sweep
- From the schematic simulation menu, select the Simulation Parameters option.
- From the Select Simulation Analysis dialog, select the AC, DC, Noise or TF tab as required.
- In the Sweep Parameters section, press the Define Mode button.
- From the Define Sweep Mode dialog, select Monte Carlo from the Sweep Mode section.
- In the Sweep Parameters section enter the required value for the Number Of Points.
- For AC, Noise and TF, you must also supply a value for the Frequency.
Setting up a Multi Step Monte Carlo Run
- From the schematic simulation menu, select the Simulation Parameters option.
- From the Select Simulation Analysis dialog, select the Transient, AC, DC, Noise or TF tab as required.
- Define the analysis as required.
- In the Monte Carlo and Multi-step Analysis section, check the Enable Multi-Step box then press the Define Multi-Step button.
- From the Define Multi Step Analysis dialog select Monte Carlo from the Sweep Mode section.
- In the Step Range section enter the required value for the Number Of Steps.
Monte Carlo analysis is now run in exactly the same way as other analysis. Exit the Simulation Parameters dialog and Press F9 or use the Simulate Design option from the simulation menu.
Setting the Seed Value
The random variations are created using a pseudo random number sequence. The sequence can be seeded such that it always produces the same sequence of numbers for a given seed. In Monte Carlo analysis, the random number generator is seeded with a new value at the start of each run and this seed value is displayed in the log file. It is also possible to fix the first seed that is used using the SEED option. This makes it possible to repeat a run. To do this, note the seed value of the run of interest from the log file then set the seed as follows:
- From the schematic simulation menu, select the Simulation Parameters option.
- Select the Options tab.
- In the Monte Carlo section, check the Set Seed box and enter the required seed value.
The first run of each Monte Carlo analysis will use the same random values as the run from which you obtained the seed value in the log file. Note this assumes that only changes in values are made to the circuit. Any topology change will upset the sequence.
This technique is a convenient way of investigating a particular run that perhaps produced unexpected results. Obtain the seed used for that run, then repeat with the seed value but doing just a single run. You will then be able to probe around the circuit and plot the results for just that run.
Monte Carlo Report
When a Monte Carlo simulation is performed a log file is produced containing the randomly selected component values and model parameters used for each run. Use View Report from the Monte Carlo menu to view the most recent Monte Carlo log file.
Analysing Monte Carlo Results
Plots of Monte Carlo analyses are performed in exactly the same manner as for normal runs. When you probe a circuit point curves for each run in the Monte Carlo analysis will be created. You will notice, however, that only one label for each set of curves will be displayed. Operations on curves such as deleting and moving will be performed on the complete set.
Identifying Curves
Sometimes it is useful to know exactly which run a particular curve is associated with. To do this proceed as follows:
- In the simulator graph window, switch on graph cursors. (Cursors | Toggle On/Off menu)
- Pick up the main cursor (the one with the short dashes) and place it on the curve of interest. (To pick up a cursor, place the mouse cursor at the intersection, press left key and drag).
- Select the Show Curve Info option. Information about the curve will be displayed in the Pulsonix-Spice command shell.
This is an example of what will be displayed:
Source group: ac1
Curve id: 4
Run number: 49
The information of interest here is the Run number. With this you can look up in the log file details of the run i.e. what values were used for each component and parameter. You can also obtain the seed value used so that the run can be repeated. See Setting the Seed Value above.
Plotting a single Curve
If you wish to plot a single curve in a Monte Carlo set, you must obtain the run number then use the Random Probe Add Curve option to plot an indexed expression. For the simple case of a single voltage or current just append it with [index] where index is the run number less 1.
Creating Histograms
From the Monte Carlo menu use the Plot Histogram option to get access to the simulator Performance Analysis dialog.
A range of functions, sometimes known as goal functions, are available that perform a computation on a complete curve to create a single value. By applying one or a combination of these functions on the results of a multi-step analysis, a curve of the goal function versus the stepped variable may be created. This feature is especially useful for Monte Carlo analysis in which case you would most likely wish to plot a histogram.
To plot histograms for single step Monte Carlo sweeps you do not need to apply a goal function, just enter the name of the signal you wish to analyse.
Related Topics
Define Component Value | Define Spice Type | Matching Components | Monte Carlo Tolerances | Plot Histogram | Random Probe | Set Device Tolerance | Simulation Parameters | Set Match Tolerance