### Loop Gain

**About the writer**:
Harvey Morehouse is a contractor/consultant with many years of experience
using circuit analysis programs. His primary activities are in Reliability,
Safety, Testability and Circuit Analysis. He may be reached at harvey.annie@verizon.net.
Simple questions for which I know the answer are free. Complex questions,
especially where I am ignorant of the answers, are costly!!!

**Summary**: Determining stability
is one of the most misunderstood aspects of using SPICE. Several simulation
methods/techniques of determining loop gain (for stability analysis
purposes) are presented along with a discussion of the problems that
can invalidate the method.

**General:**

How to determine loop gain of a feedback network seems to be a commonly misunderstood topic, for some strange reason. Even though this is covered in most college courses, most of the material seems to be lost when a person graduates for some reason.

There are several methods of determining loop gain. They include:

- Analytical methods.
- Experimental methods.

- Simulation methods. Analytical methods are often the emphasis in college courses. One gets immersed into Nyquist, Root Locus and other techniques including sometimes Liapunov's Second method and other advanced topics. However, these generally involve linear circuits or easily linearized or transformable circuits that can be conveniently be represented by an equation suitable for analysis. While it is good to have an understanding of these methods and their implications, in the 'real' world of the typical engineer they are seldom used.

Experimental methods are more frequently encountered. With the aid of network analyzers and other tools, the stability of actual breadboards or working circuits may be investigated.

The most often used simulation method used to investigate stability is simulation using SPICE or other software to investigate the performance of a modeled circuit. There are several reasons why this is so.

The first is that a breadboard, really an analog computer simulation, represents one specific combination of parts, each of which can vary widely creating virtually an infinite number of possible combinations. The model can accommodate these possible variations and the analysis can be performed under worst-case variations of the parts and stimulus and other parameters.

The second is that to construct and test many different breadboards with all of the variations takes time and effort to accomplish.

Now in many cases conventional stability analyses cannot be performed using SPICE. It must be understood almost all quantifiable stability analyses are performed on an AC basis through the construction of Bode plots. However, it is not possible to directly quantify the results in many systems of interest.

Consider a DC-DC converter. The network contains switches that essentially toggle from essentially zero to very large values almost instantaneously. An AC analysis consists of a small-signal equivalent circuit analysis of the circuit or system about an operating point. But where is the equivalent operating point of a switch that varies from open to closed?

Now one can perform a transient analysis with a small sine wave signal, but because of distortions it is often not clear what the gain and phase really are. The solution for this specific problem is to create an averaged device model. This is really out-of-scope here, but it is important to note that there is no real SPICE AC equivalent circuit for a network with switching devices.

Here we are not concerned with methods of modeling SMPS systems/DC-DC converters and investigating their stability, but the process in general of determining the open loop gain behavior of a feedback system.

**Simulation
Loop Gain methods:**

Before getting into the simulation loop gain methods, it is important to remember that most of the college and academic discussions concerning loop gains, and servos in general, are based on a BLOCK DIAGRAM model representation. See Figure 1, from Reference 1.

Figure 1

Typical Block Diagram

It is infinite impedance at its input (if it represents a voltage-to-whatever transfer function. If it represents a current-to-whatever transfer function the input impedance is zero.) It has effectively zero output impedance (if it represents a whatever-to-voltage transfer function. If it represents a whatever-to-current transfer function the output impedance is infinite.) The signal flow is unidirectional. Changes at the output of a block due to loading or signal application do not create changes at the input of a block due to direct transmission through the block in the reverse direction. Information flows only in the direction of the arrows.

Now no real system will behave in that manner, although some will be close. However, IF we properly analyze the system, we will get the proper results. {Note that the Generalized Feedback Theorem of Middlebrook. which removes these restrictions and more is NOT considered here at this time.)

**AC
Loop opening:**

A common means of obtaining a measurement of loop gain is to insert a huge inductor into the feedback path, together with a huge capacitor. The inductor is placed in the circuit in a single point in the assumed unidirectional signal flow before the injected signal. Here is where most analysts get into trouble. The problem is that that loop gain is totally misunderstood. The two referenced articles of into this in some detail.

* The
main way to get an open loop transfer function, at least until Middlebrook
came up with his generalized feedback theorem, is with a two-circuit
model.* The two-circuit model uses TWO identical copies of
the circuit under test to get a current and a voltage transfer function,
which are combined to form the open loop gain. The injection point
MUST be identical in the two circuits, it must be in the normal signal
path flow and the injection point should not be within a sub-loop.
Refer to Reference 1.

Reference 1 shows the injection technique of using a large inductor and capacitor. In one case a voltage is injected, and the resulting voltage at the other side of the inductor is measured. In the second case, a current in injected, and the short circuit current gain is measured again at the other side of the blocking inductor. The resultant loop gain is then:

Loop Gain = -1 / (1/Toc+1/Tsc)

This
can be recognized as the parallel combination of the gains Toc and
Tsc, or Gv and Gi. As in all parallel combinations, the smaller term
predominates. Now if one term is much greater than the other, it may
be neglected - **sometimes**. It may be that occasionally there
is no convenient place to 'cut' the loop and inject the signals, but
almost always, if one uses some ingenuity, a suitable place may be
found where Gi or Gv is very much larger than the other, and thus
a single model is required. Where one term is 100 times (40 dbv or
dbi) greater than the other only a 1% error is incurred. Clearly both
Gi and Gv can vary dependent on where they are measured in a loop,
however, the trick is to break the loop where one or the other is
very large, so that the other gain will predominate.

There is one problem, however, in using just a voltage (or current) measurement. And, that is the phase. The differing magnitudes may differ widely, however the Toc and Tsc gains will in general be complex quantities. To see this, all one has to do is to substitute in the previous equation the phasor relationships for Toc and Tsc in the previous equation. That is, to let the following conditions be true:

Toc = Gv*(cos(?) + j sin(?))

and

Tsc = Gi*(cos(f) + j sin(f))

Substituting these equivalents into the Loop Gain expression one can see that the gain and phase of one signal must both be large compared to the other signal. One cannot guarantee this, much measure the gain and phase margins unless one knows how Toc and Tsc behave over frequency. Moreover, in most versions of SPICE, including B2SPICE, one cannot nest analysis runs, and to add to the complications, one cannot perform a Monte Carlo analysis or vary part parameters of both models simultaneously and conveniently if the models are complex. The BEST one can do at this time is to export the gain and phase outputs to a spreadsheet from each run and process the results there.

Now the use of the inductors and capacitors are not really required. One may directly inject the signals, as shown in Reference 2.

Reference 2 is very interesting, and deserves some more looking into. To do this we must first create two models, one for the voltage gain measurement and the second for the current gain measurement. The first model, similar to the voltage macro in Reference 2, is shown in Figure 2 following:

Figure 2

Voltage Gain macro

The circuit uses three voltage generators. V3 and V2 have no function other than to isolate the measurement terminals from the device output terminals. They are zero volt sources. Inasmuch as the device output terminal designations may change when connected within a circuit, these allow the Vfm and Vim levels to be used within the B1 generator to compute the Gv value. Note that the input is to the right as shown, and the output to the left. It may be required to flip and rotate this device to place it properly within the circuit under test. B1 device implements the equation:

v = -Vfm/Vim

The circuit of Figure 2 adds a function to compute the voltage gain directly. Note that this is a ratio of two numbers that is computed and it must be graphed as a db voltage gain and phase to have meaning.

Figure 3 is a similar current gain network to that of reference 2, shown in the following Figure 3.

Figure 3

Current Gain macro

In Figure 3 we have a similar situation as that with Figure 2, wherein the gain is computed within the block. The gain in this case is computed by the B1 generator as:

Gi = I(v3)/I(v2)

Now one might wonder how this occurs properly. The reason is that the voltages (currents) will always be unity across the measuring device (will divide into two components) whose RATIO will determine the respective gain. Somewhere, either in a custom output plot, or in a separate 'B' device, these terms must be combined to form the loop gain expression as the negative reciprocal of the sum of the reciprocals of the two gains.

**Summary:**

I have had the occasion to review many circuit/system analyses, and I cannot count the number I have rejected just because the loop gain was not properly computed. In many cases the proper analysis has shown that the circuits/systems were stable, however this was not always the case.

And a few times field failures have been traced to marginally unstable systems that were deemed stable by a faulty analysis.

**References:**

1. http://www.spectrum-soft.com/news/winter2001/loopgain.shtm