THD Simulation

Discussion in 'Cadence' started by marcoballins, Sep 24, 2008.

  1. marcoballins

    marcoballins Guest

    Hi all,

    what is the best way to compute the THD of a circuit (using spectre)?

    I could use tran analysis.
    - One problem is identify the temporal window time over which perform
    the the DFT, i.e. I have to wait enough for the signal's transient to
    be extinguished. Maybe doing it manually can lead to some bad
    estimations.
    - How do I let spectre perform waveform sampling that is good enough
    for the THD calculation. Automatic sampling is ok?
    - I read the thd() SKILL function uses the dft() function. Does dft()
    performs a resampling?

    I thought Periodic Distortion Analysis (pdisto) could also do the job
    of, at least identifying the steady-state response, if the states are
    actually set to be the same one. Is this true? (I never used Periodic
    Steady State analysis so I may be completley out of track here).

    Thanks.

    Marco
     
    marcoballins, Sep 24, 2008
    #1
  2. marcoballins

    Riad KACED Guest

    Hi Marco,

    I did some THD calculations when simulating ADCs a little while back.
    I have used Spectre TRAN simulation for my case. I have been looking
    at other alternatives at the time and I did find that SpectreRF does
    support THD with PSS. I didn't use PSS because of lack of experience
    at that period. Anyway, you have to be very careful with your
    simulation options if you want to get meaningful THD results. The
    number of samples is very important, it should be high enough to take
    into account all the harmonics. You have to set it at least at twice
    the nyquist frequency of your signal. The calculator default is 64 off
    the top of my head. You might need to set it at a higher value,
    depends on on the frequency information held by your signal.
    There is one thing I won't like with the calculator THD function: You
    can't specify any windowing. This is really important when your signal
    is not periodic or you do not know the period. You can do this with
    the DFT function though. The windowing can completely change the DFT
    results. The other bit the was annoying me with the tran simulations
    is the fact you have to run the simulation for at least 10 periods
    (when periodic). The Spectre/Spice book talks about 10%-15% of the
    tran time to complete if good enough to allow the time step to
    stabilize.

    Anyway, If you do follow all the options as in the calc doc, you are
    most likely to get a descent THD.

    You could try the PSS THD otherwise but I can't make any comment on
    this since I haven't used it. Andrew may lighten us with his
    knowledge.

    BTW, are using any Matlab along with MMSIM ?

    Cheers,
    Riad.
     
    Riad KACED, Sep 25, 2008
    #2
  3. marcoballins

    sai dhiraj Guest

    hai
    u guys discussed abt THD calc
    can you please elaborate on the method to calculate THD after getting
    DFT of the signal?
     
    sai dhiraj, Oct 8, 2008
    #3
  4. marcoballins

    Riad KACED Guest

    Hi Sai,

    THD is the measure of the amount of energy in the harmonics relative
    to the energy in the fundamental.
    So from your DFT, choose the first N harmonics of interest, let say 20
    but it depends on your application, sum the energy of those harmonics
    and devide it by the energy of the fundamental.
    A more detailed explanation could be found in the Cadence's Waveform
    Calculator User Guide, just look for THD. Any other descent Analog/RF
    primer explains this as well.

    Cheers,
    Riad.
     
    Riad KACED, Oct 12, 2008
    #4
  5. marcoballins

    mm77 Guest

    Few doubts:

    Suppose the frequency points of the DFT do not correspond to the
    harmonics of your signals, which happens when the time window of the
    signal over which you applied the DFT is not equal to the period of
    your signal (the fundamental). What to do in this case? How to
    detemine correctly the power of the harmonics?
    Do you now have to intepolate the DFT to get the peaks?

    Things are easier if the sampled period *is* equal to the period of
    your signal?
    I think this can be done with PSS analysis....

    How to take noise into account in the calculation? (white noise or
    other any other kind)

    With added noise, a periodic signal is not periodic anymore... so how
    can PSS still succeed in finding a period?

    Kind regards,
    Marco
     
    mm77, Oct 13, 2008
    #5
  6. marcoballins

    Riad KACED Guest

    Hi Marco,
    I do apologize for the late answer. Have been very busy over the past
    couple of weeks and trying to catch up ...
    These are few few answers :
    There is something fundamental to know here. The Fourier analysis
    inherently assumes T-periodic waveforms. if the period of the signal
    and the Fourier interval do not match, then a discontinuity will be
    generated and this will contaminate your results. In this case, it is
    worth to either running a tran to determine the exact period before
    running the DFT or apply a windowing function. Spectre assumes a
    rectangular window. There is a good explanation of this on the
    Cadence's SourceLink. Please give a look at:
    http://sourcelink.cadence.com/docs/db/kdb/2006/June/11251190.html
    Chapter 5 from the Designer's Guide to Spectre book is very good as
    well.
    Generally speaking, you have to make a good transient waveform right
    from the beginning if you want to end up with meaningful DFT/THD
    results. So you need to think about some options like the 'reltol',
    the maximum time step, the integration method, the strobing ... etc.
    I'm afraid not, Periodicity is one of the fundamental assumptions for
    PSS analysis as well.
    Well, noise in all the sorts, i.e 1/f, white, simulation floor noise,
    shouldn't be a problem for PSS. This is how PSS works (assuming
    Shooting method, you could look at the Harmonic Balance):
    PSS tries to find and initial condition that directly results in a
    steady state, i.e the node voltages a periodic with the same period.
    The simulator compares the solution between the start and the end of
    the period. If there is a difference, then it will iterate by changing
    the initial V/I point. PSS uses the circuit equations matrix to find
    out the efficient way to recompute the initial point. There are more
    details about the PSS algorithm in the SpectreRF Theory doc.
    Please bear in mind that PSS is a 'complicated' analysis that you need
    to tweak for your type of design. In other words, the PSS settings are
    different for a VCO, PLL, Mixer, LNA ... etc.

    I don't know whether I have covered all your questions or not. I'm
    actually not an expert of this topic and hope Andrew could find some
    time to help in case of anything missing. Otherwise, I'm usually using
    the Designer's Guide Forum for this kind of topics. There are loads of
    threads about the FFT, THD, PSS over there and it's worth sparing some
    time.

    Regards,
    Riad.
     
    Riad KACED, Oct 26, 2008
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.