phetsims / plinko-probability

"Plinko Probability" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 7 forks source link

dev1.0.0-3 does not handle large dt, #21

Closed veillette closed 8 years ago

veillette commented 8 years ago

As @phet-steele pointed out

Simulation stops running if active tab in browser is changed. Simulation continues only after it becomes the active tab in the browser.

Saying the sim "stops running" here is not completely accurate. The balls currently on the board freeze in place and the hopper does not release any more balls, sure, but balls are still being created. Once the sim is returned to, all balls that were "created" are released at once. @veillette this causes lots of problems, including a large drop in performance. Furthermore, this is not limited to browser tabs. All this happens the same when switching between sim screens.

veillette commented 8 years ago

The problems lies in our use of Timer.setInterval(). If one sets the sim in continuous mode, it keeps pumping "model Ball" into the simulation, even if one changes tab. We need to use Timer.clearInterval() if the time step is larger than a given interval (say one second).

memo330179 commented 8 years ago

I have moved the lab model ball creation to the step function. If we change tabs we assume that the step function is not called and no new balls are created. The simulation now 'pauses' when the tab is switched.

veillette commented 8 years ago

We will leave this open and let the quality assurance team close this ticket once we issue a new dev version

veillette commented 8 years ago

assigning to @alynne-phet for review

alynne-phet commented 8 years ago

@veillette Verified. No longer "pauses" when the tab is switched.

veillette commented 8 years ago

Thanks. closing