MAMSpring2019_Project_update2

No preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.4 • Viewed 62 times • Downloaded 11 times • Run 0 times
Download the 'MAMSpring2019_Project_update2' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

breed [dabbawalas dabbawala ]
breed [ trains train ]
breed [stations station ]
breed [tiffins tiffin ]

dabbawalas-own [ start capacity carrying-count ]
stations-own [ name ]
; tiffins-own [ delivered? ]

to setup
  clear-all
  setup-stations
  setup-railway
  setup-dabbawalas
  reset-ticks
end 

to setup-stations
  let names  [ "Andheri" "Dadar" "Ghatkopar" "Churchgate"]
  let location (list [-8 14] [-5 0] [10 4] [-3 -11])
  create-stations 4 [
    let xy item who location
    setxy item 0 xy item 1 xy
    set shape "house two story"
    set size 2
    set name item who names
    set label name
    if name != "Churchgate"[
      hatch tiffins-count / 3 [set breed tiffins set shape "dot" rt random 90 fd random 10]]]
end 

to setup-railway
  ask station 0 [ create-link-with station 1 [ set shape "rail" ]
    ask patch-here [
      sprout 1 [
        set shape "train passenger car"
  set breed trains]]]
  ask station 2 [ create-link-with station 1 [ set shape "rail" ]
    ask patch-here [
      sprout 1 [
        set shape "train passenger car"
  set breed trains]]]
  ask station 1 [ create-link-with station 3 [ set shape "rail" ]]
end 

to setup-dabbawalas
  create-dabbawalas dabbawalas-count [
    setxy random-xcor random-ycor
    set shape "dabbawala"
    set color white
    set start one-of [ "Andheri" "Dadar" "Ghatkopar"]
    set capacity set-capacity]
end 

to go
  ask dabbawalas
  [
    set label carrying-count
    ifelse carrying-count < set-capacity [
      ifelse count tiffins with [not hidden?] > 0
      [    ifelse any? tiffins in-radius 3 [
  set heading towards one-of tiffins in-radius 3
      ]
      [rt random 360]
    fd 1
    let tiffins-taken one-of tiffins-here with [not hidden?]
    if tiffins-taken != nobody[
       set carrying-count carrying-count + 1
    ask tiffins-taken
      [  hide-turtle ]]]
      [go-to-station]
  ]
    [go-to-station]
  ]
  tick
end 

to go-to-station
  ask dabbawalas [
    let my-start start
    face one-of stations with [name = my-start ]
    fd 1
  ]
end 

There is only one version of this model, created almost 5 years ago by Sai Tanya Kumbharageri.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.