Adding a 0V source in series with a behavioral current source causes a timestep too small error.
If Voff4 is removed and replaced with a short the circuit simulates normally. I discovered this while troubleshooting a timestep too small error I see when using ".probe alli".
Using the listing command I noticed another quirk in that "probe alli" is adding 0V sources in series with voltage sources. This seems redundant.
Latest ngspice from git. Linux Debian 13.
Edit: Please ignore this comment; not removed, because the thread has moved on. The 'let' command below gives an incorrect result because '>' is interpreted as output redirection! Using the alternative 'gt' and 'lt' comparisons removes the anomaly.
There is a problem, but it is almost the inverse of this report's title. The added source seems to uncover it: an invalid DC solution. To show that, add some currents to .save:
The reported currents do not match the expression for the current source, evaluated from the DC solution. This may be a limitation of behavioural sources rather than a bug.
Last edit: Giles Atkinson 2026-02-02
I have removed a redundancy (voltage source in series to B voltage source) in pre-master-46. There might be more, needs to be checked.
Is there anything I can do to assist debugging this?
My personal view: not unless you want to dig into the code. I have looked a bit more and found one bug: the convergence test for B-sources is ineffective. A fix was already proposed as part of Patch #121, but applying that does not resolve the problem,
I have just noticed the comment on Bug #695 (Patch #121 is a proposed fix for that):
Workaround:
NGSPICE always checks for convergence of currents through linear voltage sources, so if this bug ever does cause a problem, we can add a 0V voltage source in series with the nonlinear device where we need convergence.
The implication is that some netlists may appear to succeed when they should fail, and can be made to fail by adding a voltage source. The circuit above might be an example.
After some more testing, there is indeed no DC solution at T=0 but that it not detected because the voltages can approximately converge, while there is no valid solution for the B-source current. With the extra V-source a new node representing the current is checked and the circuit fails. Applying Patch #121, DC fails, the Optran method finds an operating point, but Transient fails when Vsoc falls past one.
Given the very discontinuous nature of the current source, failure seems the correct behaviour.