# (P)SpiceITUp: How to Use Measurements to Optimize Your Design

Your products must perform well in terms of their requirements. For a product to perform well, you must ensure that the design parameters are tuned for the best performance possible. For example, you might need the output voltage to hover around 20V or the rise time to be always less than 1us. You need to have a way of defining the requirements and then simulating the circuitry to determine how it will perform. One way to do this is the error-prone and tedious bench testing method. But there is an easier and quicker solution with the Optimizer of PSpice® Advanced Analysis.

The Optimizer will vary specific parameters between successive simulations until performance comes close to or exactly meets the requirement. Of course, the parameters and performance requirements will be identified and defined by you. The performance requirements can be either a specification or a curve. A specification can be a goal or a constraint, where a goal is something you want to try to meet and a constraint must be met. In the earlier example, the 20V output is a goal whereas the 1us rise time is a constraint. A goal or a constraint can be an expression or a measuring function.

Before starting with Optimizer, you must simulate the design using PSpice A/D and ensure that the design components have variable parameters. You must also decide the goals and constraints for the design and identify component parameters. Identifying component parameters is best done by running sensitivity analysis.

If you want to work along, open the RF Amplifier demo design (*File* – *Open* – *Demo Designs*) in OrCAD® Capture.

## Setting Up Measurements

The Optimizer goal for the RF Amplifier design is to increase the bandwidth from 150 MHz to 200 MHz.

The following are the constraints for the design:

- Gain must be at least 5 dB (original value is 9.4 dB)
- Maximum noise figure to be 5 (original value is 4.1)
- Maximum output noise to be 7 nano volts per root Hz (original value is 4.3 nano volts per root Hz)

You'll need to add measurements and specify the goal and constraints for these measurements. Run AC analysis and add the following measurements in PSpice A/D.

Ensure the measurements give the expected results.

See the *Creating Measurements* section of (P)SpiceItUp: Creating Predictable Designs Using Sensitivity Analysis for the steps to run an AC analysis and create the measurements.

## Setting Up and Running Optimizer

1. In OrCAD Capture, choose *PSpice* – *Advanced Analysis* – *Optimizer* to open Optimizer in PSpice Advanced Analysis.

2. Ensure *Modified LSQ* is selected as the Optimizer engine.

Use Modified LSQ to quickly converge on an optimum solution and use the Random engine if the simulation is not converging. You can pick a start point to avoid being stuck in local minima for the Random engine.

Use the Discrete engine only to convert optimization parameters into discrete values after optimization. For example, to pick commercially available component values and run the simulation one more time with the selected commercial values.

Now, you will import parameters and restrict the range for which the parameters will be varied so that performance is optimized.

3. In the *Parameters* table, click the row containing the text *"Click here to import..."*.

4. Scroll down and select the following components and then click *OK*:

- R4
- R6
- R8

The components are listed in the table.

5. In the *Parameters* table, edit the Min and Max values for the listed components as follows to tighten or restrict the range of variation of resistance:

Component | Min | Max |

R4 | 235 | 705 |

R6 | 235 | 705 |

R8 | 3 | 3.6 |

Click to use the Original value without variation during the next optimizing run.

Click to lock in the current value without variation during the next optimizing run.

Now, you will import and set up the measurements for the goals and constraints.

6. In the *Specifications* table, click the row containing the text "*Click here to import...."*.

7. Select the measurements created and click *OK*.

The measurements are listed in the table.

8. Specify *Min*, *Max*, *Type*, and *Weight* for the measurements as follows:

Measurement | Min | Max | Type | Weight |

Max(DB(V(Load))) | 5 | 5.5 | Constraint | 20 |

Bandwidth(V(Load),3) | 200meg | Goal | 1 | |

Min(10*Log10(V(inoise)*V(inoise)/8.28e-19)) | 5 | Constraint | 1 | |

Max(V(onoise)) | 7n | Constraint | 20 |

The two constraints for gain and output noise have higher weights to emphasize their importance. The weight value must be a positive integer equal to or greater than one. You can experiment by changing the weights.

The Min and Max values ensure the goals and constraints as decided are met.

9. Click *Start/Resume* ( ) to run Optimizer.

The Error Graph shows a plot with an error trace for each measurement.

Optimization is successful for all the measurement goals and constraints.

## Using the Discrete Engine

Although optimization is successful, the new values suggested for R4, R6, and R8 are not available commercially.

You can run Optimizer using discrete values tables for different components. These tables provide commercially available values.

1. Select *Discrete* as the Optimizer engine.

2. Select the 10% discrete values table for each resistor.

You can explore the other table choices available.

3. Run Optimizer.

The Optimizer finds the nearest commercially available component and then runs simulations based on the new values to suggest a commercially available value for R4, R6, and R8.

You can now change the component values in the schematic and then run AC analysis again to verify that the results are as expected. Right-click a component and select *Find in design* to quickly locate the component in the schematic.

## Conclusion

You can quickly define specifications as constraints and goals and then determine the right component parameters to achieve the specifications using Optimizer in PSpice Advanced Analysis. You can also choose between Modified LSQ or the Random engines and then if required, use the Discrete engine to determine commercially available values.

This post discusses the standard, measurement-based way of specifying goals and constraints. The next post in this series will discuss Curve Fitting, which is the curve-based method that uses points on a waveform to specify requirements.

Do SUBSCRIBE to be updated about upcoming blogs. If you have any topic you want us to cover or any feedback for us, you can write to us at pcbbloggers@cadence.com.