diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx | 80 | ||||
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationTutorial.json | 136 |
2 files changed, 207 insertions, 9 deletions
diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx index 7bb5d0e98..9741ddc3e 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx @@ -2105,7 +2105,6 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi )}{" "} {this.dataDoc.simulationPaused && this.dataDoc.simulationType != "Inclined Plane" && - this.dataDoc.simulationType != "Suspension" && this.dataDoc.simulationType != "Circular Motion" && this.dataDoc.simulationType != "Pulley" && ( <td @@ -2114,18 +2113,54 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi }} > <InputField - lowerBound={0} + lowerBound={this.dataDoc.simulationType == "Projectile" ? 1 : (this.xMax + this.xMin) / 4 - this.radius - 15} dataDoc={this.dataDoc} prop={'positionXDisplay'} step={1} unit={"m"} - upperBound={this.xMax - 110} + upperBound={this.dataDoc.simulationType == "Projectile" ? this.xMax - 110 : (3 * (this.xMax + this.xMin)) / 4 - this.radius / 2 - 15} value={this.dataDoc.positionXDisplay} effect={(value) => { this.dataDoc.displayChange = ({ xDisplay: value, yDisplay: this.dataDoc.positionYDisplay, }); + if (this.dataDoc['simulationType'] == "Suspension") { + let x1rod = (this.xMax + this.xMin) / 2 - this.radius - this.yMin - 200; + let x2rod = (this.xMax + this.xMin) / 2 + this.yMin + 200 + this.radius; + let deltaX1 = value + this.radius - x1rod; + let deltaX2 = x2rod - (value + this.radius); + let deltaY = this.getYPosFromDisplay(this.dataDoc.positionYDisplay) + this.radius; + let dir1T = Math.PI - Math.atan(deltaY / deltaX1); + let dir2T = Math.atan(deltaY / deltaX2); + let tensionMag2 = + (this.dataDoc.mass * Math.abs(this.dataDoc.gravity)) / + ((-Math.cos(dir2T) / Math.cos(dir1T)) * Math.sin(dir1T) + + Math.sin(dir2T)); + let tensionMag1 = + (-tensionMag2 * Math.cos(dir2T)) / Math.cos(dir1T); + dir1T = (dir1T * 180) / Math.PI; + dir2T = (dir2T * 180) / Math.PI; + const tensionForce1: IForce = { + description: "Tension", + magnitude: tensionMag1, + directionInDegrees: dir1T, + component: false, + }; + const tensionForce2: IForce = { + description: "Tension", + magnitude: tensionMag2, + directionInDegrees: dir2T, + component: false, + }; + const grav: IForce = { + description: "Gravity", + magnitude: this.dataDoc.mass * Math.abs(this.dataDoc.gravity), + directionInDegrees: 270, + component: false, + }; + this.dataDoc['updatedForces'] = ([tensionForce1, tensionForce2, grav]); + } }} small={true} mode={"Freeform"} @@ -2143,7 +2178,6 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi )}{" "} {this.dataDoc.simulationPaused && this.dataDoc.simulationType != "Inclined Plane" && - this.dataDoc.simulationType != "Suspension" && this.dataDoc.simulationType != "Circular Motion" && this.dataDoc.simulationType != "Pulley" && ( <td @@ -2152,7 +2186,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi }} > <InputField - lowerBound={0} + lowerBound={1} dataDoc={this.dataDoc} prop={'positionYDisplay'} step={1} @@ -2164,6 +2198,42 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi xDisplay: this.dataDoc.positionXDisplay, yDisplay: value, }); + if (this.dataDoc['simulationType'] == "Suspension") { + let x1rod = (this.xMax + this.xMin) / 2 - this.radius - this.yMin - 200; + let x2rod = (this.xMax + this.xMin) / 2 + this.yMin + 200 + this.radius; + let deltaX1 = this.dataDoc.positionXDisplay + this.radius - x1rod; + let deltaX2 = x2rod - (this.dataDoc.positionXDisplay + this.radius); + let deltaY = this.getYPosFromDisplay(value) + this.radius; + let dir1T = Math.PI - Math.atan(deltaY / deltaX1); + let dir2T = Math.atan(deltaY / deltaX2); + let tensionMag2 = + (this.dataDoc.mass * Math.abs(this.dataDoc.gravity)) / + ((-Math.cos(dir2T) / Math.cos(dir1T)) * Math.sin(dir1T) + + Math.sin(dir2T)); + let tensionMag1 = + (-tensionMag2 * Math.cos(dir2T)) / Math.cos(dir1T); + dir1T = (dir1T * 180) / Math.PI; + dir2T = (dir2T * 180) / Math.PI; + const tensionForce1: IForce = { + description: "Tension", + magnitude: tensionMag1, + directionInDegrees: dir1T, + component: false, + }; + const tensionForce2: IForce = { + description: "Tension", + magnitude: tensionMag2, + directionInDegrees: dir2T, + component: false, + }; + const grav: IForce = { + description: "Gravity", + magnitude: this.dataDoc.mass * Math.abs(this.dataDoc.gravity), + directionInDegrees: 270, + component: false, + }; + this.dataDoc['updatedForces'] = ([tensionForce1, tensionForce2, grav]); + } }} small={true} mode={"Freeform"} diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationTutorial.json b/src/client/views/nodes/PhysicsBox/PhysicsSimulationTutorial.json index 16d1de96c..3015deaa4 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationTutorial.json +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationTutorial.json @@ -403,7 +403,7 @@ }, { "description": "Tension", - "magnitude": 16.68, + "magnitude": 11.77, "directionInDegrees": 90, "component": false } @@ -423,14 +423,32 @@ ], "showMagnitude": true }, - { "description": "Tension", - "content": "The force of tension acts in the positive y direction: π/2 rad. We know that the acceleration in a simple pulley system is .", + "content": "The force of tension acts in the positive y direction: π/2 rad. We know that the acceleration in a simple pulley system is (mass 2 - mass 1) * acceleration due to gravity / (mass 1 + mass 2) = (1.5-1) * 9.81 / (1.5+1) = 1.962 m/s^2. Because the acceleration is caused by the force of gravity and force of tension, we can solve for the force of tension acting on the weight as mass 1 * (a + acceleration due to gravity) = 1 * (1.962+9.81) = 11.77.", "forces": [ { "description": "Tension", - "magnitude": 16.68, + "magnitude": 11.77, + "directionInDegrees": 90, + "component": false + } + ], + "showMagnitude": true + }, + { + "description": "All Forces", + "content": "Combining all of the forces, we get the following free body diagram.", + "forces": [ + { + "description": "Gravity", + "magnitude": 9.81, + "directionInDegrees": 270, + "component": false + }, + { + "description": "Tension", + "magnitude": 11.77, "directionInDegrees": 90, "component": false } @@ -466,6 +484,116 @@ } ], "showMagnitude": false + }, + { + "description": "Force X Components", + "content": "There are two forces with x components to consider: the tension from the left rod and the tension from the right rod. These must cancel each other out so that the net x force is 0.", + "forces": [ + { + "description": "Left Tension X Component", + "magnitude": 4.907, + "directionInDegrees": 180, + "component": true + }, + { + "description": "Right Tension X Component", + "magnitude": 4.907, + "directionInDegrees": 0, + "component": true + } + ], + "showMagnitude": false + }, { + "description": "Force Y Components", + "content": "There are three forces with y components to consider: the tension from the left rod, the tension from the right rod, and the force of gravity.", + "forces": [ + { + "description": "Left Tension Y Component", + "magnitude": 4.907, + "directionInDegrees": 90, + "component": true + }, + { + "description": "Right Tension Y Component", + "magnitude": 4.907, + "directionInDegrees": 90, + "component": true + }, + { + "description": "Gravity Y Component", + "magnitude": 9.81, + "directionInDegrees": 270, + "component": true + } + ], + "showMagnitude": false + }, { + "description": "Force Y Components", + "content": "The y components of forces must cancel each other out so that the net y force is 0. Thus, gravity = left tension y component + right tension y component. Because the x components of tension are the same and the angles of each rod are the same, the y components must be the same. Thus, the y component for each force of tension must be 9.81/2.", + "forces": [ + { + "description": "Left Tension Y Component", + "magnitude": 4.907, + "directionInDegrees": 90, + "component": true + }, + { + "description": "Right Tension Y Component", + "magnitude": 4.907, + "directionInDegrees": 90, + "component": true + }, + { + "description": "Gravity Y Component", + "magnitude": 9.81, + "directionInDegrees": 270, + "component": true + } + ], + "showMagnitude": true + }, { + "description": "Tension", + "content": "Now that we know the y component of tension for each rod is 4.907, we can solve for the full force of tension as 4.907 = T * sin(45°) -> T = 6.94.", + "forces": [ + { + "description": "Left Tension", + "magnitude": 6.94, + "directionInDegrees": 135, + "component": false + }, + { + "description": "Right Tension", + "magnitude": 6.94, + "directionInDegrees": 45, + "component": false + } + ], + "showMagnitude": true + }, + { + "description": "All Forces", + "content": "Combining all of the forces, we get the following free body diagram.", + "forces": [ + { + "description": "Gravity", + "magnitude": 9.81, + "directionInDegrees": 270, + "component": false + }, + { + "description": "Left Tension", + "magnitude": 6.94, + "directionInDegrees": 135, + "component": false + }, + { + "description": "Right Tension", + "magnitude": 6.94, + "directionInDegrees": 45, + "component": false + } + ], + "showMagnitude": true } ] } |