[ns] how do i change the node color for animations

2011-05-09 Thread Moses Mbira

 

 

 

Hie all.

 

When I run my simulation the animation nodes are being displayed with a
green color rather than a default color black. I have tried to use the 

$node_(0) color blue/red/black but still nothing is changing. The node_(0)
is my node name.

 

Can anyone assist me please I have tried many option but to no avail. 

Your help will be greatly appreciated. Its urgent

 

--

Regards

 

Panganai Mbira

 



[ns] FW: how do i change the node color for animations in smac

2011-05-09 Thread Moses Mbira

 

 

 

Hie all.

 

When I run my simulation the animation nodes are being displayed with a
green color rather than a default color black. I have tried to use the 

$node_(0) color blue/red/black but still nothing is changing. The node_(0)
is my node name.

 

Can anyone assist me please I have tried many option but to no avail. 

Your help will be greatly appreciated. Its urgent

 

--

Regards

 

Panganai Mbira

 



[ns] awk file for control overhead

2011-04-29 Thread Moses Mbira

Hello,

 

 I need awk file to calculate routing/control overhead

 

 

  of AODV,DSR...Could anyone please send me?

 

 Thank you in advance.

 Moses

 

 

 

 

Only a life lived for others is a life worthwhile.  ~Albert Einstein

 



[ns] which files need to be edited when intergrating a new module in ns2.34

2011-04-20 Thread Moses Mbira

 

 

 

hello NS-users:

 I  create another identical SMAC file  in Ns-2.34 but I

 would like it to be renamed as moses and renamed all SMAC files (.cc  .h)
to moses files

 (.cc  .h). Then I clone the code and  I have changed all the words where

 the SMAC word appears by the moses word (C++ classes, packet headers,

 variables, TCL bindings,...). Therefore when I recompile my NS2.34 with
make command I'm getting these errors

Mac/moses mac/moses.cc

mac/moses.cc In member function 'void MOSES::handleRecvTimer()':

mac/moses.cc:563: error: 'HDR_MOSES' undeclared (first use this function) 

mac/moses.cc In member function 'int MOSES::checkToSend()':

mac/moses.cc:603: error: 'HDR_MOSES' undeclared (first use this function)

mac/moses.cc :563: error: (Each undeclared identifier is reported only once
for each function it appears)

mac/moses.cc In member function 'void MOSES::handleRecvTimer()':

mac/moses.cc:563: error: 'HDR_MOSES' undeclared (first use this function

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

mac/moses.cc: In member function 'void MOSES::sentDATA(Packet*)':

mac/moses.cc:563: error: 'HDR_MOSES' undeclared (first use this function)

make: ***[mac/moses.o]Error 1

 

 

 

 

 

 

 

 

 

These functions are the same that SMAC functions but this functions
are of my component.
 
Therefore I want to know if I'm missing any other files that need to be
edited
 
Help me, thank you very much.
 

 

 

 

 

 



[ns] Smac simulation help

2011-04-19 Thread Moses Mbira

Hie guys

 

Can anyone give me an idea on how to add this mechanism below to file
smac.cc using NS2.34 so that the changes will take effect. When I tried
myself I'm seeing no difference at all from the previous mechanism in smac.

 

 

If (ACK lost or ACK time out)

{if (fragmen(k+l)= minfragment)

fragmen(k+l) = fragmen(k+l);

else

fragmen(k+l) = fragment(k) /2;}

else

{if (fragmen(k+l)= maxfragment)

fragmen(k+l) = maxfragment

else

fragmen(k+l) = fragment(k)* 2;}

 

 

 

This effect should be changed on the function below of the smac.cc file and
any suggestion on some files I should also change to observe the difference
that I might have missed.

 

bool SMAC::sendMsg(Packet *pkt, Handler *h) {

struct hdr_smac *mh = HDR_SMAC(pkt);

#ifdef JOURNAL_PAPER

struct hdr_cmn *ch = HDR_CMN(pkt);

#endif

callback_ = h;

if ((u_int32_t)mh-dstAddr == MAC_BROADCAST) {

return (bcastMsg(pkt));

} else {

#ifdef JOURNAL_PAPER

//printf(message length: %d\n,ch-size_);

// need upper level support here





// Original code edited



 int fragNum = ch-size_ / SIZEOF_SMAC_DATAPKT ;

  if (fragNum == 0) fragNum = 1;



//printf(message length:%d\n,fragNum);



return unicastMsg(fragNum, pkt); // for now no
fragmentation

#else

return (unicastMsg(1, pkt)); // for now no
fragmentation

#endif

// fragmentation limit is 40 bytes per pkt.

// max_msg_size is tentatively 1000 bytes; weiye
will confirm this

}

}

 

 



[ns] smac simulation problem

2011-04-18 Thread Moses Mbira

 

Below is my tcl script for smac simulation.

I'm having a problem were my trace file is showing that the sending node is
the one receiving that data again at the same time.

So if anyone can help me find were I went wrong on my tcl code.

 

set val(chan)Channel/WirelessChannel;

set val(prop)Propagation/TwoRayGround;

set val(netif)Phy/WirelessPhy;

set val(mac)Mac/802_11   ;# MAC type

#set val(mac)Mac/SMAC   ;# MAC type

set val(ifq)Queue/DropTail/PriQueue;

set val(ll)LL;

set val(ant)Antenna/OmniAntenna;

 

set val(x)800;# X dimension of the topography

set val(y)800;# Y dimension of the topography

set val(ifqlen)50;# max packet in ifq

set val(nn)  4   ;# number of nodes

set val(seed)0.0

set val(stop)700.0;# simulation time

set val(tr)try.tr  ;# trace file

set val(nam)try.nam ;# animation file

set val(rp)AODV   ;# routing protocol script

set val(lm) on   ;# log movement

#set val(agent)  Agent/DSDV;

set val(energymodel)EnergyModel ;

set val(radiomodel)RadioModel ;

set val(initialenergy)  1000;# Initial energy in Joules

set val(logenergy) on  ;# log energy every 150 seconds

 

Mac/SMAC set syncFlag_ 1

 

Mac/SMAC set dutyCycle_ 10

 

set ns_  [new Simulator]

 

 

 

 

set prop[new $val(prop)]

 

 

 

set topo[new Topography]

$topo load_flatgrid $val(x) $val(y)

#ns-random 1.0

 

#

# Create god

#

set god_ [create-god $val(nn)]

 

 

#global node setting

 

$ns_ node-config -adhocRouting AODV  \

 -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 ON \

 -movementTrace ON \

 -energyModel
$val(energymodel) \

 -idlePower 1.0 \

 -rxPower 1.0 \

 -txPower 1.0 \

   -sleepPower 0.001 \

   -transitionPower 0.2 \

   -transitionTime 0.005 \

 -initialEnergy $val(initialenergy)

 

 

 

$ns_ set WirelessNewTrace_ ON

   set tracefd[open $val(tr) w]

   $ns_ trace-all $tracefd

  set namtracefd[open $val(nam) w]

  $ns_ namtrace-all-wireless $namtracefd 500 500

 

 



puts  node for simulation creation...

 

 

  #Create the specified number of nodes [$val(nn)] and attach them to the
channel.

   # for {set i 0} {$i  $val(nn) } {incr i} {

  #  set node_($i) [$ns_ node]



   # $node_($i) random-motion 0;# disable random motion

   # }

 

 

$ns_ node-config -adhocRouting AODV 

set node_(0) [$ns_ node]

$ns_ at 0.0  $node_(0) label \sending node\

 

puts  node creation has finished...

 

puts Creation of AODV nodes starts...

$ns_ node-config -adhocRouting AODV 

 

set node_(1) [$ns_ node]

$ns_ at 0.0  $node_(0) label \Sending Node\

$ns_ at 0.0  $node_(1) label \Receiving Node\

 

 

set node_(2) [$ns_ node]

set node_(3) [$ns_ node]

 

#set node_(2) [$ns_ node]

 

#set node_(3) [$ns_ node]

 

#set node_(4) [$ns_ node]

#set node_(5) [$ns_ node]

#$ns_ at 0.0  $node_(5) label \Receiving Node\

#set node_(6) [$ns_ node]

 

puts Creation of AODV nodes finished...





$node_(0) set X_ 10.0

$node_(0) set Y_ 5.0

$node_(0) set Z_ 3.0

 

$node_(1) set X_ 70.0

$node_(1) set Y_ 40.0

$node_(1) set Z_ 50.0



$node_(2) set X_ 100.0

$node_(2) set Y_ 30.0

$node_(2) set Z_ 40.0

 

$node_(3) set X_ 250.0

$node_(3) set Y_ 270.0

$node_(3) set Z_ 0.0





# Generation of movements

$ns_ at 10.0 $node_(1) setdest 250.0 250.0 3.0

$ns_ at 15.0 $node_(0) setdest 45.0 285.0 5.0

#$ns_ at 45.0 $node_(1) setdest 300.0 300.0 5.0 

$ns_ at 10.0 $node_(2) setdest 160.0 160.0 3.0

$ns_ at 15.0 $node_(3) setdest 100.0 200.0 3.0

$ns_ at 40.642 $god_ set-dist 23 46 2

 

set udp_(0) [new Agent/UDP]

set null_(0) [new Agent/Null]

$ns_ attach-agent $node_(0) $udp_(0)

 

$ns_ attach-agent $node_(1) $null_(0)

set cbr_(0) [new Application/Traffic/CBR]

$cbr_(0) set packetSize_ 512

$cbr_(0) set interval_ 0.25

$cbr_(0) set random_ 1

$cbr_(0) set maxpkts_ 1

$cbr_(0) attach-agent $udp_(0)

$ns_ connect $udp_(0) $null_(0)

 

$ns_ at 40.00 

[ns] anyone help me with the description of this trace file

2011-04-17 Thread Moses Mbira

 

 

 

Can anyone help me with the description of this sample trace file from smac
simulation stating the order as in $1- meaning, $2-meaning , $3-meaning and
so on. Thanks in advance

 

 

s 43.229835229 _0_ AGT  --- 12 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [12] 0 0

r 43.229835229 _0_ RTR  --- 12 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [12] 0 0

s 43.591401468 _0_ AGT  --- 13 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [13] 0 0

r 43.591401468 _0_ RTR  --- 13 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [13] 0 0

s 43.939238423 _0_ AGT  --- 14 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [14] 0 0

r 43.939238423 _0_ RTR  --- 14 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [14] 0 0

s 44.092246252 _0_ AGT  --- 15 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [15] 0 0

r 44.092246252 _0_ RTR  --- 15 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [15] 0 0

s 44.231846909 _0_ AGT  --- 16 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [16] 0 0

r 44.231846909 _0_ RTR  --- 16 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [16] 0 0

s 44.359548993 _0_ AGT  --- 17 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [17] 0 0

r 44.359548993 _0_ RTR  --- 17 cbr 512 [0.00 0 0] [energy 965.871369 ei
33.949 es 0.009 et 0.092 er 0.064] --- [0:0 1:0 32 0] [17] 0 0

 

 

 

 

And can you also help me correct this awk file to produce time against
throughput figures

 

BEGIN {

recv = 0

currTime = prevTime = 0

printf(# %10s %10s %5s %5s %15s %18s\n\n, \

   flow,flowType,src,dst,time,throughput)

}

 

{



# Trace line format: new

if ($2 == -t) {

event = $1

time = $3

node_id = src

flow_id = $39

pkt_id = $11

pkt_size = $6

flow_t = $45

level = $5

}

 

# Init prevTime to the first packet recv time

if(prevTime == 0)

prevTime = time

 

# Calculate total received packets' size

if (level == AGT  node_id == src  event == r 
pkt_size = 512) {

# Rip off the header

hdr_size = pkt_size % pkt

pkt_size -= hdr_size

# Store received packet's size

recv += pkt_size

# This 'if' is introduce to obtain clearer

# plots from the output of this script

if((time - prevTime) = tic*10) {

printf(  %10g %10s %5d %5d
%15g %18g\n, \

 
flow,flow_t,src,$5,(prevTime+1.0),0)

printf(  %10g %10s %5d %5d
%15g %18g\n, \

 
flow,flow_t,src,dst,(time-1.0),0)

}

currTime += (time - prevTime)

if (currTime = tic) {

printf(  %10g %10s %5d %5d
%15g %18g\n, \

 
flow,flow_t,src,$5,time,(recv/currTime)*(8/1000))

recv = 0

currTime = 0

}

prevTime = time

}

 

}

 

END {

printf(\n\n)

}



[ns] Packet transmission of smac

2011-04-11 Thread Moses Mbira

Hie

 

Can anyone help me why my tcl script is not showing the packets movement but
its showing nodes range and movement in the nam window.

This is my tcl script.

 

 

 

set opt(chan)Channel/WirelessChannel

set opt(prop)Propagation/TwoRayGround

set opt(netif)Phy/WirelessPhy

#set opt(mac)Mac/802_11   ;# MAC type

set opt(mac)Mac/SMAC   ;# MAC type

set opt(ifq)Queue/DropTail/PriQueue

set opt(ll)LL

set opt(ant)Antenna/OmniAntenna

 

set opt(x)800;# X dimension of the topography

set opt(y)800;# Y dimension of the topography

set opt(ifqlen)50;# max packet in ifq

set opt(nn)  2;# number of nodes

set opt(seed)0.0

set opt(stop)700.0;# simulation time

set opt(tr)try.tr  ;# trace file

set opt(nam)try.nam ;# animation file

set opt(rp)DumbAgent   ;# routing protocol script

set opt(lm) off   ;# log movement

set opt(agent)  Agent/DSDV

set opt(energymodel)EnergyModel ;

set opt(radiomodel)RadioModel ;

set opt(initialenergy)  1000;# Initial energy in Joules

 

Mac/SMAC set syncFlag_ 1

 

Mac/SMAC set dutyCycle_ 10

 

set ns_  [new Simulator]

 

 

 

set prop[new $opt(prop)]

 

 

# For model 'TwoRayGround'

set dist(5m)  7.69113e-06

set dist(9m)  2.37381e-06

set dist(10m) 1.92278e-06

set dist(11m) 1.58908e-06

set dist(12m) 1.33527e-06

set dist(13m) 1.13774e-06

set dist(14m) 9.81011e-07

set dist(15m) 8.54570e-07

set dist(16m) 7.51087e-07

set dist(20m) 4.80696e-07

set dist(25m) 3.07645e-07

set dist(30m) 2.13643e-07

set dist(35m) 1.56962e-07

set dist(40m) 1.20174e-07

 

Phy/WirelessPhy set CSThresh_ $dist(15m)

Phy/WirelessPhy set RXThresh_ $dist(15m)

 

set topo[new Topography]

$topo load_flatgrid $opt(x) $opt(y)

#ns-random 1.0

 

#

# Create god

#

set god_ [create-god $opt(nn)]

 

 

#global node setting

 

$ns_ node-config -adhocRouting DumbAgent \

 -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 \

 -agentTrace ON \

 -routerTrace ON \

 -macTrace 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)

 

 

 

$ns_ set WirelessNewTrace_ ON

   set tracefd[open $opt(tr) w]

   $ns_ trace-all $tracefd

  set namtracefd[open $opt(nam) w]

  $ns_ namtrace-all-wireless $namtracefd 500 500

 

 

  #  Create the specified number of nodes [$opt(nn)] and
attach them

   #  to the channel.

for {set i 0} {$i  $opt(nn) } {incr i} {

set node_($i) [$ns_ node]



$node_($i) random-motion 0;# disable random motion

}





 



for {set i 0} {$i  $opt(nn)} {incr i} {

# init agent

set agent_($i) [new $opt(agent)]

}

for {set i 0} {$i  $opt(nn)} {incr i} {   

# attach agent to node.

$node_($i) attach $agent_($i)

} 

 



$node_(0) set X_ 5.0

$node_(0) set Y_ 2.0

$node_(0) set Z_ 0.0

 

$node_(1) set X_ 15.0

$node_(1) set Y_ 2.0

$node_(1) set Z_ 0.0



# Generation of movements

$ns_ at 10.0 $node_(1) setdest 250.0 250.0 3.0

$ns_ at 15.0 $node_(0) setdest 45.0 285.0 5.0

$ns_ at 110.0 $node_(1) setdest 48.0 300.0 5.0 

 

set udp_(0) [new Agent/UDP]

$ns_ attach-agent $node_(0) $udp_(0)

set null_(0) [new Agent/Null]

$ns_ attach-agent $node_(1) $null_(0)

set cbr_(0) [new Application/Traffic/CBR]

$cbr_(0) set packetSize_ 512

$cbr_(0) set interval_ 0.05

$cbr_(0) set random_ 1

$cbr_(0) set maxpkts_ 

$cbr_(0) attach-agent $udp_(0)

$ns_ connect $udp_(0) $null_(0)

 

$ns_ at 40.00 $cbr_(0) start

 

# nodes: 5, max conn: 8, send rate: 0.0, seed: 1.0

#

# 1 connecting to 3 at time 80.557023746220864

#

set tcp_(0) [$ns_ create-connection  TCP $node_(0) TCPSink $node_(1) 0]

$tcp_(0) set window_ 32

$tcp_(0) set packetSize_ 512

set ftp_(0) [$tcp_(0) attach-source FTP]

$ns_ at 80.557023746220864 $ftp_(0) start

 

# defines the node size in Network Animator 

  for {set i 0} {$i  $opt(nn)} {incr i} { 

  

   

[ns] How to disable packet Fragmentation in ns2.34

2011-04-03 Thread Moses Mbira

 

Hie Everyone

 

Can anyone tell me how to disable fragmentation of packets in NS 2.34. Which
file do I have to edit to disable it. Or a tcl script to disable it.

 

--

Regards

 

Panganai Mbira

 

Only a life lived for others is a life worthwhile.  ~Albert Einstein

 



[ns] Tcl soucre code for fragmentation and defragmentation of packets

2011-03-21 Thread Moses Mbira

Can anyone help me with a tcl code for fragmentation and defragmentation of
large quantities of data.  

 



[ns] Does anyone know an algorithm which break down large data into small packets and sent it over a network using ns2.34

2011-03-15 Thread Moses Mbira

Does anyone have an idea of an algorithm which break down large data into
small packets and send it over a network and recompile it again to one on
the receiver.

 



[ns] help with a tcl code which breakdown large data into small packets

2011-03-15 Thread Moses Mbira

Hie

Can anyone help me with a tcl code which break down large data into small
packets and sent it over two nodes.

I'm using ns2.34

 

--

Regards

 

Panganai Mbira

Cell: 0772487215

 

Only a life lived for others is a life worthwhile.  ~Albert Einstein