[ns] Scenario file

2013-02-27 Thread Rafael P B Mota

How can I use a scenario file in tcl script generated by
indep-utils/cmu-scen-gen/setdest ?

thanks

--

Rafael Perazzo B Mota
rafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--



Re: [ns] Modifying ns2 to control the output in the trace-file

2013-02-26 Thread Rafael P B Mota

Check the file: trace/cmu-trace.cc


2013/2/26 Adel Qodmani :
>
> Hello everyone,
>
> In an earlier message to the mailing list, I was wondering how can I modify
> a tcl script to force the trace-file output to contain the locations of my
> mobile nodes; the reply I got said that such a thing isn't currently
> supported by ns2 and hinted to modify the C++ files to add such a thing as
> I need.
>
> Can you someone just point out to me which C++ file is responsible for
> printing the results on the trace-file? or more specifically;
> which C++ file should/can I modify to let ns2 print the locations of my
> nodes to the trace-file?
>
> Thanks,
> Adel



--

Rafael Perazzo B Mota
rafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--



[ns] Creating many wireless nodes

2013-01-31 Thread Rafael P B Mota

How can I create, for instance, 100 wireless nodes in tcl script ?

I tried
set nn 100
for {set i 1} {$i < $val(nn) } { incr i } {
set tag($i) [new Agent/...]
$tag($i) set var1_ $i+10
$tag($i) set time_ 1
$tag($i) set debug_ 0
}

But I am not able to bind the vars. The values are not assigned.
What's my mistake ?

Thanks

--

Rafael Perazzo B Mota
rafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--



[ns] Bind a float

2013-01-28 Thread Rafael P B Mota

How can I bind a float member ?
For example, when I bind an integer (bind("value_",&value_) it works.
When I bind a float (bind("number_",&number_) I receive errors.

What can I do to solve this problem ?
Thanks,

--

Rafael Perazzo B Mota
rafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--



[ns] Transmission range

2013-01-26 Thread Rafael P B Mota

How can I change the transmission power to allow 2 nodes communicate
themselves at a max distance of 5m ? How can I calculate the Pt_ value  ?
What does a 0.28 Pt_ value mean ?
Thanks


[ns] Disable collisions

2013-01-25 Thread Rafael P B Mota

Is there any way to disable colisions on 802.11 mac layer ?
I 'd like to receive all frames and implement in Agent the anti-collision
algorithm.
Thanks
Rafael


[ns] Random number between two floats

2013-01-25 Thread Rafael P B Mota

Helllo users,

Is there any way to generate a random number between two given float numbers ?

For example, I'd like to generate a number between 0.1 and 0.3.
I'm using the command
double tempo = Random::uniform(0,time_);
But this command requires two int numbers, instead of two float numbers.

Thanks!!

--

Rafael Perazzo B Mota
rafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--



Re: [ns] Ns-users Digest, Vol 109, Issue 21

2013-01-25 Thread Rafael P B Mota

How can I do that ?
Em 25/01/2013 00:08, "Fazlullah Khan"  escreveu:

>
> Hello Rafael
> How about to use Error Model between those two nodes, then you will get the
> dropped packet in the trace file.
> On Fri, Jan 25, 2013 at 10:00 AM,  wrote:
>
> > : [ns] Drop a packet
>
>
>
>
>
> --
> Regards
> Fazlullah Khan
>


[ns] Drop a packet

2013-01-24 Thread Rafael P B Mota

Hello users,

Does anybody know how can I drop a packet ?
For example:

When my Agent receive a packet from a particular host, I'd like to
drop the packet, and this packet should appear in the trace file like:
d -t 0.000 ...
I've tried Packet::free(p) and drop(p), but when I opened the trace
file, there's no packet dropped.
How can I do this ?

Thanks,

--

Rafael Perazzo B Mota
rafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--



Re: [ns] Wait for a packet

2013-01-24 Thread Rafael P B Mota

Hello Natalya,
Where can I get this information ? What file should I read ?
Em 24/01/2013 13:31, "Natalya Rozhnova" 
escreveu:

> Hi Rafael,
>
> Timers are your best friends in this case. ;) You can do this by analizing
> how a TCP retransmission timer works.
>
> Natalya
>
> 24.01.2013, 23:25, "Rafael P B Mota" :
>
> Hello users,
>
> Does sombody know how to can I make a node wait for a reply from another
> node ?
>
> For example:
>
> Node 1 sends a packet do Node 2. Node 1 can wait 0.5 seconds (for the
> reply) before try another request again. If node 2 sends a reply do
> Node 1, that's ok. Else , Node 1 after 0.5 seconds sends another
> packet request again to Node 2. Should I use something like a Timer ?
>
> How can I do this ?
>
> --
>
> 
> Rafael Perazzo B Mota
> rafaelpera...@gmail.com
> Web-page: https://sites.google.com/site/rafaelperazzo/
> Doutorando em Ciência da Computação
> Universidade de São Paulo (USP)
> Campus da Capital
> Instituto de Matemática e estatística (IME)
>
> --
>
>


[ns] Wait for a packet

2013-01-24 Thread Rafael P B Mota

Hello users,

Does sombody know how to can I make a node wait for a reply from another node ?

For example:

Node 1 sends a packet do Node 2. Node 1 can wait 0.5 seconds (for the
reply) before try another request again. If node 2 sends a reply do
Node 1, that's ok. Else , Node 1 after 0.5 seconds sends another
packet request again to Node 2. Should I use something like a Timer ?

How can I do this ?

--

Rafael Perazzo B Mota
rafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--



Re: [ns] tcl script

2012-11-04 Thread Rafael P B Mota

Show us your tcl script.
It will be easier to help you.
Em 04/11/2012 11:28, "shiny"  escreveu:

>
> hi frndz,
>  i have set my ftp stop time as 250 in my tcl script but nam window stop at
> 18 sec itself. can anyone help me  plz. very urgent..
>
> --
> With Regards,
> John Shiny.J
>


Re: [ns] how to Re compile NS2 after modifing a .cc file ?

2012-11-03 Thread Rafael P B Mota

Just run make command in ns-2.xx folder.
Rafael
Em 03/11/2012 07:23, "Basma Bejaoui"  escreveu:

>
> I modify a .cc files for my project simulation,
> How to recompile NS2, to consider the modification ??
> thx
>
> --
> *Cordialement*
> *Basma Bejaoui*
> *Ingénieur Informatique, Génie Télécommunication et Réseaux *
> *+216 20 09 52 02 *
>


Re: [ns] broadcast tranmission MAC leve 802.11

2012-10-23 Thread Rafael P B Mota

Pedro,

Just set the destination address to IP_BROADCAST.
It's the best way.

Rafael

2012/10/23 pedro chaparro :
>
> Hi,in 802.11 which is the address to use in destination field when i want
> to send some packet in broadcast way?It is -2?
> Thanks
>
> --
> Pedro Alonso Chaparro Valero R&D Engineer
> Ciudad Politecnica de la Innovación
> iTEAM - Mobile Communications Group
> Polytechnic University of Valencia
> C\ Camino de Vera S/N, Edificio 8G
> 46022 Valencia, Spain



-- 

Rafael Perazzo B Mota
rafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--



[ns] Trace only specific fields

2012-10-11 Thread Rafael P B Mota

Hello ns users,

Is there any way to trace only some fields, to avoid trace-all option ? For
example, I need only the options: (s/r/d), -t (time), -Ni, -Is, -Id, -Ii.
How can I do this ? My trace files are becoming to large with a lot of
unecessary information.

Thanks for help!!

-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


Re: [ns] Random time to send a packet

2012-10-03 Thread Rafael P B Mota

Hello Natalya

Thank you very much for your help. Now my agent is working properly. It
delays x random seconds.

Rafael

2012/10/3 Natalya Rozhnova 

> Hi Rafael,
>
> In order to use the Random class of ns2 you should include random.h in
> your code. I guess there are some differents distributions of random
> numbers, not only uniform.
> Normally sch.schedule (blabla) is the same function as send. So, the
> difference between send and schedule is just that the first one sends a
> packet p with no delay while the second one adds a little delay before
> sending a packet p.
> If you look a realization of the function "send" you'll find something
> like "target_->recv(p)".
> What's about "schedule": this is a timer that executes the same
> "target_->recv(p)" but in some seconds (the third parameter: a delay).
>
> Natalya
>
> 03.10.2012, 23:46, "Rafael P B Mota" :
>
> Hello Natalya,
> I found a problem in my random number generator. The number generated was
> to high.
> I tried to use your solution (Random::uniform(0,1)) but the compiler was
> unable to find the function and class Random. What library should I include
> to use Random::uniform ?
>
> Another question: If I use sch:schedule(target_,packet,time) there's no
> need to use the function send(packet) ?
>
> Thank you very much for your help!!!
>
> Rafael
>
>
>
> 2012/10/3 Natalya Rozhnova 
>
>  Hey, In addition I guess the delay has to be in seconds and not in
>  milliseconds.
>
>
>  03.10.2012, 22:51, "Natalya Rozhnova" :
>
>  It's strange... I use exactly the same idea. (I guess you are working on
>  information-centric networking :-) ). Here is a piece of my code I'm using
>  in my server agent:
>
>  rtt_alea = Random::uniform(0,1);
>  Scheduler& sch = Scheduler::instance();
>  sch.schedule(target_, Chunk, rtt_alea);
>
>  You don't need the function send using this realization.
>  or me everything works well... Try to print your delay value, may be it is
>  not computed correctly and probably it's very large.
>  Print your  value into the consol to be sure this is not a trouble.
>  03.10.2012, 22:38, "Rafael P B Mota" :
>
>  Hello Natalya,
>
>  I tryed the solution:
>
>srand(time(NULL));
>int tempo = rand() % 400 + 100;
>Scheduler& sch = Scheduler::instance();
>sch.schedule(target_,pktret,tempo);
>//send(pktret,0);
>
>  But the packet is not sent.
>  If I uncomment the line send(pktret,0) I get an error like this:
> Scheduler:
>  Event UID not valid!
>
>  What should I do ?
>
>  2012/10/3 Natalya Rozhnova 
>
>   Hi,
>
>   There are two ways to do it. Try this way for example:
>
>   Scheduler& sch = Scheduler::instance();
>   sch.schedule(target_, [packet you want to send], [delay in ms]);
>
>   The second way I don't remember exactly but it consists in using the
>   function reschedule. You can read about these functions in detail in ns2
>   manual.
>
>   Hope it helps you,
>   --
>   Cordialement,
>   Natalya Rozhnova
>
>   03.10.2012, 21:44, "Rafael P B Mota" :
>
>   Hello,
>
>   I am trying to use a random delay (in receiver) before the packet is sent
>   back to the sender agent. For example:
>
>   1) the receiver agent receive the sender packet
>   2) the receiver sets up a response packet
>   3) Wait for a random time (in ms)
>   4) sends the packet.
>
>   I don't know how to do the step 3.
>
>   I am pasting the code bellow: Somebody can help me ?
>
>   void MyAgent::recv(Packet* pkt, Handler*)
>   {
> hdr_ip* hdrip = hdr_ip::access(pkt);
> hdr_rfidPacket* hdr = hdr_rfidPacket::access(pkt);
> if (hdr->tipo_==1) {
> Packet* pktret = allocpkt();
>hdr_rfidPacket* hdrTag = hdr_rfidPacket::access(pktret);
>hdr_ip* hdrIp = hdr_ip::access(pktret);
>hdrTag->tagEPC_ = tagEPC_;
> hdrTag->id_ = hdr->id_;
>hdrTag->tipo_ = 0;
>hdrIp->daddr() = IP_BROADCAST;
>hdrIp->dport() = hdrip->sport();
>*//HOWTO WAIT A RANDOM TIME (in miliseconds) before send back the
>   packet ??*
>
> send(pktret,0);
> }
> else {
>   Packet::free(pkt);
> }
> Packet::free(pkt);
> return;
>   }
>
>   --
>
>
>
>   
> 
>   Rafael Perazzo B Mota
>   r afaelpera...@gmail.com
>
>   Web-page: https://sites.google.com/site/rafaelpera

Re: [ns] Random time to send a packet

2012-10-03 Thread Rafael P B Mota

Hello Natalya,
I found a problem in my random number generator. The number generated was
to high.
I tried to use your solution (Random::uniform(0,1)) but the compiler was
unable to find the function and class Random. What library should I include
to use Random::uniform ?

Another question: If I use sch:schedule(target_,packet,time) there's no
need to use the function send(packet) ?

Thank you very much for your help!!!

Rafael



2012/10/3 Natalya Rozhnova 

> Hey, In addition I guess the delay has to be in seconds and not in
> milliseconds.
>
>
> 03.10.2012, 22:51, "Natalya Rozhnova" :
>
> It's strange... I use exactly the same idea. (I guess you are working on
> information-centric networking :-) ). Here is a piece of my code I'm using
> in my server agent:
>
> rtt_alea = Random::uniform(0,1);
> Scheduler& sch = Scheduler::instance();
> sch.schedule(target_, Chunk, rtt_alea);
>
> You don't need the function send using this realization.
> or me everything works well... Try to print your delay value, may be it is
> not computed correctly and probably it's very large.
> Print your  value into the consol to be sure this is not a trouble.
> 03.10.2012, 22:38, "Rafael P B Mota" :
>
> Hello Natalya,
>
> I tryed the solution:
>
>   srand(time(NULL));
>   int tempo = rand() % 400 + 100;
>   Scheduler& sch = Scheduler::instance();
>   sch.schedule(target_,pktret,tempo);
>   //send(pktret,0);
>
> But the packet is not sent.
> If I uncomment the line send(pktret,0) I get an error like this: Scheduler:
> Event UID not valid!
>
> What should I do ?
>
> 2012/10/3 Natalya Rozhnova 
>
>  Hi,
>
>  There are two ways to do it. Try this way for example:
>
>  Scheduler& sch = Scheduler::instance();
>  sch.schedule(target_, [packet you want to send], [delay in ms]);
>
>  The second way I don't remember exactly but it consists in using the
>  function reschedule. You can read about these functions in detail in ns2
>  manual.
>
>  Hope it helps you,
>  --
>  Cordialement,
>  Natalya Rozhnova
>
>  03.10.2012, 21:44, "Rafael P B Mota" :
>
>  Hello,
>
>  I am trying to use a random delay (in receiver) before the packet is sent
>  back to the sender agent. For example:
>
>  1) the receiver agent receive the sender packet
>  2) the receiver sets up a response packet
>  3) Wait for a random time (in ms)
>  4) sends the packet.
>
>  I don't know how to do the step 3.
>
>  I am pasting the code bellow: Somebody can help me ?
>
>  void MyAgent::recv(Packet* pkt, Handler*)
>  {
>hdr_ip* hdrip = hdr_ip::access(pkt);
>hdr_rfidPacket* hdr = hdr_rfidPacket::access(pkt);
>if (hdr->tipo_==1) {
>Packet* pktret = allocpkt();
>   hdr_rfidPacket* hdrTag = hdr_rfidPacket::access(pktret);
>   hdr_ip* hdrIp = hdr_ip::access(pktret);
>   hdrTag->tagEPC_ = tagEPC_;
>hdrTag->id_ = hdr->id_;
>   hdrTag->tipo_ = 0;
>   hdrIp->daddr() = IP_BROADCAST;
>   hdrIp->dport() = hdrip->sport();
>   *//HOWTO WAIT A RANDOM TIME (in miliseconds) before send back the
>  packet ??*
>
>send(pktret,0);
>}
>else {
>  Packet::free(pkt);
>}
>Packet::free(pkt);
>return;
>  }
>
>  --
>
>
>  
> 
>  Rafael Perazzo B Mota
>  r afaelpera...@gmail.com
>
>  Web-page: https://sites.google.com/site/rafaelperazzo/
>  Doutorando em Ciência da Computação
>  Universidade de São Paulo (USP)
>  Campus da Capital
>  Instituto de Matemática e estatística (IME)
>
>
>  
> --
>
> --
>
> 
> Rafael Perazzo B Mota
> r afaelpera...@gmail.com
> Web-page: https://sites.google.com/site/rafaelperazzo/
> Doutorando em Ciência da Computação
> Universidade de São Paulo (USP)
> Campus da Capital
> Instituto de Matemática e estatística (IME)
>
> --
>
>


-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


Re: [ns] Random time to send a packet

2012-10-03 Thread Rafael P B Mota

Hello Natalya,

I tryed the solution:

  srand(time(NULL));
  int tempo = rand() % 400 + 100;
  Scheduler& sch = Scheduler::instance();
  sch.schedule(target_,pktret,tempo);
  //send(pktret,0);

But the packet is not sent.
If I uncomment the line send(pktret,0) I get an error like this: Scheduler:
Event UID not valid!

What should I do ?

2012/10/3 Natalya Rozhnova 

> Hi,
>
> There are two ways to do it. Try this way for example:
>
> Scheduler& sch = Scheduler::instance();
> sch.schedule(target_, [packet you want to send], [delay in ms]);
>
> The second way I don't remember exactly but it consists in using the
> function reschedule. You can read about these functions in detail in ns2
> manual.
>
> Hope it helps you,
> --
> Cordialement,
> Natalya Rozhnova
>
> 03.10.2012, 21:44, "Rafael P B Mota" :
>
> Hello,
>
> I am trying to use a random delay (in receiver) before the packet is sent
> back to the sender agent. For example:
>
> 1) the receiver agent receive the sender packet
> 2) the receiver sets up a response packet
> 3) Wait for a random time (in ms)
> 4) sends the packet.
>
> I don't know how to do the step 3.
>
> I am pasting the code bellow: Somebody can help me ?
>
> void MyAgent::recv(Packet* pkt, Handler*)
> {
>   hdr_ip* hdrip = hdr_ip::access(pkt);
>   hdr_rfidPacket* hdr = hdr_rfidPacket::access(pkt);
>   if (hdr->tipo_==1) {
>   Packet* pktret = allocpkt();
>  hdr_rfidPacket* hdrTag = hdr_rfidPacket::access(pktret);
>  hdr_ip* hdrIp = hdr_ip::access(pktret);
>  hdrTag->tagEPC_ = tagEPC_;
>   hdrTag->id_ = hdr->id_;
>  hdrTag->tipo_ = 0;
>  hdrIp->daddr() = IP_BROADCAST;
>  hdrIp->dport() = hdrip->sport();
>  *//HOWTO WAIT A RANDOM TIME (in miliseconds) before send back the
> packet ??*
>
>   send(pktret,0);
>   }
>   else {
> Packet::free(pkt);
>   }
>   Packet::free(pkt);
>   return;
> }
>
> --
>
> 
> Rafael Perazzo B Mota
> r afaelpera...@gmail.com
>
> Web-page: https://sites.google.com/site/rafaelperazzo/
> Doutorando em Ciência da Computação
> Universidade de São Paulo (USP)
> Campus da Capital
> Instituto de Matemática e estatística (IME)
>
> --
>
>


-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


Re: [ns] Random time to send a packet

2012-10-03 Thread Rafael P B Mota

Thanks for the response Christos!!

I tried the while solution with no success. Is there any way to wait, for
instance, 100ms, before the command send(pktret,0) is executed ? I guess
it's a simple issue, but until now I was not able to solve.

Does anyone can suggest something to do ?

Thanks all!!


2012/10/3 Christos Spatiotis 

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hello , Rafael
>
> If you try to put send(pktret,0) in a "while" which run for a random
> time. I guess i do not know.
> Please let me know if you make it.
>
> On 10/03/2012 05:37 PM, Rafael P B Mota wrote:
> >
> > Hello,
> >
> > I am trying to use a random delay (in receiver) before the packet
> > is sent back to the sender agent. For example:
> >
> > 1) the receiver agent receive the sender packet 2) the receiver
> > sets up a response packet 3) Wait for a random time (in ms) 4)
> > sends the packet.
> >
> > I don't know how to do the step 3.
> >
> > I am pasting the code bellow: Somebody can help me ?
> >
> > void MyAgent::recv(Packet* pkt, Handler*) { hdr_ip* hdrip =
> > hdr_ip::access(pkt); hdr_rfidPacket* hdr =
> > hdr_rfidPacket::access(pkt); if (hdr->tipo_==1) { Packet* pktret =
> > allocpkt(); hdr_rfidPacket* hdrTag =
> > hdr_rfidPacket::access(pktret); hdr_ip* hdrIp =
> > hdr_ip::access(pktret); hdrTag->tagEPC_ = tagEPC_; hdrTag->id_ =
> > hdr->id_; hdrTag->tipo_ = 0; hdrIp->daddr() = IP_BROADCAST;
> > hdrIp->dport() = hdrip->sport(); *//HOWTO WAIT A RANDOM TIME (in
> > miliseconds) before send back the packet ??* send(pktret,0); } else
> > { Packet::free(pkt); } Packet::free(pkt); return; }
> >
>
>
> - --
> ===
> Undergraduate student Spatiotis Christos
> Department of Computer Engineering & Informatics (CEID)
> University of Patras, Greece
> e-mail: spati...@ceid.upatras.gr
> website: http://spatiotis.wordpress.com
> 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.12 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
>
> iQEcBAEBAgAGBQJQbE/YAAoJEC9xXqfymW+O/uQIAIxGwtzvq/DuK9v/A2pkqm0g
> sAvwTQeoyA+w2psIVdAObud+mhuYh1GMTIBHlTEmCOt/8nSCUVnswqQlbONAOx7Y
> HecsOmhcTeDbRh1ncXqNc3iw4DKtGwS2RaiFYolfjV6pXSKz/EM0YDR29p4uZv5K
> eRAEW5TIGTTy3dYWzUf2+dexz9AiA5+UHBpP+AT9EgoTCv2u2DTyiUt3ysDl4zTd
> HgKKwZ8iBNXO0H35Eqf2ri6R6adYVtERKpSNk5fW5fxMkQuqR18szzEYcNPrfgbQ
> MjaQQmBHy7iFFbC/Hu2nVPPmL3d6o8Qn66IvX/Ap6Yy6Kwa/a/PRZOyoFV5q2U8=
> =riL2
> -END PGP SIGNATURE-
>



-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


[ns] Random time to send a packet

2012-10-03 Thread Rafael P B Mota

Hello,

I am trying to use a random delay (in receiver) before the packet is sent
back to the sender agent. For example:

1) the receiver agent receive the sender packet
2) the receiver sets up a response packet
3) Wait for a random time (in ms)
4) sends the packet.

I don't know how to do the step 3.

I am pasting the code bellow: Somebody can help me ?

void MyAgent::recv(Packet* pkt, Handler*)
{
  hdr_ip* hdrip = hdr_ip::access(pkt);
  hdr_rfidPacket* hdr = hdr_rfidPacket::access(pkt);
  if (hdr->tipo_==1) {
  Packet* pktret = allocpkt();
 hdr_rfidPacket* hdrTag = hdr_rfidPacket::access(pktret);
 hdr_ip* hdrIp = hdr_ip::access(pktret);
 hdrTag->tagEPC_ = tagEPC_;
  hdrTag->id_ = hdr->id_;
 hdrTag->tipo_ = 0;
 hdrIp->daddr() = IP_BROADCAST;
 hdrIp->dport() = hdrip->sport();
 *//HOWTO WAIT A RANDOM TIME (in miliseconds) before send back the
packet ??*
  send(pktret,0);
  }
  else {
Packet::free(pkt);
  }
  Packet::free(pkt);
  return;
}

-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


[ns] Schedule an event

2012-10-03 Thread Rafael P B Mota

Hello,

I am trying to use a random delay (in receiver) before the packet is sent
back to the sender agent. For example:

1) the receiver agent receive the sender packet
2) the receiver sets up a response packet
3) Wait for a random time (in ms)
4) sends the packet.

I don't know how to do the step 3.

I am pasting the code bellow: Somebody can help me ?

void MyAgent::recv(Packet* pkt, Handler*)
{
  hdr_ip* hdrip = hdr_ip::access(pkt);
  hdr_rfidPacket* hdr = hdr_rfidPacket::access(pkt);
  if (hdr->tipo_==1) {
  Packet* pktret = allocpkt();
hdr_rfidPacket* hdrTag = hdr_rfidPacket::access(pktret);
hdr_ip* hdrIp = hdr_ip::access(pktret);
hdrTag->tagEPC_ = tagEPC_;
  hdrTag->id_ = hdr->id_;
hdrTag->tipo_ = 0;
hdrIp->daddr() = IP_BROADCAST;
hdrIp->dport() = hdrip->sport();

send(pktret,0);
  }
  else {
Packet::free(pkt);
  }
  Packet::free(pkt);
  return;
}

-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


[ns] RFID and wifi - ns2

2012-10-01 Thread Rafael P B Mota

Hello ns-users,

I have two questions about ns, maybe somebody can help me:

1)Is there any ns-2 extension that simulates a RFID system ? (tags and
readers). If the answer is yes, where can I download ?
2) Is there any way to decrease the range of a wifi node ? (decrease the
signal power)
3) Is there any way to set the maximum speed of a wifi node ? (for
instance, max of 500Kbps)

Thanks!!

-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


[ns] Wifi transmission power

2012-09-24 Thread Rafael P B Mota

Is there any way to restrict the transmit power (to lower the range) of
wifi nodes ? How can I configure this ?
In my cenario, the wifi nodes have a large range, but I am simulating RFID
tags, so I need to limitate the range.

Thanks

-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


Re: [ns] connect many nodes with "for" loop in tcl script

2012-09-24 Thread Rafael P B Mota

Thank you very much. It is working now!!

Rafael

2012/9/24 Newaz 

> HI
>
> try this code. I am attaching.
>
>
> Regards
> Newaz
>
> On 24 September 2012 18:37, Rafael P B Mota wrote:
>
>>
>> Hello,
>>
>> I am trying to connect a node called $reader1 to 30 other nodes. I tryed
>> to
>> write a for statemant but it is not working.
>>
>>
>> This works: but with two nodes is very simple
>> $ns connect $reader1 $tag_1
>> $ns connect $reader1 $tag_2
>>
>> This is not working:
>> for {set i 1} {$i < $val(nn)} { incr i } {
>> $ns connect $reader1 $tag_$i
>> }
>>
>>
>> Error:
>>
>> can't read "tag_": no such variable
>> while executing
>> "$ns connect $reader1 $tag_$i"
>> ("for" body line 2)
>> invoked from within
>> "for {set i 1} {$i < $val(nn)} { incr i } {
>> $ns connect $reader1 $tag_$i
>> }"
>> (file "rfid4.tcl" line 118)
>>
>>
>> The tag_ var is created at:
>>
>> for {set i 1} {$i < $val(nn)} { incr i } {
>> set tag_$i [new Agent/RfidTag]
>> }
>>
>> What should I do ?
>>
>> --
>>
>> 
>> Rafael Perazzo B Mota
>> r afaelpera...@gmail.com
>>
>> Web-page: https://sites.google.com/site/rafaelperazzo/
>> Doutorando em Ciência da Computação
>> Universidade de São Paulo (USP)
>> Campus da Capital
>> Instituto de Matemática e estatística (IME)
>>
>> --
>>
>>
>>
>>
>> --
>>
>> 
>> Rafael Perazzo B Mota
>> r afaelpera...@gmail.com
>>
>> Web-page: https://sites.google.com/site/rafaelperazzo/
>> Doutorando em Ciência da Computação
>> Universidade de São Paulo (USP)
>> Campus da Capital
>> Instituto de Matemática e estatística (IME)
>>
>> --
>>
>
>
>
> --
>
>
> Newaz
>
> Phd Candidate.
> Broadband Network Lab(BNLab)
> room no:T240
> Building: Truth Hall
>
> Korea Advanced Institute of Science and Technology(KAIST)
> 119,Munjiro, Yuseong-gu, Daejeon,305-732, South Korea
>
>


-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


[ns] connect many nodes with "for" loop in tcl script

2012-09-24 Thread Rafael P B Mota

Hello,

I am trying to connect a node called $reader1 to 30 other nodes. I tryed to
write a for statemant but it is not working.


This works: but with two nodes is very simple
$ns connect $reader1 $tag_1
$ns connect $reader1 $tag_2

This is not working:
for {set i 1} {$i < $val(nn)} { incr i } {
$ns connect $reader1 $tag_$i
}


Error:

can't read "tag_": no such variable
while executing
"$ns connect $reader1 $tag_$i"
("for" body line 2)
invoked from within
"for {set i 1} {$i < $val(nn)} { incr i } {
$ns connect $reader1 $tag_$i
}"
(file "rfid4.tcl" line 118)


The tag_ var is created at:

for {set i 1} {$i < $val(nn)} { incr i } {
set tag_$i [new Agent/RfidTag]
}

What should I do ?

-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--




-- 

Rafael Perazzo B Mota
r afaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--