How to calculate data packet delivery ratio in wpan

196 views
Skip to first unread message

Đạt Lê khánh

unread,
Oct 28, 2014, 9:53:58 AM10/28/14
to omn...@googlegroups.com
Hello everyone,

I want to caculate data packet delivery ratio in starnet module.Firstly, I saw in "Ieee802154TestApp.cc" having code to caculate end to end delay and mean end to end delay vector.

void Ieee802154TestApp::handleLowerMsg(cMessage* apMsg)
{
    simtime_t e2eDelay;
    Ieee802154AppPkt* tmpPkt = check_and_cast<Ieee802154AppPkt *>(apMsg);
    e2eDelay = simTime() - tmpPkt->getCreationTime();
    totalByteRecv += tmpPkt->getByteLength();
    e2eDelayVec.record(SIMTIME_DBL(e2eDelay));
    numReceived++;
    sumE2EDelay += e2eDelay;
    meanE2EDelayVec.record(sumE2EDelay/numReceived);


    EV << "[APP]: a message sent by " << tmpPkt->getSourceName() << " arrived at application with delay " << e2eDelay << " s" << endl;
    delete apMsg;

Then, in file " Ieee802154TestApp.h " i add this line "cOutVector packetDEliveryRatioVec;" for declaring the PDR operator.
Back to  "Ieee802154TestApp.cc", i add "packetDeliveryRatioVec.record (???????) " below "  meanE2EDelayVec.record(sumE2EDelay/numReceived)";

"(?????)" mean i have bo idea to write the code in this

So, please, help me, how to caculate and record PDR in starnet module

Michael Kirsche

unread,
Oct 29, 2014, 9:06:46 AM10/29/14
to omn...@googlegroups.com
I would argue that the "Packet Delivery Ratio" shouldn't be calculated / collected in a vector, but in a scalar value like Goodput/Throughput.

As far as I understand the packet delivery ratio, then it is: Sum(packets_received) / Sum(packets_sent)

And this value should probably be calculated at the end of the simulation.
Any special reason you want to calculate it as a vector / for every packet reception?

Calculating it as a scalar is as simple as dividing numReceived through mNumTrafficMsgs in the finish() function of Ieee802154TestApp, just like the other scalar values already there.

Lê Khánh Đạt

unread,
Oct 30, 2014, 9:56:00 AM10/30/14
to omn...@googlegroups.com
Hello Michael, 
Thanks for your answer. I see in "Ieee802154TestApp.h" file has parametters: mNumTrafficMsgs, mNumTrafficMsgRcvd,  numReceived, totalByteRecv. Can you explain to me the meaning of these parameters? I was confused by  numReceived and  mNumTrafficMsgRcvd.

--
You received this message because you are subscribed to a topic in the Google Groups "omnetpp" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/9eJv-jRxVG0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omnetpp+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
---------------Le Khanh Dat
--------Student of K56D-FET-UET-VNU
-----Tel: 0164.874.1193

Michael Kirsche

unread,
Oct 30, 2014, 10:30:12 AM10/30/14
to omn...@googlegroups.com
Hmm, isn't it obvious from the actual source code?

numReceived is increased in handleLowerMsg whenever a message is received from the lower layers (aka the radio).

mNumTrafficMsgs is increased in SendTraf when a new (traffic) message is generated and then sent to the lower layers.

Lê Khánh Đạt

unread,
Oct 30, 2014, 11:33:05 AM10/30/14
to omn...@googlegroups.com
in my starnet module, i set host [0]​ is destination node and others node send data to host [0]. host [0] just received data and doesnt send it. I want to calculate PDR on host[0].

this is my code to calculate PDR " recordScalar("packetDeliveryRatio",numReceived/mNumTrafficMsgs); " but the result is infinity because  host[0] doesnt send data and mNumTrafficMsgs is the code to record the trafficsent only at each host not total host ( number/0 = infinity) . So, do you know how to calculate total trafficsent of module?

Michael Kirsche

unread,
Oct 30, 2014, 12:11:59 PM10/30/14
to omn...@googlegroups.com
node[0] doesn't sent, so he has no packet delivery ratio.

You want to know the overall packet delivery ratio of your whole network? Or for a single node?
For a single node, he has to transmit data... for the overall network, you can do post-processing of your results either in Excel or via the Analyze tool in OMNeT and select the appropriate statistic variables and do some calculations with them.

Lê Khánh Đạt

unread,
Oct 30, 2014, 12:20:17 PM10/30/14
to omn...@googlegroups.com
That mean, i have result of nNumreceived, and trafficsent of others node expect node0. So i can calculate PDR on exel.
thank you very much

--
You received this message because you are subscribed to a topic in the Google Groups "omnetpp" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/9eJv-jRxVG0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omnetpp+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages