Harmonic Balance Simulation Algorithm: The Basics

Parent Category: 2016 HFE

By Ain Rehman

Ever had the error message “Transient time step too small” come up during your transient simulations? We have. Many times. One of the most common reasons for this is that our circuit contains two widely separated time constants. So if we constrain the simulator to follow the fast time constant (by setting the timestep to be small, thereby following the faster time constant), it cannot follow the slower one, and vice versa. End result in a majority of cases: “Transient  time step too small”!

Well, the algorithm gurus came up with a technique that can put an end to this extremely annoying problem. The answer is an algorithm (that works in a majority of cases) called the “Harmonic Balance” algorithm. We can become effective users of this algorithm and the simulator which it is implemented in, if we understand it and its limits.

This brief article is an attempt to explain the HB technique as it is applied to our favorite kind of activity: circuit simulation.

HB Algorithm

The HB algorithm is very efficient and flexible and actually calculates the steady state solution directly. It does this by using the Fourier series philosophy. HB is a pure frequency domain technique. We all know how the ac frequency domain runs get done with a minimum of fuss, and relatively quickly. 

Well, HB does this first on small signal frequency domain components and then on larger signals which generate many new frequency components (Harmonics). It does sufficient small signal steady state calculations on the harmonics so that the shape of the final transient signal is produced to within an extremely small error tolerance.

Prime candidates for the use of HB are:

(1)Circuits with widely separated time constants as indicated above.

(2)Mixers.

(3)Oscillators.

(4)Frequency multipliers.

(5)Frequency dividers.

(6)Power amplifiers.

(7)Modulators.

(8)Computation of P1 dB.

(9)Computation of IP3.

(10) Computation of total harmonic distortion.

(11) Computation of IM components.

(12)Analysis of Power amplifier load – pull.

(13)Nonlinear noise analysis.

(14) Simulation of oscillator harmonics.

(15)Simulation of oscillator phase noise.

(16)Simulation of amplifier amplitude limits.

(17)Dispersive transmission lines.

(1)Circuits with a lot of reactive components.

Note in each case HB is used when the circuit exploits non-linearity in some form to get the performance required in the circuit design.

For the more analytically minded, the following explanation of the basics of HB is in order.

With reference to Figure 1, note that the entire circuit to be simulated is first separated into its linear and non linear sections as shown. The interface is a set of voltages and currents as indicated.

Two transadmittance matrices are defined; Y, that maps the signal voltages VsM to the interconnection currents iN and Y1 that maps the voltages vN to the currents iN. Thus the composite current is:

I = YMXN Vs + Y1NXN V = Is + Y1NXN VEqn (1).

Since Vsi are known and constant the current Is (input linear region currents) can be readily computed. 

The non-linear section is modeled first by a current transient solution i(t) = f1(v1, …..vk) and by a transient charge function q(t) = f2(v1,…..vq).  These functions are transformed into frequencies by the use of the Fourier transform and provide frequency domain vectors I1 and Q1.

A harmonic balance solution is found if the interconnect currents for the linear section are the same as the interconnect currents for the non-linear section. Therefore the currents of the linear and the non-linear sections are balanced at each harmonic frequency. This method is called Kirchhoff’s current law harmonic balance (KCL-HB).

This generates a non-linear matrix equation that leads to the desired solution: 

G(V) = Is + Y1.V + j ω.Q + I1  = 0                  Eqn (2)

where matrix ω contains the radian frequencies on the first main diagonal and zeros anywhere else, is the zero vector. 

Inverse Fourier Transform

The inverse Fourier transform is applied at each iteration to convert to time domain quantities. Then these time domain solutions ( v1, ……vk) and (v1,……vq) are inserted into the solution i(t). A further Fourier transform provides the charge and current vectors as above. After several iterations a solution is found, i.e., we have the voltages v1, v2 .. etc., at the interconnect points. These provide the means to calculate the voltages at all the nodes. Inserting current sources at the interconnect points and doing an AC simulation provides the complete simulation.

1606 HFE harmonic 01

Figure 1 • Linear and non-linear sections.

In conventional frequency-domain linear analysis, nonlinear devices are represented by linearized equivalent circuit models around the dc operating point. Typically, the models are extracted from small-signal and/or dc measurements. Such models can be inadequate or even unsuitable for large-signal simulation. Using harmonic balance, large-signal nonlinear models can be extracted directly from power spectrum and/or waveform measurements. 

Another significant approach is to combine dc, small signal and large-signal performance specifications into one unified design optimization problem. This is possible if the same nonlinear circuit model is used in dc, small-signal and large-signal analyses, providing analytically consistent results. The ability to optimize different types of responses simultaneously instead of separately brings important benefits to a CAD system, especially when some of the variables affect both the small- and large-signal performance.

Harmonic balance can also be applied to statistical optimization of nonlinear circuits. In order to reduce the computational effort involved in the Monte Carlo simulation of a large number of random outcomes (i.e., circuits with statistically perturbed parameter values), a recent approach applies quadratic approximation not only for the circuit responses but also for their derivatives. Since the determination of the quadratic model coefficients is independent of the number of outcomes, we can improve the sampling accuracy using a large number of outcomes without excessive computational effort.

A thesis from MIT also addresses harmonic balance and is quite useful in furthering the understanding of the algorithm. It can be found on the web at: 

http://www.rle.mit.edu/cpg/publications/nastov.pdf.

Competing Sources

The EDA industry (e.g., Agilent ADS and CADENCE SpectreRF) has come up with two competing approaches—the harmonic-balance algorithm and the PSS (Periodic Steady State) algorithm—for simulating RFICs/MMICs, such as power amplifiers, low-noise amplifiers, mixers, and VCOs. The PSS algorithm is effectively an RF-simulation extension to a transient-simulation engine, assuming that a periodic signal exists in the system. Cadence  Design System’s SpectreRF simulation implements the PSS algorithm.

The efficiency of each type of simulation (harmonic balance versus PSS) depends largely on the types of elements in the circuit and the complexity of the signal at the input. For example, passive elements—such as resistors, inductors, and capacitors— are linear except in the extremes of their operating ranges. Diode elements exhibit nonlinear electrical characteristics at large input signals. Active devices are made up of P-N diode junctions and are, therefore, also nonlinear. Note that both types of simulators first require the calculation of a dc operating point.

Benchmarking done on these two types of tools came up with the following conclusions:

Although harmonic-balance simulation suits certain nonlinear RF circuits, such as the large-signal simulation of power amps, the PSS engine may have benefits for highly nonlinear circuits and small-signal simulations. The PSS engine also performed relatively better on VCO circuits. Also, transient simulators can perform well for other types of circuit simulations, such as larger circuits with some custom- or standard-cell digital content. (Reference: http://m.eet.com/me http://www.rle.mit.edu/cpg/documents/04167776-1.pdfdia/1140852/18619-238416.pdf)

For an overview of PSS in the SpectreRF program please see the following link: http://www2.ece.ohio-state.edu/~bibyk/ece822/SpectreRF_0728.pdf.

Another interesting paper on RF simulation algorithms can be found at the following link: http://www.rle.mit.edu/cpg/documents/04167776-1.pdf

Harmonic balance freeware is also available on the web for those who do not want to spend the rather large amounts of money for commercial programs like ADS. One such program is HBfree. It will require some effort to get it going, but once that is done the program does generate some fairly respectable results. HBfree is available at the following link. https://sourceforge.net/projects/hbfree/.

About the Author

Ain Rehman is Founder and Chief Engineer at Signal Processing Group, Chandler, Ariz. His experience on the Harmonic Balance algorithm was obtained by designing RF/microwave integrated circuits over a significant length of time. Specifically the Harmonic Balance algorithm as implemented in Agilent ADS. He has found that although ADS, with its massive (and highly complex architecture) can sometimes cause issues, it does do the job. (Compared silicon with simulation and found good agreement). This is not to say that PSS should be ignored. As noted above, this evaluation has been done and some results are already quoted.