#!/bin/sh
#Create a cbr file and a scence file,and move them to "~/AODVSimulation/".
#-n/-nn:the number of node
#-mc:the number of connection
#-rate:the number of sending packet pre second
#-p:pause time
#-M:max moving speed
#-t:time of simulator
#-x/-y:the range of scence
cd /home/ns235/ns-allinone-2.35/ns-2.35/indep-utils/cmu-scen-gen/
ns cbrgen.tcl -type cbr -nn ${1} -seed 1 -mc ${2} -rate 2.0 >cbr
mv cbr ~/AODVSimulation/
cd setdest/
./setdest -v 1 -n ${1} -p 0 -M 20 -t ${3} -x ${4} -y ${5} >scene
mv scene ~/AODVSimulation/
cd ~/AODVSimulation/
#Ns use tcl script.
ns aodv.tcl ${1} ${3} ${4} ${5}
#Analyse trace file for the information of delay,packet delivery ratio,routing overhead and throughput.
gawk -f delay.awk aodv.tr > delay
gawk -f RO.awk aodv.tr > RO
gawk -f throughput.awk aodv.tr > throughput
gawk -f PDR.awk aodv.tr > PDR
echo -e "${1} \c">>ROtest
cat RO>>ROtest