#!/bin/bash
DEFAULT_SCRIPT_DIR=default
function calculate_average()
{
PREFIX=$1
SUFFIX=$2
BEGIN=$3
END=$4
for i in $(seq $BEGIN $END); do
FILE_NAME=$PREFIX$i$SUFFIX
SUM=0
for i in $(awk '{print $2}' $FILE_NAME); do
SUM=$(echo $SUM+\(`./conv $i`\) | bc);
done
COUNT=$(wc -l $FILE_NAME | awk '{print $1}')
echo $FILE_NAME $SUM $COUNT >> $FILE_NAME.avg
done
}
function simulate_protocol()
{
SEED=$1
PROTO=$2
NEWDIR=sim-$SEED-$PROTO
echo "Creating $NEWDIR..."
cp -a $PROTO $NEWDIR
cd $NEWDIR
sed "s/set opt(seed) X/set opt(seed) $SEED/g" script.tcl > script_run.tcl
time ns2 script_run.tcl > debug
time ns2 atsroot.tcl > /dev/null
time ns2 vzroot.tcl > /dev/null
TX=0;
for i in $(awk '{print $6}' bloqueio.blq); do
TX=$((TX+i));
done;
DROPPED=0;
for i in $(awk '{print $4}' bloqueio.blq); do
DROPPED=$((DROPPED+i));
done;
echo "Packets transmitted $TX , dropped $DROPPED"
echo "Calculating average for JITTER..."
calculate_average "jitter" ".jit" 1 12
echo "Calculating average for ATRASO..."
calculate_average "atraso" ".del" 1 12
echo "Calculating average for VAZAO..."
calculate_average "vazao" ".vaz" 1 12
cd ..
}
BEGIN=$1
END=$2
for i in $(seq $BEGIN $END); do
SEED=$i
# echo "Simulating OLSR with seed $SEED..."
# simulate_protocol $SEED "olsr"
# echo "Simulating OLSR-ETX with seed $SEED..."
# simulate_protocol $SEED "olsr-etx"
# echo "Simulating OLSR-ML with seed $SEED..."
# simulate_protocol $SEED "olsr-ml"
echo "Simulating OLSR-LD with seed $SEED..."
simulate_protocol $SEED "olsr-ld"
done
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
vanet protocol ontains pointers to ns code that is maintained by users and that has not been incorporated into the ns distributions. Please contact code authors for details about these modules we don t maintain them and may not have tried them out.
资源推荐
资源详情
资源评论
收起资源包目录
olsr-0.1.0-ns-2.31.tar.gz (9个子文件)
olsr-0.1.0-ns-2.31
LICENSE 18KB
samples
script-olsr-md.tcl 13KB
script-olsr-ml.tcl 13KB
script-olsr.tcl 13KB
script-olsr-etx.tcl 13KB
INSTALL 621B
olsr.patch 256KB
other
result.sh 489B
run.sh 2KB
共 9 条
- 1
资源评论
Kinonoyomeo
- 粉丝: 89
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功