sharpie7 / circuitjs1

Electronic Circuit Simulator in the Browser
GNU General Public License v2.0
2.29k stars 633 forks source link

SCR followed by resistor fails to converge; converges with just wire #851

Open nabijaczleweli opened 1 year ago

nabijaczleweli commented 1 year ago

https://user-images.githubusercontent.com/6709544/225696273-3fe00460-3c9f-42c7-8669-a7db667ce461.mp4

Minimal circuit (resistor value doesn't matter, nonexistence of the gate resistor also doesn't):

$ 65 0.0000049999999999999996 10.20027730826997 50 5 50 5e-11
177 416 48 480 48 1 0.6138908161995182 1.7000000000000002 0.000049999999999999996 0.002 50
R 416 48 416 16 0 0 40 5 0 0 0.5
R 480 -32 448 -32 0 0 40 3.3 0 0 0.5
g 528 48 544 48 0 0
r 480 48 528 48 0 2200
s 480 16 480 -32 0 1 false
o 3 64 0 4099 0.0000762939453125 409.6 0 2 3 3

When you toggle the switch, the simulator crashes into "Convergence failed!". If you replace the resistor with just a wire, it behaves as-expected and ~infinite current flows.

I played around with it, and if you increase the top voltage to 4.5V it starts to converge again (but the time step becomes 76ps).