Workplace Collaborations v1

No preview image

1 collaborator

Default-person Jasmine Powell (Author)

Tags

(This model has yet to be categorized with any tags)
Model group MAM-2013 | Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.4 • Viewed 443 times • Downloaded 61 times • Run 0 times
Download the 'Workplace Collaborations v1' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

Click to Run Model

extensions [nw]

breed [rooms room]
breed [people person]

turtles-own [
  bathroom-countdown
  drink-countdown
  food-countdown
  research-countdown
  turned-blue-at
  duration-blue
  interest
  office
  standing
  num-projects
  path-to-bathroom
  path-to-drinking-fountain
  path-to-cafeteria
  path-counter
  destination
  path-to-destination
]

globals [ bathroom cafeteria drinking-fountain wall-color office-color 
  hallway-color drinking-fountain-color cafeteria-color bathroom-color
  color1 ]

to setup
  if (count links != 0) [stop] ;;safeguard against hitting setup when you don't need to
  
  ;;to make sure there are the right number of communal locations:
  if (count patches with [pcolor = bathroom-color] != 1 or count patches with [pcolor = drinking-fountain-color] != 1 
    or count patches with [pcolor = cafeteria-color] != 1) [
    user-message("Don't forget to add exactly one bathroom, drinking fountain, and cafeteria!")
    stop
    ]
 
  ;;true setup starts here
  ask one-of patches with [pcolor = bathroom-color] [
    set bathroom self
  ]
  ask one-of patches with [pcolor = cafeteria-color]  [
    set cafeteria self 
  ]
  ask one-of patches with [pcolor = drinking-fountain-color] [
    set drinking-fountain self 
  ]
  
  ;;create turtles (rooms) on every patch in order to use the nw extension
  ask patches [
    sprout 1 [
      set color [pcolor] of self
      set breed rooms
      set shape "square"
    ]
  ]
  
  ;;make sure the communal areas are rooms (turtles), not patches
  set bathroom one-of rooms-on bathroom
  set drinking-fountain one-of rooms-on drinking-fountain
  set cafeteria one-of rooms-on cafeteria
  
  ;;create a lattice with every room connected to its neighboring rooms that are not walls
  ask rooms with [color != wall-color] [
    create-links-with rooms-on ([neighbors4] of patch-here) with [pcolor != wall-color]
  ]
  ask links [hide-link]
  
  nw:set-snapshot rooms links
  
  ask people [hatch 1 die] ;;to make sure the people are on top of the rooms
  ask people [assign-office] ;;an employee's office is where he is placed in the beginning
  clear-plot
  reset-ticks
end 

to go
  ask people [
    move
    set-destination
  ]
  ask people with [color = blue] [  ;;blue color = wants research, red color = doesn't
    if (count other people in-radius 2 with [color = blue] = 1) [
      interact
    ]
  ] 
  ask people with [color = red] [
    set research-countdown research-countdown - 1
    if research-countdown <= 0 [
      set color blue
      ask my-links [die]
      set turned-blue-at ticks
    ]  
  ]
  tick
end 

to move ;;turtle procedure
  
  if (bathroom-countdown > 0 and food-countdown > 0 and drink-countdown > 0 and one-of rooms-here != office) [
    move-toward-destination
  ]
  if bathroom-countdown <= 0 [
    set destination bathroom
    set path-to-destination path-to-bathroom
    move-toward-destination
  ]
  if (drink-countdown <= 0 and bathroom-countdown > 0) [ ;;bathroom > drink
    set destination drinking-fountain
    set path-to-destination path-to-drinking-fountain
    move-toward-destination
  ]
  if (food-countdown <= 0 and bathroom-countdown > 0 and drink-countdown > 0) [
    set destination cafeteria
    set path-to-destination path-to-cafeteria
    move-toward-destination
  ]
end 

to set-destination ;;turtle procedure
  if (one-of rooms-here = bathroom and destination = bathroom) [
    set bathroom-countdown random 1000
    set path-counter 0
    set destination office
    set path-to-destination reverse path-to-destination 
  ]
  if (one-of rooms-here = drinking-fountain and destination = drinking-fountain) [
    set drink-countdown random 1000
    set path-counter 0
    set destination office
    set path-to-destination reverse path-to-destination
  ]
  if (one-of rooms-here = cafeteria and destination = cafeteria) [
    set food-countdown random 2000
    set path-counter 0
    set destination office
    set path-to-destination reverse path-to-destination
  ]
  if (one-of rooms-here = office) [
    set path-counter 0
    set bathroom-countdown bathroom-countdown - 1
    set drink-countdown drink-countdown - 1
    set food-countdown food-countdown - 1
  ]
end 

to assign-attributes ;;turtle procedure
  set breed people
  set color blue
  set shape "person"
  set size 2
  set bathroom-countdown random 1000
  set drink-countdown random 1000
  set food-countdown random 2000
  set standing random-float 5 
  set turned-blue-at 0
  set duration-blue 0
  set num-projects 0   
end 

to declare-colors
  set wall-color yellow
  set office-color black
  set hallway-color gray
  set drinking-fountain-color blue
  set cafeteria-color red
  set bathroom-color green
end 

to assign-office ;;turtle procedure
  let temp 0
  set office one-of rooms-here
  ask office[set temp nw:turtles-on-path-to bathroom]
  set path-to-bathroom temp
  ask office[set temp nw:turtles-on-path-to drinking-fountain]
  set path-to-drinking-fountain temp
  ask office[set temp nw:turtles-on-path-to cafeteria]
  set path-to-cafeteria temp
  set path-counter 0
end 

to create-random ;;creates a random number of turtles in areas that are of office-color
  ask people [die]
  crt number [assign-attributes
    move-to one-of patches with [pcolor = office-color and count people-here = 0]
  ]
end 

to interact ;;turtle procedure
  if random-float 1 < (1 - sqrt(1 - (interact-probability / 100))) [ ;;if each person interacts with this probability, the total probaiblity of interaction is interact-probability
    let partner one-of other people in-radius 2 with [color = blue]
    set color red
    set research-countdown 1000
    set num-projects num-projects + 1
    set duration-blue ((ticks - turned-blue-at) + duration-blue)
    ask partner [set color red set research-countdown 1000 set num-projects num-projects + 1
      set duration-blue ((ticks - turned-blue-at) + duration-blue)]
    create-link-with partner [set color red]
  ]  
end 

to move-toward-destination ;;turtle procedure
  let closest one-of rooms-here
  if (path-counter < length path-to-destination - 1) [
    set path-counter path-counter + 1
    set closest item path-counter path-to-destination]
  move-to closest
end 

to-report average-blue  ;;reports the average amount of time (in ticks) a person goes without a research project
  report mean ([duration-blue / num-projects] of people with [num-projects > 0])
end 



;;used to make and import layouts of workplaces

to create-layout
  reset-ticks
  declare-colors
  if mouse-down? [
    let x round mouse-xcor
    let y round mouse-ycor
    if (Layout-options = "person") [
      ask patch x y [
        if (count people-here = 0) [sprout 1 [assign-attributes]]
      ]
    ]
    if (Layout-options = "walkable-space") [
      ask patch x y [set pcolor office-color]
    ]
    if (Layout-options = "bathroom") [
      ask patch x y [set pcolor bathroom-color]
    ]
    if (Layout-options = "drinking-fountain") [
      ask patch x y [set pcolor drinking-fountain-color]
    ]  
    if (Layout-options = "cafeteria") [
      ask patch x y [set pcolor cafeteria-color]
    ]
    if (Layout-options = "wall") [
      ask patch x y [set pcolor wall-color] 
    ]
    if (Layout-options = "desk") [ ;;a desk is a solid, unwalkable rectangle
      ask patches with [pxcor <= x + width / 2 and pycor <= y + height / 2 and pxcor > x - width / 2 and pycor > y - height / 2]  [
        set pcolor yellow
      ]
    ]
    if (Layout-options = "cubicle") [ ;;a cubicle is a rectangular room surrounded by walls
      ask patches with [(pxcor = ceiling(x + width / 2) and (pycor <= ceiling(y + height / 2) and pycor >= ceiling(y - height / 2)))
         or (pycor = ceiling(y + height / 2) and (pxcor <= ceiling(x + width / 2) and pxcor >= ceiling(x - width / 2)))
         or (pxcor = ceiling(x - width / 2) and (pycor <= ceiling(y + height / 2) and pycor >= ceiling(y - height / 2)))
         or (pycor = ceiling(y - height / 2) and (pxcor <= ceiling(x + width / 2) and pxcor >= ceiling(x - width / 2)))]  
         [set pcolor yellow]
    ]
    tick   
  ]
end     

to clear
  ca
end  

to export-layout
  export-world "Open-office-layout"
end 

to import-layout
  import-world "Open-office-layout"
end 


;;these are all of the pre-made layouts the correspond to buttons

to cubicle-layout1
  import-world "Cubicle-layout1"
  setup
end 

to cubicle-layout2
  import-world "Cubicle-layout2"
  setup
end 

to the-office-layout
  import-world "The-Office-Layout"
  setup
end 

to free-for-all
  import-world "free-for-all"
  create-random
  setup
end 

to open-office
  import-world "Open-office-layout"
  setup
end 

to cubicle-layout1-centralized
  import-world "Cubicle-layout1-centralized"
  setup
end 

to Analysis-template
  import-world "Analysis-template"
end 

to Centralized-doors-down
  import-world "Centralized-doors-down"
  setup
end 

to Centralized-no-walls
  import-world "Centralized-no-walls"
  setup
end 

to Uncentralized-inline-doors-down
  import-world "Uncentralized-inline-doors-down"
  setup
end 

to Uncentralized-scattered-doors-down
  import-world "Uncentralized-scattered-doors-down"
  setup
end 

to Centralized-fewer-hallways
  import-world "Centralized-fewer-hallways"
  setup
end 

to Uncentralized-inline-fewer-hallways
  import-world "Uncentralized-inline-fewer-hallways"
  setup
end 

to Uncentralized-scattered-fewer-hallways
  import-world "Uncentralized-scattered-fewer-hallways"
  setup
end 

to Uncentralized-scattered-no-walls
  import-world "Uncentralized-scattered-no-walls"
  setup
end 

to Uncentralized-inline-no-walls
  import-world "Uncentralized-inline-no-walls"
  setup
end 

There are 5 versions of this model.

Uploaded by When Description Download
Jasmine Powell about 12 years ago Final Version Download this version
Jasmine Powell about 12 years ago Version 4 Download this version
Jasmine Powell about 12 years ago Version 3 Download this version
Jasmine Powell about 12 years ago Version 2 Download this version
Jasmine Powell about 12 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Centralized-doors-down background Analysis Layout 1 about 12 years ago, by Jasmine Powell Download
Centralized-fewer-hallways background Analysis Layout 2 about 12 years ago, by Jasmine Powell Download
Centralized-no-walls background Analysis Layout 3 about 12 years ago, by Jasmine Powell Download
Cubicle-layout1 background Simple cubicle layout about 12 years ago, by Jasmine Powell Download
Cubicle-layout1-centralized background Simple cubicle layout revised about 12 years ago, by Jasmine Powell Download
EECS 372 Final Paper PDF.pdf pdf Final Paper about 12 years ago, by Jasmine Powell Download
EECS 372 Proposal.docx word Final Project Proposal about 12 years ago, by Jasmine Powell Download
free-for-all background Simple layout with no walls about 12 years ago, by Jasmine Powell Download
Jasmine Powell Poster Slam.pptx powerpoint Poster Slam slides about 12 years ago, by Jasmine Powell Download
Jasmine Powell Poster.jpg jpeg Picture of my poster about 12 years ago, by Jasmine Powell Download
JasminePowell_June3.docx word Progress Report 4 about 12 years ago, by Jasmine Powell Download
JasminePowell_May13.odt word Progress Report 1 about 12 years ago, by Jasmine Powell Download
JasminePowell_May19.docx word Second Progress Report about 12 years ago, by Jasmine Powell Download
JasminePowell_May27.docx word Progress Report 3 about 12 years ago, by Jasmine Powell Download
Open-office-layout background Open office layout about 12 years ago, by Jasmine Powell Download
The-Office-Layout background Layout from "The Office" about 12 years ago, by Jasmine Powell Download
Uncentralized-inline-doors-down background Analysis Layout 4 about 12 years ago, by Jasmine Powell Download
Uncentralized-inline-fewer-hallways background Analysis Layout 5 about 12 years ago, by Jasmine Powell Download
Uncentralized-inline-no-walls background Analysis Layout 6 about 12 years ago, by Jasmine Powell Download
Uncentralized-scattered-doors-down background Analysis Layout 7 about 12 years ago, by Jasmine Powell Download
Uncentralized-scattered-fewer-hallways background Analysis Layout 8 about 12 years ago, by Jasmine Powell Download
Uncentralized-scattered-no-walls background Analysis Layout 9 about 12 years ago, by Jasmine Powell Download

This model does not have any ancestors.

This model does not have any descendants.