phetsims / masses-and-springs-basics

"Masses and Springs: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 3 forks source link

Stretching spring a lot results in glitchy masses, glitchy spring #39

Closed ghost closed 5 years ago

ghost commented 5 years ago

Test Device

MacBook Air

Operating System

macOS 10.14

Browser

Safari 12.0

Problem Description

For https://github.com/phetsims/QA/issues/220. If you stretch the spring out by adjusting the spring strength at well-timed intervals, you can see some glitchiness (see the gif) in the masses and the spring itself. Not a normal use case, but I thought I'd document it anyway.

@arouinfar, aren't we exceeding the elastic limit of the spring here?

EDIT: Similar weirdness occurs in the published version of Masses and Springs.

Steps to Reproduce

  1. As the mass is falling, increase the spring strength to maximum.
  2. Reduce spring strength to minimum before the mass begins its ascent.
  3. Repeat until spring is sufficiently stretched.

Visuals

betterissue

Troubleshooting Information Name: ‪Masses and Springs: Basics‬ URL: https://phet-dev.colorado.edu/html/masses-and-springs-basics/1.0.0-dev.11/phet/masses-and-springs-basics_en_phet.html Version: 1.0.0-dev.11 2018-11-12 16:16:41 UTC Features missing: touch User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Safari/605.1.15 Language: en-US Window: 1440x837 Pixel Ratio: 1/1 WebGL: WebGL 1.0 (2.1 INTEL-12.0.34) GLSL: WebGL GLSL ES 1.0 (1.20) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 15 uniform: 1024 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 16) Max viewport: 8192x8192 OES_texture_float: true Dependencies JSON: {"assert":{"sha":"928741cf","branch":"master"},"axon":{"sha":"036865d6","branch":"master"},"brand":{"sha":"1fd6682e","branch":"master"},"chipper":{"sha":"9e1987e6","branch":"master"},"dot":{"sha":"bbbd8526","branch":"master"},"griddle":{"sha":"f64a7cf0","branch":"master"},"joist":{"sha":"11f7cf47","branch":"master"},"kite":{"sha":"b0fc6c9c","branch":"master"},"masses-and-springs":{"sha":"0ab4798a","branch":"master"},"masses-and-springs-basics":{"sha":"90423db0","branch":"master"},"phet-core":{"sha":"714b088a","branch":"master"},"phet-io":{"sha":"3acf45ca","branch":"master"},"phet-io-wrapper-classroom-activity":{"sha":"5dea7f54","branch":"master"},"phet-io-wrapper-hookes-law-energy":{"sha":"b42eaef7","branch":"master"},"phet-io-wrapper-lab-book":{"sha":"b884e9c1","branch":"master"},"phet-io-wrappers":{"sha":"e90822f4","branch":"master"},"phetcommon":{"sha":"869b2561","branch":"master"},"query-string-machine":{"sha":"06ed6276","branch":"master"},"scenery":{"sha":"3fbe7bbb","branch":"master"},"scenery-phet":{"sha":"76baf536","branch":"master"},"sherpa":{"sha":"2cd50500","branch":"master"},"sun":{"sha":"bc8424bb","branch":"master"},"tambo":{"sha":"ad355580","branch":"master"},"tandem":{"sha":"93822898","branch":"master"},"twixt":{"sha":"11a0c804","branch":"master"}}
arouinfar commented 5 years ago

What a find @lmulhall-phet!

I haven't been able to reproduce the behavior in the .gif, even when toggling the spring strength at the seemingly-opportune moment. Have you been able to reproduce on any other platforms @lmulhall-phet?

@arouinfar, aren't we exceeding the elastic limit of the spring here?

Definitely, so this isn't the most pedagogically useful scenario.

Regardless, the glitchy SpringNode is quite odd, and looks pretty buggy. It would be nice if we could track down/address the root cause if feasible. However, given how much of an edge case this is, I don't think it warrants significant resources @Denz1994.

Denz1994 commented 5 years ago

I wasn't able to reproduce this behavior as well. I guess I couldn't find the right interval, but this is eerily similar to https://github.com/phetsims/masses-and-springs/issues/170. The previous concensus was that this behavior isn't technically breaking the sim and is an extreme scenario that can be "simulated." This would break the elastic limit of a spring, but there isn't anything stopping us from simulating a spring with an extreme elastic limit.

As far as a cause, this is a result of a rapidly changing the elasticity of the spring. The act of changing the spring constant is equivilant to the act of switching a spring in a physical lab. We are essentially switching between tense and loose springs while maintaining the vertical velocity.

I will leave this issue up to @arouinfar to close, but I don't think we should correct this behavior

arouinfar commented 5 years ago

@Denz1994 while I agree that this issue stems from the interaction pattern in https://github.com/phetsims/masses-and-springs/issues/170, it seems a bit different. Here, the SpringNode is not being properly drawn.

That said, since you and I were not able to reproduce, I would like to hear a bit more from @lmulhall-phet. Are you able to reproduce this on other platforms?

ghost commented 5 years ago

@arouinfar, I am able to reproduce on other browsers + macOS. I'll try to reproduce on other OS's.

Denz1994 commented 5 years ago

@arouinfar mentioned:

It would be nice if we could track down/address the root cause if feasible. However, given how much of an edge case this is, I don't think it warrants significant resources.

Extreme values of self.y in OscillatingSpringNode.js causes the position of the end of a spring to shift. Extreme values on the order of +/- 400000 in view coordinates. This about 650 worth of screen lengths (at defualt dev bounds), which I imagine is something we don't design for. The discrepancy here is that OscillatingSpringNode.js is leveraging ParametricSpringNode.js which may not have been originally designed to reach these extreme values when strecthing, being that you have to drag the spring for it to stretch.

I will close this issue and if this becomes a further issue in the future, we can reference this as a starting point.