diff --git a/js/common/model/Magnet.ts b/js/common/model/Magnet.ts index fb94a8da..9fc9e5df 100644 --- a/js/common/model/Magnet.ts +++ b/js/common/model/Magnet.ts @@ -124,6 +124,13 @@ export default abstract class Magnet extends FELMovable { return this.localBounds.containsPoint( this.globalToLocalPosition( position, this.reusablePosition ) ); } + /** + * Does the magnet intersect a horizontal plane at the specific y-coordinate? + */ + public intersectsHorizontalPlane( y: number ): boolean { + return this.localBounds.containsPoint( this.globalToLocalXY( this.positionProperty.value.x, y, this.reusablePosition ) ); + } + /** * Gets the B-field vector at the specified point in the global coordinate frame. * @@ -182,8 +189,12 @@ export default abstract class Magnet extends FELMovable { * because our B-field model is in the magnet's local coordinate frame. */ private globalToLocalPosition( globalPosition: Vector2, returnVector?: Vector2 ): Vector2 { + return this.globalToLocalXY( globalPosition.x, globalPosition.y, returnVector ); + } + + private globalToLocalXY( globalX: number, globalY: number, returnVector?: Vector2 ): Vector2 { returnVector = returnVector || new Vector2( 0, 0 ); - returnVector.set( globalPosition ); + returnVector.setXY( globalX, globalY ); returnVector.rotateAboutPoint( this.positionProperty.value, -this.rotationProperty.value ); returnVector.subtract( this.positionProperty.value ); return returnVector; diff --git a/js/common/model/PickupCoil.ts b/js/common/model/PickupCoil.ts index ef372e65..8d3c51bf 100644 --- a/js/common/model/PickupCoil.ts +++ b/js/common/model/PickupCoil.ts @@ -152,8 +152,7 @@ export default class PickupCoil extends FELMovable { } this.maxEMFProperty = new NumberProperty( options.maxEMF, { - //TODO https://github.com/phetsims/faradays-electromagnetic-lab/issues/156 This range makes Developer control unusable. - range: new Range( 1E5, 1E7 ) + range: new Range( 1E5, 3E6 ) // Do not instrument. This is a PhET developer Property. } ); @@ -347,10 +346,8 @@ export default class PickupCoil extends FELMovable { */ public getSamplePointAreaDimensions( samplePoint: Vector2, reusableDimension: Dimension2 ): Dimension2 { - // Position of samplePoint in global coordinates. - const x = this.positionProperty.value.x + samplePoint.x; + // Position of samplePoint.y in global coordinates. const y = this.positionProperty.value.y + samplePoint.y; - this.reusablePosition.setXY( x, y ); // Use the algorithm for distance from the center of a circle to a chord to compute the length of the chord // that is perpendicular to the vertical line and goes through the sample point. If you're unfamiliar with @@ -359,11 +356,10 @@ export default class PickupCoil extends FELMovable { const d = samplePoint.y; // distance from center of the circle (loop) to the chord let chordLength = 2 * Math.sqrt( Math.abs( R * R - d * d ) ); - // If the sample point is inside the magnet, using the chord length computed above would exaggerate the - // sample point's contribution to flux. So use the magnet's thickness (depth). The field outside the magnet - // is relatively weak, so ignore its contribution. + // 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.isInside( this.reusablePosition ) ) { + if ( magnetThickness < chordLength && this.magnet.intersectsHorizontalPlane( y ) ) { chordLength = magnetThickness; } assert && assert( chordLength !== 0 ); diff --git a/js/generator/model/Generator.ts b/js/generator/model/Generator.ts index c44be9df..c653ad0d 100644 --- a/js/generator/model/Generator.ts +++ b/js/generator/model/Generator.ts @@ -61,7 +61,7 @@ export default class Generator extends PhetioObject { // Disable voltmeter kinematics for the generator. Immediate response is needed, due to the cyclic nature. kinematicsEnabledProperty: new BooleanProperty( false ) }, - maxEMF: 240000, // see PickupCoil.calibrateMaxEMF + maxEMF: 110000, // see PickupCoil.calibrateMaxEMF transitionSmoothingScale: 1, // see PickupCoil.transitionSmoothingScaleProperty samplePointsSpacing: this.turbine.barMagnet.size.height / 10, // similar to PickupCoilScreenModel tandem: options.tandem.createTandem( 'pickupCoil' ) diff --git a/js/pickup-coil/model/PickupCoilScreenModel.ts b/js/pickup-coil/model/PickupCoilScreenModel.ts index 14e0bad3..19ec6c41 100644 --- a/js/pickup-coil/model/PickupCoilScreenModel.ts +++ b/js/pickup-coil/model/PickupCoilScreenModel.ts @@ -57,7 +57,7 @@ export default class PickupCoilScreenModel extends FELScreenModel { this.pickupCoil = new PickupCoil( barMagnet, preferences.currentFlowProperty, { position: PICKUP_COIL_POSITION, - maxEMF: 8000000, // see PickupCoil.calibrateMaxEMF + maxEMF: 1000000, // see PickupCoil.calibrateMaxEMF transitionSmoothingScale: 0.77, // see PickupCoil.transitionSmoothingScaleProperty // To avoid inducing significant (incorrect) EMF when the magnet is moved vertically when inside the coil, diff --git a/js/transformer/model/Transformer.ts b/js/transformer/model/Transformer.ts index 21a63c70..200230f0 100644 --- a/js/transformer/model/Transformer.ts +++ b/js/transformer/model/Transformer.ts @@ -50,7 +50,7 @@ export default class Transformer extends PhetioObject { this.pickupCoil = new PickupCoil( this.electromagnet, currentFlowProperty, { position: options.pickupCoilPosition, - maxEMF: 3000000, // see PickupCoil.calibrateMaxEMF + maxEMF: 1000000, // see PickupCoil.calibrateMaxEMF transitionSmoothingScale: 0.56, // see PickupCoil.transitionSmoothingScaleProperty // To avoid inducing significant (incorrect) EMF when the magnet is moved vertically when inside the coil,