Car Kinematics Model

Car Kinematics Model preview image

2 collaborators

Redpanda Joshua Abraham (Author)
Kailey Jo (Team member)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.5 • Viewed 707 times • Downloaded 41 times • Run 0 times
Download the 'Car Kinematics Model' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This model simulates the relationship between position, velocity, and acceleration of an object. It is assumed there is no other variables like friction, wind resistance, et cetera.

Position, also defined as displacement, is determined by the location of the object relative to its initial position. Assuming that the initial position is 0 meters (m), then 1m is to the right of the origin and -1m is to the left of the origin.

Velocity is the change in position divided by the change in time. Unlike speed, however, velocity provides directionality. Velocity can be graphically represented as the slope of the tangent line at a point on a position versus time graph. In calculus, the equation for velocity is the derivative of an equation for the change in position, with respect to position. In this model, velocity is measured in meters per second (m/s).

Acceleration is the change in velocity divided by the change in time, or the rate of change of velocity. Acceleration can be respresented by the slope of the tangent line of a point on the velocity graph. In this model, acceleration is measured in meters per second squared (m/s^2)

The model examines how each variable is related. The user controls the initial velocity, acceleration, and if the car will stop at a velocity of zero or continue accelerating. Exploration of the various variables will demonstrate how veloctiy and acceleration affect position. The effects can be viewed on the various graphs on the User Interface (UI).

HOW IT WORKS

This model keeps track of four key variables: ticks, position, velocity, and acceleration.

  • {Ticks} are used by NetLogo to keep track of time. Each iteration of the "go" procedure adds one tick. Ticks, as time, are used for displaying position, velocity, and acceleration at a given time.

  • {Position}, also defined as displacement, is kept track of in this model based on the velocity. At each tick, the value for "car-position" is increased or decreased depending on the "data-velocity" described below.

  • {Velocity} is the change in position over time. The value for velocity in this model is separated with two variables: one for data display and one for physical movement in the world. Velocity is separated in this way to apply a 1/4 scaling of the model for 1 patch per 4 meters. "Data-velocity" keeps track of the unscaled velocity for data display on the UI. "Tick-velocity" keeps track of the 1/4 scaled velocity for movement at a given tick.

  • {Acceleration} is the cange in velocity over time. The value for acceleration is added to the value for velocity at each tick to represent this relationship. Acceleration is also scaled down by 1/4 when applied to "tick-velocity" and unscaled when added to "data-velocity."

Various data is displayed on the UI:

  • Monitors display the position, (data) velocity, and acceleration at a given tick.

  • Three graphs display the position, (data) velocity, and acceleration at each tick during the model. The graphs also plot an x-axis as a teal line for ease of reference.

HOW TO USE IT

(1) Choose an initial velocity using the "Initial-Velocity" slider. (2) Choose a starting acceleration using the "Acceleration" slider. (3) Decide if you want the program to stop or the car to begin reversing when velocity is zero by using the "Stop?" switch. If "Stop?" is selected as ON, then the program will halt once velocity (4) Click setup. An orange car on a road facing the right of the world should appear. (5) Select the "go" button. This will make the car move according to the information provided by the sliders.

At any point during the model, the "go" button can be deslected to stop the model manually.

During the model, the acceleration value can either be kept constant or manipulated through the slider. However, velocity during the simulation cannot be direcly changed. Only "initial-velocity" can be altered before the simulation begins.

THINGS TO NOTICE

Using the graphs in the user interface, how are displacement/position, velocity, and acceleration related? Do the displayed graphs illustrate that velocity is the slope of a position versus time graph and that acceleration is the slope of a veloicty versus time graph? Is velocity positive or negative when the slope of the position graph is positive? Is acceleration positive or negative when the slope of the velocity graph negative?

Also, what happens to the position graph when the car is moving backwards (make sure the "Stop?" switch is turned OFF)? Why do you think the happens?

THINGS TO TRY

1) Make the velocity and acceleration positive numbers. What does the car do?

2) Make both the velocity and acceleration negative. What does the car do?

3) Make the velocity positive and the acceleration negative. Make sure "Stop?" is set at OFF. Now what does the car do? How is this different from the previous two scenarios? What happens when velocity approaches and then passes the x-axis? Do these results still verify the relationship between position, velocity and acceleration?

EXTENDING THE MODEL

To make the code more complicated, a person could add in the effect of air resistance on speed. How will the car move with wind speeds at 10m/s versus 30m/s?

Also, factors such as weight can be added. The model could demonstrate how a race car will take less time to speed up than a semi-truck or how aerodynamics help affect movement.

NETLOGO FEATURES

Note the use of "Globals" at the top of the code to define variables not present in the user interface.

Graphs are particularly helpful in this model for demonstrating relationships between each property of movement.

RELATED MODELS

Traffic basic under "Social Science" in the NetLogo models library is useful for examining effects of car traffic and its relationship to speed.

CREDITS AND REFERENCES

Programmed by: Joshua Abraham and Kailey Sarmiento Teacher: Mr. Reese Tracy High School IB Physics Period 1

  • Tsokos, K.A. Physics for the IB Diploma. 5th Edition. Cambridge Learning.

Credit to NetLogo program and for the "Traffic Basic" model for fractions of this simulation's code:

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [tick-velocity                                      ;tick-velocity is for the scaled-down (1/4) velocity for visual purposes within the patch-based world
  data-velocity                                             ;data-velocity is for the actual velocity for data purposes outside of the world
  car-position                                              ;car-position keeps track of the displacement of the car relative to the origin
  x-axis                                                    ;x-axis allows plot to graph x-axis and remains constant
  barrier-written                                           ;barrier-written shows if the mach speed string has been displayed already, to prevent repetition
  ] 

turtles-own [cloud-speed]                                   ;speed of individual clouds

to setup                                                    ;resets and creates the world
  ca                                                        ;clears previous world
  reset-ticks                                               ;and resets ticks for graphs
  ask patches                                               ;asks all patches to
   [set pcolor 66]                                          ;turn bottom half light green
  ask patches with [pycor >= 0] 
   [set pcolor 96]                                          ;and turn top half sky blue
  ask patches with [pycor <= 0 and pycor >= -2] 
    [set pcolor 6]                                          ;creates road at certain patch y-coordinates
  create-turtles 1 [set shape "car"                         ;creates car
    set size 6                                              ;of size 6
    set heading 90                                          ;makes car face right
    set color 24]                                           ;set car color orange 
  create-turtles 30 [set shape "cloud"                      ;creates aesthetic clouds
    set size 2 + random 7                                   ;and varies their shape
    set heading 90                                          ;and sets their heading right
    set color white                                         ;with a white color
    set ycor (8 + random 5)                                 ;places clouds above road and below top of world 
    set xcor random-pxcor                                   ;and randomly on the x-axis
  ]
  ask turtles                                               ;defines random speed of each cloud
    [set cloud-speed .1 + (random 3 / 10)]                  
  set tick-velocity (initial-velocity / 25)                 ;sets velocity during model and applies scaling of 1/4 
  set data-velocity initial-velocity                        ;sets velocity during model for un-scaled (1/1) graphical and data purposes
  set car-position 0                                        ;sets displacement equal to zero 
  set x-axis 0                                              ;sets x-axis value for 0
end                                                          

to go                                                       ;continuous procedure that runs the model
  value-update                                              ;calls the value-update procedure
  change-position                                           ;calls the change-position procedure
  cloud-movement                                            ;calls the cloud-movement procedure
  mach-speed                                                ;calls the mach-speed procedure
                                                            
  ifelse stop? [                                            ;checks if car should stop instead of reverse as set in interface
                                                            ;if stop? is ON, then allows one iteration of the go procedure before stopping program
  if ticks > 10 [                                           ;prevents program from stopping if initial-velocity is 0 
  ifelse ((data-velocity < 0.5)                             ;checks if the actual (data) velocity is near 0
    and (data-velocity > -0.5))                            
   [ask turtles with [shape = "car"]                        ;continues to move the car with one more "go" iteration 
     [fd tick-velocity]                                     ;at the given velocity
    tick                                                    ;ticks for final graph update
    value-update                                            ;then updates values for velocity 
    change-position                                         ;and for displacement
    stop]                                                   ;then stops the model
   
   [ask turtles with [shape = "car"]                        ;if velocity is not near 0, move regularly 
     [fd tick-velocity]  ]
  ]
  ]
  
  [
   ask turtles with [shape = "car"]                         ;if Stop? switch is OFF move regularly
     [fd tick-velocity]                                     ;at the given tick-velocity 
  ]
 
  
  tick                                                      ;ticks for graph update
  wait .05                                                  ;slows "go" procedure 
end                                                          ;ends command code for setup

to value-update                                             ;procedure to update multiple values
  set tick-velocity                                         ;updates tick-velocity based on the
    (tick-velocity                                          ;previous tick-velocity and  
    + (acceleration / 25)                                   ;the scaled acceleration 
     )                                
    
  set data-velocity (data-velocity   
    + acceleration)                                         ;updates data-velocity based on actual acceleration
end                               

to change-position                                          ;procedure to update position
  set car-position (car-position +  
    data-velocity)                                          ;changes position based on unscaled velocity
end                                                          

to cloud-movement                                           ;procedure to move aesthetic clouds
  ask turtles with [shape = "cloud"]                        
    [fd cloud-speed]                                        ;moves clouds forward based on random speed given during "setup"
end 

to mach-speed                                               ;proecedure to display when sound barrier is broken
  if data-velocity > 343.3 and                              ;if velocity breaks the sound barrier, 
  barrier-written != 1                                      ;ensures that the message has not been displayed yet
    [type "You broke the sound barrier! "                   ;displays message in command center
      set barrier-written 1]                                ;prevents further displays of the string above
    
  if data-velocity < -343.3 and                             ;copy as above but for negative velocities
  barrier-written != 1                                      ;ensures that the message has not been displayed yet
    [type "You broke the sound barrier! "                   ;displays message in command center
      set barrier-written 1]                                ;prevents further displays of the string above
    
  if data-velocity > -343.3 and                             ;if the velocity returns within the sound barrier
  data-velocity < 343.3
    [set barrier-written 0]                                 ;resets display so that message can be redisplayed later
end 

;Written by

;Kailey Sarmiento
;Joshua Abraham
;Period 1
;IB Physics SL
;Sept. 19, 2014

There is only one version of this model, created almost 9 years ago by Joshua Abraham.

Attached files

File Type Description Last updated
Car Kinematics Model.png preview Preview for 'Car Kinematics Model' almost 9 years ago, by Joshua Abraham Download

This model does not have any ancestors.

This model does not have any descendants.