Phantom Current? SOLVED

Am I doing something wrong or is this a bug?

With the switch open, hit the "Run DC Solver" button (in Simulate) and AM1 reads zero and AM3 indicates a 200uA phantom current. It seems to me that AM1 should read 200uA, and AM3 should read 0.

by ReverseEMF
December 03, 2012

Same thing happens if I take out the voltage sources:

by ReverseEMF
December 03, 2012

Getting similar weirdness with the final circuit: But, if I replace the 1V battery with a 5K resistor, I get expected results:

BTW: I get EXTREME weirdness if I change R2 from 2.4K to 2.35K:

In all cases, Run DC Solver to get see what I'm talking about.

by ReverseEMF
December 03, 2012

Hmm, I’m a newbie, don’t know what “DC Solver” really should do …

But obviously a CL bug is involved:

Your “final” circuit is too complicated for me, I take your second (only the battery) for troubleshooting:

  • simply delete the switch, should be the same result - but isn’t.

In fact, the Solver reports a diffuse problem. Short circuit your “I1” current source (e.g. close the loop to ground), now it works.

Again, I’m not sure what you want and if the DC solver would be doing what you expect …

Regards, Sancho

by Sancho_P
December 03, 2012

It's not really a bug.

It's a failure of CL to give a meaningful error message.

You cannot model this circuit in a simulator as originally drawn and expect to get sensible results.

In a simulator an ideal current source is an ideal current source. Set it to XmA and it will push XmA through any load. If that load is an open circuit - i.e. your switch - then the current source will push XmA through it.

Therefore the voltage across the switch will rise to X*Roff where Roff is the off resistance of the switch.

Now In CL, Roff is not clearly specified (though as we'll see, you can estimate it) but whatever, what's happened is that CL has lost it's marbles trying to calculate the voltage at the SW1.nSW1_COM node of the switch (junction of I1 and SW1). This voltage has probably gone over the top end of the CL dynamic range and caused an error which is then not clearly reported to the user.

Connect a 1G Ohm resistor from SW1.nSW1_COM node to ground and suddenly CL is happy and gives a sensible result:

Note the 400kV at the SW1.nSW1_COM node: 1GOhm*400uA = 400kV

Also note that the current into SW1, I(SW1.nSW1_COM), is 800pA but the current out of SW1, I(SW1.nSW1_A), is only 400pA.

This implies that this CL switch in the off setting, has a resistance of 0.25E15 Ohms from SW1.nSW1_COM to an internal node then a resitance of 0.5E15 Ohms from the internal node to ground and another 0.5E15 Ohms from the internal node to SW1.nSW1_A.

It is not surprising that CL gets in a tizz with such ridiculously high values.

spice normally limits resistances to less than about 1E12 (actually it's a conductance Gmin and is normally set to 1E-12).

If a simulation fails, the classic first remedy is to hang 1G resistors (in fact older advice used to be 1M!) from high impedance nodes to ground.

See:

Chapter 8 of:

http://www.simetrix.co.uk/Files/manuals/7.0/SimulatorReference.pdf

and:

http:///index.php5?title=Convergence_problems%3F

by signality
December 04, 2012

That's one bad-a$$ current source! I forgot that this is the sim-universe where you REALLY get what you ask for :D

It would be really cool if CircuitLab actually showed the arching across the switch!

by ReverseEMF
December 04, 2012

Oh no .... not another Virtual Realist!!!!!!

:)

by signality
December 04, 2012

Hahahaha! ;-)

@Signality:

Sorry, I’ve to smile when reading your technically perfect attempt to cover what I call a bug. ;-)

“It is not surprising that CL gets in a tizz with such ridiculously high values.”

Well, there’s an excuse for everything, if you want.

The bug is not the missing error message. There are many of them missing in CL.

The problem is to see an open switch not simply as what it is:

  • An open switch.

In this case it might be obvious, but next the solver won’t find an end or come up much later with something like “type mismatch” or “NaN”.

But with the (irrelevant and misleading) error message you’d call it a bug then?

A simple plausibility check must find such problems before starting computing and give at least a warning to acknowledge, so the user knows about some basic problems which the solver may have to guess about.

CL has such a function, but it’s incomplete. Here’s the bug.

(BTW: Your links give some insight, thanks!)

by Sancho_P
December 04, 2012

Maybe a selectable "mode" could be added: A "Rigorous" mode and a "Real World" mode.

by ReverseEMF
December 04, 2012

@ReverseEMF:

“A "Rigorous" mode and a "Real World" mode.”

would be definitively worth thinking about!

@Signality:

I’m afraid only a few read documentation nowadays :-(

Regards, Sancho

by Sancho_P
December 05, 2012

Post a Reply

Please sign in or create an account to comment.

Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.