RSRP and SINR Values in mmwave module

301 views
Skip to first unread message

aadesh shah

unread,
Mar 30, 2020, 9:48:15 AM3/30/20
to ns-3-users
I am new to ns3 and mmwave module. I was trying to display the Sinr and Rsrp values using the following method:

Function:
void
NotifySinrRsrp (  uint64_t context, Ptr<const SpectrumValue> rsrp,Ptr<const SpectrumValue> sinr )
{
     std::cout << context
//                << " eNB CellId " << cellid
                << " RSRP " << rsrp
                << " SINR " << sinr
<<"REached"
                << std::endl;
}

Connecting via this:
Config::Connect ("/NodeList/*/DeviceList/*/MmWaveUePhy/ReportCurrentCellRsrpSinr",
                        MakeCallback (&NotifySinrRsrp));

I am getting an error like two or many variables in the function argument.
My question was how can I obtain the rsrp values from "SpectrumValue&" mentioned in the mmwave-ue-phy.h file.

And if there was some other method to find Rsrp value and Sinr values then let me know, I want to get the values with location of the nodes.

Any help would be appreciated. Thanks

- Aadesh Shah

aadesh shah

unread,
Apr 20, 2020, 5:49:01 AM4/20/20
to ns-3-users
Hey,
Even I am working woth the mmwave module, I have done the calculation for SINR check this out:

the SINR in mmwave modules is given as array of power values so you need to make few changes to mmwave-ue-phy.cc, which are:

void
MmWaveUePhy::GenerateDlCqiReport (const SpectrumValue& sinr)
{
  NS_LOG_FUNCTION (this);
  // Not totally sure what this is about. We have to check.
  if (m_ulConfigured && (m_rnti > 0) && m_receptionEnabled)
    {
      if (Simulator::Now () > m_wbCqiLast + m_wbCqiPeriod)
        {
          SpectrumValue newSinr = sinr;
          Ptr<MmWaveDlCqiMessage> msg = CreateDlCqiFeedbackMessage (newSinr);
         double avSinr= ComputeAvgSinr(newSinr);
          if (msg)
            {
              DoSendControlMessage (msg);
            }
          Ptr<MmWaveUeNetDevice> UeRx = DynamicCast<MmWaveUeNetDevice> (GetDevice ());
          m_reportCurrentCellRsrpSinrTrace (UeRx->GetImsi (), avSinr, newSinr);

        }
    }
}
double
MmWaveUePhy::ComputeAvgSinr (const SpectrumValue& sinr)
{
  NS_LOG_FUNCTION (this);

  // averaged SINR among RBs
  double sum = 0.0;
  uint8_t rbNum = 0;
  Values::const_iterator it;

  for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
    {
      sum += (*it);
      rbNum++;
    }

  double avrgSinr = (rbNum > 0) ? (sum / rbNum) : DBL_MAX;

  return avrgSinr;
}

Now in your program file add the following trace and funtions:

-First you add these lines in the main file to connect the trace:
 AsciiTraceHelper asciiTraceHelper;
  Ptr<OutputStreamWrapper> stream = asciiTraceHelper.CreateFileStream ("ueTest.txt");
  Config::Connect ("/NodeList/*/DeviceList/*/$ns3::MmWaveUeNetDevice/ComponentCarrierMapUe/*/MmWaveUePhy/ReportCurrentCellRsrpSinr",
  MakeBoundCallback (&ReportUeMeasurementsCallbackDetail,stream));
-Next this is the function:
void
 
ReportUeMeasurementsCallbackDetail  (Ptr<OutputStreamWrapper> stream,std::string context,
                                                     uint64_t imsi, double sinr, SpectrumValue& power)
{
  std::cout << "UE"<<imsi<<"SINR"<<10*log(sinr) / log(10)<<"RSRP"<< power<<std::endl;
  std::cout<<"Printed"<<std::endl;


    int nth=3;  //looking for the second ocurrence of "/"
    int cnt=0;
    size_t pos=0;

    while( cnt != nth )
    {
        pos = context.find("/", pos);
        if ( pos == std::string::npos )
          std::cout << nth << "th ocurrence not found!"<< std::endl;
        pos+=1;
        cnt++;
    }

    // std::cout << "test" <<context<< std::endl;


    //manipulate the string to get the node ID
    std::string str1;
    str1 = context.substr(10,pos-11);
    int ue= atoi(str1.c_str());



    //Get the UE position from the NodeList
    Ptr<MobilityModel> m1 = ns3::NodeList::GetNode(ue)->GetObject<MobilityModel>();
   

//    Get the eNB position from the eNB
     Ptr<MobilityModel> m2 = ns3::NodeList::GetNode(0)->GetObject<MobilityModel>();
  

    // //print UE and eNB location
    Vector v1 = m1->GetPosition();
 
    Vector v2 = Vector (25, 25 , 7);

    std::cout << Simulator::Now().GetSeconds()<<std::endl;
    // <<"\tUE:" << imsi << " - (" << v1.x << ", " << v1.y << "," <<v1.z <<")"<<std::endl;
    // std::cout << " \teNB:" << 1<< " - (" << v2.x << ", " << v2.y <<"," <<v2.z << ")"<<std::endl;

    //Print the distante between UE and eNB

    Vector distance = v2-v1;
    std::cout << " Distance : " << distance << std::endl;

     *stream->GetStream() << Simulator::Now().GetSeconds() << "\t" <<imsi<<"\t"<< 10*log(sinr) / log(10) <<"\t"<<v1 <<"\t"<<distance<< std::endl;

}

Edivaldo

unread,
Apr 21, 2020, 4:01:46 PM4/21/20
to ns-3-users
Hi, Aadesh.

I hope everything is alright.

I'm looking for something that returns values of distance between us. Seeing your code here, are you treating or doing something similar?

I am working with VANETs and of SUMO mobility. I need to obtain the distance (in meters) from the vehicles, so that they accept communication only from vehicles that are in your coverage area up to 500 meters. Above this, reject.

Thank you for your attention.

Health and peace.

Greetings,
Edivaldo

aadesh shah

unread,
Apr 22, 2020, 3:13:40 AM4/22/20
to ns-3-users
Yes its creating a vector and calculating distance between base station and UE.

Angela Tsai

unread,
Jul 3, 2020, 8:50:25 PM7/3/20
to ns-3-users
Hi Aadesh,

Sorry for bothering you for old thread. I am looking for how to record the RSRP information for mmwave UEs and I found this post.

I tried with the code you suggested here, but it showed the error message about numbers of arguments just like you did. 
Could you please guide me about how to correctly do this? 
Also, I have a question about the RSRP and SINR. I am not an expert on these two metrics. Would you please explain about why newSinr is the RSRP in your code as following?

 m_reportCurrentCellRsrpSinrTrace (UeRx->GetImsi (), avSinr, newSinr);
 std::cout << "UE"<<imsi<<"SINR"<<10*log(sinr) / log(10)<<"RSRP"<< power<<std::endl;


Thank you and hope everything is good with you.
Regards,
Angela Tsai
Reply all
Reply to author
Forward
0 new messages