Disaster Response

Disaster Response preview image

1 collaborator

Default-person Surya Poudel (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.0 • Viewed 233 times • Downloaded 15 times • Run 0 times
Download the 'Disaster Response' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

globals [
  totalaffected   totallowaffected   totalmidaffected   totalhighlyaffected   ;; variables to report affected population

  aidperpeople   reliefeffectiveness   ;; relief distribition
  w1  w2  w3  w4   ;; patches for each wards
  humancost financialcost   TotalCost    ;; humanitarian and financial cost
  todolist  todonow donow  workingward  reliefitems   worknow   ;; variables to execute commands

  ah am al at  dr  ;; temporary variables
  peoplesw1 peoplesw2 peoplesw3 peoplesw4   ;; peoples in each wwards

  affectedward1 affecthw1 affectmw1 affectlw1      ;; variables that store assessment results for each ward
  affectedward2 affecthw2 affectmw2 affectlw2
  affectedward3 affecthw3 affectmw3 affectlw3
  affectedward4 affecthw4 affectmw4 affectlw4

  raffectedward1 raffecthw1 raffectmw1 raffectlw1  ;; actual affected people in each ward (for reporting)
  raffectedward2 raffecthw2 raffectmw2 raffectlw2
  raffectedward3 raffecthw3 raffectmw3 raffectlw3
  raffectedward4 raffecthw4 raffectmw4 raffectlw4
  raffected1 raffected2 raffected3 raffected
  reliefneedw1  reliefneedw2   reliefneedw3  reliefneedw4   reliefneedtotal  ;; estimated relief needs (from assessment)
  ]

breed [peoples people]
breed [works workt]


works-own[
  timetodo
  worktodo
  wardno
  reliefunit


]



patches-own [
  ward

]


peoples-own [
  energy
  copingcapacity
  vulnerability
  exposure
  aidreceived
  assessedcategory
]

to Setup
  set-default-shape peoples "person"
   clear-all
    setupward
  create-peoples  population
  [
    set color Green
    setxy random-xcor random-ycor
  ]
  reset-ticks

           ;; setup properties for affected people.
  ask peoples [
    set exposure random-poisson ExposureMean
    set copingcapacity random-poisson CopingCapacityMean
    set vulnerability random-poisson VulnerabilityMean
    if exposure < 1   [ set exposure 1]    ;; minimum value for expopsure, vulnerability and coping capacity is 1.
     if vulnerability < 1      [ set vulnerability 1]
    if copingcapacity < 1 [set copingcapacity 1]
    if exposure > 10    [ set exposure 10]    ;; maximum value for expopsure, vulnerability and coping capacity is 10.
     if vulnerability > 10       [ set vulnerability 10]
    if copingcapacity > 10  [set copingcapacity 10]



   set energy exposure / 3 * vulnerability / 3 * (10 - copingcapacity + 1) / 3  ;; according to the definition of risk on inform methodology. The the coping capacity is divided by 10 to make it lack of coping capacity.

changecolor
set reliefeffectiveness 1
  ]
end 

to goslow
go
wait 1
end 

to go
if ticks >= daystorun * 24
  [ stop ]

  changecolor
  calculatecost
  calculateaffect
  recover
  tick

executecommands
end 

to sendrelief
  let txt  "Relief Items Dispached on: "
  let txt1 (ticks - remainder ticks 24) / 24
  set txt word txt txt1
  set txt word txt " Days and "
  set txt1 remainder ticks 24
  set txt word txt txt1
  set txt word txt " Hours. Expected to reach in 6 hours"
  output-print txt   ;; Display a message on output window

 if Ward-1 = true [
  create-works 1 [
    set worktodo "Relief"
    set timetodo ticks + 3 + random 3
      set reliefunit reliefunits
     set wardno 1
    hide-turtle
  ]
  set totalcost totalcost + (reliefunits * reliefcost)
  set financialcost financialcost + (reliefunits * reliefcost)

  ]

 if Ward-2 = true [
  create-works 1 [
    set worktodo "Relief"
    set timetodo ticks + 3 + random 3
        set reliefunit reliefunits
          set wardno 2
    hide-turtle
  ]
  set totalcost totalcost + reliefunits * reliefcost
      set financialcost financialcost + (reliefunits * reliefcost)
  ]

   if Ward-3 = true [
  create-works 1 [
    set worktodo "Relief"
    set timetodo ticks + 3 + random 3
        set reliefunit reliefunits

      set wardno 3
    hide-turtle
  ]
  set totalcost totalcost + reliefunits * reliefcost
      set financialcost financialcost + (reliefunits * reliefcost)
  ]

   if Ward-4 = true [
  create-works 1 [
    set worktodo "Relief"
    set timetodo ticks + 3 + random 3
        set reliefunit reliefunits
         set wardno 4
    hide-turtle
  ]
  set totalcost totalcost + reliefunits * reliefcost
    set financialcost financialcost + (reliefunits * reliefcost)
  ]
end 

to IRA   ;; assessment
  let txt  "Team deployed for Rapid Assessment on: "
  let txt1 (ticks - remainder ticks 24) / 24
  set txt word txt txt1
  set txt word txt " Days and "
  set txt1 remainder ticks 24
  set txt word txt txt1
  set txt word txt " Hours. Expect to get report by 24 hours"
  output-print txt




 if Ward-1 = true [

   create-works 1 [
    set worktodo "CIRA"
    set timetodo ticks + 19 + random 5
      set wardno 1
    hide-turtle
  ]
    set totalcost totalcost + assessment
      set financialcost financialcost + assessment
]

 if Ward-2 = true [

    create-works 1 [
    set worktodo "CIRA"
    set timetodo ticks + 19 + random 5
      set wardno 2
    hide-turtle
  ]
  set totalcost totalcost + assessment
  set financialcost financialcost + assessment
  ]

   if Ward-3 = true [

      create-works 1 [
    set worktodo "CIRA"
    set timetodo ticks + 19 + random 5
      set wardno 3
    hide-turtle
    ]
  set totalcost totalcost + assessment
set financialcost financialcost + assessment
  ]

   if Ward-4 = true [

         create-works 1 [
    set worktodo "CIRA"
    set timetodo ticks + 19 + random 5
      set wardno 4
    hide-turtle
    ]
  set totalcost totalcost + assessment
  set financialcost financialcost + assessment
  ]
end 

to getupdate

  let txt  "Requested for updates on : "
  let txt1 (ticks - remainder ticks 24) / 24
  set txt word txt txt1
  set txt word txt " Days and "
  set txt1 remainder ticks 24
  set txt word txt txt1
  set txt word txt " Hours. Expected to get in 3 hours"
  output-print txt


  if Ward-1 = true [
  create-works 1 [
    set worktodo "Update"
    set timetodo ticks + 1 + random 2
      set wardno 1
    hide-turtle
  ]
    set totalcost totalcost + updates
  set financialcost financialcost + updates
  ]

 if Ward-2 = true [
  create-works 1 [
    set worktodo "Update"
    set timetodo ticks + 1 + random 2
      set wardno 2
    hide-turtle
  ]
  set totalcost totalcost + updates
    set financialcost financialcost + updates
  ]

   if Ward-3 = true [
  create-works 1 [
    set worktodo "Update"
    set timetodo ticks + 1 + random 2
      set wardno 3
      hide-turtle
  ]
  set totalcost totalcost + updates
    set financialcost financialcost + updates
  ]

   if Ward-4 = true [
  create-works 1 [
    set worktodo "Update"
    set timetodo ticks + 1 + random 2
      set wardno 4
      hide-turtle ]
  set totalcost totalcost + updates
    set financialcost financialcost + updates
    ]
end 

to recover
  ask peoples
  [
    set energy  energy + ((copingcapacity / (baserecoveryperiod * vulnerability) ) / 24 )  ;; people will recovery themselves.
  ]
  let peopleswithaid peoples with [aidreceived >= 1]

    ask peopleswithaid

    [set energy energy + ((copingcapacity * aidreceived ) / (24 * baserecoveryperiod ) * reliefeffectiveness)  ;; The affected people are expected to use the available relief for the base recovery period and they will recover according to their coping capacity and vulnerability. divided by 24 to change make the change in in hour.
      set aidreceived aidreceived - (aidreceived / baserecoveryperiod)  ;;
      ]

  ;; if they have relief units
end 

to radiomessage
let txt "ALERT: "


  ifelse event = "Earthquake" [
  Set txt word txt "An earthquake of Magnitude "
 let mag 7 + random 10 / 10
    set txt word txt mag
  set txt word txt " occured near "]

[

  Set txt word txt "A huge flood has affected part of "]
   set txt word txt targetdistrict
    set txt word txt " District today. Four wards of "
    set txt word txt municipality
    set txt word txt " are highly affected."

    output-print txt
end 

to changecolor    ;; change the colour of the agents based on their energy ; Red- high, yellow - medium, blue - low. Green: not affected
  ask peoples [
  set color Green
  if energy <= 9
  [set color Blue]
   if energy <= 6
  [set color Yellow]
    if energy <= 3
  [set color Red]
  ]

  set totalaffected count peoples with [energy <= 9 ]    ;; count total
  set totallowaffected count peoples with [(energy <= 9) and (energy > 6)]
  set totalmidaffected count peoples with [(energy <= 6) and (energy > 3)]
  set totalhighlyaffected count peoples with [energy <= 3]
end 

to calculateaffect

  calculateaffected [ 1 ]
      set raffectedward1 raffected
  set  raffecthw1 raffected1
  set raffectmw1 raffected2
  set raffectlw1 raffected3

  calculateaffected [ 2 ]
      set raffectedward2 raffected
  set  raffecthw2 raffected1
  set raffectmw2 raffected2
  set raffectlw2 raffected3

  calculateaffected [ 3 ]
      set raffectedward3 raffected
  set  raffecthw3 raffected1
  set raffectmw3 raffected2
  set raffectlw3 raffected3


  calculateaffected [ 4 ]
      set raffectedward4 raffected
  set  raffecthw4 raffected1
  set raffectmw4 raffected2
  set raffectlw4 raffected3
end 

to calculatecost
  let cost (totalhighlyaffected * humcost * 1.5 + totalmidaffected * humcost + totallowaffected * .5) / 24
  set humancost humancost + cost
  set totalcost totalcost + cost
end 

to calculateaffected [ wardn ]


 let w item 0 wardn

  let peoplesaffected peoples-on patches with [ward = w]

    ; peoples clafficied according to enrgy and coping capacity.


    if any? peoplesaffected [
  ask peoplesaffected
    [
        set raffected1 count peoplesaffected with [energy <= 3]
         set raffected2 count peoplesaffected with [energy > 3 and energy <= 6 ]
         set raffected3 count peoplesaffected with [energy > 6 and energy <= 9 ]
        set raffected (raffected1 + raffected2 + raffected3)
    ]    ]
end 

to setupward
  clear-patches
   ask patches with [pycor > 0.1 and pxcor < 0.1 ]
 [ set ward 1  ]
ask patches with [pycor > 0.1 and pxcor > 0.1]
 [set ward 2 ]
ask patches with [pycor < 0.1  and pxcor < 0.1]
 [set ward 3  ]
ask patches with [pycor < 0.1  and pxcor > 0.1 ]
 [set ward 4 ]

create-turtles 1  ;; draw a border line between the wards
 ask turtles  [
   setxy 0 16
  pen-down
    set heading 180
    fd 32
    pen-up
    setxy -16 0
    set heading 90
    pen-down
    fd 32
    die
  ]
                        ;; name the wards
   set w1 patches with [ward = 1 ]
      set w2 patches with [ward = 2 ]
     set w3 patches with [ward = 3 ]
   set w4 patches with [ward = 1 ]

  set peoplesw1 peoples-on w1
  set peoplesw2 peoples-on w2
    set peoplesw3 peoples-on w3
  set peoplesw4 peoples-on w4
  radiomessage   ;; send the message for initial event.
end 

to executecommands
                                ;; relief today
  set todonow works with [worktodo = "Relief" and timetodo = ticks and wardno = 1]
  if any? todonow
  [  distributerelief [ 1 ]]

  set todonow works with [worktodo = "Relief" and timetodo = ticks and wardno = 2]
  if any? todonow
  [ distributerelief [2]]

   set todonow works with [worktodo = "Relief" and timetodo = ticks and wardno = 3]
  if any? todonow
  [distributerelief [ 3 ]]

   set todonow works with [worktodo = "Relief" and timetodo = ticks and wardno = 4]
  if any? todonow
  [  distributerelief [4]]


  ;; collect Assessment  data

  set todonow works with [worktodo = "CIRA" and timetodo = ticks and wardno = 1]
  if any? todonow
  [  collectIRA [ 1 ]
  set affecthw1 ah
    set affectmw1 am
    set affectlw1 al
    set affectedward1 at
      set reliefneedw1 dr
  ]

  set todonow works with [worktodo = "CIRA" and timetodo = ticks and wardno = 2]
  if any? todonow
  [ collectIRA [2]
  set affecthw2 ah
    set affectmw2 am
    set affectlw2 al
    set affectedward2 at
      set reliefneedw2 dr
  ]

   set todonow works with [worktodo = "CIRA" and timetodo = ticks and wardno = 3]
  if any? todonow
  [collectIRA [ 3 ]
  set affecthw3 ah
    set affectmw3 am
    set affectlw3 al
    set affectedward3 at
      set reliefneedw3 dr
  ]

   set todonow works with [worktodo = "CIRA" and timetodo = ticks and wardno = 4]
  if any? todonow
  [  collectIRA [4]
  set affecthw4 ah
    set affectmw4 am
    set affectlw4 al
    set affectedward4 at
  set reliefneedw4 dr

  ]
  ;; collect udpates
set todonow works with [worktodo = "Update" and timetodo = ticks and wardno = 1]
  if any? todonow
  [  askupdate [ 1 ]]

  set todonow works with [worktodo = "Update" and timetodo = ticks and wardno = 2]
  if any? todonow
  [ askupdate [2]]

   set todonow works with [worktodo = "Update" and timetodo = ticks and wardno = 3]
  if any? todonow
  [askupdate [ 3 ]]


   set todonow works with [worktodo = "Update" and timetodo = ticks and wardno = 4]
  if any? todonow
  [ askupdate [4]]
end 

to askupdate [wardn]
  let w item 0 wardn
    ask todonow [

    let peoplesaffected peoples-on patches with [ward = w]
        if any? peoplesaffected [
  ask peoplesaffected

    [
        set ah count peoplesaffected with [energy <= 9]
    ]]



  let recoveredpeople peoplesaffected with [energy > 9]
  ask recoveredpeople [
    set assessedcategory 4
  ]

  let newpeople peoplesaffected with [energy <= 9 and assessedcategory = 4]  ;; check there are if any new peopole still affected (reserved for additional inject after initial event
  ask newpeople [
  if energy <= 3 [set assessedcategory 1]
  if (energy > 3 and energy <= 6) [set assessedcategory 2]
  if (energy > 6 ) [set assessedcategory 3]

  ]]


 let txt "Update: "
  let txt1 ah
  set txt word txt txt1
  set txt word txt " Peoples still remain affected in ward "
  set txt word txt w

  output-print txt
end 

to collectIRA [wardn]

 let w item 0 wardn
  ask todonow [
  let peoplesaffected peoples-on patches with [ward = w]

    ; peoples clafficied according to enrgy and coping capacity.


    if any? peoplesaffected [
  ask peoplesaffected
    [



        set ah count peoplesaffected with [energy <= 3]
         set am count peoplesaffected with [energy > 3 and energy <= 6 ]
         set al count peoplesaffected with [energy > 6 and energy <= 9 ]
        set at (ah + am + al)
        set dr (((baserecoveryperiod  / (copingcapacitymean * reliefeffectiveness)) * al * 1 ) + ((baserecoveryperiod  / (copingcapacitymean * reliefeffectiveness)) * am * 2 ) + (baserecoveryperiod / (copingcapacitymean * reliefeffectiveness)) * ah * 3 )


        if energy <= 3 [set assessedcategory 1]
        if (energy > 3 and energy <= 6) [set assessedcategory 2]
        if (energy > 6 and energy <= 9) [set assessedcategory 3]
        if (energy > 9) [set assessedcategory 4]




    ]



    ]

  ]
end 

to distributerelief  [ wardn ]
  let w item 0 wardn
;;      if wardn > 0 [
  ask todonow [
  let peoplereceiving peoples-on patches with [ward = w]



    if any? peoplereceiving [
   ;; check if assessment is done already
      let ifassessed count peoplereceiving with [assessedcategory > 0]
    ifelse ifassessed < 1 [

    let aidpercapita reliefunit / count peoplereceiving
  ask peoplereceiving
    [
      set aidreceived aidreceived + aidpercapita
    ]]

      [
        let hiap peoplereceiving with [assessedcategory = 1]
        let meap peoplereceiving with [assessedcategory = 2]
        let loap peoplereceiving with [assessedcategory = 3]
        let denominator (count hiap * 3 + count meap * 2 + count loap * 1)
        let aidhigh  reliefunit * 3 / denominator
         let aidmid  reliefunit * 2 / denominator
         let aidlow  reliefunit * 1 / denominator

        ask hiap [set aidreceived aidreceived + aidhigh]
        ask meap [set aidreceived aidreceived + aidmid]
          ask loap [set aidreceived aidreceived + aidlow]


    ]]



  ]
 ;; ]

;; priortized relief : High 50%, medium .33 low .17
end 

There is only one version of this model, created almost 5 years ago by Surya Poudel.

Attached files

File Type Description Last updated
Disaster Response.png preview Preview for 'Disaster Response' almost 5 years ago, by Surya Poudel Download

This model does not have any ancestors.

This model does not have any descendants.