phetsims / circuit-construction-kit-common

"Circuit Construction Kit: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
10 stars 10 forks source link

Perpetual Current possible with Parallel inductors #774

Open ariel-phet opened 3 years ago

ariel-phet commented 3 years ago

I have seen several cases of this issue in my testing (basically seeing some kind of perpetual current in parallel inductors), but here is the way I was able to reliably reproduce it.

Possibly related to https://github.com/phetsims/circuit-construction-kit-common/issues/772

I was using testing link https://phet-dev.colorado.edu/html/circuit-construction-kit-ac/1.0.0-dev.45/phet/circuit-construction-kit-ac_en_phet.html?capacitorResistance=1E-4

Basically set up the circuit shown in the video with two parallel inductors. I used Inductors: 0.100 H Battery: 10 V Resistor: Initially set to zero Ohm

Once you set up the perpetual current behavior in the inductors, you will see odd behavior even if the resistor is brought to a value above zero.

This might take a couple of tries to work, but I could reproduce reliably. Basically let current flow in the circuit until it reaches a very high current (about 5-10 secs), isolate the inductors by opening the top switch, then short the inductors by closing the bottom switch. After that, odd behavior persists

https://user-images.githubusercontent.com/4051174/140679877-fe901c20-60a7-45b7-aac1-894163d98cc6.mp4

samreid commented 3 years ago

Can you speculate about the cause of this problem? Does increasing the inductance mitigate the problem? Do we need to add a rule for when to clear inductor internal state? Right now, inductors are cleared at the end of any time step in which both the start and end vertex have 0 adjacent circuit elements with current >1E-4.

ariel-phet commented 3 years ago

@samreid, do inductors have a minimum internal resistance (like capacitors which we just raised). I could see some funky behavior potentially being linked to inductors having too low of a default resistance.

samreid commented 3 years ago

Currently, capacitors have an internal resistance of 1E-4, but inductors do not have any internal resistance. Should we try adding that?

arouinfar commented 3 years ago

@samreid yes, let's try adding internal resistance to the inductors. I'm not certain what the value should be, but we could start with a value that matches batteries (1E-6) or capacitors (1E-4). Can you hook it up to a query parameter?

samreid commented 3 years ago

Following the pattern established with capacitor internal resistance, I added inductor internal resistance and it can be tested in this dev version: https://phet-dev.colorado.edu/html/circuit-construction-kit-ac/1.0.0-dev.47/phet/circuit-construction-kit-ac_en_phet.html. @arouinfar and @ariel-phet please test with a few values of ?inductorResistance such as ?inductorResistance=10 to sanity test that it is behaving as expected, before testing in the context of this issue.

UPDATE: Please test in the newer version: https://phet-dev.colorado.edu/html/circuit-construction-kit-ac/1.0.0-dev.48/phet/circuit-construction-kit-ac_all_phet.html

ariel-phet commented 2 years ago

@samreid I verified the query parameter is working as expected, however, this perpetual current still occurs using inductorResistance=1E-3 which is already too high to be viable (you start to see that level of resistance damping out current in a resonant circuit)

The threshold appears to be ?inductorResistance=.1 to remove the unwanted behavior from occuring, so I think we will need to pursue another route.

samreid commented 2 years ago

I've watched the video several times, and what would be most helpful to me is a description of the behavior that is odd, and what the expected behavior is instead. Is it something like this?

  1. (at 13 seconds) Expected behavior: the current flows to the right through the inductors. Actual behavior: the current flows to the left through the inductors
  2. (at 25 seconds) Expected behavior: the current flows to the left through the inductors. Actual behavior: it flows to the right through the inductors

I'm mostly guessing here, please help clarify what is expected and what is odd.

samreid commented 2 years ago

@arouinfar and I reviewed the circuit in question (with the inductor resistance of 1E-4) and we saw the perpetual motion in the inductor loop. However, we inspected the current at runtime and found the current was dying off. For instance, in one frame, the inductor had a current of 0.2982546789693879 and in the next frame it was 0.2982499213266419, so it reduced by 0.000004757642745989443 between these frames. We also noticed buggy current directionality in the original movie https://github.com/phetsims/circuit-construction-kit-common/issues/774#issue-1046977311 but did not see any errant current directionality when we tried to reproduce the problem, perhaps since we now have the inductor resistance. @ariel-phet can you please review and advise?

ariel-phet commented 2 years ago

@samreid @arouinfar I included the odd changes in current directionality in the video just as an further example of odd behavior.

I should make clear that the main issue is the you in essence get a DC current running through the inductors with no voltage source. The inductors do not appear to be clearing and discharging the way we would expect when the circuit is open. The physics just seems quite off as the inductors are "holding onto" a large amount of energy even with the circuit open.

samreid commented 2 years ago

There is a proposal in https://github.com/phetsims/circuit-construction-kit-common/issues/780#issuecomment-971149638 for an exponential damping term that seemed to help in a similar case.

UPDATE: That damping did not work.

Our hope from #780 is that a larger set of Henries will address this problem.

samreid commented 2 years ago

We would like to try higher resistances in the wires to see if it reduced the problem? But @kathy-phet says the priority is getting the sign changes fixed. If some corner cases like this have bad behavior, we may have to list it as a known issue.

We discussed changing the design so that there is just one inductor--if that solves enough of our problems we may go forward with that for 1.0

@samreid will also check if there is a sudden spike in the inductor values that is causing the problem.

We would like to go to 1 inductor for now. We will add a query parameter. ?moreInductors

samreid commented 2 years ago

After the commit, the default is 1 inductor. The ?moreInductors query parameter brings it back to 10.

UPDATE: Can you please test in https://phet-dev.colorado.edu/html/circuit-construction-kit-ac/1.0.0-dev.51/phet/circuit-construction-kit-ac_en_phet.html

ariel-phet commented 2 years ago

@samreid the query parameter ?moreInductors acts as expected. I recommend marking this issue deferred (since we may at some point want to address the issues with multiple inductors). I have removed it from the 1.0 milestone since it should likely remain opened (but deferred) and is not needed for this milestone.