Passenger Volume Simulation on Yamanote Line in Tokyo

No preview image

1 collaborator

Default-person Xiaosong Yin (Author)

Tags

transport 

Tagged by Xiaosong Yin over 10 years ago

Model group MAM-2015 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.2.0 • Viewed 810 times • Downloaded 95 times • Run 0 times
Download the 'Passenger Volume Simulation on Yamanote Line in Tokyo' 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 provides an intuitive approach to simulate passenger flow on Yamanote Line, the busiest commute line in the world. Users are able to customize the model by setting their own parameters and see how the railway system responds.

HOW IT WORKS

The model is very intuitive to use. In the model, there are trains, passengers and stations. Initially, trains are distributed uniformly along the track based on user's input. Passengers are generated at each station at user-defined values for each individual station. Stations form a circular and keep an equal distance between each other. At each tick, passengers are generated at each station according to user's input. Trains move along the track, stop at each station to pick up passengers and letting off passengers. If the train reaches its maximum capacity predefined by the user, it no longer picks up passengers. Stations are stationary.

HOW TO USE IT

The following parameters are set before running the model: • STATION-VOLUME: Initial number of passengers at each station: user could input a list of numbers into a textbox. The size of the list should equal the number of stations so that each item in the list corresponds to the initial number of passengers at each station • NUMBER-OF-STATIONS: Number of stations: Yamanote Line serves 29 stations in total. But the user working with other circular railway systems could input different values. • INTERVAL: Train intervals: user could set the time interval between two trains. When this number is set, trains are distributed uniformly along the line. As a result, the number of trains is also determined. • TIME-EACH-LOOP: Total time for each loop: A Yamanote Line train takes ~60 minutes to run a complete loop. The user could vary this value if working with another system or wanting to decrease the speed of train operations. • MAXIMUM-CAPACITY-OF-TRAIN: Maximum capacity of train: the maximum number of people a train could take • PASSENGERS-PER-MINUTE: Passenger inflow rate per minute into each station: user could input a list of numbers. The size of the list should equal to the number of stations so that each number in the list corresponds to the passenger inflow rate of each station. The rate is generated using a Poisson distribution with the user input as its mean. • REPRESENT-STATION-VOLUME-ON: by enabling this switch, each station would grow in size according its number of passengers. This helps the user to visualize the change in passenger in volume in each station • LEVEL: User could choose the threshold at which the stations grow in size. For example, if level is set to 1000, stations at passenger volume 2000 is 2x bigger than the stations with number of passengers of 1000.

The following parameters are set while the model is running • EMERGENCY: Emergency Switch: when this button is pressed, all train movements stopped but passengers keep coming into stations. When the button is pressed again, trains start moving again.

The following parameters are related to graphing • CHOSE-STATION-TO-GRAPH: user could input a list consisted of two number. Each number represents the station that the user wishes to see plotted in the two graphs labelled "station-(0 or 1)-passengers".

THINGS TO NOTICE

The most important things to notice in this model are the graphs. Two of the graphs labeled "station-(0 or 1)-passengers" plot the passenger volume at two stations over time. The graph labeled "Average Waiting Time" gives the average waiting time of passengers who are still waiting for the train at each time instance.

THINGS TO TRY

Users should supply their own numbers to the initial settings of the system to make it function. Ideally, an user should have statistical results available for each station to yield the best result.

EXTENDING THE MODEL

The current model provides the basic framework for a railway system. It simply possesses the most fundamental characteristics of a circular railway line. Many customization and expansion are possible for future development of this model, at the need of the users. The following provides some possibilities, but it is up to the user to modify the model to their best need. In terms of result analysis: • Total passenger passage over a particular section of the track • The satisfaction level of each passengers based on the waiting time In terms of model expansion: • The distance between each station could be made customizable. Currently, it is assumed to be equally separated • Additional lines and stations could be added arbitrarily by the user so that the model is expanded to cover much more complex railway systems. This expansion, however, is difficult • Trains could be added arbitrarily to the existing system at designated location • Addition of express trains that stop at certain stations. Planners might be interested if such service could improve the efficiency of the overall system. • Better way of generating passengers’ destination: the method with which the destinations of the passengers are generated could be more flexible. Currently, it is a uniform distribution where each passenger randomly chooses a station as destination. Ideally, the model could take user-defined statistical numbers for the generation process. • Modeling of Stations: stations could be modeled more individually as residential / business, etc so that passengers generated at each station assume more individuality • Modeling of different scenarios: the model could have several built-in scenarios such as morning rush hour, evening rush hour and major event near a particular station. Planners might be more interested in seeing how the system responds in these particular cases.

NETLOGO FEATURES

The current model only supports the most basic features of NetLogo

RELATED MODELS

Not available.

CREDITS AND REFERENCES

This model along with the report could be found on the Modelling Commons of NetLogo.

Comments and Questions

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

Click to Run Model

;;declare global variables
globals 
[
  total-length-of-tracks 
  number-of-trains 
  move-counter 
  move-counter2 
  station-volume-list 
  passengers-per-minute-list 
  total-wait-time
  emergency-on
]
;;declare breeds
breed [trains train]
breed [stations station]
breed [innerstations innerstation]
breed [passengers passenger]
stations-own
[
  station-number
  outer-loop-capacity
  how-many-expand
]
innerstations-own
[
  station-number
  inner-loop-capacity
]
passengers-own
[
  destination
  heading-direction
  boarded
  wait-time
  just-generated
]
trains-own
[
  capacity
  max-capacity
  destination-station
  have-stopped
  running-direction
  target-station
]

;setup the system

to setup
  clear-all
  ask patches 
  [
    set pcolor white
  ]
  setup-innerstations
  setup-stations
  setup-passengers
  setup-trains
  reset-ticks
end 

to setup-basics
  ;;total-length-of-tracks
  set total-length-of-tracks 0
  ask links
  [
    set total-length-of-tracks total-length-of-tracks + link-length
  ]
  set total-length-of-tracks total-length-of-tracks / 2
  ;;number-of-trains
  set number-of-trains time-each-loop / interval
  ;;read input about passenger volume at each station
  set station-volume-list read-from-string station-volume 
  ;;read input about passengers per minute
  set passengers-per-minute-list read-from-string passengers-per-minute
  ;;initialize total waiting time to 0
  set total-wait-time 0
end 

to setup-stations
  ask innerstations [
    hatch 1 [
      set breed stations
    ]
  ]
  ask stations
  [
    create-links-from stations with [station-number = [station-number + 1] of myself mod count stations]
    set shape "circle"
    set color blue
  ]
  setup-basics
end 

to setup-innerstations
  let station-number-temp 0
  create-ordered-innerstations number-of-stations
  [
    set station-number station-number-temp
    fd 12
    set station-number-temp station-number-temp + 1
  ]
  ask innerstations
  [
    create-links-to innerstations with [station-number = [station-number + 1] of myself mod count innerstations]
    set shape "circle"
    set color blue
  ]
  layout-circle sort-on [station-number] innerstations 12
end 

to setup-passengers
  generate-passengers 1
end 

to generate-passengers [case]
  ask stations
  [
    ;;case 1: generate passengers initially. 
    ;;case 2: generate passengers while the model is running
    ifelse case = 1
    [
      hatcher-passenger (item station-number station-volume-list)
    ]
    [
      hatcher-passenger (random-poisson (item station-number passengers-per-minute-list))
    ]
    ;;update outer_loop capacity/inner_loop capacity
    let outer-temp 0
    let inner-temp 0
    ask passengers-here
    [
      ifelse heading-direction = 2
      [
        set outer-temp outer-temp + 1
      ]
      [
        set inner-temp inner-temp + 1
      ]
    ]
    set outer-loop-capacity outer-temp
    ask one-of innerstations-here
    [set inner-loop-capacity inner-temp]
  ]
end 

to hatcher-passenger [number]
    hatch-passengers number
    [
      set boarded 0
      set wait-time 0
      set just-generated 1
      ;;assign each passenger a random station
      set destination ((random (number-of-stations - 1)) + 1)
      if destination <= [station-number] of myself
      [
        set destination destination - 1
      ]
      ;;determine the heading direction of each passenger
      let station-number-new 0
      ifelse ([station-number] of myself - destination) < 0 
      [ set station-number-new ([station-number] of myself) + number-of-stations ]
      [ set station-number-new [station-number] of myself ]
      ifelse (station-number-new - destination < number-of-stations / 2) 
      [ set heading-direction 2 ] ;;counterclockwise or outer
      [ set heading-direction 1 ] ;;clockwise or inner 
    ]
end 

to setup-trains
  ;;generate all of the trains at one station first
  ask stations with [station-number = 0]
  [
    hatch-trains number-of-trains
    [ 
      set capacity 0
      set max-capacity max-capacity-of-train
      set destination-station (list 0)
      let list-size number-of-stations - 1
      while [list-size != 0]
      [
        set destination-station sentence destination-station 0
        set list-size list-size - 1
      ]
      set running-direction 2
      set target-station number-of-stations - 1
    ]
    ;;get the trains move according to intervals
    let sequence number-of-trains - 1
    ask trains with [running-direction = 2]
    [
       setup-trains-move (total-length-of-tracks / number-of-trains * sequence)
       set sequence sequence - 1
    ]     
  ]
  ;;generate inner stations
  ask innerstations with [station-number = 0]
  [
    hatch-trains number-of-trains
    [ 
      set capacity 0
      set max-capacity max-capacity-of-train
      set destination-station (list 0)
      let list-size number-of-stations - 1
      while [list-size != 0]
      [
        set destination-station sentence destination-station 0
        set list-size list-size - 1
      ]
      set running-direction 1
      set target-station 1
    ]
    ;;get the trains move according to intervals
    let sequence number-of-trains - 1
    ask trains with [running-direction = 1]
    [
       setup-trains-move-inner (total-length-of-tracks / number-of-trains * sequence)
       set sequence sequence - 1
    ]     
  ]
end 

to setup-trains-move [steps]
  let steps-taken 0
  let station-now 0
  let link-ahead 0
  ask stations with [station-number = station-now]
  [
    set link-ahead out-link-to one-of out-link-neighbors
  ]
  set heading [link-heading] of link-ahead
  while [steps-taken <= steps]
  [
    fd 0.2 
    set steps-taken steps-taken + 1 / 5
    if one-of stations-here != nobody and [station-number] of one-of stations-here = target-station
    [
      set xcor [xcor] of one-of stations-here
      set ycor [ycor] of one-of stations-here
      set station-now (station-now + 1) mod number-of-stations
      ask one-of stations-here
      [
        set link-ahead out-link-to one-of out-link-neighbors
      ]
      set heading [link-heading] of link-ahead
      set target-station (target-station - 1)
      if target-station < 0
      [
        set target-station target-station + number-of-stations
      ]
    ]
  ]
  set shape "train"
end 

to setup-trains-move-inner [steps]
  let steps-taken 0
  let station-now 0
  let station-already 0
  let link-ahead 0
  ask innerstations with [station-number = station-now]
  [
    set link-ahead out-link-to one-of out-link-neighbors
  ]
  set heading [link-heading] of link-ahead
  while [steps-taken <= steps]
  [
    fd 0.2
    set steps-taken steps-taken + 1 / 5
    if one-of innerstations-here != nobody and [station-number] of one-of stations-here = target-station
    [
      set xcor [xcor] of one-of innerstations-here
      set ycor [ycor] of one-of innerstations-here
      set station-now (station-now + 1) mod number-of-stations
      ask one-of innerstations-here
      [
        set link-ahead out-link-to one-of out-link-neighbors
      ]
      set heading [link-heading] of link-ahead
      set target-station (target-station + 1) mod number-of-stations
    ]
  ]
  set shape "train"
end 

;;running codes

to go
  ;;move-counter: makes the train move every 100 ticks. 
  ;;move-counter2: makes the passengers be generated every 1000 ticks (1 physically minute)
  set move-counter move-counter + 1
  set move-counter2 move-counter2 + 1
  ;emergency
  ;;move only when there is no emergency
  if(move-counter = 100 and emergency-on = 0)
  [
    ask trains with [running-direction = 2]
    [
        move-train
    ]
    ask trains with [running-direction = 1]
    [
      move-train-inner
    ]
    set move-counter 0
  ]
  if emergency-on = 1
  [ set move-counter 0]
  if(move-counter2 = 1000)
  [
    ask passengers with [boarded = 0 and just-generated = 0]
    [
      set wait-time wait-time + 1
    ]
    set total-wait-time 0
    ask passengers
    [
      set total-wait-time total-wait-time + wait-time
    ]
    ask passengers with [just-generated = 1] [ set just-generated 0]
    generate-running-passengers
    if represent-station-volume-on = 1
    [represent-station-volume]
    set move-counter2 0
  ]
  tick
end 

to move-train
  ifelse(one-of stations-here = nobody)
  [
    ;;have to move very small steps, so /10 is added
    fd total-length-of-tracks / time-each-loop / 10
  ]
  ;;if at a station
  [
  ifelse(one-of stations-here != nobody and target-station = [station-number] of one-of stations-here)
  [
    ;;if the train has stopped here. The train stops at a station for two sets of 100 ticks
    ifelse (have-stopped = 1)
    [
      set have-stopped 0
      ;;new direction once stopped at a station
      let link-ahead 0
      let station-here [station-number] of one-of stations-here
      ask one-of stations-here
      [
        set link-ahead out-link-to one-of out-link-neighbors
      ]
      set heading [link-heading] of link-ahead
      fd total-length-of-tracks / time-each-loop / 10
      set target-station target-station - 1
      if target-station < 0
      [
        set target-station target-station + number-of-stations
      ]
    ]
    ;;if the train just arrives and haven't stopped here
    [
      set xcor [xcor] of one-of stations-here
      set ycor [ycor] of one-of stations-here
      stop-at-station 2
      set have-stopped have-stopped + 1
    ]
  ]
  [ fd total-length-of-tracks / time-each-loop / 10 ]
  ]
end 

to move-train-inner
  ifelse(one-of innerstations-here = nobody)
  [
    fd total-length-of-tracks / time-each-loop / 10
  ]
  [
  ifelse(one-of innerstations-here != nobody and target-station = [station-number] of one-of innerstations-here)
  [
    ifelse (have-stopped = 1)
    [
      set have-stopped 0
      ;;new direction once stopped at a station
      let link-ahead 0
      let station-here [station-number] of one-of innerstations-here
      ask one-of innerstations-here
      [
        set link-ahead out-link-to one-of out-link-neighbors
      ]
      set heading [link-heading] of link-ahead
      fd total-length-of-tracks / time-each-loop / 10
      set target-station (target-station + 1) mod number-of-stations
    ]
    [
      set xcor [xcor] of one-of innerstations-here
      set ycor [ycor] of one-of innerstations-here
      stop-at-station 1
      set have-stopped have-stopped + 1
    ]
  ] 
  [ fd total-length-of-tracks / time-each-loop / 10 ]
  ]
end 

to stop-at-station [direction-arrival]
  let mylist destination-station
  let myCapacity capacity
  let disembarked2 0
  let disembarked 0
  let embarked2 0
  let embarked 0
  ;DISEMBARK
  ;get the station number
  let station-here 0
  ;;splits code based on whether it's outer loop or inner loop and update accordingly.
  ifelse direction-arrival = 2
  [
    set station-here [station-number] of one-of stations-here
    set disembarked2 item station-here destination-station
    set mylist replace-item (station-here) (mylist) (0)
    set myCapacity myCapacity - disembarked2
    ;embark
    set embarked2 0
    ask passengers-here with [boarded = 0 and heading-direction = 2]
    [ 
      if (myCapacity < [max-capacity] of myself)
      [
        let i destination
        set mylist replace-item (destination) (mylist) ((item i mylist) + 1)
        set myCapacity myCapacity + 1
        set embarked2 embarked2 + 1
        set boarded 1
        set wait-time 0
        die
      ]
    ]
  ]
  ;; inner loop
  [
    set station-here [station-number] of one-of innerstations-here
    set disembarked item station-here destination-station
    set mylist replace-item (station-here) (mylist) (0)
    set myCapacity myCapacity - disembarked
    ;embark
    set embarked 0
    ask passengers-here with [boarded = 0 and heading-direction = 1]
    [ 
      if (myCapacity < [max-capacity] of myself)
      [
        let i destination
        set mylist replace-item (destination) (mylist) ((item i mylist) + 1)
        set myCapacity myCapacity + 1
        set embarked embarked + 1
        set boarded 1
        set wait-time 0
        die
      ]
    ]
  ]
  ;update train
  set capacity myCapacity
  set destination-station mylist 
  ;update station
  ifelse direction-arrival = 2
  [
    ask one-of stations-here
    [
      set outer-loop-capacity outer-loop-capacity + disembarked2 - embarked2
    ]
  ]
  [
    ask one-of innerstations-here
    [
      set inner-loop-capacity inner-loop-capacity + disembarked - embarked
    ]
  ]
end 

to generate-running-passengers
  generate-passengers 2
end 

;;the station turtles grow in size once the number of people grow here

to represent-station-volume
  ask stations
  [
    set how-many-expand int (outer-loop-capacity / level)
    let how-many-expand-temp 0
    ask one-of innerstations with [station-number = [station-number] of myself]
    [
      set how-many-expand-temp how-many-expand-temp + int (inner-loop-capacity / level)
    ]
    set how-many-expand how-many-expand + how-many-expand-temp 
    if how-many-expand > 4
    [ set how-many-expand 4]
    set size how-many-expand + 1  
    set shape "circle"
  ]
end 

;handles emergency button being pressed

to emergency
  ifelse emergency-on = 0
  [set emergency-on 1]
  [set emergency-on 0]
end 

There are 4 versions of this model.

Uploaded by When Description Download
Xiaosong Yin over 10 years ago Final Version Download this version
Xiaosong Yin over 10 years ago Final Download this version
Xiaosong Yin over 10 years ago Network representation Download this version
Xiaosong Yin over 10 years ago Initial upload Download this version

Attached files

File Type Description Last updated
EECS 372 Progress Report 2.docx word v2 over 10 years ago, by Xiaosong Yin Download
EECS 372 Project Progress Report 1.docx word v1 over 10 years ago, by Xiaosong Yin Download
EECS 372 Project Proposal.docx word Original Proposal over 10 years ago, by Xiaosong Yin Download
EECS372 Progress Report 3.docx word v3. Network representation over 10 years ago, by Xiaosong Yin Download
Final Poster.pdf pdf Poster for the poster fair over 10 years ago, by Xiaosong Yin Download
Final Report on the NetLogo Project.docx word Final Report over 10 years ago, by Xiaosong Yin Download
Xiaosong_Yin_Slam.pptx pdf Presentation Slam over 10 years ago, by Xiaosong Yin Download

This model does not have any ancestors.

This model does not have any descendants.