LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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


Closed Thread
  Search this Thread
Old 07-28-2016, 11:53 AM   #1
fozia kosar
LQ Newbie
 
Registered: Jul 2016
Posts: 9

Rep: Reputation: Disabled
here is the file centroid_802_11.tcl


# Generated by Topology Generator for Network Simulator (c) CENTROID

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) 9 ;# number of mobilenodes
set val(rp) CENTROID ;# protocol type
set val(x) 1000 ;# X dimension of topography
set val(y) 1000 ;# Y dimension of topography
set val(stop) 100 ;# simulation period

set ns [new Simulator]
$ns use-scheduler Heap

set tracefd [open centroid-802-11.tr w]
set namtrace [open centroid-802-11.nam w]

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

# set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)

create-god $val(nn)

# configure the nodes
$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) \
-channel [new $val(chan)] \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF \

for {set i 0} {$i < $val(nn) } { incr i } {
set mnode_($i) [$ns node]
$mnode_($i) random-motion 0
}


# Position of Anchor 1
$mnode_(0) set X_ 150.00
$mnode_(0) set Y_ 200.00
$mnode_(0) set Z_ 0.0
$mnode_(0) label "Anchor1"

# Position of Anchor 2
$mnode_(1) set X_ 480.00
$mnode_(1) set Y_ 500.00
$mnode_(1) set Z_ 0.0
$mnode_(1) label "Anchor2"

# Position of Anchor 3
$mnode_(2) set X_ 980.00
$mnode_(2) set Y_ 150.00
$mnode_(2) set Z_ 0.0
$mnode_(2) label "Anchor3"

# Position of Node 1
$mnode_(3) set X_ 300.00
$mnode_(3) set Y_ 350.00
$mnode_(3) set Z_ 0.0

# Position of Node 2
$mnode_(4) set X_ 400.00
$mnode_(4) set Y_ 250.00
$mnode_(4) set Z_ 0.0

# Position of Node 3
$mnode_(5) set X_ 520.00
$mnode_(5) set Y_ 300.00
$mnode_(5) set Z_ 0.0

# Position of Node 4
$mnode_(6) set X_ 620.00
$mnode_(6) set Y_ 180.00
$mnode_(6) set Z_ 0.0

# Position of Node 5
$mnode_(7) set X_ 720.00
$mnode_(7) set Y_ 210.00
$mnode_(7) set Z_ 0.0

# Position of Node 6
$mnode_(8) set X_ 920.00
$mnode_(8) set Y_ 230.00
$mnode_(8) set Z_ 0.0

#start sending beacon message
$ns at 0.0 "[$mnode_(0) set ragent_] anchor"

#start sending beacon message
$ns at 0.0 "[$mnode_(1) set ragent_] anchor"

#start sending beacon message
$ns at 0.0 "[$mnode_(2) set ragent_] anchor"


for {set i 0} {$i < $val(nn)} { incr i } {
$ns initial_node_pos $mnode_($i) 5
}

# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$mnode_($i) reset;"
}

# ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at [expr $val(stop) + 0.01] "puts "end simulation"; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
#exec nam dvhop-802-11.nam &

}

$ns run
 
Old 07-28-2016, 05:17 PM   #2
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,172

Rep: Reputation: 3799Reputation: 3799Reputation: 3799Reputation: 3799Reputation: 3799Reputation: 3799Reputation: 3799Reputation: 3799Reputation: 3799Reputation: 3799Reputation: 3799
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed Thread

Tags
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
using scenario file to run vbf_example tcl file Alkindi Linux - Wireless Networking 8 06-18-2016 03:31 PM
using scenario file to run tcl file Faiza Al-Salti Linux - Networking 5 06-09-2016 01:04 PM
how to pass an argument from .cc file to tcl file in ns2 pon Linux - Newbie 0 12-11-2014 09:44 AM
[SOLVED] Using Expect/TCL to move contents of a text file to an executable file jefsa Linux - Newbie 4 04-20-2012 11:43 AM

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

All times are GMT -5. The time now is 04:48 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration