From 5ab9a86ae3c4624ad61ad69d6e37348bf9690aee Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Fri, 24 May 2024 12:01:11 -0600 Subject: [PATCH] fluxAreaCompensationEnabled:false for Generator scren, https://github.com/phetsims/faradays-electromagnetic-lab/issues/170 --- js/common/model/PickupCoil.ts | 25 +++++++++++++++++++------ js/generator/model/Generator.ts | 1 + 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/js/common/model/PickupCoil.ts b/js/common/model/PickupCoil.ts index 8d3c51bf..29ad950a 100644 --- a/js/common/model/PickupCoil.ts +++ b/js/common/model/PickupCoil.ts @@ -36,6 +36,7 @@ type SelfOptions = { maxEMF: number; // the initial value of maxEMFProperty transitionSmoothingScale: number; // the initial value of transitionSmoothingScaleProperty samplePointsSpacing: number; // spacing between B-field sample points + fluxAreaCompensationEnabled?: boolean; // use the thickness of the magnet for area cross-sections used to compute flux coilOptions?: PickOptional; // passed to Coil lightBulbOptions?: PickOptional; // passed to LightBulb voltmeterOptions?: PickOptional; // passed to Voltmeter @@ -80,6 +81,11 @@ export default class PickupCoil extends FELMovable { public readonly samplePointsProperty: TReadOnlyProperty; private readonly samplePointSpacing: number; + // When true, use the thickness of the magnet for area cross-sections used to compute flux. + // See https://github.com/phetsims/faradays-electromagnetic-lab/issues/156 and + // https://github.com/phetsims/faradays-electromagnetic-lab/issues/170 + private readonly fluxAreaCompensationEnabled: boolean; + // 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. This number should be set as close as possible to the maximum EMF that can be @@ -118,11 +124,16 @@ export default class PickupCoil extends FELMovable { public constructor( magnet: Magnet, currentFlowProperty: TReadOnlyProperty, providedOptions: PickupCoilOptions ) { - const options = optionize, FELMovableOptions>()( - {}, providedOptions ); + const options = optionize, FELMovableOptions>()( { + + // SelfOptions + fluxAreaCompensationEnabled: true + }, providedOptions ); super( options ); + this.fluxAreaCompensationEnabled = options.fluxAreaCompensationEnabled; + this.magnet = magnet; // We want some Properties to appear to be children of the coil element. We could also have done this by @@ -358,13 +369,15 @@ export default class PickupCoil extends FELMovable { // If the sample point is in the same horizontal plane as the magnet, using the chord length computed above would // exaggerate the sample point's contribution to flux. So use the magnet's thickness (depth). - const magnetThickness = this.magnet.size.depth; - if ( magnetThickness < chordLength && this.magnet.intersectsHorizontalPlane( y ) ) { - chordLength = magnetThickness; + if ( this.fluxAreaCompensationEnabled ) { + const magnetThickness = this.magnet.size.depth; + if ( magnetThickness < chordLength && this.magnet.intersectsHorizontalPlane( y ) ) { + chordLength = magnetThickness; + } } - assert && assert( chordLength !== 0 ); // Area associated with the sample point. + assert && assert( chordLength !== 0 ); reusableDimension.width = chordLength; reusableDimension.height = this.samplePointSpacing; return reusableDimension; diff --git a/js/generator/model/Generator.ts b/js/generator/model/Generator.ts index c653ad0d..e82f7b0f 100644 --- a/js/generator/model/Generator.ts +++ b/js/generator/model/Generator.ts @@ -64,6 +64,7 @@ export default class Generator extends PhetioObject { maxEMF: 110000, // see PickupCoil.calibrateMaxEMF transitionSmoothingScale: 1, // see PickupCoil.transitionSmoothingScaleProperty samplePointsSpacing: this.turbine.barMagnet.size.height / 10, // similar to PickupCoilScreenModel + fluxAreaCompensationEnabled: false, // see https://github.com/phetsims/faradays-electromagnetic-lab/issues/170 tandem: options.tandem.createTandem( 'pickupCoil' ) } );