Hi Fares, 
i had a tcl script for my experiments. it has a fixed source and destination 
(node 0 and node 1 respectively), the others are randomely generated, after is 
the code tcl .

#********************beggining**********************
# 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) 300 ;# number of mobilenodes
set val(rp) AODV  ;#DSDV# routing protocol
set val(x) 1000 ;# X dimension of topography
set val(y) 1000 ;# Y dimension of topography 
set val(stop) 15 ;# time of simulation end
set opt(energymodel)    EnergyModel     ;
set opt(radiomodel)     RadioModel     ;
set opt(initialenergy)  1            ;# Initial energy in Joules

set ns [new Simulator]
set tracefd [open simple.tr w]
set namtrace [open simwrls.nam w] 
set windowVsTime2 [open win.tr 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) \
                -channelType $val(chan) \
                -topoInstance $topo \
                -agentTrace ON \
                -routerTrace ON \
                -macTrace OFF \
                -movementTrace ON \
                -energyModel $opt(energymodel) \
                -idlePower 1.0 \
                -rxPower 1.0 \
                -txPower 1.0 \
                -sleepPower 0.001 \
                -transitionPower 0.2 \
                -transitionTime 0.005 \
                -initialEnergy $opt(initialenergy)

            set topology [open topology.scn a]
         
#**********************set the source and destinaon coordinates
   #puts  $remaining "$now\t "
            puts -nonewline $topology "\$node_(0) set X_ 500"
            puts -nonewline $topology "\n"            
            puts -nonewline $topology "\$node_(0) set Y_ 850"        
            puts -nonewline $topology "\n"            
            puts -nonewline $topology "\$node_(0) set Z_ 0.000000000000"        
                
            puts -nonewline $topology "\n"
            puts -nonewline $topology "\$node_(1) set X_ 500"
            puts -nonewline $topology "\n"            
            puts -nonewline $topology "\$node_(1) set Y_ 200"        
            puts -nonewline $topology "\n"            
            puts -nonewline $topology "\$node_(1) set Z_ 0.000000000000"        
                
            puts -nonewline $topology "\n"
            close $topology

#*********************generate the other nodes randomely
for {set i 2} {$i < $val(nn) } { incr i } {
           set node_($i) [$ns node]
           set xx [expr rand()*1000]
           set yy [expr rand()*1000]
           
           set topology [open topology.scn a]
            #puts  $remaining "$now\t "
            puts -nonewline $topology "\$node_($i) set X_ $xx"
            puts -nonewline $topology "\n"            
            puts -nonewline $topology "\$node_($i) set Y_ $yy"        
            puts -nonewline $topology "\n"            
            puts -nonewline $topology "\$node_($i) set Z_ 0.000000000000"       
                 
            puts -nonewline $topology "\n"
            close $topology
     }
#***************************End**************************************
actually there is some lignes in the code we don't need them. as you can see 
the output of this code is a file called "topology.scn" . the data in the file 
is a s follows:

$node_(0) set X_ 500
$node_(0) set Y_ 850
$node_(0) set Z_ 0.000000000000
$node_(1) set X_ 500
$node_(1) set Y_ 200
$node_(1) set Z_ 0.000000000000
$node_(2) set X_ 524.31925038076895
$node_(2) set Y_ 233.64114958496819
$node_(2) set Z_ 0.000000000000
$node_(3) set X_ 806.80107456017333
$node_(3) set Y_ 905.66013283359825
$node_(3) set Z_ 0.000000000000
$node_(4) set X_ 429.85253428567785
$node_(4) set Y_ 531.54373938755305
$node_(4) set Z_ 0.000000000000
...
this file will be the entry of your real tcl code file. i mean you can inject 
it anywhere you want by puting it with in the same folder as your tcl file and 
use the command (after the ceation of nodes): 

 for {set i 0} {$i < $val(nn) } {incr i} {
 set node_($i) [$ns node]
 $node_($i) random-motion 0 ;# disable random motion
 }
 
 source ./topology.scn

hope it will help.

-Jose-

> Date: Sun, 3 Nov 2013 00:47:14 -0700
> From: mfare...@yahoo.com
> To: ns-users@ISI.EDU
> Subject: [ns] Help my friends
> 
> 
> Please, i implemented a new technique for filtering packets in a wired-based 
> network. And I want to test the efficiency of this technique by measuring the 
> no. of false positive and false negative as you know.
> 
> And to do that, I need a huge number of nodes in the simulation.
> 
> So the question is: How could I create this huge no. of nodes in the 
> simulation?
> Am I should create them manually, node by node, which will be a big problem 
> to create this huge no.
> Or, is there another way in NS2 to do this for me?
> 
> Please, waiting for your important reply.
> 
> Eng. Magdy Fadel
                                                                                
  

Reply via email to