Foot and Mouth

No preview image

1 collaborator

Default-person Hyesop Shin (Author)

Tags

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

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


Comments and Questions

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

Click to Run Model

breed [animals animal]
breed [trucks truck]
breed [farms farm]



globals
[%animals-infected
 repeat-again
 tick-in-simulation
]

turtles-own
  [ infected?
    exposed?
    exposured_length
    t_farmcode ]       ;; if true, the turtle is infectious



patches-own
[farm?
  farm_code]

farms-own
[make-farm?]

to setup
  __clear-all-and-reset-ticks


;;set road
ask patches
  [
   set pcolor brown + 3
   if (pxcor >= 10 and pxcor <= 18)   or  (pycor >= 8 and pycor <= 10)     [ set pcolor gray + 1 ]
   if (pxcor >= -15 and pxcor <= -13) or  (pycor >= 8 and pycor <= 10)     [ set pcolor gray + 1 ]
   if (pxcor >= -15 and pxcor <= -13) or  (pycor >= -18 and pycor <= -16)  [ set pcolor gray + 1 ]
;   if (pxcor >= -24 and pxcor <= -23) and (pycor >= 1 and pycor <= 7)      [ set pcolor gray ]

;;draw road lines
   if ((pycor = 9)   and ((pxcor mod 3) = 0))  [ set pcolor yellow + 2 ]
   if ((pxcor = 14)  and ((pycor mod 4) = 0))  [ set pcolor yellow + 2 ]
   if ((pycor = -17) and ((pxcor mod 3) = 0))  [ set pcolor yellow + 2 ]
   if ((pxcor = -14) and ((pycor mod 4) = 0))  [ set pcolor yellow + 2 ]
   ]


;;set fertilizer
   ask patches with [ (pxcor >= 7 and pxcor <= 9)     and  (pycor >= 8 and pycor <= 10)]     [ set  pcolor white ]
   ask patches with [ (pxcor >= 19 and pxcor <= 21)   and  (pycor >= 8 and pycor <= 10)]     [ set  pcolor white ]
   ask patches with [ (pxcor >= -15 and pxcor <= -13) and  (pycor >= 8 and pycor <= 10)]     [ set  pcolor white ]
   ask patches with [ (pxcor >= -15 and pxcor <= -13) and  (pycor >= -18 and pycor <= -16)]  [ set  pcolor white ]
   ask patches with [ (pxcor >= 7 and pxcor <= 9)     and  (pycor >= -18 and pycor <= -16)]  [ set  pcolor white ]
   ask patches with [ (pxcor >= 19 and pxcor <= 21)   and  (pycor >= -18 and pycor <= -16)]  [ set  pcolor white ]

setup-livestock
setup-animals
setup-trucks
setup-infect
end 

to setup-livestock
  create-farms Farm-Density
  let farm-list [self] of farms
  foreach farm-list [ livestock ->
    ask livestock  [
      set infected? false
      set exposed? false
      set exposured_length false

       move-to one-of patches with [
        pxcor > -28 and pxcor < 28 and pycor > -28 and pycor < 28 and
        pcolor = brown + 3 and
        mean [pcolor] of patches in-radius 2 = brown + 3 and
        count patches in-radius 3 with [pcolor = gray + 1] >= 1 and
        count farms in-radius 3 = 0]
        ask patch-here [set pcolor [color] of myself set farm? 1 set farm_code [who] of myself]
        ask neighbors  [set pcolor [color] of myself set farm? 1 set farm_code [who] of myself]
        set make-farm? 1
        set hidden? true
      ]

    ]
end 

to setup-animals
 create-animals 200
  [
    set color brown + 1
    set size 0.8
    set label-color black
    set exposed? false
    set infected? false
    let r random 2
    ifelse r = 0 [set shape "turtle"][set shape "cow"]
    setxy random-xcor random-ycor ]


  ask animals  [ifelse [farm?] of patch-here != 1 [move-to one-of patches with [farm? = 1]]
           [setxy xcor ycor]
           set t_farmcode [farm_code] of patch-here]
end 

to setup-infect
ask one-of animals with [ [farm?] of patch-here = 1] [set color red set infected? true]
end 

to setup-trucks
  set-default-shape trucks "truck"
  create-trucks 50
       [
    set color 112
    set size 1
    set exposed? false
    set infected? false
    move-to one-of patches with [pcolor = gray + 1 ]
       ]
end 

;---------------------------------------------------------------------------------------------------------------------------------------------
;---------------------------------------------------------------------------------------------------------------------------------------------

to go ;1TYM
 if (all? animals [infected? = true])  [stop]
move-around
exposure
infect
move-trucks
wash-virus
cum-plot
update-plot
tick
end 

;;;;;;;;;;;;;;;;;;;;;

to move-around
 ask animals [
    ifelse [farm?] of patch-here != 1
    [ move-to one-of patches with [farm? = 1 and farm_code = [t_farmcode] of myself]]
    [ move-to one-of patches with [farm? = 1 and farm_code = [t_farmcode] of myself]
      set heading random 360 ]]
end 

to exposure
  ask turtles with [infected? or exposed?][
  let prey one-of animals in-radius 2
   if prey != nobody
   [ ask prey [
     if (random-float 100 < prob-of-infection) and ((-100)/ 53 * temperature >= random-float 10 )
     [ set color 117 set exposed? true]]]]
end 

to infect
  let incubation (random 20)
  ask turtles with [exposed? = true]
  [ if exposured_length > incubation [
    set color red set infected? true]
    set exposured_length exposured_length + 1]

  ask trucks [
  let #infected animals in-radius 3 with [infected? = true]
  if count #infected > 0
    [ set infected? true set color red ]
  ]

  ;; Truck transmission
  ask trucks with [infected? = true] [
  let prey one-of turtles in-radius 3
          if prey != nobody [ set color red set infected? true]]
end 

to move-trucks
if (highway-effect = "highway")
    [
   ask trucks with[pxcor >= 15 and pxcor <= 16]  [set heading ( 0 ) fd 1.5]  ;Highway heading north
   ask trucks with[pxcor >= 17 and pxcor <= 18]  [set heading ( 0 ) fd 1]
   ask trucks with[pxcor >= 12 and pxcor <= 13]   [set heading ( 180 ) fd 1.5] ;Highway heading south
   ask trucks with[pxcor >= 10 and pxcor <= 11]  [set heading ( 0 ) fd 1.5]
   ask trucks with[pxcor = 14]   [set heading ( 0 + 180 * random 2 ) fd 1.5] ;Highway joongangsun
    ]

if (highway-effect = "road")
    [
   ask trucks with[pxcor >= 15 and pxcor <= 18]  [set heading ( 0 ) fd 1]  ;Highway heading north
   ask trucks with[pxcor >= 10 and pxcor <= 13]   [set heading ( 180 ) fd 1] ;Highway heading south
   ask trucks with[pxcor = 14]   [set heading ( 0 + 180 * random 2 ) fd 1] ;Highway joongangsun
    ]

; National Road(West Sero)
   ask trucks with[pxcor = -13] [set heading ( 0 ) fd 1]  ;Upper national road
   ask trucks with[pxcor = -15] [set heading ( 180 ) fd 1]  ;Upper national road
   ask trucks with[pxcor = -14] [set heading ( 0 + 180 * random 2 ) fd 1] ; Joongangsun

; National Road(North)
   ask trucks with[pycor = 8] [set heading ( (90)) fd 1]  ;Lower national roady
   ask trucks with[pycor = 10] [set heading ( 270 ) fd 1]  ;Upper national road
   ask trucks with[pycor = 9] [set heading ( 90 + 180 * random 2 ) fd 1] ; Joongangsun

; National Road(South)
   ask trucks with[pycor = -18] [set heading ( (90)) fd 1]  ;Lower national roady
   ask trucks with[pycor = -16] [set heading ( 270 ) fd 1]  ;Upper national road
   ask trucks with[pycor = -17] [set heading ( 90 + 180 * random 2 ) fd 1] ; Joongangsun


; Junction
   ask trucks with[pxcor >= -15 and pxcor <= -13 and pycor >= 8 and pycor <= 10]    [set heading (random 4 * 90 ) fd 1]
   ask trucks with[pxcor >= 10 and pxcor <= 18   and pycor >= 8 and pycor <= 10]    [set heading (random 4 * 90 ) fd 1]
   ask trucks with[pxcor >= 10 and pxcor <= 18   and pycor >= -18 and pycor <= -16] [set heading (random 4 * 90 ) fd 1]
   ask trucks with[pxcor >= -15 and pxcor <= -13 and pycor >= -18 and pycor <= -16] [set heading (random 4 * 90 ) fd 1]
end 

to wash-virus
  if wash-virus?
  [ask trucks
    [if infected? = true
    [if pcolor = white
    [if random-float 100 <  cure-rate [set color 112]]]]
  ]
end 

to update-plot
  set-current-plot "FMD Status"
  set-current-plot-pen "susceptible"
  plot (( count animals with [(color != red) and (color != 117)] ))
  set-current-plot-pen "exposed"
  ;plot (( count cows with [exposed? = true] ) + ( count pigs with [exposed? = true]))
  set-current-plot-pen "infected"
end 

to cum-plot
  set-current-plot "Cumulative plot"
  set-current-plot-pen "infected"
  plot (count animals with [infected? = true] )
end 

to-report %infected
    report (count animals with [infected? = true])
    / (count animals)  * 100
end 



;Copyright 2013 Hyesop Shin

There is only one version of this model, created 2 days ago by Hyesop Shin.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.