JacquelineNg-[team-ties]-project-EECS 472
Model was written in NetLogo 6.0-M5
•
Viewed 317 times
•
Downloaded 21 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 hours, while every tick represents five minutes. global-posaffect ;;mean affect of links, between 0 and 1 global-negaffect global-posreciprocity ;;mean reciprocity, between 0 and 1 posreciprocity-01 posreciprocity-02 posreciprocity-03 posreciprocity-12 posreciprocity-13 posreciprocity-23 global-negreciprocity ;;mean reciprocity, between 0 and 1 negreciprocity-01 negreciprocity-02 negreciprocity-03 negreciprocity-12 negreciprocity-13 negreciprocity-23 ] turtles-own [ role ;;personality extraversion conscientiousness emotional_stability agreeableness openness ;;need to import individual differences collected from HERA ;; current code does not incorporate personalities ] links-own [ posaffect ;;affect values for each link, ranging 0<=affect<=1 negaffect ] extensions[csv] 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 visible ] ;; Routine for the ABM Simulation setup to setup clear-all set time 0 setup-agents setup-links reset-ticks set imported-jobs False end ;;Creates the four agents for the model: CMD, FE, MS1, MS2 to setup-agents create-turtles 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-turtles 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-turtles 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-turtles 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 turtles with [who != 0][ create-link-to turtle 0 ] ask turtles with [who != 1][ create-link-to turtle 1 ] ask turtles with [who != 2][ create-link-to turtle 2 ] ask turtles 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 ;; The main simulation routine for the program to go ;;randomly sets affect values of links import-jobs ask links [ set posaffect (p_alpha * posaffect + (1 - p_alpha) * (0.25 * posaffect + 0.25 * (random-float .25 - random-float .25) + 0.25 * (random-float .25 - random-float .25) + 0.25 * random 2)) if posaffect > 1 [set posaffect 1] if posaffect < 0 [set posaffect 0] set negaffect (n_alpha * negaffect + (1 - n_alpha) * (0.25 * negaffect + 0.25 * (random-float .25 - random-float .25) + 0.25 * (random-float .25 - random-float .25) + 0.25 * random 2)) if negaffect > 1 [set negaffect 1] if negaffect < 0 [set negaffect 0] ] ;;colors network links based upon affect values ask links [ ;;set color rgb (255 - 255 * affect) (55 + 200 * affect) 0 set color approximate-hsb (posaffect * 140) 90 70 set color approximate-hsb (negaffect * 140) 90 70 ] ;;colors astronauts who are on the same task ask turtles with [who = 0 or who = 1 or who = 3][ ifelse (random-float 1 < 0.5) [set color white] [ifelse (random-float 1 < 0.7) [set color 87] [ifelse (random-float 1 < 0.8) [set color 57] [set color 137]]] ] ;;resets global variables set time (time + 1 / 12) set global-posaffect (([posaffect] of link 0 1 + [posaffect] of link 0 2 + [posaffect] of link 0 3 + [posaffect] of link 1 0 + [posaffect] of link 1 2 + [posaffect] of link 1 3 + [posaffect] of link 2 0 + [posaffect] of link 2 1 + [posaffect] of link 2 3 + [posaffect] of link 3 0 + [posaffect] of link 3 1 + [posaffect] of link 3 2) / 12) set posreciprocity-01 abs ([posaffect] of link 0 1 - [posaffect] of link 1 0) set posreciprocity-02 abs ([posaffect] of link 0 2 - [posaffect] of link 2 0) set posreciprocity-03 abs ([posaffect] of link 0 3 - [posaffect] of link 3 0) set posreciprocity-12 abs ([posaffect] of link 1 2 - [posaffect] of link 2 1) set posreciprocity-13 abs ([posaffect] of link 1 3 - [posaffect] of link 3 1) set posreciprocity-23 abs ([posaffect] of link 2 3 - [posaffect] of link 3 2) set global-negaffect (([negaffect] of link 0 1 + [negaffect] of link 0 2 + [negaffect] of link 0 3 + [negaffect] of link 1 0 + [negaffect] of link 1 2 + [negaffect] of link 1 3 + [negaffect] of link 2 0 + [negaffect] of link 2 1 + [negaffect] of link 2 3 + [negaffect] of link 3 0 + [negaffect] of link 3 1 + [negaffect] of link 3 2) / 12) set negreciprocity-01 abs ([negaffect] of link 0 1 - [negaffect] of link 1 0) set negreciprocity-02 abs ([negaffect] of link 0 2 - [negaffect] of link 2 0) set negreciprocity-03 abs ([negaffect] of link 0 3 - [negaffect] of link 3 0) set negreciprocity-12 abs ([negaffect] of link 1 2 - [negaffect] of link 2 1) set negreciprocity-13 abs ([negaffect] of link 1 3 - [negaffect] of link 3 1) set negreciprocity-23 abs ([negaffect] of link 2 3 - [negaffect] of link 3 2) 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 [ hide-turtle ;; make the tasks have a square shape set shape "square" 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 ;; not visible until (ticks = introduction-time) set xcor 0 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.