Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - Inductor reset is silent: energy conservation violated without warning #971

Open
calimeroteknik opened this issue Nov 21, 2024 · 0 comments

Comments

@calimeroteknik
Copy link

I noticed an energy conservation issue in this trivial circuit:
LSB
We can observe that when the switch is closed then opened, it dissipates no power; so where has the energy gone?

Thinking what should happen: if all components are ideal, we would get infinite voltage across the inductor.
Which means "overvoltage" in this simulator, and would typically halt the simulation.

Investigating the reason for the present behaviour of the simulator, a clear trend emerges:
#799 :

It seems that the simulator can't find a current path for the inductor, so […] it resets the inductor.

#675 :

The simulator doesn't think one of the inductors has a current path, so it zeroes out the current. […]
There is probably a better way to fix this.

I suggest that a better way to fix this is to interrupt the simulation. Teleporting it silently to a different state isn't a good idea!

It could be as trivial as a pop-up that says it happened, so that at least the physics law violation isn't happening silently.
I think the patch is something trivial like:

+alert("Resetting inductors because no current path was found. Energy conservation will break.")`

The helpfully informed user can then reflect upon his design choices, or insert a MΩ resistor, pF capacitor or such, to simulate the real circuit better in such a circumstance if desired!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant