# Question on the loop gain/phase

Status
Not open for further replies.

#### yschuang

##### Full Member level 3
Hello, all

I would like to know how to derive the phase of the loop gain, which is (TvTi-1)/(2+Ti+Tv).
It is straightforward to represent T as the following by using HSPICE
T= par('(v(Tv)*i(Ti)-1)/(2+v(Tv)+i(Ti))').

So far, all I can get is the loop gain but I can not get the phase.
Thanks

I´m not using HSpice, therefore I cannot confirm if the notation
T= par('(v(Tv)*i(Ti)-1)/(2+v(Tv)+i(Ti))') is correct or not.

However, in general: If Tv is the ac voltage loop gain and Ti is the ac current loop gain (both correctly simulated), then the expression
(TvTi-1)/(2+Ti+Tv)
gives you automatically the magnitude as well as the phase of the overall loop gain,

Hello, LvW

Precisely and good interpretation on the loop gain.
Tv : ac voltage gain
Ti : ac current gain
T = (TvTi-1)/(2+Ti+Tv)

The way you you mentioned about (TvTi-1)/(2+Ti+Tv) is pretty much like
I thought to get loop gain and its phase.
The notation about T using HSPICE is correct because I checked it and compared the plot with one in the slide. However, I was wondering why I can not get the phase.
I can get gain and phase of Tv, but can not get phase of Ti when probing Ti and Tv.
Or I can not get any information about the phase when probing i(X) during the calculation of current gain. That is weird.

yschuang said:
.................
I can get gain and phase of Tv, but can not get phase of Ti when probing Ti and Tv.

What means "..can not get phase..." ?
What exact is the answer of the program after asking for the phase plot?

Hello, Lvw

Thanks for quick response. That I can not get the phase means there is no information on the waveform viewer.
The following is the spice deck. The return ratio is measured by breaking @ both input and output, which are RRI and RRO respectively.

*** SPICE Deck ***

*Break loop open at output, voltage drive
XOV OV1 OV2 OV1 OV4 TIA
LOV OV2 OV4 1
COV OV4 OV3 1
VOV OV3 GND AC=1
*Break loop open at output, current drive
XOI OI1 OI2 OI1 OI4 TIA
LOI OI2 OI4 1
COI OI2 GND 1
IOI GND OI4 AC=1

*Break loop open at input, voltage drive
XIV IV1 IV2 IV3 IV2 TIA
LIV IV1 IV3 1
CIV IV1 IV4 1
VIV IV4 GND AC=1
*Break loop open at input, current drive
XII II1 II2 II3 II2 TIA
LII II1 II3 1
CII II3 GND 1
III GND II1 AC=1

.op
.ac dec 10 1e5 1e12
*Derive RR from the gen. RR's @ output terminal
.probe RRO=par('(v(OV2)*i(COI))/(v(OV2)+i(COI))')
*Derive RR from the gen. RR's @ input terminal
.probe RRI=par('(v(IV3)*i(CII))/(v(IV3)+i(CII))')

.option brief captab post
.temp 25

.end

Hi yschuang,

it makes no sense for me to go through your file as I do not use HSPICE.
However, from my experience with PSpice I know that TWO DIFFERENT ac runs are necessary (one with ac voltage, and one with ac current) which have to be combined according to the formula given for T. Do you run the system twice?

Sorry about that, Lvw. It's true two ac runs, Tv and Ti, are needed to calculate T. One trick can be played. In Hspice, I create two ckts with same feedback loop in one simulation. One is used to get Tv and other one named replica ckt is used to get Ti.

yschuang said:
Sorry about that, Lvw. It's true two ac runs, Tv and Ti, are needed to calculate T. One trick can be played. In Hspice, I create two ckts with same feedback loop in one simulation. One is used to get Tv and other one named replica ckt is used to get Ti.

Yes, another option is to use only one circuit and multiply the values of both sources with a factor like this: z*V and (1-z)*I.
Then, you run two parametric analyses with z=0 (I is activated) and z=1 (V active) and you have to combine the results of both runs.

I have a question regarding your netlist. You are using Middlebrook's method of simulating the loop gain, judging by the formula. Then why do you break the loop using L and C? Middlebrook's method allows for breaking the loop and keeping the loading both at low and high frequencies. Using L and C you in fact destroy the loading at high frequencies. You can break the loop in voltage by simply inserting between the break points an ac voltage source with dc=0 and ac=1 and then measure the ratio between the voltages at the two pins of the voltage source. Then for the current injection you simply inject an ac current source into a point of the loop. Since this current source has dc=0 it is not going to disturb the biasing too, but will preserve the loading. The current loop gain is the ratio of the currents going left and right from the injection point.

Yes, sutapanaki is completely right !

Hello, sutapanaki .

I am not using Middlebrook's way to do the simulation and get the loop gain but kind of using LC method from "Determination of stability using return ratios in balanced fullydifferential feedback circuits" and get the return ratio. Please see fig.3 for the LC method and equation 2 for the return ratio in the paper and the following is the link.
https://www.ece.ucdavis.edu/~hurst/papers/FullyDiffRR,CAS.pdf.

Actually I did the simulation of loop gain by using Middlebrook's method and that is tedious because I have to do the postprocessing in Matlab if I have to use Middlebrook's formula.

I was talking about fig.4 in this paper and formula (3). BTW, the formula that you had in your first post is exactly that one. This formula synthesizes the Middlebrook method as described here:

see expr. (21b).

Whether you use expr.(2) or expr.(3) from your paper, you need the same kind of processing. You can use two copies of the same circuit in the same simulation and do everything in spice or you can do 2 simulations and do it in Matlab or some other program.
However, it is still a fact that if you use fig.4 you preserver both the dc bias and the impedance levels. If you use fig.3, the high-frequency impedances are not there. Your choice at the end.

Hello, sutapanaki.

It's true that the formula in the 1st post is derived from Middlebrook's method.
You are right again about how to break the loop magically and perserve dc bias when simulating the loop gain. Actually, I am using a method like the link "http://sites.google.com/site/frankwiedmann/loopgain". I have to do postprocessing in Matlab if I apply above method in Hspice. Now back to my original question. I am still wondering why I can not get the phase but magnitude only. I can get magnitude, phase, real part, and imaginary part of any node when trying to get Tv. However, I can not get the information about phase when calculating Ti.

yschuang said:
.............. I have to do postprocessing in Matlab if I apply above method in Hspice
..................

Are you sure ? In PSpice I am able to combine during post processing (in PROBE) two different runs. Even if I use parameter stepping (as I have indicated before) I can combine two ac runs by using the symbol "@" which selects on of both simulation runs. I suppose something similar should be possible also in HSpice.

Hello, Lvw.
I go with you but the consequence seems to be dissapointed.
I can do 2 ac runs in one simulation and get information about magnitude and phase on nodes I want. However, I will lose information about phase if I try to multiply two nodes and all I get is the magnitude.

By the way, Tv is defined as -Vr/Vt and that seems to be wrong if I want to express that in Hspice. I am still finding out above problems.

yschuang said:
Hello, Lvw.
I go with you but the consequence seems to be dissapointed.
I can do 2 ac runs in one simulation and get information about magnitude and phase on nodes I want. However, I will lose information about phase if I try to multiply two nodes and all I get is the magnitude.
..............
.

".......information on......nodes"?
You get magnitude and phase information on loop gain (voltage resp. current) !

And why you are going to "multiply two nodes"?

Voltage loop gain is defined as a voltage ratio and current loop gain as a current ratio. At the end both are combined in a formula. That´s all - and, of course, if you mathematically combine complex functions, the result again is complex, that means it has a magnitude as well as a phase.
What really is the problem ?

Hello, LvW
Assume Tv = -Vr/Vt, Ti = Ir/It. Vt and It are input ac voltage and current singals. Vr and Ir are returned ac voltage and current signals. For now, skip the formula the loop gain. Like you said, the voltage/current loop gain is the ratio of returned signals. In a waveform viewer, the magnitude of phase of Vr, Vt, Ir, and It can be viewed. However, I can not get the phase of Vr/Vt or Ir/It. All I get is the magnitude of Vr/Vt and Ir/It. That looks weird for me.
About "multiply two nodes", that is a wrong expression.

Hi yschuang,

I don´t know what the error may be.
For your information I send you a pdf attachement with my loop gain simulation circuit and with all definitions and formulas. It has worked very well.
Perhaps you can detect some errors in your work.
Please give notice if you have solved the problem.
Good luck and regards

May it be the case, that you simply don't know the SPICE output command syntax? VP() is the operator for phase expressions, see HSPICE manuals or any SPICE text book.

Hellow, Lvw

Thanks for your kindly file and I will try to do that way and find out what's going wrong.

FvM, I know that syntax to show the phase.

Status
Not open for further replies.