Using more cycles gives an average level of
each harmonic, which may compensate for errors due to the
'start' epoch of the simulation. I find it useful to set
the.TRAN simulation to ignore the early cycles that look
distorted, but 'look' is sometimes not good enough; some
transient harmonic levels that are significant are still being
included. If I'm not confident about the reported result, I
change the .TRAN to save results later and/or simulate for
longer. The other aspect of .TRAN simulation time is that if you
set it too short it will not resolve very low frequency
components. For example, a 50ms simulation will not show a 10Hz
component.
On 2025-02-04 16:57, Tony Casey wrote:
Did you try just letting .FOUR use its defaults?
My experience that it is pretty consistent. Why do you think more
cycles would give you a better result? Just make sure the waveform
display is comfortably more than the number of cycles the .FOUR
uses. I normally use the default of 1 cycle, but display between 3
and 6 cycles for good good visual. .FOUR will use the last cycle
of the waveform.
I haven't seen your full schematic, but did you remember to use
.options plotwinsize=0 and set the maximum timestep to a good
fraction of a cycle? I normally set Tmax to 1/period/2^n, with n
normally between 8 and 16, depending on the expected level of THD
with a suitable trade-off in analysis time. Normally Fourier stuff
like things in binary multiples, but I understand LTspice's
algorithms are much less fussy.
--
Regards,
Tony
On 04/02/2025 16:32, rlim701 via
groups.io wrote:
I spoke too
soon.? Still not getting consistent THD results.? The latest
zipped files (thd_debug.zip) show that changing .param
fft_cycles=67 brought back the 'thd=0.000000% line again even
though I added extra end time and also subtracted 1 cycle from
.FOUR.? Would appreciate other thoughts to at least get some
consistent results.? What I am essentially doing is tuning the
simulator via fft_cycles and fft_throw_cycles to get a
trustworthy thd number, but whenever I try that by increasing
either parameters, I seem to eventually end up back to all
zeros.
--
OOO - Own Opinions Only
Best Wishes
John Woodgate
Keep trying