phetsims / capacitor-lab-basics

"Capacitor Lab: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 4 forks source link

Total energy not updated correctly when plate distance changed and sim is paused #284

Closed loganbraywork closed 3 years ago

loganbraywork commented 3 years ago

Test device

Windows 10 Laptop

Operating System

Windows 10 ver. 1909

Browser

Chrome Version 89.0.4389.90

Problem description

For https://github.com/phetsims/QA/issues/616

This seems to be similar to the closed issue https://github.com/phetsims/capacitor-lab-basics/issues/256. If the sim is paused and the distance between the plates is changed while connected to the battery, then changed again while connected to the light, the total energy seems to change inconsistently with original total. This works in regards of both adding energy or subtracting energy. If it is more efficient to reopen the original issue feel free to close.

Steps to reproduce

  1. Enter the Lightbulb screen
  2. Check the Top Plate Charge and Stored Energy checkboxes
  3. Pause the simulation
  4. Add a charge to the Battery
  5. Change the distance between the plates while still attached to the battery,
  6. Attach the plates to the light
  7. Change the distance between the plates and the light
  8. Does not seem to consistently occur every time, and the above steps may have to be repeated two or three times for the issue to occur

Visuals Intended behavior vs Energy being lost by the bug 2021-03-17CapLabSaveEnergy

Energy added by the bug 2021-03-17CapLabAddEnergy

Troubleshooting information: !!!!! DO NOT EDIT !!!!! Name: ‪Capacitor Lab: Basics‬ URL: https://phet-dev.colorado.edu/html/capacitor-lab-basics/1.8.0-dev.5/phet/capacitor-lab-basics_en_phet.html Version: 1.8.0-dev.5 2021-03-12 18:59:17 UTC Features missing: applicationcache, generatedcontent, applicationcache, touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Language: en-US Window: 1536x754 Pixel Ratio: 1.25/1 WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium) GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 30 uniform: 4096 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32) Max viewport: 32767x32767 OES_texture_float: true Dependencies JSON: {}

KatieWoe commented 3 years ago

I believe total energy may be intended to change. @arouinfar would know better. But #256 does look like it is an issue again.

DevonQui commented 3 years ago

If I remember correctly, when you increase the distance between the capacitors work is being done so the total energy will increase but the charge across the capacitor should stay the same.

On another note, I did notice something interesting when looking at how the charge changes. With the default capacitor connected to the battery (1.5V) notice how the charge across the capacitor will be 0.44 pC. Now, with the battery still connected, increase the capacitance by decreasing the distance between the plates and increasing the area of the plates. The charge across the capacitor will also increase. Now pause the sim and connect the battery to the light bulb and separate the plates again. The charge will revert back to the default charge we observed in the beginning 0.44 pC. Maybe the charge bug has something to do with no deleting a previous state?

here's a video link to a visual: https://drive.google.com/file/d/11afChX2Q5T_6WB1TvsZ2n-OA5KH2PkdK/view?usp=sharing

loganbraywork commented 3 years ago

Oh, I just noticed that I used the same clip twice which was unintended, edited issue with better clip showing issue for energy added. I will also add that it seems that somehow the plates are able to jump back to a previous energy value it had at a previous distance while connected to the battery. This means that if the plate was extremely close and then moved further apart while connected to the battery, when it is connected to the light and distance is adjusted it should gain energy.

jonathanolson commented 3 years ago

I believe this was resolved by the work in https://github.com/phetsims/capacitor-lab-basics/issues/256, @loganbraywork can you verify?

KatieWoe commented 3 years ago

Adding this to issues to verify column of QA board

KatieWoe commented 3 years ago

Looks good on master from what I can tell. Closing