Hi Basim,

Let me simplify this issue as following:
Suppose that I want to run a simulation experiment only once. To do so I
should type the following 15 commands:

(1) nsuwb pl.tcl regular uwb AODV 1 f 11 1
(2) grep -e "s -t " /root/results/pl/regular/uwb/AODV/uwb-AODV-1-11-1.tr >
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-sent.tr
(3) grep -e "tcp -Il 1064"
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-sent.tr >
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-sentdata.tr
(4) grep -e "-It AODV "
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-sent.tr >
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp1.tr
(5) grep -F -f /root/simulation/trace/grepfiles/frs1.txt
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp1.tr >
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp2.tr
(6) grep -F -f /root/simulation/trace/grepfiles/frd1.txt
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp2.tr >
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-sentAODV.tr
(7) grep -e "r -t " /root/results/pl/regular/uwb/AODV/uwb-AODV-1-11-1.tr >
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp1.tr
(8) grep -e "tcp -Il 1084"
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp1.tr >
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp2.tr
(9) grep -e "-Nl AGT "
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp2.tr >
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-recvdata.tr
(10) grep -e "d -t " /root/results/pl/regular/uwb/AODV/uwb-AODV-1-11-1.tr >
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp1.tr
(11) grep -e "tcp -Il "
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp1.tr >
/root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-dropped.tr
(12) rm /root/results/pl/regular/uwb/AODV/uwb-AODV-1-11-1.tr
(13) rm /root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-sent.tr
(14) rm /root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp1.tr
(15) rm /root/results/pl/regular/uwb/AODV/f1/uwb-AODV-1-11-1-temp2.tr

The first command run the simulation and it results in one trace file
"uwb-AODV-1-11-1.tr" (NOTE: I renamed my ns-2 simulator name, so I typed
"nsuwb" instead of "ns" because I used a version that support UWB networks).
Now to obtain information about throughput, routing overhead, ...etc, I
found it is better to filter the original trace file and replace it with 4
small files. This is done with commands (2) to (11). Then I deleted the
unwanted files from my system with commands (12) to (15).

Note: the first five parameters (regular uwb AODV 1 f) are specified in my
code in the file "run_pl". The 6th and 7th (11 1) parameters are added by "
gen_pl.tcl". The 6th parameter specifies the distance between nodes (in the
above example it is 11m), while the 7th parameter determines the seed of the
simulation. In my network scenario, I varied the distance between nodes from
1 to 30m with a step of 1. For each distance value I repeated the simulation
50 times.

So imagine this, to run 30X50 simulation, I should write 30X50X15 commands
which is of course unfeasible to do manually!!! So I chose to generate these
commands automatically using "gen_pl.tcl". These commands will be listed in
the file "run_pl_sim".

To sum up, the file "run_pl" will use the file "gen_pl.tcl" to generate a
file called "run_pl_sim" in which 30X50 simulation runs will be listed, in
addition to some commands to extract 4 trace files from the original trace
file for each simulation run. Then the file "run_pl_sim" will be executed.

Then, In MATLAB, run the file "info_pl" with the same 5 parameters as in
"run_pl" file. This will extract the useful information from the trace
files. Here, every 4 trace files that represents one simulation run is
replaced by one file with only one line (containing information such as
number of sent packets, dropped packets, received packet, connection time,
...etc). Therefore, the 6000 trace files will be replaced by 30X50 = 1500
files.

Then, In MATLAB also, run the file "analyse_pl" with the same 5 parameters
as in "run_pl" file. This will calculate throughput, routing overhead,
...etc, for each file of the 1500 files. the file "analyse_pl" will
generates two files, one file contains 30X50 = 1500 lines (no average is
provided), and the other file contains the average of every 50 simulation
corresponding to a certain distance between nodes, that is, the second file
contains 30 lines, each line contains the average throughput, average
routing overhead, ...etc.

As I said before, I wrote this code for my own use. I did not write enough
documentation so that other people can use it. But I hope that this email
gives some hints for those who want to understand this code. 

Also, I think one will get more hints when he understand the network
scenario simulated by this code. For more information about the network
scenario (node mobility, traffic, . etc.) see the following paper:
S. Bali, J. Steuer and K. Jobmann, "Performance of Three Routing Protocols
in UWB Ad Hoc Network Deployed in an Industrial Application," accepted in
GLOBECOM'07: IEEE Workshop on Wireless Mesh and Sensor Networks, 30 Nov,
2007. Downloadable at:
http://www.ikt.uni-hannover.de/index.php?id=publikationen0

Best wishes,
Samer

-----Original Message-----
From: Basim Javed [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 26, 2008 12:31 PM
To: Samer Bali
Subject: Re: [ns] repeat simulation

hello Samer

I dont think if I quite understand the role of run_pl_sim? is it
another tcl file or trace file generated by gen_pl.tcl? what is this
30x50 runs..i mean the values for different parameters to be used in a
specific run?

lets consider one example of throughput averging: so you have 50 trace
file for a particular setup of parameters; only you repeat the
simulation with different seed values, while keeping other parameter
values same. Which means probably you have 50 trace files. Now you
need to average out these 50 trace file into one..right? probably the
way you would do it is to geneate a throughput file for each of these
50 files, and then add the corresponding values of same time interval,
and then divide by 50?

thanks many.
b

On Tue, Feb 26, 2008 at 12:01 PM, Samer Bali <[EMAIL PROTECTED]>
wrote:
> Hi Basim,
>
> Yes, you are right. The file "gen_pl.tcl" generates a file called
> "run_pl_sim" in which 30X50 simulation runs (using the file "pl.tcl" and
the
> default values listed in the file "defaults-802.15.4a.tcl") will be
listed,
> i.e., there is 30 simulation experiments, and each experiment is repeated
50
> times.
>
> Also the file "run_pl_sim" will contain some commands to extract 4 trace
> files from the original trace file for each simulation run (using the
files
> frd1.txt, frd3.txt, frd8.txt, frs1.txt, frs3.txt, and frs8.txt).
>
> When the file "run_pl_sim" is executed , there will be 30X50X4 = 6000
trace
> files.
>
> (*) What should I do with these 6000 trace files?
> In MATLAB, run the file "info_pl.m" with the same 5 parameters as in
> "run_pl" file (see file 'instructions-before-using-codes.txt'). This will
> extract the useful information from the trace files. The 6000 trace files
> will be replaced by 30X50 files.
> (NOTE: "run_pl" and "info_pl" can be executed simultaneously to save time)
>
> (*) What should I do with the 1500 information files?
> In MATLAB, run the file "analyse_pl.m" with the same 5 parameters as in
> "run_pl" file. This will tabulate the results obtained from 1500 files
into
> one file only.
>
> (*) What should I do with this one file?
> In MATLAB, run the file "plot_pl_avg.m" to obtain various plots and
graphs.
>
> Hope this help.
>
> Best wishes,
> Samer
>
>
> -----Original Message-----
> From: Basim Javed [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 26, 2008 11:35 AM
> To: Samer Bali
> Subject: Re: [ns] repeat simulation
>
> Hello Samer
>
> its a nice effort.
> after having an overview, I think u wrote your code in tcl. right?
>
> would u kindly guide me, as also I want to run many simulations:
>
> whats the high level view of your approach? what i mean is:
>
> BIG PICTURE
> loop:
>
> initialize NS
> create a scenario
> run the simulation
> get the results processed
> terminate NS
>
> end loop:
>
> Also could you plz specify how are u getting the throughput stuff by
> processing the out.tr files by something like perl...? How do u
> average out the throughput for different runs, as I guess, you would
> get different separate out.tr files?
>
> thanks many.
> basim
> On Tue, Feb 26, 2008 at 10:55 AM, Samer Bali <[EMAIL PROTECTED]>
> wrote:
> >
> > Hi,
> >
> > I wrote a code to calculate many parameters: packet delivery ratio,
> > normalized throughput, routing overhead ratio, end2end delay, hop count
> and
> > connection time. Furthermore, this code is suitable in case you want to
> > repeat your simulation experiment many times to take the average of
them.
> > This code is freely available and you can download it from the following
> > link between '(' and  ')':
> >
> > (
> >
>
http://www.ikt.uni-hannover.de/fileadmin/institut/mitarbeiter/bali/pl-sim-1.
> > 1.zip )
> >
> > There is a text file that explains how to use the code. However, I wrote
> > this code for my own use and for my specific scenario.
> >
> > Best Regards,
> > Samer
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf
> > Of amel ksentini
> > Sent: Monday, February 25, 2008 11:13 AM
> > To: ns-users@ISI.EDU
> > Subject: [ns] repeat simulation
> >
> >
> > hi everybody
> > how can i repeat a simulation in a script?
> > is there a proc to implement in the script ti do so?
> > thanks
> >
> >
>
>

Reply via email to