Do you have any idea, what should i do with this issue? or Do you have any kind of references or sample code, etc that might help me with this problems?
Thank you for your support
Best regards
-- Dale Frakes Adjunct Instructor, PhD Candidate PSU Systems Science dfr...@pdx.edu - http://web.pdx.edu/~dfrakes/
to display-elevationgis:apply-raster elevation-dataset elevation let max-elevation gis:maximum-of elevation-dataset ask patches [ if (elevation >= -111.97) and (elevation < 441.37) [ set pcolor (approximate-rgb 56 168 0)] if (elevation >= 441.38) and (elevation < 1627.08) [ set pcolor (approximate-rgb 90 186 0)] if (elevation >= 1627.09) and (elevation < 3366.12) [ set pcolor (approximate-rgb 131 207 0)] if (elevation >= 3366.13) and (elevation < 5105.16) [ set pcolor (approximate-rgb 176 224 0)] if (elevation >= 5105.17) and (elevation < 6923.25) [ set pcolor (approximate-rgb 228 245 0)] if (elevation >= 6923.26) and (elevation < 8820.38) [ set pcolor (approximate-rgb 225 225 0)] if (elevation >= 8820.39) and (elevation < 10875.61) [ set pcolor (approximate-rgb 255 170 0)] if (elevation >= 10875.62) and (elevation < 13247.03) [ set pcolor (approximate-rgb 255 115 0)] if (elevation >= 13247.04) and (elevation < 15855.59) [ set pcolor (approximate-rgb 255 55 0)] if (elevation >= 15855.6) and (elevation < max-elevation) [ set pcolor (approximate-rgb 255 0 0)] ]end
to go if ticks >= int(3600 / tick_to_sec) [stop] ; stop after simulating an hour ; update the tsunami depth every 30 seconds if int(ticks * tick_to_sec) mod 30 = 0 [ ask patches with [depths != 0][ set depth item int(ticks * tick_to_sec / 30) depths ; set the depth to the correct item of depths list (depending on the time) if depth > max_depth [ ; monitor the maximum depth observed at each patch, for future use. set max_depth depth ] ] ; recolor the patches based on the tsunami depth, the deeper the darker the shade of blue ask patches [ let cl 99.9 - depth if cl < 90 [set cl 90] if cl > 99.9 [set cl 99.9] set pcolor cl ] ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;; RESIDENTS ;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ask residents, if they milling time has passed, to start moving ask residents with [not moving? and not dead? and miltime <= ticks][ set heading towards init_dest set moving? true ] ; ask residents that should be moving to move ask residents with [moving?][ ifelse (distance init_dest < (speed) ) [fd distance init_dest][fd speed] if distance init_dest < 0.005 [ ; if close enough to the next intersection, move the agent to it move-to init_dest set moving? false set reached? true set current_int init_dest ] ] ; check the residnet that are on the way if they have been caught by the tsunami ask residents with [not reached?][ if [depth] of patch-here > Hc [mark-dead] ] ; ask residets who have reached the network to hatch into a pedestrian or a car depending on their decision ask residents with [reached?][ let spd speed ; to pass on the spd from resident to the hatched pedestrian let dcsn decision ; to pass on the decision from the resident to either car or pedestrian if dcsn = 1 or dcsn = 3 [ ; horizontal (1) or vertical (3) evacuation - by FOOT ask current_int [ ; ask the current intersection of the resident to hatch a pedestrian hatch-pedestrians 1 [ set size 1 set shape "dot" set current_int myself ; myself = current_int of the resident set speed spd ; the speed of the resident is passed on to the pedestrian set evacuated? false ; initialized as not evacuated, will be checked immediately after being born set dead? false ; initialized as not dead, will be checked immediately after being born set moving? false ; initialized as not moving, will start moving immediately after if not evacuated and not dead if dcsn = 1 [ ; horizontal evacuation on foot set color orange set path [hor-path] of myself ; myself = current_int of the resident - Note that intersection hold the path infomration ; which passed to the pedestrians and cars set decision 1 ] if dcsn = 3 [ ; vertical evacuation on foot set color turquoise set path [ver-path] of myself ; myself = current_int of the resident - Note that intersection hold the path infomration ; which passed to the pedestrians and cars set decision 3 ] ifelse empty? path [set shelter -1][set shelter last path] ; if path list is not empty the who of the shelter is the last item of the path ; otherwise, there is no shelter destination, either the current_int is the shelter ; or due to network disconnectivity, there were no path available to any of the shelters if shelter = -1 [ if decision = 1 and [shelter_type] of current_int = "Hor" [set shelter -99] ; if the decision is horizontal evac and the list is empty since current_int is a horizontal shelter if decision = 3 and [shelter?] of current_int [set shelter -99] ; if the decision is vertical evac and the list is empty since current_int is a shelter ; basically if shelter = -99, we can mark the pedestrian as evacuated later ] st ] ] ] if dcsn = 2 or dcsn = 4 [ ; horizontal (2) or vertical (4) evacuation - by CAR ask current_int [ ; ask the current intersection of the resident to hatch a car hatch-cars 1 [ set size 1 set current_int myself ; myself = current_int of the resident set evacuated? false ; initialized as not evacuated, will be checked immediately after being born set dead? false ; initialized as not dead, will be checked immediately after being born set moving? false ; initialized as not moving, will start moving immediately after if not evacuated and not dead if dcsn = 2 [ ; horizontal evacuation by car set color sky set path [hor-path] of myself ; myself = current_int of the resident set decision 2 ] if dcsn = 4 [ ; vertical evacuation by car set color magenta set path [ver-path] of myself ; myself = current_int of the resident set decision 4 ] ifelse empty? path [set shelter -1][set shelter last path] ; if path list is not empty the who of the shelter is the last item of the path if shelter = -1 [ if decision = 2 and [shelter_type] of current_int = "Hor" [set shelter -99] ; if the decision is horizontal evac and the list is empty since current_int is a horizontal shelter if decision = 4 and [shelter?] of current_int [set shelter -99] ; if the decision is vertical evac and the list is empty since current_int is a shelter ; basically if shelter = -99, we can mark the car as evacuated later ] st ] ] ] die ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;; PEDESTRIANS ;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; check the pedestrians if they have evacuated already or died ask pedestrians with [not evacuated? and not dead?][ if [who] of current_int = shelter or shelter = -99 [mark-evacuated] if [depth] of patch-here >= Hc [mark-dead] ] ; set up the pedestrians that should move ask pedestrians with [not moving? and not empty? path and not evacuated? and not dead?][ set next_int intersection item 0 path ; assign item 0 of path to next_int set path remove-item 0 path ; remove item 0 of path set heading towards next_int ; set the heading towards the destination set moving? true ask road ([who] of current_int) ([who] of next_int)[set crowd crowd + 1] ; add the crowd of the road the pedestrian will be on ] ; move the pedestrians that should move ask pedestrians with [moving?][ ifelse speed > distance next_int [fd distance next_int][fd speed] ; move the pedestrian towards the next intersection if (distance next_int < 0.005 ) [ ; if close enough check if evacuated? dead? if neither, get ready for the next step set moving? false ask road ([who] of current_int) ([who] of next_int)[set crowd crowd - 1] ; decrease the crowd of the road the pedestrian was on set current_int next_int ; update current intersection if [who] of current_int = shelter [mark-evacuated] if [depth] of patch-here >= Hc and not evacuated? [mark-dead] ] ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;; CARS ;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; check the cars if they have evacuated already or died ask cars with [not evacuated? and not dead?][ if [who] of current_int = shelter or shelter = -99 [mark-evacuated] if [depth] of patch-here >= Hc [mark-dead] ] ; set up the cars that should move ask cars with [not moving? and not empty? path and not evacuated? and not dead?][ set next_int intersection item 0 path ; assign item 0 of path to next_int set path remove-item 0 path ; remove item 0 of path set heading towards next_int ; set the heading towards the destination set moving? true ask road ([who] of current_int) ([who] of next_int)[set traffic traffic + 1] ; add the traffic of the road the car will be on ] ; move the cars that should move ask cars with [moving?][ move-gm ; set the speed with general motors car-following model fd speed ; move if (distance next_int < 0.005 ) [ ; if close enough check if evacuated? dead? if neither, get ready for the next step set moving? false ask road ([who] of current_int) ([who] of next_int)[set traffic traffic - 1] ; decrease the traffic of the road the pedestrian was on set current_int next_int ; update current intersection if [who] of current_int = shelter [mark-evacuated] if [depth] of patch-here >= Hc and not evacuated? [mark-dead] ] ] tickend