Installing and using LTspice IV (now including LTXVII), From beginner to advanced

Comparison of FFTs?

Using the procedure described in the tutorial at post #19 at 4kHz with.

.tran 0 250ms 230ms 0.0190734us
.option
+ plotwinsize=0
+ numdgt=7
+ noopiter

The simulation takes 10 minutes and I get the pretty good-looking FFT in the first screenshot.

With the keantoken settings shown in the second screenshot (note "points=12") the simulation takes 2.7 seconds (great!) but the FFT is as shown in the third screenshot.

The very noisy FFT with "points=15" is shown in the 4th screenshot.

With trtol=100 I was able to get the improved FFT shown in the 5th screenshot.

Any way I can improve on the behaviour above 10kHz?
 

Attachments

  • FFT1.png
    FFT1.png
    59.1 KB · Views: 125
  • keantoken settings.png
    keantoken settings.png
    19.7 KB · Views: 123
  • FFT2.png
    FFT2.png
    64.5 KB · Views: 121
  • FFT3.png
    FFT3.png
    62.4 KB · Views: 115
  • FFT4.png
    FFT4.png
    41.4 KB · Views: 123
In principle only 'maxstep' sets the resolution/precision of your simulation, using TRTOL or RELTOL (and possibly others) will only lengthen the simulation (to make it more precise) , it seems to me that the first picture shows a more than decent FFT :) if you want it faster you need to make 'maxstep' larger and then experiment, but (as the points=15 version is not what you want) it will slow down the simulation, and after spending a lot of time, you may return at the first (picture, points=16 I guess).

In general, tinkering with these (and other) parameters is only to be done when things do not function, when it functions 'maxstep' is your friend.

Maybe you need a faster computer :) but, be aware, even on my dual i7 at 4G I have simulations than run for a few hours.
 
1 is 1 Farad. 1F would be 1 femto farad.

Thanks! Duh but of course! :eek:

With 0.1uF capacitors I get the FFT shown below.

The tutorial suggests using very large capacitors so that brings me back to my original problem. Larger capacitors cause slower sims or when sufficiently large, the "time step too small" error.

100uF takes 25 seconds but the FFT looks the same.

Different frequency range and circuit of course but I was hoping to obtain something like this from post #1301.

Is that possible?
 

Attachments

  • FFT5.png
    FFT5.png
    156 KB · Views: 65
Last edited:
Administrator
Joined 2007
Paid Member
Thanks! Duh but of course! :eek:

With 0.1uF capacitors I get the FFT shown below.

Don't worry, it took me ages to suss that one out.


I'm not sure what to suggest with your sim as its quite a complex design with a lot going on. Any caps across perfect voltage sources can be removed, any caps decoupling voltage sources (such as C, C3 and C10) can be removed and the voltage at that point replaced with a voltage source. Measure and record the DC voltages and then set a voltage source to equal the reading.

I'm not sure how wound components would behave tbh. They are reactive like a cap and so it seem logical to suppose they influence the result in similar ways.

I've always stuck to the longhand method of calculating the sim parameters, mainly because I don't fully understand the other methods in enough detail, and also because trying to push the noise floor ever lower is in reality something that wouldn't be achievable anyway in real life... its more an academic exercise to me.

If a sim has for example an FFT with peaks at -60db or even -90db then it doesn't really matter if the base noise floor is -150, -300 or -1000db, the peaks you are looking at are still accurately shown.
 
If a sim has for example an FFT with peaks at -60db or even -90db then it doesn't really matter if the base noise floor is -150, -300 or -1000db, the peaks you are looking at are still accurately shown.

Yes, all I'm looking for is reliable harmonic indications out to 20kHz and realistic THD estimates.

Quick turnaround would be nice because I expect to be refining a number of interacting operating points to provide a starting point for an actual build.
 
AX tech editor
Joined 2002
Paid Member
1 is 1 Farad. 1F would be 1 femto farad.

Sorry to disagree - 1f (or better: 1fF) is one femto Farad in a cap. 1fA would be 1 femto amps in a current source ;-)


Edit: To dch53: very large caps across DC sources can be a problem, since they can lead to infinite charging currents. Unless you set the sim to ramp up the voltage slowly.
But better to delete them as Mooly says; the DC source is an ideal source and the cap across it doesn't do anything (in the sim) except cause trouble.

Jan
 
Last edited:
AX tech editor
Joined 2002
Paid Member
Value suffixes in some SPICE implementations may be case sensitive, but everyone in this discussion seems to be using LTSpice where they are not, so 1F would be the same as 1f.

I would think that keeping to an agreed international system of units is key here. Precisely to avoid confusion and ambiguity.
1F is different from 1f. About a factor of 10^15 worth of difference ;-)

Anyway, a dude paying $100 for a 10F supercap for his car sound system surely would be upset if he got a 10f cap in the mail!

Jan
 
Last edited:
I would think that keeping to an agreed international system of units is key here.

That would be nice but in all simulators I have seen a number alone always works, like 1e-15 is always a femto-Farad. Differentiation between upper and lower case letters is always problematic especially with software that has a long legacy. Case in point email addresses.
 
Administrator
Joined 2007
Paid Member
The problem I had (back when I puzzled over this) was in seeing the expected (well that's how I read it) unit to be F and to me F = Farad. The expected unit for volts is V.

It seemed entirely logical to me that if you enter 1 in the voltage box you are entering 1 volt, similarly entering 1 in the capacitance box would be 1 Farad. As we now know, it doesn't quite work like that.
 

Attachments

  • Capture.PNG
    Capture.PNG
    12.1 KB · Views: 123
… Edit: To dch53: very large caps across DC sources can be a problem, since they can lead to infinite charging currents. Unless you set the sim to ramp up the voltage slowly.
But better to delete them as Mooly says; the DC source is an ideal source and the cap across it doesn't do anything (in the sim) except cause trouble.
...

Or check out this:

.NODESET -- Supply Hints for Initial DC Solution
The .nodeset directive supplies hints for finding the DC operating point. If a circuit has multiple possible DC states as, for example, a flipflop, the iteration process for finding the DC solution may never converge. A .nodeset directive can be used to lead the circuit to one or another state. Basically, after a solution pass is done with the voltage specified on the nodeset directive, the constraint is removed for subsequent iterative passes.

Syntax: .NODESET V(node1)=<voltage> [V(node2)=<voltage [...]]
 
The problem I had (back when I puzzled over this) was in seeing the expected (well that's how I read it) unit to be F and to me F = Farad. The expected unit for volts is V.

It seemed entirely logical to me that if you enter 1 in the voltage box you are entering 1 volt, similarly entering 1 in the capacitance box would be 1 Farad. As we now know, it doesn't quite work like that.

But, SPICE has no dialogs :) (yes LTspice has)

Please note that the first implementations of SPICE are older then the common usage of the dialog-box :)

Yes it is stupid m(illie) and MEG(a) go figure :) best is not to change it, while this would invalidate a ka-zil-joen of lines of SPICE-scripts, many (owners of these scripts, libraries, boek owners,... etc) will not be happy.
 
I'm not sure what to suggest with your sim as its quite a complex design with a lot going on. Any caps across perfect voltage sources can be removed, any caps decoupling voltage sources (such as C, C3 and C10) can be removed and the voltage at that point replaced with a voltage source. Measure and record the DC voltages and then set a voltage source to equal the reading.

Thanks. I'll go ahead and simplify as suggested.