Wednesday, March 19, 2008

Experimenting with the built in NetLogo models

This tutorial shows how to load, manipulate and alter a simple simulation model that comes with NetLogo.

NetLogo for classrooms tutorial # 1 from John Drake on Vimeo.

Here are two sets of exercises based on this tutorial.

Exercise set 1. Experiments with models

  • Open the module the social science model Traffic Basic.

  • Click the Information tab and read about the model.

  • Answer the following questions based on the “What is it” section of the Information tab:

    • What causes a car to speed up? _______________________________________

    • What causes a car to slow down? _____________________________________

    • What is the model attempting to demonstrate? ___________________________

________________________________________________________________

  • Read the “How to use it” section of the Information tab. Then click back on the Interface tab.

  • Click the setup button. What happens? ___________________________________

  • Click go and notice what happens. Click go again to pause the simulation.

  • Try adjusting the number of cars slider. When you do press setup to create the cars then go to run the simulation and go again when you're ready to stop. What happens to the traffic flow when you increase the number of cars? _________________ What happens when you decrease the number of cars? ______________________

  • Try adjusting the acceleration and deceleration sliders as well. What happens when you increase the accelerator? _______________ What about when you decrease the accelerator? ______________ What happens when you increase the decelerator? ________________ What happens when you decrease the delecrator.


Exercise set 2. Making changes to the model

  • Right click on the red car. Choose the option “turtle-8 -> turtle-8-> Inspect turtle 8”

  • Find the line in the turtle inspector that says “Shape – car”. Change “car” to “airplane”.

  • Experiment with using various other shapes.

  • In the observer command line type

    • ask turtles [set shape “airplane”]

    • Describe what happened _____________________________________________

  • In the turtle command line type

    • set shape “truck”

    • What happened now? ________________________________________________



  • In the observer command line type

    • ask turtle 8 [set shape “turtle”]

    • What happened? ____________________________________________________

  • Click the setup button again. What shape is everything now? ___________________

  • In the observer command line type

    • ask patches [set color yellow]

    • What happened? _____________________________________________

  • In the patches command type

    • set color blue

  • In the observer window type the following:

    • ask patch 0 0 [set pcolor red]

    • ask patch 0 1 [set pcolor white]

    • ask patch 0 -1 [set pcolor white]

    • ask patch 1 0 [set pcolor white]

    • ask patch -1 0 [set pcolor white]

  • Press setup again. What happened to the colors? ________________________

  • Note that anytime setup is pressed the simulation runs back to its original state.

  • To make a permanent changes, click on the procedures tab. Then find the line that says:

    • set-default-shape turtles "car"”

    • set-default-shape turtles "ariplane"”

  • Click go again. What happened? ______________________________________

  • Please note, when you exit NetLogo and it asks you if you want to make any changes click discard.



No comments: