- Art
- Astronomy
- Biology
- Selection and Mutation Series
- Ant Patterns
- Bacterial Growth
- Bark Beetles
- Biological Buffer
- Birds Competing For Worms
- Color Bunnies
- Ecosystem - Predator, Prey, and Grass
- Ecosystem - Rabbits and Grass
- Ecosystem - Two Species
- Ecosystem With Predator, Prey, And Grass
- Forest Fire
- Honeycomb Formation
- Termites Perimeter
- Yeast Growth
- Chemistry
- Earth Science
- Mathematics
- Physics
- Social Science
Bark Beetles
Submitted by ilee on Mon, 2006-03-20 18:45. :: Category
WHAT IS IT?
This model explores bark beetle infestation in a forest. The environment in which this simulation takes place is a hilly landscape with varying conditions at different elevations. The agents are both bark beetles and trees. Trees grow better at lower elevations, but otherwise do not interact with their environments. The bark beetles randomly move around the environment and infect trees when they find them. If the tree is sufficiently unhealthy, they are able to infect it. Once it is infected, it becomes sick and gives bark beetles a place to breed. Trees still have a chance to fight off the infection and become more healthy when there is rainfall.
HOW TO USE IT
Click the Setup button to create the environment and agents. The "rain fall" slider controls how much water there initially is, dictating the trees' health. The "initial beetle infestation" slider sets how many bark beetles are created at the start of the model. The "Max number of beetle babies" slider sets how many beetles can be hatched by each beetle each year. The "moisture tendency" slider sets how much rainfall the environment tends to get. Although each year there is randomness in the moisture, this slider will change whether the environment is usually rainy or dry. The "Cycle Yearly" button moves the model forward one year (step). With each click, the beetles reproduce, move, and infect trees. The trees either fight off the infestation or succumb to it, becoming sick or dying.
THINGS TO NOTICE
How does elevation affect the way the beetle's spread? Do they tend to infest hilly (darker brown) areas or lower areas? Explore how both the initial rain fall and the moisture tendency sliders change how the bark beetles can spread.
Turtle procedures
turtles-own [health hydration beetle_count]
breeds [tree beetle]
;Beetles wander around by setting a random heading and moving forward one unit.
to random_buzz
if breed = beetle
[
setheading (random 360)
fd 1
]
end
;Whenever beetles occupy a patch with another turtle, they grab that turtle. If the beetle grabs a tree,
;it has a chance (if a random number between 0-109 is greater than the tree's health) to infest that tree,
;setting the "beatle_count" variable to 1, and making the tree sick. The beetle turtle then dies. If the
;tree cannot be infected (because it is too healthy) or there is no tree at the beetle's current patch,
;the beetle continues to ranodmly wander.
to search_and_infest
ifelse count-turtles-here > 1
[
grab one-of-turtles-here
[
ifelse (breed-of partner) = tree
[
if (random 110) > health-of partner
[
let [:current_count (beetle_count-of partner)]
setbeetle_count-of partner :current_count + 1
ask-turtle partner [update_tree_icon]
die
]
]
[
random_buzz
]
]
]
[
random_buzz
]
random_buzz
end
;After trees have been affected by beetles, this procedure checks if their shape should be changed. If
;their health is 0, they are dead. If it is between 0 and 40, they are sick. If it is above 40, they are
;healthy. If they are currently infected (so that their beetle_count variable is at least 1), the same
;rules apply for which shape they are given, but they are also shown with a beetle on them to denote infestation.
to update_tree_icon
ifelse beetle_count < 1
[
if health > 40 [setshape tree_shape]
if health <= 40 and health > 0 [setshape sick_tree]
if health <= 0 [setshape dead_tree]
]
[
if health > 40 [setshape tree&beetle]
if health <= 40 and health > 0 [setshape sick_tree&beetle]
if health <= 0 [setshape dead_tree&beetle]
]
end
;Each cycle, the trees update their own condition and have a chance to repel the beetles. If a random number
;between 0 and 99 is less than the tree's health minus 20, the beetle is killed. This is checked for every
;beetle in the tree. Also, for all living trees, their hydration is increased based on the year's hydration
;and the health is reduced based on how many beetles are infecting the tree.
to update_tree_condition
repeat beetle_count ; if there are beetles, figure out if they live or die based on tree health
[
let [:chance (random 100)]
if :chance < (health - 20)
[
setbeetle_count beetle_count - 1
]
]
if (health > 0)
[
sethydration int (this_years_moisture - 100)
sethealth (health + hydration)
sethealth (health - (5 * beetle_count))
update_tree_icon
]
end
;Each year, all infected trees hatch new bark beetles. Each beetle infecting a tree hatches up to the number
;of beetles set by the "Max number of beetle babies" slider.
to breeding_cycle
if (breed = tree and beetle_count > 0)
[
repeat (beetle_count)
[
repeat (random beetle_babies)
[
hatch [setshape bark_beetle setbreed beetle]
]
]
]
end
Observer procedures
patches-own [height]
globals [this_years_moisture year]
;Each year, the moisture is set based on the "Moisture Tendancy" slider, bark beetles look for trees to eat,
;and trees update their condition. The year is incremented each click.
to cycle_yearly
if year > 0 [ask-turtles [breeding_cycle]]
setthis_years_moisture ((100 + (tendancy * 10)) + ((random 40) - 20))
tree_search ;find trees
ask-turtles [update_tree_condition]
setyear year + 1
end
;To setup this model, everything is reset (the screen is cleared, the year is set to 1), and the hills
;are created. To do this, a single turtle is created and given a random position. The turtle then randomly
;moves one space and stamps the patch it lands on dark green until it has moved 45 times. This hill building
;is repeated six times, after which the hill building turtle is removed.
to setup
setyear 1
ca
crt 1
repeat 6 ; create foundations for hills
[
ask-turtles
[
setxy (random screen-height) (random screen-width)
setc 52 ;dark green
repeat 45
[
stamp color
seth random 360
fd 1
]
]
]
ask-turtles [die] ; end of hill foundation making
;Creates slopes for hills through difusion. The dark green patches made above are given a random height
;between 25 and 74, and this height variable is diffused out to nearby patches. Their color is then scaled
;by height value, so patches with greater height are darker brown.
ask-patches
[
if pc = 52
[
set height ((random 50) + 25)
]
]
repeat 45
[
diffuse height .9
]
ask-patches
[scale-pc brown (int (height + 1)) 10 0]
create_trees
create_beetles
clearplots
end
;Creates the number of bark beetle turtles set by the "Initial beetle infestation"
to create_beetles
create-beetle-and-do number_of_beetles
[setshape bark_beetle setbreed beetle] ; then make my shape a bark beetle
end
;To setup the forest, trees have different probabilities of sprouting based on the height of the patch.
;At lower elevation, trees have a higher chance of sprouting. Above height 10, no trees will sprout. When a
;tree sprouts, a hydration value is given based on the height and rain_fall settings. The tree's health
;is set to 10 times its hydration and is capped at 100.
;
to create_trees
ask-patches
[
if height < 10
[
if (int (height)) <= 3 and (random 10) < 7
;if height is less than 3 there is a 70% chance of sprouting
[
sprout [
setbreed tree
sethydration int ((10 - (int height)) * (rain_fall / 100))
sethealth int (10 * hydration)
if health > 100 [sethealth 100]
update_tree_icon
]
]
if ( int (height)) > 3 and (random 10) < (10 - height)
;if height is between 4 and 10 there is a 10-height probability of sprouting
[
sprout [
setbreed tree
sethydration int ((10 - (int height)) * (rain_fall / 100))
sethealth int (10 * hydration)
if health > 100 [sethealth 100]
update_tree_icon
]
]
]
]
end
;When bark beetles are looking for trees, they wander 15 times, then execute their "serach_and_infest"
;procedure 20 times.
to tree_search
ask-turtles-with (breed = beetle)
[
repeat 15 [random_buzz]
repeat 20 [search_and_infest]
die
]
end
4408 reads
