NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 References
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Japanese
 Spanish

  Donate

NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

Download
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

Try It in NetLogo Web

## WHAT IS IT?

Macal and North [WSC 2008] ABM Example, implemented as a classical time-stepped model.
The model consists of a 12 x 12 grid of patches. Each patch is 100 feet by 100 feet square. Approximately 20% of the patches are red and 80% are green. Each red patch changes to green after 10-30 minutes. Each green patch changes to red after 70-90 minutes. There are a variable number of turtles. Each turtle is randomly placed on the grid with facing of north, east, south, or west. Turtle speed is 60 feet per minute. Ticks are one minute apart. On each tick, each patch determines if it is time for it to change color and each turtle moves, if it can. If a patch changes color, then it will calculate its next color change time (10-30 minutes if it is red, 70-90 minutes iof it is green). Each turtle uses the following rules for movement:
1. A turtle will begin moving at its specific heading if, and only if, it starts on a green patch.
2. If a turtle is on a red patch, it will wait until the patch turns gree to start moving.
3. If a turtle is moving through a patch and reaches the edge, it will only enter the next patch if it is green.
4. If a turtle is travelling through a patch when it turns red, it will stop immediately. It will not move again until the patch turns green.
5. When a turtle reaches one of the edges of the grid, it exits the system, and its total time spent in the simulation is recorded.
The simulation is run until all turtles have exited, at which time statistics are calculated.

This model has been implemented as an event-driven Discrete simulation (DES). See ExampleABM_DiscreteEvent_1.nlogo and EXAPLEABM_EventDriven_2.nlogo

## HOW IT WORKS

Each time-step (tick), every patch is checked to see if it should change color and each turtle is moved according to the movement rules.

## HOW TO USE IT

The only input is the number of turtles. Notice that the average age of the turtles is independent of the number of turtles.

## THINGS TO NOTICE

The patch setup is interesting. If the model were to start with the red patch change times taken from 10-30 minute range and the green patch color change times taken from the 70-90 minute range, then all of the patches would be green by 30 minutes and stay that way until the red patches started turning red at time 70. This is more than enough time for all of the turtles to exit the grid.

This is common in simulation, where often simulations are run for a warm-up period so that the state has become randomized steay-state. Here, the expected random state can be calculated. The math is shown in a paper, _NetLogo Meets DES_, submitted to the Computational Social Science 2018 annual conference (CSS 2018).

## THINGS TO TRY

## EXTENDING THE MODEL

## NETLOGO FEATURES

## RELATED MODELS

This model has been implemented as an event-driven Discrete simulation (DES). See ExampleABM_DiscreteEvent_1.nlogo and EXAPLEABM_EventDriven_2.nlogo

## CREDITS AND REFERENCES
Original model is presented in a paper by C. M. Macal and M. J. North, _Agent-Based Modeling and Simulation: ABMS Examples_, Proceedings of the 2008 Winter Simulation Conference, (2008), pp 101-113.

This model has been coded by Emmet Beeker, ebeeker@mitre.org and Matt Koehler, mkoehler@mitre.org. Feel free to contact us with comments or questions.
July 10, 2018

(back to the NetLogo User Community Models)