-
Notifications
You must be signed in to change notification settings - Fork 3
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
how to implement variable number of harmonics #6
Comments
Labeling for discussion at design meeting, and it would be good to have someone from the PhET-iO team attend. |
Assigning to @arouinfar @ariel-phet and @kathy-phet so they can think about this before design meeting, and provide input before the meeting if they feel like it. |
@ariel-phet asked me to summarize the pros and cons of each approach. And I think it's useful to show the (hypothetical) structure of the Studio tree. So here goes... (1) A static Waveform instance that has 11 static amplitude Properties (A1...A11) PROS:
CONS:
Studio Tree: Looks like this, regardless of the value of
(2) A static Waveform instance with a dynamic group of amplitude Properties (A1...AN) PROS:
CONS:
Studio Tree: Looks like this for
(3) A dynamic Waveform instance with N amplitude Properties (A1...AN) PROS:
CONS:
Studio Tree: Looks like this for
So... My preference is for approach (1). Once we choose an option, beware that changing will be VERY costly. |
In phetsims/tandem#226 (comment), @samreid also recommended approach (1):
|
To elaborate, the instrumentation guide ( https://github.com/phetsims/phet-io/blob/master/doc/phet-io-instrumentation-technical-guide.md ) says:
It seems like the amplitude Properties fall under level 2. |
11/12/2020 design meeting: @arouinfar @kathy-phet @samreid @pixelzoom Consensus was to go with approach (1). |
Related to #4.
The Discrete screen in Fourier allows the student to change the number of harmonics
N
, and set amplitudes for those harmonics. The amplitudes are labeled as A1...AN, and the maximum for N is 11.There are different ways of handling a variable number of harmonics. This decision will affect many other aspects of the implementation, including the PhET-iO interface (see #4). Here are 3 approaches that are being considered.
(1) A static Waveform instance that has 11 static amplitude Properties (A1...A11)
Model and view contain elements for all 11 amplitudes. The number of amplitude Properties that are relevant is based on N. Model amplitudes > N are set to zero. View components are visible only when associated with amplitudes A1...AN. All PhET-iO elements are static, with model and view components for all 11 amplitudes existing for the lifetime of the sim, and therefore always visible in Studio and available to PhET-iO.
Pseudo code:
(2) A static Waveform instance with a dynamic group of amplitude Properties (A1...AN)
When N changes, the number of amplitude Properties in the Waveform instance changes. This approach requires a PhetioGroup for managing the amplitude Properties, with tandem names numbered from 1...N. (Does PhetioGroup support numbering from 1, and reusing indices?). View components associated with the amplitude Property instances will also be managed using PhetioGroup.
Pseudo code:
(3) A dynamic Waveform instance with N amplitude Properties (A1...AN)
When N changes, a new Waveform instance is created. The N amplitude Properties will always have the same tandem names, indexed 1...N. Amplitude values from the previous Waveform are used to initialize the new Waveform instance, with amplitudes for harmonics > N being set to zero. View components associated with the Waveform instance will either need to be mutable or managed using a PhetioGroup/PhetioCapsule.
Pseudo code:
The text was updated successfully, but these errors were encountered: