Extensions Guide

NetLogo 6.3.0 User Manual

NetLogo extensions allow users to write new commands and reporters in Java and other languages for use in NetLogo models. This section of the User Manual introduces extensions and shows how to use an extension in your model once you have obtained or made one.

Note that, in addition to the numerous extensions bundled with NetLogo, there are many other extensions that can be installed through the Extension Manager.

Authoring and Sharing

Interested in adding some new functionality to NetLogo by creating your own extension? Have an extension you made and want to add it to the Extension Manager? See the extension authoring page to get started.

Using Extensions

To use an extension in a model, add the extensions keyword at the beginning of the Code tab, before declaring any breeds or variables.

extensions is followed by a pair of square brackets containing a list of extension names. For example:

extensions [sound speech]

Using extensions instructs NetLogo to make the specified extensions’ commands and reporters available in the current model, just as if they were built-in NetLogo primitives.

Where extensions are located

NetLogo will look for extensions in several places:

  1. In the folder of the current model
  2. The extensions folder within your installation of NetLogo. For typical NetLogo installations:
  3. This subfolder (relative to your home directory):
  4. The .bundled subfolder of the extensions folder mentioned in Item 2 (for example, /Applications/NetLogo 6.3.0/extensions/.bundled on Mac OS X).

The easiest way to install new extensions is to use the Extension Manager. If an extension you want to use is not available through the Extension Manager, you will have to manually download it and place it into a location described by Item 1 or Item 2 above. Manually modifying the contents of Item 3 and Item 4 above is not supported.

The order listed above is the priority the Extension Manager will use. This means that if the Extension Manager finds a requested extension for a model manually installed in the extensions folder, it will not check the extensions library to see if there are any updated versions to install. As such, you’re locked in to the manually installed version until you decide to remove it. Also, any extensions you install through the Extension Manager will override the bundled extensions that come with NetLogo. This means you can update the bundled extensions if fixes for them come out after the NetLogo release with which they were bundled, you don’t have to wait for a full NetLogo release to get updates.

Each NetLogo extension consists of a folder with the same name as the extension, entirely in lower case. This folder must contain a JAR file with the same name as the folder. For example, the sound extension is stored in a folder called sound with a file inside called sound.jar.

Some extensions depend on additional files. These files will be in the extension’s folder along with the JAR file. The folder may also contain other files such as documentation and example models.