LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-23-2015, 06:25 PM   #1
mariam33
LQ Newbie
 
Registered: Mar 2015
Posts: 6

Rep: Reputation: Disabled
divide the sensing fiels


i am working on ns2.35-ubuntu10.04,, i want to divide the sensor field in to 9 squares of equal size by using tcl script this is my first attempt but there is no result so please help me ,, the steps of division is delimited by the bold and red color.

# 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(rp) AODV ; # routing protocol
set val(x) 900 ; # X dimension of topography
set val(y) 900 ; # Y dimension of topography
set val(stop) 10 ; # time of simulation end
set val(Y) 0;
set val(X) 0;
set val(nn) 30 ;


#Creating simulation:
set ns [new Simulator]

#Creating nam and trace file:
set tracefd [open k.tr w]
set namtrace [open k.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)
set god_ [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) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \

#set $val(X) \[expr $val(x)/300\]
set $val(Y) \[expr $val(y)/300\]
for {set i 0} {$i<=$val(X)} {incr i}
{
for {set j 0} {$j<=$val(Y)} {incr i}
{
for {set b 0} {$b < $val(nn) } { incr b }
{
set node($b) \[$ns node\]
}
}
}

#stop procedure..

proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam k.nam &
}

$ns at $val(stop) "stop"

$ns run
 
  


Reply

Tags
ns2, tcl-ns2



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
[SOLVED] CRCN sensing leki Linux - Newbie 3 05-01-2014 12:52 AM
Where can i get a kernal for c64 emulator along with the other fiels a need? ChannMan40 Linux - Kernel 2 11-28-2011 11:58 AM
/etc/shadow password fiels options WingnutOne Linux - General 1 05-22-2008 03:21 PM
Recombination fiels derived from splitting with winrar in windows XP Tavassoli Linux - Software 1 06-15-2006 11:17 AM
corrupt fiels gumby_gold Linux - General 2 01-16-2006 10:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:50 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
Open Source Consulting | Domain Registration