Forum Replies Created
In fact, I realized that wired nodes in my script were considered as wireless ones so I changed the script using wired-cum-wireless model. Nodes are communicating if the hierarchical addressing is not activated. However, when it is activated, I have the following error :
Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) —
_o94: no target for slot 0
_o94 type: Classifier/Hier
content dump:
classifier _o94
0 offset
0 shift
2147483647 mask
0 slots
Finished standard no-slot{} default handler
just when the sender SCTP agent (_094) starts sending .
Here is my script :
#======================================================================
# Define options
# ======================================================================
set val(chan) Channel/WirelessChannel ;#Channel Type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 11 ;# number of nodes
set val(mn) 9 ;# number of mobilenodes
set val(rp) DSDV ;# routing protocol
set val(x) 700.0
set val(y) 700.0
set num_wired_nodes 2
set num_bs_nodes 3
Trace set show_sctphdr_ 1
Agent/SCTP set numUnrelStreams_ 0 ;# Voice streams are unreliable
Mac/802_11 set dataRate_ 54.0e+6
Mac/802_11 set basicRate_ 1.0e+6
Mac/802_11 set PLCPDataRate_ 6.0e+6
Mac/802_11 set SlotTime_ 0.000010
Mac/802_11 set SIFS_ 0.000020
Mac/802_11 set CWMax_ 1023
Mac/802_11 set DIFS_ 0.000020
Mac/802_11 set CWMin_ 15
Mac/802_11 set PF_ 2
Mac/802_11 set PreambleLength_ 72
Antenna/OmniAntenna set Gt_ 1 ;#Transmit antenna gain
Antenna/OmniAntenna set Gr_ 1 ;#Receive antenna gain
Phy/WirelessPhy set CPThresh_ 10.0 ;#//Collision Threshold
Phy/WirelessPhy set L_ 1.0 ;#System Loss Factor
Phy/WirelessPhy set Freq_ 2.412e+9
Phy/WirelessPhy set CSThresh_ 1.559e-11
Phy/WirelessPhy set RXThresh_ 3.652e-10
Phy/WirelessPhy set Pt_ 0.1
Phy/WirelessPhy set Pt_consume 0.1
Phy/WirelessPhy set P_idle 0.004
Phy/WirelessPhy set Bandwidth_ 54e+6
#=====================================================================
# Main Program
#======================================================================
# Initialize Global Variables
set ns_ [new Simulator]
# set up for hierarchical routing
$ns_ node-config -addressType hierarchical
AddrParams set domain_num_ 4
lappend cluster_num 2 1 1 1
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 4 1 4
AddrParams set nodes_num_ $eilastlevel
set namfd [open infra-sctp9.nam w]
$ns_ namtrace-all-wireless $namfd $val(x) $val(y)
set tracefd [open infra-sctp9.tr w]
$ns_ trace-all $tracefd
# set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
# Create God
create-god $val(nn)
puts “Wired Nodes def 4”
set temp {0.0.0 0.1.0}
for {set i 0} {$i < $num_wired_nodes} {incr i} {
set W_($i) [$ns_ node [lindex $temp $i]]
}
$W_(0) set X_ 10.0
$W_(0) set Y_ 200.0
$W_(0) set Z_ 0.0
$W_(0) color chocolate
$W_(1) set X_ 360.0
$W_(1) set Y_ 200.0
$W_(1) set Z_ 0.0
$W_(1) color chocolate
set HA_GW $W_(0)
set FA_GW $W_(1)
$W_(0) label “HA_GW”
$W_(1) label “FA_GW”
# Create channel
set chan_1_ [new $val(chan)]
$ns_ node-config -adhocRouting $val(rp)
-llType $val(ll)
-macType $val(mac)
-ifqType $val(ifq)
-ifqLen $val(ifqlen)
-antType $val(ant)
-propType $val(prop)
-phyType $val(netif)
-topoInstance $topo
-wiredRouting ON
-agentTrace ON
-routerTrace ON
-macTrace ON
-movementTrace ON
-channel $chan_1_
puts “Nodes def 1”
set temp {1.0.0 1.0.1 1.0.2 1.0.3}
set node_(0) [$ns_ node [lindex $temp 0]]
$node_(0) random-motion 0 ;# disable random motion
set mac_(0) [$node_(0) getMac 0]
$mac_(0) set RTSThreshold_ 3000
for {set i 1} {$i < 4} {incr i} {
set node_($i) [$ns_ node [lindex $temp $i]]
$node_($i) random-motion 0 ;# disable random motion
set mac_($i) [$node_($i) getMac 0]
$mac_($i) set RTSThreshold_ 3000
}
puts “Nodes def 2”
set node_(4) [$ns_ node 2.0.0]
$node_($i) random-motion 0 ;# disable random motion
set mac_(4) [$node_(4) getMac 0]
$mac_(4) set RTSThreshold_ 3000
puts “Nodes def 3”
set temp {3.0.1 3.0.2 3.0.3}
for {set i 5} {$i < 8 } {incr i} {
set node_($i) [$ns_ node [lindex $temp
[expr $i-5]]]
$node_($i) random-motion 0 ;# disable random motion
set mac_($i) [$node_($i) getMac 0]
$mac_($i) set RTSThreshold_ 3000
}
set node_(8) [$ns_ node 3.0.0]
$node_(8) random-motion 0 ;# disable random motion
set mac_(8) [$node_(8) getMac 0]
$mac_(8) set RTSThreshold_ 3000
set addrHA [$node_(0) node-addr]
for {set j 1} {$j < 4} {incr j} {
$node_($j) base-station [AddrParams addr2id $addrHA]
}
set addrCNAP [$node_(8) node-addr]
for {set j 5} {$j < 8} {incr j} {
$node_($j) base-station [AddrParams addr2id $addrCNAP]
}
$node_(0) set X_ 10.0
$node_(0) set Y_ 100.0
$node_(0) set Z_ 0.0
$node_(0) color Red
$node_(1) set X_ 150.0
$node_(1) set Y_ 80.0
$node_(1) set Z_ 0.0
$node_(1) color Blue
$node_(1) label “if0”
$node_(2) set X_ 160.0
$node_(2) set Y_ 80.0
$node_(2) set Z_ 0.0
$node_(2) color Blue
$node_(2) label “MH”
$node_(3) set X_ 170.0
$node_(3) set Y_ 80.0
$node_(3) set Z_ 0.0
$node_(3) color Blue
$node_(3) label “if1”
$node_(4) set X_ 360.0
$node_(4) set Y_ 100.0
$node_(4) set Z_ 0.0
$node_(4) color Red
$node_(5) set X_ 100.0
$node_(5) set Y_ 300.0
$node_(5) set Z_ 0.0
$node_(5) color Green
$node_(5) label “CN-if0”
$node_(6) set X_ 110.0
$node_(6) set Y_ 300.0
$node_(6) set Z_ 0.0
$node_(6) color Green
$node_(6) label “CN”
$node_(7) set X_ 120.0
$node_(7) set Y_ 300.0
$node_(7) set Z_ 0.0
$node_(7) color Green
$node_(7) label “CN-if1”
$node_(8) set X_ 100.0
$node_(8) set Y_ 250.0
$node_(8) set Z_ 0.0
$node_(8) color Red
$node_(8) label “CN-AP”
#Set Node 0 , Node $4 and Node $8 as the APs. Thus the APs are the ends of the horizontal line. Each STA receives different power levels.
set HA $node_(0)
set AP_ADDR1 [$mac_(0) id]
$mac_(0) ap $AP_ADDR1
set FA $node_(4)
set AP_ADDR2 [$mac_(4) id]
$mac_(4) ap $AP_ADDR2
set CN_AP $node_(8)
set AP_ADDR3 [$mac_(8) id]
$mac_(8) ap $AP_ADDR3
$HA label “HA”
$FA label “FA”
set MH_core $node_(2)
set MH_if0 $node_(1)
set MH_if1 $node_(3)
set CN_core $node_(6)
set CN_if0 $node_(5)
set CN_if1 $node_(7)
$mac_(1) ScanType ACTIVE
#$mac_(5) ScanType ACTIVE
for {set i 2} {$i < 4} {incr i} {
$mac_($i) ScanType PASSIVE ;#Passive
}
for {set i 5} {$i < 8} {incr i} {
$mac_($i) ScanType PASSIVE ;#Passive
}
$ns_ duplex-link $HA $HA_GW 5Mb 200ms DropTail
$ns_ duplex-link $FA $FA_GW 5Mb 200ms DropTail
#$ns_ duplex-link $HA_GW $FA_GW 5Mb 2ms DropTail
$ns_ duplex-link $CN_AP $HA_GW 5Mb 200ms DropTail
$ns_ duplex-link $CN_AP $FA_GW 5Mb 200ms DropTail
set sctp0 [new Agent/SCTP]
$sctp0 set-multihome-core $MH_core
$ns_ multihome-add-interface $MH_core $MH_if0
$ns_ multihome-add-interface $MH_core $MH_if1
$ns_ multihome-attach-agent $MH_core $sctp0
set entry_MH [$MH_core entry]
puts “MH entry : $entry_MH “
$entry_MH install 0 $MH_if0
#set MHslots [$entry_MH slot 0]
#puts “MH slots: $MHslots “
$sctp0 force-source $MH_if0
$sctp0 set usNumStreams 2 ;# nb streams =2
$sctp0 set debugMask_ -1 # u can use -1 to turn oneverything
$sctp0 set debugFileIndex_ 1
#$sctp0 set heartbeatInterval_ 1
set trace_ch [open trace-infra9.sctp w]
#$sctp0 set trace_all_ 1 ;# print all on a single trace event
#$sctp0 trace rto_
#$sctp0 trace errorCount_
$sctp0 attach $trace_ch
set sctp1 [new Agent/SCTP]
$sctp1 set-multihome-core $CN_core
$ns_ multihome-add-interface $CN_core $CN_if0
$ns_ multihome-add-interface $CN_core $CN_if1
$ns_ multihome-attach-agent $CN_core $sctp1
$sctp1 force-source $CN_if0
$ns_ connect $sctp0 $sctp1
$sctp0 set-primary-destination $CN_if0
$sctp1 set-primary-destination $MH_if0
#$MH_core add-route $CN_core [$MH_if0 entry]
set voice [new Application/Traffic/CBR]
$voice attach-agent $sctp0
set ftp0 [new Application/FTP]
$ftp0 attach-agent $sctp0
set ftp1 [new Application/FTP]
$ftp1 attach-agent $sctp1
#Application/Traffic/CBR set packetSize_ 1023
#Application/Traffic/CBR set rate_ 256Kb
for {set i 0} {$i < 9} {incr i} {
set entry_($i) [$node_($i) entry]
puts “node($i) entry : $entry_($i) “
set neighbors_($i) [$node_($i) neighbors]
puts “node($i) neighbors : $neighbors_($i) “
}
for {set i 0} {$i < 2} {incr i} {
set Wneighbors_($i) [$W_($i) neighbors]
puts “W($i) neighbors : $Wneighbors_($i) “
}
$ns_ at 0.01 ” puts “Nodes in position” ; $node_(0) setdest 10.0 100.0 500.0 ; $node_(4) setdest 360.0 100.0 500.0 ; $node_(1) setdest 150.0 80.0 500.0 ; $node_(2) setdest 160.0 80.0 500.0 ; $node_(3) setdest 170.0 80.0 500.0; $node_(5) setdest 100.0 300.0 500.0 ; $node_(6) setdest 110.0 300.0 500.0 ; $node_(7) setdest 120.0 300.0 500.0 ; $node_(8) setdest 100.0 250.0 500.0 “
#$ns_ at 1.0 “$ftp0 start ; $ftp1 start ; $voice start “
$ns_ at 1.0 “$ftp0 start ” ;
#$ns_ at 1.0 “$ftp0 start ; $voice start” ;
#$ns_ at 2.0 “$voice start” ;
#$ns_ at 1.5 “$ftp1 start” ;
$ns_ at 1.05 ” puts “flows generated””
$ns_ at 3.0 ” puts “MH mvt -> ” ; $node_(1) setdest 340.0 80.0 50.0 ; $node_(2) setdest 350.0 80.0 50.0 ; $node_(3) setdest 360.0 80.0 50.0″
#$ns_ at 5.5 “$voice start” ;
$ns_ at 30.0 ” puts “MH mvt<- " ; $node_(1) setdest 10.0 80.0 50.0 ; $node_(2) setdest 20.0 80.0 50.0 ; $node_(3) setdest 30.0 80.0 50.0"
$ns_ at 50.0 ” puts “MH mvt -> ” ; $node_(1) setdest 340.0 80.0 50.0 ; $node_(2) setdest 350.0 80.0 50.0 ; $node_(3) setdest 360.0 80.0 50.0″
for {set i 0} {$i < $val(mn) } {incr i} {
$ns_ at 120.0 “$node_($i) reset”;
}
$ns_ at 120.1 “stop”
proc stop {} {
global ns_
puts “finish”
#exec nam infra-sctp.nam &
$ns_ flush-trace
#close $tracefd
exit 0
}
puts “Starting Simulation…”
$ns_ run
@CharlesPandian wrote:
First try to reduce the distance between MN and HA and run the simulation.
I have a distance of ~50m between MN and HA and I tested a CSthresh = 3.5*10-10.
Also in the trace file, the authentication is accomplished between them. The problem is to establish routes.
Do I need to use ping to establish routes??
I found in mtp.tcl that a ping is used to establish routes. Is it an earlier version??
I am using ns2.33
I expect to simulate the handover of the mobile node and mainly to observe how the mobility is managed with SCTP.
I already tried the script in the case of a wired network and it works.
However, when I use 802.11 at the mac layer, there is no packet transmission between the mobile node and the HA.
It seems like the route between the MN and HA can’t be defined.
I have a message “Node(7) is not defined in the array”!!
@CharlesPandian wrote:
What kind of result you are getting? And what kind of result you are expecting? – Just explain briefly.
What version of ns you are using?