ns-3学习手记5

运行wifi-example-db.sh遇到的问题:program ‘tap-device-creator’ not found; available programs are: [],ns3,

在这里插入图片描述

解决办法:

(1)查看wifi-example-db.sh源码:

../../waf --run "wifi-example-sim --format=db --distance=$distance --run=run-$distance-$trial "

测试是路径出了问题,单独拿出来运行,也不行,只有将其切换至ns-3.28主目录下运行,其中,出现. ./. .的地方全部修改;另外,gnuplot examples/stats/wifi-example.gnuplot,路径也要修改
修改后的wifi-example-db-my.sh源码:

#!/bin/sh

#DISTANCES="25 50 75 100 125 145 147 150 152 155 157 160 162 165 167 170 172 175 177 180"
#TRIALS="1 2 3 4 5"

#modified by me
DISTANCES="25 50"
TRIALS="1 2"


echo WiFi Experiment Example

pCheck=`which sqlite3`
if [ -z "$pCheck" ]
then
  echo "ERROR: This script requires sqlite3 (wifi-example-sim does not)."
  exit 255
fi

pCheck=`which gnuplot`
if [ -z "$pCheck" ]
then
  echo "ERROR: This script requires gnuplot (wifi-example-sim does not)."
  exit 255
fi

pCheck=`which sed`
if [ -z "$pCheck" ]
then
  echo "ERROR: This script requires sed (wifi-example-sim does not)."
  exit 255
fi

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:bin/

if [ -e ./data.db ]
then
  echo "Kill data.db? (y/n)"
  read ANS
  if [ "$ANS" = "yes" -o "$ANS" = "y" ]
  then
    echo Deleting database
    rm ./data.db
  fi
fi

for trial in $TRIALS
do
  for distance in $DISTANCES
  do
    echo Trial $trial, distance $distance
    ./waf --run "wifi-example-sim --format=db --distance=$distance --run=run-$distance-$trial "
  done
done

#
#Another SQL command which just collects raw numbers of frames receved.
#
#CMD="select Experiments.input,avg(Singletons.value) \
#    from Singletons,Experiments \
#    where Singletons.run = Experiments.run AND \
#          Singletons.name='wifi-rx-frames' \
#    group by Experiments.input \
#    order by abs(Experiments.input) ASC;"

mv ./data.db .

CMD="select exp.input,avg(100-((rx.value*100)/tx.value)) \
    from Singletons rx, Singletons tx, Experiments exp \
    where rx.run = tx.run AND \
          rx.run = exp.run AND \
          rx.variable='receiver-rx-packets' AND \
          tx.variable='sender-tx-packets' \
    group by exp.input \
    order by abs(exp.input) ASC;"

sqlite3 -noheader data.db "$CMD" > wifi-default.data
sed -i.bak "s/|/   /" wifi-default.data
rm wifi-default.data.bak
gnuplot examples/stats/wifi-example.gnuplot

echo "Done; data in wifi-default.data, plot in wifi-default.eps"

(2)并将,wifi-example-db-my.sh放在ns-3.28目录下,运行
在这里插入图片描述
运行结果:(将参数改小了)

larry@larry-VirtualBox:~/ns-3-allinone/ns-3.28$ ./wifi-example-db-my.sh 
WiFi Experiment Example
Kill data.db? (y/n)
y
Deleting database
Trial 1, distance 25
Waf: Entering directory `/home/larry/ns-3-allinone/ns-3.28/build'
Waf: Leaving directory `/home/larry/ns-3-allinone/ns-3.28/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (1.468s)
Trial 1, distance 50
Waf: Entering directory `/home/larry/ns-3-allinone/ns-3.28/build'
Waf: Leaving directory `/home/larry/ns-3-allinone/ns-3.28/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (1.480s)
Trial 2, distance 25
Waf: Entering directory `/home/larry/ns-3-allinone/ns-3.28/build'
Waf: Leaving directory `/home/larry/ns-3-allinone/ns-3.28/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (1.443s)
Trial 2, distance 50
Waf: Entering directory `/home/larry/ns-3-allinone/ns-3.28/build'
Waf: Leaving directory `/home/larry/ns-3-allinone/ns-3.28/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (1.432s)
mv: './data.db' and './data.db' are the same file
Done; data in wifi-default.data, plot in wifi-default.eps

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值