Distortion simulation with LTspice

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
diyAudio Retiree
Joined 2002
Decaf........ definitely!

"How do you know he is on the right track and knows what he is
doing?? He doesn't really say much about how he does it now."

He says he knows what a Bode plot is, which would lead me to think he knows enough to look at the gain and phase. I measure phase margin with closed loop, since that is amp is actually operating. It is kind of hard to investigate the effects compensation caps in the feedback loop when running open loop. I do see how hysterics about shortcomings of Spice are helping this to learn to use the tool. Judging by his post, I think it is very likely that he can ask concise enough questions to learn to do what he wants with Spice. If you aim is to rant and rave at me, don't insult someone is making a sincere effort with pretty clear questions. Some of the Spice models pretty bad, not all of them. I try to point out questionable models when posted and there are several posters that know much more than I do. Why not help this guy instead of scaring him away with hysterics? :bawling:

Fred
 
If I remember correctly: Use Pspice, Spice, LTSpice, etc. to perform the FFT. Use the cursor to find the peak magnitudes of the 2nd, 3rd, 4th, etc. Take the square root of the sum of the squares, then divide that by the magnitude of the fundamental and multiply by 100 to get THD in percent, I think.

Pspice, Spice, LTSpice simulations are as good as the circuit modeling as long as you have the options set up correctly and don't have convergence problems. Usually a poor circuit model causes inaccuracies. In addition, your PCB is really part of the circuit. Compaq used at one time a Spice called CSpice in which you added the physical information about the PCB to your lumped circuit components. This way the PCB was part of your model. This is important for high frequenies and fast rise times, especially. In some cases, I add the parasitics to resistors, capacitors, inductors, transformers, etc. A very well done PCB layout goes a long ways to prevent problems on the bench. However, we all sometimes get an unwelcomed surprise when our actual circuit has a problem.

In the 80's a group of us had the task of performing worst case analysis for electronics on the Space Shuttle Columbia. A few used DOS Pspice and the rest of us used MathCad or a spreadsheet software such as Lotus 123. We had to write the algorithms for MathCad and Lotus, but the results were the same as Ppsice. We did Bode Plots with all three to check the results. Next the design went to the layout folks, to layout the circuit for a hybrid IC. For space work, no nice commercial ICs could be used and only a limited number of Military IC's could be used. We put the IC chips along with chip resistors and chip capacitors into hybrids. Some hybrids had silkscreened thin film resistors that got laser trimmed to a select in test value. Sort of a pain compared to commercial.
 
diyAudio Retiree
Joined 2002
" Compaq used at one time a Spice called CSpice in which you added the physical information about the PCB to your lumped circuit components"

There is now a whole field for circuit modeling for PCB signal integrity design called IBIS modeling. It is sort of like simplified version Spice and designed to test many digital signals at the same time with less computing time than an equivalent Spice model would take. The company I was at last purchased a program from Mentor Graphics that was over a hundred thousand dollars. It ran on our HP workstations under a UNIX shell. There are also programs now for modeling if RF design such as those from Ansoft. The guy trying to teach me to use it was training scientist the CERN particle physics laboratory. It was way too difficult for me but we did have one guy modeling Gigahertz PCB to hybrid interfaces with it. The EMI radiation from a six inch PCB trace that was the model I was starting with require the program to solve over a 100 thousand element matrices with complex variables. There are efforts to model RF radiation from printed circuit boards going on but many feel it requires too complicated a model to ever be useful.

http://www.eigroup.org/ibis/ibis.htm

http://www.mentor.com/highspeed/resource/ibis_modeling.html

http://www.ansoft.com/
 
Yep, it's needed for picosecond rise and fall times. We have microwave frequencies in our PCs these days, which require RF design techniques. Microstriplines with controlled impedances are needed to minimize ringing. In the old days you could put a scope probe on the highest frequency signals. I guess these days, you need special extremely low capacitance logic probes.

Mentor has been in the ball game a long time. I remember using their stuff in 1986, but they have come a long ways since then. Technology changes so fast, I can't blink without getting further behind. Everything electronics I purchase is obsolete before I get it home, or before the UPS truck arrives.
 
All animals are equal but ...

Fred Dieckmann said:

He says he knows what a Bode plot is, which would lead me to think he knows enough to look at the gain and phase. I measure phase margin with closed loop, since that is amp is actually operating. It is kind of hard to investigate the effects compensation caps in the feedback loop when running open loop. I do see how hysterics about shortcomings of Spice are helping this to learn to use the tool. Judging by his post, I think it is very likely that he can ask concise enough questions to learn to do what he wants with Spice. If you aim is to rant and rave at me, don't insult someone is making a sincere effort with pretty clear questions. Some of the Spice models pretty bad, not all of them. I try to point out questionable models when posted and there are several posters that know much more than I do. Why not help this guy instead of scaring him away with hysterics? :bawling:

Fred

I just wanted to point out that you based you posting on a lot of
assumptions about this person. In this case you choose to do
a very benevolent interpretation and assume he does know
what he is doing. I find this interesting since you have so often
posted very negative responses to a number of other people using
Spice which has also been based only on what you think these
people think and on your assumptions that they interpret data
in the wrong way. Maybe some animals are more equal than
others???

I really hope I didn't scare off the person asking the question,
and tried to point out that it wasn't about him. Sorry if that was
not clear.
I did not try to help him, since I was expecting others to jump
in who know this much better than I do.
 
thanh said:
I have just download free Ltspice from www.linear.com.It is quite bad.Its library only has got about 10 transistor.I don't also put component on my project.


Did you download the Spice Models from the same website? I think you can add more spice models from other sources. I don't have much experience with LTSpice, but my friend prefers it over Pspice.

Don't give up on LTSpice yet. Spend some time with it and try to incorporate more models. Hopefully it will become useful to you.

Good Luck
 
thanh said:
I have just download free Ltspice from www.linear.com.It is quite bad.Its library only has got about 10 transistor.I don't also put component on my project.

thanh,

I've used PSpice also, which has thousands of models. The ones I've used have been very inaccurate though. See http://www.diyaudio.com/forums/showthread.php?postid=237903#post237903 for an example. If the vendor of the transistor has a SPICE model available, it's easy to add them to LTSpice. Just paste the text into the standard.bjt file. This only works for transistor models that use .MODEL, not .SUBCKT. Also look at http://power.teipat.gr/download/OrCad Libraries/Library for Capture/PSPICE/
 
thanh said:
I have just download free Ltspice from www.linear.com.It is quite bad.Its library only has got about 10 transistor.I don't also put component on my project.

The point of PSpice, isn't the abundance of models included (you must hunt for good ones anyway), but that it's the only free offering with a circuit editor entry and without device number limitation.

WinSPICE, PySPICE and ngSPICE are unlimited, but command line only, working on classical netlist decks.

The demo/student versions have a limitation on device count OTOH.

Regards,
Peter Jacobi
 
Ok, we can't believe the distortion numbers shown by LTspice.
To me, that sounds more like a statement than a question, with an old thread as a pretext.

Anyway, I more or less agree: if you try to compare real, measured figures with the simulated ones, you will almost certainly find discrepancies.
From my own experience, simulated and actual figures rarely coincide. What I mean by coincidence is a +/-10% margin.

I would say informally that the sim is optimistic in ~70% of the cases (simulated THD lower than reality) pessimistic in 20% of the cases, and about right (within 10%) in 10% of the cases.

When you do your homework, ie you take into account all of the main non-linear effects in the sim, the discrepancy never reaches a power of ten in either direction: ie, you simulate 0.01%, you may measure 0.03% but not 0.13% unless you made some gross error somewhere.
Does this make the sims useless? I don't think so: the "error" is comparable to what you obtain when comparing slightly different physical set-ups.
Something very telling is to adjust the quiescent current of an amplifier while monitoring the THD with a real time THD meter: you understand at once how relative are these measurements.
Sim is no different than any other measurement in slightly different conditions.

Why are the simmed values optimistic (that is one of my observations, but I am pretty sure other members could confirm the effect)?
I think there are two mains causes: many amplifiers have some symmetry, either vertical (complementary P-N) or horizontal (N-N or P-P).
By default, all transistors are identical in a sim and this can cancel perfectly some types of distortion.
Some manufacturers like ONsemi publish characteristics of complementary transistors that are simply mirrored, with the same result (MJE340/MJE350 for example).
That is much more misleading: identical types can be paired with an excellent accuracy, but for complementary types, that is a completely different story, even if the datasheeet or spice model says otherwise.

This means that in practice, an amplifier using a vertical symmetry (P-N) will show the same THD than its horizontal counterpart, in sim at least.

In practice, the one using N-N symetry (a diff pair for example) will be slightly worse, whereas the one using P-N symetry will be completely out of limits, because the practical complementarity will be much worse than even a chance symetry.

This means that you have to understand how the results are generated: there is no magic involved, just simple maths.
For example, if a semiconductor junction is subjected to a 2mV excursion, it will generate about 1% 2nd harmonic distortion. That remains true in theory, reality and in sim.
If the 1% is reduced by a 20dB loop gain, it will become 0.1%.
At this stage, you have two possible sources of inaccuracy: the initial non-linearity and the loop gain.

In real circuits, there are numbers of distortion sources, and some of them can go in one or another direction, concave or convex (eg Xover or saturation), and have a specific phase.
When they are combined, it is very rare they simply add arithmetically: in general the actual sum will be lower but will depend on a number of factors, with a very high sensitivity to some parameters. If in the sim a parameter is slightly different, it can lead to widely different results (as in reality anyway)


But can-we believe them in relative ? I mean, did optimising a circuit for minimized distortion make any sens ?
Broadly, yes, but if you optimize your sim to compensate one particular type of HD by another, the effect will be meaningless.
In sim and reality, common sense remains your best compass: you can always hand-adjust a particular amplifier for optimum distortion, but this will not be valid for any other amplifier in the same series, just the one amplifier you have adjusted
For effective mass production, general principles have to guide you.

This has nothing to do with LTspice PSpice or any other tool: you are in command, you are free to use whatever tool makes you converge quicker, but you always have to use your own discerning powers. Relying blindly on any tool will lead you into the wall, quickly. That is true whatever the tool you use.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.