netlogo multiple catchment area using neighbors

Hi i'm new to netlogo programming, i have a few problems.. i'm tring to make a model where the turtles are created in a delimited areas named home-patches and have to go in other delimited areas named security-patches. now i want that the turtles go in this security-patches using a catchment-area. the problem is that i've made 10 different security-patches with an area of 3*3 patches and i've generated the catchment-area using this code

ask security-patches [set catchment-area other patches in-radius catchment-radius ]

i used the "in-radius" command to set the radius of the c-area and catchment-radius is a slider in the interface

the problem is that it create only one cathcment-area in only one patch of the security-patches choosen randomly

if it could be useful here is how i set the security-patches and the home-patches

set security-patches patches with 
   [(pxcor <= 3 and pycor <= 3) 
or (pycor >= 13 and pycor <= 16 and pxcor <= 3) 

or (pxcor <= 3 and pycor >= 26) 

or (pxcor >= 20 and pxcor <= 24 and pycor >= 26) 
or (pxcor >= 20 and pxcor <= 24 and pycor <= 3)
or (pxcor >= 67 and pycor >= 13 and pycor <= 16)
or (pxcor >= 49 and pxcor <= 53 and pycor >= 26)
or (pxcor >= 49 and pxcor <= 53 and pycor <= 3)
or (pxcor >= 67 and pycor <= 3)
or (pxcor >= 67 and pycor >= 26)]


 set home-patches patches with 
   [(pycor > 3 and pycor < 13) 
or ( pycor > 16 and pycor < 26) 
or (pxcor > 10 and pxcor < 20) 
or (pycor >= 13 and pycor <= 16 and pxcor >= 4 and pxcor <= 10)
or (pxcor > 3 and pxcor < 6 and pycor <= 3)
or (pxcor > 3 and pxcor < 6 and pycor >= 26)
or (pxcor >= 20 and pxcor < 67 and pycor >= 13 and pycor <= 16)
or (pxcor >= 6 and pxcor <= 10 and pycor >= 26)
or (pxcor >= 6 and pxcor <= 10 and pycor <= 3)
or (pxcor > 24 and pxcor < 49 and pycor >= 26)
or (pxcor > 53 and pxcor < 67 and pycor >= 26)
or (pxcor > 24 and pxcor < 49 and pycor <= 3)
or (pxcor > 53 and pxcor < 67 and pycor <= 3)]

i've set the dimensions of the world 70*30

Upvotes: 0

Views: 115

Answers (1)

drstein
drstein

Reputation: 1113

I tried your code. First I used the catchment-area as a global variable and the world behave as you specified, then I tried to set the catchment area as an own of every single patch so that every single patch has one associated:

patches-own[
  catchment-area
]

So now using the command you wrote to set the catchment areas you set them only for the security-patches and each one of them has a catchment area equals to the patches in-radius catchment-radius. I hope this solution can work for your purpose.

Upvotes: 1

Related Questions