Search code examples
omnet++rssiinetsignal-strength

OMNET++: How to obtain wireless signal power?


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?


Solution

  • 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);
    }