[ns] Hey Ns2 ;)

2007-04-23 Thread Nadia




http://www.hi5.com/register/RXx2B?inviteId=A_73f38fa_ibS0gd.YG2n0

nadia



[ns] HELP:new application not running.

2007-04-23 Thread aritra pal


I have developed a new wireless application on directed diffusion and have
followed the necessary steps to integrate it into the ns code.but on
executing the command make ,it gives the following error:
Makefile:195:*** command commences before first target.Stop.
below i am attaching the files i have created for my application.
 
#include packet1_receiver.hh

#ifdef NS_DIFFUSION
static class Packet1ReceiverAppClass : public TclClass {
public:
Packet1ReceiverAppClass() : TclClass(Application/DiffApp/Packet1Receiver) 
{}
TclObject* create(int , const char*const* ) {
return(new Packet1ReceiverApp());
}
} class_packet1_receiver;

int Packet1ReceiverApp::command(int argc, const char*const* argv) {
  if (argc == 2) {
if (strcmp(argv[1], subscribe) == 0) {
  run();
  return TCL_OK;
}
   }
  return DiffApp::command(argc, argv);
}

#endif // NS_DIFFUSION

void Packet1ReceiverReceive::recv(NRAttrVec *data, NR::handle my_handle)
{
  app_-recv(data, my_handle);
}

void Packet1ReceiverApp::recv(NRAttrVec *data, NR::handle my_handle)
{
  NRSimpleAttributeint *counterAttr = NULL;
  NRSimpleAttributevoid * *timeAttr = NULL;
  EventTime *probe_event;
  long delay_seconds;
  long delay_useconds;
  float total_delay;
  struct timeval tmv;

  GetTime(tmv);

  counterAttr = AppCounterAttr.find(data);
  timeAttr = TimeAttr.find(data);

  if (!counterAttr || !timeAttr){
DiffPrint(DEBUG_ALWAYS, Received a BAD packet !\n);
PrintAttrs(data);
return;
  }

  // Calculate latency
  probe_event = (EventTime *) timeAttr-getVal();
  delay_seconds = tmv.tv_sec;
  delay_useconds = tmv.tv_usec;

  if ((delay_seconds  probe_event-seconds_) ||
  ((delay_seconds == probe_event-seconds_) 
   (delay_useconds  probe_event-useconds_))){
// Time's not synchronized
delay_seconds = -1;
delay_useconds = 0;
DiffPrint(DEBUG_ALWAYS, Error calculating delay !\n);
  }
  else{
delay_seconds = delay_seconds - probe_event-seconds_;
if (delay_useconds  probe_event-useconds_){
  delay_seconds--;
  delay_useconds = delay_useconds + 100;
}
delay_useconds = delay_useconds - probe_event-useconds_;
  }
  total_delay = (float) (1.0 * delay_seconds) + ((float) delay_useconds / 
100.0);

  // Check if this is the first message received
  if (first_msg_recv_  0){
first_msg_recv_ = counterAttr-getVal();
  }

  // Print output message
  if (last_seq_recv_ = 0){
if (counterAttr-getVal()  last_seq_recv_){
  // Multiple sources detected, disabling statistics
  rp = 1;
  last_seq_recv_ = -1;
  DiffPrint(DEBUG_ALWAYS, Received data %d, total latency = %f!\n,
counterAttr-getVal(), total_delay);
}
else{
  last_seq_recv_ = counterAttr-getVal();
  num_msg_recv_++;
  DiffPrint(DEBUG_ALWAYS, Received data: %d, total latency = %f, %% 
messages received: %f !\n,
last_seq_recv_, total_delay,
(float) ((num_msg_recv_ * 100.00) /
 ((last_seq_recv_ - first_msg_recv_) + 1)));
}
  }
  else{
DiffPrint(DEBUG_ALWAYS, Received data %d, total latency = %f !\n,
  counterAttr-getVal(), total_delay);
  }
}

handle Packet1ReceiverApp::setupSubscription()
{
  NRAttrVec attrs;
  path_ = 0;

  attrs.push_back(NRClassAttr.make(NRAttribute::IS, 
NRAttribute::INTEREST_CLASS));
  attrs.push_back(LatitudeAttr.make(NRAttribute::GT, 54.78));
  attrs.push_back(LongitudeAttr.make(NRAttribute::LE, 87.32));
  attrs.push_back(TargetAttr.make(NRAttribute::IS, F117A));

  handle h = dr_-subscribe(attrs, mr_);

  ClearAttrs(attrs);

  return h;
}

void Packet1ReceiverApp::run()
{
  subHandle_ = setupSubscription();

#ifndef NS_DIFFUSION
  // Do nothing
  while (1){
sleep(1000);
  }
#endif // !NS_DIFFUSION
}

#ifdef NS_DIFFUSION
Packet1ReceiverApp::Packet1ReceiverApp()
#else
Packet1ReceiverApp::Packet1ReceiverApp(int argc, char **argv)
#endif // NS_DIFFUSION
{
  last_seq_recv_ = 0;
  num_msg_recv_ = 0;
  first_msg_recv_ = -1;

  mr_ = new Packet1ReceiverReceive(this);

#ifndef NS_DIFFUSION
  parseCommandLine(argc, argv);
  dr_ = NR::createNR(diffusion_port_);
#endif // !NS_DIFFUSION
}

#ifndef NS_DIFFUSION
int main(int argc, char **argv)
{
  Packet1ReceiverApp *app;

  app = new Packet1ReceiverApp(argc, argv);
  app-run();

  return 0;
}
#endif // !NS_DIFFUSION
 
#ifndef _PACKET1_RECEIVER_HH_
#define _PACKET1_RECEIVER_HH_

#ifdef HAVE_CONFIG_H
#include config.h
#endif // HAVE_CONFIG_H

#include ping.hh

class Packet1ReceiverReceive;

class Packet1ReceiverApp : public DiffApp {
public:
#ifdef NS_DIFFUSION
  Packet1ReceiverApp();
  int command(int argc, const char*const* argv);
#else
  Packet1ReceiverApp(int argc, char **argv);
#endif // NS_DIFFUSION

  void recv(NRAttrVec *data, NR::handle my_handle);
  void run();

private:
  // NR Specific variables
  Packet1ReceiverReceive *mr_;
  handle subHandle_;

  // Packet1 App variables
  int last_seq_recv_;
  int num_msg_recv_;
  

[ns] Re: Wireless sensors Examples

2007-04-23 Thread Sourabh Bora

You can start by looking at
 smak.cc and smak.h files. These protocols incorporate sleep /wake up cycle
required for sensor networks. Also 802.15.4 implementation on ns can ne the
next thing to look at.

This is a tutorial I have found  very useful for deeper understanding (after
reading Marc Greis' tutorial)
http://nile.wpi.edu/NS/

Hope that helps
Sourabh Bora


[ns] How to make FTP objects to produce bulk of data for a other other transport protocol object to send

2007-04-23 Thread Satish B

Dear all,
when we write ( assuming ftp source is attach to TCP agent) 

$ns at 1.0  $ftp1 start  automatically it will start with sending first 
packet  sending bulk data for the sender TCP agent.I 
have implemented a my own new transport protocol called STP.
In tcl script when write
set stp [new Agent/STP]
$ns attach-agent $n1 $stp
set ftp [new Application/FTP]
$ftp attach-agent $stp 
$ns at 1.0 $ftp start
I want FTP to  start sending the  packets automatically for my new transport 
protocol as it does it for TCP.
Where and what changes I have to make in ns2 to let FTP send packets 
automatically.

Thank you


[ns] energy of node

2007-04-23 Thread leticia bela

Hi all,

please How can i get the energy of a node in my C++ file

thanks

 
-
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses.


[ns] Mobility test of mobile IPv6

2007-04-23 Thread Youngmin Kim


Hello.

I tested wireless3.tcl in the section X.2. of Marc Greis's tutorial.
It works good!!
Firstly, MH talks to W(0) through HA. As MH moves to its destination,
it talks to W(0) through FA. And when it returns back original
position MH talks to W(0) through HA again.
It takes long time to hand over relatively (more than 10s), but it works..

Now I want to test a mobility of the Mobile IPv6.
I use two tools. One is Mobiwan and the other is Mobility package for
NS-2 from NIST.
1. Mobiwan for NS-2.27 (http://www.ti-wmc.nl/mobiwan2/)
2. Mobility package for NS-2 from NIST
(http://w3.antd.nist.gov/seamlessandsecure/download.html)

I modified wireless3.tcl of Marc Greis's tutorial. I attached them in this mail.
1. wireless3-mobiwan-ns-2.27.tcl
2. wireless3-nist-mih-ns-2.29.tcl
Two files run well but the handover does not work!!
In wireless3-mobiwan-ns-2.27.tcl, when MH is in the HA it talks to
W(0) but after MH leaves HA it does not talk to W(0).
wireless3-nist-mih-ns-2.29.tcl, when MH is in the HA it talks to W(0)
but after MH leaves HA it does not talk to W(0). But when MH returns
back to HA, it talks to W(0) again.

What is the problem?