View | Details | Raw Unified | Return to bug 2122
Collapse All | Expand All

(-)a/src/propagation/model/propagation-loss-model.cc (+17 lines)
 Lines 495-500    Link Here 
495
  m_referenceLoss = referenceLoss;
495
  m_referenceLoss = referenceLoss;
496
}
496
}
497
double
497
double
498
LogDistancePropagationLossModel::GetReferenceDistance (void) const
499
{
500
  return m_referenceDistance;
501
}
502
double
498
LogDistancePropagationLossModel::GetPathLossExponent (void) const
503
LogDistancePropagationLossModel::GetPathLossExponent (void) const
499
{
504
{
500
  return m_exponent;
505
  return m_exponent;
 Lines 591-596    Link Here 
591
{
596
{
592
}
597
}
593
598
599
double
600
ThreeLogDistancePropagationLossModel::GetDistance0 (void) const
601
{
602
  return m_distance0;
603
}
604
605
void
606
ThreeLogDistancePropagationLossModel::SetReferenceLoss (double referenceLoss)
607
{
608
  m_referenceLoss = referenceLoss;
609
}
610
594
double 
611
double 
595
ThreeLogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm,
612
ThreeLogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm,
596
                                                     Ptr<MobilityModel> a,
613
                                                     Ptr<MobilityModel> a,
(-)a/src/propagation/model/propagation-loss-model.h (+14 lines)
 Lines 503-508    Link Here 
503
   * \returns the current path loss exponent.
503
   * \returns the current path loss exponent.
504
   */
504
   */
505
  double GetPathLossExponent (void) const;
505
  double GetPathLossExponent (void) const;
506
  /**
507
   * \returns the current reference distance.
508
   */
509
  double GetReferenceDistance (void) const;
506
510
507
  /**
511
  /**
508
   * Set the reference path loss at a given distance
512
   * Set the reference path loss at a given distance
 Lines 591-596    Link Here 
591
   */
595
   */
592
  static TypeId GetTypeId (void);
596
  static TypeId GetTypeId (void);
593
  ThreeLogDistancePropagationLossModel ();
597
  ThreeLogDistancePropagationLossModel ();
598
  
599
  /**
600
   * Set the reference path loss at distance d0
601
   * \param referenceLoss reference path loss
602
   */
603
  void SetReferenceLoss (double referenceLoss);
604
  /**
605
   * \returns the beginning of the the first (near) distance field.
606
   */
607
  double GetDistance0 (void) const;
594
608
595
  // Parameters are all accessible via attributes.
609
  // Parameters are all accessible via attributes.
596
610
(-)a/src/wifi/model/yans-wifi-channel.cc (-1 / +32 lines)
 Lines 77-87    Link Here 
77
77
78
void
78
void
79
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
79
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
80
                       WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, Time duration) const
80
                       WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType,
81
                       Time duration, double frequency) const
81
{
82
{
82
  Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> ();
83
  Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> ();
83
  NS_ASSERT (senderMobility != 0);
84
  NS_ASSERT (senderMobility != 0);
84
  uint32_t j = 0;
85
  uint32_t j = 0;
86
  
87
  if (m_loss->GetObject<FriisPropagationLossModel> () != 0)
88
    {
89
      m_loss->GetObject<FriisPropagationLossModel> ()->SetFrequency(frequency * 1000000);
90
    }
91
  if (m_loss->GetObject<TwoRayGroundPropagationLossModel> () != 0)
92
    {
93
      m_loss->GetObject<TwoRayGroundPropagationLossModel> ()->SetFrequency(frequency * 1000000);
94
    }
95
  if (m_loss->GetObject<LogDistancePropagationLossModel> () != 0)
96
    {
97
      double refDistance = m_loss->GetObject<LogDistancePropagationLossModel> ()->GetReferenceDistance ();
98
      double C = 299792458.0; //speed of light in vacuum
99
      double lambda = C / (frequency * 1000000);
100
      double numerator = lambda * lambda;
101
      double denominator = 16 * M_PI * M_PI * refDistance * refDistance;
102
      double refLoss = -10 * log10 (numerator / denominator);
103
      m_loss->GetObject<LogDistancePropagationLossModel> ()->SetReference(refDistance, refLoss);
104
    }
105
  if (m_loss->GetObject<ThreeLogDistancePropagationLossModel> () != 0)
106
    {
107
      double refDistance = m_loss->GetObject<ThreeLogDistancePropagationLossModel> ()->GetDistance0 ();
108
      double C = 299792458.0; //speed of light in vacuum
109
      double lambda = C / (frequency * 1000000);
110
      double numerator = lambda * lambda;
111
      double denominator = 16 * M_PI * M_PI * refDistance * refDistance;
112
      double refLoss = -10 * log10 (numerator / denominator);
113
      m_loss->GetObject<ThreeLogDistancePropagationLossModel> ()->SetReferenceLoss(refLoss);
114
    }
115
  
85
  for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i++, j++)
116
  for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i++, j++)
86
    {
117
    {
87
      if (sender != (*i))
118
      if (sender != (*i))
(-)a/src/wifi/model/yans-wifi-channel.h (-1 / +2 lines)
 Lines 91-97    Link Here 
91
   * e.g. PHYs that are operating on the same channel.
91
   * e.g. PHYs that are operating on the same channel.
92
   */
92
   */
93
  void Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
93
  void Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
94
             WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, Time duration) const;
94
             WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType,
95
             Time duration, double frequency) const;
95
96
96
 /**
97
 /**
97
  * Assign a fixed random variable stream number to the random variables
98
  * Assign a fixed random variable stream number to the random variables
(-)a/src/wifi/model/yans-wifi-phy.cc (-1 / +1 lines)
 Lines 750-756    Link Here 
750
  bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
750
  bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
751
  NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, txVector);
751
  NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, txVector);
752
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel()), txVector, preamble);
752
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel()), txVector, preamble);
753
  m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel()) + m_txGainDb, txVector, preamble, packetType, txDuration);
753
  m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel()) + m_txGainDb, txVector, preamble, packetType, txDuration, GetFrequency());
754
}
754
}
755
755
756
uint32_t
756
uint32_t

Return to bug 2122