will be under maintenance from Friday, Oct. 3rd at 6pm (PST) thru Sunday, Oct 5th at 11pm (PST). login, registration, community posting and commenting functionalities will be disabled.
Home > Community > Blogs > RF Design > guidelines for maximizing speed vs accuracy for harmonic balance part 2
Login with a Cadence account.
Not a member yet?
Create a permanent login account to make interactions with Cadence more convenient.

Register | Membership benefits
Get email delivery of the RF Design blog (individual posts).


* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

Guidelines for Maximizing Speed vs Accuracy for Harmonic Balance - Part 2

Comments(4)Filed under: RF design, Virtuoso Spectre Simulator GXL, Spectre RF, Virtuoso Spectre Simulator XL, Harmonic Balance, spectreRF, MMSIM, ADE-L, RF Simulation, RF, RF spectre spectreRF, HB, analog/RF

I am often asked for guidelines on maximizing speed vs. accuracy for SpectreRF harmonic balance simulations

Today, I'll discuss part 2 of the 3 part series consisting of:

  • Which Engine:  Spectre or APS?
  • Oversample vs Number of Harmonics
  • Harmonic Trimming 

The first post in this series focused on the "which engine" question. 

Another aspect of speed vs accuracy in Harmonic Balance Simulations is specifying the number of harmonics and the value of oversample.  

Note:  You may also want to look at Solution 11670194 Guidelines for setting "Oversample vs Number of Harmonics" in Harmonic Balance simulation.  (;solutionNumber=11670194 )

Below are three scenarios I'll consider:

  • Circuit with sinusoidal voltage and current waveforms
  • Circuit with sinusoidal input but has some non-sinusoidal currents (for example) in the circuit 
  • Circuit with square wave input or signals generated in the circuit are digital-like
Circuit has sinusoidal voltage and current waveforms:

If your circuit has sinusoidal voltage and current waveforms, start with setting oversample=1

  •  As a starting point for the number of harmonics...If the circuit:
    • operates below the compression point, choose 3 harmonics.
    • operates near the compression point, choose 5 harmonics.   
    • operates above the compression point, choose 7 harmonics.
  • Run your first simulation and make your measurement (e.g. IP3).
  • Increase the number of harmonics by 50%, e.g.
    • If you started at 3 harmonics, increase to 5 harmonics,
    • If you started at 5 harmonics, increase to 7,
    • If you started at 7 harmonics, increase to 10, etc.
  • Re-run the simulation and replot the measurement.
  • If the result changes, increase the number of harmonics by 50%, re-run the simulation, and replot the measurement.
  • Keep incrementing until you get stable results. Then you know your answer is accurate.

Circuit has a sinusoidal input but currents are non-sinusoidal:

If your circuit has a sinusoidal input but currents (for example) in the circuit are non-sinusoidal -- say in the case of a diode mixer, you can still use harmonic balance, but you need to use considerably more harmonics.

  • As a start, choose 25 harmonics and set oversample to 4.
  • Simulate and plot your measurement.
  • Increase oversample to 8. (oversample should be a power of 2, since the FFT-IFFT requires a "power of 2" samples)
  • Re-simulate and plot your measurement.
  • If the results stay the same, keep oversample at 4. If they change, you may want to use oversample=8 and increase the harmonics by 50% and resimulate.

Circuit contains square waves or digital-like signals

If your input is a square wave or signals generated in the circuit are digital (e.g. mixer + divider)... as mentioned above, see Solution 11670194 Guidelines for setting "Oversample vs Number of Harmonics" in Harmonic Balance simulation. (;solutionNumber=11670194 )

  • If you have square waves in your circuit, use transient analysis to calculate period of the harmonics divided by risetime. Set this as the number of harmonics. Set oversample to 1 and run the simulation.
  • Next change oversample to 2, and re-run the simulation. If the measurement you want has changed significantly (this is ultimately determined by the designer, but a guideline you can use is about 0.2 dB) then increase oversample to 4, and re-simulate.
  • If the measurement result changes again, increase oversample to 8. If it changes again, increase the number of harmonics.
  • Keep incrementing the number of harmonics until you get a stable result.

In general, the more non-sinusoidal the waveform, the higher you need to set oversample. Typically for "sharp" edges use oversample=8. For "rounded" edges, use oversample=4.

Finally, some circuits just do not play well with Harmonic Balance.  Extremely nonlinear (but periodic) circuits may be better suited for the Shooting Newton engine.

For more tips like this, please visit Please note that you must be a Cadence Customer on Maintenance to access this website .

Stay time I'll talk about Knob 3....Harmonic Trimming!

Best regards,



By Stephan on November 3, 2011
Very useful. In some older docs it is stated that more oversampling than 2 is not recommended, but your suggestions are perfect.
Maybe tell us also on the impact of #harmonics and pnoise, etc.

By Tawna on November 16, 2011
Hi Stephan,
If you are a Cadence Customer on Maintenance,
You may also want to look at  Cadence Online Solution 11732744 "Guidelines for setting Pnoise/HBnoise sidebands to get accurate results"
or this blog posting:
Tip of the Week: Guidelines for getting accurate HB QPSS/QPNoise results (
Best regards,

By Shawn Logan on November 16, 2011
I do not understand why these algorithms cannot be built into the algorithm. In other words, if one specified the "critical" signals in an analysis, it seems an FFT of the waveforms after the simulation is complete - or even better while it is running - would reveal the nature of the critical waveforms (I.e., number of harmonics). The simulation would be stopped and re-started if the number of harmonics was too small. This appears to be much more efficient (from a designer's perspective) as only a single simulation is submitted and the iterations are handled based on the waveforms of the critical nodes by the simulator itself.

By Tawna on November 18, 2011
Hi Shawn,
Try using the fourier component in analogLib.  This component accurately calculates the number of harmonics you request with no requirement to set up any analysis options, except for possibly a tighter reltol and vabstol if your accuracy needs to be better than that produced by the defaults.  While many things can be implemented, in this case, there just hasn’t been customer demand for this feature.  I suggest you submit an enhancement request from your account at so the request can be considered.
For some guidelines on using the fourier component, please see Solution 11251190;solutionNu
Best regards,

Leave a Comment

E-mail (will not be published)
 I have read and agree to the Terms of use and Community Guidelines.
Community Guidelines
The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.