Author Topic: LTSpice pulse options  (Read 6740 times)

0 Members and 1 Guest are viewing this topic.

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
LTSpice pulse options
« on: May 05, 2019, 01:06:06 pm »
I am trying to experiment with analysing square waveforms with FFT in LTSpice by analysing the pulse waveforms with various rise and fall times. But there seems to be a minimum rise time of 50µs. Even if I set rise and fall times to "0" I get a slope of about 50µs. Is this how it works?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: LTSpice pulse options
« Reply #1 on: May 05, 2019, 03:00:45 pm »
A zero, null or absent parameter, that must be nonzero, is simply given its default value.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #2 on: May 05, 2019, 03:05:02 pm »
Well in theoretical land a 0 rise/fall time can be done. So are you saying that 50µs is the fastest transition I am allowed or that it is the default because 0 is not acceptable?
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #3 on: May 05, 2019, 03:06:00 pm »
hm, setting 1ns I get practically straight edges.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #4 on: May 05, 2019, 03:08:34 pm »
1ps produces a giberish waveform :)
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: LTSpice pulse options
« Reply #5 on: May 05, 2019, 03:47:54 pm »
hm, setting 1ns I get practically straight edges.

You might have to set Edit Simulation Command > Transient > Maximum Timestep to less than that, about 0.3ns should work, but slows it down.
.  That took much longer than I thought it would.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #6 on: May 05, 2019, 03:53:54 pm »
hm, setting 1ns I get practically straight edges.

You might have to set Edit Simulation Command > Transient > Maximum Timestep to less than that, about 0.3ns should work, but slows it down.

Right, so i tried 1ps :), how do I stop a simulation?, I am set to run for 1s, it's now taking 1s/µs to simulate - opps....
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: LTSpice pulse options
« Reply #7 on: May 05, 2019, 04:25:33 pm »
I tried 1.5ps, I always use near prime or odd numbers, don't know if it makes any difference.
Setting Maximum Timestep to 0.3ns is small enough to see 0.15ns edges for me.
If you right-click over the plot and Mark Data Points, you can check there's enough sample calculation points on the fast edges, it only needs a few on the edge, unless you've got even faster edges somewhere else. :)
.  That took much longer than I thought it would.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3382
  • Country: gb
Re: LTSpice pulse options
« Reply #8 on: May 05, 2019, 04:27:36 pm »
Right, so i tried 1ps :), how do I stop a simulation?,

Click the "Hand" button, next to the "running man" button.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #9 on: May 05, 2019, 04:32:51 pm »
Right, so i tried 1ps :), how do I stop a simulation?,

Click the "Hand" button, next to the "running man" button.

Yea found it, i was running more like 0.1µs/s
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #10 on: May 05, 2019, 04:34:15 pm »

Setting Maximum Timestep to 0.3ns is small enough to see 0.15ns edges for me.


You sure? don't you mean it the other way around?

I am just experimenting with my PC, I can reduce my core count in the bios and get a speed boost.
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: LTSpice pulse options
« Reply #11 on: May 05, 2019, 04:36:33 pm »
Right, so i tried 1ps :), how do I stop a simulation?, I am set to run for 1s, it's now taking 1s/µs to simulate - opps....

Yes, have gone through this too: LTSpice will happily fill up your hard drive if you don't pay attention  :)  Actually I would be interested too if someone knows how to limit the output file size.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #12 on: May 05, 2019, 04:41:46 pm »
Right, so i tried 1ps :), how do I stop a simulation?, I am set to run for 1s, it's now taking 1s/µs to simulate - opps....

Yes, have gone through this too: LTSpice will happily fill up your hard drive if you don't pay attention  :)  Actually I would be interested too if someone knows how to limit the output file size.

So where does it put the data? does it try to keep it after the program is closed?
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: LTSpice pulse options
« Reply #13 on: May 05, 2019, 04:50:00 pm »
So where does it put the data? does it try to keep it after the program is closed?

If I remember it was in the same directory as the project files, but I don't have LTSpice installed on my home computer, I can check tomorrow when I'm back in the lab.  And yes, the simulation files are not deleted when you close it - unless there is an option I don't know.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #14 on: May 05, 2019, 08:31:15 pm »
LTSpice creates .raw files with data at each node and component with stepping xxsec in your directory from which you started your .asc source.
It could be GBytes of data. For example the multislope ADC simulation I did here saved 6.5GB of data after a simulation of a 20ms run.

You may limit the data written with .save directive (ie. ".save V(base) I(R4)").

Also you may delete the .raw data after closing the .asc sim source file (it could be set somewhere).

It also does a compression of the data, and does use a limited precision to save the space (you may switch it off).

You may set the time when it starts to save data, and also you may set maximum step size (the smaller the slower), ie "".tran 0 1s 0.5 10ns does 1sec long transient sim, starts to save data at 0.5sec and max step is 10ns.
« Last Edit: May 05, 2019, 08:44:35 pm by imo »
Readers discretion is advised..
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: LTSpice pulse options
« Reply #15 on: May 05, 2019, 11:20:03 pm »
If all you're doing is looking at waveforms, you'll save a lot of time and precision doing it analytically rather than numerically.

SPICE only knows what it knows, on a moment-to-moment basis.  If you tell it that it needs those moments to be 1ps or something ridiculous, it's going to dutifully follow your command, and simulate with very small timesteps.  Maybe the steps are too small and it doesn't ever recover (timestep too small).  Finally, the FT it calculates from that run time, is limited by that run time: frequencies can only be so precisely calculated, based on the data recorded.  The true frequency and harmonics might be perfectly spaced, but you get sloppy binned results because it's not an analytical method.

But if all you're looking at is a PULSE source, that's a four step piecewise linear function, a trapezoid wave, with an easily solved integral in its Fourier series.  To wit:
- The harmonics go as 1/N from fundamental until the cutoff frequency
- The cutoff is determined by the ramp (edge) rate
- Above cutoff, harmonics go as 1/N^2
- If the duty cycle isn't 50%, even harmonics are present.  Specifically, harmonics go as, um, sin(D * (1-D) * N * 2*pi) or something like that.  Basically at 50%, they alternate (even harmonics = 0), while at very low or very high D, the waveform is very spiky and harmonics are flat (just as an ideal impulse train has all equal harmonics) until a break frequency F / (D*(1-D)) or thereabouts.
- I'm not sure offhand what happens with dissimilar rising and falling edges, but it must have some intermediate cutoff point.  Note that asymmetry in any parameter (rise/fall, on/off) introduces even harmonics.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #16 on: May 06, 2019, 09:03:11 am »
Took a half of a second..
« Last Edit: May 06, 2019, 09:31:12 am by imo »
Readers discretion is advised..
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #17 on: May 06, 2019, 09:21:21 am »
Sub-ps edges.
Readers discretion is advised..
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15796
  • Country: fr
Re: LTSpice pulse options
« Reply #18 on: May 06, 2019, 10:33:23 am »
Regarding the 0/default value for rise/fall times:

http://ltwiki.org/index.php?title=Most_frequently_asked_questions_for_beginners#I_have_a_pulse_source_in_my_schematic_with_zero_transition_times._LTspice_only_shows_slow_transition_times_of_2ns._What.27s_going_on_here.3F

Just tested a pulse voltage source in LTSpice with rise and fall times of 10ns, 100µs Ton, 200µs Toff, 1ms stop time without specifying a maximum timestep for the transient simulation, and I get 10ns rise and fall times.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #19 on: May 06, 2019, 12:52:05 pm »
Regarding the 0/default value for rise/fall times:

http://ltwiki.org/index.php?title=Most_frequently_asked_questions_for_beginners#I_have_a_pulse_source_in_my_schematic_with_zero_transition_times._LTspice_only_shows_slow_transition_times_of_2ns._What.27s_going_on_here.3F

Just tested a pulse voltage source in LTSpice with rise and fall times of 10ns, 100µs Ton, 200µs Toff, 1ms stop time without specifying a maximum timestep for the transient simulation, and I get 10ns rise and fall times.


Yes if you specify it it will go to what you want. If you don't it seems to assume 50µs

I am looking at the FFT of RC filtered steps, i would think that 10 points of those curves is a good idea? Questin is to do a proper FFT how many cycles do i need? I am pretty sure that the resulting graph from 2 and 14 cycle was different.
« Last Edit: May 06, 2019, 01:07:58 pm by Simon »
 

Offline aandrew

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: ca
Re: LTSpice pulse options
« Reply #20 on: May 06, 2019, 06:39:09 pm »
I tried 1.5ps, I always use near prime or odd numbers, don't know if it makes any difference.

Why do you always use near prime (what's a near prime number?) or odd numbers?
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #21 on: May 06, 2019, 06:58:55 pm »
I am looking at the FFT of RC filtered steps, i would think that 10 points of those curves is a good idea? Questin is to do a proper FFT how many cycles do i need? I am pretty sure that the resulting graph from 2 and 14 cycle was different.
What do you mean by "point of a curve"? LTspice is not a DSO with a limited sampling rate..
The more periods of a signal you put into the FFT the better.

The FFT can do up to 16mil "samples" of the "signal trace" (you have 3 choices what time range to include).
« Last Edit: May 06, 2019, 07:04:36 pm by imo »
Readers discretion is advised..
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #22 on: May 06, 2019, 07:02:38 pm »
Well the time step is the resolution of the simulation is it not? the RC charge/discharge is not a rise/fall ramp, it's a curve so you cannot just take a couple of points and draw a line between them.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTSpice pulse options
« Reply #23 on: May 06, 2019, 07:07:50 pm »
I think not.
The FFT works such you set the number of "FFT points" (up to 16mil) and the TIME INTERVAL (3 choices you get).
So the lowest freq in the spectra is given by the time interval (ie 100ns). The highest is related to the number of FFT points you selected.

There is not such thing like "number of points in the signal trace".

The trace you see is a "continual curve", and as such is taken into the FFT (with up to 16mil "sampling points").

It does not matter whether the time scale is fs, ps, ns - those are just "numbers" for LTspice.

If you see a square wave 50/50 in the trace it takes "the smooth picture" of the trace, cuts it into up to 16mil "sampling points" and creates the spectra.
Then it recalculates the freq axis.
« Last Edit: May 06, 2019, 07:20:07 pm by imo »
Readers discretion is advised..
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18118
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: LTSpice pulse options
« Reply #24 on: May 06, 2019, 07:24:36 pm »
No, I am not talking about the FFT but the initial simulation. Getting the data that the FFT is to calculate from.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf