- Home Page of ProjectGuideline.com ›
- Forums ›
- Get Help to do your B.E., and M.E., M.Tech., & M.S., Project in Ns2 ›
- 2 mobile node can’t send the TCP packet at same time
Hi , I’m Indah
I’m doing wimax mobile simulation.
I run more than 2 mobile nodes, and TCP was attached over It.
But while simulation , there is just one mobile node who successed send the TCP packet, and the others was just moving with no TCP packet accessed.
I’m sure that i’ve already attached TCP and FTP over all mobile nodes there.
The Mobile node will successed send the packet if I use UDP, not TCP over it.
Is there anyone can help me to solve this??
Thanks a lot
Regard.
If possible, upload your tcl script. Then only some one in this forum may provide you a solution.
ok.. this is my script
set seed 5555
Mac/802_16 set scan_iteration_ 2
set use_going_down 1
if {$use_going_down == 1} {
Mac/802_16 set lgd_factor_ 1.1
} else {
Mac/802_16 set lgd_factor_ 1.0
}
Mac/802_16 set scan_duration_ 4
Mac/802_16 set interleaving_interval_ 6
Mac/802_16 set dcd_interval_ 5 ;#max 10s
Mac/802_16 set ucd_interval_ 1 ;#max 10s
set default_modulation OFDM_16QAM_3_4 ;#OFDM_BPSK_1_2
set contention_size 5 ;#for initial ranging and bw
Mac/802_16 set t21_timeout_ 0.02 ;#max 10s, to replace the timer for
Mac/802_16 set client_timeout_ 0.007
Mac/802_16 set lost_ulmap_interval_ 0.76
#define frequency of RA at base station
Agent/ND set minRtrAdvInterval_ 0
Agent/ND set maxRtrAdvInterval_ 10
Agent/ND set router_lifetime_ 250
Agent/ND set minDelayBetweenRA_ 0.03
Agent/ND set maxRADelay_ 0.005
#define debug values
Agent/ND set debug_ 1
Agent/ND set send-RS 1
Agent/MIH set debug_ 1
Mac/802_16 set debug_ 0
Agent/MIHUser/IFMNGMT/MIPV6 set debug_ 1
Agent/MIHUser/IFMNGMT/MIPV6/Handover/Handover1 set debug_ 1
# Handover
Agent/MIHUser/IFMNGMT/MIPV6/Handover/Handover1 set case_ 3
#define coverage area for base station:
#default frequency 3.5e+9 hz
Phy/WirelessPhy set Pt_ 15
Phy/WirelessPhy set RXThresh_ 1.215e-09 ;#500m coverage
Phy/WirelessPhy set CSThresh_ [expr 0.8 *[Phy/WirelessPhy set RXThresh_]]
# Parameter for wireless nodes
set opt(chan) Channel/WirelessChannel ;# channel type
set opt(prop) Propagation/TwoRayGround ;# radio-propagation model
set opt(netif) Phy/WirelessPhy/OFDM ;# network interface type
set opt(mac) Mac/802_16 ;# MAC type
set opt(ifq) Queue/DropTail/PriQueue ;# interface queue type
set opt(ll) LL ;# link layer type
set opt(ant) Antenna/OmniAntenna ;# antenna model
set opt(ifqlen) 50 ;# max packet in ifq
set opt(adhocRouting) NOAH ;# routing protocol
set opt(nbMN) 2 ;# number of Mobile Nodes
set opt(nbBS) 3 ;# number of base stations
set opt(x) 3000 ;# X dimension of the
set opt(y) 3000 ;# Y dimension of the
set opt(mnSender) 2
#Rate at which the nodes start moving
set moveStart 1.0
set moveStop 60.0
#Speed of the mobile nodes (m/sec)
set moveSpeed_0 40
set moveSpeed_1 40
set moveSpeed_2 40
set moveSpeed_3 40
set moveSpeed_4 40
#destination of the M
set X0_dst 2300
set Y0_dst 1150
set X1_dst 2300
set Y1_dst 1350
set X2_dst 2300
set Y2_dst 1400
set X3_dst 250
set Y3_dst 1200
set X4_dst 250
set Y4_dst 1460
#defines function for flushing and closing files
proc finish {} {
global ns nf tf ;#f0 f1 f2
$ns flush-trace
puts “running nam…”
exec nam out.nam &
#exec xgraph indah.tr -geometry 800×400 &
# exec xgraph out1.tr -geometry 800×400 &
# exec xgraph out2.tr -geometry 800×400 &
exit 0
}
#create the simulator
set ns [new Simulator]
#$ns use-newtrace
#create the topography
set topo [new Topography]
$topo load_flatgrid $opt(x) $opt(y)
#open file for trace
set tf [open out.tr w]
set nf [open out.nam w]
$ns trace-all $tf
$ns namtrace-all-wireless $nf $opt(x) $opt(y)
$ns use-newtrace
#**********
#set f0 [open out0.tr w] ;#for the 1st BS
#set f1 [open out1.tr w] ;#for the 2nd BS
#set f2 [open out2.tr w] ;#for the 3rd BS
#**********
# set up for hierarchical routing (needed for routing over a basestation)
$ns node-config -addressType hierarchical
AddrParams set domain_num_ 7 ;# domain number
AddrParams set cluster_num_ {1 1 1 1 1 1 1} ;# cluster
lappend tmp 1 ;# CN
lappend tmp 2 ;# router 1 & ganggu
lappend tmp 3 ;# 802.16 MNs+BS
lappend tmp 3 ;# 802.16 MNs+BS
lappend tmp 3 ;# 802.16 MNs+BS
lappend tmp 1 ;#MultifaceNode
lappend tmp 1 ;#MultifaceNode
AddrParams set nodes_num_ $tmp
# Node address for router0 and router1 are 4 and 5, respectively.
set CN [$ns node 0.0.0]
$CN set X_ 1250.0
$CN set Y_ 200.0
$CN set Z_ 0.0
$CN install-default-ifmanager
$CN label “CN”
$CN color red
set router [$ns node 1.0.0]
$router set X_ 1250
$router set Y_ 600
$router set Z_ 0
$router label “router”
$router color green
set ganggu [$ns node 1.0.1]
$ganggu set X_ 800
$ganggu set Y_ 600
$ganggu set Z_ 0
$ganggu label “BT”
$ganggu color cyan
set udp1 [new Agent/UDP]
$ns attach-agent $ganggu $udp1
set cbr1 [new Application/Traffic/CBR]
#$cbr1 set packetSize_ 500
$cbr1 set rate_ 64 Kb
$cbr1 set interval_ 0.003
#$cbr1 set maxpkts_ 200000
$cbr1 attach-agent $udp1
set null1 [new Agent/LossMonitor]
$ns attach-agent $CN $null1
$ns connect $udp1 $null1
set udp2 [new Agent/UDP]
$ns attach-agent $router $udp2
set cbr2 [new Application/Traffic/CBR]
#$cbr2 set packetSize_ 500
$cbr2 set rate_ 64 Kb
$cbr2 set interval_ 0.009
#$cbr2 set maxpkts_ 200000
$cbr2 attach-agent $udp1
set null2 [new Agent/LossMonitor]
$ns attach-agent $CN $null2
$ns connect $udp2 $null2
# connect links
$ns duplex-link $router $CN 2Mb 0.00339ms DropTail 1000
$ns duplex-link $router $ganggu 2Mb 0.00339ms DropTail 1000
# Create God
create-god [expr ($opt(nbMN) + $opt(nbBS))]
# Create multi-interface node
$ns node-config -multiIf ON
#set multiFaceNode_0 [$ns node 5.0.0]
#set multiFaceNode_1 [$ns node 6.0.0]
#set multiFaceNode_2 [$ns node 7.0.0]
set multiFaceNode_wl_0 [$ns node 5.0.0]
set multiFaceNode_wl_1 [$ns node 6.0.0]
#set multiFaceNode_wl_2 [$ns node 10.0.0]
#set multiFaceNode_wl_3 [$ns node 11.0.0]
#set multiFaceNode_wl_4 [$ns node 12.0.0]
#set multiFaceNode_wl [$ns node [expr 5+$opt(nbBS)].0.0]
$ns node-config -multiIf OFF
#creates the Access Point (Base station)
$ns node-config -adhocRouting $opt(adhocRouting)
-llType $opt(ll)
-macType $opt(mac)
-ifqType $opt(ifq)
-ifqLen $opt(ifqlen)
-antType $opt(ant)
-propType $opt(prop)
-phyType $opt(netif)
-channel [new $opt(chan)]
-topoInstance $topo
-wiredRouting ON
-agentTrace ON
-routerTrace ON
-macTrace ON
Mac/802_16 set debug_ 1
set bstation_0 [$ns node 2.0.0]
$bstation_0 random-motion 0
$bstation_0 set X_ 500
$bstation_0 set Y_ 1000
$bstation_0 set Z_ 0
$bstation_0 label “BS0”
$bstation_0 color blue
$bstation_0 shape hexagon
set clas_0 [new SDUClassifier/Dest]
[$bstation_0 set mac_(0)] add-classifier $clas_0
set bs_sched_0 [new WimaxScheduler/BS]
$bs_sched_0 set-default-modulation $default_modulation
$bs_sched_0 set-contention-size 10
[$bstation_0 set mac_(0)] set-scheduler $bs_sched_0
[$bstation_0 set mac_(0)] set-channel 0
set wimaxctrl_0 [new Agent/WimaxCtrl]
$wimaxctrl_0 set-mac [$bstation_0 set mac_(0)]
$ns attach-agent $bstation_0 $wimaxctrl_0
Mac/802_16 set debug_ 1
set bstation_1 [$ns node 3.0.0]
$bstation_1 random-motion 0
$bstation_1 set X_ 1250
$bstation_1 set Y_ 1000
$bstation_1 set Z_ 0
$bstation_1 label “BS1”
$bstation_1 color blue
$bstation_1 shape hexagon
set clas_1 [new SDUClassifier/Dest]
[$bstation_1 set mac_(0)] add-classifier $clas_1
set bs_sched_1 [new WimaxScheduler/BS]
$bs_sched_1 set-default-modulation $default_modulation
$bs_sched_1 set-contention-size 10
[$bstation_1 set mac_(0)] set-scheduler $bs_sched_1
[$bstation_1 set mac_(0)] set-channel 2
set wimaxctrl_1 [new Agent/WimaxCtrl]
$wimaxctrl_1 set-mac [$bstation_1 set mac_(0)]
$ns attach-agent $bstation_1 $wimaxctrl_1
Mac/802_16 set debug_ 1
set bstation_2 [$ns node 4.0.0]
$bstation_2 random-motion 0
$bstation_2 set X_ 2000
$bstation_2 set Y_ 1000
$bstation_2 set Z_ 0
$bstation_2 label “BS2”
$bstation_2 color blue
$bstation_2 shape hexagon
set clas_2 [new SDUClassifier/Dest]
[$bstation_2 set mac_(0)] add-classifier $clas_2
set bs_sched_2 [new WimaxScheduler/BS]
$bs_sched_2 set-default-modulation $default_modulation
$bs_sched_2 set-contention-size 10
[$bstation_2 set mac_(0)] set-scheduler $bs_sched_2
[$bstation_2 set mac_(0)] set-channel 4
set wimaxctrl_2 [new Agent/WimaxCtrl]
$wimaxctrl_2 set-mac [$bstation_2 set mac_(0)]
$ns attach-agent $bstation_2 $wimaxctrl_2
$wimaxctrl_0 add-neighbor [$bstation_1 set mac_(0)] $bstation_1
$wimaxctrl_0 add-neighbor [$bstation_2 set mac_(0)] $bstation_2
$wimaxctrl_1 add-neighbor [$bstation_2 set mac_(0)] $bstation_2
$wimaxctrl_1 add-neighbor [$bstation_0 set mac_(0)] $bstation_0
$wimaxctrl_2 add-neighbor [$bstation_1 set mac_(0)] $bstation_1
$wimaxctrl_2 add-neighbor [$bstation_0 set mac_(0)] $bstation_0
$ns node-config -wiredRouting OFF
-macTrace ON ;# Mobile nodes cannot do routing.
#configure the MOBILE NODE
Mac/802_16 set debug_ 1
set wl_node_0 [$ns node 2.0.1]
$wl_node_0 random-motion 1
# create the node with given @.$wl_node_0 random-motion 0 ;# disable random
$wl_node_0 base-station [AddrParams addr2id [$bstation_0 node-addr]] ;#
$wl_node_0 set X_ 250
$wl_node_0 set Y_ 1150
$wl_node_0 set Z_ 0
$wl_node_0 label “satu”
set clas_wl_0 [new SDUClassifier/Dest]
[$wl_node_0 set mac_(0)] add-classifier $clas_wl_0
#set the scheduler for the node. Must be changed to -shed [new $opt(sched)]
set ss_sched_wl_0 [new WimaxScheduler/SS]
[$wl_node_0 set mac_(0)] set-scheduler $ss_sched_wl_0
$wl_node_0 set mac_(0)] set-channel 0
$multiFaceNode_wl_0 add-interface-node $wl_node_0
set nd_mn_wl_0 [$wl_node_0 install-nd]
set handover_wl_0 [new Agent/MIHUser/IFMNGMT/MIPV6/Handover/Handover1]
$multiFaceNode_wl_0 install-ifmanager $handover_wl_0
$nd_mn_wl_0 set-ifmanager $handover_wl_0
# install MIH in multi-interface node
set mih_wl_0 [$multiFaceNode_wl_0 install-mih]
$handover_wl_0 connect-mih $mih_wl_0
set tmp_wl_0 [$wl_node_0 set mac_(0)]
$handover_wl_0 nd_mac $nd_mn_wl_0 $tmp_wl_0
$tmp_wl_0 mih $mih_wl_0
$mih_wl_0 add-mac $tmp_wl_0
#configure the MOBILE NODE
Mac/802_16 set debug_ 1
set wl_node_1 [$ns node 2.0.2]
$wl_node_1 random-motion 5
# create the node with given @.$wl_node_0 random-motion 0 ;# disable random
$wl_node_1 base-station [AddrParams addr2id [$bstation_0 node-addr]] ;#
$wl_node_1 set X_ 250
$wl_node_1 set Y_ 1170
$wl_node_1 set Z_ 0
$wl_node_1 label “dua”
set clas_wl_1 [new SDUClassifier/Dest]
[$wl_node_1 set mac_(0)] add-classifier $clas_wl_1
#set the scheduler for the node. Must be changed to -shed [new $opt(sched)]
set ss_sched_wl_1 [new WimaxScheduler/SS]
[$wl_node_1 set mac_(0)] set-scheduler $ss_sched_wl_1
[$wl_node_1 set mac_(0)] set-channel 0
$multiFaceNode_wl_1 add-interface-node $wl_node_1
set nd_mn_wl_1 [$wl_node_1 install-nd]
set handover_wl_1 [new Agent/MIHUser/IFMNGMT/MIPV6/Handover/Handover1]
$multiFaceNode_wl_1 install-ifmanager $handover_wl_1
$nd_mn_wl_1 set-ifmanager $handover_wl_1
# install MIH in multi-interface node
set mih_wl_1 [$multiFaceNode_wl_1 install-mih]
$handover_wl_1 connect-mih $mih_wl_1
set tmp_wl_1 [$wl_node_1 set mac_(0)]
$handover_wl_1 nd_mac $nd_mn_wl_1 $tmp_wl_1
$tmp_wl_1 mih $mih_wl_1
$mih_wl_1 add-mac $tmp_wl_1
#configure the MOBILE NODE
#Mac/802_16 set debug_ 1
#set wl_node_2 [$ns node 2.0.4]
# create the node with given @.
#$wl_node_2 random-motion 0 ;# disable random
#$wl_node_2 base-station [AddrParams addr2id [$bstation_0 node-addr]] ;#
#$wl_node_2 set X_ 250
#$wl_node_2 set Y_ 1400
#$wl_node_2 set Z_ 0.0
#$wl_node_2 label “tiga”
#set clas_wl_2 [new SDUClassifier/Dest]
#[$wl_node_2 set mac_(0)] add-classifier $clas_wl_2
#set the scheduler for the node. Must be changed to -shed [new $opt(sched)]
#set ss_sched_wl_2 [new WimaxScheduler/SS]
#[$wl_node_2 set mac_(0)] set-scheduler $ss_sched_wl_2
#[$wl_node_2 set mac_(0)] set-channel 0
#$multiFaceNode_wl_2 add-interface-node $wl_node_2
#set nd_mn_wl_2 [$wl_node_2 install-nd]
#set handover_wl_2 [new Agent/MIHUser/IFMNGMT/MIPV6/Handover/Handover1]
#$multiFaceNode_wl_2 install-ifmanager $handover_wl_2
#$nd_mn_wl_2 set-ifmanager $handover_wl_2
# install MIH in multi-interface node
#set mih_wl_2 [$multiFaceNode_wl_2 install-mih]
#$handover_wl_2 connect-mih $mih_wl_2
#set tmp_wl_2 [$wl_node_2 set mac_(0)]
#$handover_wl_2 nd_mac $nd_mn_wl_2 $tmp_wl_2
#$tmp_wl_2 mih $mih_wl_2
#$mih_wl_2 add-mac $tmp_wl_2
#configure the MOBILE NODE
#Mac/802_16 set debug_ 1
#set wl_node_3 [$ns node 4.0.2]
# create the node with given @.
#$wl_node_3 random-motion 0 ;# disable random
#$wl_node_3 base-station [AddrParams addr2id [$bstation_2 node-addr]] ;#
#$wl_node_3 set X_ 2300
#$wl_node_3 set Y_ 1200
#$wl_node_3 set Z_ 0.0
#$wl_node_3 label “empat”
#set clas_wl_3 [new SDUClassifier/Dest]
#[$wl_node_3 set mac_(0)] add-classifier $clas_wl_3
#set the scheduler for the node. Must be changed to -shed [new $opt(sched)]
#set ss_sched_wl_3 [new WimaxScheduler/SS]
#[$wl_node_3 set mac_(0)] set-scheduler $ss_sched_wl_3
#[$wl_node_3 set mac_(0)] set-channel 0
#$multiFaceNode_wl_3 add-interface-node $wl_node_3
#set nd_mn_wl_3 [$wl_node_3 install-nd]
#set handover_wl_3 [new Agent/MIHUser/IFMNGMT/MIPV6/Handover/Handover1]
#$multiFaceNode_wl_3 install-ifmanager $handover_wl_3
#$nd_mn_wl_3 set-ifmanager $handover_wl_3
# install MIH in multi-interface node
#set mih_wl_3 [$multiFaceNode_wl_3 install-mih]
#$handover_wl_3 connect-mih $mih_wl_3
#set tmp_wl_3 [$wl_node_3 set mac_(0)]
#$handover_wl_3 nd_mac $nd_mn_wl_3 $tmp_wl_3
#$tmp_wl_3 mih $mih_wl_3
#$mih_wl_3 add-mac $tmp_wl_3
#configure the MOBILE NODE
#Mac/802_16 set debug_ 1
#set wl_node_4 [$ns node 4.0.3]
# create the node with given @.
#$wl_node_4 random-motion 0 ;# disable random
#$wl_node_4 base-station [AddrParams addr2id [$bstation_2 node-addr]] ;#
#$wl_node_4 set X_ 2300
#$wl_node_4 set Y_ 1460
#$wl_node_4 set Z_ 0.0
#$wl_node_4 label “lima”
#set clas_wl_4 [new SDUClassifier/Dest]
#[$wl_node_4 set mac_(0)] add-classifier $clas_wl_4
#set the scheduler for the node. Must be changed to -shed [new $opt(sched)]
#set ss_sched_wl_4 [new WimaxScheduler/SS]
#[$wl_node_4 set mac_(0)] set-scheduler $ss_sched_wl_4
#[$wl_node_4 set mac_(0)] set-channel 0
#$multiFaceNode_wl_4 add-interface-node $wl_node_4
#set nd_mn_wl_4 [$wl_node_4 install-nd]
#set handover_wl_4 [new Agent/MIHUser/IFMNGMT/MIPV6/Handover/Handover1]
#$multiFaceNode_wl_4 install-ifmanager $handover_wl_4
#$nd_mn_wl_4 set-ifmanager $handover_wl_4
# install MIH in multi-interface node
#set mih_wl_4 [$multiFaceNode_wl_4 install-mih]
#$handover_wl_4 connect-mih $mih_wl_4
#set tmp_wl_4 [$wl_node_4 set mac_(0)]
#$handover_wl_4 nd_mac $nd_mn_wl_4 $tmp_wl_4
#$tmp_wl_4 mih $mih_wl_4
#$mih_wl_4 add-mac $tmp_wl_4
# configure each Base station 802.16
set nd_bs_0 [$bstation_0 install-nd]
$nd_bs_0 set-router TRUE
$nd_bs_0 router-lifetime 250
$ns at 1 “$nd_bs_0 start-ra”
set mih_bs_0 [$bstation_0 install-mih]
set tmp2_0 [$bstation_0 set mac_(0)] ;#in 802.16 one interface is created
$tmp2_0 mih $mih_bs_0
$mih_bs_0 add-mac $tmp2_0
set nd_bs_1 [$bstation_1 install-nd]
$nd_bs_1 set-router TRUE
$nd_bs_1 router-lifetime 250
$ns at 1 “$nd_bs_1 start-ra”
set mih_bs_1 [$bstation_1 install-mih]
set tmp2_1 [$bstation_1 set mac_(0)] ;#in 802.16 one interface is created
$tmp2_1 mih $mih_bs_1
$mih_bs_1 add-mac $tmp2_1
set nd_bs_2 [$bstation_2 install-nd]
$nd_bs_2 set-router TRUE
$nd_bs_2 router-lifetime 250
$ns at 1 “$nd_bs_2 start-ra”
set mih_bs_2 [$bstation_2 install-mih]
set tmp2_2 [$bstation_2 set mac_(0)] ;#in 802.16 one interface is created
$tmp2_2 mih $mih_bs_2
$mih_bs_2 add-mac $tmp2_2
# add link to backbone
$ns duplex-link $bstation_0 $router 100Mb 1ms DropTail 1000
$ns duplex-link $bstation_1 $router 100Mb 1ms DropTail 1000
$ns duplex-link $bstation_2 $router 100Mb 1ms DropTail 1000
#***************************
#setup sender side
set tcp_0 [new Agent/TCP/Linux]
#tcp_0 set window_ 128
$tcp_0 set flow_ 0
$tcp_0 set class_ 0
$ns color 0 green
$tcp_0 set timestamps_ true
$ns at 0 “$tcp_0 select_ca newreno”
#$tcp_0 set packetSize_ 1000
$ns attach-agent $wl_node_0 $tcp_0
#setup sender side
set tcp_1 [new Agent/TCP/Linux]
#$tcp_1 set window_ 128
$tcp_1 set fid_ 1
$tcp_1 set class_ 1
$ns color 1 blue
$tcp_1 set timestamps_ true
$tcp_1 set flow_ 1
$ns at 0 “$tcp_1 select_ca newreno”
#$tcp_1 set packetSize_ 1500
$ns attach-agent $wl_node_1 $tcp_1
#setup sender side
#set tcp_2 [new Agent/TCP/Linux]
#tcp_2 set window_ 128
#$tcp_2 set fid_ 2
#$tcp_2 set class_ 2
#$ns color 2 white
#$tcp_2 set timestamps_ true
#$tcp_2 set flow_ 2
#$ns at 2 “$tcp_2 select_ca westwood”
#tcp_2 set packetSize_ 1500
#$ns attach-agent $wl_node_2 $tcp_2
#setup sender side
#set tcp_3 [new Agent/TCP/Linux]
#$tcp_3 set fid_ 3
#tcp_3 set window_ 128
#$tcp_3 set class_ 3
#$ns color 3 cyan
#$tcp_3 set timestamps_ true
#$tcp_3 set flow_ 3
#$ns at 0 “$tcp_3 select_ca westwood”
#tcp_3 set packetSize_ 1500
#$ns attach-agent $wl_node_3 $tcp_3
#setup sender side
#set tcp_4 [new Agent/TCP/Linux]
#$tcp_4 set fid_ 4
#tcp_4 set window_ 128
#$tcp_4 set class_ 4
#$ns color 4 purple
#$tcp_4 set timestamps_ true
#$tcp_4 set flow_ 4
#$ns at 0 “$tcp_4 select_ca westwood”
#tcp_4 set packetSize_ 1500
#$ns attach-agent $wl_node_4 $tcp_4
set TCPtraceFile_0 [open indah.tr w]
$tcp_0 tracevar cwnd_
$tcp_0 attach $TCPtraceFile_0
set TCPtraceFile_1 [open rizka.tr w]
$tcp_1 tracevar cwnd_
$tcp_1 attach $TCPtraceFile_1
#set TCPtraceFile_2 [open rina.tr w]
#$tcp_2 tracevar cwnd_
#$tcp_2 attach $TCPtraceFile_2
#set TCPtraceFile_3 [open bintang.tr w]
#$tcp_3 tracevar cwnd_
#$tcp_3 attach $TCPtraceFile_3
#set TCPtraceFile_4 [open aditya.tr w]
#$tcp_4 tracevar cwnd_
#$tcp_4 attach $TCPtraceFile_4
#set up receiver side
set sink_0 [new Agent/TCPSink/Sack1]
$sink_0 set ts_echo_rfc1323_ true
$ns attach-agent $CN $sink_0
$ns attach-agent $CN $sink_0
$multiFaceNode_wl_0 attach-agent $tcp_0 $wl_node_0
$handover_wl_0 add-flow $tcp_0 $sink_0 $wl_node_0 1 2000.
set sink_1 [new Agent/TCPSink/Sack1]
$sink_1 set ts_echo_rfc1323_ true
$ns attach-agent $CN $sink_1
$ns attach-agent $CN $sink_1
#Multiface node is transmitter
$multiFaceNode_wl_1 attach-agent $tcp_1 $wl_node_1
$handover_wl_1 add-flow $tcp_1 $sink_1 $wl_node_1 1 2000.
#set sink_2 [new Agent/TCPSink/Sack1]
#$sink_2 set ts_echo_rfc1323_ true
#$ns attach-agent $CN $sink_2
# $ns attach-agent $CN $sink_2
# #Multiface node is transmitter
# $multiFaceNode_wl_2 attach-agent $tcp_2 $wl_node_2
# $handover_wl_2 add-flow $tcp_2 $sink_2 $wl_node_2 1 2000.
#
# set sink_3 [new Agent/TCPSink/Sack1]
#$sink_3 set ts_echo_rfc1323_ true
#$ns attach-agent $CN $sink_3
# $ns attach-agent $CN $sink_3
# #Multiface node is transmitter
# $multiFaceNode_wl_3 attach-agent $tcp_3 $wl_node_3
# $handover_wl_3 add-flow $tcp_3 $sink_3 $wl_node_3 1 2000.
# set sink_4 [new Agent/TCPSink/Sack1]
#$sink_4 set ts_echo_rfc1323_ true
#$ns attach-agent $CN $sink_4
# $ns attach-agent $CN $sink_4
#Multiface node is transmitter
# $multiFaceNode_wl_4 attach-agent $tcp_4 $wl_node_4
# $handover_wl_4 add-flow $tcp_4 $sink_4 $wl_node_4 1 2000.
#set up application
set ftp_0 [new Application/FTP]
$ftp_0 attach-agent $tcp_0
#ftp_0 send 500
#$ftp_0 set rate_ 24.6
#$ftp produce n ;#source akan menghasilkan ftp n paket skaligus
#$ftp producemore ;#ftp menghasilkan lebih banyak paket
#$ftp maxpkts_ 20000 Mb
$ftp_0 set type_ FTP
set ftp_1 [new Application/FTP]
$ftp_1 attach-agent $tcp_1
#ftp_1 send 500
#ftp_1 set rate_ 24.6
#$ftp produce n ;#source akan menghasilkan ftp n paket skaligus
#$ftp producemore ;#ftp menghasilkan lebih banyak paket
#$ftp maxpkts_ 20000 Mb
$ftp_1 set type_ FTP
#set ftp_2 [new Application/FTP]
#$ftp_2 attach-agent $tcp_2
#ftp_2 send 500
#ftp_2 set rate_ 24.6
#$ftp produce n ;#source akan menghasilkan ftp n paket skaligus
#$ftp producemore ;#ftp menghasilkan lebih banyak paket
#$ftp maxpkts_ 20000 Mb
#$ftp_2 set type_ FTP
#set ftp_3 [new Application/FTP]
#$ftp_3 attach-agent $tcp_3
#ftp_3 send 500
#ftp_3 set rate_ 24.6
#$ftp produce n ;#source akan menghasilkan ftp n paket skaligus
#$ftp producemore ;#ftp menghasilkan lebih banyak paket
#$ftp maxpkts_ 20000 Mb
#$ftp_3 set type_ FTP
#set ftp_4 [new Application/FTP]
#$ftp_4 attach-agent $tcp_4
#ftp_4 send 500
#ftp_4 set rate_ 24.6
#$ftp produce n ;#source akan menghasilkan ftp n paket skaligus
#$ftp producemore ;#ftp menghasilkan lebih banyak paket
#$ftp maxpkts_ 20000 Mb
#$ftp_4 set type_ FTP
$ns at 1 “$cbr1 start”
$ns at 60 “$cbr1 stop”
$ns at 1 “$cbr2 start”
$ns at 60 “$cbr2 stop”
$ns at $moveStart “$wl_node_0 setdest $X0_dst $Y0_dst $moveSpeed_0”
$ns at $moveStart “$wl_node_1 setdest 1250 1449 $moveSpeed_1”
$ns at 27.5 “$wl_node_1 setdest 2300 1175 $moveSpeed_1”
#$ns at $moveStart “$wl_node_2 setdest $X2_dst $Y2_dst $moveSpeed_2”
#$ns at $moveStart “$wl_node_3 setdest $X3_dst $Y3_dst $moveSpeed_3”
#$ns at $moveStart “$wl_node_4 setdest $X4_dst $Y4_dst $moveSpeed_4”
#Start the application 1sec before the MN is entering the WiMAX cell
#$ns at [expr $moveStart – 1] “$ftp_0 start”
#Stop the application according to another poisson distribution (note that we
#$ns at [expr $moveStop + 1] “$ftp_0 stop”
$ns at 5 “$ftp_0 start”
#Stop the application according to another poisson distribution (note that we
$ns at 60 “$ftp_0 stop”
#Start the application 1sec before the MN is entering the WiMAX cell
#$ns at [expr $moveStart – 1] “$ftp_1 start”
#Stop the application according to another poisson distribution (note that we
#$ns at [expr $moveStop + 1] “$ftp_1 stop”
$ns at 5 “$ftp_1 start”
#Stop the application according to another poisson distribution (note that we
$ns at 60 “$ftp_1 stop”
#Start the application 1sec before the MN is entering the WiMAX cell
#$ns at [expr $moveStart – 1] “$ftp_2 start”
#Stop the application according to another poisson distribution (note that we
#$ns at [expr $moveStop + 1] “$ftp_2 stop”
#Start the application 1sec before the MN is entering the WiMAX cell
#$ns at [expr $moveStart – 1] “$ftp_3 start”
#Stop the application according to another poisson distribution (note that we
#$ns at [expr $moveStop + 1] “$ftp_3 stop”
#Start the application 1sec before the MN is entering the WiMAX cell
#$ns at [expr $moveStart – 1] “$ftp_4 start”
#Stop the application according to another poisson distribution (note that we
#$ns at [expr $moveStop + 1] “$ftp_4 stop”
$ns at $moveStop “finish”
puts “Running simulation for $opt(nbMN) mobile nodes…”
$ns run
puts “Simulation done.”
thanks