Author Topic: FFT in LTSPICE XVII - force settings  (Read 2675 times)

0 Members and 1 Guest are viewing this topic.

Offline fcbTopic starter

  • Super Contributor
  • ***
  • Posts: 2135
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
FFT in LTSPICE XVII - force settings
« on: May 18, 2020, 09:37:02 am »
Is there a way to force the setting of the FFT in LTspice (using XVII).

I'm already using the .four operative to create THD readouts successfully and also the FFT (View>FFT).

Problem is that it (FFT) doesn't seem to remember my 'specify a time range/time range' choices and requires resetting every simulation run (although it does remember my choice of window?).

?Any ideas if their are some operatives/instructions to force the the FFT?
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15794
  • Country: fr
Re: FFT in LTSPICE XVII - force settings
« Reply #1 on: May 18, 2020, 01:17:26 pm »
IIRC, the View/FFT computes an FFT over the portion of signal in the current window by default. I don't think there is any other way to make it "remember" the time range. So your best bet, if you want to issue an FFT over a specific time range, would be to define this time range in the transient simulation (time to start saving data/stop time).

 
The following users thanked this post: fcb

Offline fcbTopic starter

  • Super Contributor
  • ***
  • Posts: 2135
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: FFT in LTSPICE XVII - force settings
« Reply #2 on: May 18, 2020, 01:49:49 pm »
Thanks SiliconWizard.

That fix does work and is saving my sometime.  Still be nice if their were .op options to force the settings of the FFT, perhaps someone from LT/AD will read this.
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2766
  • Country: ca
Re: FFT in LTSPICE XVII - force settings
« Reply #3 on: May 18, 2020, 01:53:00 pm »
Is there a way to force the setting of the FFT in LTspice (using XVII).

I'm already using the .four operative to create THD readouts successfully and also the FFT (View>FFT).

Problem is that it (FFT) doesn't seem to remember my 'specify a time range/time range' choices and requires resetting every simulation run (although it does remember my choice of window?).

?Any ideas if their are some operatives/instructions to force the the FFT?

Can you share your model? or an example with the same challenges?

There may be a solution.

Regards,
Jay_Diddy_B
 

Offline fcbTopic starter

  • Super Contributor
  • ***
  • Posts: 2135
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: FFT in LTSPICE XVII - force settings
« Reply #4 on: May 18, 2020, 02:08:25 pm »
Sorry Jay_Diddy_B.  It's under a fairly draconian NDA.

For anybody else searching how to do an FFT or THD (.four) using LTspice, this is the main resource I used:


https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15794
  • Country: fr
Re: FFT in LTSPICE XVII - force settings
« Reply #5 on: May 18, 2020, 02:20:47 pm »
Thanks SiliconWizard.

That fix does work and is saving my sometime.  Still be nice if their were .op options to force the settings of the FFT, perhaps someone from LT/AD will read this.

Maybe.

IMO, the FFT view is an integral part of the waveform viewer, and thus follows the same "philosophy". It's meant to be interactive.
And then, your need could actually be translated to other parts of the viewer. I find LTSpice's waveform viewer to be lacking in a lot of areas actually - would be nice if it could get a good overhaul. You may take a look at Micro-cap 12 (which has been made free) to get an idea of what a nice waveform viewer could be.
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2766
  • Country: ca
Re: FFT in LTSPICE XVII - force settings
« Reply #6 on: May 18, 2020, 02:32:34 pm »
Hi FCB,

Since you can't share your circuit, I will share mine:



If I run this model I get:



Which includes the start up behaviour.

If use the FFT function, the default is:



and the resulting FFT is:



If I look at the FFT for the last 10ms, that is from 10ms to 20ms I get>



Which doesn't include the start-up.

What do you want to do? using my model an example.

Regards,
Jay_Diddy_B
* fft transient.asc (0.62 kB - downloaded 53 times.)
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2766
  • Country: ca
Re: FFT in LTSPICE XVII - force settings
« Reply #7 on: May 18, 2020, 02:54:55 pm »
Hi,

You can also do this:




The simulation will run three times. Each time it runs 10ms after the start.

The resulting FFTs are:




Regards,
Jay_Diddy_B

 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2766
  • Country: ca
Re: FFT in LTSPICE XVII - force settings
« Reply #8 on: May 18, 2020, 02:59:53 pm »
Hi,

IF I add:

.four 1kHz I(R1)

to the model, and look at the SPICE error log:

Code: [Select]

Circuit: * D:\projects\eevblog fft 2020\fft transient.asc

Direct Newton iteration for .op point succeeded.
.step start=0
N-Period=1
Fourier components of I(r1)
DC component:-3.14927e-005

Harmonic Frequency Fourier Normalized Phase  Normalized
 Number   [Hz]    Component Component [degree] Phase [deg]
    1    1.000e+03 3.370e-02 1.000e+00 -105.99°     0.00°
    2    2.000e+03 1.550e-04 4.601e-03    22.40°   128.38°
    3    3.000e+03 2.728e-03 8.096e-02    91.57°   197.56°
    4    4.000e+03 5.102e-05 1.514e-03     9.58°   115.57°
    5    5.000e+03 8.626e-04 2.560e-02    88.42°   194.40°
    6    6.000e+03 3.191e-05 9.470e-04     5.73°   111.72°
    7    7.000e+03 4.242e-04 1.259e-02    86.38°   192.37°
    8    8.000e+03 2.342e-05 6.949e-04     3.71°   109.70°
    9    9.000e+03 2.519e-04 7.476e-03    84.61°   190.60°
Total Harmonic Distortion: 8.631035%(8.665294%)


.step start=0.01
N-Period=1
Fourier components of I(r1)
DC component:2.26431e-007

Harmonic Frequency Fourier Normalized Phase  Normalized
 Number   [Hz]    Component Component [degree] Phase [deg]
    1    1.000e+03 3.356e-02 1.000e+00 -105.71°     0.00°
    2    2.000e+03 5.077e-05 1.513e-03     6.05°   111.76°
    3    3.000e+03 2.651e-03 7.901e-02    92.45°   198.16°
    4    4.000e+03 1.684e-05 5.019e-04     0.20°   105.91°
    5    5.000e+03 8.159e-04 2.431e-02    89.68°   195.39°
    6    6.000e+03 1.029e-05 3.066e-04    -1.78°   103.94°
    7    7.000e+03 3.890e-04 1.159e-02    87.78°   193.49°
    8    8.000e+03 7.340e-06 2.187e-04    -3.27°   102.44°
    9    9.000e+03 2.256e-04 6.723e-03    86.01°   191.72°
Total Harmonic Distortion: 8.376411%(8.406611%)

.step start=0.02
N-Period=1
Fourier components of I(r1)
DC component:-3.13169e-007

Harmonic Frequency Fourier Normalized Phase  Normalized
 Number   [Hz]    Component Component [degree] Phase [deg]
    1    1.000e+03 3.362e-02 1.000e+00 -105.78°     0.00°
    2    2.000e+03 4.760e-05 1.416e-03     8.29°   114.08°
    3    3.000e+03 2.518e-03 7.489e-02    92.26°   198.04°
    4    4.000e+03 1.382e-05 4.112e-04     2.48°   108.26°
    5    5.000e+03 7.324e-04 2.178e-02    89.08°   194.87°
    6    6.000e+03 8.120e-06 2.415e-04    -4.98°   100.80°
    7    7.000e+03 3.455e-04 1.028e-02    85.86°   191.64°
    8    8.000e+03 5.745e-06 1.709e-04    -6.79°    99.00°
    9    9.000e+03 2.130e-04 6.334e-03    85.15°   190.93°
Total Harmonic Distortion: 7.893936%(7.932186%)


Date: Mon May 18 10:55:51 2020
Total elapsed time: 1.422 seconds.

tnom = 27
temp = 27
method = modified trap
totiter = 7807
traniter = 7804
tranpoints = 3903
accept = 3183
rejected = 720
matrix size = 4
fillins = 0
Matrix Compiler1: off  [0.2]/0.2/0.2
Matrix Compiler2: off  [0.2]/0.4/0.3




I have the THD for the three windows.

Does this help?

Jay_Diddy_B
 

Offline fcbTopic starter

  • Super Contributor
  • ***
  • Posts: 2135
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: FFT in LTSPICE XVII - force settings
« Reply #9 on: May 18, 2020, 03:47:37 pm »
The problem I had was that until circuit settled down (after ~1ms) the FFT would show LF garbage.

By reducing the visible data (.tran 0 2ms 1ms 1ns) to between 1ms to 2ms I solve the problem with the FFT settings not 'sticking', but I'm also interested in looking how .raw looks from 0-2ms.  It's a minor but irritating thing. Traces below:

0-2ms

1-2ms
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf