phetsims / molarity

"Molarity" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/molarity
GNU General Public License v3.0
2 stars 6 forks source link

Sliders should use constrainValue #212

Closed arouinfar closed 4 years ago

arouinfar commented 4 years ago

Tangentially related to https://github.com/phetsims/QA/issues/464.

I was working on editing the Teacher Tips (#161) to add some clarification around max concentration vs. saturation (#154 & #196). I noticed that I could reliably reach maxConcentration without triggering precipitation using keyboard navigation, but it rarely worked if I used the mouse or a combination of mouse+keyboard. As a result I was often seeing saturated solutions at the maxConcentration.

Screen Shot 2020-01-07 at 11 25 10 AM

Opening the sim in studio, I realized that the model value (soluteAmountProperty) is actually a nasty float rather than the displayed value.

Screen Shot 2020-01-07 at 11 38 16 AM

We have often used constrainValue to make the slider thumb snap in particular intervals, which allows for nicer looking numbers and easier-to-repeat experiments. You can see an example of this in Pendulum Lab. When changing the length with the slider thumb, the value snaps in steps of 0.1 m, while the tweakers increment the value in steps of 0.01 m.

This is not exactly an apples-to-apples comparison with Molarity, but perhaps if we used constrainValue to restrict the slider thumb to 0.001 mol or 0.001 L increments, we wouldn't run into so many floating point issues.

Assigning to @zepumph and @jessegreenberg to evaluate, and if they agree, implement.

terracoda commented 4 years ago

@arouinfar, we also noticed this issue during the description design process, and struggled quiter a bit with it because teh sim model relies on precipitate to show up to say saturated.

We figured this was intentional, but in retrospect maybe we should have reached out to you.

We solved this problem in the description design by having a third value, "Solution darkest", so in the fairly rare, but possible case where the learner reaches this equilibrium state...in the descriptive experience they hear:

terracoda commented 4 years ago

Use the a11y view and let me know what you think of the descriptions when you transition through this max concentration.

Or see what I have in the design doc here: https://docs.google.com/document/d/1Z_5biEOBk9W4lVPXxGt7fyg-V6_CwTA4vMZ0mVMTJsI/edit#heading=h.smmn6gmb7xfr

jessegreenberg commented 4 years ago

I discussed with@emily-phet and @terracoda to understand better - When working on alternative input we were actually nervous that keyboard input allowed easy/reliable access to max concentration without seeing precipitate. This point isn't an important learning goal of the sim, and there isn't anything in the sim that visually indicates it is important or why. And so it was decided that we handle in description but not change anything else.

However, I also see merit in repeatable behavior and similar behavior between mouse + keyboard. @arouinfar can you review this line of thought? If you want to proceed with constrainValue let me know and I will add it.

arouinfar commented 4 years ago

@jessegreenberg @terracoda thanks for the clarification.

My primary concern is that the values in the model and the view are not the same, so rounding issues will not be uncommon.

In this example, if we calculate the molarity from the values on the solute and solution sliders, the result will not match the solution concentration (0.574/0.287 = 2). image

More generally, I do not see why the model values need to be so precise. In the above examples, the solute amount is 0.5736370441714982 moles and the solution volume is 0.28705372933253803 liters. I believe constrainValue would force the slider thumb to snap in increments of 0.001 (similar to using the shift modifier), but perhaps there is another way to ensure that the values in the model and the view are the same.

jessegreenberg commented 4 years ago

Done in the above commit, @arouinfar can you please review?

arouinfar commented 4 years ago

Looks good in master. Thanks @jessegreenberg!

jessegreenberg commented 4 years ago

OK thanks! Going to keep open as a self-reminder to propagate to the RC.

jessegreenberg commented 4 years ago

I verified that this made it into rc.3