2
\$\begingroup\$

Is there a more elegant and/or simpler method to model a repeating, damped sinusoid from SPICE or LTSpice rather than chaining the damped SINE sources in series? Below is a schematic and the waveform I am attempting to recreate ad infinitum.

I'm attempting to simulate switching noise from a DC/DC converter from within LTSpice. The area of interest is the PCB parasitics which cause a repeating, damped sinusoid superimposed on the switching frequency output ripple.

The only method I have found to model a repeating, damped sinusoid is to use a series chain of SINE sources, each offset in time by 1/2 the switching frequency, and include a damping factor for the decay. For a short chain length this is manageable; however for a longer transient sim, the thing would become unwieldy.

Any ideas how to make this repeatable forever?

Chain of repeating damped sinusoids

\$\endgroup\$
  • \$\begingroup\$ You could try an LCR circuit of some sort and use a square-wave on it. Rising edge will produce a decayed ringing and ditto trailing edge. \$\endgroup\$ – Andy aka Apr 21 '14 at 18:23
  • \$\begingroup\$ Tried that, and although it does work, creating different rising and falling edge oscillatory behavior proves to be difficult. My insticts tell me there must be a way to simulate a (for ..) loop inside LTSpice or at least set up behavioral voltage sources to repeat a certain time segment of another source over and over again. \$\endgroup\$ – smoothVTer Apr 24 '14 at 18:45
  • \$\begingroup\$ You can create different falling edge ringing frequencies and damping ratios by using a switch contact triggered on the falling edge. \$\endgroup\$ – Andy aka Apr 24 '14 at 19:20
5
\$\begingroup\$

[Sorry for the necromancy]

Even if it has been answered, there is a much simpler, better, and faster way to do it:

damped sinusoid

V2 acts as a control source who outputs pulses with very narrow Toff. V1 has the trigger keyword which allows an external source turn on V1 when V(ctl) >= 0.5 and off when V(ctl) < 0.5. The trigger voltage can also have a specified value, for example [...] trigger V(ctl)<1.3. This provides an exact sine with an exact 1-exp(-x) decaying shape, set in V1.

\$\endgroup\$
5
\$\begingroup\$

This should be possible with arbitrary behavioural voltage sources. For a linear dampening you just need a modulo and a sine function. Sine is fortunately already there, just modulo must be defined on your own:

.function mod(x,y) { (x/y)-int(x/y) }

You can then set your voltage source to

V=(1-mod(time*100,5))*sin(time*1000)

and this will produce:

enter image description here

If you need this more often you can make your own function that takes sine frequency and cycle as a parameter.

A little more complex this could be

V=sinh((1-mod(time*20,5))*5)*sin(time*1000)

which will produce

enter image description here

If you need more complex dampening behaviour, simply setup another voltage source that has this behaviour and use that voltage as a multiplicator for a sine wave.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.