phetsims / gas-properties

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

PhET-iO instrumentation of sampling models #241

Closed pixelzoom closed 3 months ago

pixelzoom commented 4 months ago

Related to #231 (PhET-iO instrumentation for particles) and #236 (PhET-iO support for data fluency) ...

The following things sample the particle system:

For each of these, the samples need to be stateful. For the elements that involve a fixed time period, the accumulated time must also be stateful.

pixelzoom commented 4 months ago

Most of this work was done as part of #30, #77, and #231. In the above commits, documentation for IOTypes was improved.

pixelzoom commented 4 months ago

@arouinfar @Nancy-Salpepi @kathy-phet This is ready for review. Below is a summary of the relevant PhET-iO elements.

Average Speed

heavyAverageSpeedProperty and lightAverageSpeedProperty are the (running) average speeds for heavy and light particles respectively, as displayed in the Average Speed accordion box. These Properties are phetioFeatured: true.

averageSpeedModel handles serialization of internal elements that are used to derive the above Properties. All of its fields are for internal use only, so it is phetioFeatured: false. AverageSpeedModelIO is its IOType, which looks like this in Studio:

screenshot_3300

Speed and KE histograms

heavyKineticEnergyBinCountsProperty, lightKineticEnergyBinCountsProperty, and totalKineticEnergyBinCountsProperty are the bin counts displayed by the Kinetic Energy histogram. These Propertes are phetioFeatured: true.

heavySpeedBinCountsProperty, lightSpeedBinCountsProperty, and totalSpeedBinCountsProperty are the bin counts displayed by the Speed histogram. These Propertes are phetioFeatured: true.

histogramsModel handles serialization of internal elements that are used to derive the above Properties. All of its fields are for internal use only, so it is phetioFeatured: false. HistogramsModelIO is its IOType, which looks like this in Studio:

screenshot_3301

Particle Flow Rate

particle1FlowRateModel.leftFlowRateProperty and particle1FlowRateModel.rightFlowRateProperty are the left and right flow rates displayed for particles of type 1. These Propertes are phetioFeatured: true.

particle2FlowRateModel.leftFlowRateProperty and particle2FlowRateModel.rightFlowRateProperty are the left and right flow rates displayed for particles of type 2. These Propertes are phetioFeatured: true.

particle1FlowRateModel and particle2FlowRateModel handle serialization of internal elements that are used to derive the above Properties. All of their fields are for internal use only, so they are phetioFeatured: false. ParticleFlowRateModelIO is their IOType, which looks like this in Studio:

screenshot_3302
pixelzoom commented 4 months ago

In #235, serialization of the histograms was optimized. HistogramsModelIO now look like this. Rather than storing raw samples of speed and KE, the samples are immediately processed into "cumulative bins", then averaged later. This greatly reduces the amount of serialized data.

screenshot_3314
pixelzoom commented 3 months ago

@arouinfar and @Nancy-Salpepi noted a potential problem with restoring state for the Speed histogram, tracking in #261.

@arouinfar @Nancy-Salpepi if everything else looks OK here, and the state schemas look reasonable, please close this issue.

arouinfar commented 3 months ago

@arouinfar @Nancy-Salpepi if everything else looks OK here, and the state schemas look reasonable, please close this issue.

Looks good, closing.