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

Current direction arrows fail to reappear when plates reconnected to battery while sim paused #285

Open loganbraywork opened 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

If the sim is paused and the plates are attached to the lights and then to the battery, the direction arrows will not reappear unless the plates are moved.

Steps to reproduce

  1. Pause sim
  2. Add charge to battery
  3. Attach plates to light
  4. Attach plates to battery

Visuals

2021-03-17CapLabNoArrow

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: {}

arouinfar commented 3 years ago

Thanks @loganbraywork.

This looks like a possible regression @jonathanolson. I remember catching a similar issue before, see https://github.com/phetsims/capacitor-lab-basics/issues/234#issuecomment-407852627 onwards.

jonathanolson commented 3 years ago

Is that really desirable? This would probably be a fairly significant change to the code, if we have to track things in a way to show this. My current understanding:

  1. We only start showing the arrows when there is a change in the current.
  2. Changing the battery causes an instantaneous change in current, which triggers the arrows.
  3. When the battery is connected to the capacitor AND the user isn't changing the battery, the current is ZERO.
  4. When the user switches from connecting the lightbulb and the capacitor in the above scenario, there is zero current change (and zero current).

However, if we want to TRY to track things more in the paused state, and show arrows for "the change between before we paused AND now" (which seems potentially confusing for students also), let me know. Might be good to have a discussion.

Thoughts @arouinfar?

arouinfar commented 3 years ago

Is that really desirable?

No, I misread the situation.

@jonathanolson your summary of the behavior is absolutely correct -- the current arrows should only show up if there is a change in the current.

In the scenario described by @loganbraywork, the voltage on the capacitor would not have changed between steps 3 & 4, so there would be no current arrows to display. If the capacitor had been discharged or its geometry changed, then switching back to the battery would reset the voltage across the capacitor and thus cause a change in current.

I spent some time in master testing various scenarios while the sim is paused. In general, the behavior is all looking good and the things that should update instantaneously do (charges on the plates, graphs, current arrows when dQ/dt is nonzero, bulb halo).

The one thing that looks off is the case described by @loganbraywork. If I follow his steps, the current arrows will appear when switching back to the battery: image

jonathanolson commented 3 years ago

This seems ok for current phet-brand given the amount of work to fix the underlying issues, but should be handled when this sim is revisited for phet-io.

Notably: