NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 NetLogo Publications
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Farsi / Persian
 Japanese
 Spanish

  Donate

NetLogo Models Library:
Code Examples/Extensions Examples/ls

(back to the library)

Model Visualizer and Plotter Example

[screen shot]

Note: If you download the NetLogo application, every model in the Models Library is included.

WHAT IS IT?

This code example shows two different ways of visualizing data from LevelSpace child models with a parent model:

  1. Through the use of plots and reporters
  2. Through drawing a phase diagram with turtles

HOW IT WORKS

The model creates the specified number of turtles who each create a Wolf Sheep Predation child model. For each GO, turtles call GO in their child model, and then move to XY coordinates that reflect the counts of wolves and sheep in their model.

HOW TO USE IT

Use NUM-MODELS to decide how many models you want. Press SETUP to create the child models, and GO to run the models and visualize them.

THINGS TO NOTICE

All models start with the same number of wolves and sheep, and roughly the same amount of grass. Even then, we see heterogeneity in their outcomes after just a few ticks.

EXTENDING THE MODEL

Try to add a heat map functionality to the model. We suggest adding a patch variable that turtles add to whenever they are on a patch, and then use the palette:scale primitive to show the spatial distribution over time.

Try to change the code so that, upon setup, all models are created with the same random seed. This will ensure that all models run in the exact same way, and all turtles will keep moving to the same places. Then create a button that sets a new random seed in each model. See how long it takes before your models are so different that you can't even tell that they were exactly the same at some point in their past.

NETLOGO FEATURES

This model uses the LevelSpace extension to create many child models programmatically from inside NetLogo. It uses Headless models, but you can view the state of each model by using the ls:show <model-id> command. If you want to view all models at the same time, try ls:show ls:models. But if you have lots of models open, this may slow down your machine considerably.

RELATED MODELS

See the Parent Model Example and the Model Interactions Example.

(back to the NetLogo Models Library)