EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: Erikkssen on May 17, 2020, 06:16:23 pm

Title: LTspice transient analysis simple R-L series but abnormal current.
Post by: Erikkssen on May 17, 2020, 06:16:23 pm
Hi everyone,

just a small question. When i started transient analysis in LTspice with 0 deg phase Vsin generator then everything is fine (probably). but when i started with 90 deg phase then the current suddenly jumps over 30A. Where i wrong ? (see the attachment) 
Thanks for any advice.


   
Title: Re: LTspice transient analysis simple R-L series but abnormal current.
Post by: jmelson on May 17, 2020, 06:46:02 pm
Well, first think is to remember that SPICE (any version) is pure math.  Put a 1 V source into a 0.001 Ohm resistor and you get 1000 Amps.

With the 90 degree start angle, you start up wth the sine source at the voltage peak.  I think the issue is that the initial condition is then determined to be 30 V with 1 Ohm resistance into a short, or 30 amps, so the initial condition for the inductor is set to 30 A at T=0.  That long declining exponential is the current decaying through the 1 Ohm resistor.

Jon
Title: Re: LTspice transient analysis simple R-L series but abnormal current.
Post by: TimFox on May 17, 2020, 07:24:10 pm
With the initial phase at 90 deg, the waveform jumps abruptly from 0 to positive peak voltage, which (in a perfect loss-less inductor) would cause an infinite current.  As pointed about above, the actual initial current is limited by the resistance of the inductor, which is why Spice will return an error if you attempt to apply a voltage to a pure inductor (without series resistance).
Title: Re: LTspice transient analysis simple R-L series but abnormal current.
Post by: T3sl4co1l on May 17, 2020, 07:58:26 pm
More precisely, it's startup conditions.  SPICE performs a DC Operating Point Analysis, as a starting point for Transient Analysis.

It's not "just math"; we might approach this problem analytically by using a literal sine wave, i.e. it persists from time negative infinity to positive infinity.  In that case the phase makes no difference, and the current is always simply whatever is a consequence of that voltage (i.e. the cosine).

Indeed, you get exactly these results from an AC Analysis.  Which doesn't even present the results in terms of waves, because that's completely redundant information -- the graph of a sine wave contains no more information than its phase and amplitude, no matter where and how you look at it (keep this in mind for simple transient simulations like this!)  Rather, it gives you just that: the phase and amplitude.  There's nothing more you need!

And since it's such a simple calculation, you can perform AC Analysis over a series of frequencies, and plot the resulting frequency response (really it's just calculating each point independently, but we understand them to be a series, given certain assumptions; namely, that the frequency response is changing smoothly at the rate we are sampling it).

Alternately, we could do the analysis assuming no signals for t < 0, which we might approach using the Laplace transform of sin(wt + phi) U(t) (U = unit step function).  Here there will be two components, one a decaying exponential corresponding to the L/R time constant (or a DC offset if R = 0) and depending on the phase, and the sinusoidal component (times U(t)) that we expect.  The offset or exponential arises from the first half-cycle delivering unbalanced flux (for R = 0, any time the voltage does not start on a +/- peak).

Or in terms of differential equations, we get a superposition of the homogeneous (natural system) response, the exponential decay; and the inhomogeneous (driven) response, the sine wave.

But this too is not what you are seeing here.  The time constant is correct (of course), but the magnitude is terribly far off.


What's actually happening is this:

SPICE is assuming DC values, i.e. V(t < 0) = 30V, and calculating DC current accordingly (I_L = (30V) / R).  Then when the transient simulation starts, for t >= 0, it sets V = SINE() function as given, and the timesteps are calculated from there.  Transient simulation makes no assumptions about what the components are, it just lets the system evolve over time.  (Which can generate peculiar errors in linear systems like these -- namely that the gain can be greater or lesser than 1, when it's supposed to be merely very close to (but still less than) 1.  This is effectively due to the accumulation of millions of rounding errors, so, what do you expect, it's trying its best!)

If we wish to see the phase-sensitive case, we must tell SPICE to skip the DC op step, or set everything to zero.

We can do this in SPICE settings: tick "initial conditions: set to zero" (or whatever it's labeled as exactly, I forget).

Or we can force specific state variables* to zero: open the inductor's property dialog and set initial current to zero.  (Some simulators, you may have to enable "use initial conditions", which will also have the effect of setting all other components to their default initial condition of zero...)

*State variables, components which store or remember some state -- namely inductors and capacitors, but also Laplace blocks (if applicable), digital logic to some extent, transmission lines, and custom components with memory.

Tim
Title: Re: LTspice transient analysis simple R-L series but abnormal current.
Post by: Erikkssen on May 19, 2020, 07:34:54 am
Thank You very much ! Solved with : "Skip initial operating point solution" (LTspice) and "Skip the initial transient bias point calculation (SKIPBP)" (Pspice).
Bye.