Is there a way to set zero rise and fall time in LTspice?

Discussion in 'Programmer's Corner' started by anhnha, Mar 9, 2016.

  1. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    774
    48
    Is there a way to set zero rise and fall time in LTspice? I tried that but LTspice automatically uses a default value for <trise> and <tfall> if these parameters are set to zero.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,163
    1,797
    It might be that the simulation blows up with derivatives of infinite magnitude. You are actually doing numerical integration of a system of linearized differential equations. If you could set those times to zero you would get meaningless results. Take your pick.
     
  3. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    774
    48
    Yes, I am aware of this problem. But for some application, I want to use the option.
     
  4. StayatHomeElectronics

    Well-Known Member

    Sep 25, 2008
    864
    40
    Can you set <trise> and <tfall> to very small times like 1 us or 1 ns? You might be able to find a time that suits your simulation purposes.
     
  5. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    774
    48
    I tried one that is smaller than that above ( 1f (femto) second) but it seems that it still uses the default values.
     
  6. StayatHomeElectronics

    Well-Known Member

    Sep 25, 2008
    864
    40
    Femtoseconds must be too small for the simulator to recognize. Try something larger.
     
  7. crutschow

    Expert

    Mar 14, 2008
    13,052
    3,244
    You must have put the values in wrong.
    As shown below, with the pulse rise and fall times set to 1fs in LTspice, 1fs is displayed in the transient plot.

    upload_2016-3-9_9-10-56.png
     
  8. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    774
    48
    Thank you. Here is the result of me:

    upload_2016-3-10_0-44-40.png

    upload_2016-3-10_0-45-6.png
     
    Last edited: Mar 9, 2016
  9. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    You've got totally different time scales -- 1 fs rise and fall times but a 20 second period?

    You've also got eight parameters to the PULSE model. How does that model handle eight parameters?

    What happens if you simply use the settings that crutschow used?
     
  10. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    774
    48
    20 is the number of cycles which is plotted.
    Period is 1 second.
    Here is the model parameters:
    upload_2016-3-10_1-28-38.png

    With this, I got the same result. However, with the same setting but change the stop time (run time) fro 4fs to 1m second, the result is totally different. Maybe my LTspice is having some problem.

    upload_2016-3-10_1-39-44.png
     
  11. eetech00

    Active Member

    Jun 8, 2013
    650
    112
    Try subtracting TR+TF from Ton:

    .param Ton=0.5-(1f+1f)

    PULSE(0 1 0 1f 1f {Ton} 1 20)
     
  12. crutschow

    Expert

    Mar 14, 2008
    13,052
    3,244
    The problem is your time scale. LTspice assumes that if you are doing seconds of time you don't need fs resolution (why would you?).
    If you want to do seconds of simulation and display a 1fs rise-time then you need to set the maximum time-step in the transient setup to 1fs. But that will require many minutes (or even hours) of simulation time since for each second of simulation the computer now has to do at least a trillion calculations and each calculation likely requires many CPU cycles. :eek:
     
    Last edited: Mar 9, 2016
  13. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    764
    For pulses you leave the data, blank.
     
  14. crutschow

    Expert

    Mar 14, 2008
    13,052
    3,244
    What data? :confused:
    If you leave the rise and fall time values blank, the those times default to a fixed percentage of the pulse width.
     
  15. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    You still aren't running the same settings that crutschow used. Look at your .tran statement. You are telling the simulator to run the sim for 5 milliseconds. That's 5,000,000,000,000 femtoseconds!
     
  16. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    764
    What is that fixed percentage Carl? Where is it stated?
     
  17. crutschow

    Expert

    Mar 14, 2008
    13,052
    3,244
    Don't know if it's stated anywhere.
    I've just observed that the default rise and fall times seem to be about 10% of the pulse width.
     
    Last edited: Mar 9, 2016
  18. Papabravo

    Expert

    Feb 24, 2006
    10,163
    1,797
    I can't imagine why you would want to do it and I suspect it won't let you do that for a very good reason. If you don't believe me, then why don't you shoot Mike Englehardt an email and ask him. I'm sure he'd be glad to educate you on the matter
     
  19. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    774
    48
    As I said above, with setting exactly as crutschow, I got the same result. However, I was wondering why run time (4fs, 5m) affects the rise or fall time. That seems strange to me.
     
  20. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    I'm pretty sure that the actual simulator is not overriding you values with "defaults", but rather the schematic capture tool. You should be able to simulate a hand written circuit file (or a hand tweaked one) in which you force the values to zero. This may or may not simulate successfully as it may cause convergence problems.
     
Loading...