Gridlock

Gridlock preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

hubnet 

Tagged by Reuven M. Lerner over 9 years ago

traffic 

Tagged by Reuven M. Lerner over 9 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0beta5 • Viewed 554 times • Downloaded 44 times • Run 0 times
Download the 'Gridlock' 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?

Students control traffic lights in a real-time traffic simulation. The teacher controls overall variables, such as the speed limit and the number of cars. This allows students to explore traffic dynamics, which can lead into many areas of study, from calculus to social studies.

Challenge the students to develop strategies to improve traffic and discuss the different ways to measure the quality of traffic.

The coordinates for the traffic lights are based on the first quadrant of the Cartesian plane. Therefore, the traffic light with the coordinates (0,0) is in the lowest row and the left-most column. The traffic light above it has coordinates (0,1) and the traffic light to the right of it has (1,0).

For further documentation, see the Participatory Simulations Guide found at http://ccl.northwestern.edu/ps/

HOW TO USE IT

Quickstart instructions

Contains instructions as to how to quickly setup the model, and clients to run this activity. The instructions can be found below and can be seen progressively in the Quick Start instructions monitor in the Interface:

Teacher: Follow these directions to setup the HubNet activity.
Optional: Zoom In (see Tools in the Menu Bar)
Change the traffic grid (using the sliders GRID-SIZE-X and GRID-SIZE-Y) to make enough lights for everyone.
Change any other of the settings that you would like to change. For example, if you plan on running Gridlock in the MANUAL mode, be sure to have AUTO? set to OFF.

Press the SETUP button.
Press the LOGIN button.

Everyone: Open up a HubNet Client on your machine and input the IP Address of this computer, type your user name in the user name box and press ENTER.
Teacher: Once everyone is logged in and has a light, stop the LOGIN button by pressing it again.

Everyone: Whichever mode AUTO? is set for in NetLogo, you will control your intersection in a different way:
If you have chosen MANUAL, you can change the state of your light by pressing the CHANGE LIGHT button.
If you have chosen AUTO, you can change the phase of your light by moving the PHASE slider to a different position.

Teacher: Once everyone is ready, start the simulation by pressing the GO button.

Teacher: You may want to view some of the plots. Do this by changing the PLOTS-TO-DISPLAY chooser, which changes the plot displayed for everyone.

  • Choose 'No Plots' to turn off all the plots.
  • Choose 'Stopped Cars' to see the STOPPED CARS plot.
  • Choose 'Average Speed of Cars' for the AVERAGE SPEED OF CARS plot.
  • Choose 'Average Wait Time of Cars' for the AVERAGE WAIT TIME OF CARS plot.
  • Choose 'All three plots' for all the plots.

Teacher: To run the activity again with the same group, stop the model by pressing the GO button, if it is on. Change the values of the sliders and switches to the values you want for the new run. Press the SETUP button. Once everyone is ready, restart the simulation by pressing the GO button.

Teacher: To start the simulation over with a new group, stop the model by pressing the GO button, if it is on, press the RESET button in the Control Center and follow these instructions again from the beginning.

Buttons

SETUP - generates a new traffic grid based on the current GRID-SIZE-X and GRID-SIZE-Y and NUM-CARS number of cars. This also clears all the plots. If the size of the grid has changed the clients will be assigned to new intersections.
GO - runs the simulation indefinitely
LOGIN - allows users to log into the activity without running the model or collecting data
REFRESH PLOTS - redraws the plots based on the current value of PLOTS-TO-DISPLAY. Useful for looking at different plots when GO is off.

Sliders

SPEED-LIMIT - sets the maximum speed for the cars
NUMBER - the number of cars in the simulation (you must press the SETUP or RE-RUN buttons to see the change)
SIMULATION-SPEED - the speed at which the simulation runs
TICKS-PER-CYCLE - sets the maximum value that the phase can be. This has no effect when the model is run with AUTO? false. Also, the phase that each user chooses is scaled to be less than or equal to this value.
GRID-SIZE-X - sets the number of vertical roads there are (you must press the SETUP button to see the change)
GRID-SIZE-Y - sets the number of horizontal roads there are (you must press the SETUP button to see the change)

Choosers

PLOTS-TO-DISPLAY - determines which plot is drawn in NetLogo:

  • No Plots.
  • STOPPED CARS
  • AVERAGE SPEED OF CARS
  • AVERAGE WAIT TIME OF CARS
  • All three plots.

Switches

CRASH? - toggles car crashing
POWER? - toggles the presence of traffic lights
AUTO? - toggles between automatic mode, where the students' lights change on a cycle, and manual in which students directly control the lights with their clients. Lights which aren't associated with clients always change on a cycle.

Plots

STOPPED CARS - displays the number of stopped cars over time
AVERAGE SPEED OF CARS - displays the average speed of cars over time
AVERAGE WAIT TIME OF CARS - displays the average time cars are stopped over time

Client Information

After logging in, the client interface will appear for the students. The controls for manual and automatic mode are both included, but which one works is based on the setting of the AUTO? switch in NetLogo. In MANUAL mode, click the CHANGE LIGHT button to switch the state of the light you control. In AUTO mode, move the PHASE slider to change the phase for your light. The phase determines what percent of the way through the cycle to switch on.

THINGS TO NOTICE

When cars have stopped at a traffic light, and then they start moving again, the traffic jam will move backwards even though the cars are moving forwards. Why is this? Discuss in your class possible reasons for this phenomena.

THINGS TO TRY

Try changing the speed limit for the cars. How does this affect the overall efficiency of the traffic flow? Are fewer cars stopping for a shorter amount of time? Is the average speed of the cars higher or lower than before?

Try changing the number of cars on the roads. Does this affect the efficiency of the traffic flow?

How about changing the speed of the simulation? Does this affect the efficiency of the traffic flow?

Using HubNet, try running this simulation with AUTO? being true and AUTO? being false. Is it harder to make the traffic move well using one scheme or the other? Why?

Using HubNet, try running this simulation with AUTO? being true. Try to find a way of setting the phases of the traffic lights so that the average speed of the cars is the highest. Now try to minimize the number of stopped cars. Now try to decrease the average wait time of the cars. Is there any correlation between these different metrics?

EXTENDING THE MODEL

Currently, the maximum speed limit (found in the SPEED-LIMIT slider) for the cars is 1.0. This is due to the fact that the cars must look ahead the speed that they are traveling to see if there are cars ahead of them. If there aren't, they speed up. If there are, they slow down. Looking ahead for a value greater than 1 is a little bit tricky. Try implementing the correct behavior for speeds greater than 1.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Wilensky, U. and Stroup, W. (1999). NetLogo HubNet Gridlock model. http://ccl.northwestern.edu/netlogo/models/HubNetGridlock. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 1999 Uri Wilensky and Walter Stroup.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

This activity and associated models and materials were created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

Comments and Questions

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

Click to Run Model

;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Variable declarations ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;

globals
[
  grid-x-inc  ;; the amount of patches in between two roads in the x direction
  grid-y-inc  ;; the amount of patches in between two roads in the y direction
  acceleration  ;; the constant that controls how much a car speeds up or slows down by if it is to accelerate or decelerate
  phase  ;; keeps track of the phase
  num-cars-stopped  ;; the number of cars that are stopped during a single pass thru the go procedure
  old-display-which-metric  ;; holds the value of display-which-metric for the last time through the go procedure

  ;; patch agentsets
  intersections  ;; agentset containing the patches that are intersections
  roads  ;; agentset containing the patches that are roads

  ;;quick start instructions variables
  quick-start  ;; the current quickstart instruction displayed in the quickstart monitor
  qs-item  ;; the index of the current quickstart instruction
  qs-items  ;; the list of quickstart instructions
]

turtles-own
[
  speed  ;; the speed of the turtle
  up-car?  ;; this will be true if the turtle moves downwards and false if it moves to the right
  wait-time  ;; the amount of time since the last time a turtle has moved
]

patches-own
[
  intersection?  ;; this is true if the patch is at the intersection of two roads
  accident?  ;; this is true if a crash has occurred at this intersection.  this will never be true for a non-intersection patch
  green-light-up?  ;; this is true if the green light is above the intersection.  otherwise, it is false.  this is only true for patches that are intersections.
  my-row  ;; this holds the row of the intersection counting from the upper left corner of the view.  it is -1 for patches that are not intersections.
  my-column  ;; this holds the column of the intersection counting from the upper left corner of the view.  it is -1 for patches that are not intersections.
  user-id  ;; this holds the user-id that corresponds to the intersection.  it is -1 for patches that are not intersections.
  my-phase  ;; this holds the phase for the intersection.  it is -1 for patches that are not intersections.
]


;;;;;;;;;;;;;;;;;;;;;
;; Setup Functions ;;
;;;;;;;;;;;;;;;;;;;;;

to startup
  setup
  setup-quick-start
  hubnet-reset
end 

;; Initialize the display by giving the global and patch variables initial values.
;; Create num-cars of turtles if there are enough road patches for one turtle to be created per road patch.
;; Setup the plots
;; All code in setup is done if full-setup? is true.  If it is false, then it doesn't clear the information
;; about the users; users still retain the same light that they had before.
;; "setup false" is done by the re-run button.

to setup
  clear-output
  clear-turtles
  clear-all-plots

  let full-setup? ((grid-x-inc != (world-width / grid-size-x))
      or (grid-y-inc != (world-height / grid-size-y)))

  setup-globals

  ifelse full-setup?
  [
    let users map [[user-id] of ?] sort patches with [is-string? user-id]
    let phases map [[my-phase] of ?] sort patches with [is-string? user-id]
    clear-patches
    setup-patches
    setup-intersections
    ;; reassign the clients to intersections
    (foreach users phases
    [
      get-free-intersection ?1
      ask intersections with [ user-id = ?1 ]
        [ set my-phase ?2 ]
    ])
  ]
  [ setup-intersections ]

  set-default-shape turtles "car"

  if (number > count roads)
  [
    user-message (word  "There are too many cars for the amount of road.  "
    "or GRID-SIZE-Y sliders, or decrease the number of cars by lowering "
    "the NUMBER slider.\nThe setup has stopped.")
    stop
  ]

  ;; Now create the turtles and have each created turtle call the functions setup-cars and set-car-color
  crt number
  [
    setup-cars
    set-car-color
    record-data
  ]

  ;; give the turtles an initial speed
  ask turtles
  [ set-car-speed ]

  reset-ticks
end 

;; Initialize the global variables to appropriate values

to setup-globals
  set phase 0
  set num-cars-stopped 0
  set grid-x-inc world-width / grid-size-x
  set grid-y-inc world-height / grid-size-y

  ;; don't make acceleration 0.1 since we could get a rounding error and end up on a patch boundary
  set acceleration 0.099
end 

;; Make the patches have appropriate colors, setup the roads and intersections agentsets,
;; and initialize the traffic lights to one setting

to setup-patches
  ;; initialize the patch-own variables and color the patches to a base-color
  ask patches
  [
    set intersection? false
    set accident? false
    set green-light-up? true
    set my-row -1
    set my-column -1
    set user-id -1
    set my-phase -1

    set pcolor brown + 3
  ]

  ;; initialize the global variables that hold patch agentsets
  set roads patches with [ (floor ((pxcor + max-pxcor - floor(grid-x-inc - 1)) mod grid-x-inc) = 0) or
                           (floor ((pycor + max-pycor) mod grid-y-inc) = 0) ]
  set intersections roads with [ (floor ((pxcor + max-pxcor - floor(grid-x-inc - 1)) mod grid-x-inc) = 0) and
                                 (floor ((pycor + max-pycor) mod grid-y-inc) = 0) ]

  ask roads
  [ set pcolor white ]
end 

;; Give the intersections appropriate values for the intersection?, my-row, and my-column
;; patch variables.  Make all the traffic lights start off so that the lights are red
;; horizontally and green vertically.

to setup-intersections
  ask intersections
  [
    set intersection? true
    set green-light-up? true
    set my-phase 0
    set my-row floor ((pycor + max-pycor) / grid-y-inc )
    set my-column floor ((pxcor + max-pxcor) / grid-x-inc )
    set-signal-colors
  ]
end 

;; Initialize the turtle variables to appropriate values and place the turtle on an empty road patch.

to setup-cars  ;; turtle procedure
  set speed 0
  set wait-time 0

  put-on-empty-road

  ifelse intersection?
  [
    ifelse random 2 = 1
    [ set up-car? true ]
    [ set up-car? false ]
  ]
  [
    ifelse (floor ((pxcor + max-pxcor - floor(grid-x-inc - 1)) mod grid-x-inc) = 0)
    [ set up-car? true ]
    [ set up-car? false ]
  ]

  ifelse up-car?
  [ set heading 180 ]
  [ set heading 90 ]
end 

;; Find a road patch without any turtles on it and place the turtle there.

to put-on-empty-road  ;; turtle procedure
  move-to one-of roads
  if any? other turtles-here
  [ put-on-empty-road ]
end 

;;;;;;;;;;;;;;;;;;;;;;;
;; Runtime Functions ;;
;;;;;;;;;;;;;;;;;;;;;;;

;; receives information from the clients and runs the simulation

to go
  ;; get commands and data from the clients
  listen-clients

  every delay
  [
    ;; clear any accidents from the last time thru the go procedure
    clear-accidents

    ;; if there are any intersections that are to switch automatically, have them change their color
    set-signals
    set num-cars-stopped 0

    ;; set the turtles speed for this time thru the procedure, move them forward their speed,
    ;; record data for plotting, and set the color of the turtles
    ;; to an appropriate color based on their speed
    ask turtles
    [
      set-car-speed
      fd speed
      record-data
      set-car-color
    ]
    ;; crash the cars if crash? is true
    if crash?
    [ crash-cars ]

    ;; update the clock and the phase
    clock-tick
  ]
end 

;; reports the amount of seconds by which to slow the model down

to-report delay
  ifelse simulation-speed <= 0
  [ report ln (10 / 0.001) ]
  [ report ln (10 / simulation-speed) ]
end 

;; have the traffic lights change color if phase equals each intersections' my-phase

to set-signals
  ask intersections with
  [ phase = floor ((my-phase * ticks-per-cycle) / 100) and ( auto? or user-id = -1 ) ]
  [
    set green-light-up? (not green-light-up?)
    set-signal-colors
  ]
end 

;; This procedure checks the variable green-light-up? at each intersection and sets the
;; traffic lights to have the green light up or the green light to the left.

to set-signal-colors  ;; intersection (patch) procedure
  ifelse power?
  [
    ifelse green-light-up?
    [
      ask patch-at -1 0 [ set pcolor red ]
      ask patch-at 0 1 [ set pcolor green ]
    ]
    [
      ask patch-at -1 0 [ set pcolor green ]
      ask patch-at 0 1 [ set pcolor red ]
    ]
  ]
  [
    ask patch-at -1 0 [ set pcolor white ]
    ask patch-at 0 1 [ set pcolor white ]
  ]
end 

;; set any intersection's color that had an accident back to white and make accident? false

to clear-accidents
  if crash?
  [
    ask patches with [accident?]
    [
      set pcolor white
      set accident? false
    ]
  ]
end 

;; set the turtles' speed based on whether they are at a red traffic light or the speed of the
;; turtle (if any) on the patch in front of them

to set-car-speed  ;; turtle procedure
  ifelse pcolor = red
  [ set speed 0 ]
  [
    ifelse up-car?
    [ set-speed 0 -1 ]
    [ set-speed 1 0 ]
  ]
end 

;; set the speed variable of the turtle to an appropriate value (not exceeding the
;; speed limit) based on whether there are turtles on the patch in front of the turtle

to set-speed [delta-x delta-y]  ;; turtle procedure
  let turtles-ahead turtles-on patch-at delta-x delta-y

  ;; if there are turtles in front of the turtle, slow down
  ;; otherwise, speed up
  ifelse any? turtles-ahead
  [
    let up-cars?-ahead [up-car?] of turtles-ahead
    ifelse member? up-car? up-cars?-ahead and member? (not up-car?) up-cars?-ahead
    [
      if not crash?
      [ set speed 0 ]
    ]
    [
      set speed [speed] of one-of turtles-ahead
      slow-down
    ]
  ]
  [ speed-up ]
end 

;; decrease the speed of the turtle

to slow-down  ;; turtle procedure
  ifelse speed <= 0  ;;if speed < 0
  [ set speed 0 ]
  [ set speed speed - acceleration ]
end 

;; increase the speed of the turtle

to speed-up  ;; turtle procedure
  ifelse speed > speed-limit
  [ set speed speed-limit ]
  [ set speed speed + acceleration ]
end 

;; set the color of the turtle to a different color based on how fast the turtle is moving

to set-car-color  ;; turtle procedure
  ifelse speed < (speed-limit / 2)
  [ set color blue ]
  [ set color cyan - 2 ]
end 

;; keep track of the number of stopped turtles and the amount of time a turtle has been stopped
;; if its speed is 0

to record-data  ;; turtle procedure
  ifelse speed = 0
  [
    set num-cars-stopped num-cars-stopped + 1
    set wait-time wait-time + 1
  ]
  [ set wait-time 0 ]
end 

;; crash any turtles at the same intersection going in different directions

to crash-cars
  ask intersections with [any? turtles-here with [up-car?] and any? turtles-here with [not up-car?]]
  [
    set accident? true
    set pcolor orange
  ]
end 

;; increases the clock by 1 and cycles phase to the next appropriate value

to clock-tick
  tick
  ;; The phase cycles from 0 to ticks-per-cycle, then starts over.
  set phase phase + 1
  if phase mod ticks-per-cycle = 0
  [ set phase 0 ]
end 

to hide-or-show-pen [name-of-plot]
  ifelse plots-to-display = "All three plots" or plots-to-display = name-of-plot
  [ __plot-pen-show ]
  [ __plot-pen-hide ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Quick Start functions ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; instructions to quickly setup the model, and clients to run this activity

to setup-quick-start
  set qs-item 0
  set qs-items
  [
    "Teacher: Follow these directions to setup the HubNet activity."
    "Optional: Zoom In (see Tools in the Menu Bar)"
    "Change the traffic grid (using the sliders GRID-SIZE-X and..."
      "GRID-SIZE-Y) to make enough lights for everyone."
    "Change any other of the settings that you would like to change."
    "For example, if you plan on running Gridlock in..."
      "the MANUAL mode, be sure to have AUTO? set to OFF."
    "Press the SETUP button."
    "Press the LOGIN button."
    "Everyone: Open up a HubNet Client on your machine and..."
      "type your user name, select this activity and press ENTER."
    "Teacher: Once everyone is logged in and has a light..."
      "stop the LOGIN button by pressing it again."
    "Everyone: Whichever mode AUTO? is set for in NetLogo,..."
      "you will control your intersection in a different way."
    "If you have chosen MANUAL,..."
      "you can change the state of your light by pressing..."
        "the CHANGE LIGHT button."
    "If you have chosen AUTO,..."
      "you can change the phase of your light by moving..."
        "the PHASE slider to a different position."
    "Teacher: Once everyone is ready,..."
      "start the simulation by pressing the GO button."
    "Teacher: You may want to view some of the plots."
      "Do this by changing the PLOTS-TO-DISPLAY chooser,..."
        "which changes the plot displayed for everyone."
    "Choose No Plots to turn off all the plots..."
      "Choose Stopped Cars to see the STOPPED CARS plot..."
        "Choose 2 Speed of Cars the AVERAGE SPEED plot..."
          "Choose 3 Average Wait Time of Cars the AVERAGE WAIT plot..."
            "or Choose 'All three plots' for all the plots..."

    "Teacher: To run the activity again with the same group,..."
      "stop the model by pressing the GO button, if it is on."
        "Change any of the settings that you would like."
          "Press the SETUP button."
    "Teacher: Once everyone is ready,..."
      "restart the simulation by pressing the GO button."

    "Teacher: To start the simulation over with a new group,..."
      "stop the model by pressing the GO button, if it is on..."
      "Press the RESET button in the Control Center"
        "and follow these instructions again from the beginning."
  ]
  set quick-start (item qs-item qs-items)
end 

;; view the next item in the quickstart monitor

to view-next
  set qs-item qs-item + 1
  if qs-item >= length qs-items
  [ set qs-item length qs-items - 1 ]
  set quick-start (item qs-item qs-items)
end 

;; view the previous item in the quickstart monitor

to view-prev
  set qs-item qs-item - 1
  if qs-item < 0
  [ set qs-item 0 ]
  set quick-start (item qs-item qs-items)
end 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Code for interacting with the clients ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; when a command is sent, find out which client sent it and then execute the command

to listen-clients
  while [hubnet-message-waiting?]
  [
    hubnet-fetch-message
    ifelse hubnet-enter-message?
    [
      give-intersection-coords
      wait 1  ;; we want to give some time for other clients to log in on this round
    ]
    [
      ifelse hubnet-exit-message?
      [
        abandon-intersection
      ]
      [
        ifelse hubnet-message-tag = "Change Light"
          [ manual hubnet-message-source ]
        [
          if hubnet-message-tag = "Phase"
            [ auto hubnet-message-source ]
        ]
      ]
    ]
  ]
end 

;; when a new client logs in, if there are free intersections,
;; assign one of them to that client
;; if this current-id already has an intersection, give the client that intersection.

to give-intersection-coords
  let current-id hubnet-message-source
  ifelse not any? intersections with [user-id = current-id]
  [
      ;; the case where they tried logging in previously but there was no room for them
      ;; or they haven't logged in before
      get-free-intersection current-id
  ]
  [
    ;; otherwise, we already have an intersection for the current-id.
    ;; all we need to do is send where the light is located at
    ask intersections with [user-id = current-id]
    [ hubnet-send current-id "Located At:" (word "(" my-column "," my-row ")") ]
  ]
end 

;; when a client disconnects, free up its intersection

to abandon-intersection
  ask intersections with [user-id = hubnet-message-source]
  [
    set user-id -1
    set my-phase 0
    ask patch-at -1 1 [ set plabel ""]
  ]
end 

;; if there are any free intersections, pick one of them at random and give it to the current-id.
;; if there are not any free intersections, toss an error and put error values into the list

to get-free-intersection [current-id]
  ifelse any? intersections with [user-id = -1]
  [
    ;; pick a random intersection that hasn't been taken yet
    ask one-of intersections with [user-id = -1]
    [
      set user-id current-id
      ask patch-at -1 1
      [
        set plabel-color black
        set plabel current-id
      ]
      hubnet-send current-id "Located At:" (word "(" my-column "," my-row ")")
    ]
  ]
  [
    hubnet-send current-id "Located At:" "Not enough lights"
    user-message word "Not enough lights for student with id: " current-id
  ]
end 

;; switch the traffic lights at the intersection for the client with user-id

to manual [current-id]
  if not auto?
  [
    ask intersections with [user-id = current-id]
    [
      set green-light-up? (not green-light-up?)
      set-signal-colors
    ]
  ]
end 

;; change the value of the phase for the intersection at (xc,yc) to
;; the value passed by the client

to auto [current-id]
  ask intersections with [user-id = current-id]
  [
    set my-phase hubnet-message
  ]
end 


; Copyright 1999 Uri Wilensky and Walter Stroup.
; See Info tab for full copyright and license.

There are 7 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 9 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky almost 10 years ago Updated version tag Download this version
Uri Wilensky almost 10 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky over 10 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Gridlock Download this version
Uri Wilensky over 12 years ago Gridlock Download this version

Attached files

File Type Description Last updated
Gridlock.png preview Preview for 'Gridlock' over 9 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.