phetsims / faradays-electromagnetic-lab

"Faraday's Electromagnetic Lab" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 0 forks source link

Calibration #66

Open pixelzoom opened 5 months ago

pixelzoom commented 5 months ago

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:

pixelzoom commented 4 months ago

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 commented 2 months ago

Existing calibration parameters to consider adjusting:

pixelzoom commented 2 months ago

@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 commented 1 month ago

On hold until #156 and related issues are closed.

pixelzoom commented 1 month ago

The fudge factor added in https://github.com/phetsims/faradays-electromagnetic-lab/issues/166#issuecomment-2125799912 changes the flux of the pickup coil for screens that have an electromagnet. They require recalibration of maxEMF.

pixelzoom commented 1 month ago

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

pixelzoom commented 1 month ago

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 commented 2 weeks ago

@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 commented 2 weeks ago

With the improvements noted in https://github.com/phetsims/faradays-electromagnetic-lab/issues/66#issuecomment-2181203760, 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 commented 4 days ago

@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:

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 commented 2 days ago

Back to @arouinfar for review and some questions.

I've made the max EMF changes requested in https://github.com/phetsims/faradays-electromagnetic-lab/issues/66#issuecomment-2207402239.

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?