Thank you for your reply!

My Problem is that the value of the variable "double txtime_" in common header, 
that I compute, as (packet_length_in_bit / bandwidth_in_bit_per_second ), and 
set at MAC layer, with

                struct  hdr_cmn *ch = HDR_CMN(p);
        ch->txtime()=tx_time(p);

( the function "tx_time(p)" computes the packet transmission time as I 
described below).

when Phy layer takes the value of that variable, so:

         if(em()) {
               if (em()->energy() > 0) {
                         //double txtime = 
(8.*hdr_cmn::access(p)->size())/bandwidth_;
                         double txtime = hdr_cmn::access(p)->txtime();
                         (etc!)

in sendDown at wireless-phy.cc, to decrease node's energy, the variable txtime 
is equal to 0.0! And this happens only with the packet of the MAC protocol I'm 
using! So I can't see decreasing node's energy...

My question is:

is the variable I access the same? Or not?
Why I get two different values for the same variable txtime_ of the common 
header? 
And why it happens only with my MAC packets?

May be these packets are too short? 

Thank you again,

Annalisa

-----Messaggio originale-----
Da: Matthias Kuhnert [mailto:[EMAIL PROTECTED]
Inviato: mer 17/01/2007 15.40
A: [EMAIL PROTECTED]
Oggetto: Re: [ns] URGENT:: txtime = 0.0
 
Hi,

if I get you right, you want the time it takes to send the packet at node x "to 
the air". 
I think the value you get with your code is the time needed to pass the packet 
to the wireless_phy easy spoken the computing time of the packet at your mac 
and phy layer.
The time you need may be calculated by the sending rate times the packet size - 
look at the following function of the 802_15_4 in the wpan folder:
double Phy802_15_4::trxTime(Packet *p,bool phyPkt)
{
        int phyHeaderLen;
        double trx;
        hdr_cmn* ch = HDR_CMN(p);
        
        phyHeaderLen = (phyPkt)?0:defPHY_HEADER_LEN;
        trx = ((ch->size() + phyHeaderLen)*8/getRate('d'));
        return trx;
}

where getRate gives you the sending rate in bytes per second.
If you have only one sending rate, you can "hardcode" it, if you have multiple, 
you can write a function that returns the proper rate...

Greets,
 Matthias

-------- Original-Nachricht --------
Datum: Wed, 17 Jan 2007 11:47:10 +0100
Von: [EMAIL PROTECTED]
An: [email protected]
Betreff: [ns] URGENT:: txtime = 0.0

> 
> Hi everybody!
> 
> I'm using a new MAC protocol for wireless nodes, in ns2.28 .
> 
> I need the transmission time information to decrease node's energy, at
> wireless-phy.cc.
> For this reason in MAC I set the txtime_ variable of the common header,
> before sending down the MAC control packets to PHY.
> 
>       struct  hdr_cmn *ch = HDR_CMN(p);
>       ch->txtime()=tx_time(p);
> 
> But when I control the value of the txtime of the common header in
> wireless-phy.cc, for my MAC control packets it is always 0.0!
> (then the energy doesn't decrease, after the MAC control epoch! )
> 
> Why??????
> 
> perhaps the value is negligible??? Could be negligible 0.00008 seconds
> ????
> 
> Which is the correct point to set the txtime_?? And is there any?
> The only thing I do before sending down a packet to PHY, after setting
> txtime, is to print on screen the value of txtime!
> 
> Am I wrong?
> 
> At the receiver the packets arrive with the correct delay ( txtime +
> propagation delay)...
> 
> There is another strange thing, that I couldn't explain: the MAC trace
> writes only when a MAC control packet is sent, but not when it is received!
> 
> When MAC-trace is called, precisely?
> 
> Could somebody give me a hint, please? I'm very new to ns...
> Thank you!
> 
> Annalisa
> Thank you!

-- 
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: http://www.gmx.net/de/go/promail

Reply via email to