sharpie7 / circuitjs1

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

Bug - Current from nowhere #522

Closed nietamten closed 3 years ago

nietamten commented 3 years ago

https://tinyurl.com/y3sx3jy2 When the switch is closed and the simulation is restarted, the results are correct but switching twice causes the simulation to be in a bad state. More minimal example: https://tinyurl.com/y2thq9bq

pfalstad commented 3 years ago

The problem is that the op-amp is drawing current from ground, but there's no ground in the circuit, so the simulator has to assume a ground node and draw current from there, which looks weird. If you add a ground somewhere, it will look right. I'm not sure what to do in this case. Op-amps probably shouldn't be created in circuits with 2-node voltage sources and no ground. They have a hidden connection to their positive and negative supply voltages, so they can seemingly create current out of thin air.

nietamten commented 3 years ago

I don't know much about electronics and op-amps, I'm just a guessing. I think it works as expected after such changes: https://tinyurl.com/y5z3lrc2

nietamten commented 3 years ago

Workaround is sufficient for me.