dctcp example-ns2
set N 8
set B 250
set K 65
set RTT 0.0001 set simulationTime 1.0 set startMeasurementTime 1
set stopMeasurementTime 2
set flowClassifyTime 0.001 set sourceAlg DC-TCP-Sack
set switchAlg RED
set lineRate 10Gb
set inputLineRate 11Gb set DCTCP_g_ 0.0625
set ackRatio 1
set packetSize 1460 set traceSamplingInterval 0.0001
set throughputSamplingInterval 0.01
set enableNAM 0 set ns [new Simulator] Agent/TCP set ecn_ 1
Agent/TCP set old_ecn_ 1
Agent/TCP set packetSize_ $packetSize
Agent/TCP/FullTcp set segsize_ $packetSize
Agent/TCP set window_ 1256
Agent/TCP set slow_start_restart_ false
Agent/TCP set tcpTick_ 0.01
Agent/TCP set minrto_ 0.2 ; # minRTO = 200ms
Agent/TCP set windowOption_ 0 if {[string compare $sourceAlg "DC-TCP-Sack"] == 0} {
Agent/TCP set dctcp_ true
Agent/TCP set dctcp_g_ $DCTCP_g_;
}
Agent/TCP/FullTcp set segsperack_ $ackRatio;
Agent/TCP/FullTcp set spa_thresh_ 3000;
Agent/TCP/FullTcp set interval_ 0.04 ; #delayed ACK interval = 40ms Queue set limit_ 1000 Queue/RED set bytes_ false
Queue/RED set queue_in_bytes_ true
Queue/RED set mean_pktsize_ $packetSize
Queue/RED set setbit_ true
Queue/RED set gentle_ false
Queue/RED set q_weight_ 1.0
Queue/RED set mark_p_ 1.0
Queue/RED set thresh_ [expr $K]
Queue/RED set maxthresh_ [expr $K] DelayLink set avoidReordering_ true if {$enableNAM != 0} {
set namfile [open out.nam w]
$ns namtrace-all $namfile
} set mytracefile [open mytracefile.tr w]
set throughputfile [open thrfile.tr w] proc finish {} {
global ns enableNAM namfile mytracefile throughputfile
$ns flush-trace
close $mytracefile
close $throughputfile
if {$enableNAM != 0} {
close $namfile
exec nam out.nam &
}
exit 0
} proc myTrace {file} {
global ns N traceSamplingInterval tcp qfile MainLink nbow nclient packetSize enableBumpOnWire set now [$ns now] for {set i 0} {$i < $N} {incr i} {
set cwnd($i) [$tcp($i) set cwnd_]
set dctcp_alpha($i) [$tcp($i) set dctcp_alpha_]
} $qfile instvar parrivals_ pdepartures_ pdrops_ bdepartures_ puts -nonewline $file "$now $cwnd(0)"
for {set i 1} {$i < $N} {incr i} {
puts -nonewline $file " $cwnd($i)"
}
for {set i 0} {$i < $N} {incr i} {
puts -nonewline $file " $dctcp_alpha($i)"
} puts -nonewline $file " [expr $parrivals_-$pdepartures_-$pdrops_]"
puts $file " $pdrops_" $ns at [expr $now+$traceSamplingInterval] "myTrace $file"
} proc throughputTrace {file} {
global ns throughputSamplingInterval qfile flowstats N flowClassifyTime set now [$ns now] $qfile instvar bdepartures_ puts -nonewline $file "$now [expr $bdepartures_*8/$throughputSamplingInterval/1000000]"
set bdepartures_ 0
if {$now <= $flowClassifyTime} {
for {set i 0} {$i < [expr $N-1]} {incr i} {
puts -nonewline $file " 0"
}
puts $file " 0"
} if {$now > $flowClassifyTime} {
for {set i 0} {$i < [expr $N-1]} {incr i} {
$flowstats($i) instvar barrivals_
puts -nonewline $file " [expr $barrivals_*8/$throughputSamplingInterval/1000000]"
set barrivals_ 0
}
$flowstats([expr $N-1]) instvar barrivals_
puts $file " [expr $barrivals_*8/$throughputSamplingInterval/1000000]"
set barrivals_ 0
}
$ns at [expr $now+$throughputSamplingInterval] "throughputTrace $file"
} $ns color 0 Red
$ns color 1 Orange
$ns color 2 Yellow
$ns color 3 Green
$ns color 4 Blue
$ns color 5 Violet
$ns color 6 Brown
$ns color 7 Black for {set i 0} {$i < $N} {incr i} {
set n($i) [$ns node]
} set nqueue [$ns node]
set nclient [$ns node] $nqueue color red
$nqueue shape box
$nclient color blue for {set i 0} {$i < $N} {incr i} {
$ns duplex-link $n($i) $nqueue $inputLineRate [expr $RTT/4] DropTail
$ns duplex-link-op $n($i) $nqueue queuePos 0.25
} $ns simplex-link $nqueue $nclient $lineRate [expr $RTT/4] $switchAlg
$ns simplex-link $nclient $nqueue $lineRate [expr $RTT/4] DropTail
$ns queue-limit $nqueue $nclient $B $ns duplex-link-op $nqueue $nclient color "green"
$ns duplex-link-op $nqueue $nclient queuePos 0.25
set qfile [$ns monitor-queue $nqueue $nclient [open queue.tr w] $traceSamplingInterval] for {set i 0} {$i < $N} {incr i} {
if {[string compare $sourceAlg "Newreno"] == 0 || [string compare $sourceAlg "DC-TCP-Newreno"] == 0} {
set tcp($i) [new Agent/TCP/Newreno]
set sink($i) [new Agent/TCPSink]
}
if {[string compare $sourceAlg "Sack"] == 0 || [string compare $sourceAlg "DC-TCP-Sack"] == 0} {
set tcp($i) [new Agent/TCP/FullTcp/Sack]
set sink($i) [new Agent/TCP/FullTcp/Sack]
$sink($i) listen
} $ns attach-agent $n($i) $tcp($i)
$ns attach-agent $nclient $sink($i) $tcp($i) set fid_ [expr $i]
$sink($i) set fid_ [expr $i] $ns connect $tcp($i) $sink($i)
} for {set i 0} {$i < $N} {incr i} {
set ftp($i) [new Application/FTP]
$ftp($i) attach-agent $tcp($i)
} $ns at $traceSamplingInterval "myTrace $mytracefile"
$ns at $throughputSamplingInterval "throughputTrace $throughputfile" set ru [new RandomVariable/Uniform]
$ru set min_ 0
$ru set max_ 1.0 for {set i 0} {$i < $N} {incr i} {
$ns at 0.0 "$ftp($i) send 10000"
$ns at [expr 0.1 + $simulationTime * $i / ($N + 0.0001)] "$ftp($i) start"
$ns at [expr $simulationTime] "$ftp($i) stop"
} set flowmon [$ns makeflowmon Fid]
set MainLink [$ns link $nqueue $nclient] $ns attach-fmon $MainLink $flowmon set fcl [$flowmon classifier] $ns at $flowClassifyTime "classifyFlows" proc classifyFlows {} {
global N fcl flowstats
puts "NOW CLASSIFYING FLOWS"
for {set i 0} {$i < $N} {incr i} {
set flowstats($i) [$fcl lookup autp 0 0 $i]
}
} set startPacketCount 0
set stopPacketCount 0 proc startMeasurement {} {
global qfile startPacketCount
$qfile instvar pdepartures_
set startPacketCount $pdepartures_
} proc stopMeasurement {} {
global qfile startPacketCount stopPacketCount packetSize startMeasurementTime stopMeasurementTime simulationTime
$qfile instvar pdepartures_
set stopPacketCount $pdepartures_
puts "Throughput = [expr ($stopPacketCount-$startPacketCount)/(1024.0*1024*($stopMeasurementTime-$startMeasurementTime))*$packetSize*8] Mbps"
} $ns at $startMeasurementTime "startMeasurement"
$ns at $stopMeasurementTime "stopMeasurement" $ns at $simulationTime "finish" $ns run
dctcp example-ns2的更多相关文章
- ubuntu 14.04 ns2.35 ***buffer overflow detected **: ns terminated解决办法
1.按照如下教程安装 Install With Me !: How to Install NS-2.35 in Ubuntu-13.10 / 14.04 (in 4 easy steps) 2.运行一 ...
- Fedora 23安装 NS2 (network simulator 2)
1 实验环境 OS: Fedora 23 workstation 2 实验步骤 ( 参考了:http://www.isi.edu/nsnam/ns/ns-build.html) 本次实验的实验环境: ...
- Ubuntu10.04下安装Ns2的一系列错误及解决方案
安装之前改一下nam1.11下的agent.h文件73行 Null改为0 第一个错误: xxx configuration: Syntax error: Unterminated quoted str ...
- NS2中修改载波侦听范围和传输范围
修改这两个值是在tcl中进行的,加上 Phy/WirelessPhy set CSThresh_ 1.559e-11 ;#550m Phy/WirelessPhy set RXThresh_ 3.65 ...
- 寻找研究基于NS2研究覆盖网络的小伙伴:)
如题,本人菜鸟刚刚入门,想找些基于NS2研究覆盖网络方面的小伙伴,具体点是关于覆盖网络中QoS服务调度方法方面的,有的小伙伴可以留下联系方式,或者加我QQ:245939069 :P:P:P
- 与NS2一起度过第一个圣诞夜!(NS2入门学习参考资料)
Merry xmas! 安装好NS2后正式开始学习NS2啦,先转发一哥们的博客内容,慢慢看! 一). NS常用基本网站 1. 寻求问题答案最好的地方. http:/ ...
- 关于NS2安装的若干问题
之前就知道这个软件安装起来很恶心,因为毕竟是10年前的软件,可没想到真的好恶心...花了整整一天才装上. 我安装的版本是ns-allinone-2.28,系统版本是ubuntu14.04 其实大部分出 ...
- 网络拥塞控制与NS2仿真
准备工作: 1. 安装virtual box 虚拟机,并安装虚拟机增强功能,并配制共享文件夹. 共享文件夹自动挂载后的路径为/media/sf_xxx文件夹,xxx为所起的文件名. 解决virtual ...
- 【NS2仿真】RTP协议安装
来自: http://personales.upv.es/fboronat/Research/NS2_RTP/NS2_RTP_RTCP_module.htm 文件:http://pan.baidu.c ...
- 【工具】NS2安装记录
献给同样为了NS2抓破了头皮的同志们. 1, Get Started: http://www.isi.edu/nsnam/ns/ns-build.html#allinone Build by piec ...
随机推荐
- 小y的质数
题目链接:https://ac.nowcoder.com/acm/contest/634/C 链接:https://ac.nowcoder.com/acm/contest/634/C来源:牛客网 题目 ...
- uwsgi错误invalid request block size
uwsgi错误invalid request block size 今天使用uwsgi启动django代码,然后打开浏览器输入http://localhost:8000/admin.后台出现下面错误 ...
- css3画半圆
border-radius制作半圆与制作圆形的方法是一样的,只是元素的宽度与圆角方位要配合一致,不同的宽度和高度比例,以及圆角方位,可以制作上半圆.下半圆.左半圆和右半圆效果.例如:.semicirc ...
- h5移动端设置键盘搜索
点击键盘上的搜索按钮实现页面跳转 <form action="#list?goods_title={{message?message:''}}" @submit.preven ...
- whatwg-fetch
fetch 是什么 XMLHttpRequest的最新替代技术 fetch优点 接口更简单.简洁,更加语义化 基于promise,更加好的流程化控制,可以不断then把参数传递,外加 async/aw ...
- Codeforces 671 A——Recycling Bottles——————【思维题】
Recycling Bottles time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- HDU 5695 ——Gym Class——————【贪心思想,拓扑排序】
Gym Class Time Limit: 6000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total S ...
- NetMQ:.NET轻量级消息队列
前言 首先我现在是在一家游戏工作做服务端的,这几天我们服务端游戏做了整个底层框架的替换,想必做过游戏的也都知道,在游戏里面会有很多的日志需要记录,量也是比较大的:在没有换框架之前我们存日志和游戏运行都 ...
- GeneratedKeyHolder的作用:获得新建主键值
Spring利用GeneratedKeyHolder,提供了一个可以返回新增记录对应主键值的方法: int update(PreparedStatementCreator psc, KeyHolder ...
- 纯手写实现HashMap
1.hashmap的实现 ① 初始化 1)定义一个Node<K, V>的数组来存放元素,但不立即初始化,在使用的时候再加载 2)定义数组初始大小为16 3)定义负载因子,默认为0.75, ...