JacquelineNg-[team-ties]-project-EECS 472
Model was written in NetLogo 6.0-M6
•
Viewed 145 times
•
Downloaded 19 times
•
Run 0 times
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
globals [ imported-jobs ;;an indicator whether the csv data file import was successful time ;;tracks the simulation time in minutes, while every tick represents five minutes. global-link ;;mean of displayed links, between 0 and 1 global-reciproticy ;;mean reciprocity, between 0 and 1 reciprocity-01 reciprocity-02 reciprocity-03 reciprocity-12 reciprocity-13 reciprocity-23 temp-color-store task-slot-1-full task-slot-2-full task-slot-3-full task-slot-4-full ] links-own [ paffect ;;positive affect values for each link, ranging [0,1] naffect ;;negative affect values for each link, ranging [0,1] inform ;;instrumental: informational values for each link, ranging [0,1] behave ;;instrumental: behavioral values for each link, ranging [0,1] ] extensions[csv] breed [astronauts astronaut] astronauts-own [ role ;;personality extraversion conscientiousness emotional_stability agreeableness openness ;;need to import individual differences collected from HERA ] breed [jobs job] ;;have a task importer where things you want to knwo about a job are defined and set ;;make a csv first column is when task is introduced, task duration, four columns for each hera member ;;comment code jobs-own[ start-time duration assigned-to-CMD assigned-to-FE assigned-to-MS1 assigned-to-MS2 teaming-episode ] ;; Routine for the ABM Simulation setup to setup clear-all set time 0 setup-agents setup-links reset-ticks set imported-jobs False import-jobs refresh end ;;Creates the four agents for the model: CMD, FE, MS1, MS2 to setup-agents create-astronauts 1 [ set role "CMD" set shape "astronaut" set size 4 set color white set xcor 0 set ycor 9 ] ask patch 1 5 [ set plabel "CMD" ] create-astronauts 1 [ set role "FE" set shape "astronaut" set size 4 set color white set xcor 0 set ycor -9 ] ask patch 0.3 -5 [ set plabel "FE" ] create-astronauts 1 [ set role "MS1" set shape "astronaut" set size 4 set color white set xcor -9 set ycor 0 ] ask patch -5 0 [ set plabel "MS1" ] create-astronauts 1 [ set role "MS2" set shape "astronaut" set size 4 set color white set xcor 9 set ycor 0 ] ask patch 6 0 [ set plabel "MS2" ] end ;; Creates the setup for all links for the model to setup-links ;ask all turtles to create a link to every other turtle that's not itself ask astronauts with [who != 0][ create-link-to turtle 0 ] ask astronauts with [who != 1][ create-link-to turtle 1 ] ask astronauts with [who != 2][ create-link-to turtle 2 ] ask astronauts with [who != 3][ create-link-to turtle 3 ] ask links [ ;;set color rgb 255 0 0 set color approximate-hsb 0 90 70 set shape "curvy" set thickness 0.2 ] end to update-paffect ask links [ set paffect (paffect + random-float .25 - random-float .20) if paffect > 1 [set paffect 1] if paffect < 0 [set paffect 0] ] end to update-naffect ask links [ set naffect (naffect - random-float .25 + random-float .20) if naffect > 1 [set naffect 1] if naffect < 0 [set naffect 0] ] end to update-inform ask links [ set inform (inform + random-float .25 - random-float .20) if inform > 1 [set inform 1] if inform < 0 [set inform 0] ] end to update-behave ask links [ set behave (behave + random-float .25 - random-float .20) if behave > 1 [set behave 1] if behave < 0 [set behave 0] ] end to display-paffect ;;colors network links for positve affect ask links [ set color approximate-hsb (paffect * 140) 90 70 ] ;;changes global positve affect variables set global-link (([paffect] of link 0 1 + [paffect] of link 0 2 + [paffect] of link 0 3 + [paffect] of link 1 0 + [paffect] of link 1 2 + [paffect] of link 1 3 + [paffect] of link 2 0 + [paffect] of link 2 1 + [paffect] of link 2 3 + [paffect] of link 3 0 + [paffect] of link 3 1 + [paffect] of link 3 2) / 12) set reciprocity-01 abs ([paffect] of link 0 1 - [paffect] of link 1 0) set reciprocity-02 abs ([paffect] of link 0 2 - [paffect] of link 2 0) set reciprocity-03 abs ([paffect] of link 0 3 - [paffect] of link 3 0) set reciprocity-12 abs ([paffect] of link 1 2 - [paffect] of link 2 1) set reciprocity-13 abs ([paffect] of link 1 3 - [paffect] of link 3 1) set reciprocity-23 abs ([paffect] of link 2 3 - [paffect] of link 3 2) end to display-naffect ask links [ set color approximate-hsb (naffect * 140) 90 70 ] ;;changes global negative affect variables set global-link (([naffect] of link 0 1 + [naffect] of link 0 2 + [naffect] of link 0 3 + [naffect] of link 1 0 + [naffect] of link 1 2 + [naffect] of link 1 3 + [naffect] of link 2 0 + [naffect] of link 2 1 + [naffect] of link 2 3 + [naffect] of link 3 0 + [naffect] of link 3 1 + [naffect] of link 3 2) / 12) set reciprocity-01 abs ([naffect] of link 0 1 - [naffect] of link 1 0) set reciprocity-02 abs ([naffect] of link 0 2 - [naffect] of link 2 0) set reciprocity-03 abs ([naffect] of link 0 3 - [naffect] of link 3 0) set reciprocity-12 abs ([naffect] of link 1 2 - [naffect] of link 2 1) set reciprocity-13 abs ([naffect] of link 1 3 - [naffect] of link 3 1) set reciprocity-23 abs ([naffect] of link 2 3 - [naffect] of link 3 2) end to display-inform ask links [ set color approximate-hsb (inform * 140) 90 70 ] ;;changes global informational tie variables set global-link (([inform] of link 0 1 + [inform] of link 0 2 + [inform] of link 0 3 + [inform] of link 1 0 + [inform] of link 1 2 + [inform] of link 1 3 + [inform] of link 2 0 + [inform] of link 2 1 + [inform] of link 2 3 + [inform] of link 3 0 + [inform] of link 3 1 + [inform] of link 3 2) / 12) set reciprocity-01 abs ([inform] of link 0 1 - [inform] of link 1 0) set reciprocity-02 abs ([inform] of link 0 2 - [inform] of link 2 0) set reciprocity-03 abs ([inform] of link 0 3 - [inform] of link 3 0) set reciprocity-12 abs ([inform] of link 1 2 - [inform] of link 2 1) set reciprocity-13 abs ([inform] of link 1 3 - [inform] of link 3 1) set reciprocity-23 abs ([inform] of link 2 3 - [inform] of link 3 2) end to display-behave ask links [ set color approximate-hsb (behave * 140) 90 70 ] ;;changes global behavioral tie variables set global-link (([behave] of link 0 1 + [behave] of link 0 2 + [behave] of link 0 3 + [behave] of link 1 0 + [behave] of link 1 2 + [behave] of link 1 3 + [behave] of link 2 0 + [behave] of link 2 1 + [behave] of link 2 3 + [behave] of link 3 0 + [behave] of link 3 1 + [behave] of link 3 2) / 12) set reciprocity-01 abs ([behave] of link 0 1 - [behave] of link 1 0) set reciprocity-02 abs ([behave] of link 0 2 - [behave] of link 2 0) set reciprocity-03 abs ([behave] of link 0 3 - [behave] of link 3 0) set reciprocity-12 abs ([behave] of link 1 2 - [behave] of link 2 1) set reciprocity-13 abs ([behave] of link 1 3 - [behave] of link 3 1) set reciprocity-23 abs ([behave] of link 2 3 - [behave] of link 3 2) end ;;refreshes the display for the model based on the chooser values to refresh ;;displays current tasks, hides non-current tasks. Repositions all tasks into correct task-slots ask jobs with [(teaming-episode = 1) and (hidden? = false) and not((start-time <= time) and (start-time + duration > time))] [ if (ycor = -15) [set task-slot-1-full 0] if (ycor = -12) [set task-slot-2-full 0] if (ycor = -9) [set task-slot-3-full 0] if (ycor = -6) [set task-slot-4-full 0] hide-turtle ] ask jobs with [(hidden? = true) and (teaming-episode = 1) and (start-time <= time) and (start-time + duration > time)] [ ifelse (task-slot-1-full = 0) [ set ycor -15 set task-slot-1-full 1] [ifelse (task-slot-2-full = 0) [ set ycor -12 set task-slot-2-full 1] [ifelse (task-slot-3-full = 0) [ set ycor -9 set task-slot-3-full 1] [if (task-slot-4-full = 0) [ set ycor -6 set task-slot-4-full 1]]]] show-turtle ] ;;colors astronauts based upon the current tasks ask astronauts [set color white] ask jobs with [(hidden? = false) and (teaming-episode = 1)] [ set temp-color-store color if (assigned-to-cmd = 1) [ask astronaut 0 [set color temp-color-store]] if (assigned-to-fe = 1) [ask astronaut 1 [set color temp-color-store]] if (assigned-to-ms1 = 1) [ask astronaut 2 [set color temp-color-store]] if (assigned-to-ms2 = 1) [ask astronaut 3 [set color temp-color-store]] ] ;;displays the correct type of ties if (displayn = "Positive affect")[display-paffect] if (displayn = "Negative affect")[display-naffect] if (displayn = "Informational ties")[display-inform] if (displayn = "Behavioral ties")[display-behave] ;;displays the current time ask patch 15 15 [ set plabel time ] end ;; The main simulation routine for the program to go ;;steps forward in model time update-paffect update-naffect update-inform update-behave set time (time + 5) ;;time stored in five minute increments (one twelth of an hour) refresh tick end ;; A subroutine for importing jobs from csv to import-jobs ;; open a file on the system let filename "CrewSchedule.csv" file-open filename ;; parses the file let header csv:from-row file-read-line while [ not file-at-end? ] [ let items csv:from-row file-read-line create-jobs 1 [ ;; not visible until (ticks = start-time) hide-turtle ;; make the tasks have a box shape set shape "box" set size 3 set start-time item 0 items set duration item 1 items set assigned-to-CMD item 2 items set assigned-to-FE item 3 items set assigned-to-MS1 item 4 items set assigned-to-MS2 item 5 items set teaming-episode item 6 items set xcor 15 set ycor 0 ] ] ;; import complete, so close the file file-close set imported-jobs true end
There is only one version of this model, created over 8 years ago by Jacqueline Ng.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
JacquelineNg-[team-ties]-project-EECS 472.png | preview | Preview for 'JacquelineNg-[team-ties]-project-EECS 472' | over 8 years ago, by Jacqueline Ng | Download |
This model does not have any ancestors.
This model does not have any descendants.