Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
repository:rear-end_collision [2020/08/24 20:32]
porcaro1 [Answer Key]
repository:rear-end_collision [2021/02/17 18:33] (current)
porcaro1
Line 2: Line 2:
 ====Activity Information==== ====Activity Information====
 ===Learning Goals=== ===Learning Goals===
-*Apply the principles of constant velocity motion +  ​*Apply the principles of constant velocity motion ​([[https://​www.nextgenscience.org/​pe/​hs-ps2-1-motion-and-stability-forces-and-interactions | HS-PS2-1]]) 
-*Create and modify computational models to describe/​show a given system+  *Create and modify computational models to describe/​show a given system
 ===Prior Knowledge Required=== ===Prior Knowledge Required===
-  * 1-Dimensional ​Kinematics+  * 1-Dimensional ​kinematics
     * The relationship between position, distance, displacement,​ speed, and velocity     * The relationship between position, distance, displacement,​ speed, and velocity
-    * Position vs. Time and Velocity ​vs. Time graphs +    * Position vs. time and velocity ​vs. time graphs 
-  * Scalar and Vector Quantities+  * Scalar and vector quantities
  
 ===Code Manipulation=== ===Code Manipulation===
Line 17: Line 17:
 ====Activity==== ====Activity====
 ===Handout=== ===Handout===
 +{{ :​repository:​rear-end_collision_1.png?​nolink&​600|}}
 **Rear-End Collision** ​ **Rear-End Collision** ​
  
Line 22: Line 23:
   - When and where will the crash occur?   - When and where will the crash occur?
   - Create a position vs. time graph that includes both cars' motion (optional). ​   - Create a position vs. time graph that includes both cars' motion (optional). ​
 +
 +**Note:** when conducting this activity with students, the initial positions and velocities of the vehicles can be provided by the instructor, but for demonstration purposes they have been included in the code below.
 +
 +To perform this virtual experiment in real life, constant velocity toy cars can be purchased [[https://​www.arborsci.com/​products/​constant-velocity-car | here]].
 ===Code=== ===Code===
-[[https://trinket.io/glowscript/bf8901f2cb ​| Link]]+[[https://www.glowscript.org/#/​user/​porcaro1/​folder/​RepositoryPrograms/​program/​Rear-EndCollision-Incomplete/edit | Link]]
 <code Python [enable_line_numbers="​true"​]>​ <code Python [enable_line_numbers="​true"​]>​
 GlowScript 2.7 VPython GlowScript 2.7 VPython
Line 75: Line 80:
 ====Answer Key==== ====Answer Key====
 ===Handout=== ===Handout===
-  ​- We can solve for where and when the crash will occur by creating a system of equations and solving (much like we did in the [[https://​www.msuperl.org/​wikis/​icsam/​doku.php?​id=repository:​head-on_collision | Head-On Collision] activity). Let's start by creating a kinematic equation describing the motion of the fast, red buggy: ​$x=-5+5t$. This equation is essentially saying that the red buggy starts ​5 units to the left of the origin and moves to the right 5 units for every unit of time (lines 4 and 12). Now let's do the same for the slower, blue buggy: $x=0+3t$ (lines 5 and 13). Setting these equations equal to each other will allow us to find out how long until the collisions: ​$$-5+5t=0+3t$$ ​Solving ​for $t$: $2t=5$ therefore $t=\dfrac{5}{2}=2.5$. The crash will occur after 2.5 units of time. We can plug this back into any of our two initial kinematic equations to find out where the crash will occur: $x=-5+5*2.5=7.5$ units. ​+{{ :​repository:​rear-end_collision_2.png?​nolink&​600|}} 
 +We can solve for where and when the crash will occur by creating a system of equations and solving (much like we did in the [[https://​www.msuperl.org/​wikis/​icsam/​doku.php?​id=repository:​head-on_collision | Head-On Collision]] activity). Let's start by creating a kinematic equation describing the motion of the fast, red buggy: ​We know the initial position of the red buggy is 5 units to the left of the origin ​(line 4) and moving ​to the right with a velocity of 5 units or length per unit of time (line 12). Therefore, the kinematic equation to describe the position of the red buggy is $x=-5+5t$. Now let's do the same for the slower, blue buggy: $x=0+3t$ (lines 5 and 13). Setting these equations equal to each other will allow us to find out how long until the collisions: $-5+5t=0+3t$. However, we aren't quite ready to solve first; We need to remember that these buggies have a physical length of 2 (lines 3 and 4) while their positions in the code represent the centers of the buggies. We don't want to solve for when the cars are intersecting but rather when the front of the red buggy collides with the rear bumper of the blue buggy. We can compensate for this in the equations by adding a length unit for the red buggy equation and subtracting a length unit for the blue buggy equation: ​$x=-4+5t$ and $x=-1+3t$, respectively. Now we can solve for $t$ by setting the equations equal to one-another$$-4+5t=1+3t$$ Simplifying we get $2t=3$ therefore $t=\dfrac{3}{2}=1.5$. The crash will occur after 1.5 units of time. We can plug this back into any of our two initial kinematic equations to find out where the crash will occur: $x=-4+5*1.5=-1+3*1.5=3.5$. The buggies will collide 3.5 units to the right of the origin; in other words (accounting for the length of each vehicle), the position of the center of the red buggy at the crash site will be at 2.5 units to the right of the orign and the the center of the blue buggy will be at 4.5 units. 
 + 
 +See highlighted lines below to see important code modifications
 ===Code=== ===Code===
-<code Python [enable_line_numbers="​true",​ highlight_lines_extra=""​]>​+<code Python [enable_line_numbers="​true",​ highlight_lines_extra="​12,​13,​39,​40,​41,​42"]> 
 +GlowScript 2.7 VPython 
 +## Code for a particle object and a ground object 
 +redbuggy = box(pos=vector(-5,​1,​0),​ length = 2, width = 1, height = 1,color = color.red) 
 +bluebuggy = box(pos=vector(0,​1,​0),​ length = 2, width = 1, height = 1,color = color.blue) 
 +ground = box(pos=vector(0,​0,​0),​ length = 20, width = 1, height = 1, color=color.white) 
 + 
 +## Assign the particle a fixed velocity 
 +redbuggy.velocity = vector(5,​0,​0) 
 +bluebuggy.velocity = vector(3,​0,​0) 
 + 
 +## Creates an arrow to visualize the particle'​s velocity  
 +vArrow = arrow(pos=redbuggy.pos,​ axis = redbuggy.velocity,​ color = redbuggy.color) 
 +vArrow = arrow(pos=bluebuggy.pos,​ axis = bluebuggy.velocity,​ color = bluebuggy.color) 
 + 
 +## Set up the time variables for the while loop 
 +dt = 0.01 
 +t = 0 
 +tf = 5 
 + 
 +def add_time(t,​dt):​ 
 +    new_t = t+dt 
 +    return new_t 
 + 
 +#Click Screen to Start 
 +scene.waitfor('​click'​) 
 + 
 +## While loop to iterate over the time interval 
 +while redbuggy.pos.x < bluebuggy.pos.x-2:​ 
 +     
 +    rate(100) ## Defines the rate at which the program runs 
 +     
 +    ## Update position of particle based on its velocity 
 +    redbuggy.pos = redbuggy.pos + redbuggy.velocity*dt 
 +    bluebuggy.pos = bluebuggy.pos + bluebuggy.velocity*dt 
 +     
 +    #​redbuggy.pos  
 +    
 +    ## Keep the arrow representing the particle'​s velocity and acceleration 
 +    vArrow.pos = redbuggy.pos 
 +    vArrow.axis = redbuggy.velocity 
 +    vArrow.pos = bluebuggy.pos 
 +    vArrow.axis = bluebuggy.velocity 
 +    
 +    t=add_time(t,​dt) 
 +     
 +    print("​time=",​t,"​RedPos = ",​redbuggy.pos.x,"​BluePos = ", bluebuggy.pos.x)
 </​code>​ </​code>​
  
 ---- ----
 ====See Also==== ====See Also====
-  *+  *[[colliding_crates | Colliding Crates]] 
 +  *[[head-on_collision | Head-On Collision]] 
 +  *[[phineas_&​_ferb | Phineas & Ferb]]
   ​   ​
  • repository/rear-end_collision.1598301164.txt.gz
  • Last modified: 2020/08/24 20:32
  • by porcaro1