Tutorials, news, snippets, and other various musings about the electrical engineering industry.

Quick Tutorial: Optimizing Circuit Results with PSpice Advanced Analysis

Getting your circuit to give the results that you want can sometimes be a very difficult task. If you have specific behaviors that you would like your circuit to adhere to or if you have a set of data points that you’d like your output to match exactly, it can be challenging and time consuming to tune your circuit to meet those requirements. The Optimizer tool in PSpice Advanced Analysis makes quick work of these types of problems by using its solving engine to get right to the results that you need.


PSpice Advanced Analysis is an option that you can add on to your PSpice simulation environment which contains five features overall (Smoke, Monte Carlo, Optimizer, Sensitivity and Parametric Plotter) – we’ll be addressing only the Optimizer portion of the toolset in this post.


In this entry, we are going to take a look at two different scenarios where the Optimizer can be used. If you would like more information, please view the video near the end of the post showing all the steps to make it run; also, the files that were used will be included as attachments at the bottom of this post.


Optimizer using Measurements

If you have some general behavior that you would like your circuit to match, you can Optimize that quite easily using Measurements. First, you can run a regular simulation showing the behavior of the circuit as it exists presently. In PSpice, pull up the Measurements dialog by choosing View > Measurement Results. On the Measurement Results tab that comes up, choose, “Click here to evaluate a new measurement…” to set up a new measurement for PSpice to evaluate – these measurements are critical for nearly all the simulation features in Advanced Analysis including Optimizer.



Once you’ve got the measurements set up that you would eventually like to optimize, go back to Capture and choose PSpice > Advanced Analysis > Optimizer to invoke the PSpice Advanced Analysis tool and the Optimizer feature specifically.



In Optimizer, focusing on the Specifications window in the middle, you need to import your measurements using the, “Click here to import a measurement created within PSpice…” line item and then you can specify what values you would like these measurements to have (the desired functionality) in the Min and Max fields.



In the Parameters window in the upper right, you will specify which components the Optimizer is allowed to manipulate and to what extent. You can import components by choosing the, “Click here to import a parameter from the design property map…” line item and modify the limits to which the Optimizer can change the component value if you wish.



At this point, the setup is completely finished and you can hit the Start button to allow the Optimizer to begin its attempt to converge on a solution that will meet your Goals and Constraints. If it is able to converge, you will see each line in the Error Graph make its way down to 0% error.



It will also show the Current Value in the Specifications window and the Component Values in the Parameters window so you can verify that the results obtained are meeting your needs.


If the component values are too specific and not purchasable, you can have the Optimizer map these components to the nearest purchasable value on a specified tolerance table (we provide 1%, 5% and 10% tables but you can add more if you wish) by choosing Discrete in the Simulation Engine drop down.



You can now take these results and plug them back into your schematic to get exactly the same behavior in your original design.


Optimizer using Curve-Fitting


If you have a set of very specific data points that you’d like your trace to match, the Curve Fitting tool within Optimizer is the feature you want to use. In this case, instead of Measurements, you’ll need a text file that has a list of the data points that you want your trace(s) to match, like this:


  • Where the first column is Frequency (x-axis) and the second and third columns are Phase and Gain.
  • Before going off to the Optimizer, Run a regular simulation in PSpice just to make sure the netlist is current. In Optimizer, click on the Curve Fit tab in the middle window and point to the text file with the data points that you’d like to match and the waveform in your design that you’d like to match it to. Specify the error tolerance that you’ll permit and the components and their range allowed in the optimization (top window).



Hit Run and let the Optimizer work to put the green traces on top of the desired red traces.



Where the top plot is showing the Phase Optimization and the bottom plot is showing the Gain. In both plots the red is representing the text file points and the green is showing what the circuit is doing based on the values of the components in the specific simulation iteration.


After a few iterations, the green trace is hopefully getting closer to lying on top of the red trace, like this:



If you’d like the results to be even closer, you can reduce the tolerance to force the Optimizer to try longer to get the traces more on top of each other. If these results are close enough, you can map your components to discrete parts that are purchasable and plug those numbers into your schematic and you’re done!


Thanks for reading about how the Optimizer inside PSpice Advanced Analysis works, please watch the video below for a walk-through and then try this for yourself.


Watch the Video