Skip to content

Commit

Permalink
Merge branch 'main' into data-fluency
Browse files Browse the repository at this point in the history
# Conflicts:
#	js/view/CCKCScreenView.ts
#	js/view/CurrentChartNode.ts
#	js/view/SeriesAmmeterNode.ts
#	js/view/VoltageChartNode.ts
  • Loading branch information
samreid committed Nov 12, 2024
2 parents 692640a + c784ba5 commit 76ada92
Show file tree
Hide file tree
Showing 46 changed files with 239 additions and 225 deletions.
2 changes: 1 addition & 1 deletion circuit-construction-kit-common-tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="phet-sim-level" content="development">
<link rel="stylesheet" href="../sherpa/lib/qunit-2.20.0.css">
<title>circuit-construction-kit-common</title>
Expand Down
2 changes: 1 addition & 1 deletion circuit-construction-kit-common_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="phet-sim-level" content="development">

<title>circuit-construction-kit-common</title>
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @author Michael Kauzmann (PhET Interactive Simulations)
*/

import simEslintConfig from '../chipper/eslint/sim.eslint.config.mjs';
import simEslintConfig from '../perennial-alias/js/eslint/config/sim.eslint.config.mjs';

export default [
...simEslintConfig
Expand Down
11 changes: 2 additions & 9 deletions js/model/analysis/LTACircuitTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,11 @@ const iterateCapacitor = ( circuit: LTACircuit, resistor: MNAResistor, v: number
const expectedVoltage = v * Math.exp( -( t + dt ) / r / c );
const error = Math.abs( actualVoltage - expectedVoltage );

// console.log( expectedVoltage, actualVoltage );
// console.log( error );
if ( error > worstError ) {
worstError = error;
// console.log( 'new worst error: ' + worstError );
}

// window.string = window.string + `${v} ${r} ${c} ${t} ${desiredVoltageAtTPlusDT} ${voltage} ${error}
// `;

const fractionalError = error / expectedVoltage;
// console.log( fractionalError, error );
if ( error > 1E-8 ) {
Expand Down Expand Up @@ -115,14 +110,14 @@ QUnit.test( 'test RC Circuit should have voltage exponentially decay with T RC f
QUnit.test( 'test RC Circuit with series capacitors', assert => {
testVRCCircuitSeriesCapacitors( 3, 7, 10, 10, assert );
for ( let i = 0; i < 10; i++ ) {
testVRCCircuitSeriesCapacitors( 3, 7, Math.random() * 10, Math.random() * 10, assert ); // eslint-disable-line phet/bad-sim-text, phet/bad-sim-text
testVRCCircuitSeriesCapacitors( 3, 7, Math.random() * 10 + 0.1, Math.random() * 10 + 0.1, assert ); // eslint-disable-line phet/bad-sim-text, phet/bad-sim-text
}
} );

QUnit.test( 'test RC Circuit with parallel capacitors', assert => {
testVRCCircuitParallelCapacitors( 3, 7, 10, 10, assert );
for ( let i = 0; i < 10; i++ ) {
testVRCCircuitParallelCapacitors( 3, 7, Math.random() * 10, Math.random() * 10, assert ); // eslint-disable-line phet/bad-sim-text, phet/bad-sim-text
testVRCCircuitParallelCapacitors( 3, 7, Math.random() * 10 + 0.1, Math.random() * 10 + 0.1, assert ); // eslint-disable-line phet/bad-sim-text, phet/bad-sim-text
}
} );

Expand All @@ -133,15 +128,13 @@ const iterateInductor = ( circuit: LTACircuit, resistor: MNAResistor, V: number,
const actualCurrent = solution!.getCurrent( resistor );
const expectedCurrent = -V / R * ( 1 - Math.exp( -( t + dt ) * R / L ) );//positive, by definition of MNA.Battery

// console.log( expectedCurrent, actualCurrent );
const error = Math.abs( actualCurrent - expectedCurrent );
const fractionalError = error / expectedCurrent;

if ( error > 1E-8 ) {
assert.ok( fractionalError <= 0.02 );
}
// assert.ok( error < errorThreshold );
// assert.ok( true );
circuit = circuit.updateWithSubdivisions( dt );
}
};
Expand Down
3 changes: 2 additions & 1 deletion js/model/analysis/mna/MNASolution.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright 2015-2022, University of Colorado Boulder
// Copyright 2015-2024, University of Colorado Boulder

/**
* Sparse solution containing the solved variables from MNACircuit. * No listeners are attached and hence no dispose implementation is necessary.
*
* @author Sam Reid (PhET Interactive Simulations)
*/

/* global Assert */
import circuitConstructionKitCommon from '../../../circuitConstructionKitCommon.js';
import MNACircuitElement from './MNACircuitElement.js';
import MNAResistor from './MNAResistor.js';
Expand Down
8 changes: 4 additions & 4 deletions js/view/ACVoltageNode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2023, University of Colorado Boulder
// Copyright 2019-2024, University of Colorado Boulder

/**
* Renders the lifelike/schematic view for a ACVoltage.
Expand All @@ -9,18 +9,18 @@
import Property from '../../../axon/js/Property.js';
import Dimension2 from '../../../dot/js/Dimension2.js';
import { Shape } from '../../../kite/js/imports.js';
import optionize, { EmptySelfOptions } from '../../../phet-core/js/optionize.js';
import MinusNode from '../../../scenery-phet/js/MinusNode.js';
import PlusNode from '../../../scenery-phet/js/PlusNode.js';
import { Circle, Node, Path } from '../../../scenery/js/imports.js';
import Tandem from '../../../tandem/js/Tandem.js';
import CCKCConstants from '../CCKCConstants.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import ACVoltage from '../model/ACVoltage.js';
import FixedCircuitElementNode, { FixedCircuitElementNodeOptions } from './FixedCircuitElementNode.js';
import CircuitElementViewType from '../model/CircuitElementViewType.js';
import CCKCScreenView from './CCKCScreenView.js';
import CircuitNode from './CircuitNode.js';
import CircuitElementViewType from '../model/CircuitElementViewType.js';
import optionize, { EmptySelfOptions } from '../../../phet-core/js/optionize.js';
import FixedCircuitElementNode, { FixedCircuitElementNodeOptions } from './FixedCircuitElementNode.js';

// constants
const sineCurveShape = new Shape();
Expand Down
16 changes: 8 additions & 8 deletions js/view/AdvancedAccordionBox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2023, University of Colorado Boulder
// Copyright 2020-2024, University of Colorado Boulder

/**
* Advanced control panel that appears in "Lab" screens which allows the user to adjust the resistivity of wires
Expand All @@ -7,20 +7,20 @@
* @author Sam Reid (PhET Interactive Simulations)
*/

import TReadOnlyProperty from '../../../axon/js/TReadOnlyProperty.js';
import optionize, { combineOptions } from '../../../phet-core/js/optionize.js';
import { AlignGroup, Node, Text, VBox } from '../../../scenery/js/imports.js';
import { CheckboxOptions } from '../../../sun/js/Checkbox.js';
import Tandem from '../../../tandem/js/Tandem.js';
import CCKCConstants from '../CCKCConstants.js';
import CircuitConstructionKitCommonStrings from '../CircuitConstructionKitCommonStrings.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import CircuitConstructionKitCommonStrings from '../CircuitConstructionKitCommonStrings.js';
import Circuit from '../model/Circuit.js';
import CCKCAccordionBox, { CCKCAccordionBoxOptions } from './CCKCAccordionBox.js';
import CCKCCheckbox from './CCKCCheckbox.js';
import CCKCColors from './CCKCColors.js';
import SourceResistanceControl from './SourceResistanceControl.js';
import WireResistivityControl from './WireResistivityControl.js';
import Circuit from '../model/Circuit.js';
import Tandem from '../../../tandem/js/Tandem.js';
import optionize, { combineOptions } from '../../../phet-core/js/optionize.js';
import TReadOnlyProperty from '../../../axon/js/TReadOnlyProperty.js';
import { CheckboxOptions } from '../../../sun/js/Checkbox.js';
import CCKCColors from './CCKCColors.js';

type SelfOptions = {
showRealBulbsCheckbox?: boolean;
Expand Down
16 changes: 8 additions & 8 deletions js/view/AmmeterNode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2023, University of Colorado Boulder
// Copyright 2016-2024, University of Colorado Boulder

/**
* The user interface component with a single probe which reads current values from Wires (not from Vertex or
Expand All @@ -9,25 +9,25 @@

import BooleanProperty from '../../../axon/js/BooleanProperty.js';
import DerivedProperty from '../../../axon/js/DerivedProperty.js';
import DerivedStringProperty from '../../../axon/js/DerivedStringProperty.js';
import Property from '../../../axon/js/Property.js';
import Bounds2 from '../../../dot/js/Bounds2.js';
import Vector2 from '../../../dot/js/Vector2.js';
import Vector2Property from '../../../dot/js/Vector2Property.js';
import optionize from '../../../phet-core/js/optionize.js';
import ProbeNode from '../../../scenery-phet/js/ProbeNode.js';
import WireNode from '../../../scenery-phet/js/WireNode.js';
import { Color, DragListener, Image, Node, NodeOptions, PressListenerEvent, Rectangle, Text } from '../../../scenery/js/imports.js';
import Tandem from '../../../tandem/js/Tandem.js';
import ammeterBody_png from '../../images/ammeterBody_png.js';
import CCKCConstants from '../CCKCConstants.js';
import CCKCUtils from '../CCKCUtils.js';
import CircuitConstructionKitCommonStrings from '../CircuitConstructionKitCommonStrings.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import ProbeTextNode from './ProbeTextNode.js';
import CircuitConstructionKitCommonStrings from '../CircuitConstructionKitCommonStrings.js';
import Ammeter from '../model/Ammeter.js';
import CircuitNode from './CircuitNode.js';
import Bounds2 from '../../../dot/js/Bounds2.js';
import Property from '../../../axon/js/Property.js';
import ammeterReadoutTypeProperty from './ammeterReadoutTypeProperty.js';
import optionize from '../../../phet-core/js/optionize.js';
import DerivedStringProperty from '../../../axon/js/DerivedStringProperty.js';
import CircuitNode from './CircuitNode.js';
import ProbeTextNode from './ProbeTextNode.js';

const currentStringProperty = CircuitConstructionKitCommonStrings.currentStringProperty;

Expand Down
4 changes: 2 additions & 2 deletions js/view/BatteryNode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2023, University of Colorado Boulder
// Copyright 2015-2024, University of Colorado Boulder

/**
* Renders the lifelike/schematic view for a Battery.
Expand All @@ -12,8 +12,8 @@ import { Shape } from '../../../kite/js/imports.js';
import { combineOptions } from '../../../phet-core/js/optionize.js';
import { Color, Image, Path } from '../../../scenery/js/imports.js';
import Tandem from '../../../tandem/js/Tandem.js';
import batteryHigh_png from '../../images/batteryHigh_png.js';
import battery_png from '../../images/battery_png.js';
import batteryHigh_png from '../../images/batteryHigh_png.js';
import CCKCConstants from '../CCKCConstants.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import Battery from '../model/Battery.js';
Expand Down
8 changes: 4 additions & 4 deletions js/view/BatteryReverseButton.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Copyright 2017-2023, University of Colorado Boulder
// Copyright 2017-2024, University of Colorado Boulder

/**
* Button that reverses a battery.
*
* @author Sam Reid (PhET Interactive Simulations)
*/

import optionize, { EmptySelfOptions } from '../../../phet-core/js/optionize.js';
import { Color, Path, VBox } from '../../../scenery/js/imports.js';
import syncAltSolidString from '../../../sherpa/js/fontawesome-5/syncAltSolidString.js';
import { RoundPushButtonOptions } from '../../../sun/js/buttons/RoundPushButton.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import Battery from '../model/Battery.js';
import CCKCRoundPushButton from './CCKCRoundPushButton.js';
import Circuit from '../model/Circuit.js';
import { RoundPushButtonOptions } from '../../../sun/js/buttons/RoundPushButton.js';
import optionize, { EmptySelfOptions } from '../../../phet-core/js/optionize.js';
import CCKCRoundPushButton from './CCKCRoundPushButton.js';

// constants
const ARROW_ICON_SCALE = 0.035;
Expand Down
22 changes: 11 additions & 11 deletions js/view/CCKCChartNode.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
// Copyright 2019-2023, University of Colorado Boulder
// Copyright 2019-2024, University of Colorado Boulder

/**
* Provides simulation-specific values and customizations to display time-series data in a chart.
*
* @author Sam Reid (PhET Interactive Simulations)
*/

import { ObservableArray } from '../../../axon/js/createObservableArray.js';
import DerivedProperty from '../../../axon/js/DerivedProperty.js';
import Emitter from '../../../axon/js/Emitter.js';
import NumberProperty from '../../../axon/js/NumberProperty.js';
import Property from '../../../axon/js/Property.js';
import TEmitter from '../../../axon/js/TEmitter.js';
import TReadOnlyProperty from '../../../axon/js/TReadOnlyProperty.js';
import CanvasGridLineSet from '../../../bamboo/js/CanvasGridLineSet.js';
import CanvasLinePlot from '../../../bamboo/js/CanvasLinePlot.js';
import ChartCanvasNode from '../../../bamboo/js/ChartCanvasNode.js';
import ChartRectangle from '../../../bamboo/js/ChartRectangle.js';
import ChartTransform from '../../../bamboo/js/ChartTransform.js';
import CanvasGridLineSet from '../../../bamboo/js/CanvasGridLineSet.js';
import TickLabelSet from '../../../bamboo/js/TickLabelSet.js';
import ScatterPlot from '../../../bamboo/js/ScatterPlot.js';
import SpanNode from '../../../bamboo/js/SpanNode.js';
import TickLabelSet from '../../../bamboo/js/TickLabelSet.js';
import Bounds2 from '../../../dot/js/Bounds2.js';
import Range from '../../../dot/js/Range.js';
import Utils from '../../../dot/js/Utils.js';
import Vector2 from '../../../dot/js/Vector2.js';
import Vector2Property from '../../../dot/js/Vector2Property.js';
import optionize from '../../../phet-core/js/optionize.js';
import Orientation from '../../../phet-core/js/Orientation.js';
import PickRequired from '../../../phet-core/js/types/PickRequired.js';
import MagnifyingGlassZoomButtonGroup from '../../../scenery-phet/js/MagnifyingGlassZoomButtonGroup.js';
import ShadedRectangle from '../../../scenery-phet/js/ShadedRectangle.js';
import WireNode from '../../../scenery-phet/js/WireNode.js';
Expand All @@ -33,15 +40,8 @@ import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import CircuitConstructionKitCommonStrings from '../CircuitConstructionKitCommonStrings.js';
import Meter from '../model/Meter.js';
import CCKCProbeNode from './CCKCProbeNode.js';
import CircuitNode from './CircuitNode.js';
import Property from '../../../axon/js/Property.js';
import Bounds2 from '../../../dot/js/Bounds2.js';
import CCKCScreenView from './CCKCScreenView.js';
import TReadOnlyProperty from '../../../axon/js/TReadOnlyProperty.js';
import { ObservableArray } from '../../../axon/js/createObservableArray.js';
import optionize from '../../../phet-core/js/optionize.js';
import PickRequired from '../../../phet-core/js/types/PickRequired.js';
import TEmitter from '../../../axon/js/TEmitter.js';
import CircuitNode from './CircuitNode.js';

const oneSecondStringProperty = CircuitConstructionKitCommonStrings.oneSecondStringProperty;
const timeStringProperty = CircuitConstructionKitCommonStrings.timeStringProperty;
Expand Down
8 changes: 4 additions & 4 deletions js/view/CCKCCheckbox.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright 2021-2022, University of Colorado Boulder
// Copyright 2021-2024, University of Colorado Boulder

/**
* Checkbox styled for CCK
* @author Sam Reid (PhET Interactive Simulations)
*/

import Checkbox, { CheckboxOptions } from '../../../sun/js/Checkbox.js';
import { Node } from '../../../scenery/js/imports.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import Property from '../../../axon/js/Property.js';
import { combineOptions } from '../../../phet-core/js/optionize.js';
import { Node } from '../../../scenery/js/imports.js';
import Checkbox, { CheckboxOptions } from '../../../sun/js/Checkbox.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';

// constants
const BOX_WIDTH = 16;
Expand Down
2 changes: 1 addition & 1 deletion js/view/CCKCColors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*/

import { ProfileColorProperty } from '../../../scenery/js/imports.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import Tandem from '../../../tandem/js/Tandem.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';

const tandem = Tandem.COLORS;

Expand Down
22 changes: 11 additions & 11 deletions js/view/CCKCLightBulbNode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2023, University of Colorado Boulder
// Copyright 2015-2024, University of Colorado Boulder

/**
* Named CCKCLightBulbNode to avoid collisions with SCENERY_PHET/LightBulbNode. Renders the bulb shape
Expand All @@ -7,31 +7,31 @@
* @author Sam Reid (PhET Interactive Simulations)
*/

import Multilink from '../../../axon/js/Multilink.js';
import NumberProperty from '../../../axon/js/NumberProperty.js';
import Property from '../../../axon/js/Property.js';
import Matrix3 from '../../../dot/js/Matrix3.js';
import Utils from '../../../dot/js/Utils.js';
import Vector2 from '../../../dot/js/Vector2.js';
import { Shape } from '../../../kite/js/imports.js';
import { combineOptions } from '../../../phet-core/js/optionize.js';
import { Color, Image, Node, Path } from '../../../scenery/js/imports.js';
import lightBulbMiddleHigh_png from '../../mipmaps/lightBulbMiddleHigh_png.js';
import lightBulbMiddleReal_png from '../../mipmaps/lightBulbMiddleReal_png.js';
import Tandem from '../../../tandem/js/Tandem.js';
import lightBulbFrontReal_png from '../../images/lightBulbFrontReal_png.js';
import lightBulbMiddle_png from '../../mipmaps/lightBulbMiddle_png.js';
import lightBulbMiddleHigh_png from '../../mipmaps/lightBulbMiddleHigh_png.js';
import lightBulbMiddleReal_png from '../../mipmaps/lightBulbMiddleReal_png.js';
import CCKCConstants from '../CCKCConstants.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import CircuitElementViewType from '../model/CircuitElementViewType.js';
import LightBulb from '../model/LightBulb.js';
import CCKCScreenView from './CCKCScreenView.js';
import CircuitNode from './CircuitNode.js';
import CustomLightBulbNode from './CustomLightBulbNode.js';
import FixedCircuitElementNode, { FixedCircuitElementNodeOptions } from './FixedCircuitElementNode.js';
import LightBulbSocketNode from './LightBulbSocketNode.js';
import schematicTypeProperty from './schematicTypeProperty.js';
import CCKCScreenView from './CCKCScreenView.js';
import CircuitNode from './CircuitNode.js';
import LightBulb from '../model/LightBulb.js';
import CircuitElementViewType from '../model/CircuitElementViewType.js';
import Tandem from '../../../tandem/js/Tandem.js';
import SchematicType from './SchematicType.js';
import Multilink from '../../../axon/js/Multilink.js';
import { combineOptions } from '../../../phet-core/js/optionize.js';
import schematicTypeProperty from './schematicTypeProperty.js';

// constants
const SCRATCH_MATRIX = new Matrix3();
Expand Down
6 changes: 3 additions & 3 deletions js/view/CCKCPanel.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Copyright 2016-2023, University of Colorado Boulder
// Copyright 2016-2024, University of Colorado Boulder

/**
* Parent class for the panels in CCK so they have similar look and feel.
*
* @author Sam Reid (PhET Interactive Simulations)
*/

import { combineOptions } from '../../../phet-core/js/optionize.js';
import { Node } from '../../../scenery/js/imports.js';
import Panel, { PanelOptions } from '../../../sun/js/Panel.js';
import Tandem from '../../../tandem/js/Tandem.js';
import { Node } from '../../../scenery/js/imports.js';
import CCKCConstants from '../CCKCConstants.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import { combineOptions } from '../../../phet-core/js/optionize.js';
import CCKCColors from './CCKCColors.js';

export type CCKCPanelOptions = PanelOptions;
Expand Down
Loading

0 comments on commit 76ada92

Please sign in to comment.