Re: [ns] Simulating a C++ program in NS2

2014-01-08 Thread jose nmrd

you can have a look on the following link, hope it will help.
http://www.cse.ohio-state.edu/~sakai/research/ns2_greedy.html
-Jose- 

 Date: Wed, 8 Jan 2014 23:05:38 -0800
 From: rmo...@hotmail.com
 To: ns-users@ISI.EDU
 Subject: [ns] Simulating a C++ program in NS2
 
 
 Hi..
 
 I'm new to NS2, and i was woundering how can i simulate a C++ framework in
 NS2. i've already simulated my framework using TCL (network topology,
 agents), but i dont know how to integrate my C++ files in NS2!
 
 Can someone please help me!!
 best Regards.
 
 rania
 
 
 
 --
 View this message in context: 
 http://network-simulator-ns-2.7690.n7.nabble.com/Simulating-a-C-program-in-NS2-tp28056.html
 Sent from the ns-users mailing list archive at Nabble.com.
 
  


Re: [ns] Help friends !!!

2014-01-04 Thread jose nmrd

Hi, 
there is a unique node ID generated by NS2 for the nodes during their creation. 
it's an int. and since  a short int is 16 bits, an int is 32 bits, and a long 
int is 64 bits. i suppose by acceding the class Node in the c++ hierarchy and 
setting the int nodeid_ member as short int nodeid_, you will get what u 
want (NS2 will generate the id as short int (16 bits)). of course you have to 
recompile...

 Date: Sat, 4 Jan 2014 12:32:41 -0800
 From: mfare...@yahoo.com
 To: ns-users@ISI.EDU
 Subject: [ns] Help friends !!!
 
 
 Hi,
 I am working in a wire-based topology, and I need each node in the topology 
 to has a unique 16 bits ID.
 
 Actually I have a huge number of nodes in my topology. And I will use this 16 
 bits ID in future work. Is there any way to do this in NS2.
 
 
 Many thanks in advance
 
 Eng. Magdy
  


Re: [ns] find neighbors in transmission range of mobile node

2013-11-08 Thread jose nmrd

have a look at this,

http://mailman.isi.edu/pipermail/ns-users/2011-September/071003.html

-Jose-

 Date: Fri, 8 Nov 2013 12:00:19 +
 From: exceptional_attract...@yahoo.com
 To: ns-users@ISI.EDU
 Subject: [ns] find neighbors in transmission range of mobile node
 
 
 Hi , 
 
 How we can find , 
 number of neighbors for mobile wireless networks in a transmission range of a 
 node. 
 
 Could anyone know any method or any command ? 
 I will be greatly thankful to you for your cooperation.
 
 
 Best Regards,
 Imran Khan
 University of Toulouse
 France
 
 
  


[ns] FW: Help my friends

2013-11-03 Thread jose nmrd





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.

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.

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.   
 
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.
$node_(1) set X_ 500
$node_(1) set Y_ 200
$node_(1) set Z_ 0.
$node_(2) set X_ 524.31925038076895
$node_(2) set Y_ 233.64114958496819
$node_(2) set Z_ 0.
$node_(3) set X_ 806.80107456017333
$node_(3) set Y_ 905.66013283359825
$node_(3) set Z_ 0.
$node_(4) set X_ 429.85253428567785
$node_(4) set Y_ 531.54373938755305
$node_(4) set Z_ 0.
...
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: 

Re: [ns] God function

2013-05-18 Thread jose nmrd

Hi Zineb;
 
http://mailman.isi.edu/pipermail/ns-users/2011-September/071004.html
 
hope it will help.
 
-Jose-
 Date: Sat, 18 May 2013 06:59:33 -0700
 From: z.rezaie...@yahoo.com
 To: ns-users@ISI.EDU
 Subject: [ns] God function
 
 
 
  
 
 
 Hello friends,
 I have a question about god function. can we use it in c++ file in ns2 to 
 understand the number
 of neighbors of the node if our nodes moves? if we can use it how I can do it.
 any help will be appreciate
 thanks
 regards 
  


[ns] Packet format issue

2013-05-02 Thread jose nmrd

hi everyone,
is it correct (doesn't induce to errors) to put a dynamic structure in a packet 
header, for example in AODV request header put a pointer to a structure str 
{node_energy, next} to record the nodes energy along the request path?
thx in advance.
  


Re: [ns] get a reference to a node from AODV [resolved].

2013-04-21 Thread jose nmrd

Hi Itishi, thx again for the reply, 
actually it appears that the problem that i have been stacked in for a month  
is that the function static Node* get_node_by_address(nsaddr_t);

is static so it can be called by itself independently of any object by using 
the class name and the scope resolution operator, 
so i can call it from the aodv.cc and then do the rest of the work.
thanks . 
Xoce.

Date: Sat, 20 Apr 2013 20:42:17 +0800
From: itish...@yahoo.com
Subject: Re: [ns] How to get a reference of a node from AODV?‏
To: jose-...@hotmail.com; ns-users@ISI.EDU

Hi Jose, Using the following function definition you can create object 
of the node class.now using the c_node object of the node class you can access 
methinds of the node class.  Node* c_node=Node::get_node_by_address(index);   
Regards,Itishi
From: jose nmrd jose-...@hotmail.com
 To: itishi saxena itish...@yahoo.com 
 Sent: Thursday, 18 April 2013 12:03 PM
 Subject: RE: [ns] How to get a reference of a node from AODV?‏
   



Hi Itishi and thanks for the reply,
i know i have to create objects to access them, but currently in the class 
AODV.cc there only one variable index of type nsaddr_t which represents the 
address of the node [nsaddr_tindex;// IP Address of 
this node] but i don't know how to get the whole structure of Node because with 
this variable index i can't access the attributes of the node. in other words 
how to access classes AODV.cc and Node.cc from one to another? just by making 
them friends? 
for
 example if i put: $ns node-config -adhocRouting AODV, 
if i have a node N0 i want to get access to it from the AODV attached to it. 
Thank you very much again.
Xoce.

Date: Thu, 18 Apr 2013 06:31:23 +0800
From: itish...@yahoo.com
Subject: Re: [ns] How to get a reference of a node from AODV?‏
To: jose-...@hotmail.com; ns-users@ISI.EDU

Hello Jose,

For getting access to the node attribut you have to play with node.cc inside 
common folder in ns-2.34.

It is basically how you
 access method of one class toanother in c++.

so you have two classes aodv.cc and node.cc

you have to create object of one of them to access methods and they have to be 
friend of each other.

I hope it will give you sufficient hint for your task.


Itishi


From: jose nmrd jose-...@hotmail.com

 To: ns-users@isi.edu ns-users@ISI.EDU 
 Sent: Wednesday, 17 April 2013 5:30 PM
 Subject: [ns] How to get a reference of a node from AODV?‏
   





Hi everyone,
here is the problem, i have added some 
code to the class Node to do some computations, i'm modifying the 
protocol AODV where i have to use the computations added in the class 
Node, but after looking at the class AODV composition there is just the 
address of the Node, not the reference to the whole structure of the 
Node. so my question is how to get the reference of the node that the 
AODV agent is associated to so that i can access the attributes and 
functions and of course my added code of the class Node? if any one can 
help,
 thx in advance
 .
Xoce.   

  


  

[ns] How to get a reference of a node from AODV?‏

2013-04-17 Thread jose nmrd





Hi everyone,
here is the problem, i have added some 
code to the class Node to do some computations, i'm modifying the 
protocol AODV where i have to use the computations added in the class 
Node, but after looking at the class AODV composition there is just the 
address of the Node, not the reference to the whole structure of the 
Node. so my question is how to get the reference of the node that the 
AODV agent is associated to so that i can access the attributes and 
functions and of course my added code of the class Node? if any one can 
help, thx in advance .
Xoce. 

FW: [ns] How to get a reference of a node from AODV?‏

2013-04-17 Thread jose nmrd





Hi Itishi and thanks for the reply,
i know i have to create objects to access them, but currently in the class 
AODV.cc there only one variable index of type nsaddr_t which represents the 
address of the node [nsaddr_tindex;// IP Address of 
this node] but i don't know how to get the whole structure of Node because with 
this variable index i can't access the attributes of the node. in other words 
how to access classes AODV.cc and Node.cc from one to another? just by making 
them friends? 
for example if i put: $ns node-config -adhocRouting AODV, 
if i have a node N0 i want to get access to it from the AODV attached to it. 
Thank you very much again.
Xoce.

Date: Thu, 18 Apr 2013 06:31:23 +0800
From: itish...@yahoo.com
Subject: Re: [ns] How to get a reference of a node from AODV?‏
To: jose-...@hotmail.com; ns-users@ISI.EDU

Hello Jose,

For getting access to the node attribut you have to play with node.cc inside 
common folder in ns-2.34.

It is basically how you access method of one class toanother in c++.

so you have two classes aodv.cc and node.cc

you have to create object of one of them to access methods and they have to be 
friend of each other.

I hope it will give you sufficient hint for your task.


Itishi


From: jose nmrd jose-...@hotmail.com

 To: ns-users@isi.edu ns-users@ISI.EDU 
 Sent: Wednesday, 17 April 2013 5:30 PM
 Subject: [ns] How to get a reference of a node from AODV?‏
   





Hi everyone,
here is the problem, i have added some 
code to the class Node to do some computations, i'm modifying the 
protocol AODV where i have to use the computations added in the class 
Node, but after looking at the class AODV composition there is just the 
address of the Node, not the reference to the whole structure of the 
Node. so my question is how to get the reference of the node that the 
AODV agent is associated to so that i can access the attributes and 
functions and of course my added code of the class Node? if any one can 
help, thx in advance
 .
Xoce.