¿ªÔÆÌåÓý

Date

Re: Determine phase and gain margin in filter/amp

monettsys
 

--- In LTspice@..., <frank_wiedmann@...> wrote:

I have uploaded to the Temp folder an example circuit from where I have included the .meas commands for the phase and gain margins. For further explanations, please see Measure_Margins.asc. I have also reduced the step size of the .ac simulation in order to get more precise results.

The second condition in the Omicron article means that the voltage loop gain is only a good approximation for the loop gain as long as the loop gain is much larger than the ratio |Zout/Zin|. Because the first condition means that this ratio has to be much smaller than 1, this second condition is automatically satisfied at |T|=1 (or 0 dB), where you measure the phase margin.

Best regards,

Frank
Frank, that is absolutely spectacular! Thanks very much. Also thanks for the explanation of the second condition in the Omicron paper. It means we have no problems to use the Voltage Injection method for most practical circuits in LTspice. This is very good news.

Thanks very much for the .measure commands. I would probably have had great trouble converting the Tian commands since they are so long. It is much easier to understand how the commands work when they are much shorter:

.meas ac phase_margin find V(fb)/V(inm) when mag(V(fb)/V(inm))=1
.meas ac gain_margin find V(inm)/V(fb) when ph(V(inm)/V(fb))=0

In the second command for gain margin, why did you invert the ratio to V(inm)/V(fb)? Was that to give a positive result to the answer? Why is that needed?

For others who may be interested, I should mention you have an excellent set of articles on your home page at



There is also a very good thread discussing open loop gain starting with your post in 2004:



Thanks again,

Mike


Re: FFT Resolution

 

¿ªÔÆÌåÓý

Hi Steve and Andy

Youll only be able to see the side bands if
the sample is long enough to encompass an integral number of modulation periods.
(and an integral number of carrier periods.
The two should be integrally related to minimize artifacts.)

The more info that gets sampled, the better the resolution.
Hence is why the default FFT size is 262k, but of course
you can set that to any thing needed.

Al D.


On 12/10/2013 06:11 PM, Andy wrote:
When some sort of modulation is going on, energy gets transferred from the signal at the peak, into the sidebands around it. ?So as the amount of modulation gets worse, I think I would expect to see the peak shown by the FFT to decrease, while the width increases.


-- 

AC2CL 

I do not think there is any thrill that 
can go through the human heart like that felt by the inventor as 
he sees some creation of the brain unfolding to success... 
Such emotions make a man forget food, sleep, friends, love, everything. 

- Nikola Tesla 

 


Re: Questions about phase in .AC LTspice Analysis

 

Hnguyen wrote: "
Q1: Why |Vop| and |Vom| are nearly equal??why not equal?"

A1: ?Ideally they are equal. ?Real circuits are not ideal. ?If there is any common-mode component present in the output signal, the two output pins would not be precisely complementary and then their amplitudes might not be equal.

"
Q2: How do you know that V(vop,vom) would be larger than either one."

A2: ?When exactly complementary, if you look at their AC components (and ignore the DC offset), V(vom) = -V(vop).

V(vop,vom) = V(vop)-V(vom) = V(vop)-(-V(vop)) = 2*V(vop).

So, in an AC simulation, the amplitudes of vop and vom should be equal, and the amplitude of V(vop,vom) should be 6 dB higher.

Andy



Re: FFT Resolution

 

The widths of the peaks depend highly on the number of samples per cycle. It also depends a lot on the windowing function that is used.My hunch is that, for an FFT, it is often an indicator of non-infinite sampling duration. If you sample with the same number of samples per cycle, the peaks are narrower as you include more cycles. To me, that says that much of the observed peak width is not "real".?

Jim Wagner
Oregon Research Electronics

On Dec 10, 2013, at 3:11 PM, Andy wrote:

?

Steve K. wrote: "
...?
what's the narrowest possible harmonic bandwidth that ought to be expected? In other words, when is the simulation as optimized as it can be?"

Good question. ?I don't know.

Steve continued, "
On a more general note, assuming artifacts of a non-ideal simulation have been minimized, does the harmonic bandwidth provide useful information, or do only the peak values matter?"

I think the widths could matter, depending. ?If anything non-ideal is going on that modulates the signal in some way, whether by varying its amplitude or its phase or frequency, that should translate into sidebands around each of the frequency components of the square wave signal. ?So if you are looking for that sort of thing, and assuming that the FFT is good enough to resolve those sidebands (and not just an artifact of doing the FFT), then it could be useful information. ?But to someone else, it might not matter.

When some sort of modulation is going on, energy gets transferred from the signal at the peak, into the sidebands around it. ?So as the amount of modulation gets worse, I think I would expect to see the peak shown by the FFT to decrease, while the width increases.

Andy





Re: Determine phase and gain margin in filter/amp

 

---In ltspice@..., <405a82e5@...> wrote:

Thanks, Frank.

The omicron article gives good information, including derivations. Thanks for posting the link.

The first condition is pretty easy - inject the signal at the input to the op amp as shown in Lokere's demo.

I don't understand the second condition. I think it applies when you are injecting a signal across a small resistor via a transformer, where the impedances are part of the result. I don't think it was ever mentioned for applications in SPICE.

Would you care to help translate your .measure commands to the Voltage Injection method? You are familiar with the method and could avoid a lot of errors that others may encounter.

Thanks,

Mike

?

?

I have uploaded to the Temp folder an example circuit from ?where I have included the .meas commands for the phase and gain margins. For further explanations, please see Measure_Margins.asc. I have also?reduced the step size of the .ac simulation in order to get more precise results.

?

The second condition in the Omicron article means that the voltage loop gain is only a good approximation for the loop gain as long as the loop gain is much larger than the ratio |Zout/Zin|. Because the first condition means that this ratio has to be much smaller than 1, this second condition is automatically satisfied at |T|=1 (or 0 dB), where you measure the phase margin.

?

Best regards,

?

Frank???????????????????????????


Re: FFT Resolution

 

Steve K. wrote: "
...?
what's the narrowest possible harmonic bandwidth that ought to be expected? In other words, when is the simulation as optimized as it can be?"

Good question. ?I don't know.

Steve continued, "
On a more general note, assuming artifacts of a non-ideal simulation have been minimized, does the harmonic bandwidth provide useful information, or do only the peak values matter?"

I think the widths could matter, depending. ?If anything non-ideal is going on that modulates the signal in some way, whether by varying its amplitude or its phase or frequency, that should translate into sidebands around each of the frequency components of the square wave signal. ?So if you are looking for that sort of thing, and assuming that the FFT is good enough to resolve those sidebands (and not just an artifact of doing the FFT), then it could be useful information. ?But to someone else, it might not matter.

When some sort of modulation is going on, energy gets transferred from the signal at the peak, into the sidebands around it. ?So as the amount of modulation gets worse, I think I would expect to see the peak shown by the FFT to decrease, while the width increases.

Andy



Re: Questions about phase in .AC LTspice Analysis

hoa van nguyen
 

Hello Andy
Andy: If they were complementary, then |Vop| and |Vom| would be nearly equal, their phases would be opposite (180 degrees apart), and V(vop,vom) would be larger than either one, rather than smaller. ?None of these things are happening in your .AC simulation.

Q1: Why |Vop| and |Vom| are nearly equal? why not equal?
Q2: How do you know that V(vop,vom) would be larger than either one.

Could you share your thoughts with me?

Regards

Hnguyen


On Saturday, December 7, 2013 4:01 PM, Jerry Lee Marcel wrote:
?

Le 06/12/2013 16:28, Andy a ¨¦crit?:
?
Jerry Lee Marcel wrote:

For some reason, LTSpice doesn't want to show currents

That's because of this statement on the schematic:

? .Save V(*)
Thanks for this explanation. I just wonder why the OP included this statement.




Re: FFT Resolution

John Woodgate
 

In message <l87u7c+ebvu@...>, dated Tue, 10 Dec 2013, "skleiser@..." <skleiser@...> writes:

Given (in this case) a square wave of fixed frequency, fast but non-zero rising & falling edges, 50% duty cycle, and an exact integer number of cycles (etc.), what's the narrowest possible harmonic bandwidth that ought to be expected? In other words, when is the simulation as optimized as it can be?
harmonic bandwidth doesn't depend on those things. Embedded in the Help on the B source is:

"In LTspice, the impulse response is found from the FFT of a discrete set points in frequency domain response. This process is prone to the usual artifacts of FFT's such as spectral leakage and picket fencing that is common to discrete FFT's. LTspice uses a proprietary algorithm that exploits that it has an exact analytical expression for the frequency domain response and chooses points and windows to cause such artifacts to diffract precisely to zero. However, LTspice must guess an appropriate frequency range and resolution. It is recommended that the LTspice first be allowed to make a guess at this. The length of the window and number of FFT data points used will be reported in the .log file. You can then adjust the algorithm's choices by explicitly setting nfft and window length. The reciprocal of the value of the window is the frequency resolution. The value of nfft times this resolution is the highest frequency considered."


The significant words are:

"The reciprocal of the value of the window is the frequency resolution."

Frequency resolution is the same as the observed 'harmonic bandwidth'.


On a more general note, assuming artifacts of a non-ideal simulation have been minimized, does the harmonic bandwidth provide useful information, or do only the peak values matter?
The harmonic energy is averaged over the bandwidth, so widening the bandwidth tends to reduce the observed amplitude.
--
OOO - Own Opinions Only. With best wishes. See www.jmwa.demon.co.uk
Nondum ex silvis sumus
John Woodgate, J M Woodgate and Associates, Rayleigh, Essex UK


Re: FFT Resolution

 

Given (in this case) a square wave of fixed frequency, fast but non-zero rising & falling edges, 50% duty cycle, and an exact integer number of cycles (etc.), what's the narrowest possible harmonic bandwidth that ought to be expected? In other words, when is the simulation as optimized as it can be?

On a more general note, assuming artifacts of a non-ideal simulation have been minimized, does the harmonic bandwidth provide useful information, or do only the peak values matter?

Just curious,
Steve K.

--- In LTspice@..., Andy <Andrew.Ingraham@...> wrote:

ronw6wo wrote:

To gain some FFT experience I checked the bandwidth of individual
harmonics of a 14MHz square wave They show as having a bandwidth of 1.5
MHz which is ridiculous I have tried many simulation settings but they all
produce the same results What Pulse and tran settings should I be using ?
I don't use FFTs regularly, but some things you should be doing include:

Disable waveform compression (.option plotwinsize=0).

The simulation must run for an exact integer multiple of cycles, and turn
off Windowing in the FFT. Either of those can make the components wider.

More data points at finer time increments is usually better. Specify a
Maximum Timestep in the .TRAN command.

Many circuits start with a burp, which you might not always notice.
Remember, a transient simulation begins with the variable sources turned
off, and then suddenly they are turned on. That can cause a bias shift if
signals are AC-coupled anywhere ... which translates into a widening of the
FFT components. To avoid that when it happens, don't start saving data
until after the bias has settled or the transient has died out ("Time to
Start Saving Data" in the .TRAN command). Remember to adjust the stop time
accordingly so you still have an integral number of cycles saved.

Also, don't forget, you can't make perfect "square" waves. The Pulse
waveform rise and fall times should not be zero.

Andy


Re: Determine phase and gain margin in filter/amp

monettsys
 

--- In LTspice@..., <frank_wiedmann@...> wrote:
That's actually what I was trying to suggest. With the help of my comment in Measure_Margins.asc

The expression used in the .meas statement for phase_margin is the negative value of the expression for the loop gain, the expression used in the .meas statement for gain_margin is the negative reciprocal value of the expression for the loop gain.
it should be pretty easy to adapt the .measure statements.
The method presented by Kris Lokere simulates what I like to call "voltage loop gain". It is a good approximation for the loop gain if the conditions given in are satisfied.

Best regards,

Frank
Thanks, Frank.

The omicron article gives good information, including derivations. Thanks for posting the link.

The first condition is pretty easy - inject the signal at the input to the op amp as shown in Lokere's demo.

I don't understand the second condition. I think it applies when you are injecting a signal across a small resistor via a transformer, where the impedances are part of the result. I don't think it was ever mentioned for applications in SPICE.

Would you care to help translate your .measure commands to the Voltage Injection method? You are familiar with the method and could avoid a lot of errors that others may encounter.

Thanks,

Mike


Re: Determine phase and gain margin in filter/amp

 

Mike,

?

If you only want to put one cursor on the trace up can click right or left click on the label.? It works fine for me, if I set the cursor near the 0 dB point before?I expand the trace.? It takes only a few seconds to do it.? For example it is easy to get -934.5 udB and 107.19 degrees at 9.166 MHz

?

Rick?


Re: Keep getting Unknown Subcircuit err LM13700

 

Thanks all, it's working!


numbered the pins 1 to 9.


Re: Determine phase and gain margin in filter/amp

monettsys
 

--- In LTspice@..., <sawreyrw@...> wrote:

Mike,

You can attach a cursor to the plot and drag it where ever you want.. Right click on the trace label. The display is in the lower right and it is easy to see the numbers change as you move the cursor. I just checked and got the same results as before.

Rick
Thanks, Rick. Do you mean Left Click? I tried it and still got inconsistent results, especially when you zoom in on the waveform. It takes quite a bit of fiddling to get the cursor as close to 0 dB as possible, and the results depend on the zoom level.

I'm looking for a method that will give everyone the same results every time. The .measure command looks most promising. It will also be faster, and I can copy the data directly from the error log and paste it in a report.

Thanks,

Mike


Re: Keep getting Unknown Subcircuit err LM13700

 

Hello,

You will find examples in our Files section.

http://groups.yahoo.com/neo/groups/LTspice/files/%20Lib/OTA%20CA3080%20and%20LM13700/

Just copy LM13700.asy and LM13700.mod in the folder of your schematics.
Additionally include the model file in your schematic.

.include LM13700.mod
or
.lib LM13700.mod

Best regards,
Helmut


Re: Keep getting Unknown Subcircuit err LM13700

 

Hello,


You have to number the "Netlist Order" in the symbol pins in the order 1 to n, e. g.

1,2,3,4,5,6,7,8,9 regardless of the pin names/numbers in the ".subckt ...".


Best regards,

Helmut


Re: Keep getting Unknown Subcircuit err LM13700

 

Ok, replaced the .MOD file to my own working dir.


And included the following:

.INCLUDE C:\Users\...\LTSPICE lib\LM13700.MOD


Now LTSpice is telling me there's a port mismatch between "lm13700" and "xu1".


The asy has 9 ports (1 to 8 + 11), the .MOD file also describes 9 ports:

.SUBCKT LM13700 1 2 3 4 5 6 7 8 11


Am I missing something?



Re: Keep getting Unknown Subcircuit err LM13700

 

Opened and saved it with notepad++, also tried deleting all the commented stuff/weburls. Still got the error.


[IMG]http://i.imgur.com/6U4T1PU.png[/IMG]


Re: Keep getting Unknown Subcircuit err LM13700

John Woodgate
 

In message <6939C6D9E5727A428B0A00DBB4359A3226AB9E8E@...>,
dated Tue, 10 Dec 2013, Ray Merewether <ray.merewether@...>
writes:

Don¡¯t use notepad.? It screws up the LTspice preferred end of line
character.? Search the message archives for ¡°Notepad¡±
Indeed, but that might not produce a 'Cannot find...' error. Equally,
the chunk of HTML in the netlist at V7 won't be any help at all and must
be deleted, but that also might not cause a 'Cannot find...' error.
--
OOO - Own Opinions Only. With best wishes. See www.jmwa.demon.co.uk
Nondum ex silvis sumus
John Woodgate, J M Woodgate and Associates, Rayleigh, Essex UK


Re: Keep getting Unknown Subcircuit err LM13700

 

mummiewikkel?wrote:

Did the following:

1. Made LM13700.MOD file in notepad (path: \lib\sub\LM13700.MOD), including this:

Don't put your models anywhere in LTspice's libraries. ?Put it in your own working directory, which should not be in your computer's "\Program Files" (or similar) directory tree.

Did you .INCLUDE the file containing the subcircuit?

Andy



Re: XVAR specification

 

M.Rakesh Sharma?wrote:

I am designing a circuit in LTSPICE. I need a variable resistor to use it in my circuit. I try to use the variable resistor(XVAR) from LTSPICE library.

Are you trying to use a varistor (a resistor with a nonlinear resistance, its resistance depends on the voltage), or do you just need a potentiometer or rheostat? ?You might have mixed them up.

The "xvaristor" symbol in the library is for a varistor which is a nonlinear resistor. ?It requires a subcircuit (that you would provide), to describe its R(V) characteristics.

I think LTspice's built-in library has no component for a potentiometer, but there are several in this YahooGroup's "Files" section. ?Go to the "Table of Contents" area and download the file "all_files.htm". ?Then open it in your web browser, and search for "potentiometer". ?There are several to choose from.

Alternatively, you could just use an ordinary resistor symbol, and annotate it to show that it is a variable resistor or potentiometer. ?Its resistance value would be fixed during any one simulation, right?

Regards,
Andy