Child of AirTrafficControl_m

No preview image

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

1 collaborator

Default-person Jim Reierson (Author)

Tags

air traffic simulation game 

Tagged by Jim Reierson about 10 years ago

Child of model AirTrafficControl_m preview imageAirTrafficControl_m
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.5 • Viewed 533 times • Downloaded 32 times • Run 0 times
Download the 'Child of 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.

HOW TO USE IT

  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 an aircraft by moving its heading slider.
  4. Press Go/Stop to pause the simulation.

CHALLENGES

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

OPTIONS

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

EXTENDING THE MODEL

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 jim3311@gmail.com

CREDITS AND REFERENCES

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 that runs in a browser. https://github.com/NetLogo/NetLogo/wiki/Tortoise and http://li425-91.members.linode.com:9000/create-standalone

I took the online course "Introduction to Complexity" http://www.santafe.edu/education/schools/sfi-mooc/

The course uses NetLogo for examples and problems.
NetLogo can be downloaded from http://ccl.northwestern.edu/netlogo/download.shtml 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 sliders

This is the same simulation as the parent AirTrafficControl_m, except for the method of controlling aircraft.

Posted about 10 years ago

Click to Run Model

;  air traffic controller game     Jim Reierson   1/30/2014
;  this version _s controls aircraft with heading sliders
;  includes 11/26/2014 mods to allow compilation with tortoise
breed [airplanes airplane]
breed [halos halo]
globals [dist dist-flown prev_timer temp-dif]

to setup
  clear-all
  reset-ticks
  reset-timer 
  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"
  
    grow-background
  ; draw a fix
  crt 1 [
    set color red
    set pen-size 3
    setxy 8 12
    pendown
    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
    make-halo
    ;;  set color who + 2   changed for compilation with tortoise
    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 heading atan (sin (70 - who * 10 )) (cos (70 - who * 10 ))
   set Heading_1  60
   set Heading_2  50   
   if population > 2 [ set Heading_3  40 ]       
   if population > 3 [ set Heading_4  30 ]
   if population > 4 [ set Heading_5  20 ]           
  ]
  
  ; 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
    make-halo
    set color brown
    set label who
    set heading 270
    setxy 18 6
    
  ]]
    
  ;;  grow-background
  reset-timer
end 

to go
  ;;   move-with-mouse    ;;  used for testing
  set dist max-step-size / 50
  tick 
  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
      
      ifelse Instant_Turn 
        [
          ask airplane 1 [set heading Heading_1]
          ask airplane 2 [set heading Heading_2]       
          if population > 2 [ask airplane 3 [set heading Heading_3]]
          if population > 3 [ask airplane 4 [set heading Heading_4]]
          if population > 4 [ask airplane 5 [set heading Heading_5]]
        ]
       
        [ set temp-dif (subtract-headings Heading_1  [heading] of airplane 1 )   ;  simplify in future with procedure
           if ( abs temp-dif > 1 )
              [ask airplane 1 [set heading  (heading + (0.1 * max-step-size) * (temp-dif / (abs (temp-dif))))]]   
              
           set temp-dif (subtract-headings Heading_2  [heading] of airplane 2 )
           if ( abs temp-dif > 1 )
              [ask airplane 2 [set heading  (heading + (0.1 * max-step-size) * (temp-dif / (abs (temp-dif))))]] 
                
           if population > 2 [set temp-dif (subtract-headings Heading_3  [heading] of airplane 3 )
           if ( abs temp-dif > 1 )
              [ask airplane 3 [set heading  (heading + (0.1 * max-step-size) * (temp-dif / (abs (temp-dif))))]]]
              
           if population > 3 [set temp-dif (subtract-headings Heading_4  [heading] of airplane 4 )
           if ( abs temp-dif > 1 )
              [ask airplane 4 [set heading  (heading + (0.1 * max-step-size) * (temp-dif / (abs (temp-dif))))]]]
              
           if population > 4 [set temp-dif (subtract-headings Heading_5  [heading] of airplane 5 )
           if ( abs temp-dif > 1 )
              [ask airplane 5 [set heading  (heading + (0.1 * max-step-size) * (temp-dif / (abs (temp-dif))))]]]   
        ]
      pen-down
      forward  dist
      set dist-flown  dist-flown + dist
           ask other airplanes in-radius 3  [ set color black ] 
  ]
  set prev_timer timer
  ]
end 

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

to grow-background
  ask patches [set pcolor 59]
end 

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 ] ]
end 


  ;;to move-with-mouse      ;  used for testing
  ;;   if mouse-down? [
  ;;    let candidate min-one-of turtles [distancexy mouse-xcor mouse-ycor]
  ;;   if [distancexy mouse-xcor mouse-ycor] of candidate < 1 [
      ;; The WATCH primitive puts a "halo" around the watched turtle.
  ;;      watch candidate
  ;;      while [mouse-down?] [
        ;; If we don't force the view to update, the user won't
        ;; be able to see the turtle moving around.
  ;;        display
  ;;        ;; The SUBJECT primitive reports the turtle being watched.
  ;;        ask subject [ setxy mouse-xcor mouse-ycor ]
  ;;     ]
  ;;     ;; Undoes the effects of WATCH.  Can be abbreviated RP.
   ;;     reset-perspective
  ;;    ]
  ;;  ]
  ;;end

There are 2 versions of this model.

Uploaded by When Description Download
Jim Reierson over 9 years ago Changes allow compilation with Tortoise to produce a HTML5 file that runs in a browser. Download this version
Jim Reierson about 10 years ago Air Traffic Control Game with sliders for heading changes Download this version

Attached files

No files

Parent: AirTrafficControl_m

This model does not have any descendants.

Graph of models related to 'Child of AirTrafficControl_m'