NetLogo banner
 Home Page
 Download
 Models
 Community Models
 Extensions
 User Manual:
  Web version
  Printable version
 FAQ
 Resources
 Contact Us

Sample Extensions

These sample extensions demonstrate NetLogo's extensions facility, which allows Java programmers to extend NetLogo's capabilities.

For more information on using and writing your own extensions, see the Extensions section of the NetLogo User Manual.

If you have written an extension you would like to share with the NetLogo user community, please E-mail it to us at feedback@ccl.northwestern.edu and we will add it to this web page.

All extensions on this page come with complete Java source code.

NetLogo 4.0

Bundled extensions

The source code for the Array, Table, GoGo, Profiler, Sample, and Sound extensions is included with the NetLogo 4.0. Look in the extensions directory in your NetLogo installation.

Palette

This extension allows you to create multi-color gradients using rgb color lists. Additionally you can use or browse ColorBrewer color schemes.

Info and download: Palette extension for NetLogo 4.0

Speech

This Mac OS X-only extension provides speech-synthesis capabilities to NetLogo. It is implemented with a Mac OS X text-to-speech class library called A Humble Narrator.

Download: Speech extension for NetLogo 4.0

GIS

This extension provides the ability to load vector GIS data (points, lines, and polygons), and raster GIS data (grids) into NetLogo.

Info and download: GIS extension for NetLogo 4.0


User Submitted Extensions

These extensions are contributions from the user community and are not included with NetLogo. These extensions are authored by the individual contributor and are not checked by the CCL staff.

Strings (by James Steiner)

This provides NetLogo versions of a few standard Java string reporters:

  • upper-case ( ... )
  • lower-case ( ... )
  • trim (removes leading and trailing whitespace)
  • starts-with (* true if the first string matches the start of the second string)
  • ends-with (* likewise, but matches the end of the second string)
  • explode (convert string to a list of characters)
  • rex-split (split string to a list, on the given regular expression pattern)
  • rex-replace-first (replaces the first match of the pattern in the string with another string)
  • rex-replace-all (like replace-first, but replaces all pattern matches)
  • rex-match (reports true if the pattern exactly matches the string)
  • from-file (** reports the entire file contents as a single string)
  • message-digest-5 (reports the md5 hash of the string)
  • hash-code (reports the integer hash code of the string)

* this are in-fix operators, i.e. if my-string string:starts-with prefix [ print true ]

** from-file seems to only work well with absolute file paths, as it doesn't seem to hook into the current-directory as expected/hoped.

Download: String extension

Multiple Random Number Generator (by David O'Sullivan)

Usage is:

  • rngs: initialise resets everything, deleting all existing random number generators (RNGs) in the extension
  • rngs: set-seed initialises a RNG that will be referred to by the supplied id number, with the supplied (positive integer) seed value. A seed value of 0 will be initialised from the system clock
  • rngs: random-float returns a random float between 0 and the specified range from the RNG with the supplied id. This can only be called if rngs:set-seed has previously been used to create the specified RNG

Download: Multiple random number generator extension

Priority Queue (by Roger Peppe)

Provides a priority queue type:

  • pq:new (reporter) - create and return a new priority queue.
  • pq:add q p item (command) - add item with priority p (a number) to the priority queue q.
  • pq:remove q (reporter) - remove and return the item with the highest priority from tq. this gives an error if there are no items currently in the queue.
  • pq:delete-item q item (command) - delete item from the queue. this operation takes O(n) time, where n is the number of items in the queue.
  • pq:peek q (reporter) report the item in the queue with the highest priority, or raise an error if there are no items in the queue.
  • pq:peek-priority q (reporter) - report the highest priority in the queue, or raise an error if there are no items in the queue. (actually i think in this version, this it not yet implemented).
  • pq:length q (reporter) report the number of items in the queue q.

Download: Priority Queue Extension

NetLogo 3.1.4

Sound

This extension provides primitives to add MIDI sound to NetLogo models. It comes preinstalled in NetLogo. The download here additionally includes Java source code. For information on using the sound extension, see the Sound section of the NetLogo User Manual.

Download: Sound extension for NetLogo 3.1.4

Speech

This Mac OS X-only extension provides speech-synthesis capabilities to NetLogo. It is implemented with a Mac OS X text-to-speech class library called A Humble Narrator.

Download: Speech extension for NetLogo 3.1.4

GoGo

The GoGo Board extension lets you connect NetLogo to the physical world, using sensors, motors, light bulbs, LEDs, relays and other devices. The GoGo Extension for NetLogo provides primitives to communicate with a GoGo board via a serial interface.

A GoGo Board is an open source, easy-to-build, low cost, general purpose board especially designed to be used in educational projects. It was created by Arnan Sipitakiat at the MIT Media Lab.

Download: GoGo extension for NetLogo 3.1.4