Traffic Model on google map
Model was written in NetLogo 5.0.4
•
Viewed 2599 times
•
Downloaded 143 times
•
Run 0 times
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
Click to Run Model
;; SIMULACI�N TR�FICO CUMBAY� ;; Autor: V�ctor Aguiar ;; Preparado para Seminario de Investigaci�n. ;; Versi�n: 18 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Procedimientos. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Extensi�n. extensions [ gis ] ;; Declaraci�n de Variables. globals [ mapa-dataset botadero parkusfq ;; parqueaderos botadero-cap-max park-cerrado ;; parqueadero cerrado roads wall river obst bosque my-neighbors entrada1 entrada2 entradab1 entradab2 limite1 limite2 semaforo1 semaforo1b semaforo2 semaforo3 ;; sem�foro interseccion interseccion2 interseccion3 ;; interseccion autos van a USFQ interseccionb1 interseccionb2 interseccionb3 counter ratio-vista angle-vista ;; variables para autos speed-limit acceleration ] ;; counter ;; Espec�ficas patches-own [mapa] ;; Razas breed [guias guia] breed [USFQ usfq1] breed [cars car] ;; Carros que van a USFQ breed [cars2 car2] ;; Carros que van a Quito breed [cars3 car3] ;; Carros que van a Quito breed [salidas salida] breed [semaforos semaforo] ;; objetivos cars-own [direction speed target parked? ] cars2-own [direction speed target parked? ] semaforos-own [id] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; MAPA DE GOOGLE MAPS OPENSTREET DE CUMBAY�: RASTER. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; NOTAR QUE SE CARGA UN ARCHIVO asc o raster de GIS, generado en R, ;; El c�digo de R utiliza RgoogleMaps, est� adjunto en la carpeta. to setup reset-ticks clear-turtles clear-patches clear-drawing clear-all-plots clear-output ; Note that setting the coordinate system here is optional, as ; long as all of your datasets use the same coordinate system. ; Load all of our datasets set mapa-dataset gis:load-dataset "pngmap_B1.asc" gis:set-world-envelope (gis:envelope-union-of (gis:envelope-of mapa-dataset)) setparameters end ;; Poner los par�metros principales. to setparameters set ratio-vista 12 ;;set angle-vista 60 set angle-vista 70 set speed-limit .7 set acceleration .009 set park-cerrado [] end ;; Agentes fijos to setfijos ask patches with [ pxcor = -13 and pycor = -21 ] [sprout-semaforos 1 [set id 1 set size 10 set pcolor red] ] ;; Sem�foro 2: calle principal a USFQ ask patches with [ pxcor = -5 and pycor = 8 ] [sprout-semaforos 1 [set id 2 set size 10 set pcolor red] ] ;; Sem�foro 3: calle hacia Quito o Gu�pulo. ask patches with [ pxcor = 77 and pycor = -4 ] [sprout-semaforos 1 [set id 3 set size 10 set pcolor red] ] end ;; Funci�n observer para mostrar el mapa. to display-mapa gis:paint mapa-dataset 0 end ;; Mostrar el mapa como patches to display-mapa-in-patches gis:apply-raster mapa-dataset mapa let min-mapa gis:minimum-of mapa-dataset let max-mapa gis:maximum-of mapa-dataset ask patches [ if (mapa <= 0) or (mapa >= 0) [set pcolor scale-color black mapa min-mapa max-mapa ]] end ;; Muestrar el mapa con los pathes to sample-mapa-with-patches let min-mapa gis:minimum-of mapa-dataset let max-mapa gis:maximum-of mapa-dataset ask patches [ set mapa gis:raster-sample mapa-dataset self if (mapa <= 0) or (mapa >= 0) [ set pcolor scale-color black mapa min-mapa max-mapa ] ] end ;; Hacer que las celdas del mapa GIS coincidan con los patches. to match-cells-to-patches gis:set-world-envelope gis:raster-world-envelope mapa-dataset 0 0 cd ct end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Procesamiento de Patches: caminos, r�os, bosques, y sem�foros. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Caminos: to setcaminos ask patches with [ pxcor >= 210 and pxcor <= 219 and pycor >= -19 and pycor <= -9 ] [set pcolor 9.411764705882353] ;; correcci�n parte USFQ set roads patches with [pcolor >= 9.5 or pcolor = 6.627450980392156 or pcolor = 9.254901960784315 ] ;; or pcolor = 0.6666666666666666 ;;set roads patches with [pcolor != 9.490196078431373 ] ask roads [ set pcolor green ] set wall patches with [pcolor != green] set river patches with [ pcolor >= 6 and pcolor <= 8] ask river [set pcolor blue] ask river [cambiar2] set bosque patches with [ pcolor = 5.529411764705882] ask bosque [ set pcolor gray] set obst patches with [ pcolor != 9.490196078431373 and pcolor != green and pcolor != blue and pcolor != gray and pcolor != 9.411764705882353] ask obst [set pcolor yellow] ;;ask obst [cambiar1] end to cambiar1 set my-neighbors patches in-radius 5 if (count my-neighbors with [ pcolor = green] > 10) [ask self [set pcolor green]] end to cambiar2 set my-neighbors patches in-radius 7 if (count my-neighbors with [ pcolor = 9.490196078431373 ] > 5) [ask self [set pcolor 9.490196078431373 ]] end ;; Partes de caminos to clean-up ask patches with [pxcor <= 210 and pxcor >= 200 and pycor >= -18 and pycor <= -10] [ set pcolor green ] ask patches with [pxcor <= -166 and pxcor >= -175 and pycor >= -43 and pycor <= -37 ] [set pcolor green] ask patches with [ pxcor <= 194 and pxcor >= 191 and pycor <= -43 and pycor >= -46] [set pcolor green] ask patches with [ pxcor <= 92 and pxcor >= 88 and pycor <= -26 and pycor >= -31] [set pcolor green] ask patches with [ pxcor >= 150 and pxcor <= 164 and pycor <= -153 and pycor >= -194] [set pcolor green] ask patches with [ pxcor >= -64 and pxcor <= -57 and pycor >= 32 and pycor <= 36] [set pcolor green] ask patches with [ pxcor >= 159 and pxcor <= 161 and pycor >= -102 and pycor <= -98] [set pcolor green] ask patches with [ pxcor >= 172 and pxcor <= 179 and pycor <= -96 and pycor >= -106] [set pcolor green] ask patches with [ (pxcor >= 177 and pxcor <= 181 and pycor <= -81 and pycor >= -91)] [set pcolor green] set roads patches with [pcolor = green] end ;; Parqueaderos. to set-parqueaderos set botadero patches with [ pycor <= 42 and pycor >= 35 and pxcor >= 150 and pxcor <= 160 ] ask botadero [ set pcolor blue ] ;;set parkusfq patches with [ pxcor >= 210 and pxcor <= 219 ;; and pycor >= -19 and pycor <= -9 ] set parkusfq patches with [ pxcor >= 200 and pxcor <= 207 and pycor <= -28 and pycor >= -36 ] ask parkusfq [set pcolor blue] end ;; Entradas de los autos y l�mites d�nde la simulaci�n termina. to set-entradas ;;set entrada1 patches with [pxcor = -265 and pycor = 195] ;;ask entrada1 [ set pcolor blue] set entrada1 patches with [ (pxcor = -60 and pycor = 25) ;; entrada Puente. ;;or (pxcor = -132 and pycor = 194) or ( pxcor = -209 and pycor = -54) ;; entrada av. Conquistadores ] ask entrada1 [ set pcolor blue ] set entrada2 patches with [pxcor = -132 and pycor = 194] ask entrada2 [ set pcolor blue] ;; Entradas autos v�a a Quito. set entradab1 patches with [(pxcor = 297 and pycor = 23) or (pxcor = 164 and pycor = -167) ] ask entradab1 [set pcolor magenta] end to set-limitesfijos set limite1 patches with [ (pxcor = -267 and pycor >= 184 and pycor <= 195) or (pxcor = 305 and pycor >= 14 and pycor <= 27) or (pxcor = -214 and pycor >= -55 and pycor <= -43 ) or (pycor = -247 and pxcor >= 210 and pxcor <= 235 ) or (pycor = -172 and pxcor >= 149 and pxcor <= 164)] ask limite1 [ set pcolor magenta] end ;;Sem�foros V�a principal, Carros V�a USFQ. to setsemaforos set semaforo1 patches with [ pxcor <= -9 and pxcor >= -11 and pycor <= 9 and pycor >= -3] ask semaforo1 [ifelse (luces = TRUE) [set pcolor red ask semaforos with [ id = 2 ] [set color red] ] [set pcolor green ask semaforos with [ id = 2 ] [set color green]] ] ;; Pone la luz del sem�foro 1 en verde ;; Sem�foro Conquistadores, Carros V�a USFQ. set semaforo1b patches with [ pxcor = -22 and pycor <= -6 and pycor >= -16] ask semaforo1b [ifelse (luces = TRUE) [set pcolor green ask semaforos with [ id = 1 ] [set color green] ] [set pcolor red ask semaforos with [ id = 1 ] [set color red]] ] ;; Sem�foro V�a Principal V�a a Quito. set semaforo2 patches with [ pxcor = 82 and pycor <= -8 and pycor >= -13] ask semaforo2 [ifelse (luces = TRUE) [set pcolor green ask semaforos with [ id = 3 ] [set color green] ] [set pcolor violet ask semaforos with [ id = 3 ] [set color red]] ] ;; ABERTURA INTERSECCI�N DE LA V�A PRINCIPAL. ifelse (luces = TRUE) [ ask patches with [ (pxcor = -3 and pycor <= -5 and pycor >= -17)] [set pcolor green] let abertura patches with [ (pxcor = -3 and pycor <= -5 and pycor >= -17)] set interseccion patches with [member? self interseccion and not member? self abertura] set interseccion2 patches with [member? self interseccion2 and not member? self abertura] set interseccion3 patches with [member? self interseccion3 and not member? self abertura] ] [setinterseccion] end ;;Intersecciones to setinterseccion set interseccion patches with [ (pxcor = -3 and pycor <= -5 and pycor >= -19) or (pxcor >= 53 and pxcor <= 60 and pycor = -20 ) or (pxcor >= 87 and pxcor <= 95 and pycor = -30 ) or (pxcor >= 120 and pxcor <= 129 and pycor = -43 ) or (pxcor >= 168 and pxcor <= 196 and pycor = -69 ) or (pxcor = 196 and pycor >= -69 and pycor <= -49) or (pxcor <= -163 and pxcor >= -171 and pycor = -37) or (pxcor = -171 and pycor <= -37 and pycor >= -41) or (pycor = -41 and pxcor <= -171 and pxcor >= -175) or (pxcor = -175 and pycor <= -41 and pycor >= -44) or (pycor = -16 and pxcor >= -50 and pxcor <= -43) or (pycor = -19 and pxcor <= -4 and pxcor >= -11) or (pycor = -18 and pxcor <= -4 and pxcor >= -11) or (pxcor = 225 and pycor <= 23 and pycor >= 10) ;; interseccion v�a Botadero. or (pycor = 25 and pxcor >= 218 and pxcor <= 226) or (pycor = 37 and pxcor <= 199 and pxcor >= 192) or (pycor = 45 and pxcor >= 170 and pxcor <= 178) or (pycor = 58 and pxcor >= 141 and pxcor <= 148) or (pxcor = 137 and pycor >= 41 and pycor <= 49) ] ask interseccion [set pcolor blue] ;; Intersecci�n 2: Para los que van a Tumbaco. set interseccion2 patches with [ (pxcor = -3 and pycor <= -5 and pycor >= -19) or (pxcor >= 53 and pxcor <= 60 and pycor = -20 ) or (pxcor >= 87 and pxcor <= 95 and pycor = -30 ) or (pxcor >= 120 and pxcor <= 129 and pycor = -43 ) or (pxcor = 146 and pycor >= -191 and pycor <= -178 ) or (pxcor = 161 and pycor >= -95 and pycor <= -89 ) or (pxcor <= -163 and pxcor >= -171 and pycor = -37) or (pxcor = -171 and pycor <= -37 and pycor >= -41) or (pycor = -41 and pxcor <= -171 and pxcor >= -175) or (pxcor = -175 and pycor <= -41 and pycor >= -44) or (pycor = -16 and pxcor >= -50 and pxcor <= -43) or (pycor = -19 and pxcor <= -4 and pxcor >= -11) or (pycor = -18 and pxcor <= -4 and pxcor >= -11)] ask interseccion2 [set pcolor yellow] ;; Intersecci�n 3: set interseccion3 patches with [ (pxcor = -3 and pycor <= -5 and pycor >= -19) or (pxcor >= 53 and pxcor <= 60 and pycor = -20 )] ask interseccion3 [ set pcolor magenta] ;; Intersecci�n 1b carros Quito set interseccionb1 patches with [ (pycor = 24 and pxcor <= 301 and pxcor >= 289) or (pycor = 25 and pxcor >= 218 and pxcor <= 226) ;; interseccion v�a Botadero. or (pycor = 37 and pxcor <= 199 and pxcor >= 192) or (pycor = 45 and pxcor >= 170 and pxcor <= 178) or (pycor = 58 and pxcor >= 141 and pxcor <= 148) or (pycor = 13 and pxcor >= 250 and pxcor <= 258) or (pycor = 9 and pxcor <= 75 and pxcor >= 68) ] ask interseccionb1 [set pcolor pink] ;; Intersecci�n 2b carros a USFQ desde TUMBACO set interseccionb2 patches with [ (pxcor = 176 and pycor <= -93 and pycor >= -107) or (pycor = -93 and pxcor >= 176 and pxcor <= 180) or (pxcor = 196 and pycor <= -49 and pycor >= -68) or (pycor = -44 and pxcor >= 188 and pxcor <= 195) or (pycor = 1 and pxcor >= 66 and pxcor <= 77) ] ask interseccionb2 [set pcolor lime] ;; interseccion v�a Botadero. ;; Intersecci�n 3b carros desde TUMBACO HACIA GU�PULO. set interseccionb3 patches with [ (pxcor = 176 and pycor <= -93 and pycor >= -107) or (pycor = -93 and pxcor >= 176 and pxcor <= 180) or (pxcor = 196 and pycor <= -49 and pycor >= -68) or (pycor = -44 and pxcor >= 188 and pxcor <= 195) ;;or (pycor = 1 and pxcor >= 66 and pxcor <= 77) or (pycor = -7 and pxcor >= -4 and pxcor <= 79) ] ask interseccionb3 [set pcolor sky] ;; interseccion v�a Botadero. end ;; Formas de Agentes to setshapes set-default-shape cars "car" set-default-shape cars2 "car2" set-default-shape semaforos "circle" end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Agentes: carros, gu�as y destinos. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Agentes ;; Carros llegan a la zona en cada tick to setcars ask entrada1 [sprout-cars 1 [ set direction 1 set size 10 set parked? false set target random 4] ] ask entradab1 [sprout-cars2 1 [ set direction 1 set size 10 set parked? false set target random 4] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Cambio de velocidad con visi�n de cono. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; para si hay alg�n auto en un ratio to set-speed2 [ ratio anglei ] ;; turtle procedure ;; get the turtles on the patch in front of the turtle let cars-ahead cars in-cone ratio anglei with [ parked? = false] ;; if there are turtles in front of the turtle, slow down ;; otherwise, speed up ifelse count(cars-ahead) >= 2 [ ifelse count(cars-ahead) >= 2 [ set speed 0 ] [ set speed [speed] of one-of cars-ahead slow-down2 ] ] [ speed-up2 ] end ;; decrease the speed of the turtle to slow-down2 ;; turtle procedure ifelse speed <= 0 ;;if speed < 0 [ set speed 0 ] [ set speed speed - acceleration ] end to speed-up2 ;; turtle procedure ifelse speed > speed-limit [ set speed speed-limit ] [ set speed speed + acceleration ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Funci�n para que choquen los autos. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Para carros que van USFQ. to collide ;; Si los autos est�n cerca en un ratio menor que if (count(cars) > 2) [ if (parked? = false) [ let distancia-vecino distance min-one-of other cars with [parked? = false] [distance myself] if (distancia-vecino < ratio-vista - (ratio-vista / 2)) [ask min-one-of other cars with [parked? = false] [distance myself] [die] ask self [die] ] ] ] end ;; Para carros que van a Quito. to collide2 ;; Si los autos est�n cerca en un ratio menor que if (count(cars2) > 2) [ if (parked? = false) [ let distancia-vecino distance min-one-of other cars2 with [parked? = false] [distance myself] if (distancia-vecino < ratio-vista - (ratio-vista / 2)) [ask min-one-of other cars2 with [parked? = false] [distance myself] [die] ask self [die] ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Agentes: carros, gu�as y destinos. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Movimiento de los autos ;; REPORTE DE LOS L�MTES DEL CAMINO ;; Tomado de Ejercicios de inteligencia artificial. ;; Comportamiento de laberinto, mano en pared. ;; Funci�n, que reporta si hay una pared ;; Pared para cars que van a la USFQ. to-report wall1? [angle dist] ;; note that angle may be positive or negative. if angle is ;; positive, the turtle looks right. if angle is negative, ;; the turtle looks left. let patch-color patch-right-and-ahead angle dist if (target = 0 ) [report not ( member? patch-color roads or member? patch-color semaforo1 or member? patch-color botadero or member? patch-color parkusfq) or member? patch-color interseccion ] if (target = 1 ) [report not ( member? patch-color roads or member? patch-color semaforo1 or member? patch-color botadero or member? patch-color parkusfq) or member? patch-color interseccion2 ] if (target = 2 ) [report not ( member? patch-color roads or member? patch-color semaforo1 or member? patch-color botadero) or member? patch-color interseccion or member? patch-color parkusfq ] if (target = 3 ) [report not ( member? patch-color roads or member? patch-color semaforo1 ) or member? patch-color interseccion3] end ;; Pared para los autos que van a Quito. ;; Pared para cars que van a la USFQ. to-report wall2? [angle dist] ;; note that angle may be positive or negative. if angle is ;; positive, the turtle looks right. if angle is negative, ;; the turtle looks left. let patch-color patch-right-and-ahead angle dist if (target = 0 ) [report not ( member? patch-color roads or member? patch-color semaforo1 or member? patch-color botadero or member? patch-color parkusfq) or member? patch-color interseccionb1 or member? patch-color interseccionb2 ] if (target = 1 ) [report not ( member? patch-color roads or member? patch-color semaforo1 or member? patch-color botadero or member? patch-color parkusfq) or member? patch-color interseccionb1] ;; or member? patch-color interseccionb2 ] if (target = 2 ) [report not ( member? patch-color roads or member? patch-color semaforo1 or member? patch-color botadero) or member? patch-color interseccionb1 or member? patch-color parkusfq or member? patch-color interseccionb2 ] if (target = 3 ) [report not ( member? patch-color roads or member? patch-color semaforo1 ) or member? patch-color interseccionb1 or member? patch-color interseccionb3] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Behaviour Wall following ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to behaviour-wall-followingSP2 ; classic 'hand-on-the-wall' behaviour set-speed2 ratio-vista angle-vista if not wall1? (90 * direction) 1 and wall1? (135 * direction) (sqrt 2) ;;(speed ^ 2 + speed ^ 2)) [ rt 90 * direction ] ;; wall straight ahead: turn left if necessary (sometimes more than once) set counter 0 while [wall1? 0 1] [ lt 90 * direction set counter (counter + 1) if (counter > 100) [die] ] fd speed end ;; Comportamiento pared para carros que van Quito. to behaviour-wall-followingSP2Q set-speed2 ratio-vista angle-vista if not wall2? (90 * direction) 1 and wall2? (135 * direction) (sqrt 2) ;;(speed ^ 2 + speed ^ 2)) [ rt 90 * direction ] set counter 0 while [wall2? 0 1] [ lt 90 * direction set counter (counter + 1) if (counter > 100) [die] ] fd speed end ;; Implementa la velocidad. to salencarros ;;ask one-of cars-on botadero [move-to one-of neighbors roads ] ;; DEBO PONER CU�LES DE LOS VECINOS end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Simulaci�n de carros ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to gocarsSP ;;if (ticks mod 79) = 0 if (ticks mod 61) = 0 [setcars] tick ask cars [ ;;set direction 1 ;;Movimiento principal ifelse ([pcolor] of patch-right-and-ahead 0 1 = red or member? patch-here botadero or member? patch-here parkusfq ) [set speed 0] [behaviour-wall-followingSP2] ;; Colisi�n collide ;; Salir del mapa if (member? patch-right-and-ahead 0 1 limite1 ) [die] ] ;; Carros que van a Quito. ask cars2 [ ifelse ([pcolor] of patch-right-and-ahead 0 1 = violet or member? patch-here botadero or member? patch-here parkusfq ) [set speed 0] [behaviour-wall-followingSP2Q] ;; Colisi�n collide2 ;; Salir del mapa if (member? patch-right-and-ahead 0 1 limite1 ) [die] ] ask cars with [ member? patch-here parkusfq or member? patch-here botadero ] [ set parked? true ] ask cars2 with [ member? patch-here parkusfq or member? patch-here botadero ] [ set parked? true ] update-plot1-tipos end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; AUTOM�TICA Simulaci�n de carros ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to gocarsSPAUTO ;;if (ticks mod 79) = 0 if (ticks mod 61) = 0 [setcars] tick if (ticks mod 179) = 0 [ ifelse (LUCES = true) [set LUCES false] [set LUCES true] setsemaforos] ask cars [ ;;set direction 1 ;;Movimiento principal ifelse ([pcolor] of patch-right-and-ahead 0 1 = red or member? patch-here botadero or member? patch-here parkusfq ) [set speed 0] [behaviour-wall-followingSP2] ;; Colisi�n collide ;; Salir del mapa if (member? patch-right-and-ahead 0 1 limite1 ) [die] ] ;; Carros que van a Quito. ask cars2 [ ifelse ([pcolor] of patch-right-and-ahead 0 1 = violet or member? patch-here botadero or member? patch-here parkusfq ) [set speed 0] [behaviour-wall-followingSP2Q] ;; Colisi�n collide2 ;; Salir del mapa if (member? patch-right-and-ahead 0 1 limite1 ) [die] ] ask cars with [ member? patch-here parkusfq or member? patch-here botadero ] [ set parked? true ] ask cars2 with [ member? patch-here parkusfq or member? patch-here botadero ] [ set parked? true ] update-plot1-tipos end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Parqueaderos. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to close-parking ifelse (count turtles-on botadero >= botadero-cap-max) [set park-cerrado patches with [member? self botadero or member? self park-cerrado] ] [ set park-cerrado patches with [member? self park-cerrado and not member? self botadero] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Funciones del Observador. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Prepara el mapa raster Escala 14000 para el procesamiento y utilizaci�n. to start-up setup match-cells-to-patches sample-mapa-with-patches setcaminos set-entradas clean-up set-limitesfijos setshapes setcamino ;;display-mapa end to setcamino setinterseccion setfijos setsemaforos set-parqueaderos display-mapa end to start-agentes setcars end to update-plot1-tipos set-current-plot "Velocidad Promedio" set-current-plot-pen "avspeed" let target1num mean [speed] of cars with [ parked? = false] plot target1num ;; Parados set-current-plot "Parados" set-current-plot-pen "stopped" let stoppedvar count cars with [speed = 0 ] plot stoppedvar / count (cars) ;; Estacionados set-current-plot "Parqueados" set-current-plot-pen "parkusfqn" let parq1 count cars with [member? patch-here parkusfq ] plot parq1 end
There is only one version of this model, created over 11 years ago by Victor Aguiar.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
pngmap_B1.asc | background | map | over 11 years ago, by Victor Aguiar | Download |
screenshot_traffic_beta.jpg | jpeg | map screen | over 11 years ago, by Victor Aguiar | Download |
Traffic Model on google map.png | preview | Preview for 'Traffic Model on google map' | over 11 years ago, by Victor Aguiar | Download |
This model does not have any ancestors.
This model does not have any descendants.
pablo lopez
Create ASC map with R (Question)
I intend to use a map to model mobile phones trajectories on a map of choice. I would ask, how can I generate a street map, ASC format, as the one of this model? It is possible to have an example of how has been produced with Rgooglemap plugin? Kind regards
Posted almost 8 years ago
pablo lopez
Please upload the R code
Into the Netlogo code the author comment that the R to generate the map is into the files folder of this model but is not, at least as a separate file. Please someone could upload the R code to generate the map Regards
Posted almost 8 years ago