1

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?

Farzan Badakhshan
  • 373
  • 1
  • 5
  • 19

1 Answers1

4

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:

enter image description here

And packet received by application layer contains SignalPowerInd too:

enter image description here


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);
}
Jerzy D.
  • 6,707
  • 2
  • 16
  • 22
  • in my case the power is always 0mW. https://stackoverflow.com/questions/65293303/unitdiskradiomedium-no-power-consumption-settings-omnetpp – Sebi Dec 14 '20 at 17:21