Reputation: 1
I'm working on a model to simulate tick bites in the Netherlands. My code is finished and now I want to use Behavior Space to generate output files. I've got two breeds in my model, 'residents' and 'tourists-2d'. From both breeds, I want to count how many turtles got a tick bite. The residents-breed is working but the tourists-breed isn't. Can anybody help me how to fix this? I think it is because my tourists-breed comes from a list but I don't know how to fix it. Even if I simply use 'count tourists-2d', the output of Behavior Space is 0.
globals [ month month-day week week-day tourist-2d-list ]
breed [ residents resident ]
breed [ tourists-2d tourist-2d ]
to setup
ca
file-close-all
reset-ticks
; ---------- Creating tourist-lists -----------
set tourist-2d-list (list 1 1 2 4 8 17 38 85 188 420 935 2086 4651 10371 18750 18750 10371 4651 2086 935 420 188 85 38 17 8 4 2 1 1)
end
to go
set month ceiling(ticks / 30)
set month-day (ticks mod 30)
set week ceiling(ticks / 7)
set week-day (ticks mod 7)
; ---------- Set tick dynamics per month ----------
if month = 13 and month-day = 1 [reset-ticks]
; ---------- Set 2-day tourist dynamics per week ----------
initialize-tourists-2d
tick
remove-tourists
end
to initialize-tourists-2d
if week-day = 6 [
if week > 14 and week < 45 [
create-tourists-2d item (week - 15) tourist-2d-list [set color pink set shape "person" setxy -14 -7 set stay-period 2 set day-counter 0 ]
]
]
end
to remove-tourists
ask tourists-2d [set day-counter (day-counter + 1)
if day-counter = stay-period [die]
]
end
Additional info to my code, tourist-2d-list is a global and tourists-2d a breed. It would be great if somebody could help me!
Upvotes: 0
Views: 159
Reputation: 9620
Please post a minimal working example for such a question. This would look like the following:
globals [tourist-2d-list week-day week]
breed [tourists-2d tourist-2d]
to setup
set tourist-2d-list (list 1 1 2 4 8 17 38 85 188 420 935 2086 4651 10371 18750 18750
10371 4651 2086 935 420 188 85 38 17 8 4 2 1 1)
reset-ticks
end
to go
if (ticks > (45 * 7)) [stop]
set week-day ticks mod 7
set week (int ticks / 7)
add-tourists
tick
end
to add-tourists
if week-day = 6 and week > 14 and week < 45 [
create-tourists-2d item (week - 15) tourist-2d-list [init-tourist]
print (count tourists-2d) ;print to debug
]
end
to init-tourist
; put initializations here
end
As you can see, the count is not zero.
Upvotes: 1