AirTrafficControl_m preview image

This model is seeking new collaborators — would you please help?

1 collaborator

Default-person Jim Reierson (Author)


air traffic simulation game 

Tagged by Jim Reierson over 10 years ago

Parent of 1 model: Child of AirTrafficControl_m
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.5 • Viewed 1344 times • Downloaded 67 times • Run 0 times
Download the 'AirTrafficControl_m' modelDownload this modelEmbed this model

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

Jim's Air Traffic Control Game

Test your skill as an Air Traffic Controller.
Adjust aircraft headings so they cross the fix (the triangle symbol) in an orderly line and then head for the upper right corner of the screen. If halos touch, the aircraft are too close to each other and turn black -- try to avoid that. Maneuver the aicraft so that they cross the fix closely spaced, but with no black aircraft.


  1. Press Initialize (if you don't see a halo around each aircraft, press initialize again).
  2. Press Go/Stop to start the simulation.
  3. Turn aircraft by clicking to the left or right of the nose of an aircraft.
  4. Press Go/Stop to pause the simulation.


If you want to keep score, try to get all aircraft across the fix with minimum distance flown or minimum time, as shown in the two status boxes.

Cross the fix in order -- 1,2,3,..
Change things up by specifying a different order, for example, 2,1,3


Select the aircraft population ( 2 - 5 ). Speed up aircraft with the max-step-size slider. Setting Instant_Turn OFF makes aircraft execute more realistic smooth turns. Setting Crossing_Traffic ON adds a crossing aircraft to be avoided


This is a very simple simulation. Real air traffic controllers also issue instructions to change aircraft speed and altitude for spacing and traffic avoidance.

If you want to suggest things to add or change email me at


Jim Reierson 1/30/2014 and 11/26/2014 copyright 2014 James Reierson

This version includes 11/26/2014 mods to allow compilation with Tortoise to produce a JavaScript-based HTML5 file. At this time, browsers hang when mouse clicks on aircraft. However, the compiled child model with headings controlled by sliders does work. and

I took the online course "Introduction to Complexity"

The course uses NetLogo for examples and problems.
NetLogo can be downloaded from The download contains documation and a library of models and code examples, all very well done and easy to use.

Comments and Questions

Control aircraft headings with mouse

Turn aircraft by clicking within halo to left or right of aircraft nose. Child model uses sliders for aircraft heading control.

Posted over 10 years ago

Click to Run Model

;  air traffic controller game     Jim Reierson  11/26/2014
;  change aircraft direction by clicking mouse
;  11/26/2014 mods to allow compilation with tortoise  
;      -- as of 11/26/2014 this will compile in tortoise but browser freezes after mouse clicks
breed [airplanes airplane]
airplanes-own [old-heading new-heading]
breed [halos halo]
globals [dist dist-flown prev_timer temp-dif]

to setup
  set prev_timer timer     ;  use timer intervals rather than ticks so aircraft movement not a function of cpu speed
  set-default-shape halos "circle" ;  "circle 2"
  ; draw a fix
  crt 1 [
    set color black
    set pen-size 3
    setxy 8 12
    set heading 90
    fd 1
    left 120
    fd 1
    left 120
    fd 1
    ;; die   ;  keeps default triangle in place when compiled with tortoise
  create-airplanes population
    set shape "airplane"             ; shape size relative to patch size  shapes: airplane, circle 2, target
    set size 2
    ;;  set color who + 2
    set color who * 10 + 45
    set label who
    set label-color black
    set heading 20
       ; set dest to be x= 8, y= 12,   all turtles initially equidistant and heading to fix
    setxy (8 - 27 * sin (70 - who * 10 )) (12 - 27 * cos (70 - who * 10 ))
    set heading (70 - who * 10 )
    set old-heading heading
    set new-heading heading  
  ; create crossing traffic
    if Crossing_Traffic   [ create-airplanes 1
   [  set shape "airplane"             ; shape size relative to patch size  shapes: airplane, circle 2, target
    set size 2
    set color brown
    set label who
    set heading 270
    set old-heading heading
    set new-heading heading 
    setxy 18 6

to go
  ;every 0.5 
  set dist max-step-size / 50     
  if (timer - prev_timer) > .1  
   [ask airplanes 
      ; if (( [heading] of airplane 1 ) = Heading_1 ) [ask airplane 1 [set heading Heading_1]]  ;; errors
      ; if not Instant_Turn [ask airplane 1 [set heading heading + ((Heading_1 - heading) / 100 )]]   ;  needs work
        set temp-dif (subtract-headings new-heading heading)
         if ( abs temp-dif > 1 )
              [set heading  (heading + (0.8 * max-step-size) * (temp-dif / (abs (temp-dif))))] 
      forward  dist
      set dist-flown  dist-flown + dist
           ask other airplanes in-radius 3  [ set color black ] 
  set prev_timer timer

to-report coin-flip?     ; returns true or false at random   --- not used presently
  report random 2 = 0

to grow-background
  ask patches [set pcolor 59]

to make-halo  ;; turtle procedure
  ;; when you use HATCH, the new turtle inherits the
  ;; characteristics of the parent.  so the halo will
  ;; be the same color as the turtle it encircles (unless
  ;; you add code to change it
  hatch-halos 1
  [ set size 3
    ;; Use an RGB color to make halo three fourths transparent
    ;; set color lput 90 extract-rgb color    removed for compilation with tortoise
   set color lput 50 [100 0 0]
    ;; set thickness of halo to half a patch
   ;; __set-line-thickness 0.1
    ;; We create an invisible directed link from the runner
    ;; to the halo.  Using tie means that whenever the
    ;; runner moves, the halo moves with it.
    create-link-from myself
    [ tie
      hide-link ] ]

to turn-to-mouse      ;  this one works best so far
   while [mouse-down? ]          
    [let airplane min-one-of airplanes [distancexy mouse-xcor mouse-ycor]
      if [distancexy mouse-xcor mouse-ycor] of airplane < 3 [
      ;; The WATCH primitive puts a "halo" around the watched turtle.
        watch airplane
        ;; The SUBJECT primitive reports the turtle being watched.
        ask airplane [set old-heading heading]
        ask airplane [facexy mouse-xcor mouse-ycor]
        ask airplane [set new-heading heading]
        if (not Instant_Turn)
        [ ask airplane [set  heading old-heading]]
        ; if (not Instant_Turn) [ask airplane [set heading old-heading]]
      ;; Undoes the effects of WATCH.  Can be abbreviated RP.

to-report head2
 ;; report airplane 2 show new-heading

There are 2 versions of this model.

Uploaded by When Description Download
Jim Reierson over 9 years ago Contains changes to allow compilation with Turtle. Download this version
Jim Reierson over 10 years ago Initial upload Download this version

Attached files

File Type Description Last updated
AirTrafficControl_m.png preview Preview for 'AirTrafficControl_m' over 10 years ago, by Jim Reierson Download

This model does not have any ancestors.


Graph of models related to 'AirTrafficControl_m'