Skip to content
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

Rename currentAmplitudeProperty #130

Closed
samreid opened this issue Mar 26, 2024 · 13 comments
Closed

Rename currentAmplitudeProperty #130

samreid opened this issue Mar 26, 2024 · 13 comments

Comments

@samreid
Copy link
Member

samreid commented Mar 26, 2024

During code review #103 we observed this code in Coil.ts:

export default class Coil extends PhetioObject {

  // This is a quantity that PhET made up. It is a percentage [-1,1] that describes the amount of current relative to
  // some maximum current in the model, and the sign indicates the direction of that current. View components can use
  // this value to determine how they should behave -- eg, how far to move a voltmeter needle, how bright to make a
  // light bulb, and how fast to move electrons.
  public readonly currentAmplitudeProperty: TReadOnlyProperty<number>;

Using a name like "amplitude" suggests that it is a non-negative number. So we recommend coming up with a new name that more closely reflects the documentation and behavior.

We also recommend adjusting the terminology "percentage" if the values like between -1 and 1.

@pixelzoom
Copy link
Contributor

Adding @arouinfar to this, because this would be a huge change. It's the foundation of the Hollywood model, appears in model.md and in the PhET-iO API.

@pixelzoom
Copy link
Contributor

pixelzoom commented Mar 26, 2024

@samreid said:

We also recommend adjusting the terminology "percentage" if the values like between -1 and 1.

Can you help me grok the typo in this sentence?

Can you point me to a case where we've used [-1,1] as the range for a percentage? Values expressed as percentages are in the range [0,100] throughout this sim. That range was used rather than [0,1] to accommodate PhET-iO, so that Property values correspond to the % values shown in the UI.

@samreid
Copy link
Member Author

samreid commented Mar 26, 2024

The documentation, referenced in the top comment, says:

It is a percentage [-1,1]

Normally a percentage goes from 0% to 100%, so perhaps "percentage" is inaccurate in this context. Perhaps my typo was to say "like" instead of "are".

@pixelzoom
Copy link
Contributor

Documentation revised in Coil.ts and model.md, which purges the word "percentage" and hopefully clarifies the semantics of the value. Now we need to decide whether we need to change the name.

  // This is a quantity that PhET made up. It is a value in the range [-1,1]. The magnitude describes the amount of
  // current relative to some maximum current in the model. The sign indicates the direction of that current. View
  // components can use this value to determine how they should behave -- eg, how far to move a voltmeter needle,
  // how bright to make a light bulb, and how fast to move electrons.
  public readonly currentAmplitudeProperty: TReadOnlyProperty<number>;

@pixelzoom
Copy link
Contributor

@arouinfar @samreid How about currentSignalProperty?

@samreid
Copy link
Member Author

samreid commented Mar 26, 2024

That is an improvement, but I wonder what you think of a more general term like currentAmountProperty or equivalent?

@pixelzoom
Copy link
Contributor

We'd also like to remove the word "current", to avoid misconceptions like #118. There is no computation of current in this model, and no modeling of resistance.

@arouinfar and I like normalizedVoltageProperty, which has a range [-1,1]. EMF is in volts, and the computation is emf / maxEMF.

@pixelzoom
Copy link
Contributor

pixelzoom commented Mar 26, 2024

While we have no current or resistance in the model, we unfortuately have things that are named CurrentIndicator CurrentSource to correspond to how they are presented in the UI.

@samreid
Copy link
Member Author

samreid commented Mar 27, 2024

When renaming to normalizedVoltageProperty, consider renaming CURRENT_AMPLITUDE_RANGE to match.

@samreid samreid removed their assignment Mar 27, 2024
@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 1, 2024

When renaming to normalizedVoltageProperty, consider renaming CURRENT_AMPLITUDE_RANGE to match.

Yes - anything named "current amplitude" will be renamed accordingly.

@pixelzoom
Copy link
Contributor

I'm starting to like normalizedCurrentProperty more than normalizedVoltageProperty.

@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 3, 2024

@arouinfar ready for your review.

I changed to normalizedCurrentProperty throughout the code, and in model.md.

pickupCoil.coil.normalizedCurrentProperty and electromagnet.coil.normalizedCurrentProperty are the 2 places where this name appears in the PhET-iO API. They share the same PhET-iO documentation, shown below. This previously said only "For internal use only", but I think it deserves clarification.

screenshot_3170

@arouinfar
Copy link
Contributor

Looks good, thanks @pixelzoom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants