The ns-2/akaroa-2 project
UpdateNow works with ns-2 v.2.26, fixed a bug (AkRandom() replaced by AkRandomReal()*MAX_INT) and simplified akaroa.cc. Note: The new RNG of ns 2.26 has a complex interface, the rng.cc 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.
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.
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 : http://www.isi.edu/nsnam/ns/tutorial/index.html For a Tcl/Tk- tutorial : http://hegel.ittc.ukans.edu/topics/tcltk/
Akaroa-2 is freely available for educational purposes. For details of the usage policy please read this copyright notice.
- 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, rng.cc and new akaroa.cc into your /wherever/ns/ns-2/tools directory
- Changes in the Makefile.in 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.
Files to download:nsak.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 rng.cc
- 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.
- instantiate a new Akaroa object in the Tclscript method
- if you want to observe more than one parameter, tell Akaroa about it:
- inform Akaroa about each parameter change
- - one parameter:
- - more parameters:
set ak [new Akaroa]
$ak AkDeclareParameters $number_of_parameterselse leave this line out
$ak AkObservation $delay
$ak AkObservation 1 $delay
$ak AkObservation 2 $packet_size
into your module and call
Running a ns-2 simulation under akaroa-2First, 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.MM1 - Queueing system
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.