Skip to first unread message

matuko

unread,
Jan 16, 2020, 10:42:12 PM1/16/20
to ns-3-users
Hello.

I want to acquire and use the sending node and receiving node using "propagatelossmodel.cc".

New to NS3, but I don't know how to get the sender and recipient node IDs.

I thought that I should use a and b of Ptr <MobilityModel> a and Ptr <MobilityModel> b, but I couldn't get it well as follows.

Thanks.




double
LogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm,
                                                Ptr<MobilityModel> a,
                                                Ptr<MobilityModel> b) const
{
  double distance = a->GetDistanceFrom (b);
  if (distance <= m_referenceDistance)
    {
      return txPowerDbm - m_referenceLoss;
    }
  /**
   * The formula is:
   * rx = 10 * log (Pr0(tx)) - n * 10 * log (d/d0)
   *
   * Pr0: rx power at reference distance d0 (W)
   * d0: reference distance: 1.0 (m)
   * d: distance (m)
   * tx: tx power (dB)
   * rx: dB
   *
   * Which, in our case is:
   *
   * rx = rx0(tx) - 10 * n * log (d/d0) 
   */
  double pathLossDb = 10.0 * m_exponent * std::log10 (distance / m_referenceDistance);
  double rxc = -m_referenceLoss - pathLossDb;






NS_LOG_DEBUG ("  "<<a<<"  "<<b<<"  ");



+99.975421000  PropagationLossModel:DoCalcRxPower():   0x556a65c05c90  0x556a65c05c30    
+99.985435000  PropagationLossModel:DoCalcRxPower():   0x556a65b53800  0x556a65b83070    
+99.985435000  PropagationLossModel:DoCalcRxPower():   0x556a65b53800  0x556a65b60920    
+99.985435000  PropagationLossModel:DoCalcRxPower():   0x556a65b53800  0x556a65b5a700   
+99.996340000  PropagationLossModel:DoCalcRxPower():   0x556a65c05c30  0x556a65b5af50  
+99.996340000  PropagationLossModel:DoCalcRxPower():   0x556a65c05c30  0x556a65b52910  
+99.996340000  PropagationLossModel:DoCalcRxPower():   0x556a65c05c30  0x556a65c05c90




Reply all
Reply to author
Forward
0 new messages