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

Calibration #66

Closed
3 of 4 tasks
pixelzoom opened this issue Jan 29, 2024 · 13 comments
Closed
3 of 4 tasks

Calibration #66

pixelzoom opened this issue Jan 29, 2024 · 13 comments

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Jan 29, 2024

This issue concerns the calibration sim model, including the pickup coil, speed of electrons, light bulb, and voltmeter.

PickupCoil has this method, ported from the Java version, and enabled via ?calibrateEMF:

  /**
   * Provides assistance for calibrating this coil. The easiest way to calibrate is to run the sim with the
   * &log query parameter, then follow these steps for each screen that has a PickupCoil model element.
   *
   * 1. Set the "Max EMF" developer control to its smallest value.
   * 2. Set the model parameters to their maximums, so that maximum EMF will be generated.
   * 3. Do whatever is required to generate EMF (move magnet through coil, run generator, etc.)
   * 4. Watch the console for a message that tells you what value to use.
   * 5. Change the value of maxEMF that is used to instantiate the PickupCoil.
   */
  private calibrateMaxEMF(): void {

A few issues related to calibration:

  • LightBulb and Voltmeter likely need to be calibrated separately, and this does not support that.
  • LightBulb and Voltmeter do not observe emfProperty, they observe currentAmplitudeProperty (as they should).
  • Running with ?calibrateMaxEMF, I rarely see currentAmplitudeProperty approaching the maximums of its range [-1,1].
  • Instead of setting currentAmplitudeProperty in PickupCoil updateEMF (the only place it's set), we might want to make it new DerivedProperty( [ emfProperty ], ... ).
@pixelzoom pixelzoom self-assigned this Jan 29, 2024
@pixelzoom pixelzoom changed the title Calibration of pickup coil Calibration of pickup coil, light bulb, and voltmeter Feb 13, 2024
@pixelzoom
Copy link
Contributor Author

Design meeting 2/29/24 with @arouinfar @kathy-phet @ariel-phet @Nancy-Salpepi @pixelzoom

Consensus was that the separate calibration of light bulb, etc. would be nice to have, so I should investigate.

@pixelzoom
Copy link
Contributor Author

Existing calibration parameters to consider adjusting:

  • currentSpeedScale
  • transitionSmoothingScale
  • maxEMF

@pixelzoom
Copy link
Contributor Author

pixelzoom commented May 1, 2024

@arouinfar and I discovered that it's useful for the light bulb to have a different maxRayLength for each screen. For the Generator screen, maxRayLength: 500 feels really great. Not sure about the other screens...

@pixelzoom pixelzoom changed the title Calibration of pickup coil, light bulb, and voltmeter Calibration May 7, 2024
pixelzoom added a commit that referenced this issue May 11, 2024
@pixelzoom
Copy link
Contributor Author

pixelzoom commented May 20, 2024

On hold until #156 and related issues are closed.

@pixelzoom
Copy link
Contributor Author

pixelzoom commented May 22, 2024

The fudge factor added in #166 (comment) changes the flux of the pickup coil for screens that have an electromagnet. They require recalibration of maxEMF.

@pixelzoom
Copy link
Contributor Author

As of 11:00AM this morning... Issues with the new flux model have been resolved, so work on calibration can resume.

@pixelzoom
Copy link
Contributor Author

pixelzoom commented May 28, 2024

Calibration went relatively quickly. Transformer screen needed some tweaks in the above commits, but otherwise things look pretty good.

@arouinfar please review. ... and definitely take your time on this review. It's something we can tweak after a dev test, and does not block dev testing.

@pixelzoom pixelzoom removed their assignment May 28, 2024
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Jun 20, 2024

@arouinfar To facilitate fiddling with calibration, I've made 2 improvements to the developer features that are available when running with ?dev.

First, in the 'Developer' accordion box, the arrow buttons for the 'Max EMF' control (shown below) now increment/decrement by 100 -- instead of 1, which was not very useful for the range [100000, 6000000].

screenshot_3384

Second, I've added a 'Max EMF' display to the 'Pickup Coil Debugger' panel, shown below. This is a nicer alternative to the calibrateMaxEMF query parameter. As you play with the sim, this value will update, and you can use it to inform how you set the 'Max EMF' control in the 'Developer' accordion box.

screenshot_3382

@pixelzoom
Copy link
Contributor Author

pixelzoom commented Jun 20, 2024

With the improvements noted in #66 (comment), the calibrateMaxEMF query parameter is no longer needed, so I've deleted it.

Here is the latest documentation that describes how to calibrate maxEMFProperty and transitionSmoothingScaleProperty.

  // DEBUG: Writeable via developer controls only, when running with &dev query parameter. Dividing the coil's EMF by
  // this number will give us the coil's normalized current (see Coil.normalizedCurrentProperty), which determines the
  // responsiveness of view components.
  //
  // To set this value, follow these steps:
  // * Run with &dev query parameter to see the 'Developer' accordion boxes. For screens that have a pickup coil:
  // * Check the 'Debugger Panel' checkbox to see the 'Pickup Coil Debugger' panel, which displays 'Max EMF'.
  // * Set the sim to settings that will generate the most EMF. Note the value of 'Max EMF' in the 'Pickup Coil Debugger' panel.
  // * Set the 'Max EMF' control in the 'Developer' accordion box based on the value that you observe in the 'Pick Coil Debugger' panel.
  //   Depending on the screen, you may decide to use a smaller value for 'typical' use versus 'extreme' use.
  public readonly maxEMFProperty: NumberProperty;

  // DEBUG: Writeable via developer controls only, when running with &dev query parameter.
  // This is a scaling factor used to smooth out abrupt changes that occur when the magnet transitions between being
  // inside & outside the coil. This is used to scale the B-field for sample points inside the magnet, eliminating
  // abrupt transitions at the left and right edges of the magnet. For any sample point inside the magnet, the B-field
  // sample is multiplied by this value.
  //
  // To set this value, follow these steps:
  // * Run with &dev query parameter to see the 'Developer' accordion boxes. For screens that have a pickup coil:
  // * Check the 'Debugger Panel' checkbox to see the 'Pickup Coil Debugger' panel.
  // * Move the magnet horizontally through the coil until, by moving it one pixel, you see an abrupt change in the
  //   displayed flux value.
  // * Note the 2 flux values when the abrupt change occurs.
  // * Move the magnet so that the largest of the 2 flux values is displayed.
  // * Adjust the 'Transition Smoothing Scale' control until the larger value is reduced to approximately
  //   the same value as the smaller value.
  public readonly transitionSmoothingScaleProperty: NumberProperty;

@arouinfar
Copy link
Contributor

arouinfar commented Jul 3, 2024

@pixelzoom thanks for setting up the dev controls, it made calibration much smoother. The one sticking point was that the Max EMF readout in the debugger panel doesn't reset with ResetAll, I had to refresh the browser window.

Let's use these values:

  • Pickup Coil Screen: Max EMF = 1,300,000
  • Transformer Screen: Max EMF = 3,500,000
  • Generator Screen: Max EMF = 120,000

The only significant change is the Transformer screen, which was at Max EMF = 5,000,000. A stationary AC source inside of the coils has a max EMF of ~1,600,000 (max amplitude, max frequency, max loops, min loop area) and I found the voltmeter particularly hard to read. Under the same conditions, the DC source has a Max EMF of ~3,100,000 with alt input, but can get much higher when dragged rapidly. Decreasing the Max EMF to 3,500,000 seemed like a good compromise to improve the static AC source case without sacrificing too much from the DC case.

@pixelzoom
Copy link
Contributor Author

Back to @arouinfar for review and some questions.

I've made the max EMF changes requested in #66 (comment).

Any changes for transitionSmoothingScaleProperty?

Regarding:

The one sticking point was that the Max EMF readout in the debugger panel doesn't reset with ResetAll, I had to refresh the browser window.

Developer controls are currently NOT reset on ResetAll, and I'd like to keep that consistent. So rather than resetting the max EMF display on ResetAll, I'm now resetting it whenever the "Max EMF" control is changed in the Developer accordion box. Does this address the inconvenience?

@pixelzoom
Copy link
Contributor Author

pixelzoom commented Jul 8, 2024

Re #66 (comment), @arouinfar and I reviewed 2 of my questions during today's standup meeting:

Any changes for transitionSmoothingScaleProperty?

No. Current values looked good.

... So rather than resetting the max EMF display on ResetAll, I'm now resetting it whenever the "Max EMF" control is changed in the Developer accordion box. Does this address the inconvenience?

Yes.

So all that remains is to review the changes requested for max EMF values.

@arouinfar
Copy link
Contributor

Thanks @pixelzoom! Looks good on main, closing.

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

2 participants