extensions
[
csv ;; Turns on the CSV extension.
pathdir ;; Turns on the PathDir extension.
]
;;; GLOBAL VARIABLES OWNED BY ALL ;;;
globals ;; Global variables that can be owned by all.
[
track-symptomatic-csv ;; Stores custom filename for CSV
symptomatic-challenge-count ;; For calibrating
asymptomatic-challenge-count ;; For calibrating
diagnosed-vaccine-efficacy ;; (1 - Relative Risk) * 100 that would be equated using current real-world methods.
diagnosed-relative-risk ;; Attack Ratio (Fully-Vaccinated) / Attack Ratio (Vaccinations not Up to Date) that would be equated using current real-world methods.
diagnosed-case-vaccinated ;; Fully vaccinated case that would be diagnosed using current real-world methods.
diagnosed-case-unvaccinated ;; Unvaccinated case that would be diagnosed using current real-world methods.
diagnosed-AR-vaccinated ;; Attack Ratio (Fully-Vaccinated) that would be diagnosed using current real-world methods.
diagnosed-AR-unvaccinated ;; Attack Ratio (Vaccinations not Up to Date) that would be diagnosed using current real-world methods.
cause-asymptomatic ;; Tracks if an asymptomatic carrier transmitted the bacteria.
cause-symptomatic ;; Tracks if a symptomatic carrier transmitted the bacteria.
unvac-attack-success ;; Green Patches
vac-attack-success ;; Red Patches
vac-attack-fail ;; Pink Patches
infected ;; The # of the population that is infected.
vaccinated-infected ;; The # of the population that is vaccinated and infected.
unvaccinated-infected ;; The # of the population that is unvaccinated and infected.
%infected ;; The % of the population is infected.
%vaccinated-infected ;; The % of the population that is vaccinated and infected.
%unvaccinated-infected ;; The % of the population that is unvaccinated and infected.
%never-infected ;; The % of the population never infected.
track-iterations ;; Tracks the iterations that the program has run.
track-symptomatic ;; Tracks the active number of symptomatic infections.
symptomatic-counter ;; Counts the total number of symptomatic infection there have been.
track-asymptomatic ;; Tracks the active number of asymptomatic infections.
asymptomatic-counter ;; Counts the total number of asymptomatic infections there have been.
total-counter ;; Counts the total number of infections.
track-antibiotics ;; Tracks the number of patients who have taken antibiotics.
buildings-counter ;; Allows buildings to be created commensurate with initial-children/12 and assigns ID #'s
daycare ;; Patches representing the daycare.
workspace ;; Patches representing work.
school ;; Patches representing school.
house ;; Patches representing houses.
transportation ;; Patches representing transportation.
transportation-id ;; ID # representing transportation for 12 families, enables scaling of transportation network.
counter ;; A placeholder variable to count/store background operations. (Used for assigning turtle-daycare to turtle and calendar.)
counts-days ;; Counts the days to progressively move days of week until reaching starting day of the week.
calendar-counter ;; Counts days of the month to progress through months.
feb-leap-year ;; Stores 28 days or 29 days for February depending on leap year.
calendar-days ;; For storing correct Gregorian calendar days in a year to accomodate leap year when necessary.
day-of-week ;; Tracks which day of the week it is (numerical form). ("Sunday 7, Monday 1... etc.")
work-counter ;; Allows non-care-giver parent the possibility to go to a different workplace than spouse.
month ;; Tracks Months.
year ;; Tracks Years.
days ;; Tracks Days.
hours ;; Tracks Hours.
minutes ;; Tracks Minutes.
output-day ;; Outputs the day-of-week in text form, ("Sunday, Monday... etc.")
agent-zero ;; Allows documenting of agent-zeroes family information.
symptom-onset-counter ;; Used to count the symptom onsets (Only counts symptomatic agents).
jan ;; Used during setup to set the day of the week.
feb ;; Used during setup to set the day of the week.
mar ;; Used during setup to set the day of the week.
apr ;; Used during setup to set the day of the week.
may ;; Used during setup to set the day of the week.
jun ;; Used during setup to set the day of the week.
jul ;; Used during setup to set the day of the week.
aug ;; Used during setup to set the day of the week.
sept ;; Used during setup to set the day of the week.
oct ;; Used during setup to set the day of the week.
nov ;; Used during setup to set the day of the week.
dec ;; Used during setup to set the day of the week.
average-temperature ;; For selecting the appropriate monthly temperature each month.
daily-temperature ;; Fluctuates the temperature +/- 10 degrees daily from the average temperature.
adjusted-sneezes-per-day ;; Used for setting the adjusted sneezes per day based on temperature.
adjusted-coughs-per-day ;; Used for setting the adjusted coughs per day based on temperature.
rotate-daycare ;; Used for rotating one of the daycare workers through the classrooms.
holiday-counter ;; Global variable counter for determining holidays that fall on a certain day of week every year (ie. Thanksgiving).
holiday? ;; True or False for the day being a holiday.
]
;;; VARIABLES OWNED BY PATCHES ;;;
patches-own ;; Variables that are owned by patches
[
patch-type ;; Defines the type of building.
daycare-id ;; ID # for patches representing a particular daycare.
workspace-id ;; ID # for patches representing a particular place of work.
school-id ;; ID # for patches representing a particular school.
house-id ;; ID # for patches representing a particular house.
transportation-wd ;; ID # for patches representing transportation between workspace and daycare.
transportation-dh ;; ID # for patches representing transportation between daycare and house.
transportation-hs ;; ID # for patches representing transportation between house and school.
]
;;; VARIABLES OWNED BY TURTLES ;;;
turtles-own ;; Variables that are owned by all "breeds"
[
when-infected ;; Stores the tick count (minute) at time of infection.
destination ;; Stores destination of turtle.
turtle-home ;; Allows home coordinates to be assigned.
family-id ;; Families receive an ID after they are randomly grouped together.
care-giver? ;; Parent who takes child to daycare.
workspace-ncg ;; Non-care-giver parents assigned workspace.
turtle-daycare ;; Allows daycare to be assigned.
phase-tracker ;; Progresses the infection according to ticks (phase length is set within a peer-reviewed articles proposed range and is unique to each turtle).
incubation ;; Length of first phase of pertussis infection (Length is individually calculated and assigned for each infected turtle).
catarrhal ;; Length of second phase of pertussis infection (Length is individually calculated and assigned for each infected turtle).
paroxysmal ;; Length of third phase of pertussis infection (Length is individually calculated and assigned for each infected turtle).
convalescent ;; Length of fourth phase of pertussis infection(Length is individually calculated and assigned for each infected turtle).
bacteria? ;; Is the agent carrying Bordtella pertussis bacteria?
asymptomatic-bacteria? ;; Is the agent asymptomatically carrying Bordetella pertussis bacteria?
vaccinated? ;; Is the agent vaccinated?
age ;; Tracks the age of the agent.
vaccine-effectiveness ;; For setting individual vaccine effectiveness based on days from receipt of vaccination.
scheduled-vaccine ;; Set the date of last vaccine.
natural-immunity? ;; Sets natural immunity.
awareness-factor ;; Age gives an awareness factor that decreases chances of acquiring Pertussis.
aware-turtle? ;; Turtles can be identified as the aware turtle.
stay-home? ;; Symptomatic-agents stay-home if they know they are symptomatic.
type-of-agent ;; Holds type-of-agent numerical value.
]
;;; BREEDS IN THE SCRIPT ;;;
breed [ children child ] ;; Introduces the "breed", children to the script.
breed [ siblings sibling ] ;; Introduces the "breed", siblings to the script.
breed [ parents parent ] ;; Introduces the "breed", parents to the script.
breed [ daycareworkers daycareworker ] ;; Introduces the "breed", daycareworkers to the script.
;;; "SETUP BUTTON" COMMANDS - Includes Buildings and Transportation ;;;
to setup ;; Commands when the "setup" button is pressed or the setup command is given.
clear-patches ;; Clears the Patches.
clear-turtles ;; Clears the Turtles.
reset-ticks ;; Ticks are started at 0.
resize-world 0 ((initial-children / 12) * 120) -50 50 ;; Resizes the world based on # of initial children slider divided by the increment * 106 patches to accomodate for additional daycares and homes.
ask patches [set pcolor white] ;; Sets the background color to white.
set track-iterations track-iterations + 1 ;; Adds 1 to the # of iterations (To begin recording at the 1st iteration as opposed to the 0th).
set track-symptomatic 0 ;; Resets track-symptomatic global variable to 0.
set track-asymptomatic 0 ;; Resets track-asymptomatic global variable to 0.
set symptomatic-counter 0 ;; Resets the symptomatic-counter global variable to 0.
set asymptomatic-counter 0 ;; Resets the asymptomatic-counter global variable to 0.
set total-counter 0 ;; Resets the total-counter global variable to 0.
set cause-symptomatic 0 ;; Resets cause-symptomatic global variable to 0.
set cause-asymptomatic 0 ;; Resets cause-asymptomatic global variable to 0.
set diagnosed-case-vaccinated 0 ;; Resets diagnosed-case-vaccinated global variable to 0.
set diagnosed-case-unvaccinated 0 ;; Resets diagnosed-case-unvaccinated global variable to 0.
set month start-month ;; Sets the calendar to the pre-selected starting month.
set year start-year ;; Sets the calendar to the pre-selected starting year.
set calendar-counter start-day ;; Sets the calendar to the pre-selected starting day.
set minutes 0 ;; Resets the Minutes to 0.
set hours 0 ;; Resets the Hours to 0.
set days 0 ;; Resets the Days to 0.
set counter 0 ;; Counter is set to 0 for use calculating the day of the week.
set counts-days 1 ;; Sets counts-days to 1.
set symptom-onset-counter 0 ;; Resets the symptom-onset-counter to 0.
set holiday? false ;; Initiall sets the holiday value to false.
set holiday-counter 0 ;; Resets the holiday-counter to 1.
file-open (word "output-" track-iterations ".csv") ;; Creates a file or opens a file named output-#.csv in the main directory.
file-print "Month,Day,Track.Asym,Track.Sym,Sym.Chal,Asym.Chal,Antibiotics,C.Sym.Onset,F.Sym.Onset,D.Sym.Onset" ;; Writes the header for the output CSV.
file-close-all ;; Closees open files.
pathdir:create (word "CSV-Iteration-" track-iterations) ;; Creates a folder to contain CSV files created for each iteration.
file-open (word "./CSV-Iteration-" track-iterations "/" "track-asymptomatic-" track-iterations ".csv") ;; Creates a file or opens a file named track-asymptomatic-#.csv in the Iterations CSV directory.
file-print "Month,Day,Track.Asym" ;; Writes the header for tracking the asymptomatic cases.
file-close-all ;; Closes open files.
file-open (word "./CSV-Iteration-" track-iterations "/" "track-symptomatic-" track-iterations ".csv") ;; Creates a file or opens a file named track-symptomatic-#.csv in the Iterations CSV directory.
file-print "Month,Day,Track.Sym" ;; Writes the header for tracking the symptomatic cases.
file-close-all ;; Closes open files.
file-open (word "./CSV-Iteration-" track-iterations "/" "symptomatic-challenge-" track-iterations ".csv") ;; Creates a file or opens a file named symptomatic-challenge-#.csv in the Iterations CSV directory.
file-print "Month,Day,Sym.Chal" ;; Writes the header for tracking the symptomatic challenges.
file-close-all ;; Closes open files.
file-open (word "./CSV-Iteration-" track-iterations "/" "asymptomatic-challenge-" track-iterations ".csv") ;; Creates a file or opens a file named asymptomatic-challenge-#.csv in the Iterations CSV directory.
file-print "Month,Day,Asym.Chal" ;; Writes the header for tracking the asymptomatic challenges.
file-close-all ;; Closes open files.\
file-open (word "./CSV-Iteration-" track-iterations "/" "antibiotics-" track-iterations ".csv") ;; Creates a file or opens a file named antibiotics-#.csv in the Iterations CSV directory.
file-print "Month,Day,Antibiotics" ;; Writes the header for tracking the antibiotics.
file-close-all ;; Closes open files.
file-open (word "./CSV-Iteration-" track-iterations "/" "children-symptomatic-onset-" track-iterations ".csv") ;; Creates a file or opens a file named children-symptomatic-onset-#.csv in the Iterations CSV directory.
file-print "Month,Day,C.Sym.Onset" ;; Writes the header for tracking the date diagnosed for children symptom onset.
file-close-all ;; Closes open files.
file-open (word "./CSV-Iteration-" track-iterations "/" "family-symptomatic-onset-" track-iterations ".csv") ;; Creates a file or opens a file named family-symptomatic-onset-#.csv in the Iterations CSV directory.
file-print "Month,Day,F.Sym.Onset" ;; Writes the header for tracking the date diagnosed for family symptom onset.
file-close-all ;; Closes open files.
file-open (word "./CSV-Iteration-" track-iterations "/" "daycareworkers-symptomatic-onset-" track-iterations ".csv") ;; Creates a file or opens a file named daycareworkers-symptomatic-onset-#.csv in the Iterations CSV directory.
file-print "Month,Day,D.Sym.Onset" ;; Writes the header for tracking the date diagnosed for daycare workers symptom onset.
file-close-all ;; Closes open files.
calendar-commands ;; Runs Calendar Commands (Sets temperature).
set daily-temperature (average-temperature + (random 10) - (random 10)) ;; Sets the initial temperature +/- 10 degrees.
file-open (word "./CSV-Iteration-" track-iterations "/" "daily-temperature-" track-iterations ".csv") ;; Creates a file or opens a file named daily-temperature-#.csv in the Iterations CSV directory.
file-print "Month,Day,Temp" ;; Writes the header for tracking the temperature.
file-type month file-type "," file-type calendar-counter file-type "," file-type daily-temperature file-type "\n" ;; Adds relevant information to the month, day, and temperature.
file-close-all ;; Closes open files.
setup-calendar ;; The setup-calendar commands run.
setup-buildings-and-transportation ;; THe setup-buildings-and-transportation commands run.
setup-children ;; The setup-children commands run.
setup-parents ;; The setup-parents commands run.
setup-siblings ;; The setup-siblings commands run.
setup-daycareworkers ;; The setup-daycareworkers commands run.
infect-agent-zero ;; Runs commands to infect agent zero.
end
;;; SETUP-CHILDREN COMMANDS ;;;
to setup-children ;; Contains the setup-children commands.
set buildings-counter 1 ;; Resets buildings-counter to 1.
while [buildings-counter <= round(initial-children * pct-initial-children-vaccinated)] ;; Runs the loop to create the pre-selected # of vaccinated children.
[
create-children 1 ;; Creates the children "breed" who are vaccinated, uses round to ensure 1 child per house.
[
setxy 0 50 ;; Creates children at a specified location.
set shape "person" ;; The children are shaped like people.
set size 1 ;; The children relative size as they appear on the drawing board.
set color brown ;; The children are initially brown, this denotes that the children have never been colonized.
set bacteria? false ;; These children are without Pertussis bacteria.
set asymptomatic-bacteria? false ;; None of the children are asymptomatic carriers.
set vaccinated? true ;; These children are vaccinated.
set natural-immunity? false ;; Initially sets natural-immunity? false.
set stay-home? false ;; The children will not initially stay at home.
set type-of-agent 1 ;; Children are type-of-agent 1.
]
set buildings-counter buildings-counter + 1 ;; Adds one to the buildings-counter to progress through while command.
]
set buildings-counter 1 ;; Resets buildings-counter to 1.
while [buildings-counter <= (initial-children - round(initial-children * pct-initial-children-vaccinated))] ;; Runs the loop to create the pre-selected % of unvaccinated children.
[
create-children 1 ;; Creates the children "breed" who are unvaccinated, uses round to ensure 1 child per house.
[
setxy 0 50 ;; Creates children at a specific location.
set shape "person" ;; The children are shaped like babies.
set size 1 ;; The children relative size as they appear on the drawing board.
set color brown ;; The children are initially brown, this denotes that the children have never been colonized.
set bacteria? false ;; All children are without Pertussis bacteria.
set asymptomatic-bacteria? false ;; No children are asymptomatic carriers.
set vaccinated? false ;; All children are vaccinated.
set natural-immunity? false ;; Initially sets natural-immunity? false.
set stay-home? false ;; The children will not initially stay at home.
set type-of-agent 1 ;; Children are type-of-agent 1.
]
set buildings-counter buildings-counter + 1 ;; Adds one to the buildings-counter to progress through while command.
]
set buildings-counter 1 ;; Resets buildings-counter to 1.
set counter 1 ;; Sets counter to 1.
;;; Randomly Disperses children regardless of vaccination status across houses. ;;;
while [initial-children >= buildings-counter] ;; Uses buildings-counter to ensure all initial children get homes by looping until criteria becomes false.
[
ask one-of children-on patch 0 50 ;; This randomly selects an child regardless of being vaccinated or not.
[
move-to one-of patches with [house-id = buildings-counter] ;; This equation ensures that selected go to unique homes.
set age (1 / 24 * buildings-counter) ;; Sets the childrens ages to be 1 month apart.
set awareness-factor age ;; Sets the awareness factor of each child to be proportional to their age.
set aware-turtle? false ;; Initially sets no turtles as the aware turtle.
;; VACCINE SCHEDULE ;;
ifelse (2 / 12) < age and age <= (4 / 12) ;; For children older than 2 months and 4 months or less.
[ set scheduled-vaccine (2 / 12) ] ;; Last vaccine will have been at 2 months.
[ ifelse (4 / 12) < age and age <= (6 / 12) ;; For children older than 4 months and 6 months or less.
[ set scheduled-vaccine (4 / 12) ] ;; Last vaccine will have been at 4 months.
[ ifelse (6 / 12) < age and age <= (15 / 12) ;; For children older than 6 months and 13 months or less.
[ set scheduled-vaccine (6 / 12) ] ;; Last vaccine will have been at 6 months
[ ifelse (15 / 12) < age and age <= 4 ;; For children older than 13 months and 4 years or less.
[ set scheduled-vaccine (15 / 12) ] ;; Last vaccine will have been at 13 months.
[ set scheduled-vaccine 4 ] ;; Children older than 4, last vaccine will have been at 4 years.
]
]
]
if (2 / 12) < age ;; For children older than 2 months.
[
ifelse waning-immunity? ;; Checks to see if waning-immunity is turned on.
[
set vaccine-effectiveness (initial-vaccine-effectiveness - (initial-vaccine-effectiveness * ((age - scheduled-vaccine) * waning-rate-annual))) ;; Wanes immunity according to child's date since last vaccination.
]
[
set vaccine-effectiveness initial-vaccine-effectiveness ;; If waning immunity is turned off, the vaccination effectiveness is set to initial setting without waning immunity being factored.
]
]
set turtle-home patch-here ;; Assigns this patch as the children home.
set family-id house-id ;; Assigns the house-id as the family-id.
set turtle-daycare 1 ;; Sets turtle-daycare to 1
while [ (buildings-counter / 12) > turtle-daycare ] ;; While loop adds 1 to the turtle-daycare for every 12 children processed.
[
set turtle-daycare turtle-daycare + 1 ;; Adds one to turtle daycare.
]
]
set buildings-counter buildings-counter + 1 ;; Adds one to the buildings-counter to progress through while command.
]
end
;;; SETUP-PARENTS COMMANDS ;;;
to setup-parents ;; Contains the setup-children commands.
create-parents round((initial-children * 2) * pct-initial-parents-vaccinated) ;; Creates the parents "breed" @ 2 times # intial children who are vaccinated, uses round to ensure 2 parents per house.
[
setxy 0 50 ;; Creates parents at a single designated location to start.
set shape "person" ;; The parents are shaped like people.
set size 3 ;; The parents relative size as they appear on the drawing board.
set bacteria? false ;; These parents are without Pertussis bacteria.
set asymptomatic-bacteria? false ;; None of these parents are asymptomatic carriers.
set vaccinated? true ;; These parents are vaccinated.
set stay-home? false ;; The parents will not initially stay at home.
set type-of-agent 2 ;; Parents are type-of-agent 2.
set color brown ;; The parents are initially brown, this denotes that the parents have never been colonized.
set age ((random 17) + 23) ;; Randomly sets the age of parents from 23 to 40.
set natural-immunity? false ;; Initially sets natural-immunity? false.
]
create-parents round((initial-children * 2) - ((initial-children * 2) * pct-initial-parents-vaccinated)) ;; Creates the parents "breed" who are unvaccinated, uses round to ensure 2 parents per house.
[
setxy 0 50 ;; Creates parents at a specific location.
set shape "person" ;; The parents are shaped like people.
set size 3 ;; The parents relative size as they appear on the drawing board.
set bacteria? false ;; These parents are without Pertussis bacteria.
set asymptomatic-bacteria? false ;; None of these parents are asymptomatic carriers.
set vaccinated? false ;; These parents are not vaccinated.
set stay-home? false ;; The parents will not initially stay at home.
set type-of-agent 2 ;; Parents are type-of-agent 2.
set color brown ;; The parents are initially brown, this denotes that the parents have never been colonized.
set age ((random 17) + 23) ;; Randomly sets the age of parents from 23 to 40.
set natural-immunity? false ;; Initially sets natural-immunity? false.
]
;;; Randomly Disperses parents vaccinated/not across houses. ;;;
set buildings-counter 1 ;; Resets buildings-counter to 1.
while [initial-children >= buildings-counter] ;; Uses buildings-counter to ensure all initial children get homes by looping until criteria becomes false.
[
ask one-of parents-on patch 0 50 ;; This randomly selects a parent regardless of being vaccinated or not.
[
move-to one-of patches with [house-id = buildings-counter] ;; This equation ensures that selected go to unique homes.
set turtle-home patch-here ;; Assigns this patch as the parents home patch.
set family-id house-id ;; Assigns the house-id as the family-id.
set scheduled-vaccine (family-id * ( 1 / 24 )) ;; Parents last vaccine is set to when the age of their child.
ifelse waning-immunity? ;; Checks to see if waning-immunity? is turned on.
[
set vaccine-effectiveness (initial-vaccine-effectiveness - (initial-vaccine-effectiveness * (scheduled-vaccine * waning-rate-annual))) ;; Degrades Vaccine effectiveness accordingly.
if vaccine-effectiveness < 0 OR not vaccinated?
[ set vaccine-effectiveness 0 ]
]
[
set vaccine-effectiveness initial-vaccine-effectiveness ;; Sets vaccine-effectiveness to initial-vaccine-effectiveness slider bar.
]
set care-giver? true ;; This parent is the care-giver who will take the child to daycare.
set awareness-factor age ;; The awareness factor is directly correlated to an agents age.
set aware-turtle? false ;; Initially sets no turtles as the aware turtle.
]
ask one-of parents-on patch 0 50 ;; This randomly selects a second parent regardless of being vaccinated or not.
[
move-to one-of patches with [house-id = buildings-counter] ;; This equation ensures that selected go to unique homes.
set turtle-home patch-here ;; Assigns this patch as the parents home patch.
set family-id house-id ;; Assigns the house-id as the family-id.
set scheduled-vaccine (family-id * ( 1 / 24 )) ;; Parents last vaccine is set to when the age of their child.
ifelse waning-immunity? ;; Checks to see if waning-immunity? is turned on.
[
set vaccine-effectiveness (initial-vaccine-effectiveness - (initial-vaccine-effectiveness * (scheduled-vaccine * waning-rate-annual))) ;; Degrades Vaccine effectiveness accordingly.
if vaccine-effectiveness < 0 OR not vaccinated?
[ set vaccine-effectiveness 0 ]
]
[
set vaccine-effectiveness initial-vaccine-effectiveness ;; Sets vaccine-effectiveness to initial-vaccine-effectiveness slider bar.
]
set care-giver? false ;; This parent is the non-care-giver.
set awareness-factor age ;; The awareness factor is directly correlated to an agents age.
set aware-turtle? false ;; Initially sets no turtles as the aware turtle.
set workspace-ncg (random (initial-children)) ;; Assigns the workspace (possibly at or not at co-parents place of work) to the parent.
]
set buildings-counter buildings-counter + 1 ;; Adds one to the buildings-counter to progress through while command.
]
end
;;; SETUP-SIBLINGS COMMANDS ;;;
to setup-siblings ;; Contains the setup-children commands.
create-siblings round(initial-children * pct-initial-siblings-vaccinated) ;; Creates the siblings "breed" @ 2 times # intial children who are vaccinated, uses round to ensure 2 siblings per house.
[
setxy 0 50 ;; Creates siblings at a single designated location to start.
set shape "person" ;; The siblings are shaped like people.
set size 2 ;; The siblings relative size as they appear on the drawing board.
set bacteria? false ;; These siblings are without Pertussis bacteria.
set asymptomatic-bacteria? false ;; None of these siblings are asymptomatic carriers.
set vaccinated? true ;; These siblings are vaccinated.
set stay-home? false ;; The siblings will not initially stay at home.
set type-of-agent 3 ;; Siblings are type-of-agent 3.
set color brown ;; The siblings are initially brown, this denotes that the siblings have never been colonized.
set age ((random 12) + 6) ;; Randomly sets the age of siblings from 6 to 18.
set scheduled-vaccine random 2 + 4 ;; Last vaccine will have been between 4 and 6 years old.
ifelse waning-immunity? ;; Checks to see if waning immunity is turned on.
[
set vaccine-effectiveness (initial-vaccine-effectiveness - (initial-vaccine-effectiveness * ((age - scheduled-vaccine) * waning-rate-annual))) ;; Degrades Vaccine effectiveness accordingly.
if vaccine-effectiveness < 0 ;; If vaccine effectiveness is less than 0.
[ set vaccine-effectiveness 0 ] ;; Sets vaccine effectiveness to 0.
]
[
set vaccine-effectiveness initial-vaccine-effectiveness ;; Sets vaccine-effectiveness to initial-vaccine-effectiveness slider bar.
]
set natural-immunity? false ;; Initially sets natural-immunity? false.
]
create-siblings round(initial-children - (initial-children * pct-initial-siblings-vaccinated)) ;; Creates the siblings "breed" who are unvaccinated, uses round to ensure 2 siblings per house.
[
setxy 0 50 ;; Creates siblings at a single designated location to start.
set shape "person" ;; The siblings are shaped like people.
set size 2 ;; The siblings relative size as they appear on the drawing board.
set bacteria? false ;; These siblings are without Pertussis bacteria.
set asymptomatic-bacteria? false ;; None of these siblings are asymptomatic carriers.
set vaccinated? false ;; These siblings are not vaccinated.
set stay-home? false ;; The siblings will not initially stay at home.
set type-of-agent 3 ;; Siblings are type-of-agent 3.
set color brown ;; The siblings are initially brown, this denotes that the siblings have never been colonized.
set age ((random 12) + 6) ;; Randomly sets the age of siblings from 6 to 18.
set natural-immunity? false ;; Initially sets natural-immunity? false.
]
set buildings-counter 1 ;; Resets buildings-counter to 1.
;;; Randomly Disperses siblings vaccinated/not across houses. ;;;
while [initial-children >= buildings-counter] ;; Uses buildings-counter to ensure all initial siblings get homes by looping until criteria becomes false.
[
ask one-of siblings-on patch 0 50 ;; This randomly selects a sibling regardless of being vaccinated or not.
[
move-to one-of patches with [house-id = buildings-counter] ;; This equation ensures that selected go to unique homes.
set turtle-home patch-here ;; Assigns this patch as the siblings home.
set family-id house-id ;; Assigns the house-id as the family-id.
set awareness-factor age ;; The awareness factor is set according to the agents age.
set aware-turtle? false ;; Initially sets no turtles as the aware turtle.
]
set buildings-counter buildings-counter + 1 ;; Adds one to the buildings-counter to progress through while command.
]
end
to setup-daycareworkers
create-daycareworkers initial-children / 6 ;; Creates 2 daycare workers per daycare (per 12 children).
[
setxy 0 50 ;; Creates daycare workers at a single designated location to start.
set shape "person" ;; The daycare workers are shaped like people.
set size 3 ;; The daycare workers relative size as they appear on the drawing board.
set bacteria? false ;; These daycare workers are without Pertussis bacteria.
set asymptomatic-bacteria? false ;; None of these daycare workers are asymptomatic carriers.
set vaccinated? true ;; These daycare workers are vaccinated.
set stay-home? false ;; The daycare workers will not initially stay at home.
set type-of-agent 4 ;; Siblings are type-of-agent 4.
set color brown ;; The daycare workers are initially brown, this denotes that the daycare workers have never been colonized.
set age ((random 22) + 18) ;; Randomly sets the age of daycare workers from 18 to 40.
set scheduled-vaccine (age - random 1) ;; Last vaccine will have been one year ago or zero years ago.
ifelse waning-immunity? ;; Checks to see if waning immunity is turned on.
[
set vaccine-effectiveness (initial-vaccine-effectiveness - (initial-vaccine-effectiveness * ((age - scheduled-vaccine) * waning-rate-annual))) ;; Degrades Vaccine effectiveness accordingly.
if vaccine-effectiveness < 0 ;; If vaccine effectiveness is less than 0.
[ set vaccine-effectiveness 0 ] ;; Sets vaccine effectiveness to 0.
]
[
set vaccine-effectiveness initial-vaccine-effectiveness ;; Sets vaccine-effectiveness to initial-vaccine-effectiveness slider bar.
]
set natural-immunity? false ;; Initially sets natural-immunity? false.
]
set buildings-counter 1 ;; Resets buildings-counter to 1
;;; Randomly Disperses daycare workers across daycares. ;;;
while [any? daycareworkers-on patch 0 50] ;; Disperses until no daycareworkers are on patch 0 50
[
ask one-of daycareworkers-on patch 0 50 ;; This randomly selects a daycare worker.
[
move-to one-of patches with [daycare-id = buildings-counter] ;; This equation ensures that selected go to unique homes.
set turtle-home patch-here ;; Assigns this patch as the daycare workers home.
set family-id daycare-id ;; Assigns the family-id as the daycare-id.
set awareness-factor age ;; The awareness factor is set according to the agents age.
]
ask one-of daycareworkers-on patch 0 50 ;; This randomly selects a daycare worker.
[
move-to one-of patches with [daycare-id = buildings-counter] ;; This equation ensures that selected go to unique homes.
set turtle-home patch-here ;; Assigns this patch as the daycare workers home.
set family-id daycare-id ;; Assigns the family-id as the daycare-id.
set awareness-factor age ;; The awareness factor is set according to the agents age.
]
set buildings-counter buildings-counter + 1 ;; Adds one to the buildings-counter to progress through while command.
]
end
;;; SYMPTOMATIC INFECT COMMANDS ;;;
to symptomatic-infect ;; The procedure for an infected or carrier turtle to infect other turtles
ask other turtles in-radius 1 ;; Checks for turtles within a contact range radius of 2 patches
[
if patch-type = "house" or patch-type = "school" or patch-type = "daycare" or patch-type = "workspace" ;; Can only get infected in buildings.
[
ifelse natural-immunity? ;; Checks to see if turtle has acquired Natural Immunity
[ ] ;; Nothing happens if Natural-Immunity? True
[
ifelse bacteria? ;; Tests if the bacteria in the child is true or false
[ ] ;; If the turtle within contact range already has bacteria, then nothing happens.
[
ifelse asymptomatic-bacteria? ;; Check to see if the turtle within contact range is an asymptomatic carrier of pertussis bacteria.
[ ] ;; If the turtle within contact range is an asymptomatic-carrier then nothing happens.
[
if random 100 >= awareness-factor * awareness-strength ;; Awareness factor gives an additional chance to avoid infection proportional to the ages of the turtles, dependent on awareness strength.
[
set symptomatic-challenge-count symptomatic-challenge-count + 1 ;; Adds 1 to the symptomatic-challenge-count.
file-open (word "./CSV-Iteration-" track-iterations "/" "symptomatic-challenge-" track-iterations ".csv") ;; Creates a file or opens a file named symptomatic-challenge-#.csv
file-type month file-type "," file-type calendar-counter file-type "," file-type "1" file-type "\n" ;; Adds relevant information to the month, day, and a 1 to indicate an additional challenge by a symptomatic carrier.
file-close-all ;; Closes all open files.
file-open (word "output-" track-iterations ".csv") ;; Creates a file or opens a file named output-#.csv.
file-type month file-type "," file-type calendar-counter file-type "\n" ;; Space holds the Month and Day for merging using Pandas in Python.
file-close-all ;; Closes all open files.
ifelse vaccinated? ;; Checks to see if the turtle within contact range is vaccinated.
[
ifelse random 100 >= vaccine-effectiveness ;; If the child within contact range is vaccinated, this equation represents the chance of acquiring infection upon contact.
[
ask neighbors4 [set pcolor red + 2 ] ;; Turns 4 of the patches surrounding the turtle a light shade of red if a symptomatic infection causes a symptomatic infection.
symptomatic ;; If the equation tests true, then the turtle within contact range gets infected.
set cause-symptomatic cause-symptomatic + 1 ;; Adds 1 to the count of symptomatic infections caused by symptomatic carriers.
set diagnosed-case-vaccinated diagnosed-case-vaccinated + 1 ;; Adds 1 to the diagnosed cases of vaccinated individuals.
]
[
if asymptomatic-carriers? ;; The program checks to see if asymptomatic-carriers are turned on prior to allowing.
[
ask neighbors4 [ set pcolor red + 2 ] ;; Turns 4 of the patches surrounding the turtle a light shade of red if a symptomatic infection causes a asymptomatic infection.
asymptomatic ;; If the equation tests false, then the turtle within contact range becomes an asymptomatic carrier if awareness fails.
]
]
]
[
ask neighbors4 [ set pcolor red + 2 ] ;; Turns 4 of the patches surround the turtle a light shade of red.
symptomatic ;; If the turtle within contact range is not vaccinated then they get infected.
set cause-symptomatic cause-symptomatic + 1 ;; Adds 1 to the count of symptomatic infections caused by symptomatic carriers.
]
set diagnosed-case-unvaccinated diagnosed-case-unvaccinated + 1 ;; Adds 1 to the diagnosed cases of unvaccinated individuals
]
]
]
]
]
]
end
;;; ASYMPTOMATIC INFECT COMMANDS ;;;
to asymptomatic-infect ;; The procedure for an infected or carrier turtle to infect other turtles
ask other turtles in-radius 1 ;; Checks for turtles within a contact range radius of 2 patches
[
if patch-type = "house" or patch-type = "school" or patch-type = "daycare" or patch-type = "workspace" ;; Can only get infected in buildings.
[
ifelse natural-immunity?
[ ] ;; Nothing happens if Natural-Immunity? True
[
ifelse bacteria? ;; Tests if the bacteria in the child is true or false
[ ] ;; If the turtle within contact range already has bacteria, then nothing happens.
[
ifelse asymptomatic-bacteria? ;; Check to see if the turtle within contact range is an asymptomatic carrier of pertussis bacteria.
[ ] ;; If the turtle within contact range is an asymptomatic-carrier then nothing happens.
[
if random 125 >= awareness-factor * awareness-strength ;; Tests against awareness factor with a 25% less chance of prevailing because the person is not aware of the asymptomatic carrier.
[
set asymptomatic-challenge-count asymptomatic-challenge-count + 1 ;; Adds 1 to the asymptomatic-challenge-count tracker.
file-open (word "./CSV-Iteration-" track-iterations "/" "asymptomatic-challenge-" track-iterations ".csv") ;; Creates a file or opens a file named asymptomatic-challenge-#.csv
file-type month file-type "," file-type calendar-counter file-type "," file-type "1" file-type "\n" ;; Adds relevant information to the month, day, and a 1 to indicate an additional challenge by an asymptomatic carrier.
file-close-all ;; Closes all open files.
file-open (word "output-" track-iterations ".csv") ;; Creates a file or opens a file named output-#.csv.
file-type month file-type "," file-type calendar-counter file-type "\n" ;; Space holds the Month and Day for merging using Pandas in Python.
file-close-all ;; Closes all open files.
ifelse vaccinated? ;; Checks to see if the turtle within contact range is vaccinated.
[
ifelse random 100 >= vaccine-effectiveness ;; If the child within contact range is vaccinated, this equation represents the chance of acquiring infection upon contact.
[
ask neighbors4 [set pcolor blue + 2 ] ;; Turns 4 of the patches surrounding the turtle light blue.
symptomatic ;; If the equation tests true, then the turtle within contact range gets infected.
set cause-asymptomatic cause-asymptomatic + 1 ;; Adds 1 to the count of symptomatic infections caused by symptomatic carriers.
set diagnosed-case-vaccinated diagnosed-case-vaccinated + 1 ;; Adds 1 to the diagnosed cases of vaccinated individuals.
]
[
if asymptomatic-carriers? ;; The program checks to see if asymptomatic-carriers are turned on prior to allowing them to infect.
[
ask neighbors4 [ set pcolor blue + 2 ] ;; Turns 4 of the patches surrounding the turtle light blue.
asymptomatic ;; If the equation tests false, then the turtle within contact range becomes an asymptomatic carrier.
]
]
]
[ if random 125 >= awareness-factor ;; Tests against the increased risk awareness-factor scale.
[
ask neighbors4 [ set pcolor blue + 2 ] ;; Turns 4 of the patches surrounding the turtle light blue.
symptomatic ;; If the turtle within contact range is not vaccinated then they get infected.
set cause-asymptomatic cause-asymptomatic + 1 ] ;; Adds 1 to the count of symptomatic infections caused by symptomatic carriers.
set diagnosed-case-unvaccinated diagnosed-case-unvaccinated + 1 ;; Adds 1 to the diagnosed cases of unvaccinated individuals.
]
]
]
]
]
]
]
end
;;; SYMPTOMATIC COMMANDS ;;;
to symptomatic ;; The symptomatic commands.
set when-infected ticks ;; Tracks the tick count when infection occured.
set track-symptomatic track-symptomatic + 1 ;; Tracks the symptomatic carriers.
file-open (word "./CSV-Iteration-" track-iterations "/" "track-symptomatic-" track-iterations ".csv") ;; Creates a file or opens a file named track-symptomatic-#.csv
file-type month file-type "," file-type calendar-counter file-type "," file-type "1" file-type "\n" ;; Adds relevant information to the month, day, and a 1 to indicate an additional infection.
file-close-all ;; Closes all open files.
file-open (word "output-" track-iterations ".csv") ;; Creates a file or opens a file named output-#.csv.
file-type month file-type "," file-type calendar-counter file-type "\n" ;; Space holds the Month and Day for merging using Pandas in Python.
file-close-all
set symptomatic-counter symptomatic-counter + 1 ;; Tallies the cumulative number of symptomatic carriers per each iteration.
set total-counter total-counter + 1 ;; Adds up the Total infections that have occured symptomatic and asymptomatic. (These do not subtract 1 when cured.)
set bacteria? true ;; The turtle now has Pertussis bacteria.
set incubation random (8 * 24 * 60) + (7 * 24 * 60) ;; random 7:14 days.
set catarrhal random (8 * 24 * 60) + (7 * 24 * 60) + incubation ;; random 7:14 days after incubation.
set paroxysmal random (15 * 24 * 60) + (14 * 24 * 60) + catarrhal ;; random 14:28 days after catarrhal.
set convalescent random (15 * 24 * 60) + (7 * 24 * 60) + paroxysmal ;; random 7:21 days after paroxysmal.
set phase-tracker 1 ;; Sets the Phase Tracker for specific turtle to begin disease stages
set infected infected + 1 ;; Adds 1 to the infected count.
incubation-phase ;; Initiates the incubation-phase commands.
end
;;; ASYMPTOMATIC COMMANDS ;;;
to asymptomatic ;; The asymptomatic commands.
set when-infected ticks ;; Tracks the tick count when infection occured.
set track-asymptomatic track-asymptomatic + 1 ;; Tracks the asymptomatic carriers.
file-open (word "./CSV-Iteration-" track-iterations "/" "track-asymptomatic-" track-iterations ".csv") ;; Creates a file or opens a file named track-asymptomatic-#.csv
file-type month file-type "," file-type calendar-counter file-type "," file-type "1" file-type "\n" ;; Adds relevant information to the month, day, and a 1 to indicate an additional infection.
file-close-all ;; Closes all open files.
file-open (word "output-" track-iterations ".csv") ;; Creates a file or opens a file named output-#.csv.
file-type month file-type "," file-type calendar-counter file-type "\n" ;; Space holds the Month and Day for merging using Pandas in Python.
file-close-all
set asymptomatic-counter asymptomatic-counter + 1 ;; Tallies the cumulative number of asymptomatic carriers per each iteration.
set total-counter total-counter + 1 ;; Adds up the Total infections that have occured symptomatic and asymptomatic. (These do not subtract 1 when cured.)
set asymptomatic-bacteria? true ;; The turtle now has Pertussis bacteria.
set incubation random (8 * 24 * 60) + (7 * 24 * 60) ;; random 7:14 days.
set catarrhal random (8 * 24 * 60) + (7 * 24 * 60) + incubation ;; random 7:14 days after incubation.
set paroxysmal random (15 * 24 * 60) + (14 * 24 * 60) + catarrhal ;; random 14:28 days after catarrhal.
set convalescent random (15 * 24 * 60) + (7 * 24 * 60) + paroxysmal ;; random 7:21 days after paroxysmal.
set phase-tracker 1 ;; Sets the Phase Tracker for specific turtle to begin disease stages
incubation-phase ;; Initiates the incubation commands.
set infected infected + 1
end
;;; INCUBATION-PHASE COMMANDS ;;;
to incubation-phase ;; The incubation-phase commands.
set phase-tracker phase-tracker + 1 ;; Adds 1 to phase tracker (progresses infected through incubation phase).
ifelse bacteria? ;; Checks to see if agent is symptomatic.
[ set color red ] ;; Sets the color to red to signify symptomatic incubation phase.
[ set color blue ] ;; Sets the color to blue to signify asymptomatic incubation phase.
end
;;; CATARRHAL-PHASE COMMANDS ;;;
to catarrhal-phase ;; The catarrhal-phase commands.
set phase-tracker phase-tracker + 1 ;; Adds 1 to phase tracker (progresses infected through catarrhal phase).
ifelse bacteria? ;; Checks to see if agent is symptomatic.
[
set color red - 1 ;; Sets the color to red + 1 to signify symptomatic catarrhal phase.
if antibiotics? ;; Checks to see if antibiotics are turned on.
[
if 1 > random (14 * 24 * 60) ;; Chance of taking antibiotics once every 14 days
[
take-antibiotics ;; Runs the command for agents to transmit pertussis bacteria.
]
]
ifelse temperature? ;; Checks to see if the temperature variable is turned on.
[
set adjusted-sneezes-per-day (sneezes-per-day / (daily-temperature / 100)) ;; Sets the adjusted sneezes per day to account for temperature.
set adjusted-coughs-per-day (coughs-per-day / (daily-temperature / 100)) ;; Sets te adjusted coughs per day to account for temperature.
if (adjusted-sneezes-per-day + adjusted-coughs-per-day) > random (24 * 60) ;; Chance of symptomatic person infecting another by adjusted-sneezes-per-day in every 24 hours.
[
symptomatic-infect ;; Runs the command for agents to transmit pertussis bacteria.
]
]
[
if (sneezes-per-day + coughs-per-day) > random (24 * 60) ;; Chance of symptomatic person infecting another by sneezes-per-day in every 24 hours.
[
symptomatic-infect ;; Runs the command for agents to transmit pertussis bacteria.
]
]
]
[
set color blue - 1 ;; Sets the color to blue - 1 to signify asymptomatic catarrhal phase.
if ((sneezes-per-day + coughs-per-day)) > random (24 * 60) ;; Chance of asymptomatic person infecting another by sneezes-per-day in every 24 hours.
[
asymptomatic-infect ;; Runs the same command for asymptomatic agents to transmit bacteria.
]
]
end
;;; PAROXYSMAL-PHASE COMMANDS ;;;
to paroxysmal-phase ;; The paroxysmal-phase commands.
set phase-tracker phase-tracker + 1 ;; Adds 1 to phase tracker (progresses infected through catarrhal phase).
ifelse bacteria? ;; Checks to see if agent is symptomatic.
[
set color red - 2 ;; Sets the color to red + 1 to signify symptomatic catarrhal phase.
if antibiotics? ;; Checks to see if antibiotics are turned on.
[
if 1 > random (7 * 24 * 60) ;; Chance of taking Antibiotics once every 7 days
[
take-antibiotics ;; Runs the command for agents to transmit pertussis bacteria.
if phase-tracker >= (7 * 24 * 60) + catarrhal
[
set symptom-onset-counter symptom-onset-counter + 1 ;; Adds 1 to the symptom-onset-counter to be plotted.
type "\n" type "Potential Confirmed or Probable Case" ;; Header for Potential or Confirmed Diagnosis
type "\n" type "Age: " type age ;; Tracks the Age of the case.
type "\n" type "Day of Symptom Onset: " type year type " " type month type " " type (days - 14) ;; Produces the Month of diagnosis and the gregorian calendar day of the year 14 days prior to diagnosis.
ifelse breed = children ;; Checks to see if the agent is a child.
[
file-open (word "./CSV-Iteration-" track-iterations "/" "children-symptomatic-onset-" track-iterations ".csv") ;; Creates a file or opens a file named children-symptomatic-onset-#.csv.
file-type month file-type "," file-type calendar-counter file-type "," file-type "1" file-type "\n" ;; Adds relevant information to the month, day, and a 1 to indicate an additional symptom onset for the epidemic curve.
file-close-all ;; Closes all open files.
file-open (word "output-" track-iterations ".csv") ;; Creates a file or opens a file named output-#.csv.
file-type month file-type "," file-type calendar-counter file-type "\n" ;; Space holds the Month and Day for merging using Pandas in Python.
file-close-all
]
[
ifelse breed = daycareworkers ;; Checks to see if the agent is a daycareworker.
[
file-open (word "./CSV-Iteration-" track-iterations "/" "daycareworkers-symptomatic-onset-" track-iterations ".csv") ;; Creates a file or opens a file named daycareworkers-symptomatic-onset-#.csv.
file-type month file-type "," file-type calendar-counter file-type "," file-type "1" file-type "\n" ;; Adds relevant information to the month, day, and a 1 to indicate an additional symptom onset for the epidemic curve.
file-close-all ;; Closes all open files.
file-open (word "output-" track-iterations ".csv") ;; Creates a file or opens a file named output-#.csv.
file-type month file-type "," file-type calendar-counter file-type "\n" ;; Space holds the Month and Day for merging using Pandas in Python.
file-close-all
]
[
file-open (word "../CSV-Iteration-" track-iterations "/" "family-symptomatic-onset-" track-iterations ".csv") ;; Creates a file or opens a file named family-symptomatic-onset-#.csv.
file-type month file-type "," file-type calendar-counter file-type "," file-type "1" file-type "\n" ;; Adds relevant information to the month, day, and a 1 to indicate an additional symptom onset for the epidemic curve.
file-close-all ;; Closes all open files.
file-open (word "output-" track-iterations ".csv") ;; Creates a file or opens a file named output-#.csv.
file-type month file-type "," file-type calendar-counter file-type "\n" ;; Space holds the Month and Day for merging using Pandas in Python.
file-close-all
]
]
]
]
]
ifelse temperature? ;; Checks to see if the temperature variable is turned on.
[
set adjusted-sneezes-per-day (sneezes-per-day / (daily-temperature / 100)) ;; Sets the adjusted sneezes per day to account for temperature.
set adjusted-coughs-per-day (coughs-per-day / (daily-temperature / 100)) ;; Sets te adjusted coughs per day to account for temperature.
if ((adjusted-sneezes-per-day + adjusted-coughs-per-day) * 2) > random (24 * 60) ;; Chance of symptomatic person infecting another by adjusted-sneezes-per-day in every 24 hours.
[
symptomatic-infect ;; Runs the command for agents to transmit pertussis bacteria.
]
]
[
if ((sneezes-per-day + coughs-per-day) * 2) > random (24 * 60) ;; Chance of symptomatic person infecting another by sneezes-per-day in every 24 hours.
[
symptomatic-infect ;; Runs the command for agents to transmit pertussis bacteria.
]
]
]
[
set color blue - 2
if (sneezes-per-day + coughs-per-day) > random (24 * 60) ;; Chance of asymptomatic person infecting another by sneezes-per-day in every 24 hours.
[
asymptomatic-infect ;; Runs the same command for asymptomatic agents to transmit bacteria.
]
]
end
;;; CONVALESCENT-PHASE COMMANDS ;;;
to convalescent-phase ;; The convalescent-phase commands.
set phase-tracker phase-tracker + 1 ;; Adds 1 to phase tracker (progresses infected through convalescent phase).
ifelse bacteria?
[ set color red - 3 ] ;; Sets the color to red + 3 to signify symptomatic convalescent phase.
[ set color blue - 3 ] ;; Sets the color to blue - 3 to signify asymptomatic convalescent phase.
end
to take-antibiotics
set track-antibiotics track-antibiotics + 1 ;; Tracks the use of antibiotics to cure symptomatic carriers.
file-open (word "./CSV-Iteration-" track-iterations "/" "antibiotics-" track-iterations ".csv") ;; Creates a file or opens a file named antibiotics-#.csv
file-type month file-type "," file-type calendar-counter file-type "," file-type "1" file-type "\n" ;; Adds relevant information to the month, day, and a 1 to indicate an additional infection.
file-close-all ;; Closes all open files.
file-open (word "output-" track-iterations ".csv") ;; Creates a file or opens a file named output-#.csv.
file-type month file-type "," file-type calendar-counter file-type "\n" ;; Space holds the Month and Day for merging using Pandas in Python.
file-close-all
set phase-tracker (convalescent - (60 * 24 * antibiotics-days-to-recovery)) ;; Agent immediately progresses rapidly to recovery phase, after user set days of antibiotics no longer contagious.
set stay-home? true ;; Symptomatic agents stay home if they know they are symptomatic.
end
;;; RECOVER COMMANDS ;;;
to recover ;; The recover commands.
set phase-tracker 0 ;; Resets the phase-tracker.
if bacteria? ;; Checks to see if the agent is symptomatic.
[ set track-symptomatic track-symptomatic - 1 ] ;; Updates the symptomatic tracker to show that an agent has recovered.
if asymptomatic-bacteria? ;; Checks to see if the agent is asymptomatic.
[ set track-asymptomatic track-asymptomatic - 1 ] ;; Updates the asymptomatic tracker to show that an agent has recovered.
set bacteria? false ;; Removes the bacteria.
set asymptomatic-bacteria? false ;; Removed the bacteria from asymptomatic carriers.
set color green ;; Sets the color to green to signify health.
set natural-immunity? true ;; Those who have recovered will not be re-infected or become carriers.
set stay-home? false ;; Agents no longer need to stay at home (if they were) when they have recovered.
end
;;; "PRINT-RESULTS" COMMANDS ;;;
to print-results ;; Commands for present-results button being pushed.
type "\n" type "Total Count: " type total-counter ;; Prints the total count of Pertussis cases.
type "\n" type "Count Symptomatic: " type symptomatic-counter ;; Prints the count of symptomatic cases.
type "\n" type "Count Asymptomatic: " type asymptomatic-counter ;; Prints the count of asymptomatic cases.
type "\n" type "% Symptomatic: " type (symptomatic-counter / total-counter) ;; Prints the % of Symptomatic carriers.
type "\n" type "% Asymptomatic: " type (asymptomatic-counter / total-counter) ;; Prints the % of Asymptomatic carriers.
end
to go ;; Happens when the "go" button is pressed or "go" command is issued.
if not any? turtles with [ bacteria? ] and not any? turtles with [ asymptomatic-bacteria? ] OR days = 239 ;; Recognizes when there is no longer a possibility for infection.
[
type "\n" type "Total Count: " type total-counter
type "\n" type "Count Symptomatic: " type symptomatic-counter
type "\n" type "Count Asymptomatic: " type asymptomatic-counter
type "\n" type "% Symptomatic: " type (symptomatic-counter / total-counter)
pathdir:create (word "Results-Iteration-" track-iterations) ;; Creates a folder to contain CSV files created for each iteration.
export-world (word "/Results-Iteration-" track-iterations "/" word "results" track-iterations ".csv") ;; Exports all variables to a csv file.
export-view (word "/Results-Iteration-" track-iterations "/" word "view" track-iterations ".png") ;; Exports the image of the final Pertussis model.
setup ;; Runs the setup
]
ask children ;; Tasks for the children
[
ifelse stay-home? ;; Checks to see if the agent knows they are symptomatic.
[ stay-at-home ] ;; Runs the commands to stay-at-home
[
move-children ;; Runs the command for childrens movement.
]
if 1 <= phase-tracker and phase-tracker <= incubation [ incubation-phase ] ;; Runs incubation-phase commands until phase-tracker > turtles unique incubation period.
if incubation < phase-tracker and phase-tracker <= catarrhal [ catarrhal-phase ] ;; Runs catarrhal-phase commands until phase-tracker > turtles unique catarrhal period.
if catarrhal < phase-tracker and phase-tracker <= paroxysmal [ paroxysmal-phase ] ;; Runs paroxysmal-phase commands until phase-tracker > turtles unique paroxysmal period.
if paroxysmal < phase-tracker and phase-tracker <= convalescent [ convalescent-phase ] ;; Runs convalescent-phase commands until phase-tracker > turtles unique convalescent period.
if convalescent < phase-tracker [ recover ] ;; Runs recover command if phase-tracker complete.
]
ask parents ;; Tasks for the Parents
[
ifelse stay-home? ;; Checks to see if the agent knows they are symptomatic.
[ stay-at-home ] ;; Runs the commands to stay-at-home
[
move-parents ;; Runs the command for parents movement.
]
if 1 <= phase-tracker and phase-tracker <= incubation [ incubation-phase ] ;; Runs incubation-phase commands until phase-tracker > turtles unique incubation period.
if incubation < phase-tracker and phase-tracker <= catarrhal [ catarrhal-phase ] ;; Runs catarrhal-phase commands until phase-tracker > turtles unique catarrhal period.
if catarrhal < phase-tracker and phase-tracker <= paroxysmal [ paroxysmal-phase ] ;; Runs paroxysmal-phase commands until phase-tracker > turtles unique paroxysmal period.
if paroxysmal < phase-tracker and phase-tracker <= convalescent [ convalescent-phase ] ;; Runs convalescent-phase commands until phase-tracker > turtles unique convalescent period.
if convalescent < phase-tracker [ recover ] ;; Runs recover command if phase-tracker complete.
]
ask siblings ;; Tasks for the Parents
[
ifelse stay-home? ;; Checks to see if the agent knows they are symptomatic.
[ stay-at-home ] ;; Runs the commands to stay-at-home
[
move-siblings ;; Runs the command for siblings movement.
]
if 1 <= phase-tracker and phase-tracker <= incubation [ incubation-phase ] ;; Runs incubation-phase commands until phase-tracker > turtles unique incubation period.
if incubation < phase-tracker and phase-tracker <= catarrhal [ catarrhal-phase ] ;; Runs catarrhal-phase commands until phase-tracker > turtles unique catarrhal period.
if catarrhal < phase-tracker and phase-tracker <= paroxysmal [ paroxysmal-phase ] ;; Runs paroxysmal-phase commands until phase-tracker > turtles unique paroxysmal period.
if paroxysmal < phase-tracker and phase-tracker <= convalescent [ convalescent-phase ] ;; Runs convalescent-phase commands until phase-tracker > turtles unique convalescent period.
if convalescent < phase-tracker [ recover ] ;; Runs recover command if phase-tracker complete.
]
ask daycareworkers ;; Tasks for the Parents
[
ifelse stay-home? ;; Checks to see if the agent knows they are symptomatic.
[ stay-at-home ] ;; Runs the commands to stay-at-home
[
move-daycareworkers ;; Runs the command for daycare workers movement.
]
if 1 <= phase-tracker and phase-tracker <= incubation [ incubation-phase ] ;; Runs incubation-phase commands until phase-tracker > turtles unique incubation period.
if incubation < phase-tracker and phase-tracker <= catarrhal [ catarrhal-phase ] ;; Runs catarrhal-phase commands until phase-tracker > turtles unique catarrhal period.
if catarrhal < phase-tracker and phase-tracker <= paroxysmal [ paroxysmal-phase ] ;; Runs paroxysmal-phase commands until phase-tracker > turtles unique paroxysmal period.
if paroxysmal < phase-tracker and phase-tracker <= convalescent [ convalescent-phase ] ;; Runs convalescent-phase commands until phase-tracker > turtles unique convalescent period.
if convalescent < phase-tracker [ recover ] ;; Runs recover command if phase-tracker complete.
]
; update-tracking-info ;; Runs update-tracking-info commands.
tick ;; A single-tick is counted.
;;; CLOCK COMMANDS ;;;
clear-output ;; Clears the Output each time to be written over by the changing clock/calendar.
set minutes minutes + 1 ;; 1 Minute is accumulated to the clock per every tick.
if minutes = 60 ;; Commands for when minutes reach 60.
[
set hours hours + 1 ;; 1 Hour is accumulated per 60 minutes.
set minutes 0 ;; Minutes are reset to 0 minutes.
]
if hours = 24 ;; Commands for 24 hours.
[
set days days + 1 ;; 1 Day is accumulated per 24 hours.
set hours 0 ;; Hours are reset to 0 hours.
set daily-temperature (average-temperature + random 10 - random 10) ;; Sets the temperature +/- 10 degrees
set calendar-counter calendar-counter + 1 ;; 1 Calendar-Counter day progresses for the calendar per day.
file-open (word "./CSV-Iteration-" track-iterations "/" "daily-temperature-" track-iterations ".csv") ;; Creates a file or opens a file named daily-temperature-#.csv
file-type month file-type "," file-type calendar-counter file-type "," file-type daily-temperature file-type "\n" ;; Adds relevant information to the month, day, and temperature.
file-close-all ;; Closes open files.
if calendar-counter >= 28 ;; On or after the 28th of the month, the following commands run.
[
calendar-commands ;; Runs Calendar Commands (For changing the month on the 28th, 29th, 30th or 31st.).
]
set day-of-week day-of-week + 1
if day-of-week > 7
[ set day-of-week 1 ]
holidays ;; Commands for determining holidays.
ifelse day-of-week = 1 ;; Checks to see if output day is the numerical day for Monday.
[ set output-day "Monday" ] ;; Sets the output day to Monday.
[ ifelse day-of-week = 2 ;; Checks to see if output day is the numerical day for Tuesday.
[ set output-day "Tuesday" ] ;; Sets the output day to Tuesday.
[ ifelse day-of-week = 3 ;; Checks to see if output day is the numerical day for Wednesday.
[ set output-day "Wednesday" ] ;; Sets the output day to Wednesday.
[ ifelse day-of-week = 4 ;; Checks to see if output day is the numerical day for Thursday.
[ set output-day "Thursday" ] ;; Sets the output day to Thursday.
[ ifelse day-of-week = 5 ;; Checks to see if output day is the numerical day for Friday.
[ set output-day "Friday" ] ;; Sets the output day to Friday.
[ ifelse day-of-week = 6 ;; Checks to see if output day is the numerical day for Saturday.
[ set output-day "Saturday" ] ;; Sets the output day to Saturday.
[ if day-of-week = 7 ;; Checks to see if output day is the numerical day for Sunday.
[ set output-day "Sunday" ] ;; Sets the output day to Sunday.
] ] ] ] ] ] ;; Closes out 6 ifelse queries above.
ask turtles
[
set age age + (1 / calendar-days) ;; Progresses the age of the turtles 1 day.
set awareness-factor age ;; A persons "awareness factor" is set according to their age. (Children are less aware than toddlers, who are less aware than teenagers, etc.)
]
if waning-immunity? ;; Checks to see if waning immunity is turned on prior to commands.
[
ask turtles ;; Commands for turtles if waning immunity is turned on.
[
if age > (2 / 12) ;; Checks to see if turtles are at least 2 months old.
[
set vaccine-effectiveness (vaccine-effectiveness - (vaccine-effectiveness * waning-rate-annual * (1 / calendar-days))) ;; The effectiveness of the vaccine wanes at the rate set on the slider bar.
]
]
]
set rotate-daycare 1
while [ rotate-daycare <= initial-children / 12 ]
[
if any? daycareworkers with [ family-id = rotate-daycare ]
[
ask n-of 1 daycareworkers with [ family-id = rotate-daycare ]
[
set family-id family-id + 1
if family-id > initial-children / 12
[ set family-id 1 ]
set counter family-id
set destination min-one-of (patches with [daycare-id = counter]) [distance myself]
move-to destination
]
]
set rotate-daycare rotate-daycare + 1
]
]
output-type "dd : hh : mm " output-type daily-temperature output-type " f" ;; Overhead Clock Output shows the format the numbers are displayed in.
output-type "\n" if days < 10 [output-type "0"] output-type days output-type " : " if hours < 10 [ output-type "0" ] output-type hours output-type " : " if minutes < 10 [ output-type "0" ] output-type minutes ;; Types the Clock to the Output.
output-type "\n" output-type output-day ;; Types the day of the week.
output-type "\n" output-type month output-type " " output-type calendar-counter output-type ", " output-type year ;; Outputs the Month Day, Year.
end
;;; CALENDAR COMMANDS ;;;
to calendar-commands
ifelse month = "January" ;; Commands for the month of January.
[
set average-temperature january-avg-temp ;; Sets the average temperature to the January average that is set.
if calendar-counter > 31 ;; Commands if the calendar has progressed through 31 days of January.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "February" ] ;; The month becomes February.
]
[
ifelse month = "February" ;; Commands for the month of February.
[
set average-temperature february-avg-temp ;; Sets the average temperature to the February average that is set.
if calendar-counter > feb-leap-year ;; Commands if the calendar has progressed through 28 days of February except in leapyear it has 29.
[
set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "March" ] ;; The month becomes March.
]
[
ifelse month = "March" ;; Commands for the month of March.
[
set average-temperature march-avg-temp ;; Sets the average temperature to the March average that is set.
if calendar-counter > 31 ;; Commands if the calendar has progressed through 31 days of March.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "April" ] ;; The month becomes April.
]
[
ifelse month = "April" ;; Commands for the month of April.
[
set average-temperature april-avg-temp ;; Sets the average temperature to the April average that is set.
if calendar-counter > 30 ;; Commands if the calendar has progressed through 30 days of April.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "May" ] ;; The month becomes May.
]
[
ifelse month = "May"
[
set average-temperature may-avg-temp ;; Sets the average temperature to the May average that is set.
if calendar-counter > 31 ;; Commands if the calendar has progressed through 31 days of May.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "June" ] ;; The month becomes June.
]
[
ifelse month = "June"
[
set average-temperature june-avg-temp ;; Sets the average temperature to the June average that is set.
if calendar-counter > 30 ;; Commands if the calendar has progressed through 30 days of June.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "July" ] ;; The month becomes July.
]
[
ifelse month = "July"
[
set average-temperature july-avg-temp ;; Sets the average temperature to the July average that is set.
if calendar-counter = 31 ;; Commands if the calendar has progressed through 31 days of July.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "August" ] ;; The month becomes August.
]
[
ifelse month = "August"
[
set average-temperature august-avg-temp ;; Sets the average temperature to the August average that is set.
if calendar-counter > 31 ;; Commands if the calendar has progressed through 31 days of August.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "September" ] ;; The month becomes September.
]
[
ifelse month = "September"
[
set average-temperature september-avg-temp ;; Sets the average temperature to the September average that is set.
if calendar-counter > 30 ;; Commands if the calendar has progressed through 30 days of September.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "October" ] ;; The month becomes October.
]
[
ifelse month = "October"
[
set average-temperature october-avg-temp ;; Sets the average temperature to the October average that is set.
if calendar-counter > 31 ;; Commands if the calendar has progressed through 31 days of October.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "November" ] ;; The month becomes November.
]
[
ifelse month = "November"
[
set average-temperature november-avg-temp ;; Sets the average temperature to the November average that is set.
if calendar-counter > 30 ;; Commands if the calendar has progressed through 30 days of November.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set month "December" ] ;; The month becomes December.
]
[
if month = "December"
[
set average-temperature december-avg-temp ;; Sets the average temperature to the December average that is set.
if calendar-counter > 31 ;; Commands if the calendar has progressed through 31 days of October.
[ set calendar-counter 1 ;; Resets the calendar counter to 1 just prior to changing months.
set year year + 1
ifelse year = 2028 OR year = 2024 OR year = 2020 OR year = 2016 OR year = 2012 OR year = 2008 OR year = 2004 OR year = 2000 ;; Checks to see if it is a leap year.
[
set calendar-days 366 ;; If it is a leap year calendar-days are set to 366 for aging.
set feb-leap-year 29 ;; If it is a leap year there are 29 days.
]
[
set calendar-days 365 ;; If it is not a leap year calendar-days are set to 365 for aging.
set feb-leap-year 28 ;; If it is not a leap year there are 28 days.
]
set month "January" ] ;; The month becomes January.
] ] ] ] ] ] ] ] ] ] ] ] ;; Closes 11 ifelse queries and 1 if query.
end
;;; MOVE-CHILDREN COMMANDS ;;;
to stay-at-home ;; Contains the commands for staying at home.
ifelse type-of-agent > 3
[
set destination patch 0 50
move-to destination
]
[
set counter family-id ;; Copies value of turtle-owned family-id to global variable counter.
set destination min-one-of (patches with [house-id = counter]) [distance myself]
move-to destination
]
end
to move-children ;; Contains the commands for children movement.
set counter family-id ;; Copies value of turtle-owned family-id to global variable counter.
ifelse holiday? ;; Asks if it is a holiday.
[
rt random 90 ;; Parent has 180 degrees of potential direction.
lt random 90
ifelse [house-id] of patch-ahead 1 = family-id ;; Checks to make sure the patch in the direction the parent is facing is the house.
[ fd 1 ] ;; Moves forward if true.
[ ] ;; Does nothing if false.
awareness-avoidance ;; Runs awareness-avoidance commands.
]
[
ifelse day-of-week < 6 ;; These commands occur Monday through Friday.
[
if (6 <= hours and hours < 7 and house-id = counter) ;; Child wakes-up, if at house can move around until 6:59am.
[
rt random 360 ;; The child turns in a random direction.
ifelse [house-id] of patch-ahead 1 = family-id ;; Checks to see if the patch ahead of the child belongs to the house the child lives in.
[ fd 1 ] ;; Moves forward 1 in any random direction if it is inside a building
[ ] ;; Child stays in place if test is false.
awareness-avoidance ;; Runs awareness-avoidance commands.
]
if (7 = hours and 0 = minutes) ;; Child's directions replicate care-giver (simulates going with parent) at 7am.
[
set destination min-one-of (patches with [transportation-dh = counter]) [distance myself] ;; Child goes to teh beginning of their Daycare to home transportation route.
move-to destination ;; Places child at destination.
set heading 0 ;; Sets children heading along path.
]
if (7 = hours and (transportation-dh = counter)) ;; Transportation directions children to go with care-giver parents until 8:00am.
[
ifelse [transportation-dh] of patch-ahead 2 = counter ;; Checks to see if child can travel maximum distance of 2 space in 1 tick and stay on it's transportation network.
[ fd 2 ] ;; If child can, it travels 2 spaces.
[ ifelse [transportation-dh] of patch-ahead 1 = counter ;; Checks to see if child can travel 1 space in 1 tick and stay on it's transportation network.
[ fd 1 ] ;; If child can, it travels 1 space.
[ ifelse [patch-type] of patch-ahead 1 = "daycare" ;; Checks to see if daycare is 1 space ahead.
[ fd 1 ] ;; If yes, child travels 1 space ahead into the daycare.
[ set heading 270 ] ;; If not, the child turns to 270 degrees (facing the daycare).
]
]
]
if (7 <= hours and hours <= 16 and patch-type = "daycare") ;; Direction for children who have arrived at daycare.
[
rt random 360 ;; The child turns in a random direction.
ifelse [patch-type] of patch-ahead 1 = "daycare" ;; Checks to see if the patch ahead of the child belongs to the child.
[ fd 1 ] ;; Child moves forward one patch if test is true.
[ ] ;; Child stays in place if test is false.
awareness-avoidance ;; Runs awareness avoidance commands.
]
if (hours = 16 and minutes = 58) ;; Directions for children when they get to get ready to leave daycare at 4:58p.
[
set destination min-one-of (patches with [transportation-dh = counter]) [distance myself]
move-to destination
set heading 180
ifelse [transportation-dh] of patch-ahead 1 = counter
[ fd 2 ]
[ ]
]
if (17 <= hours and hours <= 18 and (transportation-dh = counter) and any? parents-here) ;; Directions for children to go with parent home.
[
move-to min-one-of (patches with [house-id = counter]) [distance myself]
set heading 180
]
if (17 <= hours and hours < 20 and (house-id = family-id)) ;; Direction for children who have arrived at home.
[
rt random 360
ifelse [house-id] of patch-ahead 1 = family-id
[ fd 1 ]
[ ]
awareness-avoidance ;; Runs awareness-avoidance commands.
]
; if (21 < hours or hours <= 5 and (house-id = family-id)) ;; Place-holder for bedtime hours at home (FUTURE: ER visits?.)
; [ ]
]
[ ;; These commands occur Saturday and Sunday.
if (6 <= hours and hours <= 2000 and house-id = counter) ;; Child wakes-up, if at house can move around until 10:00pm.
[
rt random 360 ;; The child turns in a random direction.
ifelse [house-id] of patch-ahead 1 = family-id ;; Checks to see if the patch ahead of the child belongs to the house the child lives in.
[ fd 1 ] ;; Moves forward 1 in any random direction if it is inside a building
[ ] ;; Child stays in place if test is false.
]
]
]
end
;;; MOVE-PARENTS COMMANDS ;;;
to move-parents ;; Contains the commands for parents movement.
set counter family-id ;; Copies value of turtle-owned family-id to global variable counter.
set work-counter workspace-ncg ;; Copies value of turtle-owned workspace-ncg to global variable counter.
ifelse holiday? ;; Asks if it is a holiday.
[
rt random 90 ;; Parent has 180 degrees of potential direction.
lt random 90
ifelse [house-id] of patch-ahead 1 = family-id ;; Checks to make sure the patch in the direction the parent is facing is the house.
[ fd 1 ] ;; Moves forward if true.
[ ] ;; Does nothing if false.
awareness-avoidance ;; Runs awareness-avoidance commands.
]
[
ifelse day-of-week < 6 ;; These commands occur Monday through Friday.
[
if (6 <= hours and hours < 7 and house-id = counter and care-giver?) ;; Parent care-giver wakes-up, if at house can move around until 6:59am.
[
rt random 90
lt random 90
ifelse [house-id] of patch-ahead 1 = family-id
[ fd 1 ]
[ ]
awareness-avoidance ;; Runs awareness-avoidance commands.
]
if (6 <= hours and hours < 9 and house-id = counter and not care-giver?) ;; Non-caregiver parent wakes-up, if at house can move around until 8:59am.
[
rt random 90
lt random 90
ifelse [house-id] of patch-ahead 1 = counter
[ fd 1 ]
[ ]
awareness-avoidance ;; Runs awareness-avoidance commands.
]
if (7 = hours and 0 = minutes and care-giver?) ;; Directions for parents at 7am.
[
set destination min-one-of (patches with [transportation-dh = counter]) [distance myself]
move-to destination ;; Places parent at destination.
set heading 0 ;; Sets parents heading along path.
]
if (7 <= hours and hours <= 8 and (transportation-dh = counter) and care-giver?) ;; Transportation directions for care-giver parents until 8:00am.
[
ifelse [transportation-dh] of patch-ahead 2 = counter ;; All parents arrive at work between 7:04am and 8:54 am.
[ fd 2 ]
[ ifelse [transportation-dh] of patch-ahead 1 = counter
[ fd 1 ]
[ ifelse [patch-type] of patch-ahead 1 = "daycare"
[ fd 1 ]
[ set heading 270 ]
]
]
]
if (7 <= hours and hours <= 8 and patch-type = "daycare" and care-giver? and not (workspace-id = counter)) ;; Transportation directions for care-giver parents after arrival at daycare until 8:00am.
[
set destination min-one-of (patches with [transportation-wd = counter]) [distance myself]
move-to destination
set heading 90
]
if (8 >= hours and care-giver? and transportation-wd = counter) ;; Direction for care-giver parents until 8:00am, not in a building or on other road.
[
ifelse [transportation-wd] of patch-ahead 2 = counter ;; All parents arrive at daycare between 7:02am and 7:55 am.
[ fd 2 ]
[ ifelse [transportation-wd] of patch-ahead 1 = counter
[ fd 1 ]
[ ifelse [patch-type] of patch-ahead 1 = "workspace"
[ fd 1 ]
[ set heading 0 ]
]
]
]
if (8 = hours and 59 = minutes and not care-giver?) ;; Directions for non-care-giver parents to go to work at 8:59am.
[
set destination min-one-of (patches with [workspace-id = work-counter]) [distance myself]
move-to destination
set heading 0
]
if (7 <= hours and hours <= 16 and patch-type = "workspace") ;; Direction for parents who have arrived at work.
[
rt random 90
lt random 90
ifelse [patch-type] of patch-ahead 1 = "workspace"
[ fd 1 ]
[ ]
awareness-avoidance ;; Runs awareness-avoidance commands.
]
if (14 = hours and 59 = minutes and not care-giver?) ;; Directions for non-care-giver parents to go to home at 2:59pm.
[
set destination min-one-of (patches with [house-id = counter]) [distance myself]
move-to destination
set heading 0
]
if (16 = hours and minutes = 59 and care-giver?) ;; Directions for care-giver parents when they get to get ready to leave work at 4:59p.
[
set destination min-one-of (patches with [transportation-wd = counter]) [distance myself]
move-to destination
set heading 180
]
if (17 = hours and care-giver? and not (patch-type = "daycare") and not (transportation-dh = counter)) ;; Transportation directions for care-giver parents at 5pm
[
ifelse [transportation-wd] of patch-ahead 3 = counter
[ fd 3 ]
[ ifelse [transportation-wd] of patch-ahead 2 = counter ;; All parents arrive at daycare between 5:02pm and 5:42 pm.
[ fd 2 ]
[ ifelse [transportation-wd] of patch-ahead 1 = counter
[ fd 1 ]
[ ifelse [patch-type] of patch-ahead 1 = "daycare"
[ fd 1 ]
[ set heading 270 ]
]
]
]
]
if (17 = hours and (patch-type = "daycare") and care-giver? and not (house-id = family-id)) ;; Directions for care-giver parents when they get to daycare between 5pm and 5:59pm
[ set destination min-one-of (patches with [transportation-dh = counter]) [distance myself]
move-to destination
set heading 180
]
if (17 <= hours and hours <= 18 and (transportation-dh = counter) and care-giver?) ;; Direction for care-giver parents leaving daycare to go home.
[
ifelse [transportation-dh] of patch-ahead 2 = counter ;; All parents arrive at home between 5:04 pm and 6:36 pm.
[ fd 2 ]
[ ifelse [transportation-dh] of patch-ahead 1 = counter
[ fd 1 ]
[ ifelse [patch-type] of patch-ahead 1 = "house"
[ fd 1 ]
[ set heading 90
if [transportation-dh] of patch-ahead 1 != counter
[ set heading 180 ]
]
]
]
]
if (17 <= hours and hours <= 21 and (house-id = family-id)) ;; Direction for parents who have arrived at home.
[
rt random 90
lt random 90
ifelse [house-id] of patch-ahead 1 = family-id
[ fd 1 ]
[ ]
awareness-avoidance ;; Runs awareness-avoidance commands.
]
; if (21 < hours or hours <= 5 and (house-id = family-id)) ;; Place-holder for bedtime hours at home (FUTURE: ER visits?.)
; [ ]
]
[
if (6 <= hours and hours <= 22 and house-id = counter) ;; Parent wakes-up, if at house can move around until 10:00pm.
[
rt random 90 ;; Parent has 180 degrees of potential direction.
lt random 90
ifelse [house-id] of patch-ahead 1 = counter ;; Checks to make sure the patch in the direction the sibling is facing is the house.
[ fd 1 ] ;; Moves forward 1 patch if true.
[ ] ;; Does nothing if false.
awareness-avoidance ;; Runs awareness-avoidance commands.
]
]
]
end
;;; MOVE-SIBLINGS COMMANDS ;;;
to move-siblings ;; Contains the commands for parent movement.
set counter family-id ;; Copies value of turtle-owned family-id to global variable counter.
ifelse holiday? ;; Asks if it is a holiday.
[
rt random 90 ;; Parent has 180 degrees of potential direction.
lt random 90
ifelse [house-id] of patch-ahead 1 = family-id ;; Checks to make sure the patch in the direction the parent is facing is the house.
[ fd 1 ] ;; Moves forward if true.
[ ] ;; Does nothing if false.
awareness-avoidance ;; Runs awareness-avoidance commands.
]
[
ifelse day-of-week < 6 ;; These commands occur Monday through Friday.
[
if (6 <= hours and hours <= 7 and house-id = counter) ;; Sibling wakes-up, if at house can move around until 7:59am.
[
rt random 135 ;; Sibling has 270 degrees of potential direction.
lt random 135
ifelse [house-id] of patch-ahead 1 = counter ;; Checks to make sure the patch in the direction the sibling is facing is the house.
[ fd 1 ] ;; Moves forward 1 patch if true.
[ ] ;; Does nothing if false.
awareness-avoidance ;; Runs awareness-avoidance commands.
]
if (8 = hours and 00 = minutes) ;; Transportation directions for siblings at 7:59 am.
[
set destination min-one-of (patches with [transportation-hs = counter]) [distance myself]
move-to destination
set heading 180
]
if (8 = hours and (transportation-hs = counter)) ;; Directions for siblings to go to school at 8:00 am.
[
fd 1
]
if (8 <= hours and hours <= 14 and patch-type = "school") ;; Direction for siblings who have arrived at school.
[
rt random 135
lt random 135
ifelse [patch-type] of patch-ahead 1 = "school"
[ fd 1 ]
[ ]
awareness-avoidance ;; Runs awareness-avoidance commands.
]
if (15 = hours and 00 = minutes and not (patch-type = "house")) ;; Directions for siblings to get read to go home at 3:00 pm.
[
set destination min-one-of (patches with [transportation-hs = counter]) [distance myself]
move-to destination
set heading 0
]
if (15 = hours and 01 <= minutes and (transportation-hs = counter)) ;; Directions for siblings to leave school at 3:01 pm.
[
fd 1
]
if (17 <= hours and hours <= 21 and (house-id = family-id)) ;; Direction for parents who have arrived at home.
[
rt random 135
lt random 135
ifelse [house-id] of patch-ahead 1 = family-id
[ fd 1 ]
[ ]
awareness-avoidance ;; Runs awareness-avoidance commands.
]
; if (21 < hours or hours <= 5 and (house-id = family-id)) ;; Place-holder for bedtime hours at home (FUTURE: ER visits?.)
; [ ]
]
[
if (6 <= hours and hours <= 22 and house-id = counter) ;; Sibling wakes-up, if at house can move around until 10:00pm.
[
rt random 135 ;; Sibling has 270 degrees of potential direction.
lt random 135
ifelse [house-id] of patch-ahead 1 = counter ;; Checks to make sure the patch in the direction the sibling is facing is the house.
[ fd 1 ] ;; Moves forward 1 patch if true.
[ ] ;; Does nothing if false.
awareness-avoidance ;; Runs awareness-avoidance commands.
]
]
]
end
to move-daycareworkers
set counter family-id ;; Copies value of turtle-owned family-id to global variable counter.
ifelse day-of-week < 6 ;; These commands occur Monday through Friday.
[
if (7 <= hours and hours <= 18 and daycare-id = counter) ;; Daycare workers move around the daycare between 7am and 6pm.
[
rt random 90 ;; Daycare workers have 180 degrees of potential direction.
lt random 90
ifelse [daycare-id] of patch-ahead 1 = counter ;; Checks to make sure the patch in the direction the daycare worker is facing is the daycare.
[ fd 1 ] ;; Moves forward 1 patch if true.
[ ] ;; Does nothing if false.
awareness-avoidance ;; Runs awareness-avoidance commands.
if [daycare-id] of patch-here != counter ;; Checks to see if daycareworker is still on a daycare patch
[
set destination min-one-of (patches with [daycare-id = counter]) [distance myself]
move-to destination
]
]
]
[
awareness-avoidance ;; Runs awareness-avoidance commands.
]
end
to awareness-avoidance
ifelse awareness-factor >= random 100 ;; Checks to see if the child passes the awareness test.
[
set aware-turtle? true ;; The turtle is identifiable as the aware turtle.
ask min-one-of other turtles [distance myself] ;; Asks closest turtle...
[
if bacteria? ;; if the turtle has bacteria?
[
ask turtles in-radius 2 ;; Asks turtles who are in a radius of 2...
[
if aware-turtle? ;; If they are the aware turtle.
[
face min-one-of other turtles [distance myself] ;; Faces the aware tutle towards the nearest symptomatic carrier.
rt 180 ;; Then turns the aware turtle 180 degrees.
fd 1 ;; Aware turtle moves forward 1 patch away from the symptomatic carrier
]
]
]
]
set aware-turtle? false ;; Resets the aware turtle to false.
]
[ ] ;; Nothing happens if the child is unaware.
end
to infect-agent-zero
ask n-of 1 turtles ;; Selects 1 agent.
[
ifelse vaccinated? ;; Checks if the turtle is vaccinated.
[
ifelse asymptomatic-carriers? ;; Checks to see if asymptomatic carriers are turned on.
[
set diagnosed-case-vaccinated diagnosed-case-vaccinated + 1 ;; Adds 1 to the Vaccinated cases.
asymptomatic ;; Initiates the asymptomatic commands.
set agent-zero family-id ;; Sets the global-variable agent-zero to the family-id of the infected to document family members.
type "********** BEGINNING OF NEW ITERATION **********" type "\n" ;; Beginning of New Iteration Header.
type "Starting Agent" type "\n" ;; Types that this is the agent zero info in the command prompt. Skips a line afterward.
type "Age: " type age type "\n" ;; Types the age of the agent zero. Skips a line afterward.
print "Vaccinated" ;; Types that agent zero is vaccinated.
print vaccine-effectiveness ;; Prints the initial Vaccine Effectiveness of the Agent.
print "Family:" ;; Indicates Family information will follow.
ifelse breed = daycareworkers ;; Checks to see if agent zero is a daycare worker.
[
ask other turtles in-radius 24 ;; Checks turtles within a radius of 24 patches (full vertical length of the daycare).
[
ifelse breed = daycareworkers
[
type "Age: " type age type " Vaccinated: " type vaccinated? type " Vaccine Effectiveness: " type vaccine-effectiveness type "\n" ;; Prints a report on each turtle. Skips a line afterward.
]
[
]
]
]
[
ask other turtles in-radius 10 ;; Checks turtles within a radius of 10 patches (full vertical length of the house).
[
if family-id = agent-zero and not (breed = daycareworkers) ;; Asks turtles if their family-id is the same as agent-zero and makes sure they are not a daycare worker.
[
type "Age: " type age type " Vaccinated: " type vaccinated? type " Vaccine Effectiveness: " type vaccine-effectiveness type "\n" ;; Prints a report on each turtle. Skips a line afterward.
]
]
]
]
[
set diagnosed-case-vaccinated diagnosed-case-vaccinated + 1 ;; Adds 1 to the Vaccinated cases.
symptomatic ;; Initiates the symptomatic commands.
set agent-zero family-id ;; Sets the global-variable agent-zero to the family-id of the infected to document family members.
type "********** BEGINNING OF NEW ITERATION **********" type "\n" ;; Beginning of New Iteration Header.
type "Starting Agent" type "\n" ;; Types that this is the agent zero info in the command prompt. Skips a line afterward.
type "Age: " type age type "\n" ;; Types the age of the agent zero. Skips a line afterward.
print "Vaccinated" ;; Types that agent zero is vaccinated.
print vaccine-effectiveness ;; Prints the initial Vaccine Effectiveness of the Agent.
print "Family:" ;; Indicates Family information will follow.
ask other turtles in-radius 10 ;; Checks turtles within a radius of 10 patches (full vertical length of the house).
[
if family-id = agent-zero ;; Asks turtles if their family-id is the same as agent-zero.
[
type "Age: " type age type " Vaccinated: " type vaccinated? type " Vaccine Effectiveness: " type vaccine-effectiveness type "\n" ;; Prints a report on each turtle. Skips a line afterward.
]
]
]
]
[
set diagnosed-case-unvaccinated diagnosed-case-unvaccinated + 1 ;; Adds 1 to the Unvaccinated cases.
symptomatic ;; Initiates the symptomatic commands
set agent-zero family-id ;; Sets the global-variable agent-zero to the family-id of the infected to document family members.
type "********** BEGINNING OF NEW ITERATION **********" type "\n" ;; Beginning of New Iteration Header.
type "Starting Agent" type "\n" ;; Skips one line, types that this is the agent zero info in the command prompt. Skips a line afterward.
type "Age: " type age type "\n" ;; Types the age of the agent zero. Skips a line afterward.
print "Unvaccinated" ;; Types that agent zero is vaccinated.
print vaccine-effectiveness ;; Prints the initial Vaccine Effectiveness of the Agent.
print "Family:" ;; Indicates Family information will follow.
ask other turtles in-radius 10 ;; Checks turtles within a radius of 10 patches (full vertical length of the house).
[
if family-id = agent-zero ;; Asks turtles if their family-id is the same as agent-zero.
[
type "Age: " type age type " Vaccinated: " type vaccinated? type " Vaccine Effectiveness: " type vaccine-effectiveness type "\n" ;; Prints a report on each turtle. Skips a line afterward.
]
]
]
]
end
to setup-buildings-and-transportation
;;; WORKSPACE SCRIPT ;;;
set buildings-counter 0 ;; Resets the buildings-counter to 0.
while [ buildings-counter < initial-children ] ;; Runs a loop while buildings-counter < initial children because there is 1 workspace per child.
[
;;; TOP ROW OF WORKSPACES ;;;
set workspace patches with [((10 * buildings-counter)) < pxcor and pxcor < ((10 * buildings-counter) + 8) ;; Draws workspaces evenly spaced across x-axis on 120 x-axis patch world map.
and (35 < pycor and pycor < 50)] ;; Draws workspace y-axis between 35 to 50 y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask workspace [ set workspace-id buildings-counter ] ;; Assigns a unique workspace-id to patches created for each house.
ask workspace [ set pcolor gray + 2 ] ;; Sets a lighter color gray to workspaces to better enable seeing dynamic agents.
ask workspace [ set patch-type "workspace" ] ;; Sets the patch-type to workspace.
;;; BOTTOM ROW OF WORKSPACES ;;;
set workspace patches with [((10 * buildings-counter)) < pxcor and pxcor < ((10 * buildings-counter) + 8) ;; Draws workspaces evenly spaced across x-axis on 120 x-axis patch world map.
and (15 < pycor and pycor < 30)] ;; Draws workspace y-axis between 35 to 50 y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask workspace [ set workspace-id buildings-counter ] ;; Assigns a unique workspace-id to patches created for each house.
ask workspace [ set pcolor gray + 2 ] ;; Sets a lighter color gray to workspaces to better enable seeing dynamic agents.
ask workspace [ set patch-type "workspace" ] ;; Sets the patch-type to workspace.
]
;;; TRANSPORTATION BETWEEN WORKSPACE AND DAYCARE SCRIPT ;;;
set transportation-id 0 ;; Resets the transportation-id to 0.
while [ transportation-id < (initial-children / 12) ] ;; Ensures transportation network is drawn once per twelve children.
[
set buildings-counter 0 ;; Resets the Building-Counter to 0.
while [ buildings-counter < 12 ] ;; Allows loop to run while buildings-counter is less than 12.
[
;;; VERTICAL TRANSPORTATION PATH FOR TOP ROW OF WORKSPACES ;;;
set transportation patches with [((10 * buildings-counter) + 4 + (120 * transportation-id)) < pxcor and pxcor < ((10 * buildings-counter) + 6 + (120 * transportation-id)) ;; Draws transportations evenly spaced across x-axis on 120 x-axis patch world map.
and (11 - buildings-counter) < pycor and pycor < 36] ;; Draws transportation between y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask transportation [ set transportation-wd (buildings-counter + (12 * transportation-id)) ] ;; Assigns a unique transportation-wd to transportation patches created for each family.
ask transportation [ set pcolor black + 3] ;; Assigns the color black + 3 to top row transportation.
ask transportation [ set patch-type "street" ] ;; Sets the patch-type to street.
;;; VERTICAL TRANSPORTATION PATH FOR BOTTOM ROW OF WORKSPACES ;;;
set transportation patches with [((10 * buildings-counter) + 4 + (120 * transportation-id)) < pxcor and pxcor < ((10 * buildings-counter) + 6 + (120 * transportation-id)) ;; Draws transportations evenly spaced across x-axis on 120 x-axis patch world map.
and (12 - buildings-counter) < pycor and pycor < 16] ;; Draws transportation between y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask transportation [ set transportation-wd (buildings-counter + (12 * transportation-id)) ] ;; Assigns a unique transportation-wd to patches created for each family.
ask transportation [ set pcolor black ] ;; Assigns the color black to bottom row transportation.
ask transportation [ set patch-type "street" ] ;; Sets the patch-type to street.
]
set buildings-counter 2 ;; Sets the buildings-counter to 2 (Because there are 2 vertical paths that do not need horizontal paths to arrive at the daycare.)
while [ buildings-counter < 12 ] ;; Allows the buildings-counter to run while it is less than 12.
[
;;; HORIZONTAL TRANSPORTATION PATH FOR TOP ROW OF WORKSPACES ;;;
set transportation patches with [19 + (120 * transportation-id) < pxcor and pxcor < ((10 * buildings-counter) + 6 + (120 * transportation-id)) ;; Draws transportations evenly spaced across x-axis on 120 x-axis patch world map.
and (11 - buildings-counter) < pycor and pycor < (13 - buildings-counter)] ;; Draws transportation between y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask transportation [ set pcolor black + 3 ] ;; Assigns the color black + 3 to top row transportation.
ask transportation [ set transportation-wd (buildings-counter + (12 * transportation-id)) ] ;; Assigns a unique transportation-wd to transportation patches created for each family.
ask transportation [ set patch-type "street" ] ;; Sets the patch-type to street.
;;; HORIZONTAL TRANSPORTATION PATH FOR BOTTOM ROW OF WORKSPACES ;;;
set transportation patches with [19 + (120 * transportation-id) < pxcor and pxcor < ((10 * buildings-counter) + 6 + (120 * transportation-id)) ;; Draws transportations evenly spaced across x-axis on 120 x-axis patch world map.
and (11 - buildings-counter) < pycor and pycor < 13 - buildings-counter] ;; Draws transportation between y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask transportation [ set pcolor black ] ;; Assigns the color black to bottom row transportation.
ask transportation [ set transportation-wd (buildings-counter + (12 * transportation-id)) ] ;; Assigns a unique transportation-wd to transportation patches created for each family.
ask transportation [ set patch-type "street" ] ;; Sets the patch-type to street.
]
set transportation-id transportation-id + 1 ;; Assigns the transportation-id for the next set of patches created and progresses the loop.
]
;;; DAYCARE SCRIPT ;;;
set buildings-counter 0 ;; Resets the buildings-counter global variable to 0.
while [ buildings-counter < (initial-children / 12) ] ;; Runs a loop while buildings-counter < initial-children/12 because there is 1 daycare per 12 children.
[
set daycare patches with [(120 * buildings-counter) < pxcor and pxcor < ((120 * buildings-counter) + 20) ;; Aligns left and evenly spaces out daycares according to # of children via the buildings-counter variable.
and (-12 < pycor and pycor < 12)] ;; Draws house y-axis between -10 to 10 y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask daycare [ set daycare-id buildings-counter ] ;; Assigns a unqiue daycare-id to patches created for each daycare.
ask daycare [ set pcolor gray + 2 ] ;; Sets a lighter color gray to daycares to better enable seeing dynamic agents.
ask daycare [ set patch-type "daycare" ] ;; Sets the patch-type to daycare.
]
;;; TRANSPORTATION BETWEEN DAYCARE AND HOUSE SCRIPT ;;;
set transportation-id 0 ;; Resets the transportation-id to 0.
while [ transportation-id < (initial-children / 12) ] ;; Runs a loop while transportation-id < initial-children/12 becasue there is 1 complete transportation network per 12 children.
[
set buildings-counter 0 ;; Resets buildings-counter to 0.
while [ buildings-counter < 12 ] ;; Runs a loop while buildings-counter < 12.
[
;;; VERTICAL TRANSPORTATION PATH FOR ODD COLUMN OF HOUSES ;;;
set transportation patches with [((10 * buildings-counter) + 4 + (120 * transportation-id)) < pxcor and pxcor < ((10 * buildings-counter) + 6 + (120 * transportation-id)) ;; Draws transportations evenly spaced across x-axis on 120 x-axis patch world map.
and -16 < pycor and pycor < (-11 + buildings-counter)] ;; Draws transportation between y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask transportation [ set transportation-dh (buildings-counter + (12 * transportation-id)) ] ;; Assigns a unique transportation-id to patches created for each family.
ask transportation [ set pcolor black ] ;; Assigns the color black to odd column transportation.
ask transportation [ set patch-type "street" ] ;; Sets the patch-type to street.
;;; VERTICAL TRANSPORTATION PATH FOR EVEN COLUMN OF HOUSES ;;;
set transportation patches with [((10 * buildings-counter) + 4 + (120 * transportation-id)) < pxcor and pxcor < ((10 * buildings-counter) + 6 + (120 * transportation-id)) ;; Draws transportations evenly spaced across x-axis on 120 x-axis patch world map.
and -16 < pycor and pycor < (-12 + buildings-counter)] ;; Draws transportation between y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask transportation [ set transportation-dh (buildings-counter + (12 * transportation-id)) ] ;; Assigns a unique transportation-id to patches created for each family.
ask transportation [ set pcolor black + 3 ] ;; Assigns the color black + 3 to even column transportation.
ask transportation [ set patch-type "street" ] ;; Sets the patch-type to street.
]
set buildings-counter 2 ;; Sets buildings-counter to 2. (Because there are 2 vertical paths that do not need horizontal paths to get to work.)
while [ buildings-counter < 12 ] ;; Runs a loop while buildings-counter < 12.
[
;;; HORIZONTAL TRANSPORTATION PATH FOR ODD COLUMN OF HOUSES ;;;
set transportation patches with [19 + (120 * transportation-id) < pxcor and pxcor < ((10 * buildings-counter) + 6 + (120 * transportation-id)) ;; Draws transportations evenly spaced across x-axis on 120 x-axis patch world map.
and (-13 + buildings-counter) < pycor and pycor < (-11 + buildings-counter)] ;; Draws transportation between y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask transportation [ set pcolor black ] ;; Assigns the color black to odd column transportation.
ask transportation [ set transportation-dh (buildings-counter + (12 * transportation-id)) ] ;; Assigns a unique transportation-id to patches created for each family.
ask transportation [ set patch-type "street" ] ;; Sets the patch-type to street.
;;; HORIZONTAL TRANSPORTATION PATH FOR EVEN COLUMN OF HOUSES ;;;
set transportation patches with [19 + (120 * transportation-id) < pxcor and pxcor < ((10 * buildings-counter) + 6 + (120 * transportation-id)) ;; Draws transportations evenly spaced across x-axis on 120 x-axis patch world map.
and (-13 + buildings-counter) < pycor and pycor < (-11 + buildings-counter)] ;; Draws transportation between y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask transportation [ set pcolor black + 3 ] ;; Assigns the color black + 3 to even column transportation.
ask transportation [ set transportation-dh (buildings-counter + (12 * transportation-id)) ] ;; Assigns a unique transportation-id to patches created for each family.
ask transportation [ set patch-type "street" ] ;; Sets the patch-type to street.
]
set transportation-id transportation-id + 1 ;; Adds 1 to the Transportation-id as the loop progresses.
]
;;; HOUSE SCRIPT ;;;
set buildings-counter 0 ;; Resets the buildings-counter to 0.
while [ buildings-counter < initial-children ] ;; Runs a loop while buildings-counter < initial children because there is 1 house per child.
[
set house patches with [(10 * buildings-counter) < pxcor and pxcor < ((10 * buildings-counter) + 8) ;; Draws houses evenly spaced across x-axis on 120 x-axis patch world map.
and (-25 < pycor and pycor < -15)] ;; Draws house y-axis centered on -25 to -15 y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask house [ set house-id buildings-counter ] ;; Assigns a unique house-id to patches created for each house.
ask house [ set pcolor gray + 2 ] ;; Sets a lighter color gray to houses to better enable seeing dynamic agents.
ask house [ set patch-type "house" ] ;; Sets the patch-type to house.
]
;;; TRANSPORTATION BETWEEN HOUSE AND SCHOOL ;;;
set buildings-counter 0 ;; Resets buildings-counter to 0.
while [ buildings-counter < initial-children ] ;; Runs the loop while buildings-counter < intial-children.
[
set transportation patches with [((10 * buildings-counter) + 4) < pxcor and pxcor < ((10 * buildings-counter) + 6) ;; Draws transportations evenly spaced across x-axis on 120 x-axis patch world map.
and -31 < pycor and pycor < -24] ;; Draws transportation between y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask transportation [ set transportation-hs buildings-counter ] ;; Assigns a unique transportation-id to patches created for each family.
ask transportation [ set pcolor black ] ;; Assigns the color black to this transportation.
ask transportation [ set patch-type "street" ] ;; Sets the patch-type to street.
]
;;; SCHOOL SCRIPT ;;;
set buildings-counter 0 ;; Resets the buildings-counter to 0.
while [ buildings-counter < (initial-children / 4) ] ;; Runs a loop while buildings-counter < initial-children/4 to create 3 schools for siblings of children in a daycare classroom (Elem/Mid/HS).
[
set school patches with [((40 * buildings-counter) + 3) < pxcor and pxcor < ((40 * buildings-counter) + 36) ;; Evenly spaces out schools according to # of children via the buildings-counter variable.
and (-50 < pycor and pycor < -30)] ;; Draws school y-axis between -40 and -30 y-axis patches of world map.
set buildings-counter buildings-counter + 1 ;; Progresses buildings-counter to progress through while loop.
ask school [ set school-id buildings-counter ] ;; Assigns a unqiue daycare-id to patches created for each school.
ask school [ set pcolor gray + 2 ] ;; Sets a lighter color gray to schools to better enable seeing dynamic agents.
ask school [ set patch-type "school" ] ;; Sets the patch-type to school.
]
end
to setup-calendar
ifelse year = 2028 OR year = 2024 OR year = 2020 OR year = 2016 OR year = 2012 OR year = 2008 OR year = 2004 OR year = 2000 ;; Checks to see if it is a leap year.
[
set calendar-days 366 ;; If it is a leap year calendar-days are set to 366 for aging and initial day of the week equation.
set feb-leap-year 29 ;; If it is a leap year there are 29 days.
]
[
set calendar-days 365 ;; If it is not a leap year calendar-days are set to 365 for aging and initial day of the week equation.
set feb-leap-year 28 ;; If it is not a leap year there are 28 days.
]
ifelse year = 2001 OR year = 2007 OR year = 2018 ;; Checks the year.
[ set day-of-week 1 ] ;; January 1st is Monday (2001, 2007, 2018).
[ ifelse year = 2002 OR year = 2008 OR year = 2013 ;; Checks the year.
[ set day-of-week 2 ] ;; January 1st is Tuesday (2002, 2008, 2013).
[ ifelse year = 2003 OR year = 2014 ;; Checks the year.
[ set day-of-week 3 ] ;; January 1st is Wednesday (2003, 2014).
[ ifelse year = 2004 OR year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 4 ] ;; January 1st is Thursday (2004, 2009, 2015).
[ ifelse year = 2010 OR year = 2016 ;; Checks the year.
[ set day-of-week 5 ] ;; January 1st is Friday (2010, 2016).
[ ifelse year = 2000 OR year = 2005 OR year = 2011 ;; Checks the year.
[ set day-of-week 6 ] ;; January 1st is Saturday (2000, 2005, 2011).
[ if year = 2006 OR year = 2012 OR year = 2017 ;; Checks the year.
[ set day-of-week 7 ] ;; January 1st is Sunday (2006, 2012, 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
ifelse start-month = "January" ;; Checks to see if the start-month is "January".
[ while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
]
]
[
ifelse start-month = "February" ;; Checks to see if the start-month is "February".
[
ifelse year = 2001 OR year = 2007 OR year = 2018 ;; Checks the year.
[ set day-of-week 4 ] ;; February 1st is Thursday.
[ ifelse year = 2002 OR year = 2008 OR year = 2013 ;; Checks the year.
[ set day-of-week 5 ] ;; February 1st is Friday (2002, 2008, 2013).
[ ifelse year = 2003 OR year = 2014 ;; Checks the year.
[ set day-of-week 6 ] ;; February 1st is Saturday (2003, 2014).
[ ifelse year = 2004 OR year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 7 ] ;; February 1st is Sunday (2004, 2009, 2015).
[ ifelse year = 2010 OR year = 2016 ;; Checks the year.
[ set day-of-week 1 ] ;; February 1st is Monday (2010, 2016).
[ ifelse year = 2000 OR year = 2005 OR year = 2011 ;; Checks the year.
[ set day-of-week 2 ] ;; February 1st is Tuesday (2000, 2005, 2011).
[ if year = 2006 OR year = 2012 OR year = 2017 ;; Checks the year.
[ set day-of-week 3 ] ;; February 1st is Wednesday (2006, 2012, 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
]
]
[
ifelse start-month = "March" ;; Checks to see if the start-month is "March".
[
ifelse year = 2001 OR year = 2007 OR year = 2012 OR year = 2018 ;; Checks the year.
[ set day-of-week 4 ] ;; March 1st is Thursday (2001, 2007, 2012 [leap year], 2018).
[ ifelse year = 2002 OR year = 2013 ;; Checks the year.
[ set day-of-week 5 ] ;; March 1st is Friday (2002, 2013).
[ ifelse year = 2003 OR year = 2008 OR year = 2014 ;; Checks the year.
[ set day-of-week 6 ] ;; March 1st is Saturday (2003, 2008 [leap year], 2014).
[ ifelse year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 7 ] ;; March 1st is Sunday (2004 [leap year], 2009, 2015).
[ ifelse year = 2004 OR year = 2010 ;; Checks the year.
[ set day-of-week 1 ] ;; March 1st is Monday (2010, 2016 [leap year]).
[ ifelse year = 2005 OR year = 2011 OR year = 2016 ;; Checks the year.
[ set day-of-week 2 ] ;; March 1st is Tuesday (2000 [leap year], 2005, 2011).
[ if year = 2000 OR year = 2006 OR year = 2017 ;; Checks the year.
[ set day-of-week 3 ] ;; March 1st is Wednesday (2006, 2012 [leap year], 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
]
]
[
ifelse start-month = "April" ;; Checks to see if the start-month is "April".
[
ifelse year = 2001 OR year = 2007 OR year = 2012 OR year = 2018 ;; Checks the year.
[ set day-of-week 7 ] ;; April 1st is Sunday (2001, 2007, 2012 [leap year], 2018).
[ ifelse year = 2002 OR year = 2013 ;; Checks the year.
[ set day-of-week 1 ] ;; April 1st is Monday (2002, 2013).
[ ifelse year = 2003 OR year = 2008 OR year = 2014 ;; Checks the year.
[ set day-of-week 2 ] ;; April 1st is Tuesday (2003, 2008 [leap year], 2014).
[ ifelse year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 3 ] ;; April 1st is Wednesday (2004 [leap year], 2009, 2015).
[ ifelse year = 2004 OR year = 2010 ;; Checks the year.
[ set day-of-week 4 ] ;; April 1st is Thursday (2010, 2016 [leap year]).
[ ifelse year = 2005 OR year = 2011 OR year = 2016 ;; Checks the year.
[ set day-of-week 5 ] ;; April 1st is Friday (2000 [leap year], 2005, 2011).
[ if year = 2000 OR year = 2006 OR year = 2017 ;; Checks the year.
[ set day-of-week 6 ] ;; April 1st is Saturday (2006, 2012 [leap year], 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
]
]
[
ifelse start-month = "May" ;; Checks to see if the start-month is "May".
[
ifelse year = 2001 OR year = 2007 OR year = 2012 OR year = 2018 ;; Checks the year.
[ set day-of-week 2 ] ;; May 1st is Tuesday (2001, 2007, 2012 [leap year], 2018).
[ ifelse year = 2002 OR year = 2013 ;; Checks the year.
[ set day-of-week 3 ] ;; May 1st is Wednesday (2002, 2013).
[ ifelse year = 2003 OR year = 2008 OR year = 2014 ;; Checks the year.
[ set day-of-week 4 ] ;; May 1st is Thursday (2003, 2008 [leap year], 2014).
[ ifelse year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 5 ] ;; May 1st is Friday (2004 [leap year], 2009, 2015).
[ ifelse year = 2004 OR year = 2010 ;; Checks the year.
[ set day-of-week 6 ] ;; May 1st is Saturday (2010, 2016 [leap year]).
[ ifelse year = 2005 OR year = 2011 OR year = 2016 ;; Checks the year.
[ set day-of-week 7 ] ;; May 1st is Sunday (2000 [leap year], 2005, 2011).
[ if year = 2000 OR year = 2006 OR year = 2017 ;; Checks the year.
[ set day-of-week 1 ] ;; May 1st is Monday (2006, 2012 [leap year], 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
]
]
[
ifelse start-month = "June" ;; Checks to see if the start-month is "June".
[
ifelse year = 2001 OR year = 2007 OR year = 2012 OR year = 2018 ;; Checks the year.
[ set day-of-week 5 ] ;; June 1st is Friday (2001, 2007, 2012 [leap year], 2018).
[ ifelse year = 2002 OR year = 2013 ;; Checks the year.
[ set day-of-week 6 ] ;; June 1st is Saturday (2002, 2013).
[ ifelse year = 2003 OR year = 2008 OR year = 2014 ;; Checks the year.
[ set day-of-week 7 ] ;; June 1st is Sunday (2003, 2008 [leap year], 2014).
[ ifelse year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 1 ] ;; June 1st is Monday (2004 [leap year], 2009, 2015).
[ ifelse year = 2004 OR year = 2010 ;; Checks the year.
[ set day-of-week 2 ] ;; June 1st is Tuesday (2010, 2016 [leap year]).
[ ifelse year = 2005 OR year = 2011 OR year = 2016 ;; Checks the year.
[ set day-of-week 3 ] ;; June 1st is Wednesday (2000 [leap year], 2005, 2011).
[ if year = 2000 OR year = 2006 OR year = 2017 ;; Checks the year.
[ set day-of-week 4 ] ;; June 1st is Thursday (2006, 2012 [leap year], 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
]
]
[
ifelse start-month = "July" ;; Checks to see if the start-month is "July".
[
ifelse year = 2001 OR year = 2007 OR year = 2012 OR year = 2018 ;; Checks the year.
[ set day-of-week 7 ] ;; July 1st is Sunday (2001, 2007, 2012 [leap year], 2018).
[ ifelse year = 2002 OR year = 2013 ;; Checks the year.
[ set day-of-week 1 ] ;; July 1st is Monday (2002, 2013).
[ ifelse year = 2003 OR year = 2008 OR year = 2014 ;; Checks the year.
[ set day-of-week 2 ] ;; July 1st is Tuesday (2003, 2008 [leap year], 2014).
[ ifelse year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 3 ] ;; July 1st is Wednesday (2004 [leap year], 2009, 2015).
[ ifelse year = 2004 OR year = 2010 ;; Checks the year.
[ set day-of-week 4 ] ;; July 1st is Thursday (2010, 2016 [leap year]).
[ ifelse year = 2005 OR year = 2011 OR year = 2016 ;; Checks the year.
[ set day-of-week 5 ] ;; July 1st is Friday (2000 [leap year], 2005, 2011).
[ if year = 2000 OR year = 2006 OR year = 2017 ;; Checks the year.
[ set day-of-week 6 ] ;; July 1st is Saturday (2006, 2012 [leap year], 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
holidays ;; Runs the commands to determine holidays
]
]
[
ifelse start-month = "August" ;; Checks to see if the start-month is "August".
[
ifelse year = 2001 OR year = 2007 OR year = 2012 OR year = 2018 ;; Checks the year.
[ set day-of-week 3 ] ;; August 1st is Wednesday (2001, 2007, 2012 [leap year], 2018).
[ ifelse year = 2002 OR year = 2013 ;; Checks the year.
[ set day-of-week 4 ] ;; August 1st is Thursday (2002, 2013).
[ ifelse year = 2003 OR year = 2008 OR year = 2014 ;; Checks the year.
[ set day-of-week 5 ] ;; August 1st is Friday (2003, 2008 [leap year], 2014).
[ ifelse year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 6 ] ;; August 1st is Saturday (2004 [leap year], 2009, 2015).
[ ifelse year = 2004 OR year = 2010 ;; Checks the year.
[ set day-of-week 7 ] ;; August 1st is Sunday (2010, 2016 [leap year]).
[ ifelse year = 2005 OR year = 2011 OR year = 2016 ;; Checks the year.
[ set day-of-week 1 ] ;; August 1st is Monday (2000 [leap year], 2005, 2011).
[ if year = 2000 OR year = 2006 OR year = 2017 ;; Checks the year.
[ set day-of-week 2 ] ;; August 1st is Tuesday (2006, 2012 [leap year], 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
]
]
[
ifelse start-month = "September" ;; Checks to see if the start-month is "September".
[
ifelse year = 2001 OR year = 2007 OR year = 2012 OR year = 2018 ;; Checks the year.
[ set day-of-week 6 ] ;; September 1st is Saturday (2001, 2007, 2012 [leap year], 2018).
[ ifelse year = 2002 OR year = 2013 ;; Checks the year.
[ set day-of-week 7 ] ;; September 1st is Sunday (2002, 2013).
[ ifelse year = 2003 OR year = 2008 OR year = 2014 ;; Checks the year.
[ set day-of-week 1 ] ;; September 1st is Monday (2003, 2008 [leap year], 2014).
[ ifelse year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 2 ] ;; September 1st is Tuesday (2004 [leap year], 2009, 2015).
[ ifelse year = 2004 OR year = 2010 ;; Checks the year.
[ set day-of-week 3 ] ;; September 1st is Wednesday (2010, 2016 [leap year]).
[ ifelse year = 2005 OR year = 2011 OR year = 2016 ;; Checks the year.
[ set day-of-week 4 ] ;; September 1st is Thursday (2000 [leap year], 2005, 2011).
[ if year = 2000 OR year = 2006 OR year = 2017 ;; Checks the year.
[ set day-of-week 5 ] ;; September 1st is Friday (2006, 2012 [leap year], 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
holidays ;; Runs the commands to determine holidays
]
]
[
ifelse start-month = "October" ;; Checks to see if the start-month is "October".
[
ifelse year = 2001 OR year = 2007 OR year = 2012 OR year = 2018 ;; Checks the year.
[ set day-of-week 1 ] ;; October 1st is Monday (2001, 2007, 2012 [leap year], 2018).
[ ifelse year = 2002 OR year = 2013 ;; Checks the year.
[ set day-of-week 2 ] ;; October 1st is Tuesday (2002, 2013).
[ ifelse year = 2003 OR year = 2008 OR year = 2014 ;; Checks the year.
[ set day-of-week 3 ] ;; October 1st is Wednesday (2003, 2008 [leap year], 2014).
[ ifelse year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 4 ] ;; October 1st is Thursday (2004 [leap year], 2009, 2015).
[ ifelse year = 2004 OR year = 2010 ;; Checks the year.
[ set day-of-week 5 ] ;; October 1st is Friday (2010, 2016 [leap year]).
[ ifelse year = 2005 OR year = 2011 OR year = 2016 ;; Checks the year.
[ set day-of-week 6 ] ;; October 1st is Saturday (2000 [leap year], 2005, 2011).
[ if year = 2000 OR year = 2006 OR year = 2017 ;; Checks the year.
[ set day-of-week 7 ] ;; October 1st is Sunday (2006, 2012 [leap year], 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
]
]
[
ifelse start-month = "November" ;; Checks to see if the start-month is "November".
[
ifelse year = 2001 OR year = 2007 OR year = 2012 OR year = 2018 ;; Checks the year.
[ set day-of-week 4 ] ;; November 1st is Thursday (2001, 2007, 2012 [leap year], 2018).
[ ifelse year = 2002 OR year = 2013 ;; Checks the year.
[ set day-of-week 5 ] ;; November 1st is Friday (2002, 2013).
[ ifelse year = 2003 OR year = 2008 OR year = 2014 ;; Checks the year.
[ set day-of-week 6 ] ;; November 1st is Saturday (2003, 2008 [leap year], 2014).
[ ifelse year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 7 ] ;; November 1st is Sunday (2004 [leap year], 2009, 2015).
[ ifelse year = 2004 OR year = 2010 ;; Checks the year.
[ set day-of-week 1 ] ;; November 1st is Monday (2010, 2016 [leap year]).
[ ifelse year = 2005 OR year = 2011 OR year = 2016 ;; Checks the year.
[ set day-of-week 2 ] ;; November 1st is Tuesday (2000 [leap year], 2005, 2011).
[ if year = 2000 OR year = 2006 OR year = 2017 ;; Checks the year.
[ set day-of-week 3 ] ;; November 1st is Wednesday (2006, 2012 [leap year], 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
holidays ;; Runs the commands to determine holidays.
]
]
[
if start-month = "December" ;; Checks to see if the start-month is "December".
[
ifelse year = 2001 OR year = 2007 OR year = 2012 OR year = 2018 ;; Checks the year.
[ set day-of-week 6 ] ;; December 1st is Saturday (2001, 2007, 2012 [leap year], 2018).
[ ifelse year = 2002 OR year = 2013 ;; Checks the year.
[ set day-of-week 7 ] ;; December 1st is Sunday (2002, 2013).
[ ifelse year = 2003 OR year = 2008 OR year = 2014 ;; Checks the year.
[ set day-of-week 1 ] ;; December 1st is Monday (2003, 2008 [leap year], 2014).
[ ifelse year = 2009 OR year = 2015 ;; Checks the year.
[ set day-of-week 2 ] ;; December 1st is Tuesday (2004 [leap year], 2009, 2015).
[ ifelse year = 2004 OR year = 2010 ;; Checks the year.
[ set day-of-week 3 ] ;; December 1st is Wednesday (2010, 2016 [leap year]).
[ ifelse year = 2005 OR year = 2011 OR year = 2016 ;; Checks the year.
[ set day-of-week 4 ] ;; December 1st is Thursday (2000 [leap year], 2005, 2011).
[ if year = 2000 OR year = 2006 OR year = 2017 ;; Checks the year.
[ set day-of-week 5 ] ;; December 1st is Friday (2006, 2012 [leap year], 2017).
] ] ] ] ] ] ;; Closes out five ifelse queries and one if query above.
while [ counts-days < start-day ] ;; Runs this loop until counts-days is greater than the start-day.
[
set counts-days counts-days + 1 ;; Adds one to counts-days to progress the loop.
set day-of-week day-of-week + 1 ;; Adds one to the day-of-week to change the day-of-week.
if day-of-week > 7 ;; This happens when the day-of-week is greater than seven.
[ set day-of-week 1 ] ;; The day of week restarts at Monday.
holidays ;; Runs the commands to determine holidays.
]
] ] ] ] ] ] ] ] ] ] ] ] ;; Closes out 11 ifelse queries and 1 if query.
ifelse day-of-week = 1 ;; Checks to see if output day is the numerical day for Monday.
[ set output-day "Monday" ] ;; Sets the output day to Monday.
[ ifelse day-of-week = 2 ;; Checks to see if output day is the numerical day for Tuesday.
[ set output-day "Tuesday" ] ;; Sets the output day to Tuesday.
[ ifelse day-of-week = 3 ;; Checks to see if output day is the numerical day for Wednesday.
[ set output-day "Wednesday" ] ;; Sets the output day to Wednesday.
[ ifelse day-of-week = 4 ;; Checks to see if output day is the numerical day for Thursday.
[ set output-day "Thursday" ] ;; Sets the output day to Thursday.
[ ifelse day-of-week = 5 ;; Checks to see if output day is the numerical day for Friday.
[ set output-day "Friday" ] ;; Sets the output day to Friday.
[ ifelse day-of-week = 6 ;; Checks to see if output day is the numerical day for Saturday.
[ set output-day "Saturday" ] ;; Sets the output day to Saturday.
[ if day-of-week = 7 ;; Checks to see if output day is the numerical day for Sunday.
[ set output-day "Sunday" ] ;; Sets the output day to Sunday.
] ] ] ] ] ] ;; Closes out 6 ifelse queries above.
end
to holidays
;;; THANKSGIVING ;;;
if month = "January"
[
ifelse calendar-counter >= 1
[
set holiday? true
]
[
set holiday? false
]
]
if month = "July"
[
ifelse calendar-counter = 4
[
set holiday? true
]
[
set holiday? false
]
]
if month = "September"
[
ifelse calendar-counter = 5
[
set holiday? true
]
[
set holiday? false
]
]
if month = "November"
[
if day-of-week = 4 and holiday-counter < 3
[
set holiday-counter holiday-counter + 1
]
if holiday-counter = 4 and day-of-week = 3
[
set holiday? true
]
if holiday-counter = 4 and day-of-week = 4
[
set holiday? true
]
if holiday-counter = 4 and day-of-week = 5
[
set holiday? true
set holiday-counter calendar-counter
]
if calendar-counter = holiday-counter + 1
[
set holiday? false
]
if day-of-week = 5 and holiday-counter = 3
[
set holiday-counter holiday-counter + 1
]
]
if month = "December"
[
if calendar-counter >= 23
[
set holiday-counter 0
set holiday? true
]
]
end
;;; UPDATE-TRACKING-INFO COMMANDS ;;;
;to update-tracking-info ;; Runs update-tracking-info commands
; set vac-attack-fail (count patches with [pcolor = green])
; set vac-attack-success (count patches with [pcolor = orange])
; set unvac-attack-success (count patches with [pcolor = pink])
; set infected (count turtles with [ bacteria? ] ) ;; Equation for determining the # of infected children.
; set %infected (infected / count turtles) * 100 ;; Equation for determing the % of infected children.
; set vaccinated-infected (count turtles with [ vaccinated? and bacteria? ] ) ;; Equation for determining vaccinated & infected turtles.
; set %vaccinated-infected (vaccinated-infected / count turtles) * 100 ;; Equation for determining % vaccinated & infected turtles.
; set unvaccinated-infected (infected - vaccinated-infected) ;; Equation for determining vaccinated & infected turtles.
; set %unvaccinated-infected (%infected - %vaccinated-infected) ;; Equation for determining % unvaccinated & infected turtles.
; set %never-infected (count turtles with [ color = blue or color = violet or color = blue - 1 or color = violet - 1 or color = blue - 2 or color = violet - 2 ] / count turtles) * 100 ;; Equation for determining the % of never infected turtles.
; set diagnosed-AR-vaccinated (diagnosed-case-vaccinated / (count turtles with [ vaccinated? ] )) ;; Equation for determining the diagnosed Attack Rate of Vaccinated turtles.
; set diagnosed-AR-unvaccinated (diagnosed-case-unvaccinated / ((count turtles) - (count turtles with [ vaccinated? ] ))) ;; Equation for determining the diagnosed Attack Rate of Unvaccinated turtles.
; set diagnosed-relative-risk (diagnosed-AR-vaccinated / diagnosed-AR-unvaccinated) ;; Equation that determines diagnosed Relative Risk.
; set diagnosed-vaccine-efficacy ((1 - diagnosed-relative-risk) * 100) ;; Equation that determines diagnosed Vaccine Efficacy.
;end
@#$#@#$#@
GRAPHICS-WINDOW
480
10
972
423
-1
-1
4.0
1
10
1
1
1
0
1
1
1
0
120
-50
50
0
0
1
Ticks (Minutes)
30.0
BUTTON
330
125
405
158
Setup!
setup
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
SLIDER
5
160
225
193
initial-children
initial-children
12
144
12.0
12
1
NIL
HORIZONTAL
BUTTON
410
125
470
158
Go!
go
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
410
165
470
198
Go!
go
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
MONITOR
5
10
100
55
# of Iterations
track-iterations
17
1
11
BUTTON
330
165
405
198
Clear All!
clear-all
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
SLIDER
5
200
225
233
pct-initial-children-vaccinated
pct-initial-children-vaccinated
0
1
0.0
.01
1
NIL
HORIZONTAL
SWITCH
5
560
225
593
asymptomatic-carriers?
asymptomatic-carriers?
0
1
-1000
SLIDER
5
240
225
273
pct-initial-parents-vaccinated
pct-initial-parents-vaccinated
0
1
0.0
.01
1
NIL
HORIZONTAL
SLIDER
5
280
225
313
pct-initial-siblings-vaccinated
pct-initial-siblings-vaccinated
0
1
0.0
.01
1
NIL
HORIZONTAL
OUTPUT
210
10
470
115
19
SWITCH
5
595
225
628
waning-immunity?
waning-immunity?
0
1
-1000
SLIDER
5
320
225
353
initial-vaccine-effectiveness
initial-vaccine-effectiveness
0
100
0.0
1
1
NIL
HORIZONTAL
SWITCH
5
630
225
663
antibiotics?
antibiotics?
0
1
-1000
SLIDER
5
400
225
433
waning-rate-annual
waning-rate-annual
0
1
0.0
.01
1
NIL
HORIZONTAL
CHOOSER
105
60
197
105
start-month
start-month
"January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December"
5
CHOOSER
105
110
197
155
start-year
start-year
2018 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2001 2000
5
CHOOSER
105
10
197
55
start-day
start-day
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0
SLIDER
5
440
225
473
sneezes-per-day
sneezes-per-day
0
20
20.0
.1
1
NIL
HORIZONTAL
SLIDER
5
480
225
513
coughs-per-day
coughs-per-day
0
20
20.0
.1
1
NIL
HORIZONTAL
SLIDER
5
360
225
393
antibiotics-days-to-recovery
antibiotics-days-to-recovery
0
21
10.0
1
1
NIL
HORIZONTAL
SLIDER
5
520
225
553
awareness-strength
awareness-strength
0
1
1.0
.1
1
NIL
HORIZONTAL
BUTTON
240
125
325
158
Print Results
print-results
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
240
165
325
198
Export World
export-world (word \"results \" track-iterations \".csv\")
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
240
205
325
238
Export View
export-view (word \"view\" track-iterations \".png\")
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
CHOOSER
240
245
457
290
casestudy-selection
casestudy-selection
"Tallahassee, Florida 2013-2014"
0
SLIDER
240
295
412
328
january-avg-temp
january-avg-temp
0
100
51.0
1
1
f
HORIZONTAL
SLIDER
240
330
412
363
february-avg-temp
february-avg-temp
0
100
60.0
1
1
f
HORIZONTAL
SLIDER
240
365
412
398
march-avg-temp
march-avg-temp
0
100
60.0
1
1
f
HORIZONTAL
SLIDER
240
400
412
433
april-avg-temp
april-avg-temp
0
100
66.0
1
1
f
HORIZONTAL
SLIDER
240
435
412
468
may-avg-temp
may-avg-temp
0
100
74.0
1
1
f
HORIZONTAL
SLIDER
240
470
412
503
june-avg-temp
june-avg-temp
0
100
80.0
1
1
f
HORIZONTAL
SLIDER
240
505
412
538
july-avg-temp
july-avg-temp
0
100
82.0
1
1
f
HORIZONTAL
SLIDER
240
540
412
573
august-avg-temp
august-avg-temp
0
100
82.0
1
1
f
HORIZONTAL
SLIDER
240
575
412
608
september-avg-temp
september-avg-temp
0
100
78.0
1
1
f
HORIZONTAL
SLIDER
240
645
412
678
november-avg-temp
november-avg-temp
0
100
60.0
1
1
f
HORIZONTAL
SLIDER
240
680
412
713
december-avg-temp
december-avg-temp
0
100
53.0
1
1
f
HORIZONTAL
SLIDER
240
610
412
643
october-avg-temp
october-avg-temp
0
100
69.0
1
1
f
HORIZONTAL
SWITCH
5
665
225
698
temperature?
temperature?
0
1
-1000
@#$#@#$#@
## WHAT IS IT?
In epidemiology, spatial and temporal variables are used to compute vaccination efficacy and effectiveness. The chosen resolution and scale of a spatial or spatio-temporal analysis will affect the results. When calculating vaccination efficacy, for example, a simple environment that offers various ideal outcomes is often modeled using coarse scale data aggregated on an annual basis. In contrast to the inadequacy of this aggregated method, this research uses agent based modeling of fine-scale neighborhood data centered around the interactions of infants in daycare and their families to demonstrate an accurate reflection of vaccination capabilities. Despite being able to prevent major symptoms, recent studies suggest that acellular Pertussis does not prevent the colonization and transmission of Bordetella Pertussis bacteria. After vaccination, a treated individual becomes a potential asymptomatic carrier of the Pertussis bacteria, rather than an immune individual. Agent based modeling enables the measurable depiction of asymptomatic carriers that are otherwise unaccounted for when calculating vaccination efficacy and effectiveness. Using empirical data from a Florida Pertussis outbreak case study, the results of this model demonstrate that asymptomatic carriers bias the calculated vaccination efficacy and reveal a need for reconsidering current methods that are widely used for calculating vaccination efficacy and effectiveness.
## HOW IT WORKS
The model is running by default on a 100x100 patch square. Each patch is measured at 5 pixels.
The **bacteria?** variable is a simplified represenation of the genus, Bordtella, this variable can be used in any agent. The model only represents the species, Bordtella pertussis, which is the most likely species within the genus Bordtella to produce severe reactions within children. One species that was not represented, Bordtella parapertussis, can produce a milder reaction in humans. Bordtella bronchiseptica, Bordtella avium, Bordtella trematum, and Bordtella holmesii rarely found in human infections1 and are also not factored in this model. Turtles infected with symptomatic Bordtella pertussis progress through four phases until recovery.
The four phases of pertussis represented in this model are incubation, catarrhal, paroxysmal, and convalescent. Incubation occurs for seven days, catarrhal occurs for fourteen days, paroxysmal occurs for forty-two days, and convalescent occurs for ten days. After progressing through all of the stages a turtle is considered recovered and it is recovered, marked by the color green.
The **asymptomatic-carriers?** variable can be turned on or off via the interface (see section "HOW TO USE IT"). If this variable is turned on then individuals who are vaccinated are still able to carry the vaccine without showing any major symptoms associated with pertussis. They progress through the stages of the disease and can pass the pertussis bacteria to immunized as well as non-vaccinated turtles during this time period.
Turtles who are infected progress through the phases of Pertussis disease as defined by the CDC. An incubation period is followed by the Catarrhal, Paroxysmal and Convalesence stage. A turtle who progresses through these stages is considered recovered.2
Research regarding a preschool with a Pertussis outbreak in Florida was used as a basis for turtle varriables such as **model-vaccine-efficacy**, **model-relative-risk**, **model-attack-rate-vaccinated**, and **model-attack-rate-unvaccinated**.
- model-vaccine-efficacy = (1 - Relative Risk) * 100
- model-relative-risk = Attack Rate (Fully-Vaccinated) / Attack Rate (Not Up to Date)
Fully vaccinated children are those who are in compliance with the _Recommended Immunization Schedule for Children and Adolescents Aged 18 Years or Younger, UNITED STATES_, which is approved by the Advisory Committee on Immunization Practices (ACIP), American Academy of Pediatrics (AAP), American Academy of Family Physicians (AAFP) and American College of Obstetricians and Gynecologists (ACOG) and published by the Center for Disease Control (CDC).3 Unvaccinated are all of those who are considered not up to date with this vaccination schedule. In this model, those who are not up to date with the vaccination schedule are the same as those who are not vaccinated at all.
- model-attack-rate-vaccinated = Vaccinated Infected / Population
- model-attack-rate-unvaccinated = Unvaccinated Infected / Population
## HOW TO USE IT
The **Setup!** button clears the **turtles* and resets the **ticks**. It also prints the CSV header in the command prompt, as long as it is the first time setup has happened or the **clear-all** button has been used.
The **clear** button on the Command Prompt should abe clicked prior to running the program to clear the data from the Command Prompt. This will make it easier to copy everything from the command prompt into a CSV file.
The **Go!** button will proceed forward a single tick.
The **Go! (Forever)** button will proceed forward an infinite number of ticks and iterations or until depressed by a second click.
The **initial-infants** slider allows you to choose the number of initial infants.
The **pct-initial-infants-vaccinated** slider allows you to choose the number of initial infants that will be vaccinated. Users, need to ensure that their % of vaccination equates to whole number divisions of the initial-infant population to ensure accuracy of the model.
The **vaccine-efficacy** slider allows you to choose the effectiveness of the vaccination. When bacteria carrying turtles come into contact with vaccinated turtles who are not carrying bacteria, then this is the % chance that they will acquire the bacteria for each tick that they enter or stay in the 2 patch radius of the carrying turtle.
These are Pre-Selected-Settings:
- "High Vaccination, Low Efficacy" (90% vaccination, 10% efficacy)
- "High Vaccination, Mid Efficacy" (90% vaccination, 50% efficacy)
- "High Vaccination, High Efficacy" (90% vaccination, 90% efficacy)
- "Mid Vaccination, Low Efficacy" (50% vaccination, 10% efficacy)
- "Mid Vaccination, Mid Efficacy" (50% vaccination, 50% efficacy)
- "Mid Vaccination, High Efficacy" (50% vaccination, 90% efficacy)
- "Low Vaccination, Low Efficacy" (10% vaccination, 10% efficacy)
- "Low Vaccination, Mid Efficacy" (10% vaccination, 50% efficacy)
- "Low Vaccination, High Efficacy" (10% vaccination, 90% efficacy)
There are a lot of sliders, switches and buttons to explore. Dig through the code, pull out things you like, or modify and use them to create your own models. I would appreciate a citation to my research article if you do use functionality from this model. The article also contains additional information about this model:
https://doi.org/10.5194/isprs-annals-IV-4-W2-37-2017
## CREDITS AND REFERENCES
**1.** VON KÖNIG, C. W., RIFFELMANN, M., & COENYE, T. 2011. Volume I: section II: BACTERIOLOGY: GRAM-NEGATIVE BACTERIA: Chapter 43: Bordetella and Related Genera. Manual Of Clinical Microbiology, 739.
**2.** CDC. Epidemiology & Prevention of Vaccine-Preventable Diseases 13th Edition. 2017. Ch 16. Pg 261-278. Accessed via https://www.cdc.gov/vaccines/pubs/pinkbook/index.html. (last accessed 12 March 2017)
**3.** CDC. Recommended Immunization Schedule for Children and Adolescents Aged 18 Years or Younger (United States 2017). 2016. https://www.cdc.gov/vaccines/schedules/downloads/child/0-18yrs-child-combined-schedule.pdf (last accessed 11 March 2017).
@#$#@#$#@
default
true
0
Polygon -7500403 true true 150 5 40 250 150 205 260 250
airplane
true
0
Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
arrow
true
0
Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
baby
true
0
Rectangle -7500403 true true 90 120 195 195
Circle -7500403 true true 162 59 95
Polygon -7500403 true true 61 146 54 211 95 212 93 182
Polygon -7500403 true true 187 160 220 214 195 225 180 195
Circle -7500403 true true 54 189 42
Circle -7500403 true true 189 199 30
Circle -7500403 true true 60 120 60
Circle -7500403 true true 91 185 30
Circle -7500403 true true 195 165 30
Polygon -7500403 true true 225 180 222 173 195 135 165 165 195 180
box
false
0
Polygon -7500403 true true 150 285 285 225 285 75 150 135
Polygon -7500403 true true 150 135 15 75 150 15 285 75
Polygon -7500403 true true 15 75 15 225 150 285 150 135
Line -16777216 false 150 285 150 135
Line -16777216 false 150 135 15 75
Line -16777216 false 150 135 285 75
bug
true
0
Circle -7500403 true true 96 182 108
Circle -7500403 true true 110 127 80
Circle -7500403 true true 110 75 80
Line -7500403 true 150 100 80 30
Line -7500403 true 150 100 220 30
butterfly
true
0
Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
Circle -16777216 true false 135 90 30
Line -16777216 false 150 105 195 60
Line -16777216 false 150 105 105 60
car
false
0
Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
Circle -16777216 true false 180 180 90
Circle -16777216 true false 30 180 90
Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
Circle -7500403 true true 47 195 58
Circle -7500403 true true 195 195 58
circle
false
0
Circle -7500403 true true 0 0 300
circle 2
false
0
Circle -7500403 true true 0 0 300
Circle -16777216 true false 30 30 240
cow
false
0
Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
Polygon -7500403 true true 73 210 86 251 62 249 48 208
Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
cylinder
false
0
Circle -7500403 true true 0 0 300
dot
false
0
Circle -7500403 true true 90 90 120
face happy
false
0
Circle -7500403 true true 8 8 285
Circle -16777216 true false 60 75 60
Circle -16777216 true false 180 75 60
Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
face neutral
false
0
Circle -7500403 true true 8 7 285
Circle -16777216 true false 60 75 60
Circle -16777216 true false 180 75 60
Rectangle -16777216 true false 60 195 240 225
face sad
false
0
Circle -7500403 true true 8 8 285
Circle -16777216 true false 60 75 60
Circle -16777216 true false 180 75 60
Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
fish
false
0
Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
Circle -16777216 true false 215 106 30
flag
false
0
Rectangle -7500403 true true 60 15 75 300
Polygon -7500403 true true 90 150 270 90 90 30
Line -7500403 true 75 135 90 135
Line -7500403 true 75 45 90 45
flower
false
0
Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
Circle -7500403 true true 85 132 38
Circle -7500403 true true 130 147 38
Circle -7500403 true true 192 85 38
Circle -7500403 true true 85 40 38
Circle -7500403 true true 177 40 38
Circle -7500403 true true 177 132 38
Circle -7500403 true true 70 85 38
Circle -7500403 true true 130 25 38
Circle -7500403 true true 96 51 108
Circle -16777216 true false 113 68 74
Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
house
false
0
Rectangle -7500403 true true 45 120 255 285
Rectangle -16777216 true false 120 210 180 285
Polygon -7500403 true true 15 120 150 15 285 120
Line -16777216 false 30 120 270 120
leaf
false
0
Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
line
true
0
Line -7500403 true 150 0 150 300
line half
true
0
Line -7500403 true 150 0 150 150
pentagon
false
0
Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
person
false
0
Circle -7500403 true true 110 5 80
Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
Rectangle -7500403 true true 127 79 172 94
Polygon -7500403 true true 195 90 240 150 225 180 165 105
Polygon -7500403 true true 105 90 60 150 75 180 135 105
plant
false
0
Rectangle -7500403 true true 135 90 165 300
Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
sheep
false
15
Circle -1 true true 203 65 88
Circle -1 true true 70 65 162
Circle -1 true true 150 105 120
Polygon -7500403 true false 218 120 240 165 255 165 278 120
Circle -7500403 true false 214 72 67
Rectangle -1 true true 164 223 179 298
Polygon -1 true true 45 285 30 285 30 240 15 195 45 210
Circle -1 true true 3 83 150
Rectangle -1 true true 65 221 80 296
Polygon -1 true true 195 285 210 285 210 240 240 210 195 210
Polygon -7500403 true false 276 85 285 105 302 99 294 83
Polygon -7500403 true false 219 85 210 105 193 99 201 83
square
false
0
Rectangle -7500403 true true 30 30 270 270
square 2
false
0
Rectangle -7500403 true true 30 30 270 270
Rectangle -16777216 true false 60 60 240 240
star
false
0
Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
target
false
0
Circle -7500403 true true 0 0 300
Circle -16777216 true false 30 30 240
Circle -7500403 true true 60 60 180
Circle -16777216 true false 90 90 120
Circle -7500403 true true 120 120 60
tree
false
0
Circle -7500403 true true 118 3 94
Rectangle -6459832 true false 120 195 180 300
Circle -7500403 true true 65 21 108
Circle -7500403 true true 116 41 127
Circle -7500403 true true 45 90 120
Circle -7500403 true true 104 74 152
triangle
false
0
Polygon -7500403 true true 150 30 15 255 285 255
triangle 2
false
0
Polygon -7500403 true true 150 30 15 255 285 255
Polygon -16777216 true false 151 99 225 223 75 224
truck
false
0
Rectangle -7500403 true true 4 45 195 187
Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
Rectangle -1 true false 195 60 195 105
Polygon -16777216 true false 238 112 252 141 219 141 218 112
Circle -16777216 true false 234 174 42
Rectangle -7500403 true true 181 185 214 194
Circle -16777216 true false 144 174 42
Circle -16777216 true false 24 174 42
Circle -7500403 false true 24 174 42
Circle -7500403 false true 144 174 42
Circle -7500403 false true 234 174 42
turtle
true
0
Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
wheel
false
0
Circle -7500403 true true 3 3 294
Circle -16777216 true false 30 30 240
Line -7500403 true 150 285 150 15
Line -7500403 true 15 150 285 150
Circle -7500403 true true 120 120 60
Line -7500403 true 216 40 79 269
Line -7500403 true 40 84 269 221
Line -7500403 true 40 216 269 79
Line -7500403 true 84 40 221 269
wolf
false
0
Polygon -16777216 true false 253 133 245 131 245 133
Polygon -7500403 true true 2 194 13 197 30 191 38 193 38 205 20 226 20 257 27 265 38 266 40 260 31 253 31 230 60 206 68 198 75 209 66 228 65 243 82 261 84 268 100 267 103 261 77 239 79 231 100 207 98 196 119 201 143 202 160 195 166 210 172 213 173 238 167 251 160 248 154 265 169 264 178 247 186 240 198 260 200 271 217 271 219 262 207 258 195 230 192 198 210 184 227 164 242 144 259 145 284 151 277 141 293 140 299 134 297 127 273 119 270 105
Polygon -7500403 true true -1 195 14 180 36 166 40 153 53 140 82 131 134 133 159 126 188 115 227 108 236 102 238 98 268 86 269 92 281 87 269 103 269 113
x
false
0
Polygon -7500403 true true 270 75 225 30 30 225 75 270
Polygon -7500403 true true 30 75 75 30 270 225 225 270
@#$#@#$#@
NetLogo 6.0.2
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
setup
go
ticks
track-iterations
count turtles
%vaccinated-infected
%unvaccinated-infected
@#$#@#$#@
@#$#@#$#@
default
0.0
-0.2 0 0.0 1.0
0.0 1 1.0 0.0
0.2 0 0.0 1.0
link direction
true
0
Line -7500403 true 150 150 90 180
Line -7500403 true 150 150 210 180
@#$#@#$#@
1
@#$#@#$#@