OMNET++: How to obtain wireless signal power?

邮差的信 提交于 2019-12-11 16:11:44

问题


I am using the newly released INET 4.0 framework for OMNET++ and I would like to obtain the received signal strength value in a wireless host (of type AdhocHost). How may I do that?


回答1:


In INET 4.0.0 the packet received by a module contains several tags. Between others there is SignalPowerInd tag. According to SignalTag.msg:

This indication specifies the average analog signal power that was detected during receiving the packet. It may be present on a packet from the phyiscal layer to the application.

This tag is present in packet processing by a wireless MAC layer, for example:

And packet received by application layer contains SignalPowerInd too:


One can obtain the value of SignalPowerInd from received radio packet in any layer using standard API. For example, to obtain it in UdpBasicApp one should add in UdpBasicApp.cc:
#include "inet/physicallayer/common/packetlevel/SignalTag_m.h"
// ...

void UdpBasicApp::socketDataArrived(UdpSocket *socket, Packet *packet) {

   if (packet->findTag<SignalPowerInd>() != nullptr) {
       auto signalPowerInd = packet->getTag<SignalPowerInd>();
       auto rxPower = signalPowerInd->getPower().get();
       EV_INFO << "RX power= " << rxPower << "W" << endl;
   } 

   // process incoming packet
   processPacket(packet);
}


来源:https://stackoverflow.com/questions/51365240/omnet-how-to-obtain-wireless-signal-power

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!