NS2_Reno, cwnd, ip packet size의 11Mbps 무선랜, 100Mbps유선랜 ns2_upstream10/downstream10

|

Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 3.1622777e-14
Phy/WirelessPhy set RXThresh_ 3.1622777e-13
Phy/WirelessPhy set bandwidth_ 11Mb
Phy/WirelessPhy set Pt_ 0.031622777
Phy/WirelessPhy set freq_ 2.472e9
Phy/WirelessPhy set L_ 1.0
#######################################

set opt(chan)           Channel/WirelessChannel    ;# channel type
set opt(prop)           Propagation/TwoRayGround   ;# radio-propagation model
set opt(netif)          Phy/WirelessPhy            ;# network interface type
set opt(mac)            Mac/802_11                 ;# MAC type
#set opt(ifq)            Queue/DropTail/PriQueue    ;# interface queue type
set opt(ifq)  CMUPriQueue
set opt(ll)             LL                         ;# link layer type
set opt(ant)            Antenna/OmniAntenna        ;# antenna model
set opt(ifqlen)         [lindex $argv 1]                         ;# max packet in ifq
set opt(data)             [lindex $argv 0]                         ;# number of mobilenodes
set opt(nm)             [expr $opt(data)]                         ;# number of mobilenodes
set opt(adhocRouting)   DSDV                       ;# routing protocol
#set opt(adhocRouting)   DumbAgent   ;#KDH

set opt(cp)             ""                         ;# connection pattern file
#set opt(sc)     "../mobility/scene/scen-3-test"    ;# node movement file.
set opt(sc)             ""          ;#KDH

set opt(x)      670                            ;# x coordinate of topology
set opt(y)      670                            ;# y coordinate of topology
set opt(seed)   0.0                            ;# seed for random number gen.
set opt(stop)   500                            ;# time to stop simulation
set packetSize_ 1500                           ;#packet size
set cwnd_ 64
set opt(ftp0-start)      90.0         ;
Mac/802_11 set dataRate_ 11.0e6
#set num_wired_nodes      5
set opt(nw)      [expr $opt(nm) + 1]   ;
set num_bs_nodes         1                     ;

# ============================================================================
# check for boundary parameters and random seed
if { $opt(x) == 0 || $opt(y) == 0 } {
 puts "No X-Y boundary values given for wireless topology\n"
}
if {$opt(seed) > 0} {
 puts "Seeding Random number generator with $opt(seed)\n"
 ns-random $opt(seed)
}

# create simulator instance
set ns_   [new Simulator]

# set up for hierarchical routing
$ns_ node-config -addressType hierarchical
AddrParams set domain_num_ 2           ;# number of domains
lappend cluster_num 1 1                ;# number of clusters in each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel $opt(nw) $opt(nw)               ;# number of nodes in each cluster
AddrParams set nodes_num_ $eilastlevel ;# of each domain

set tracefd  [open up_down_stream_$opt(nm)-$opt(nm).tr w]
$ns_ trace-all $tracefd

# Create topography object
set topo   [new Topography]

# define topology
$topo load_flatgrid $opt(x) $opt(y)

# create God
create-god [expr $opt(nm) + $num_bs_nodes]

#create wired nodes
set temp {0.0.0 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 0.0.8 0.0.9 0.0.10 0.0.11 0.0.12 0.0.13 0.0.14 0.0.15 0.0.16 0.0.17 0.0.18 0.0.19 0.0.20  0.0.21 0.0.22 0.0.23 0.0.24 0.0.25 0.0.26 0.0.27 0.0.28}        ;# hierarchical addresses for wired domain
for {set i 0} {$i < $opt(nw)} {incr i} {
    set W($i) [$ns_ node [lindex $temp $i]]
}

# configure for base-station node
$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) \
                 -channelType $opt(chan) \
   -topoInstance $topo \
                 -wiredRouting ON \
   -agentTrace ON \
                 -routerTrace OFF \
                 -macTrace OFF


#create base-station node
set temp {1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28} ;# hier address to be used for wireless
                                     ;# domain
set BS(0) [$ns_ node [lindex $temp 0]]
$BS(0) random-motion 0               ;# disable random motion

# create mobilenodes in the same domain as BS(0) 
# note the position and movement of mobilenodes is as defined
# in $opt(sc)

#configure for mobilenodes
$ns_ node-config -wiredRouting OFF

  for {set j 0} {$j < $opt(nm)} {incr j} {
    set node_($j) [ $ns_ node [lindex $temp \
     [expr $j+1]] ]
    $node_($j) base-station [AddrParams addr2id \
     [$BS(0) node-addr]]
}

#create links between wired and BS nodes

for {set t 0} {$t < $opt(nm) } {incr t} {
$ns_ duplex-link $W($opt(nm)) $W($t) 100Mb 20ms DropTail
}
$ns_ duplex-link $W($opt(nm)) $BS(0) 100Mb 50ms DropTail
# setup TCP connections

#Agent/UDP set packetSize_ 1048
for {set ttt 0} {$ttt < $opt(nm) } {incr ttt} {
 set tcp_($ttt) [new Agent/TCP/Reno]
 $tcp_($ttt) set fid_ 2
 set sink_($ttt) [new Agent/TCPSink]
 $ns_ attach-agent $W($ttt) $tcp_($ttt)
 $ns_ attach-agent $node_($ttt) $sink_($ttt)
 $ns_ connect $tcp_($ttt) $sink_($ttt)
 set ftp_($ttt) [new Application/FTP]
 $ftp_($ttt) attach-agent $tcp_($ttt)
 $ns_ at $opt(ftp0-start) "$ftp_($ttt) start"

}

for {set tttt 0} {$tttt < $opt(nm)} {incr tttt} {
 set tcp_($tttt) [new Agent/TCP/Reno]
 $tcp_($tttt) set fid_ 2
 set sink_($tttt) [new Agent/TCPSink]
 $ns_ attach-agent $node_($tttt) $tcp_($tttt)
 $ns_ attach-agent $W($tttt) $sink_($tttt)
 $ns_ connect $tcp_($tttt) $sink_($tttt)
 set ftp_($tttt) [new Application/FTP]
 $ftp_($tttt) attach-agent $tcp_($tttt)
 $ns_ at $opt(ftp0-start) "$ftp_($tttt) start"

}

# Tell all nodes when the simulation ends
for {set i } {$i < $opt(nm) } {incr i} {
    $ns_ at $opt(stop).0 "$node_($i) reset";
}
$ns_ at $opt(stop).0 "$BS(0) reset";

$ns_ at $opt(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
$ns_ at $opt(stop).0001 "stop"
proc stop {} {
    global ns_ tracefd
    close $tracefd
}

# informative headers for CMUTracefile
puts $tracefd "M 0.0 nn $opt(nm) x $opt(x) y $opt(y) rp \
 $opt(adhocRouting)"
puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)"
puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"

puts "Starting Simulation..."
$ns_ run


And