Significant Ltspice precision error/bug?

Discussion in 'Programmer's Corner' started by Hypatia's Protege, Mar 10, 2016.

  1. Hypatia's Protege

    Thread Starter Distinguished Member

    Mar 1, 2015
    2,795
    1,236
    Kind friends

    I seem to have encountered a rather egregious 'precision error' Re: LtSpice

    Granting that past experience suggests the problem is likely down to my-own misunderstanding of the application -- I will nonetheless be most grateful for assistance in settling the matter either way!:)

    The circuit under study is a 'bone-basic' 1/2 wave rectifier/filter operating at 60kHz / 50kV (peak)

    Cursors set as follows:
    Cursor #1: For an amplitude of 49.999993Kv (For all intents and purposes 90°)
    Cursor #2: Cursor 1 +100.6626ns (i.e. ≈ 2.1743° 'ahead' of cursor #1)

    Hence I would expect an amplitude difference of ≈ -36V However the simulator returns a value of ≈ -40.9V:confused:??? --- The cited disparity would seem to exceed that ascribable to a 'rounding' error'?

    Note that while the selected diode does not, in actuality, support the simulated frequency or EMF -- such should not be an issue inasmuch as LtSpice does not 'enforce' Trr or Vrrm

    Please note that, for the convenience of the readers, I have annotated the screen capture...

    Many, many advance thanks for any assistance or insight!!!:):):):)

    Diode.jpg
     
  2. dannyf

    Well-Known Member

    Sep 13, 2015
    1,819
    363
    4v out of 50kv is egregious? Are you using it to design a probe to the next black hole?
     
    Hypatia's Protege likes this.
  3. Hypatia's Protege

    Thread Starter Distinguished Member

    Mar 1, 2015
    2,795
    1,236
    Perhaps 'egregious' is a bit strong:oops: Even so an error of 0.0098% is larger than one would expect? --- In any event I'm ok with it so long as I may be certain such is merely a rounding artifact:):):)

    Many thanks for your response!:)

    Best regards
    HP
     
    Last edited: Mar 10, 2016
  4. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,059
    3,821
    I cannot zoom in to see the text details of your entire circuit on my tablet but, as noted a 0.01% "error" could be that a diode has about 0.01% of the capacitance of a 10nF capacitor, that is 1pF. (I cannot see the numbers on your voltage source or any information on the o-scope)

    Also, many simulators do not like capacitor circuits with no resistance. You can put a 0.01 ohm resistor in series with your diode or a multi-megOhm in parallel with your capacitor to meet the typical criteria while minimizing the impact to the circuit.
     
    Hypatia's Protege likes this.
  5. Hypatia's Protege

    Thread Starter Distinguished Member

    Mar 1, 2015
    2,795
    1,236
    Many thanks for your reply!:):):)

    FWIW Here's the ".asc":)
     
  6. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,801
    1,105
    Are you using the default Tolerances, or have you set them to something else in Control Panel?
     
    Hypatia's Protege likes this.
  7. Hypatia's Protege

    Thread Starter Distinguished Member

    Mar 1, 2015
    2,795
    1,236
    I merely opened the program, selected new schematic, then drafted the circuit -- If it's of any assistance I've attached the .ASC file to post #5

    Many thanks for your reply!

    Best regards
    HP:)
     
  8. Bordodynov

    Active Member

    May 20, 2015
    641
    188
    Last edited: Mar 10, 2016
    Hypatia's Protege and GopherT like this.
  9. Hypatia's Protege

    Thread Starter Distinguished Member

    Mar 1, 2015
    2,795
    1,236
    @Bordodynov (and anyone wishing to respond):cool:

    First of all many thanks for your time and effort in assisting me with this!:)

    So... I have a few questions -- please be patient - I'm new to LtSpice (my experience with said application being confined principally to 'schematic entry').

    But to begin:
    Ltspice directive/statement:...............My Interpretation....................................Questiom
    .param Tmax={7440.25/60000}........ Load Tmax = (7440 Cycles+90°) := 124ms --- Why 'add' the extraneous 7440 Cycles?:confused:


    Please indicate whether I have correctly interpreted the following statements:)
    Statement................................................My Interpretation
    .meas Vmax Find V(a) at {Tmax}
    ...............Load 'Vmax' := EMF at 90° ?
    .meas Vsh Find V(a) at {t1} ......................Load 'Vsh' := EMF at 90° ± ≈ 2.1743° ?
    .meas delta param Vmax-Vsh....................Load 'Delta' := Vmax-Vsh ?
    .meas ph param 100.6624n*60000*360......Load 'ph' := calculated angle per T1 interval (≈2.1743°) ?

    Please explain why this 'textual run' returns the correct result whereas the graphical simulation was in error? (IOW what was I doing wrong?:oops::oops::oops:)

    With heartfelt thanks and very best regards!
    HP:):):):)
     
    Last edited: Mar 10, 2016
  10. Aleph(0)

    Member

    Mar 14, 2015
    343
    325
    HP I say it's to allow enough rc TCs to make sure c1 isn't messing with readings:)!
     
  11. Bordodynov

    Active Member

    May 20, 2015
    641
    188
    Hypatia's Protege.
    Yes. Tmax=7465.25*60000
    I looked at your chart. But the difference in the result not will be. You can take any period. You did not properly understand the results. I increased the calculation accuracy. Ask directive ".opt reltol=1u" and make calculations, and repeat your measurements. With the default settings the result was just as bad as you.
     
    Last edited: Mar 11, 2016
    Hypatia's Protege likes this.
  12. Hypatia's Protege

    Thread Starter Distinguished Member

    Mar 1, 2015
    2,795
    1,236
    So, as I understand your reply, my error owed to insufficient precision?

    I've just attempted to set the Relative Tolerance to '1u' (i.e. 1*10^-6) as (shown below) -- however that seems to have compounded the error?:confused::confused::confused:
    Please advise...?

    Again, I entreat patience:oops: -- I apologize for my slow-wittedness in this matter!:oops: --- Many thanks!
    HP:)

    Diode2.jpg
     
  13. Bordodynov

    Active Member

    May 20, 2015
    641
    188
    You are not there to change the accuracy. You have changed the graphical information. On the calculation is not affected. I prefer to write parameters on the circuit. See

    Reltol2.png
     
    Hypatia's Protege likes this.
  14. Bordodynov

    Active Member

    May 20, 2015
    641
    188
    HP. To improve the accuracy of graphic information pick you need to remove compression.
    it is .option plotwinsize=0.
     
    Hypatia's Protege likes this.
  15. Hypatia's Protege

    Thread Starter Distinguished Member

    Mar 1, 2015
    2,795
    1,236
    @Bordodynov -- Thanks!

    I've run the simulation having issued the 'onscreen' directive: ".option plotwinsize=0." -- with much improved results (please see immediately below):) - Howbeit not as accurate as your results (attached to post #8)

    ---Post continued 'below' image---
    DiodePlot1.jpg

    When attempting to run the simulator having issued the ".model" directive shown in post #8, I receive the following error/warning dialog:

    ---Post continued 'below' image---
    DiodeError.jpg

    And the erstwhile erroneous results on the 'plot' (Please see below):confused: - Please advise? ---- Many thanks for your patience!:):):):)

    DiodePlot2.jpg


    Best regards
    HP:)
     
  16. Bordodynov

    Active Member

    May 20, 2015
    641
    188
    I recommend .option plotwinsize = 0 reltol = 1u. But remember that the raw-file is very large.
     
  17. Hypatia's Protege

    Thread Starter Distinguished Member

    Mar 1, 2015
    2,795
    1,236
    Thank you! -- I'll give it a try and post my results!:)

    Very best regards
    HP
     
Loading...