Skip to main content

13 - Monte Carlo And Sensitivity (Worst-Case) Analyses

Statistical analyses

Monte Carlo and sensitivity (worst-case) are statistical analyses. This section describes information common to both types of analyses.

Overview of statistical analyses

The Monte Carlo and worst-case analyses vary the lot or device tolerances of devices between multiple runs of an analysis (DC, AC, or transient). Before running the analysis, you must set up the model and/or lot tolerances of the model parameter to be investigated.

A Monte Carlo analysis performs a Monte Carlo (statistical) analysis of the circuit. A worst-case analysis performs a sensitivity and worst-case analysis of the circuit.

Sensitivity (worst-case) analyses are different from Monte Carlo analyses in that they compute the parameters using the sensitivity data rather than using random numbers.

You can run either a Monte Carlo or a worst-case analysis, but you cannot run both at the same time. Multiple runs of the selected analysis are done while parameters are varied. You can select only one analysis type (AC, DC, or transient) per run. The selected analysis is repeated in subsequent passes of the analysis.

Generating statistical results

As the number of Monte Carlo or worst-case runs increases, simulation takes longer and the data file gets larger. Large data files may be slow to open and slow to draw traces.

One way to work around this is to set up an overnight batch job to run the simulation and execute commands. You can even set up the batch job to produce a series of plots on paper to be ready for you in the morning.

Output control for statistical analyses

Monte Carlo and sensitivity( worst-case) analyses generate the following types of reports:

  • Model parameter values used for each run (that is, the values with tolerances applied)
  • Waveforms from each run, as a function of specifying data collection, or by specifying output variables in the analysis set up
  • Summary of all the runs using a collating function

Output is saved to the data file for use by the waveform analyzer. For Monte Carlo analyses, you can use the performance analysis feature to produce histograms of derived data.

Model parameter values reports

To produce a list of the model parameters actually used for each run,

  1. In the Simulation Settings dialog box, click the Analysis tab.
  2. From the Analysis Type list, select an analysis type.
  3. Under Options, select Monte Carlo/Worst Case.
  4. Click the More Settings button.
  5. Select List model parameter values in the output file of each run.
  6. Click OK.

This list is written to the simulation output file at the beginning of the run and contains the parameters for each device, as opposed to the parameters for each .MODEL statement. This is because devices can have different parameter values when using a model statement containing a DEV tolerance.

Note that for midsize and large circuits, the List option can produce a large output file.

Monte Carlo history support

Using the history support feature of Monte Carlo, you can store the model parameter values used for each Monte Carlo run, in a separate file, and later reuse these values.

For every Monte Carlo run, the model parameter values are generated randomly with in the tolerance range specified by you. With the history support feature, you can save these randomly generated values and reuse exactly the same values in the next analysis.

The Monte Carlo history support feature allows you to compare the results of two Monte Carlo analyses by manually changing only one or more parameter values. For comparison between simulations, the random numbers have to remain the same for the toleranced model parameters and this can be achieved using the Monte Carlo history support feature.

Saving parameter values in a file

To enable saving of the randomly generated model parameter values:

  1. Select PSpice – Edit Simulation Profile.
    The Simulation Settings dialog box appears.
  2. In the Analysis tab, select the Analysis Type as Time Domain(Transient), DC Sweep or AC Sweep/Noise, or Bias Point.
  3. In the Options list, select Monte Carlo/Worst Case.
  4. Select the MC Load/Save button.
  5. In the Load/Save Monte Carlo Parameter File dialog box, select the Save Parameter values in filename: check box.
  6. In the text box that is enabled, specify the name and the location of the file in which the parameter data is to be saved.
  7. Click OK to save your settings.

If you now run the Monte Carlo analysis, the model parameter values used for various simulation runs will be stored in the .mcp file specified by you.

Reusing parameter values

To reuse model parameter values from a previous Monte Carlo analysis:

  1. Select PSpice – Edit Simulation Profile.
    The Simulation Settings dialog box appears.
  2. In the Analysis tab, select the Analysis Type as Time Domain(Transient), DC Sweep or AC Sweep/Noise, or Bias Point.
  3. In the Options list, select Monte Carlo/Worst Case
  4. Select the MC Load/Save button.
  5. In the Load/Save Monte Carlo Parameter File dialog box, select the Load Parameter values in filename: check box.
  6. In the text box that is enabled, specify the name and the location of the .mcp file from which the parameter data is to be read.
  7. Click OK to save your settings.

Now when you run the Monte Carlo analysis, the simulator will reuse all the model parameter values stored in the .mcp files. Any new or additional parameter values will be varied separately with in the tolerance range.

While reusing values from a .mcp file, you must take care of the points listed below.

  1. When you use the Monte Carlo history support feature, the values stored in a .mcp file for model parameters are different from the values stored for components, such as resistor, capacitor, and inductor. In case of model parameters, actual parameter values used for simulation are stored. Whereas in case of the components, instead of the actual value, the multiplication factor used for generating the random values are stored.
    Table 13-1 lists down the actual entries recorded in a .mcp file for a model parameter and a resistor.

    Table 13-1: Entries in a .mcp file

    For a model parameter: base value 100 tolerance 10% For a resistor: base value 100 tolerance 10%

    1.00000e+002

    1

    1.02747e+002

    1.002

    1.07986e+002

    .986

    1.04803e+002

    1.003

    9.17754e+001

    .9912


    The difference in the method used for storing values from previous Monte Carlo runs, is highlighted when you change the original value of a parameter and also choose to reuse the values from a previous Monte Carlo run.
    For example, if you change the original base value of a model parameter from 100 to 50 and reuse the values from an .mcp file, the simulation results will be based on the original parameter value, which is 100. Whereas, in case you change the value of a resistor from 100Ω to 10Ω, and reuse the values from a .mcp file, simulation results will be based on the changed value of 10Ω.
  2. If the number of Monte Carlo runs is greater than the number of values in the .mcp file, PSpice simulator with first reuse all the values from the .mcp file and then for rest of the runs, the random values will be generated using the base value and the tolerance defined for the parameter in the schematic.
    For example, consider that for a particular model parameter, the .mcp file from which the parameter data is to be read has 10 entries, but for the current simulation, 20 Monte Carlo runs are required. In such cases, for the first 10 Monte Carlo runs the values will be read from the .mcp file. For the last 10 runs, the simulator will calculate the values using the base value of the model parameter and the tolerance specified on it.

The Monte Carlo Parameter (.mcp) file

When you use the Monte Carlo history support feature, you either generate a Monte Carlo Parameter (.mcp) file or use parameters from a .mcp file. A .mcp file is a text file that stores the parameter information generated during Monte Carlo analysis. The data is stored in a tabular format with the data values separated by white spaces, blanks, or tabs. Each columns in a .mcp file indicates a parameter whose values was varied during the Monte Carlo analysis.

The format for a .mcp file is shown below:

In a .mcp file, the name of the variable parameter is defined using the following format:

<instance_name>::ParameterName.

where...

indicates...

instance_name

reference designator or the name that appears in the PSpice netlist

ParameterName

indicates whether the component is a resistor, capacitor, transistor, and so on.

For example, if the name of the variable parameter is R_U2_R2::RR_U2_R2 is the reference designator and R indicates the parameter name, which in this case is a resistor.

A sample .mcp file that has three parameters values varied is shown below.

Waveform reports

For Monte Carlo analyses, there are five variations of the output that you can specify in the Save data from text box on the Monte Carlo dialog box. Options:

<none>

No output is generated

All

Forces all output to be generated (including nominal run)

First*

Generates output only during the first n runs

Every*

Generates output for every nth run

Runs(list)*

Does specified analysis and generates outputs only for the listed runs (up to 25 values can be specified in the list)

The * indicates that you can set the number of runs in the runs text box.

Values for the output variables specified in the selected analyses are saved to the simulation output file and data file.

In excess of about 10 runs, the waveform display can look more like a band than a set of individual waveforms. This can be useful for seeing the typical spread for a particular output variable. As the number of runs increases, the spread more closely approximates the actual worst-case limits for the circuit.
Even a modest number of runs can produce large output files.

Collating functions

You can further compress the results of Monte Carlo and worst-case analyses. If you use the collating function, a single number represents each run. (Click the More Settings Options button and select a function from the Find list.) A table of deviations per run is reported in the simulation output file.

Collating functions are listed in Table 13-2.

Table 13-2 Collating functions used in statistical analyses

Function Description

YMAX

Find the greatest difference in each waveform from the nominal

MAX

Find the maximum value of each waveform

MIN

Find the minimum value of each waveform

RISE_EDGE

Find the first occurrence of the waveform crossing above a specified threshold value

FALL_EDGE

Find the first occurrence of the waveform crossing below a specified threshold value

Temperature considerations in statistical analyses

The statistical analyses perform multiple runs, as does the temperature analysis. Conceptually, the Monte Carlo and worst-case loops are inside the temperature loop.

However, since both temperature and tolerances affect the model parameters, OrCAD X recommends not using temperature analysis when using Monte Carlo or worst-case analysis.

Also, you cannot sweep the temperature in a DC sweep analysis or put tolerances on temperature coefficients while performing one of these statistical analyses. In EXAMPLE.OPJ, the temperature value is fixed at 35° C.

Figure 13-1 Example schematic EXAMPLE.OPJ.

The example schematic EXAMPLE.OPJ is provided with the installed programs.

Monte Carlo analysis

The Monte Carlo analysis calculates the circuit response to changes in part values by randomly varying all of the model parameters for which a tolerance is specified. This provides statistical data on the impact of a device parameter’s variance.

Monte Carlo analysis is frequently used to predict yields on production runs of a circuit. With Monte Carlo analysis, model parameters are given tolerances, and multiple analyses (DC, AC, or transient) are run using these tolerances.

For EXAMPLE.OPJ in Figure 13-1, you can analyze the effects of variances in the values of resistors RC1 and RC2 by assigning a model description to these resistors that includes a 5% device tolerance on the multiplier parameter R. The steps for adding the 5% device tolerance are given below.

Then you can perform a Monte Carlo analysis. First, the simulator performs a DC analysis with the nominal R multiplier value for RC1 and RC2. Then it performs a set number of additional runs with the R multiplier varied independently for RC1 and RC2 within a 5% tolerance.

To modify example.opj and set up simulation

  1. Replace RC1 and RC2 with RBREAK parts from the BREAKOUT.OLB part library, setting property values to match the resistors that are being replaced (VALUE=10k) and reference designators to match previous names.
  2. Select an RBREAK part and choose PSpice Model from the Edit menu.
    The Model Editor window appears.
  3. Create the model CRES by replacing the model text:
    .model Rbreak RES R=1
    with the text:
    .MODEL CRES RES( R=1 DEV=5% TC1=0.02
    + TC2=0.0045 )
    Where TC1 is the linear temperature coefficient. TC2 is the quadratic temperature coefficient.
  4. From the File menu in Model Editor, choose Save.
    The schematic editor automatically attaches the CRES model to the selected RBREAK part by updating the IMPLEMENTATION property on the part.
  5. Double-click the second RBREAK part to display the Parts spreadsheet.
  6. In the IMPLEMENTATION text box, change the value to CRES, then click Apply.
  7. Close the Parts spreadsheet.
  8. From the File menu, choose Save. By default, Capture saves the definition to the model library EXAMPLE.LIB and automatically configures the file for local use with the current schematic.
  9. In Capture, set up a new Monte Carlo analysis as shown in Figure 13-2. The analysis specification tells PSpice A/D to do one nominal run and four Monte Carlo runs, saving the DC analysis output from those five runs.
    Figure 13-2 Monte Carlo analysis setup for EXAMPLE.OPJ

For DC sweep, specify the Primary Sweep settings.

  1. Select Voltage source in the Sweep variable frame.
  2. Enter V2 in the Name text box.
  3. Select Linear in the Sweep type frame.
  4. Enter a 0 in the Start value text box.
  5. Enter a 12 in the End value text box.
  6. Enter a 1 in the Increment text box.

PSpice A/D starts by running all of the analyses enabled in the Simulation Settings dialog box with all parameters set to their nominal values.

However, with Monte Carlo enabled, PSpice A/D saves the DC sweep analysis results for later reference and comparison. After the nominal analyses are finished, PSpice A/D performs the additional specified analysis runs (in this example, DC sweep).

Subsequent runs use the same analysis specification as the nominal run with one major exception: instead of using the nominal parameter values, the tolerances are applied to set new parameter values and thus, new part values.

There is a trade-off in choosing the number of Monte Carlo runs. More runs provide better statistics, but they require more time. The amount of time scales directly with the number of runs: 20 transient analyses take 20 times as long as one transient analysis. During Monte Carlo runs, the PSpice A/D status display includes the current run number and the total number of runs left.

PSpice A/D offers a facility to generate histograms of data derived from Monte Carlo waveform families through the performance analysis feature.

History support

The Monte Carlo analysis calculates the circuit response to changes in part values by randomly varying all of the model parameters for which a tolerance is specified. However, at times users might want to keep some or all of the parameters similar for multiple analysis so that they can compare the results of multiple simulations.

Consider an example of IC designs, which usually require numerous runs. In such cases, rather than doing large number of runs (with too many model parameters), users would prefer doing less number of runs (with less number of parameters), manually change some components/parameters values or add a small amount of circuitry, and then continue the analysis. Here user expects that simulator should use similar values for all model parameters, so that a comparison can be done between multiple simulations.

PSpice A/D allows you to save randomly generated values for a run in a .mcp file. You can then load this file to reuse the values for subsequent runs.

Reading the summary report

The summary report generated in this example (see Figure 13-3) specifies that the waveform generated from V(OUT1) should be the subject of the collating function YMAX. In each of the last four runs, the new V(OUT1) waveform is compared to the nominal V(OUT1) waveform for the first run, calculating the maximum deviation in the Y direction (YMAX collating function). The deviations are printed in order of size along with their run number.

Figure 13-3 Summary of Monte Carlo runs for EXAMPLE.OPJ

With the List option enabled, a report is also generated showing the parameter value used for each device in each run. In this case (see Figure 13-4), run three shows the highest deviation.

Figure 13-4 Parameter values for Monte Carlo pass three.

Example: Monte Carlo analysis of a pressure sensor

This example shows how the performance of a pressure sensor circuit with a pressure-dependent resistor bridge is affected by manufacturing tolerances, using Monte Carlo analysis to explore these effects.

Drawing the schematic

To begin, construct the bridge as shown in Figure 13-5.

Figure 13-5 Pressure sensor circuit.

Here are a few things to know when placing and connecting the part:

  • To get the part you want to place, from the Place menu, choose Part.
  • To rotate a part before placing it, press R.
  • For V1 and Meter, place a generic voltage source using the VSRC part. When you place the source for the meter, change its name by double-clicking the part and typing Meter in the Reference cell in the Parts Spreadsheet.
  • For R1-R7, place a resistor using the R part.
  • Place the analog ground using the 0 ground symbol from the SOURCE.OLB part library.
  • To connect the parts, from the Place menu, choose Wire.
  • To move values or reference designators, click the value or reference designator to select it, then drag it to the new location.

Defining part values

Define the part values as shown in Figure 13-5. For the pressure sensor, you need to do the following:

  • Change the resistor values for R3, R5, R6, and R7 from their default value of 1 k.
  • Set the DC value for the V1 voltage source.
Because the Meter source is used to measure current, it has no DC value and can be left unchanged.

To change resistor values

  1. Double-click the value for a resistor.
  2. Type the new value. Depending on the resistor you are changing, set its value to one of the following (refer to Figure 13-5).
    If you are changing this resistor... Type this...

    R3

    {1k*(1+P*Pcoeff/Pnom)}

    The value for R3—{1k*(1+P*Pcoeff/Pnom)}—is an expression that represents linear dependence of resistance on pressure. To complete the definition for R3, you will create and define global parameters for Pcoeff, P, and Pnom later on in this example.

    R5

    2k

    R6

    470

    R7

    25

  3. Repeat steps 1-2 for each resistor on your schematic page.

To set the DC value for the V1 source and make it visible

  1. Double-click the V1 source part.
  2. In the Parts Spreadsheet, click in the cell under the DC column.
  3. Type 1.35v.
  4. Click the Display button.
  5. In the Display Format frame, choose the Value Only option to make the DC value (1.35v) visible on the schematic.
  6. Click OK, then click Apply to apply the changes you have made to the part.
  7. Close the Parts Spreadsheet.

Setting up the parameters

To complete the value specification for R3, define the global parameters Pcoeff, P, and Pnom.

To define and initialize Pcoeff, P, and Pnom

  1. Place a PARAM part on the schematic page.
  2. Double-click the PARAM part to display the Parts Spreadsheet.
  3. For each parameter, create a new property by clicking New and typing its name. Enter its corresponding value by clicking in the cell under the new property name and typing its value. Specify the parameter name and corresponding value as follows.
    Property Value

    Pcoeff

    -0.06

    P

    0

    Pnom

    1.0

  4. Click Apply to save the changes you have made then close the Parts Spreadsheet.

Using resistors with models

To explore the effects of manufacturing tolerances on the behavior of this circuit, you set device (DEV) and (LOT) tolerances on the model parameters for resistors R1, R2, R3, and R4 in a later step (see Defining tolerances for the resistor models). This means you need to use resistor parts that have model associations.

Because R parts do not have associated models (and therefore no model parameters), change the resistor parts to Rbreak parts that do have models.

When PSpice A/D runs a Monte Carlo analysis, it uses tolerance values to determine how to vary model parameters during the simulation.

To replace R1, R2, R3, and R4 with the RBREAK part

  1. Click R1 to select it.
  2. Hold down the Ctrl key and click R2, R3 and R4 to add them to the selection set.
  3. Press Delete to delete the selection set.
  4. From the Place menu, choose Part.
  5. Type RBREAK in the Part text box. (If RBREAK is not available, click the Add Library button and select BREAKOUT.OLB to configure it for use in Capture.)
  6. Click OK.
  7. Manually place the RBREAK part in the circuit diagram where R1, R2, R3 and R4 were located.
  8. Double-click on each RBREAK part and change the reference designators as desired.

Saving the design

Before editing the models for the Rbreak resistors, save the schematic.

To save the design

  1. From Capture’s File menu, choose Save.

Defining tolerances for the resistor models

This section shows how to assign device (DEV) and lot (LOT) tolerances to the model parameters for resistors R1, R2, R3, and R4 using the model editor.

You can use the model editor to change the .MODEL or .SUBCKT syntax for a model definition.  

To assign 2% device and 10% lot tolerances to the resistance multiplier for R1

  1. Select R1.
  2. From the Edit menu, choose PSpice Model.
    Capture searches the libraries for the Rbreak model definition and makes a copy to create an instance model.
  3. To change the instance model name from Rbreak to Rmonte1, do the following:
    1. In the Model Text frame, double-click Rbreak.
    2. Type RMonte1.
  4. To add a 2% device tolerance and a 10% lot tolerance to the resistance multiplier, do the following:
    1. Add the following to the .MODEL statement (after R=1):
      DEV=2% LOT=10% 
      The model editing window should look something like the figure below.
  5. From the File menu, choose Save.

By default, Capture saves the RMonte1 .MODEL definition to the DESIGN_NAME.LIB library, which is PSENSOR.LIB. Capture also automatically configures the library for local use.

To have resistors R2 and R4 use the same tolerances as R1

  1. In Capture’s schematic page editor, select R2 and R4.
  2. From the Edit menu, select Properties.
  3. In the R2 row, click in the cell under the Implementation column and type RMonte1.
  4. In the R4 row, click in the cell under the Implementation column and type RMonte1.

To assign 5% device tolerance to the resistance multiplier for R3

  1. Select R3.
  2. From the Edit menu, select PSpice Model.
  3. In the Model Text frame, change the .MODEL statement to:
    .model RTherm RES R=1 DEV=5%
  4. From the File menu, choose Save.

Setting up the analyses

This section shows how to define and enable a DC analysis that sweeps the pressure value and a Monte Carlo analysis that runs the DC sweep with each change to the resistance multipliers.

To set up the DC sweep

  1. In the PSpice menu, choose New Simulation Profile or Edit Simulation Profile. (If this is a new simulation, enter the name of the profile and click OK.)
    The Simulation Settings dialog box appears.

    Figure 13-6 Pressure sensor circuit with RMonte1 and RTherm model definitions.
  2. Select DC Sweep in the Analysis type list box.
  3. In the Sweep Variable frame, select Global Parameter.
  4. Enter the following values:
    In this text box... Type this...

    Parameter name

    P

    Start value

    0

    End value

    5.0

    Increment

    0.1

To set up the Monte Carlo analysis

  1. Select the Monte Carlo/Worst Case option.
  2. Check Monte Carlo if it is not already selected.
  3. In the Number of runs text box, type 10.
  4. In the Save data from list box, select All.
  5. Type I(Meter) in the Output variable text box.
  6. Click OK to save the simulation profile.

Running the analysis and viewing the results

To complete setup, simulate, and view results

  1. From Capture’s PSpice menu, choose Run to start the simulation
    When the simulation is complete, PSpice A/D automatically displays the selected waveform. Because PSpice A/D ran a Monte Carlo analysis, it saved multiple runs or sections of data. These are listed in the Available Sections dialog box.
  2. From PSpice A/D’s Trace menu, choose Performance Analysis.
  3. Click the Select sections button.
  4. In the Available Sections dialog box, click the All button.
  5. Click OK.
  6. To display current through the Meter voltage source, do the following:
    1. From Capture’s PSpice menu, point to markers and choose Current into Pin.
    2. Place a current probe on the left-hand pin of the Meter source.
  7. Switch to the Probe window to see the family of curves for I(Meter) as a function of P.
    Another way to view the family of curves without using schematic markers is as follows:
    1. From PSpice A/D’s Trace menu, choose Add Trace.
    2. In the Simulation Output Variables list, double-click I(Meter).
For more on analyzing Monte Carlo results in PSpice A/D, see the next section on Monte Carlo histograms.

Monte Carlo Histograms

You can display data derived from Monte Carlo waveform families as histograms. This is part of the performance analysis feature.

In this example, you simulate a fourth-order Chebyshev active filter, running a series of 100 AC analyses while randomly varying resistor and capacitor values for each run. Then, having defined performance analysis measurements for bandwidth and center frequency, you observe the statistical distribution of these quantities for the 100 runs.

Chebyshev filter example

The Chebyshev filter is designed to have a 10 kHz center frequency and a 1.5 kHz bandwidth. The schematic page for the filter is shown in Figure 13-7. The stimulus specifications for V1, V2, and V3 are:

V1: DC=-15 V2: DC=+15 V3: AC=1

The parts are rounded to the nearest available 1% resistor and 5% capacitor value. In this example, note how the bandwidth and the center frequency vary when 1% resistors and 5% capacitors are used in the circuit.

Figure 13-7 Chebyshev filter.

Creating models for Monte Carlo analysis

To vary the resistors and capacitors in the filter circuit, create models for these parts on which you can set device tolerances for Monte Carlo analysis. The BREAKOUT.OLB library contains generic devices for this purpose. The resistors and capacitors in this schematic are the Rbreak and Cbreak parts from BREAKOUT.OLB.

Using the Model Editor, modify the models for these parts as follows:

.model RMOD RES(R=1 DEV=1%)
.model CMOD CAP(C=1 DEV=5%)

Setting up the analysis

To analyze the filter, set up both an AC analysis and a Monte Carlo analysis. The AC analysis sweeps 50 points per decade from 100 Hz to 1 MHz. The Monte Carlo analysis is set to take 100 runs. Save data from all runs and set the output variable to V(OUT).

Creating histograms

Because the data file can become quite large when running a Monte Carlo analysis, to view just the output of the filter, you place a voltage probe at the output of the filter.

To collect data for the marked node only

  1. From the PSpice menu, choose New Simulation Profile or Edit Simulation Profile. (If this is a new simulation, enter the name of the profile and click OK.)
    The Simulation Settings dialog box appears.
  2. On the Data Collection tab, choose the At Markers Only option for each type of marker (Voltages, Currents, Power, Digital, Noise).
  3. Click OK.

To run the simulation and load Probe with data

  1. From Capture’s PSpice menu, choose Run to start the simulation.
    When the simulation is complete, PSpice A/D automatically displays the selected waveform. Because PSpice A/D ran a Monte Carlo analysis, it saved multiple runs or sections of data. These are listed in the Available Sections dialog box.
  2. In the Available Sections dialog box, click All.
  3. Click OK.

To display a histogram for the 1 dB bandwidth

  1. From PSpice A/D’s Plot menu, choose Axis Settings.
  2. Select the X Axis tab.
  3. In the Processing Options frame, select the Performance Analysis check box.
  4. Click OK.
    The histogram display appears. The Y axis is the percent of samples.
  5. From the Trace menu, choose Add Trace.
  6. Choose Bandwidth.
  7. In the Trace Expression box, specify Bandwidth(VDB(OUT),1).
You can also display this histogram by using the performance analysis wizard to display Bandwidth (VDB(OUT),1).

To change the number of histogram divisions

  1. From the Tools menu, choose Options.
  2. In the Number of Histogram Divisions text box, replace 10 with 20.
  3. Click OK.

The histogram for 1 dB bandwidth is shown in Figure 13-8.

Figure 13-8 1 dB bandwidth histogram.

The statistics for the histogram are shown along the bottom of the display. The statistics show the number of Monte Carlo runs, the number of divisions or vertical bars that make up the histogram, mean, sigma, minimum, maximum, 10th percentile, median, and 90th percentile.

  • Ten percent of the measurement values is less than or equal to the 10th percentile number, and 90% of the measured values is greater than or equal to that number.
  • If there is more than one measurement expression value that satisfies this criteria, then the 10th percentile is the midpoint of the interval between the measured values that satisfy the criteria. Similarly, the median and 90th percentile numbers represent measured values such that 50% and 90% (respectively) of the measured values are less than or equal to those numbers.
  • Sigma is the standard deviation of the measurement expression values.

If needed, you can turn off the statistical data display as follows:

  1. From the Tools menu, choose Options.
  2. Clear the Display Statistics check box.
  3. Click Save, and then OK.

You can also show the distribution of the center frequency of the filter.

To display the center frequency

  1. From the Trace menu, choose Add Trace.
  2. Choose CenterFreq.
  3. In the Trace Expression box, specify CenterFreq(VDB(OUT),1).

The new histogram replaces the previous histogram. To display both histograms at once, choose Add Plot to Window on the Plot menu before choosing Add from the Trace menu. The histogram of the center frequency is as shown in Figure 13-9.

Figure 13-9 Center frequency histogram.

Copying histogram data

You can use the copy function to transfer the raw histogram data points for a particular trace to the Windows clipboard. This allows you to save the data as a standard ASCII text file, or paste it directly into a report or other document for later reference.

To copy histogram data to the clipboard

  1. Select the trace symbol, or the trace name, in the histogram.
  2. From the Edit menu, choose Copy (or press Ctrl+C).
    The histogram data points for the trace will be transferred to the Windows clipboard.

To copy the histogram display to the clipboard

  1. From the Window menu, choose Copy to Clipboard.
    The histogram graph will be transferred to the Windows clipboard.

Worst-case analysis

This section discusses the analog worst-case analysis feature of PSpice A/D. The information provided in this section explains how to use worst-case analysis properly and with realistic expectations.

Overview of worst-case analysis

Worst-case analysis is used to find the worst probable output of a circuit or system given the restricted variance of its parameters. For instance, if the values of R1, R2, and R3 can vary by +10%, then the worst-case analysis attempts to find the combination of possible resistor values which result in the worst simulated output. As with any other analysis, there are three important parts: inputs, procedure, and outputs.

Inputs

In addition to the circuit description, you need to provide two pieces of information:

  • the parameter tolerances
  • a definition of what worst means

You can set tolerances on any number of the parameters that characterize a model.

You can define models for nearly all primitive analog circuit parts, such as resistors, capacitors, inductors, and semiconductor devices. PSpice A/D reads the standard model parameter tolerance syntax specified in the .MODEL statement. For each model parameter, PSpice A/D uses the nominal, minimum, and maximum probable values, and the DEV and/or LOT specifiers; the probability distribution type (such as UNIFORM or GAUSS) is ignored.

The criterion for determining the worst values for the relevant model parameters is defined in the .WC statement as a function of any standard output variable in a specified range of the sweep.

In a given range, reduce the measurement to a single value by one of these five collating functions:

MAX

Maximum output variable value

MIN

Minimum output variable value

YMAX

Output variable value at the point where it differs the most with the nominal run

RISE_EDGE
(value)

Sweep value where the output variable value crosses above a given threshold value

FALL_EDGE
(value)

Sweep value where the output variable value crosses below a given threshold value

You can define worst as the highest (HI) or lowest (LO) possible collating function relative to the nominal run.

You can use analog behavioral models to measure waveform characteristics other than those detected by the available collating functions, such as rise time or slope. You can also use analog behavioral models to incorporate several voltages and currents into one output variable to which a collating function may be applied.

Procedure

To establish the initial value of the collating function, worst-case analysis begins with a nominal run using all model parameters at their nominal values.

Next, multiple sensitivity analyses determine the individual effect of each model parameter on the collating function. This is accomplished by varying model parameters, one at a time, in consecutive simulations. The direction (better or worse) in which the collating function changes with a small increase in each model parameter is recorded.

Finally, for the worst-case run, each parameter value is taken as far from its nominal as allowed by its tolerance, in the direction which should cause the collating function to be its worst (given by the HI or LO specification).

This procedure saves time by performing the minimum number of simulations required to make an educated guess at the parameter values that produce the worst results. It also has some limitations, which are described in the following sections.

Outputs

A summary of the sensitivity analysis is printed in the PSpice A/D output file (.OUT). This summary shows the percent change in the collating function corresponding to a small change in each model parameter. If a .PROBE statement is included in the circuit file, then the results of the nominal and worst-case runs are saved for viewing in the Probe window.

Caution: An important condition for correct worst-case analysis

Worst-case analysis is not an optimization process; it does not search for the set of parameter values that result in the worst result.

It assumes that the worst case occurs when each parameter has been either pushed to one of its limits or left at its nominal value as indicated by the sensitivity analysis. It shows the true worst-case results when the collating function is monotonic within all tolerance combinations.

Otherwise, there is no guarantee. Usually you cannot be certain whether this condition is true, but insight into the operation of the circuit may alert you to possible anomalies.

Worst-case analysis example

The schematic shown in Figure 13-10 is for an amplifier circuit that is a biased BJT. This circuit is used to demonstrate how a simple worst-case analysis works. It also shows how non-monotonic dependence of the output on a single parameter can adversely affect the worst-case analysis.

Because an AC (small-signal) analysis is being performed, setting the input to unity means that the output, Vm([OUT]), is the magnitude of the gain of the amplifier. The only variable declared in this circuit is the resistance of Rb2. Because the value of Rb2 determines the bias on the BJT, it also affects the amplifier’s gain.

Figure 13-10 Simple biased BJT amplifier.

Figure 13-10 is the circuit file used to run one of the following:

  • a parametric analysis (.STEP, shown enabled in the circuit file) that sets the value of resistor Rb2 by stepping model parameter R through values spanning the specified DEV tolerance range, or
  • a worst-case analysis (shown disabled in the circuit file) that allows PSpice A/D to determine the worst-case value for parameter R based upon a sensitivity analysis.

Only one of these analyses can run in any given simulation.

The AC and worst-case analysis specifications (.AC and .WC statements) are written so that the worst-case analysis tries to minimize Vm([OUT]) at 100 kHz.

The netlist and circuit file in Figure 13-11 are set up to run either a parametric (.STEP) or worst-case (.WC) analysis of the specified AC analysis. These simulations demonstrate the conditions under which worst-case analysis works well and those that can produce misleading results when output is not monotonic with a variable parameter (see Figure 13-13 and Figure 13-14).

Figure 13-11 circuit netlist

For demonstration, the parametric analysis is run first, generating the curve shown in Figure 13-13 and Figure 13-14. This curve, derived using the YatX measurement shown in Figure 13-12 illustrates the non-monotonic dependence of gain on Rb2.

Figure 13-12 YatX Measurement Expression

To do this yourself, place the measurement definition in a PROBE.PRB file in the circuit directory. Then start PSpice A/D, load all of the AC sweeps, set up the X axis for performance analysis, and add the following trace:

YatX(Vm([OUT]),100k)
The YatX measurement is used on the simulation results for the parametric sweep (.STEP) defined in Figure 13-12. The resulting curves are shown in Figure 13-13 and Figure 13-14.

Next, the parametric analysis is commented out and the worst-case analysis is enabled. Two runs are made using the two versions of the Rbmod .MODEL statement shown in the circuit file. The model parameter, R, is a multiplier which is used to scale the nominal value of any resistor referencing the Rbmod model (Rb2 in this case).

The first .MODEL statement leaves the nominal value of Rb2 at 720 ohms. The sensitivity analysis increments R by a small amount and checks its effect on Vm([OUT]). This slight increase in R causes an increase in the base bias voltage of the BJT, and increases the amplifier’s gain, Vm([OUT]). The worst-case analysis correctly sets R to its minimum value for the lowest possible Vm([OUT]) (see Figure 14).

The second .MODEL statement scales the nominal value of Rb2 by 1.1 to approximately 800 ohms. The gain still increases with a small increase in R, but a larger increase in R increases the base voltage so much that it drives the BJT into saturation and nearly eliminates the gain. The worst-case analysis is fooled by the sensitivity analysis into assuming that Rb2 must be minimized to degrade the gain, but maximizing Rb2 is much worse (see Figure 13-14). Note that even an optimizer, which checks the local gradients to determine how the parameters should be varied, is fooled by this circuit.

Figure 13-13 Correct worst-case results.

In the above figure, output is monotonic within the tolerance range. Sensitivity analysis correctly points to the minimum value.

Figure 13-14 Incorrect worst-case results.

In the above figure, output is non-monotonic within the tolerance range, thus producing incorrect worst-case results.

Consider a slightly different scenario: Rb2 is set to 720 ohms so that maximizing it is not enough to saturate the BJT, but Rb1 is variable also. The true worst case occurs when Rb2 is maximized and Rb1 is minimized. Checking their individual effects is not sufficient, even if the circuit were simulated four times with each resistor in turn set to its extreme values.

Tips and other useful information

VARY BOTH, VARY DEV, and VARY LOT

When VARY BOTH is specified in the .WC statement and a model parameter is specified with both DEV and LOT tolerances defined, the worst-case analysis may produce unexpected results. The sensitivity of the collating function is only tested with respect to LOT variations of such a parameter.

Figure 13-15 Schematic using VARY BOTH.

For example, during the sensitivity analysis, the parameter is varied once affecting all devices referring to it and its effect on the collating function is recorded. For the worst-case analysis, the parameter is changed for all devices by LOT + DEV in the determined direction. See the example schematic in Figure 13-15 and circuit file in Figure 13-16.

Figure 13-16 Circuit file using VARY BOTH.

In this case, V(3) is maximized if:

  • Rwc1 and Rwc2 are both increased by 10% per the LOT tolerance specification, and
  • Rwc1 is decreased by 5% and Rwc2 is increased by 5% per the DEV tolerance specification.

The final values for Rwc1 and Rwc2 should be 105 and 115, respectively. However, because Rwc1 and Rwc2 are varied together during the sensitivity analysis, it is assumed that both must be increased to their maximum for a maximum V(3). Therefore, both are increased by 15%.

The purpose of the technique is to reduce the number of simulations. For a more accurate worst-case analysis, you should first perform a worst-case analysis with VARY LOT, manually adjust the nominal model parameter values according to the results, then perform another analysis with VARY DEV specified.

Gaussian distributions

Parameters using Gaussian distributions are changed by 1σ (one sigma) for the worst-case analysis.

The default Gaussian distribution shall have the sigma value of 3.

A new Gaussian distribution GaussUser will have a default sigma value of 1.When this is selected, user can see the value of sigma displayed alongside. The sigma value can be changed from 1 to 9.

YMAX collating function

The purpose of the YMAX collating function is often misunderstood. This function does not try to maximize the deviation of the output variable value from nominal. Depending on whether HI or LO is specified, it tries to maximize or minimize the output variable value itself at the point where maximum deviation occurred during sensitivity analysis.

This may result in maximizing or minimizing the output variable value over the entire range of the sweep. This collating function is useful when you know the direction in which the maximum deviation occurs.

RELTOL

During the sensitivity analysis, each parameter is varied (multiplied) by 1+RELTOL where RELTOL is specified in a .OPTIONS statement, or defaults to 0.001.

Sensitivity analysis

The sensitivity analysis results are printed in the output file (.OUT). For each varied parameter, the percent change in the collating function and the sweep variable value at which the collating function was measured are given. The parameters are listed in worst output order; for example, the collating function was its worst when the first parameter printed in the list was varied.

When you use the YMAX collating function, the output file also lists mean deviation and sigma values. These are based on the changes in the output variable from nominal at every sweep point in every sensitivity run.

Manual optimization

You can use worst-case analysis to perform manual optimization with PSpice A/D. The monotonicity condition is usually met if the parameters have a very limited range.

Performing worst-case analysis with tight tolerances on the parameters produces sensitivity and worst-case results (in the output file). You can use these to decide how the parameters should be varied to achieve the desired response. You can then make adjustments to the nominal values in the circuit file, and perform the worst-case analysis again for a new set of gradients.

Parametric sweeps (.STEP), like the one performed in the circuit file shown in Figure 13-11, can be used to augment this procedure.

Monte Carlo analysis

Monte Carlo (.MC) analysis may be helpful when worst-case analysis cannot be used. Monte Carlo analysis can often be used to verify or improve on worst-case analysis results. Monte Carlo analysis randomly selects possible parameter values, which can be thought of as randomly selecting points in the parameter space. The worst-case analysis assumes that the worst results occur somewhere on the surface of this space, where parameters (to which the output is sensitive) are at one of their extreme values.

If this is not true, the Monte Carlo analysis may find a point at which the results are worse. To try this, replace .WC in the circuit file with .MC < #runs > , where < #runs > is the number of simulations you want to perform. More runs provide higher confidence results. The Monte Carlo summary in the output file lists the runs in decreasing order of collating function value.

To save disk space, do not specify any OUTPUT options.

Next, add the following option to the . MC statement, and simulate again.

OUTPUT LIST RUNS <worst_run#>

This performs only two simulations: the nominal and the worst Monte Carlo run. The parameter values used during the worst run are written to the output file, and the results of both simulations are saved.

Using Monte Carlo analysis with YMAX is a good way to obtain a conservative guess at the maximum possible deviation from nominal, since worst-case analysis usually cannot provide this information.

View the next document: 14 - Digital Simulation

If you have any questions or comments about the OrCAD X platform, click on the link below.

Contact Us