AC simulation oddities / question

So I have this test setup, which is derieved from another project where I want to visualize the susceptibility of the circuit to small signal noise on the power supply rails.

What I do not quite understand, is how ngspice (correctly) calculates the low signal level across C1 and C2 (purple line, hides the green line for C1 as they are identical), but then goes right ahead and claims that the power supplies V1 and V2 (+18V and -18V) - which should be ideal with 0 ohm source impedance - each have the full AC signal of V3 on their outputs…

What does ngspice do here, that I don’t understand and don’t expect from an electrical circuit standpoint?

KiCad_test_20230724.zip (7.1 KB)

This is probably a bug in Eeschema.

If you add

.control
set controlswait
print v(+18v) v(net-_r4-pad2_ )
.endc

into a textbox on the Eeschema canvas, you will see that ngspice prints 0 for the real and imaginary values of v(+18v), Eeschema however plots 0dbv. v(net-r4-pad2 ) has just been added to check that printing data is o.k… However dbv(0) is invalid anyway, so what to do?

1 Like

It is, in other words, an analoguous case as “NaN” in any spreadsheet or mathematical software (Octave etc.). I guess the best - at least from my point of view as a user - would be to add / report the “special case” of “no signal” in the list of signals, so it is obvious and easy to understand.
At least 0 dBV is not correct, as it suggests that there is indeed a (quite large) signal.

I had a slight suspicion there was something strange going on, many thanks for explaining what it was!

Issue reported here:

Set the source(s) for e.g. AC=0.0000000001 or similar to defeat the “odd” behaviour, you claim. I guess you know, that 10 Ohms versus 0 Ohms is pretty useless, don’t you?

P.S.: Mike told me “Spice is 99,9999999% correct” - and yes: i never found one single bug in LTspice. Mostly - its syntax misunderstandings. Do not give up… :wink:

I do not understand this comment.

AC simulation is done on a linearized circuit (at the chosen operating point). Any output measured is to be seen relative to the input. Thus selecting AC 1 makes this division (output/input) as easy as possible. If the output is 0, it stays 0, as for unconnected nodes or voltage sources with zero internal resistance, one terminal grounded.

Thus the correct way is to report this bug (0dbV plot output when ngspice is reporting 0) as a plotting bug to the Eeschema maintainers, as has been done above by hmk. Standard ngspice bails out with an error message when forced to calculate log(0) by a plotting command.