Author Topic: LTspice - .meas ac - extracting phase  (Read 22740 times)

0 Members and 1 Guest are viewing this topic.

Offline treeTopic starter

  • Regular Contributor
  • *
  • Posts: 235
  • Country: us
LTspice - .meas ac - extracting phase
« on: June 03, 2014, 07:39:48 pm »
Hello folks,

I'm trying to perform some stability analysis in LTspice of an op amp.

I am trying to meas the exact phase margin using a .meas statement
.meas ac res4 FIND ph(V(out)/V(in,out)) when mag(V(out)/V(in,out))=1

This tells LTspice to create a variable called 'res4' whose result is the phase of the open loop gain when the magnitude of the open loop gain is 0dB.

The result is the following:
res4: ph(v(out)/v(in,out))=(44.9831dB,180°) at 22938.9

This says that at 22.9389kHz the phase has an angle of -177.48 deg but it doesn't display the angle, instead it is shown as as magnitude and phase which is a ridiculous way to express an angle.
44.9831dB = 177.48 and the 180 phase shift gives it a negative sign.

Is there any way to properly display the angle?

Thanks.
« Last Edit: June 03, 2014, 07:46:05 pm by tree »
 

Offline LvW

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: de
Re: LTspice - .meas ac - extracting phase
« Reply #1 on: June 03, 2014, 07:55:28 pm »
I cannot imagine that LTSpice gives the phase in log units.
Anyway - why don´t you use the clear and logical way to display both magnitude and phase of the loop gain?
This gives you a clear picture about the loop gain response - and you can see if everything is OK. Remember: You should not blindly trust such simulation results and it is always good to know approximately what you can expect. This holds, in particular, for loop gain simulations which often are a bit tricky becaus opening the loop must not (a) disturb the dc opearatig point  and (b) must not change the loading conditions at the opening.
 

Offline treeTopic starter

  • Regular Contributor
  • *
  • Posts: 235
  • Country: us
Re: LTspice - .meas ac - extracting phase
« Reply #2 on: June 03, 2014, 07:56:58 pm »
What is the clear and logical way?

EDIT: got it! I got rid of the mag() function and it displays the magnitude and phase.

AND I didn't disturb the DC operating point. The feedback loop is still there.

For those who want to follow along I've attached a picture of the schematic
« Last Edit: June 03, 2014, 08:07:51 pm by tree »
 

Offline f5r5e5d

  • Frequent Contributor
  • **
  • Posts: 349
Re: LTspice - .meas ac - extracting phase
« Reply #3 on: June 04, 2014, 03:11:58 am »
stability tests in sim or the real world can be complicated - and some differing conventions for phase too - you may have open loop phase shift, or return ratio, may want phase margin...


the example/Educational folder in your LTspice install has several loopgain probe examples and the FRA file

the Yahoo LTspice group is a good place to look up discussions - if Yahoo hadn't ruined all groups with the stupid infinite scroll UI

do search the group - it isn't a spice beginners tutoring group or chat room

the basics are - get the circuit working in .TRAN 1st - see if its stable for tmax step size << 1/GBW of the fastest part in the loop

then you don't have to worry about the .AC tool's conventions for phase - you already know its stable and can work from that assumption

you need to understand the tool - the software can't give a priori formal answers in your particular textbook's or personal preference convention system
« Last Edit: June 04, 2014, 03:16:15 am by f5r5e5d »
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4851
  • Country: us
Re: LTspice - .meas ac - extracting phase
« Reply #4 on: June 04, 2014, 04:21:42 am »
You can also add the text statement ".opt meascplxfmt=cartesian" which will cause measurements to be returned in linear (a+bi) units, or '.opt meascplxfmt=polar' to get linear magnitude and phase.  It affects all measurements, so only use it if that is what you want.
 

Offline LvW

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: de
Re: LTspice - .meas ac - extracting phase
« Reply #5 on: June 04, 2014, 08:32:20 am »
What is the clear and logical way?
The most logical way to measure or to simulate a certain property of a device is to follow the DEFINITION.
And the stability margin is defined based on the LOOP GAIN of a circuit with feedback.
Hence, as I have mentioned before, you should simulate the LOOP GAIN.
Do you know what "loop gain" means and how it is defined - in contrast to closed-loop gain and open-loop gain? (The wording is a bit misleading, I know).

EDIT: got it! I got rid of the mag() function and it displays the magnitude and phase.
AND I didn't disturb the DC operating point. The feedback loop is still there.

I am afraid, you didn´t get it. I cannot see how you are simulating the loop gain.
Question: What is the original circuit to be analyzed and how do you open the loop (you must open the loop for ac signals!)-
 

Offline treeTopic starter

  • Regular Contributor
  • *
  • Posts: 235
  • Country: us
Re: LTspice - .meas ac - extracting phase
« Reply #6 on: June 04, 2014, 01:41:05 pm »
If I remember correctly, A = open loop gain, Beta = feedback, A* beta = loop gain.

What I'm doing is exactly what open loop gain is. The output divided by the difference between the input terminals.

EDIT: There's an LTspice video from Linear's website that deals with op amp stability by analyzing OPEN loop gain, not loop gain.
I followed this tutorial: http://www.simonbramble.co.uk/techarticles/advanced_op_amps/advanced_op_amps.htm
« Last Edit: June 04, 2014, 01:57:12 pm by tree »
 

Offline LvW

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: de
Re: LTspice - .meas ac - extracting phase
« Reply #7 on: June 04, 2014, 07:05:08 pm »
If I remember correctly, A = open loop gain, Beta = feedback, A* beta = loop gain.
What I'm doing is exactly what open loop gain is. The output divided by the difference between the input terminals.

Yes - everything correct.
However, in your first post you spoke about stability analysis, didn´t you?
And for this purpose, you need the loop gain - not the gain of the opamp without feedback (open-loop gain).
The most simple method is to place an ac source (Vac=1V)  BETWEEN opamp output and input of the feedback network.
Then, the loop gain is the ratio between the two nodes of the ac source.
For higher frequencies - beyond the region which determines stability - this method has some errors, however, it is sufficiently exact.
 

Offline atferrari

  • Frequent Contributor
  • **
  • Posts: 314
  • Country: ar
Re: LTspice - .meas ac - extracting phase
« Reply #8 on: June 06, 2014, 12:48:40 pm »
I'm trying to perform some stability analysis in LTspice of an op amp. 

Hi

My first post in this forum.

Maybe this could help you: http://www.linear.com/solutions/4449
« Last Edit: June 06, 2014, 12:51:33 pm by atferrari »
Agustín Tomás
In theory, there is no difference between theory and practice. In practice, however, there is.
 

Offline treeTopic starter

  • Regular Contributor
  • *
  • Posts: 235
  • Country: us
Re: LTspice - .meas ac - extracting phase
« Reply #9 on: June 06, 2014, 01:55:05 pm »
I'm trying to perform some stability analysis in LTspice of an op amp. 

Hi

My first post in this forum.

Maybe this could help you: http://www.linear.com/solutions/4449

Hi, welcome.

I watched that video at least 10 times and I think that applies only to an inverting configuration.
 

Offline LvW

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: de
Re: LTspice - .meas ac - extracting phase
« Reply #10 on: June 06, 2014, 02:57:36 pm »
I watched that video at least 10 times and I think that applies only to an inverting configuration.

Tree - as you have to analyze the loop gain it does not matter if the closed-loop circuit is operated in inverting or non-inverting configuration.
In both cases the loop gain definition/simulation is identical.
In my former contribution I have recommended to place the ac source at the output of the opamp.
In the video it is placed at the input. The result will be the same. The only thing which matters is the following:
The breaking must not drastically change the loading conditions under normal closed-loop operation . This can be sufficiently fulfilled at the output (small output resistance) as well as at the input (large input resistance)
« Last Edit: June 06, 2014, 03:01:38 pm by LvW »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->