LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 02-05-2011, 04:00 AM   #1
bluetooth
LQ Newbie
 
Registered: Feb 2011
Posts: 7

Rep: Reputation: 0
Unhappy wireless implementation in ns2


not able to solve an error when i try to do a wireless scenario in ns2.


num_nodes is set 3
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
 
Old 02-05-2011, 06:33 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,170

Rep: Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645
Welcome to LQ.

May be start here http://www.linuxquestions.org/linux/...Ask_a_Question
http://linuxsilo.net/docs/smart-questions_en.html

Much more information is required :
Always tell, which Linux OS ( Ubuntu <version> <name> ),
you are using for the application in question, please.
And the application, <version> : ns-allinone-2.34 ?
The command, that is used. And the location. ( $ pwd will tell.)
Also : If you wrote the file.tcl yourself or used a modified one.

Example : cd ns-allinone-2.34/ns-2.34/tcl/ex
ns wireless-mitf.tcl : No errors.
Or : ns wireless.tcl : Also OK.

..
 
1 members found this post helpful.
Old 02-07-2011, 11:38 PM   #3
bluetooth
LQ Newbie
 
Registered: Feb 2011
Posts: 7

Original Poster
Rep: Reputation: 0
Thanx knudfl. I rectified the error. It was just a mistake in the code i had written. But certainly i'll keep in mind your tip.
 
Old 02-22-2012, 04:07 AM   #4
eyana
LQ Newbie
 
Registered: Jul 2011
Posts: 16

Rep: Reputation: Disabled
sctp in wireless scenario

Hi!

I got the same error.

I'm using ns2.33 and I modified the simple-wireless.tcl.

My code is below:

Trace set show_sctphdr_ 1

# ======================================================================

# 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) 2 ;# number of mobilenodes

set val(rp) DSDV ;# routing protocol



# ======================================================================

# Main Program

# ======================================================================

#

# Initialize Global Variables

#

set ns [new Simulator]


set tr [open simple.tr w]

$ns trace-all $tr

set nf [open simple.nam w]
$ns namtrace-all $nf



# set up topography object

set topo [new Topography]



$topo load_flatgrid 500 500



#

# Create God

#

create-god $val(nn)



#

# Create the specified number of mobilenodes [$val(nn)] and "attach" them

# to the channel.

# Here two nodes are created : node(0) and node(1)



# configure node



$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) \

-channelType $val(chan) \

-topoInstance $topo \

-agentTrace ON \

-routerTrace ON \

-macTrace OFF \

-movementTrace OFF



for {set i 0} {$i < $val(nn) } {incr i} {

set node_($i) [$ns node]

$node_($i) random-motion 0 ;# disable random motion

}



#

# Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes

#

$node_(0) set X_ 5.0

$node_(0) set Y_ 2.0

$node_(0) set Z_ 0.0



$node_(1) set X_ 390.0

$node_(1) set Y_ 385.0

$node_(1) set Z_ 0.0



#

# Now produce some simple node movements

# Node_(1) starts to move towards node_(0)

#

$ns at 50.0 "$node_(1) setdest 25.0 20.0 15.0"

$ns at 10.0 "$node_(0) setdest 20.0 18.0 1.0"



# Node_(1) then starts to move away from node_(0)

$ns at 100.0 "$node_(1) setdest 490.0 480.0 15.0"



# Setup traffic flow between nodes

# SCTP connections between node_(0) and node_(1)



set sctp0 [new Agent/SCTP]
$ns attach-agent $node_(0) $sctp0
$sctp0 set fid_ 1
set cbr0 [new Application/Traffic/CBR]

# set traffic class to 1

$cbr0 set class_ 1
$cbr0 attach-agent $sctp0

# Create a Null sink to receive Data

set sinknode1 [new Agent/LossMonitor]
$ns attach-agent $node_(1) $sinknode1
set sctp1 [new Agent/SCTP]
$ns attach-agent $node_(1) $sctp1
$sctp1 set fid_ 2
set cbr1 [new Application/Traffic/CBR]
$cbr1 set class_ 2
$cbr1 attach-agent $sctp1
set sinknode0 [new Agent/LossMonitor]
$ns attach-agent $node_(0) $sinknode0
$ns connect $sctp0 $sctp1


#

# Tell nodes when the simulation ends

#

for {set i 0} {$i < $val(nn) } {incr i} {

$ns at 150.0 "$node_($i) reset";

}

$ns at 15.0 "stop"

$ns at 15.01 "puts \"NS EXITING...\" ; $ns halt"

proc stop {} {

global ns tracefd

$ns flush-trace

close $tracefd

}



Please help me.

Thank you very much.
 
Old 02-22-2012, 05:10 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,170

Rep: Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645
Post #4, @eyana : Please edit post #4 to use CODE tags :
Write [/code] at code text end, and [code] at text start.
Or use the # button in the Advanced Editor : Edit > Go Advanced.
http://www.linuxquestions.org/questi....php?do=bbcode


Quote:
I got the same error.
Same as what ? ? No errors were indicated in post #1.

.
 
Old 02-22-2012, 11:11 PM   #6
eyana
LQ Newbie
 
Registered: Jul 2011
Posts: 16

Rep: Reputation: Disabled
I'm sorry. I made correction for post #4.

When I run this code I got the same output as #1 and the simple.tr file was blank. Also nam didn't appear.

Code:
Trace set show_sctphdr_ 1

# ======================================================================

# 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) 2 ;# number of mobilenodes

set val(rp) DSDV ;# routing protocol



# ======================================================================

# Main Program

# ======================================================================

#

# Initialize Global Variables

#

set ns [new Simulator]


set tr [open simple.tr w]

$ns trace-all $tr

set nf [open simple.nam w]
$ns namtrace-all $nf



# set up topography object

set topo [new Topography]

$topo load_flatgrid 500 500

# Create God
create-god $val(nn)

# Create the specified number of mobilenodes [$val(nn)] and "attach" them
# to the channel.
# Here two nodes are created : node(0) and node(1)

# configure node
$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) \

-channelType $val(chan) \

-topoInstance $topo \

-agentTrace ON \

-routerTrace ON \

-macTrace OFF \

-movementTrace OFF

for {set i 0} {$i < $val(nn) } {incr i} {

set node_($i) [$ns node]

$node_($i) random-motion 0 ;# disable random motion

}



#

# Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes

#

$node_(0) set X_ 5.0

$node_(0) set Y_ 2.0

$node_(0) set Z_ 0.0



$node_(1) set X_ 390.0

$node_(1) set Y_ 385.0

$node_(1) set Z_ 0.0

#

# Now produce some simple node movements

# Node_(1) starts to move towards node_(0)

#

$ns at 50.0 "$node_(1) setdest 25.0 20.0 15.0"

$ns at 10.0 "$node_(0) setdest 20.0 18.0 1.0"


# Node_(1) then starts to move away from node_(0)

$ns at 100.0 "$node_(1) setdest 490.0 480.0 15.0"


# Setup traffic flow between nodes

# SCTP connections between node_(0) and node_(1)

set sctp0 [new Agent/SCTP]
$ns attach-agent $node_(0) $sctp0
$sctp0 set fid_ 1
set cbr0 [new Application/Traffic/CBR]

# set traffic class to 1

$cbr0 set class_ 1
$cbr0 attach-agent $sctp0

# Create a Null sink to receive Data

set sinknode1 [new Agent/LossMonitor]
$ns attach-agent $node_(1) $sinknode1
set sctp1 [new Agent/SCTP]
$ns attach-agent $node_(1) $sctp1
$sctp1 set fid_ 2
set cbr1 [new Application/Traffic/CBR]
$cbr1 set class_ 2
$cbr1 attach-agent $sctp1
set sinknode0 [new Agent/LossMonitor]
$ns attach-agent $node_(0) $sinknode0
$ns connect $sctp0 $sctp1

#

# Tell nodes when the simulation ends

#

for {set i 0} {$i < $val(nn) } {incr i} {

$ns at 150.0 "$node_($i) reset";

}

$ns at 15.0 "stop"

$ns at 15.01 "puts \"NS EXITING...\" ; $ns halt"

proc stop {} {

global ns tracefd

$ns flush-trace

close $tracefd

}
Please help me.
 
Old 02-23-2012, 03:10 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,170

Rep: Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645Reputation: 2645
Post # 4 : Please hit the Edit button : Code tags are required.

A tcl file that 1) generates a trace file ? , 2) starts nam,
can look like this ( Template.tcl )
Code:
# start with these lines :

set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf

proc finish {} {
        global ns nf
        $ns flush-trace
        close $nf
        exec nam out.nam &
        exit 0
}

#######################



#######################

# end with :

$ns at 5.0 "finish"
$ns run
.

Last edited by knudfl; 02-23-2012 at 06:38 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hwmp implementation on ns2.28 hend baklouti Linux - Software 14 06-22-2013 05:21 AM
ns2 Wireless simulation Help md_imranullah Programming 1 06-13-2012 03:19 AM
Regarding NS2 implementation lalithimral Programming 1 05-03-2011 05:17 PM
i am using ubuntu as os. for NS2 to implement a routing protocol in ns2. sujovasu Programming 1 07-27-2010 02:44 AM
wireless shared internet service: which authentication implementation? F1uX Linux - Security 3 01-21-2004 07:43 AM


All times are GMT -5. The time now is 12:33 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration