LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-24-2013, 04:10 AM   #1
lavendar89
LQ Newbie
 
Registered: Sep 2013
Posts: 9

Rep: Reputation: Disabled
how to add nodes in tcl script to create topology traffic in ns2.31?


my final project is want to evaluate performance using AODV and WCETT routing protocol based on throughput..i have use the ns2.31 simulator in ubuntu 10.04..my problem is i don't know how to add more that 10 nodes in tcl script and the coding that must have for more than 10 nodes in topology traffic.everytime i want to run more than 10 nodes, the segmentation fault will be appear..like the picture that i attach..anyone can solve my problem?
Attached Thumbnails
Click image for larger version

Name:	1bnew.png
Views:	140
Size:	69.2 KB
ID:	13798  
 
Old 10-25-2013, 12:53 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Quote:
problem is I don't know how to add more that 10 nodes in tcl script
Which tcl script ? ? ?
"wcett" : That could be a CRCN patched ns-2.31 ? ?

The node limit in "test4wcett.tcl" seems to be 13 :
set val(nn) 13


Generally, if you want a question answered :
A lot more information is required ...
http://www.linuxquestions.org/linux/...Ask_a_Question
http://linuxsilo.net/docs/smart-questions_en.html

-
 
Old 10-25-2013, 09:34 AM   #3
lavendar89
LQ Newbie
 
Registered: Sep 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
thanks a lot knudfl..yes,i means test4wcett.tcl script..so by using this script, i cannot to test more the scenario for 20 nodes and above?if i change random.tcl file give the effect to test4wcett,tcl or not?..sory..i'm a newbie in ns2..
 
Old 10-28-2013, 08:16 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 3 .

? Editing test4wcett.tcl or / and random.tcl ?

You will simply have to try what works.
 
Old 11-07-2013, 09:11 AM   #5
fattabiouni
LQ Newbie
 
Registered: Sep 2013
Posts: 23

Rep: Reputation: Disabled
hi there,
im also using tcl script in ns-allinone-2.31 to do my project, seems that the throughput.awk script that you gave me previously is working....im wonder that the numbers of nodes in tcl script represent Cognitive Radio users or Primary users?

if it represent the CR users only, then, how do i need to do to add the node that represent the primary users?

thank you in advanced
 
Old 02-20-2014, 12:45 AM   #6
joseph4life
LQ Newbie
 
Registered: Feb 2014
Posts: 4

Rep: Reputation: Disabled
my final project is want to developing a cooperative protocol using AODV protocol and i have use the ns2.31 simulator in ubuntu 10.04..my problem is i don't know how to simulate node misbehaving of more that 10 nodes in tcl script, I nees ns2 code to simulate node misbehaviour .anyone can solve my problem?
 
Old 02-20-2014, 03:14 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Post #6, @joseph4life.

? Did you try with : Google .. ns2 node misbehavior ..
https://www.google.com/webhp?hl=all#...e+misbehaviour
http://www.researchgate.net/publicat...work_using_NS2
and http://elmurod.net/en/index.php/archives/196

A few lines of "malicious info" at LQ :
. http://www.linuxquestions.org/questions/tags/malicious/
. http://www.linuxquestions.org/questi...odv-malicious/

-
 
Old 02-20-2014, 10:44 PM   #8
joseph4life
LQ Newbie
 
Registered: Feb 2014
Posts: 4

Rep: Reputation: Disabled
simulation in NS2

Good day can someone help me out, Im running a simulation in NS2 and I have the below erorr how can I fix it,




Code:
this an error I got while runing my code


joseph4blues@ubuntu:~/bin2/edited_tcl$ ns Edit_cooperative.tcl
num_nodes is set 16
INITIALIZE THE LIST xListHead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
Start of simulation..
ns: _o229 setdest 700.0 700.0 3000.0: 
    (_o229 cmd line 1)
    invoked from within
"_o229 cmd setdest 700.0 700.0 3000.0"
    invoked from within
"catch "$self cmd $args" ret"
    invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
    (procedure "_o229" line 2)
    (SplitObject unknown line 2)
    invoked from within
"_o229 setdest 700.0 700.0 3000.0"

Last edited by joseph4life; 02-21-2014 at 01:16 AM. Reason: to use code tags
 
Old 02-21-2014, 12:13 AM   #9
joseph4life
LQ Newbie
 
Registered: Feb 2014
Posts: 4

Rep: Reputation: Disabled
is like i was able to fix the error in post 8, but now I have This, this is my tcl script I used for 16 nodes but Im having this error when I run the script, pls help me check



this my tcl script:

Code:
# co.tcl (802.11g)

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

# Define options 

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

set val(chan) Channel/WirelessChannel ;# channel type 

set val(prop) Propagation/TwoRayGround ;# radio-propagation model 

set val(ant) Antenna/OmniAntenna ;# Antenna type 

set val(ll) LL ;# Link layer type 

set val(ifq) Queue/DropTail/PriQueue ;# Interface queue type 

set val(ifqlen) 50 ;# max packet in ifq 

set val(netif) Phy/WirelessPhy ;# network interface type 

set val(mac) Mac/802_11 ;# MAC type 

set val(nn) 16 ;# number of mobilenodes 

set val(rp) AODV ;# routing protocol 

set val(x) 650 

set val(y) 650 






#The Antenna height of transmitter and receiver is 1.5m. 

#The propagation model is TwoRayGround model. 

# set up the antennas to be centered in the node and 1.5 meters above it 

Antenna/OmniAntenna set X_ 0 

Antenna/OmniAntenna set Y_ 0 

Antenna/OmniAntenna set Z_ 1.5 

Antenna/OmniAntenna set Gt_ 1.0 ;# Transmit antenna gain 

Antenna/OmniAntenna set Gr_ 1.0 ;# Receive antenna gain 



Phy/WirelessPhy set bandwidth_ 54e6 ;#Data Rate 



# Initialize the SharedMedia interface with parameters to make 

# it work like the 914MHz Lucent WaveLAN DSSS radio interface 

#Collision Threshold 

Phy/WirelessPhy set CPThresh_ 10.0 

#Receive Power Threshold;calculated under TwoRayGround model by tools from NS2 

Phy/WirelessPhy set RXThresh_ 3.652e-10 

#Transmit Power 

Phy/WirelessPhy set Pt_ 0.28183815 

# Channel 2.4 GHz 

Phy/WirelessPhy set freq_ 2.4e9 

#System loss facor 

Phy/WirelessPhy set L_ 1.0 

#Carrier Sense Power 

Phy/WirelessPhy set CSThresh_ 1.559e-11

Phy/WirelessPhy set PowerMonitorThresh_ 6.310e-14 ;#-102dBm power monitor sensitivity 

Phy/WirelessPhy set HeaderDuration_ 0.000040 ;#40 us 

Phy/WirelessPhy set AdvanceModulationScheme_ 0 

Phy/WirelessPhy set PreambleCaptureSwitch_ 1 

Phy/WirelessPhy set DataCaptureSwitch_ 0 

Phy/WirelessPhy set SINR_PreambleCapture_ 2.5118; ;# 4 dB 

Phy/WirelessPhy set SINR_DataCapture_ 100.0; ;# 10 dB 

Phy/WirelessPhy set trace_dist_ 1e6 ;# PHY trace until distance of 1 Mio.km("infinty") 

Phy/WirelessPhy set PHY_DBG_ 0 

Phy/WirelessPhy set noise_floor_ 1.26e-13 ;#-99 dBm for 10MHz bandwidth 



#you can set dataRate for DATA here 

Mac/802_11 set dataRate_ 54e6 ;# Rate for Data frame 

#you can set basicRate for RTS/CTS, and ACK here 

Mac/802_11 set basicRate_ 6e6 ;# Rate for Control Frame 



#Mac/802_11 set RTSThreshold_ 3000 ;# Disable RTS/CTS 

# 802.11g parameters 



Mac/802_11 set CWMin_ 15 

Mac/802_11 set CWMax_ 1023 

Mac/802_11 set SlotTime_ 0.000009 ;# 9us 

Mac/802_11 set CCATime_ 0.000003 

Mac/802_11 set RxTxTurnaroundTime_ 0.000002 

Mac/802_11 set SIFSTime_ 0.000016 ;# 16us 

Mac/802_11 set DIFS_ 0.000028 ;# 50us 

Mac/802_11 set PreambleLength_ 96 ;# 96 bit 

Mac/802_11 set PLCPHeaderLength_ 40 ;# 40 bits 

Mac/802_11 set PLCPDataRate_ 6.0e6 ;# 6Mbps 

Mac/802_11 set MaxPropagationDelay_ 0.0000005 ;# 0.5us 



Mac/802_11 set ShortRetryLimit_ 7 

Mac/802_11 set LongRetryLimit_ 4 

Mac/802_11 set HeaderDuration_ 0.000040 

Mac/802_11 set SymbolDuration_ 0.000008 

Mac/802_11 set BasicModulationScheme_ 0 

Mac/802_11 set use_802_11a_flag_ true 

#Mac/802_11 set RTSThreshold_ 2346 

Mac/802_11 set MAC_DBG_ 0



# fix for when RTS/CTS not used 

#Mac/802_11 set RTS_ 20.0 

#Mac/802_11 set CTS_ 14.0



#To create a simulator object. This can be done with the command: 

set ns [new Simulator]



set f [open coop.tr w] 

$ns trace-all $f



set namtrace [open coop.nam w] 

$ns namtrace-all-wireless $namtrace $val(x) $val(y) 



set f0 [open co_packet_received.data w] 

set f1 [open co_packet_lost.data w] 

set f2 [open co_expected_packet.data w] 

set f3 [open byte.data w] 

set f4 [open receivingTime.data w] 

set f5 [open actual_Time.data w]

 

set f8 [open co_cbr6np.data w] 

set f9 [open co_cbr6nl.data w] 

set f10 [open co_cbr6ex.data w] 

set f11 [open cbr6by.data w]

set f12 [open cbr6re.data w]

set f13 [open co_sumband.data w]

set f14 [open co_avecbr6.data w]



set f6 [open co_sumband.data w]

set f7 [open co_aveband.data w]

#set f8 [open sequence_number.data w] 



set topo [new Topography] 

$topo load_flatgrid 650 650 



create-god $val(nn) 



set chan_1 [new $val(chan)] 

set chan_2 [new $val(chan)] 

set chan_3 [new $val(chan)] 

set chan_4 [new $val(chan)] 

set chan_5 [new $val(chan)]

set chan_6 [new $val(chan)] 

set chan_7 [new $val(chan)] 

set chan_8 [new $val(chan)]

set chan_9 [new $val(chan)] 

set chan_10 [new $val(chan)] 

set chan_11 [new $val(chan)] 

set chan_12 [new $val(chan)] 

set chan_13 [new $val(chan)]

set chan_14 [new $val(chan)] 

set chan_15 [new $val(chan)] 

set chan_16 [new $val(chan)]



# CONFIGURE AND CREATE NODES 



proc UniformErr {} {

set err [new ErrorModel]

$err unit packet

$err set rate_ 0.05

$err ranvar [new RandomVariable/Uniform]

$err drop-target [new Agent/Null]

return $err}



# NODE CONFIG PART

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

	 -agentTrace OFF \

	 -routerTrace ON \

	 -macTrace ON \

	 -movementTrace OFF \

	 -channel $chan_1 \

	 -IncomingErrProc UniformErr



for {set i 0} {$i < $val(nn) } {incr i} {set node_($i) [$ns node] 

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

}

 

proc finish {} {

global ns f f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 namtrace

$ns flush-trace 

close $namtrace 

close $f0 

close $f1 

close $f2 

close $f3 

close $f4

close $f5 

close $f6 

close $f7 

close $f8 

close $f9 

close $f10 

close $f11 

close $f12 

close $f13



exec xgraph co_packet_received.data co_packet_lost.data co_expected_packet.data &

exec xgraph receivingTime.data actual_Time.data -geometry 500x300 & 

exec xgraph byte.data co_sumband.data -geometry 400x300 &



#exec xgraph co_cbr6np.data co_cbr6nl.data co_cbr6ex.data &

#exec xgraph cbr6re.data -geometry 500x300 & 

#exec xgraph byte.data co_sumband.data cbr6by.data co_sumcbr6.data -geometry 400x300 &

		exec nam -r 5m coop.nam & 

          exit 0 

} 

set co_sumband 0 

set co_aveband 0 

set co_sumcbr6 0 

set co_avecbr6 0



proc record {} { 

global sink0 sink1 sink2 sink3 sink4 sink5 sink6 sink7 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 co_sumband co_aveband co_sumcbr6 co_avecbr6 

#Get An Instance Of The Simulator 

set ns [Simulator instance]



#Set The Time After Which The Procedure Should Be Called Again 

set time 1.0 

#How Many Bytes Have Been Received By The Traffic Sinks? 



set bw0 [$sink5 set npkts_] 

set bw1 [$sink5 set nlost_] 

set bw [$sink5 set expected_] 

set byte [$sink5 set bytes_] 

set receivingTime [$sink5 set lastPktTime_]

set cbr6np [$sink0 set npkts_] 

set cbr6nl [$sink0 set nlost_] 

set cbr6ex [$sink0 set expected_] 

set cbr6by [$sink0 set bytes_] 

set cbr6re [$sink0 set lastPktTime_]



#Get The Current Time 

set now [$ns now] 



#Save Data To The Files 

puts $f0 "$now [expr $bw0]" 

puts $f1 "$now [expr $bw1]" 

puts $f2 "$now [expr $bw]" 

puts $f3 "$now [expr $byte]" 

puts $f4 "$now [expr $receivingTime]" 

puts $f5 "$now [expr $now]" 

puts $f6 "$now [expr $co_sumband]" 

puts $f7 "$now [expr $co_aveband]"



puts $f8 "$now [expr $cbr6np]" 

puts $f9 "$now [expr $cbr6nl]" 

puts $f10 "$now [expr $cbr6ex]" 

puts $f11 "$now [expr $cbr6by]"

puts $f12 "$now [expr $cbr6re]" 

puts $f13 "$now [expr $co_sumcbr6]" 

puts $f14 "$now [expr $co_avecbr6]"



#calculate loss ratio, to avoid divided-by-zero error 

if {$bw0==0} {set bw0 1} 

set co_sumband [expr $co_sumband + $byte] 

#average throughput in bps, 10 sec is session time 

set co_aveband [expr double($co_sumband)/10] 

puts "T=$now, Band=$bw0, co_sumband= $co_sumband, co_aveband=$co_aveband" 

#puts " At time =$now, Loss ratio [expr double($bw1)/double($bw1+$bw0)]"



if {$cbr6np==0} {set cbr6np 1} 



set co_sumcbr6 [expr $co_sumcbr6 + $cbr6by] 

#average throughput in bps, 10 sec is session time 

set co_avecbr6 [expr double($co_sumcbr6)/10] 



#Reset the bytes_ values on the traffic sinks 

#$sink5 set byte_ 0 

#reset the nlost_ values to zero 

#$sink0 set nlost_ 0 

#reset the npkts_ values to zero 

#$sink0 set npkts_ 0



#Re-Schedule The Procedure 

$ns at [expr $now+$time] "record" 

} 





# define color index 

$ns color 0 blue 

$ns color 1 red 

$ns color 2 chocolate 

$ns color 3 red 

$ns color 4 brown 

$ns color 5 tan 

$ns color 6 gold 

$ns color 7 black



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

$ns initial_node_pos $node_($i) 30+i*100 

} 

$node_(0) set X_ 0.0 

$node_(0) set Y_ 0.0 

$node_(0) set Z_ 0.0 


$node_(1) set X_ 0.0 

$node_(1) set Y_ 0.0 

$node_(1) set Z_ 0.0 



$node_(2) set X_ 0.0 

$node_(2) set Y_ 0.0 

$node_(2) set Z_ 0.0



$node_(3) set X_ 0.0 

$node_(3) set Y_ 0.0 

$node_(3) set Z_ 0.0 



$node_(4) set X_ 0.0 

$node_(4) set Y_ 0.0 

$node_(4) set Z_ 0.0 



$node_(5) set X_ 0.0 

$node_(5) set Y_ 0.0 

$node_(5) set Z_ 0.0 



$node_(6) set X_ 0.0 

$node_(6) set Y_ 0.0 

$node_(6) set Z_ 0.0 



$node_(7) set X_ 0.0 

$node_(7) set Y_ 0.0 

$node_(7) set Z_ 0.0 



$node_(8) set X_ 0.0 

$node_(8) set Y_ 0.0 

$node_(8) set Z_ 0.0



$node_(9) set X_ 0.0 

$node_(9) set Y_ 0.0 

$node_(9) set Z_ 0.0



$node_(10) set X_ 0.0 

$node_(10) set Y_ 0.0 

$node_(10) set Z_ 0.0



$node_(11) set X_ 0.0 

$node_(11) set Y_ 0.0 

$node_(11) set Z_ 0.0



$node_(12) set X_ 0.0 

$node_(12) set Y_ 0.0 

$node_(12) set Z_ 0.0



$node_(13) set X_ 0.0 

$node_(13) set Y_ 0.0 

$node_(13) set Z_ 0.0



$node_(14) set X_ 0.0 

$node_(14) set Y_ 0.0 

$node_(14) set Z_ 0.0



$node_(15) set X_ 0.0 

$node_(15) set Y_ 0.0 

$node_(15) set Z_ 0.0







$ns at 0.0 "$node_(0) setdest 100.0 100.0 3000.0" 

$ns at 0.0 "$node_(1) setdest 200.0 200.0 3000.0" 

$ns at 0.0 "$node_(2) setdest 300.0 200.0 3000.0" 

$ns at 0.0 "$node_(3) setdest 400.0 300.0 3000.0" 

$ns at 0.0 "$node_(4) setdest 500.0 400.0 3000.0" 

$ns at 0.0 "$node_(5) setdest 560.0 280.0 3000.0" 

$ns at 0.0 "$node_(6) setdest 550.0 200.0 3000.0" 

$ns at 0.0 "$node_(7) setdest 600.0 300.0 3000.0" 

$ns at 0.0 "$node_(8) setdest 500.0 480.0 3000.0" 

$ns at 0.0 "$node_(9) setdest 640.0 620.0 3000.0" 

$ns at 0.0 "$node_(10) setdest 500.0 500.0 3000.0" 

$ns at 0.0 "$node_(11) setdest 100.0 100.0 3000.0" 

$ns at 0.0 "$node_(12) setdest 300.0 100.0 3000.0" 

$ns at 0.0 "$node_(13) setdest 500.0 280.0 3000.0" 

$ns at 0.0 "$node_(14) setdest 340.0 200.0 3000.0" 

$ns at 0.0 "$node_(15) setdest 550.0 500.0 3000.0" 





$ns at 1.5 "$node_(5) setdest 100.0 400.0 500.0"

#$ns at 1.0 "$node_(3) setdest 400.0 400.0 500.0" 

$ns at 2.5 "$node_(14) setdest 500.0 300.0 500.0"

$ns at 3.5 "$node_(5) setdest 500.0 100.0 500.0"

#$ns at 4.0 "$node_(3) setdest 600.0 400.0 500.0"

#$ns at 3.5 "$node_(5) setdest 300.0 100.0 500.0" 

$ns at 7.0 "$node_(6) setdest 550.0 550.0 500.0"

$ns at 8.0 "$node_(6) setdest 100.0 400.0 500.0"

#added nodes

$ns at 2.5 "$node_(8) setdest 550.0 500.0 500.0" 

$ns at 1.6 "$node_(9) setdest 400.0 300.0 500.0" 

$ns at 1.5 "$node_(10) setdest 550.0 300.0 500.0"

$ns at 1.6 "$node_(11) setdest 100.0 100.0 500.0" 

$ns at 1.8 "$node_(12) setdest 110.0 110.0 500.0"

$ns at 2.0 "$node_(13) setdest 100.0 280.0 500.0"

$ns at 2.0 "$node_(14) setdest 550.0 400.0 500.0"

$ns at 2.5 "$node_(15) setdest 250.0 500.0 500.0" 



 

$ns at 0.4 "$node_(0) label \"source\"" 

$ns at 0.4 "$node_(14) label \"destination\"" 

#$ns at 0.4 "$node_(3) label \"destination\""

$ns at 1.9 "$node_(1) label \"helper\"" 

#$ns at 2.4 "$node_(3) label \" \"" 

$ns at 3.3 "$node_(1) label \" \"" 

$ns at 3.4 "$node_(2) label \"helper\"" 

$ns at 4.8 "$node_(14) label \"\"" 

#$ns at 4.5 "$node_(3) label \"destination\"" 

$ns at 6.2 "$node_(6) label \"destination\"" 

$ns at 6.8 "$node_(2) label \"\"" 

$ns at 7.0 "$node_(3) label \"helper\"" 

$ns at 7.9 "$node_(3) label \"\"" 

$ns at 8.0 "$node_(4) label \"helper\"" 

$ns at 9.0 "$node_(4) label \"\"" 

$ns at 9.1 "$node_(1) label \"helper\""

#added nodes

$ns at 0.0 "$node_(8) label \"helper\""

$ns at 0.0 "$node_(9) \"\"" 

$ns at 0.0 "$node_(10) label \"\"" 

$ns at 0.0 "$node_(11)\"\"" 

$ns at 0.0 "$node_(12) \"\"" 

$ns at 0.0 "$node_(13) label \"helper\""

$ns at 0.0 "$node_(15) \"helper\"" 





# CONFIGURE AND SET UP A FLOW

 

set sink0 [new Agent/LossMonitor] 

set sink1 [new Agent/LossMonitor] 

set sink2 [new Agent/LossMonitor] 

set sink3 [new Agent/LossMonitor] 

set sink4 [new Agent/LossMonitor] 

set sink5 [new Agent/LossMonitor] 

set sink6 [new Agent/LossMonitor] 

set sink7 [new Agent/LossMonitor] 

#aaded nodes

set sink8 [new Agent/LossMonitor] 

set sink9 [new Agent/LossMonitor] 

set sink10 [new Agent/LossMonitor] 

set sink11 [new Agent/LossMonitor] 

set sink12 [new Agent/LossMonitor] 

set sink13 [new Agent/LossMonitor] 

set sink14 [new Agent/LossMonitor] 

set sink15 [new Agent/LossMonitor] 



$ns attach-agent $node_(0) $sink0 

$ns attach-agent $node_(1) $sink1 

$ns attach-agent $node_(2) $sink2 

$ns attach-agent $node_(3) $sink3 

$ns attach-agent $node_(4) $sink4 

$ns attach-agent $node_(5) $sink5 

$ns attach-agent $node_(6) $sink6 

$ns attach-agent $node_(7) $sink7 

#aaded nodes

$ns attach-agent $node_(8) $sink8 

$ns attach-agent $node_(9) $sink9 

$ns attach-agent $node_(10) $sink10 

$ns attach-agent $node_(11) $sink11 

$ns attach-agent $node_(12) $sink12 

$ns attach-agent $node_(13) $sink13 

$ns attach-agent $node_(14) $sink14 

$ns attach-agent $node_(15) $sink15 



#$ns attach-agent $sink2 $sink3 

set tcp0 [new Agent/TCP] 

$ns attach-agent $node_(0) $tcp0 

set tcp1 [new Agent/TCP] 

$ns attach-agent $node_(1) $tcp1 

set tcp2 [new Agent/TCP] 

$ns attach-agent $node_(2) $tcp2 

set tcp3 [new Agent/TCP] 

$ns attach-agent $node_(3) $tcp3

set tcp4 [new Agent/TCP] 

$ns attach-agent $node_(4) $tcp4 

set tcp5 [new Agent/TCP] 

$ns attach-agent $node_(5) $tcp5 

set tcp6 [new Agent/TCP] 

$ns attach-agent $node_(6) $tcp6 

set tcp7 [new Agent/TCP] 

$ns attach-agent $node_(7) $tcp7

#added nodes

set tcp8 [new Agent/TCP] 

$ns attach-agent $node_(8) $tcp8

set tcp9 [new Agent/TCP] 

$ns attach-agent $node_(9) $tcp9 

set tcp10 [new Agent/TCP] 

$ns attach-agent $node_(10) $tcp10 

set tcp11 [new Agent/TCP] 

$ns attach-agent $node_(11) $tcp11

set tcp12 [new Agent/TCP] 

$ns attach-agent $node_(12) $tcp12 

set tcp13 [new Agent/TCP] 

$ns attach-agent $node_(13) $tcp13 

set tcp14 [new Agent/TCP] 

$ns attach-agent $node_(14) $tcp14 

set tcp15 [new Agent/TCP] 

$ns attach-agent $node_(15) $tcp15



proc attach-CBR-traffic { node sink size interval } { 

#Get an instance of the simulator 

set ns [Simulator instance] 

#Create a CBR agent and attach it to the node 

set cbr [new Agent/CBR] 

$ns attach-agent $node $cbr 

$cbr set packetSize_ $size 

$cbr set interval_ $interval 



#Attach CBR source to sink; 

$ns connect $cbr $sink 

return $cbr 

}



#src bitrate: 500*16/0.015=26.666 Kbps 

set cbr0 [attach-CBR-traffic $node_(0) $sink5 500 .015] 

set cbr1 [attach-CBR-traffic $node_(1) $sink2 500 .015] 

set cbr2 [attach-CBR-traffic $node_(2) $sink3 500 .015] 

set cbr3 [attach-CBR-traffic $node_(3) $sink0 500 .015] 

set cbr4 [attach-CBR-traffic $node_(4) $sink3 500 .015] 

set cbr5 [attach-CBR-traffic $node_(5) $sink0 500 .015] 

set cbr6 [attach-CBR-traffic $node_(6) $sink0 500 .015] 

set cbr7 [attach-CBR-traffic $node_(7) $sink0 500 .015] 

#added nodes

set cbr8 [attach-CBR-traffic $node_(8) $sink5 500 .015] 

set cbr9 [attach-CBR-traffic $node_(9) $sink2 500 .015] 

set cbr10 [attach-CBR-traffic $node_(10) $sink3 500 .015] 

set cbr11 [attach-CBR-traffic $node_(11) $sink0 500 .015] 

set cbr12 [attach-CBR-traffic $node_(12) $sink3 500 .015] 

set cbr13 [attach-CBR-traffic $node_(13) $sink0 500 .015] 

set cbr14 [attach-CBR-traffic $node_(14) $sink0 500 .015] 

set cbr15 [attach-CBR-traffic $node_(15) $sink0 500 .015] 





$ns at 0.0 "record" 

$ns at 0.5 "$cbr0 start" 

$ns at 0.6 "$cbr2 start" 

$ns at 2.0 "$cbr2 stop" 

$ns at 4.6 "$cbr4 start" 

$ns at 5.0 "$cbr0 stop" 

$ns at 5.8 "$cbr4 stop" 

$ns at 6.0 "$cbr0 stop" 

$ns at 6.0 "$cbr6 start" 

$ns at 9.0 "$cbr4 stop"

#$ns at 4.5 "$cbr2 start" 

#$ns at 6.0 "$cbr2 stop" 

#$ns at 5.4 "$cbr0 start" 

#added nodes

$ns at 0.0 "record" 

$ns at 0.5 "$cbr0 start" 

$ns at 0.6 "$cbr12 start" 

$ns at 2.0 "$cbr12 stop" 

$ns at 4.6 "$cbr13 start" 

$ns at 5.0 "$cbr0 stop" 

$ns at 5.8 "$cbr13 stop" 

$ns at 6.0 "$cbr0 stop" 

$ns at 6.0 "$cbr11 start" 

$ns at 7.5 "$cbr11 stop" 

$ns at 9.0 "$cbr15 stop"







$ns at 10.0 "finish" 



puts "Start of simulation.." 

$ns run



this the out error when I run the above tcl script:

Start of simulation..
ns: _o254 "":
(_o254 cmd line 1)
invoked from within
"_o254 cmd {}"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o254" line 2)
(SplitObject unknown line 2)
invoked from within
"_o254 """

Last edited by joseph4life; 02-21-2014 at 01:20 AM. Reason: to add tags
 
Old 02-21-2014, 12:40 AM   #10
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
#8, #9, @joseph4life.

Please edit posts #8 and #9 to use code tags : The `Edit' button.
* http://www.linuxquestions.org/questi....php?do=bbcode
* http://www.linuxquestions.org/questi...gs-4175464257/
Code tags : That's the # button in the 'Advanced Editor'.
Or type [/code] at code , error text end, and [code] at text start.

Besides that it's not the real code you show in post #10.
So you will also have to replace the faulty text.

-

Last edited by knudfl; 02-21-2014 at 12:46 AM.
 
Old 02-22-2014, 09:46 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 9 .

The code in post #9 is still not usable.
Please replace the "code text" with the real tcl code.
 
Old 10-02-2014, 11:10 PM   #12
juvenal
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Rep: Reputation: Disabled
how to add multi radio and multi channel in tcl script to create topology traffic ns2.34?

hi all people;

i want to now how to add multi radio and multi channel in OLSR, can anyone help me or send script with have

thank you
 
  


Reply

Tags
crcn, ns2


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
Error on Tcl when add misbehavior node in aodv ns2 D4SH_SI4 Linux - Networking 5 06-28-2013 12:57 AM
NS2.29.3 TCL script compile errors iamusbah Linux - Newbie 1 03-27-2012 04:20 AM
script tcl NS2 MounaRM Linux - Networking 0 01-10-2011 08:49 AM
Attaching an algorithm to tcl script in ns2 raviteja99 Linux - Wireless Networking 2 09-12-2010 07:16 PM
Cannot create CBR traffic in ns2 Cataj Linux - Newbie 21 08-13-2009 12:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:02 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration