Statistical Framework in NS-3

NS-3 is one of the most used Network Simulators because it includes different modules, applications and protocols to simulate a wide range of network. Since new proposals usually involve a large number of simulations, a procedure to automatize the simulation process and extract statistics is very useful. "Statistical Framework" (SF) is an important module of NS-3 because it fulfills this need. SF allows us to collect simulation data and obtain statistical reports for NS-3. In this report, we present a detailed description of statistical framework module and two useful examples of its configuration.


Introduction
When we use network simulators it is important to obtain the detailed information of the results of the simulations.[1] This information can be obtained in different ways, for instance generating pcap traces [2], printing files, graphics with gnuplot and flowmonitor [3].NS-3 contains a module, named Statistical Framework (SF), that allows us to get data and statistics for analysis of simulation results in an automatic way.Therefore, we can optimize the simulation process by using statistical framework [4].The rest of this report is organized as follows: Sec. 2 briefly describes SF.Then, Sec. 3 reviews the files needed to run a simulation with SF.After that, in the Sec. 4 we show the configuration of the files described in Sec. 3. Finally, we will present two examples using SF.

Overview
Statistical framework provides functions to calculate, record and present data and statistics to analyze network simulations [4].
This framework is located in the directory examples/stats.There are various files that allow data collection and generation of graphics in this directory.The core components of the framework are the following [4]: − One experiment trial is conducted by one instance of a simulation program (parallel or serially).− A control script executes instances of the simulation, varying parameters as necessary.− Data is collected by connecting the stat framework to existing trace signals.The data is stored in a database for plotting and analysis.− Trace signals or direct manipulation of the framework may be used to instrument custom simulation code.
Fig. 1 shows the basic components of the framework and their interactions.We can see in the picture that the process is managed by a experimental control (lower rectangle), which executes the different simulation instances (squares).Within each square the construction of the simulation is carried out.Finally, a data base is generated for further analysis.

Configuration
Now, we explain step by step the configuration that must be done in the files aforementioned in the previous section.For this, we will focus on the default files that has the framework.

wifi-example-sim.cc
This is the main script in the framework because contains the structure of simulation (protocols, nodes, applications, collector, among others).Each block of the Fig. 3 shows the structure of file.cc.To generate a simulation we must include these blocks according to the scenario that you want to simulate.For example, there are cases in which one scenario requires mobility in the nodes while in others it is not necessary.Everything regarding protocols, devices, generation and data collection must be configured in this file.

wscript
The configuration of this script is important because it includes all the modules that are used in the simulation.If a simulation requires additional modules it is necessary to add these, in the script.Otherwise, problems arise in the execution of the simulation.To run the simulation we must use the command line mentioned in the section 3.In this case, the simulation has been configured in such way that the results are displayed on the screen and through a database.The Fig. 6 shows a bit of the results on the screen.The Fig. 7 shows the database generated with statistical framework.In this case, we have used an external program to read the data.
In this way the results have been obtained successfully.At the end of the tutorial we will attach the scripts so that they can be analyzed.

Example 2
In this example we simulate an MANET [8] with different number of nodes using AODV [9] routing protocol and Random WayPoint as mobility model [10].The scenario is shown in Fig. 8.
We consider the following: − Variation in the number of nodes (10-20-30).− The transmission is made between two specific nodes.− We will test with 3 trials.
In the Fig. 9, we can see the results of a trial with 10 nodes.Similar to the example 1 we have generated the results on screen and in a database.

Figure 2 .
Figure 2. Component files of statistical framework

Figure 3 .
Figure 3. Structure of file

Figure 6 .
Figure 6.Results of the example 1