An example of the usage of wireless LAN technologyfor multimedia: see Berlin live!

TKN - Telecommunication Networks Group TU-Berlin
Head of Group: Prof. Adam Wolisz Faculty of Electrical Engineering and Computer Science

The ns-2/akaroa-2 project

Hagen Woesner
Eugen Gillich
Andreas Köpke

release 1


Now works with ns-2 v.2.26, fixed a bug (AkRandom() replaced by AkRandomReal()*MAX_INT) and simplified Note: The new RNG of ns 2.26 has a complex interface, the and rng.h you can download here support only the important subset. Write a mail, if somebody actually uses the new interface - this will result in link errors.





Quantitative stochastic simulation is a useful tool for studying performance of stochastic dynamic systems, but it can consume much time and computing resources. To overcome these limits, parallel or distributed computation is needed. Akaroa-2 makes an aproach to parallel simulation, that of multiple replications in parallel or MRIP.

NS-2 is a nice tool for network simulation, but does not provide support for statistical analysis of the obtained results. So by combining NS-2 and Akaroa-2 we add run-length control for simulations based on statistic measures to NS-2 as well as a speed-up if the simulation can be run on many hosts in parallel.

The more precise objective for this project was to combine the Network Simulator with Akaroa-2 and to make the changes only in the ns part. This should give the opportunity to monitor a running ns simulation while not writing out excessive trace files. In addition, akaroa-2 provides the nice feature of an almost linear speedup with the number of hosts due to the MRIP (Multiple Replications In Parallel) method.


ns-2 is a discrete event simulator targeted at networking research. It provides substantial support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks. For more information about Network Simulator check the URL : 

Simulations are written in OTcl but if you need some specific behavior of the OTcl Classes you can write your own in C++.
For a good tutorial : For a Tcl/Tk- tutorial :


Akaroa-2 has been developed at the University of Canterbury in Christchurch, New Zealand by Prof. Dr. K. Pawlikowski, Dr. Don McNickle and Dr. Greg Ewing. It is designed for running quantitative stochastic discrete-event simulations on Unix multiprocessor systems or networks of heterogeneous Unix workstations. Instead of dividing up the program for parallelization - a tremendous effort -, multiple instances of an ordinary simulation program are run simultaneously on different processors.
Akaroa-2 is freely available for educational purposes. For details of the usage policy please read this copyright notice.

Jump Start


  • Preparation
    • get AKAROA-2 and install it (might need some tweaking to run under Linux)
    • set AKAROA environment variable to point to your Akaroa-2 directory 
      • we have v.2.7.4 running here
    • possibly include $AKAROA/bin in your PATH
    • get Ns-2 and install it
      • we have v. 2.26 v.2.1b6, v.2.1b7 and 2.1b7a running here
    • get files and install changed rng.h, and new into your /wherever/ns/ns-2/tools directory
  • Assembling
    • Changes in the of ns:
      • set an include directory pointing to the header files (akaroa.H) of your akaroa installation
      • set a lib directory pointing to the akaroa libraries -L/$(AKAROA)/lib -lakaroa 
      • in the same line, add -lfl (akaroa needs libfl.a, the flex library)
      • add akaroa.o to the objects list
    • run ./configure
    • run make clean; make depend; make etc. as described in the ns-Manual.
Happy simulating!

Files to download:
Or as zip

In this file a new class Akaroa - derived from TclObject - is defined. The function calls from OTcl are mapped to Akaroa library calls. Also an new RNGImplementaion class was derived. It maps calls for a new uniformly distributed random number to the Akaroa Random Number  Generator. Additionaly some intializations are performed.

When running multiple replications of a simulation model in parallel, it is important that each simulaton engine uses a unique stream of random numbers. So we had to exchange the Random Number Generator.

rng.h and

The class RNGImplementation has now a  virtual long next() method instead of a normal one.The class RNG has a 
static void setRNGImplementation(RNGImplementation *imp)
method, to set a new RNGImplementation when needed. The Akaroa-class uses it to install its own implementation. Due to its dynamic nature the random number stream of RNG is a pointer now. We added reference counting for the stream to ensure that there is only one RNGImplementation object.


In your ns-simulation.tcl file do the following:
  1. instantiate a new Akaroa object in the Tclscript method
  2.     set ak [new Akaroa]
  3. if you want to observe more than one parameter, tell Akaroa about it:
  4.     $ak AkDeclareParameters $number_of_parameters
    else leave this line out
  5. inform Akaroa about each parameter change
  6. - one parameter:
     $ak AkObservation $delay
    - more parameters:
     $ak AkObservation 1 $delay
     $ak AkObservation 2 $packet_size
If the parameter change is easily observed within the C++ part just
#include <akaroa.H>
  into your module and call

AkObservation(parameternumber, observation);


Running a ns-2 simulation under akaroa-2

First, you have to start the akmaster process that controls the parallelization and the random number generator.
> akmaster &

Next, start the akslave process on every machine that you want to run your simulation on. It collects the results and starts and terminates the simulations locally.

> akslave &

  You can use the BatchDistribution tool for this. This java tool will login on your behalf using ssh and run any command specified.

Last, start akrun with the parameters like the number of hosts and the program to be executed, e.g.:

> akrun -n 5 ns mm1.tcl

Eventually, a result like this should appear:

Param    Estimate       Delta  Conf         Var   Count   Trans
    1     97.6467    0.400812  0.95   0.0405465  264078    1259
    2     2.77603    0.134357  0.95   0.0045561  263346    1673
#Results obtained using the Akaroa2(c) automatic parallel simulation manager.

Example ns script 

 MM1 - Queueing system


You should make sure that your simulation reaches a steady state, especially when you use more realistic traffic models, like self-similar traffic. Akaroa2 will produce accurate results characterizing steady-state behaviour of the simulated system only if that system can reach steady state within a reasonable time interval. Simulation of systems converging to steady state extremely slowly, or systems that are unstable and never reach steady-state, will be automatically stopped.

If you intend to execute a terminating simulation instead of steady-state one, then you need to use Akaroa2 in Independent Observation Mode; see Section 2.6 of the Akaroa2's manual.


If you have got any questions mail to :

Questions? Contact webmaster.

Contents subject to change. All rights reserved.
Mit dem Urteil vom 12. Mai 1998- 312 O 85/98- "Haftung für Links" hat das Landgericht Hamburg entschieden, daß man durch die Anbringung eines Links, die Inhalte der gelinkten Seite ggf. mit zu verantworten hat. Dies kann nur dadurch verhindert werden, daß man sich ausdrücklich von diesen Inhalten distanziert.
"Hiermit distanzieren wir uns ausdrücklich von allen Inhalten aller extern gelinkten Seiten auf unserem Server und machen uns diese Inhalte nicht zu eigen. Diese Erklärung gilt für alle auf unserem Server angebrachten externen Links."