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

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

Open
loganbraywork opened this issue Mar 18, 2021 · 4 comments

Comments

@loganbraywork
Copy link

Test device

Windows 10 Laptop

Operating System

Windows 10 ver. 1909

Browser

Chrome Version 89.0.4389.90

Problem description

For phetsims/qa#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
Copy link

Thanks @loganbraywork.

This looks like a possible regression @jonathanolson. I remember catching a similar issue before, see #234 (comment) onwards.

@jonathanolson
Copy link
Contributor

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
Copy link

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
Copy link
Contributor

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:

  • The current is modeled NOT for every section, but a general "what could have current at the moment", which changes
  • This current is only updated on the model step (not from any other changes)
  • When there is no animation frame between switching connections, it incorrectly treats the current changes as coming from the NEW section, instead of the old section.

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

No branches or pull requests

3 participants