Closed KatieWoe closed 3 years ago
Nice find @KatieWoe!
Since the published version doesn't have a pause button, it is hard to tell if this bug exists there, but it doesn't look like it.
Definitely looks like charge isn't being conserved here @Denz1994. Moving the plates while the sim is paused should never affect the amount of charge. While discharging, the charge on the plates would exponentially decay.
@arouinfar I believe this issue persisted in the published version. You see the change when following the steps without pausing, but it is a lot less apparent.
The top plate charge only updates when the capacitor is connected to the battery. @arouinfar Please double check that this behavior is correct in master.
@Denz1994 master still looks off to me.
When the capacitor is disconnected from the battery, changing its capacitance results in a change in the voltage (Q is conserved and Q = CV). Here, decreasing C results in proportionally increased V.
Similarly, when connected to the bulb, changing C should create an instantaneous change in V. Here, decreasing C from 1.77 pF to 0.35 pF should have increased the voltage from 1.5 V to 7.5 V, resulting in a larger halo. Instead, the voltage remains 1.5 V, and the charge is instead reduced.
If you run into any questions, or would like to discuss over Zoom, please let me know.
this.capacitor.discharge( )
was is responsible for updating the inverse relationship between capacitance and voltage, when the light bulb was connected. This function was being called during step()
so when the sim was paused this wasn't being handled.
The capacitor now discharges when the plate geometry changes which should maintain conservation of charge. @arouinfar could you confirm in master?
Looks great @Denz1994!
May be connected to https://github.com/phetsims/capacitor-lab-basics/issues/259. As such, will leave up to @Denz1994 on whether this is fixed/whether to close
The changes in https://github.com/phetsims/capacitor-lab-basics/issues/259 should not have affected this, though closely related. This issue should be verified by QA to ensure it is resolved.
This seems to occur under more specific circumstances now. A bit harder to reproduce now.
Edit: It seems that just adjusting the charge with the battery while paused will cause this.
Removing the ready-for qa label.
Great find @KatieWoe.
@Denz1994 it looks like the plate charge isn't getting properly stored/updated on pause.
After much digging, it turns out that capacitor.discharge() should not be used when dragging the plate area and separation arrows. It causes the capacitor to leak voltage and produced a side effect where the charges could be built up to indefinitely when swapping to an open circuit.
The voltage is now explicitly set using Q=V/C when dragged. This prevents charges from being lost and the voltage drops or increases accordingly.
Not fixed. Now, you must pause the sim, switch to light bulb, move the plates, and then step through while paused. https://github.com/phetsims/QA/issues/349
Edit: Also happens if you step through first, then adjust the plates.
https://drive.google.com/open?id=1-8shThGK3r3NfECoiMY9IpNRyc2rRm9q
Some more strange behavior if you pause the sim after switching to the lightbulb, and then move plates closer while paused. Top plate charge will jump back up to what it was before connecting to the lightbulb (0.27 in this video).
One more oddity here. When making the plate larger and smaller or changing distance while discharging the charge jumps up and down. But I've only seen it so far on IE Win 7. Wondering if this is due to performance or something with IE. Edit: Went back to check other platforms. Seems to happen on IE, Edge, and Safari.
In master when doing ES6 Testing. Moving the plates when not connected to the battery or bulb makes all the charge go away when on the light bulb screen. If the plates are close enough together charges come back, but behave as if the plates are connected to the battery.
Instead of setting the top plate charge when the capacitance changes, the charges are discharged. This bug was introduced when trying to explicitly set the capacitor charge when the plate geometry or separation changes. I've reviewed this briefly with @arouinfar but she will review further in this RC version.
@Denz1994 looks good in rc.4
This still seems to be broken as of https://github.com/phetsims/QA/issues/565. By following the steps laid out in the comment above.
This seems to occur under more specific circumstances now. A bit harder to reproduce now.
- Go to the light bulb screen
- Add charge to the plates
- Select the check box for reading the top plate charge (easier to see change)
- While battery is still connected change either the area or distance of the plates
- Pause the sim
- While paused, switch to the light bulb connections
- While still paused, move the plates closer/further away or bigger/smaller
- The instant you do that the amount of charge will change. It will stay at the same charge with further movement
Edit: It seems that just adjusting the charge with the battery while paused will cause this.
Removing the ready-for qa label.
Currently. using the switch still causes a jump in top plate energy if the sim was paused while the plates were adjusted.
A patch was made to remove explicitly setting the discharge parameters when the geometry changes. This should be handled by discharging. This is more apparent when we can pause because discharging happens during the step. Can you verify this is fixed in this version @loganbraywork?
It now seems to be back to the original behavior where it changes when the plate is changed consistently. In fact, it seems worse since it doesn't jump back to correct behavior when you play/step forward. I also notice the play and step forward buttons are behind the light from the bulb now, making them almost impossible to use.
Charge is definitely not being conserved in master. For example:
I'm not always seeing as much as I saw in https://github.com/phetsims/capacitor-lab-basics/issues/256#issuecomment-712965729, and have some trouble reproducing to that degree for some reason. But even so I get a consistent one time jump when I start to move the plates.
The discharge model was simplified in the above commit. Also, the previousCapacitance
was being changed as a side effect of discharging but used elsewhere (see updateDischargeParameters
).
The steps in https://github.com/phetsims/capacitor-lab-basics/issues/256#issuecomment-710621089 should be verified by QA.
Things are looking good in rc.8 so far. Closing for now, but will keep an eye out and reopen if something reappears.
This has come back for https://github.com/phetsims/QA/issues/616 Steps:
Good find @CliffordH123. Looks like yet another regression @jonathanolson, so I'm wondering if we should pause/cancel this dev test.
@KatieWoe I believe this is fixed in master, can you verify?
Adding this to issues to verify on QA board
Looks fixed on master, Win10 Chrome.
This appears fixed as of https://github.com/phetsims/QA/issues/640 on Win 10 Chrome.
Test device: Dell and Jordan Operating System: Win 10 and Mac 10.14 Browser: chrome and safari Problem description: For https://github.com/phetsims/QA/issues/306, may be connected to https://github.com/phetsims/capacitor-lab-basics/issues/234. When the sim is paused and discharging, moving the capacitors seems to make the amount of charge change. This should not be possible, and steping forward one step causes the charge to jump to the correct amount. Steps to reproduce:
Screenshots:
Troubleshooting information (do not edit):