So I'm trying to make the following simulation work properly to verify some hand solving for a circuit. The circuit is an LC tank with some diode clamping, and an initial capacitor voltage of -50V.

I tried both with and without a switch to see if that helped...it didn't.

attempt1 attempt2

Solving for this by hand I expected to see around 300A as the initial surge current, but it's up in the high kA range in the simulation. I know this can occur with LTSpice time base errors, but here's the stranger part

I had it working fine, then accidentally didn't save the changes. Now I can't make it work properly for some reason. I've tried:

  • all the integration modes
  • normal/alternate solver
  • Taking the maximum timestep all the way down to 1E-12...took forever but it didn't help.

Nothing seems to make this simulation behave properly. Is there anything else I can try? I don't know why it isn't working now as opposed to earlier.


  • 2
    \$\begingroup\$ To help yourself and us, please note the following: 1) LTspice understands "100uF" and such. Engineers use this, academics without a soldering iron may use the exponential form. :) 2) LTspice "randomly" reassigns unnamed nodes. You can label a node by pressing F4 and then put a name where you want it. Then you can make sure that an expression such as V(N006) does not move around after you change the circuit. \$\endgroup\$
    – pipe
    Dec 20 '15 at 23:36
  • \$\begingroup\$ Also note that V1 as it currently sits, has a series resistance of 0.000 Ohms. That of course means, it can source unlimited current. Right-click it and set a series resistance of a more realistic \$R_{SER}\$. \$\endgroup\$
    – rdtsc
    Dec 21 '15 at 0:18
  • \$\begingroup\$ And it may be easier on you (and us) to use engineering units instead of exponentials. "1E-3" = "1m". "25E-6" = 25u. (Since most keyboards don't have a key for the Greek µ or "mu", the "u" works instead.) See Engineering Notation for more info. \$\endgroup\$
    – rdtsc
    Dec 21 '15 at 0:29
  • \$\begingroup\$ I'm familiar with how LTSpice handles SI prefixes, I'll start using them more. I also added the node label, just didn't think to use them here. Thanks for the reminder. I set it to 1ohm series resistance and it didn't really help. \$\endgroup\$ Dec 21 '15 at 0:40
  • \$\begingroup\$ Which nodes are N0004 and N0006? \$\endgroup\$
    – The Photon
    Dec 21 '15 at 1:17

Suffixes in LTspice are not case sensitive, so your switch's off resistance Roff=1M is actually 1 milliohm not 1 Megohm. Change it to Roff=1Meg and it will work.

Without a switch you get several thousand Amps because the initial conditions are calculated at DC and inductors are considered to be short circuits. The inductor in your circuit has close to 150V across it, so the initial DC current is very large.

  • \$\begingroup\$ I had forgotten about the case sensitivity, thanks for reminding me. What I'm finding strange about the current is that it's way larger than what the hand done math says, which I've checked against the answer key, by an order of magnitude. It's near 300A according to the equations. \$\endgroup\$ Dec 21 '15 at 6:40

I actually got the numbers to make a bit more sense, although I don't fully understand why. I set the simulation options to not do an initial operating point solution and suddenly the currents started to match my hand calculations.

In addition a total summary of the fixes that were contributed by folks here:

  • @bruce-abbott mentioned that the SI prefixes aren't case sensitive, so my switch off resistance was really low.
  • Several folks reminded me to use actual SI notation for clarity instead of exponential

So thanks to all for those tips. I don't yet have a precise understanding of why skipping solving the initial operating point fixed the issue, so for now I guess it's just another thing to try if the numbers don't make sense.

DC Operating Point Results:

V(n002): 100 voltage V(n003): -49.5131 voltage V(vo): -50 voltage V(n004): -125 voltage V(vcap): -50 voltage V(n001): 0 voltage I(C1): -5e-015 device_current I(D2): -7.501e-011 device_current I(D1): 1.49528e-006 device_current I(L1): 1.49521e-006 device_current I(S1): 1.49528e-006 device_current I(V3): 0 device_current I(V2): 7.50191e-011 device_current I(V1): -1.49528e-006 device_current

EDIT: The initial dc solution started the input current at a high value because the operation treats inductors and capacitors in their DC forms as open circuits and shorts.

  • 1
    \$\begingroup\$ There may be a clue in what the initial operating point actually shows. You many already know how to get that, but just in case, replace the simulation command with ".op" (without the quotes) and see what comes out. \$\endgroup\$ Dec 21 '15 at 7:38
  • \$\begingroup\$ I edited the DC op values into my answer so they were formatted properly. A first glance nothing is out of place, there's the usual leakage currents through the diodes and switch, but nothing crazy. \$\endgroup\$ Dec 21 '15 at 8:24
  • 1
    \$\begingroup\$ .IC sets initial conditions to their DC values (ignoring inductance and capacitance). You have +100V going into D1 and -50V at n006. The inductor has a resistance of 1 milliohm. What current do you think this will produce? \$\endgroup\$ Dec 21 '15 at 16:22
  • \$\begingroup\$ Right...it ignores the inductance and capacitance. So that'll stuff the current up to 150/0.001 = 150kA Thanks for pointing that out, good thing to keep in mind for future. \$\endgroup\$ Dec 21 '15 at 21:43

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.