Airports?

No preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Model group LS426-2012 | Visible to everyone | Changeable by group members (LS426-2012)
Model was written in NetLogo 5.0RC7 • Viewed 1094 times • Downloaded 87 times • Run 0 times
Download the 'Airports?' 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 depicts airplanes flying between airports. It is meant to demonstrate the phenonmenon of how "hub" airports form. Over time new airports are built, but you can see that the airports that have existed for the longest still have the greatest number of airplanes flying to them.

HOW IT WORKS

We start with a few airports and airplanes that appear on the screen at random locations. At each tick, the airplanes find a random airport and fly to it, leaving trails to show their paths. Every 25 ticks, a new airport and a new airplane are built.

The airports are identified as green patches that have the property airport? = true. The airplanes are turtles that are asked to fly between airports. To do this, each turtle first checks if the patch it's currently on is airport? = true. If the patch the turtle is currently on is not an airport, the turtle chooses one of the airports at random to face. Then, as long as the turtle is on a patch that is not an airport, it will keep moving forward in it's given heading. That way it will eventually come to the airport it's facing. Once the turtle recognizes that the patch it's on is an airport, (airport? = true) the airplane departs, which means it chooses a random heading and flies to a random airport.

HOW TO USE IT

For this model, it helps to view it at a slower than normal speed. Use the slider to choose the number of initial airports and airplanes. Then click on setup to make those appear. Clicking go will cause the airplanes to start flying.

The plot shows the airports on the x-axis (with the most recently created airports on the right). The number of flights that have departed from each airport are shown on the y-axis.

THINGS TO NOTICE

You should notice that, over time, there are more path lines from the airports that were around the longest. Check this out on the plot!

THINGS TO TRY

Right click on an airport and inspect the patch. You can see the exact number of flights that have departed from that airport.

EXTENDING THE MODEL

Challenge #1 Right now the planes randomly choose a new airport to fly to. Sometimes the airplane will end up trying to fly to the airport it's already at. Can you help us fix that bug?

Challenge #2 Try to get each new airplane, as it's created, start out at the newest airport.

CREDITS AND REFERENCES

This was created by Laurel Schrementi and Ellen Fitzmorris. Thanks to our wonderful TAs for helping us out!

Comments and Questions

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

Click to Run Model

  patches-own ;; this way turtles can recognize which patches are airports and which aren't
 [airport? ;; patches are either airports (airport? = true) or not (airport? = false)
 num-of-flights ;; so airports keep track of how many turtles have departed from them
 airport-id] ;; this helps us with the plotting.  the airport-id will be on the x-axis and the number of flights that have departed from each airport (corresponding to it's airport-id) will be on the y-axis)

globals [airport-count] ;; to help us keep track of the total number of airports and to keep the airport-id procedure increasing by 1 for each new airport created

to setup
  clear-all
  set airport-count 0 ;; because there are no airports yet!
 ask patches [set airport? false] ;; to make all the black patches not airports
    repeat initial-airports ;; use the slider to set # of initial airports
    [ask patch  random-pxcor random-pycor 
    [ set pcolor green 
      set num-of-flights 0  ;; because no flights have departed yet
      set airport-id airport-count ;; so the first airport created has an airport-id of 0
      set airport-count airport-count + 1] ] ;; we need to increase the airport-count so that next time an airport is created it will have a higher id number
    ask patches with [pcolor = green] [set airport? true] ;; to make the green patches be recognizable to turtles as airports
    crt initial-airports [set color red setxy random-xcor random-ycor ] ;; still working on how to get the airplanes to appear at same location as the airports
    set-default-shape turtles "airplane" ;; for fun and authenticity
    reset-ticks
end 

to go
  ask turtles [fly] ;; asks turtles to fly to an airport
  new-airport ;; creates new airports after a set # of ticks
  tick
end 

to new-airport
  if remainder ticks 25 = 0 ;; this is asking if the total number of ticks divided by twenty five leaves no remainder. this way this procedure will happen only every 25 ticks
  [ask patch  random-pxcor random-pycor 
    [ set pcolor green  set num-of-flights  0  
      set airport-id airport-count 
      set airport-count airport-count + 1]  ;; makes a new airport with a new airport-id
    crt 1 [set color red setxy random-xcor random-ycor] ;; and a new airplane
    ask patches with [pcolor = green] 
    [set airport? true] ]
end 

to fly
 pd ;; so it leaves a nice path we can see
land
end 

to land  ;; turtle procedure
  ifelse airport? 
  [depart] ;; if the patch the turtle is on right now is an airport, it's time to depart and find a new airport
  [ let airports patches with [airport? = true]  ;; this let command tells the turtles that all patches that answer true to airport? are in fact airports
   face one-of airports ;; this tells the turtle to choose just one of the patches it now knows it an airport to face (changes turtle's heading so it heads toward the airport)
   while [airport? = false] [ fd 1 ] ]  ;; as long as the turtle is on a patch that is not an airport it will keep moving forward in it's given heading. 
end 

to depart
 set heading random 170 ;; just to add some randomness
  ask patch-here [set num-of-flights num-of-flights + 1]
 fd 1
land ;; so the turtle will continue to look for another airport
end 

There are 3 versions of this model.

Uploaded by When Description Download
Laurel Schrementi over 13 years ago most recent version with plane image! Download this version
Laurel Schrementi over 13 years ago This is our most current version! Download this version
Laurel Schrementi over 13 years ago Initial upload Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.