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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
12-18-2013, 12:32 PM
|
#16
|
LQ Newbie
Registered: Nov 2013
Posts: 14
Original Poster
Rep: 
|
Hi,
As the User Equipment nodes in eyana.tcl were wired,I tried to make the User equipment nodes wireless by using Wireless and Wired Scenario in ns2.The following is my Tcl Script.
-------------------------------------------------------------------------------------
# ======================================================================
# Define options
# ======================================================================
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(ll) LL ;# link layer type
set opt(ant) Antenna/OmniAntenna ;# antenna model
set opt(ifqlen) 50 ;# max packet in ifq
set opt(nn) 3 ;# number of mobilenodes
set opt(adhocRouting) DSDV ;# routing protocol
set opt(cp) "" ;# connection pattern file(#cp file not used)
set opt(sc) "/home/chandana/ns2/ns-allinone-2.33/ns-2.33/tcl/mobility/scene/scen-3-test"
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) 250 ;# time to stop simulation
set opt(ftp-start) 3.4
set opt(cbr-start) 1.4
set num_wired_nodes 2
set num_bs_nodes 1
# ======================= =====================================================
# checking 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)
}
#simulator instance
set ns [new Simulator]
# set up for hierarchical routing(used for wireless cum wired tcl script)
$ns node-config -addressType hierarchical
AddrParams set domain_num_ 2 ;# number of domains
lappend cluster_num 2 1 ;# number of clusters in each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 4 ;#(1 each w and 4 in wl)
AddrParams set nodes_num_ $eilastlevel ;
set tracefd [open wireless2-out.tr w]
set namtrace [open wireless2-out.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $opt(x) $opt(y)
# Create topography object
set topo [new Topography]
# define topology
$topo load_flatgrid $opt(x) $opt(y)
# create God(opt is array so written like this)
create-god [expr $opt(nn) + $num_bs_nodes]
#------------------Creation of Wired Nodes------------------------------------------------------------#
set temp {0.0.0 0.0.0} ;# hierarchical addresses for wired domain
for {set i 0} {$i < $num_wired_nodes} {incr i} {
set aGW [$ns node [lindex $temp $i]]
$aGW label "aGW"
}
set temp {0.0.0 0.1.0} ;# hierarchical addresses for wired domain
for {set i 1} {$i < $num_wired_nodes} {incr i} {
set server [$ns node [lindex $temp $i]]
$server label "server"
}
#------------------------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 OFF \
-agentTrace ON \
-routerTrace ON \
-macTrace ON
#create base-station node
set temp {1.0.0 1.0.1 1.0.2 1.0.3} ;# hier address to be used for wireless
;# domain
set eNB [$ns node [lindex $temp 0]]
$eNB random-motion 0 ;# disable random motion
#provide some co-ord (fixed) to base station node
$eNB set X_ 1.0
$eNB set Y_ 2.0
$eNB set Z_ 0.0
#---------------------configuration of UE----------------------------------------------------------#
# create mobilenodes in the same domain as BS
#configure for mobilenodes
$ns node-config -wiredRouting ON
for {set j 0} {$j < $opt(nn)} {incr j} {
set UE($j) [ $ns node [lindex $temp \
[expr $j+1]] ]
$UE($j) base-station [AddrParams addr2id \
[$eNB node-addr]]
}
for { set i 0} {$i < $opt(nn)} {incr i} {
$ns simplex-link $UE($i) $eNB 500Mb 2ms LTEQueue/ULAirQueue
$ns simplex-link $eNB $UE($i) 1Gb 2ms LTEQueue/DLAirQueue
}
$UE(0) label "UE1"
$UE(1) label "UE2"
$UE(2) label "UE3"
#-----------------Orientation of links-------------------------------------------------------------#
#create links between wired and BS nodes
$ns duplex-link $aGW $server 5Mb 2ms LTEQueue/ULS1Queue
$ns simplex-link $aGW $eNB 5Gb 10ms LTEQueue/DLS1Queue
$ns duplex-link $aGW $server 5Mb 2ms DropTail
#-----------------------------TCP CONNECTIONS-----------------------------------------------------------#
set mproto DM
set mrthandle [$ns mrtproto $mproto {}]
set group [Node allocaddr]
for { set i 0 } { $i < $opt(nn) } {incr i} {
set s0($i) [new Session/RTP]
set s1($i) [new Session/RTP]
$s0($i) session_bw 12.2kb/s
$s1($i) session_bw 12.2kb/s
$s0($i) attach-node $UE($i)
$s1($i) attach-node $server
$ns at 0.7 "$s0($i) join-group $group"
$ns at 0.8 "$s0($i) start"
$ns at 0.9 "$s0($i) transmit 12.2kb/s"
$ns at 1.0 "$s1($i) join-group $group"
$ns at 1.1 "$s1($i) start"
$ns at 1.2 "$s1($i) transmit 12.2kb/s"
}
#create Null Agent for every UDP Agent in server
for { set i 0} {$i < $opt(nn)} {incr i} {
set udp($i) [new Agent/UDP]
$ns attach-agent $server $udp($i)
set null($i) [new Agent/Null]
$ns attach-agent $UE($i) $null($i)
$ns connect $udp($i) $null($i)
$udp($i) set class_ 1
set cbr($i) [new Application/Traffic/CBR]
$cbr($i) attach-agent $udp($i)
$cbr($i) set packetSize_ 1000
$cbr($i) set rate_ 0.01Mb
$cbr($i) set random_ false
$ns at 1.4 "$cbr($i) start"
}
# step 3.3 define the interactive traffic
$ns rtproto Session
set log [open "http.log" w]
# Care must be taken to make sure that every client sees the same set of pages as the servers to which they are attached.
set pgp [new PagePool/Math]
set tmp [new RandomVariable/Constant] ;# Size generator
$tmp set val_ 10240 ;# average page size
$pgp ranvar-size $tmp
set tmp [new RandomVariable/Exponential] ;# Age generator
$tmp set avg_ 4 ;# average page age
$pgp ranvar-age $tmp
set s [new Http/Server $ns $server]
$s set-page-generator $pgp
$s log $log
set cache [new Http/Cache $ns $aGW]
$cache log $log
for { set i 0} {$i<$opt(nn)} {incr i} {
set c($i) [new Http/Client $ns $UE($i)]
set ctmp($i) [new RandomVariable/Exponential] ;# Poisson process
$ctmp($i) set avg_ 1 ;# average request interval
$c($i) set-interval-generator $ctmp($i)
$c($i) set-page-generator $pgp
$c($i) log $log
}
$ns at 0.4 "start-connection"
proc start-connection {} {
global ns s cache c number
}
$cache connect $s
for { set i 0} { $i < $opt(nn) } {incr i} {
$c($i) connect $cache
$c($i) start-session $cache $s
}
for { set i 0} {$i < $opt(nn)} {incr i} {
set tcp($i) [new Agent/TCP]
$ns attach-agent $server $tcp($i)
set sink($i) [new Agent/TCPSink]
$ns attach-agent $UE($i) $sink($i)
$ns connect $tcp($i) $sink($i)
$tcp($i) set class_ 3
$tcp($i) set packetSize_ 0.5M
set ftp($i) [new Application/FTP]
$ftp($i) attach-agent $tcp($i)
$ns at 3.4 "$ftp($i) start"
}
#-----------------------------------------------------------------------------------------------------#
if { $opt(sc) == "" } {
puts "*** NOTE: no scenario file specified."
set opt(sc) "none"
} else {
puts "Loading scenario file..."
source $opt(sc)
puts "Load complete..."
}
#initial node position of wireless nodes in nam
for {set i 0} {$i < $opt(nn)} {incr i} {
$ns initial_node_pos $UE($i) 50
}
# Tell all nodes when the simulation ends
for {set i } {$i < $opt(nn) } {incr i} {
$ns at $opt(stop).0 "$UE($i) reset";
}
$ns at $opt(stop).0 "$eNB reset";
$ns at $opt(stop).0002 "puts \"NS EXITING...\" ; $ns halt"
$ns at $opt(stop).0001 "stop"
proc stop {} {
global ns_ tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam wireless2-out.nam &
exit 0
}
# informative headers for CMUTracefile
puts $tracefd "M 0.0 nn $opt(nn) 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 when run the tcl script,I get the following error.Is it not possible to use wireless cum wired scenerios to simulate LTE in ns2?
Loading scenario file...
Load complete...
Starting Simulation...
can't read "Node_(3)": no such element in array
while executing
"return $Node_($id)"
(procedure "_o3" line 3)
(Simulator get-node-by-id line 3)
invoked from within
"$self get-node-by-id [lindex $L 0]"
(procedure "_o3" line 14)
(Simulator compute-hier-routes line 14)
invoked from within
"$self compute-hier-routes "
invoked from within
"if [Simulator hier-addr?] {
$self compute-hier-routes
} else {
$self compute-flat-routes
}"
(procedure "_o3" line 2)
(Simulator compute-routes line 2)
invoked from within
"[Simulator instance] compute-routes"
(procedure "Agent/rtProto/Session" line 2)
(Agent/rtProto/Session init-all line 2)
invoked from within
"Agent/rtProto/Session init-all"
("eval" body line 1)
invoked from within
"eval Agent/rtProto/$proto init-all $rtprotos_($proto)"
("foreach" body line 2)
invoked from within
"foreach proto [array names rtprotos_] {
eval Agent/rtProto/$proto init-all $rtprotos_($proto)
}"
invoked from within
"if [info exists rtprotos_] {
foreach proto [array names rtprotos_] {
eval Agent/rtProto/$proto init-all $rtprotos_($proto)
}
} else {
Agent/rtProto/St..."
(procedure "_o349" line 3)
(RouteLogic configure line 3)
invoked from within
"[$self get-routelogic] configure"
(procedure "_o3" line 5)
(Simulator run line 5)
invoked from within
"$ns run"
(file "nlComb.tcl" line 284)
|
|
|
12-18-2013, 03:40 PM
|
#17
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520
|
# 16 .
Please edit post #16 to use 'code tags' for the tcl code.
I.e. type [/code] at code end, and [code] at tcl code start.
Or use the # button in the "Advanced Editor".
http://www.linuxquestions.org/questi....php?do=bbcode
Quote:
can't read "Node_(3)": no such element in array
|
Three nodes are numbered 0, 1, 2.
The error will disappear, when line 12 is edited to :
Code:
set opt(nn) 4 ;# number of mobilenodes
-
|
|
|
12-21-2013, 01:27 AM
|
#18
|
LQ Newbie
Registered: Nov 2013
Posts: 14
Original Poster
Rep: 
|
I trying to simulate LTE in wired cum wireless scenario in ns2.I have considered basestation and the user equipments in one domain and the wired nodes in another doamin.When the run the tcl script I'm getting the following error:
num_nodes is set 4
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
invalid command name "(null)"
while executing
"[$self set classifier_] install $dst $target"
(procedure "_o45" line 3)
(RtModule add-route line 3)
invoked from within
"$rtnotif_ add-route $dst $target"
(procedure "_o44" line 5)
(Node add-route line 5)
invoked from within
"$self add-route $address_ $dmux_"
(procedure "_o44" line 8)
(Node attach line 8)
invoked from within
"$node attach $ragent [Node set rtagent_port_]"
(procedure "_o3" line 76)
(Simulator create-wireless-node line 76)
invoked from within
"_o3 create-wireless-node 1.0.0"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o3" line 23)
(Simulator node line 23)
invoked from within
"$ns node 1.0.0"
invoked from within
"set BS(0) [$ns node 1.0.0]"
(file "newlte1.tcl" line 74)
Is it not possible to simulate LTE in wired cum Wireless scenario?
|
|
|
02-28-2014, 11:11 PM
|
#19
|
LQ Newbie
Registered: Nov 2013
Posts: 14
Original Poster
Rep: 
|
Hi,
I'm currently using ns-lte binary to run all the LTE related TCL scripts.I need to make few changes to some of the .h and .cc files present in ns2.But I can't find any of these files in the binary file.
should I separately patch LTE onto my ns2 to make changes to .h and cc files?
|
|
|
03-01-2014, 12:20 AM
|
#20
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520
|
# 19 .
Please read post #17. Why didn't you edit post #16 to `Code Tags' ?
Any problems by using the 'Edit' button at that time ?
# 19 :
Quote:
I need to make few changes to some of the .h and .cc files present in ns2.
But I can't find any of these files in the binary file.
should I separately patch LTE onto my ns2 to make changes to .h and cc files ?
|
When you are changing files, you will have to build your own version,
ns-2.33 + LTE. See post #122 here for the "new proof patching" :
http://www.linuxquestions.org/questi...930/page9.html
→ lte-ns233-patching-2.tar.gz .
-
Last edited by knudfl; 03-01-2014 at 12:26 AM.
|
|
|
All times are GMT -5. The time now is 07:17 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|