Current miscalculation and RL circuit

  • Hello. I'm analyzing the next circuit

    Here is the equations that describes the current probe.

    Before t=1s, the equation gives the same values for the current probe. But, at t>=1s don't. I know that inductor current's can't change abruptly and my equations are correct though these ones no describes strange current behavior after 1s given by Qucs. I think switches are causing this. Is it a bug or I'm doing something wrong?

  • Richard C
    Richard C

    As far as I can tell your equations give roughly the same result as Qucs, see attached figure produced using the following Matlab/Octave code:

    t = linspace(0, 1, 25);
    t = [t, linspace(1 + 1/100, 6, 100)];
    i1 = (1/6) .* (1 - exp(-t));
    i2 = 0.5 - (1/3) .* (exp(1) + 0.5).* exp(-t);
    plot(t(t<=1), i1(t<=1), t(t>=1), i2(t>=1))
  • At t=1s my equations gives i = 105.35mA and Qucs gives i = 107mA. Please check again.

  • Guilherme

    If you reduce the step size from 250ms to 125ms; i(t=1s) = 106.16mA.
    If you reduce the step size from 125ms to 65.2ms; i(t=1s) = 105.86mA.
    If you reduce the step size to 15.625ms; i(t=1s) = 105.72mA.
    You get the idea. The more detail you ask (finer timestep) the more accuracy (and longer run time) you get.
    It is up to you to define how close is close enough.

    The transient simulation advance in timesteps, the smaller step the more accurate the simulation becomes. With large steps error quickly builds up as it is accumulated.

    Note that you can select the current on the tabular diagram and ask for more digits of precision.

    Last edit: Guilherme 2013-10-09
  • Ok, thank you! I didn't know about timestep and a better precision.