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

(-)a/src/buildings/examples/buildings-pathloss-profiler.cc (-1 / +1 lines)
 Lines 93-99    Link Here 
93
      Ptr<MobilityBuildingInfo> buildingInfoUe = CreateObject<MobilityBuildingInfo> ();
93
      Ptr<MobilityBuildingInfo> buildingInfoUe = CreateObject<MobilityBuildingInfo> ();
94
      mmUe->AggregateObject (buildingInfoUe); // operation usually done by BuildingsHelper::Install
94
      mmUe->AggregateObject (buildingInfoUe); // operation usually done by BuildingsHelper::Install
95
      BuildingsHelper::MakeConsistent (mmUe);
95
      BuildingsHelper::MakeConsistent (mmUe);
96
      double loss = propagationLossModel->GetLoss (mmEnb, mmUe);
96
      double loss = propagationLossModel->GetLoss (mmEnb, mmUe, 0.0);
97
      outFile << i << "\t"
97
      outFile << i << "\t"
98
              << loss 
98
              << loss 
99
              << std::endl;
99
              << std::endl;
(-)a/src/buildings/model/buildings-propagation-loss-model.cc (-2 / +2 lines)
 Lines 214-222    Link Here 
214
214
215
215
216
double
216
double
217
BuildingsPropagationLossModel::DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
217
BuildingsPropagationLossModel::DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const
218
{
218
{
219
  return txPowerDbm - GetLoss (a, b) - GetShadowing (a, b);
219
  return txPowerDbm - GetLoss (a, b, frequency) - GetShadowing (a, b);
220
}
220
}
221
221
222
int64_t
222
int64_t
(-)a/src/buildings/model/buildings-propagation-loss-model.h (-2 / +3 lines)
 Lines 64-75    Link Here 
64
  /**
64
  /**
65
   * \param a the mobility model of the source
65
   * \param a the mobility model of the source
66
   * \param b the mobility model of the destination
66
   * \param b the mobility model of the destination
67
   * \param frequency the carrier frequency
67
   * \returns the propagation loss (in dBm)
68
   * \returns the propagation loss (in dBm)
68
   */
69
   */
69
  virtual double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const = 0;
70
  virtual double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const = 0;
70
71
71
  // inherited from PropagationLossModel
72
  // inherited from PropagationLossModel
72
  virtual double DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
73
  virtual double DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
73
74
74
protected:
75
protected:
75
  double ExternalWallLoss (Ptr<MobilityBuildingInfo> a) const;
76
  double ExternalWallLoss (Ptr<MobilityBuildingInfo> a) const;
(-)a/src/buildings/model/hybrid-buildings-propagation-loss-model.cc (-19 / +19 lines)
 Lines 140-146    Link Here 
140
140
141
141
142
double
142
double
143
HybridBuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
143
HybridBuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const
144
{
144
{
145
  NS_ASSERT_MSG ((a->GetPosition ().z >= 0) && (b->GetPosition ().z >= 0), "HybridBuildingsPropagationLossModel does not support underground nodes (placed at z < 0)");
145
  NS_ASSERT_MSG ((a->GetPosition ().z >= 0) && (b->GetPosition ().z >= 0), "HybridBuildingsPropagationLossModel does not support underground nodes (placed at z < 0)");
146
146
 Lines 164-183    Link Here 
164
              if ((a->GetPosition ().z < m_rooftopHeight)
164
              if ((a->GetPosition ().z < m_rooftopHeight)
165
                  && (b->GetPosition ().z < m_rooftopHeight))
165
                  && (b->GetPosition ().z < m_rooftopHeight))
166
                {
166
                {
167
                  loss = ItuR1411 (a, b);
167
                  loss = ItuR1411 (a, b, frequency);
168
                  NS_LOG_INFO (this << " 0-0 (>1000): below rooftop -> ITUR1411 : " << loss);
168
                  NS_LOG_INFO (this << " 0-0 (>1000): below rooftop -> ITUR1411 : " << loss);
169
                }
169
                }
170
              else
170
              else
171
                {
171
                {
172
                  // Over the rooftop tranmission -> Okumura Hata
172
                  // Over the rooftop tranmission -> Okumura Hata
173
                  loss = OkumuraHata (a, b);
173
                  loss = OkumuraHata (a, b, frequency);
174
                  NS_LOG_INFO (this << " O-O (>1000): above rooftop -> OH : " << loss);
174
                  NS_LOG_INFO (this << " O-O (>1000): above rooftop -> OH : " << loss);
175
                }
175
                }
176
            }
176
            }
177
          else
177
          else
178
            {
178
            {
179
              // short range outdoor communication
179
              // short range outdoor communication
180
              loss = ItuR1411 (a, b);
180
              loss = ItuR1411 (a, b, frequency);
181
              NS_LOG_INFO (this << " 0-0 (<1000) Street canyon -> ITUR1411 : " << loss);
181
              NS_LOG_INFO (this << " 0-0 (<1000) Street canyon -> ITUR1411 : " << loss);
182
            }
182
            }
183
        }
183
        }
 Lines 189-206    Link Here 
189
              if ((a->GetPosition ().z < m_rooftopHeight)
189
              if ((a->GetPosition ().z < m_rooftopHeight)
190
                  && (b->GetPosition ().z < m_rooftopHeight))
190
                  && (b->GetPosition ().z < m_rooftopHeight))
191
                {                  
191
                {                  
192
                  loss = ItuR1411 (a, b) + ExternalWallLoss (b1) + HeightLoss (b1);
192
                  loss = ItuR1411 (a, b, frequency) + ExternalWallLoss (b1) + HeightLoss (b1);
193
                  NS_LOG_INFO (this << " 0-I (>1000): below rooftop -> ITUR1411 : " << loss);
193
                  NS_LOG_INFO (this << " 0-I (>1000): below rooftop -> ITUR1411 : " << loss);
194
                }
194
                }
195
              else
195
              else
196
                {
196
                {
197
                  loss = OkumuraHata (a, b) + ExternalWallLoss (b1);
197
                  loss = OkumuraHata (a, b, frequency) + ExternalWallLoss (b1);
198
                  NS_LOG_INFO (this << " O-I (>1000): above the rooftop -> OH : " << loss);
198
                  NS_LOG_INFO (this << " O-I (>1000): above the rooftop -> OH : " << loss);
199
                }
199
                }
200
            }
200
            }
201
          else
201
          else
202
            {
202
            {
203
              loss = ItuR1411 (a, b) + ExternalWallLoss (b1) + HeightLoss (b1);
203
              loss = ItuR1411 (a, b, frequency) + ExternalWallLoss (b1) + HeightLoss (b1);
204
              NS_LOG_INFO (this << " 0-I (<1000) ITUR1411 + BEL : " << loss);
204
              NS_LOG_INFO (this << " 0-I (<1000) ITUR1411 + BEL : " << loss);
205
            }
205
            }
206
        } // end b1->isIndoor ()
206
        } // end b1->isIndoor ()
 Lines 213-226    Link Here 
213
          if (a1->GetBuilding () == b1->GetBuilding ())
213
          if (a1->GetBuilding () == b1->GetBuilding ())
214
            {
214
            {
215
              // nodes are in same building -> indoor communication ITU-R P.1238
215
              // nodes are in same building -> indoor communication ITU-R P.1238
216
              loss = ItuR1238 (a, b) + InternalWallsLoss (a1, b1);;
216
              loss = ItuR1238 (a, b, frequency) + InternalWallsLoss (a1, b1);;
217
              NS_LOG_INFO (this << " I-I (same building) ITUR1238 : " << loss);
217
              NS_LOG_INFO (this << " I-I (same building) ITUR1238 : " << loss);
218
218
219
            }
219
            }
220
          else
220
          else
221
            {
221
            {
222
              // nodes are in different buildings
222
              // nodes are in different buildings
223
              loss = ItuR1411 (a, b) + ExternalWallLoss (a1) + ExternalWallLoss (b1);
223
              loss = ItuR1411 (a, b, frequency) + ExternalWallLoss (a1) + ExternalWallLoss (b1);
224
              NS_LOG_INFO (this << " I-I (different) ITUR1238 + 2*BEL : " << loss);
224
              NS_LOG_INFO (this << " I-I (different) ITUR1238 + 2*BEL : " << loss);
225
            }
225
            }
226
        }
226
        }
 Lines 232-250    Link Here 
232
              if ((a->GetPosition ().z < m_rooftopHeight)
232
              if ((a->GetPosition ().z < m_rooftopHeight)
233
                  && (b->GetPosition ().z < m_rooftopHeight))
233
                  && (b->GetPosition ().z < m_rooftopHeight))
234
                {
234
                {
235
                  loss = ItuR1411 (a, b) + ExternalWallLoss (a1) + HeightLoss (a1);
235
                  loss = ItuR1411 (a, b, frequency) + ExternalWallLoss (a1) + HeightLoss (a1);
236
                  NS_LOG_INFO (this << " I-O (>1000): down rooftop -> ITUR1411 : " << loss);
236
                  NS_LOG_INFO (this << " I-O (>1000): down rooftop -> ITUR1411 : " << loss);
237
                }
237
                }
238
              else
238
              else
239
                {
239
                {
240
                  // above rooftop -> OH
240
                  // above rooftop -> OH
241
                  loss = OkumuraHata (a, b) + ExternalWallLoss (a1) + HeightLoss (a1);
241
                  loss = OkumuraHata (a, b, frequency) + ExternalWallLoss (a1) + HeightLoss (a1);
242
                  NS_LOG_INFO (this << " =I-O (>1000) over rooftop OH + BEL + HG: " << loss);
242
                  NS_LOG_INFO (this << " =I-O (>1000) over rooftop OH + BEL + HG: " << loss);
243
                }
243
                }
244
            }
244
            }
245
          else
245
          else
246
            {
246
            {
247
              loss = ItuR1411 (a, b) + ExternalWallLoss (a1)  + HeightLoss (a1);
247
              loss = ItuR1411 (a, b, frequency) + ExternalWallLoss (a1)  + HeightLoss (a1);
248
              NS_LOG_INFO (this << " I-O (<1000)  ITUR1411 + BEL + HG: " << loss);
248
              NS_LOG_INFO (this << " I-O (<1000)  ITUR1411 + BEL + HG: " << loss);
249
            }
249
            }
250
        } // end b1->IsIndoor ()
250
        } // end b1->IsIndoor ()
 Lines 257-267    Link Here 
257
257
258
258
259
double
259
double
260
HybridBuildingsPropagationLossModel::OkumuraHata (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
260
HybridBuildingsPropagationLossModel::OkumuraHata (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const
261
{
261
{
262
  if (m_frequency <= 2.3e9)
262
  if (m_frequency <= 2.3e9)
263
    {
263
    {
264
      return m_okumuraHata->GetLoss (a, b);
264
      return m_okumuraHata->GetLoss (a, b, frequency);
265
    }
265
    }
266
  else
266
  else
267
    {
267
    {
 Lines 270-291    Link Here 
270
}
270
}
271
271
272
double
272
double
273
HybridBuildingsPropagationLossModel::ItuR1411 (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
273
HybridBuildingsPropagationLossModel::ItuR1411 (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const
274
{
274
{
275
  if (a->GetDistanceFrom (b) < m_itu1411NlosThreshold)
275
  if (a->GetDistanceFrom (b) < m_itu1411NlosThreshold)
276
    {
276
    {
277
      return (m_ituR1411Los->GetLoss (a, b));
277
      return (m_ituR1411Los->GetLoss (a, b, frequency));
278
    }
278
    }
279
  else
279
  else
280
    {
280
    {
281
      return (m_ituR1411NlosOverRooftop->GetLoss (a, b));
281
      return (m_ituR1411NlosOverRooftop->GetLoss (a, b, frequency));
282
    }
282
    }
283
}
283
}
284
284
285
double
285
double
286
HybridBuildingsPropagationLossModel::ItuR1238 (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
286
HybridBuildingsPropagationLossModel::ItuR1238 (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const
287
{
287
{
288
  return m_ituR1238->GetLoss (a,b);
288
  return m_ituR1238->GetLoss (a, b, frequency);
289
}
289
}
290
290
291
291
(-)a/src/buildings/model/hybrid-buildings-propagation-loss-model.h (-4 / +5 lines)
 Lines 93-108    Link Here 
93
  /**
93
  /**
94
   * \param a the mobility model of the source
94
   * \param a the mobility model of the source
95
   * \param b the mobility model of the destination
95
   * \param b the mobility model of the destination
96
   * \param frequency the carrier frequency
96
   * \returns the propagation loss (in dBm)
97
   * \returns the propagation loss (in dBm)
97
   */
98
   */
98
  virtual double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
99
  virtual double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
99
100
100
  
101
  
101
private:
102
private:
102
103
103
  double OkumuraHata (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
104
  double OkumuraHata (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
104
  double ItuR1411 (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
105
  double ItuR1411 (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
105
  double ItuR1238 (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
106
  double ItuR1238 (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
106
107
107
  Ptr<OkumuraHataPropagationLossModel> m_okumuraHata;
108
  Ptr<OkumuraHataPropagationLossModel> m_okumuraHata;
108
  Ptr<ItuR1411LosPropagationLossModel> m_ituR1411Los;
109
  Ptr<ItuR1411LosPropagationLossModel> m_ituR1411Los;
(-)a/src/buildings/model/itu-r-1238-propagation-loss-model.cc (-3 / +13 lines)
 Lines 53-59    Link Here 
53
}
53
}
54
54
55
double
55
double
56
ItuR1238PropagationLossModel::GetLoss (Ptr<MobilityModel> a1, Ptr<MobilityModel> b1) const
56
ItuR1238PropagationLossModel::GetLoss (Ptr<MobilityModel> a1, Ptr<MobilityModel> b1, double frequency) const
57
{
57
{
58
  NS_LOG_FUNCTION (this << a1 << b1);
58
  NS_LOG_FUNCTION (this << a1 << b1);
59
  Ptr<MobilityBuildingInfo> a = a1->GetObject<MobilityBuildingInfo> ();
59
  Ptr<MobilityBuildingInfo> a = a1->GetObject<MobilityBuildingInfo> ();
 Lines 96-102    Link Here 
96
    {
96
    {
97
      NS_LOG_ERROR (this << " Unkwnon Wall Type");
97
      NS_LOG_ERROR (this << " Unkwnon Wall Type");
98
    }
98
    }
99
  double loss = 20 * std::log10 (m_frequency / 1e6 /*MHz*/) + N * std::log10 (a1->GetDistanceFrom (b1)) + Lf - 28.0;
99
  double loss = 20 * std::log10 (frequency / 1e6 /*MHz*/) + N * std::log10 (a1->GetDistanceFrom (b1)) + Lf - 28.0;
100
  NS_LOG_INFO (this << " Node " << a1->GetPosition () << " <-> " << b1->GetPosition () << " loss = " << loss << " dB");
100
  NS_LOG_INFO (this << " Node " << a1->GetPosition () << " <-> " << b1->GetPosition () << " loss = " << loss << " dB");
101
101
102
  return loss;
102
  return loss;
 Lines 106-114    Link Here 
106
double 
106
double 
107
ItuR1238PropagationLossModel::DoCalcRxPower (double txPowerDbm,
107
ItuR1238PropagationLossModel::DoCalcRxPower (double txPowerDbm,
108
						Ptr<MobilityModel> a,
108
						Ptr<MobilityModel> a,
109
						Ptr<MobilityModel> b,
110
            double frequency) const
111
{
112
  return (txPowerDbm - GetLoss (a, b, frequency));
113
}
114
115
116
double 
117
ItuR1238PropagationLossModel::DoCalcRxPower (double txPowerDbm,
118
						Ptr<MobilityModel> a,
109
						Ptr<MobilityModel> b) const
119
						Ptr<MobilityModel> b) const
110
{
120
{
111
  return (txPowerDbm - GetLoss (a, b));
121
  return (txPowerDbm - GetLoss (a, b, m_frequency));
112
}
122
}
113
123
114
124
(-)a/src/buildings/model/itu-r-1238-propagation-loss-model.h (-1 / +6 lines)
 Lines 45-61    Link Here 
45
   * 
45
   * 
46
   * \param a the first mobility model
46
   * \param a the first mobility model
47
   * \param b the second mobility model
47
   * \param b the second mobility model
48
   * \param frequency the carrier frequency
48
   * 
49
   * 
49
   * \return the loss in dBm for the propagation between
50
   * \return the loss in dBm for the propagation between
50
   * the two given mobility models
51
   * the two given mobility models
51
   */
52
   */
52
  double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
53
  double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequnecy) const;
53
54
54
private:
55
private:
55
56
56
  // inherited from PropagationLossModel
57
  // inherited from PropagationLossModel
57
  virtual double DoCalcRxPower (double txPowerDbm,
58
  virtual double DoCalcRxPower (double txPowerDbm,
58
                                Ptr<MobilityModel> a,
59
                                Ptr<MobilityModel> a,
60
                                Ptr<MobilityModel> b,
61
                                double frequency) const;
62
  virtual double DoCalcRxPower (double txPowerDbm,
63
                                Ptr<MobilityModel> a,
59
                                Ptr<MobilityModel> b) const;
64
                                Ptr<MobilityModel> b) const;
60
  virtual int64_t DoAssignStreams (int64_t stream);
65
  virtual int64_t DoAssignStreams (int64_t stream);
61
  
66
  
(-)a/src/buildings/model/oh-buildings-propagation-loss-model.cc (-6 / +6 lines)
 Lines 63-69    Link Here 
63
63
64
64
65
double
65
double
66
OhBuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
66
OhBuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const
67
{
67
{
68
  NS_LOG_FUNCTION (this << a << b);
68
  NS_LOG_FUNCTION (this << a << b);
69
69
 Lines 78-90    Link Here 
78
    {
78
    {
79
      if (b1->IsOutdoor ())
79
      if (b1->IsOutdoor ())
80
        {
80
        {
81
          loss = m_okumuraHata->GetLoss (a, b);
81
          loss = m_okumuraHata->GetLoss (a, b, frequency);
82
          NS_LOG_INFO (this << " O-O : " << loss);
82
          NS_LOG_INFO (this << " O-O : " << loss);
83
        }
83
        }
84
      else
84
      else
85
        {
85
        {
86
          // b indoor
86
          // b indoor
87
          loss = m_okumuraHata->GetLoss (a, b) + ExternalWallLoss (b1);
87
          loss = m_okumuraHata->GetLoss (a, b, frequency) + ExternalWallLoss (b1);
88
          NS_LOG_INFO (this << " O-I : " << loss);
88
          NS_LOG_INFO (this << " O-I : " << loss);
89
        } // end b1->isIndoor ()
89
        } // end b1->isIndoor ()
90
    }
90
    }
 Lines 96-115    Link Here 
96
          if (a1->GetBuilding () == b1->GetBuilding ())
96
          if (a1->GetBuilding () == b1->GetBuilding ())
97
            {
97
            {
98
              // nodes are in same building -> indoor communication ITU-R P.1238
98
              // nodes are in same building -> indoor communication ITU-R P.1238
99
              loss = m_okumuraHata->GetLoss (a, b) + InternalWallsLoss (a1, b1);;
99
              loss = m_okumuraHata->GetLoss (a, b, frequency) + InternalWallsLoss (a1, b1);;
100
              NS_LOG_INFO (this << " I-I (same building)" << loss);
100
              NS_LOG_INFO (this << " I-I (same building)" << loss);
101
101
102
            }
102
            }
103
          else
103
          else
104
            {
104
            {
105
              // nodes are in different buildings
105
              // nodes are in different buildings
106
              loss = m_okumuraHata->GetLoss (a, b) + ExternalWallLoss (a1) + ExternalWallLoss (b1);
106
              loss = m_okumuraHata->GetLoss (a, b, frequency) + ExternalWallLoss (a1) + ExternalWallLoss (b1);
107
              NS_LOG_INFO (this << " I-O-I (different buildings): " << loss);
107
              NS_LOG_INFO (this << " I-O-I (different buildings): " << loss);
108
            }
108
            }
109
        }
109
        }
110
      else
110
      else
111
        {
111
        {
112
          loss = m_okumuraHata->GetLoss (a, b) + ExternalWallLoss (a1);
112
          loss = m_okumuraHata->GetLoss (a, b, frequency) + ExternalWallLoss (a1);
113
          NS_LOG_INFO (this << " I-O : " << loss);
113
          NS_LOG_INFO (this << " I-O : " << loss);
114
        } // end b1->IsIndoor ()
114
        } // end b1->IsIndoor ()
115
    } // end a1->IsOutdoor ()
115
    } // end a1->IsOutdoor ()
(-)a/src/buildings/model/oh-buildings-propagation-loss-model.h (-1 / +2 lines)
 Lines 47-55    Link Here 
47
  /**
47
  /**
48
   * \param a the mobility model of the source
48
   * \param a the mobility model of the source
49
   * \param b the mobility model of the destination
49
   * \param b the mobility model of the destination
50
   * \param frequency the carrier frequency
50
   * \returns the propagation loss (in dBm)
51
   * \returns the propagation loss (in dBm)
51
   */
52
   */
52
  virtual double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
53
  virtual double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
53
  
54
  
54
private:
55
private:
55
56
(-)a/src/buildings/test/buildings-pathloss-test.cc (-1 / +1 lines)
 Lines 175-181    Link Here 
175
  propagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0));
175
  propagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0));
176
  propagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0));
176
  propagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0));
177
177
178
  double loss = propagationLossModel->GetLoss (mma, mmb);
178
  double loss = propagationLossModel->GetLoss (mma, mmb, 0.0);
179
179
180
  NS_LOG_INFO ("Calculated loss: " << loss);
180
  NS_LOG_INFO ("Calculated loss: " << loss);
181
  NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
181
  NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
(-)a/src/buildings/test/buildings-shadowing-test.cc (-2 / +2 lines)
 Lines 108-115    Link Here 
108
    {
108
    {
109
      Ptr<MobilityModel> mma = CreateMobilityModel (m_mobilityModelIndex1);
109
      Ptr<MobilityModel> mma = CreateMobilityModel (m_mobilityModelIndex1);
110
      Ptr<MobilityModel> mmb = CreateMobilityModel (m_mobilityModelIndex2);
110
      Ptr<MobilityModel> mmb = CreateMobilityModel (m_mobilityModelIndex2);
111
      double shadowingLoss = propagationLossModel->DoCalcRxPower (0.0, mma, mmb) + m_lossRef;
111
      double shadowingLoss = propagationLossModel->DoCalcRxPower (0.0, mma, mmb, 0.0) + m_lossRef;
112
      double shadowingLoss2 = propagationLossModel->DoCalcRxPower (0.0, mma, mmb) + m_lossRef;
112
      double shadowingLoss2 = propagationLossModel->DoCalcRxPower (0.0, mma, mmb, 0.0) + m_lossRef;
113
      NS_TEST_ASSERT_MSG_EQ_TOL (shadowingLoss, shadowingLoss2, 0.001, 
113
      NS_TEST_ASSERT_MSG_EQ_TOL (shadowingLoss, shadowingLoss2, 0.001, 
114
                                 "Shadowing is not constant for the same mobility model pair!");
114
                                 "Shadowing is not constant for the same mobility model pair!");
115
      loss.push_back (shadowingLoss);
115
      loss.push_back (shadowingLoss);
(-)a/src/propagation/model/cost231-propagation-loss-model.cc (-14 / +20 lines)
 Lines 43-49    Link Here 
43
    .AddAttribute ("Lambda",
43
    .AddAttribute ("Lambda",
44
                   "The wavelength  (default is 2.3 GHz at 300 000 km/s).",
44
                   "The wavelength  (default is 2.3 GHz at 300 000 km/s).",
45
                   DoubleValue (300000000.0 / 2.3e9),
45
                   DoubleValue (300000000.0 / 2.3e9),
46
                   MakeDoubleAccessor (&Cost231PropagationLossModel::m_lambda),
46
                   MakeDoubleAccessor (static_cast<void (ns3::Cost231PropagationLossModel::*)(double)>(&Cost231PropagationLossModel::SetLambda),
47
                                       &Cost231PropagationLossModel::GetLambda),
47
                   MakeDoubleChecker<double> ())
48
                   MakeDoubleChecker<double> ())
48
    .AddAttribute ("Frequency",
49
    .AddAttribute ("Frequency",
49
                   "The Frequency  (default is 2.3 GHz).",
50
                   "The Frequency  (default is 2.3 GHz).",
 Lines 73-85    Link Here 
73
  m_shadowing = 10;
74
  m_shadowing = 10;
74
}
75
}
75
76
76
void
77
Cost231PropagationLossModel::SetLambda (double frequency, double speed)
78
{
79
  m_lambda = speed / frequency;
80
  m_frequency = frequency;
81
}
82
83
double
77
double
84
Cost231PropagationLossModel::GetShadowing (void)
78
Cost231PropagationLossModel::GetShadowing (void)
85
{
79
{
 Lines 94-107    Link Here 
94
void
88
void
95
Cost231PropagationLossModel::SetLambda (double lambda)
89
Cost231PropagationLossModel::SetLambda (double lambda)
96
{
90
{
97
  m_lambda = lambda;
98
  m_frequency = 300000000 / lambda;
91
  m_frequency = 300000000 / lambda;
99
}
92
}
100
93
101
double
94
double
102
Cost231PropagationLossModel::GetLambda (void) const
95
Cost231PropagationLossModel::GetLambda (void) const
103
{
96
{
104
  return m_lambda;
97
  return 300000000 / m_frequency;
105
}
98
}
106
99
107
void
100
void
 Lines 140-146    Link Here 
140
}
133
}
141
134
142
double
135
double
143
Cost231PropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
136
Cost231PropagationLossModel::GetLoss (Ptr<MobilityModel> a,
137
                                      Ptr<MobilityModel> b,
138
                                      double frequency) const
144
{
139
{
145
140
146
  double distance = a->GetDistanceFrom (b);
141
  double distance = a->GetDistanceFrom (b);
 Lines 149-155    Link Here 
149
      return 0.0;
144
      return 0.0;
150
    }
145
    }
151
146
152
  double frequency_MHz = m_frequency * 1e-6;
147
  double frequency_MHz = frequency * 1e-6;
153
148
154
  double distance_km = distance * 1e-3;
149
  double distance_km = distance * 1e-3;
155
150
 Lines 169-177    Link Here 
169
}
164
}
170
165
171
double
166
double
172
Cost231PropagationLossModel::DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
167
Cost231PropagationLossModel::DoCalcRxPower (double txPowerDbm,
168
                                            Ptr<MobilityModel> a,
169
                                            Ptr<MobilityModel> b,
170
                                            double frequency) const
173
{
171
{
174
  return txPowerDbm + GetLoss (a, b);
172
  return txPowerDbm + GetLoss (a, b, frequency);
173
}
174
175
double
176
Cost231PropagationLossModel::DoCalcRxPower (double txPowerDbm,
177
                                            Ptr<MobilityModel> a,
178
                                            Ptr<MobilityModel> b) const
179
{
180
  return txPowerDbm + GetLoss (a, b, m_frequency);
175
}
181
}
176
182
177
int64_t
183
int64_t
(-)a/src/propagation/model/cost231-propagation-loss-model.h (-8 / +3 lines)
 Lines 62-70    Link Here 
62
   * Get the propagation loss
62
   * Get the propagation loss
63
   * \param a the mobility model of the source
63
   * \param a the mobility model of the source
64
   * \param b the mobility model of the destination
64
   * \param b the mobility model of the destination
65
   * \param frequency the carrier frequency
65
   * \returns the propagation loss (in dBm)
66
   * \returns the propagation loss (in dBm)
66
   */
67
   */
67
  double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
68
  double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
68
69
69
  /**
70
  /**
70
   * Set the BS antenna height
71
   * Set the BS antenna height
 Lines 83-94    Link Here 
83
   */
84
   */
84
  void SetLambda (double lambda);
85
  void SetLambda (double lambda);
85
  /**
86
  /**
86
   * Set the wavelength
87
   * \param frequency the signal frequency [Hz]
88
   * \param speed the signal speed [m/s]
89
   */
90
  void SetLambda (double frequency, double speed);
91
  /**
92
   * Set the minimum model distance
87
   * Set the minimum model distance
93
   * \param minDistance the minimum model distance
88
   * \param minDistance the minimum model distance
94
   */
89
   */
 Lines 138-148    Link Here 
138
   */
133
   */
139
  Cost231PropagationLossModel & operator = (const Cost231PropagationLossModel &);
134
  Cost231PropagationLossModel & operator = (const Cost231PropagationLossModel &);
140
135
136
  virtual double DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
141
  virtual double DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
137
  virtual double DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
142
  virtual int64_t DoAssignStreams (int64_t stream);
138
  virtual int64_t DoAssignStreams (int64_t stream);
143
  double m_BSAntennaHeight; //!< BS Antenna Height [m]
139
  double m_BSAntennaHeight; //!< BS Antenna Height [m]
144
  double m_SSAntennaHeight; //!< SS Antenna Height [m]
140
  double m_SSAntennaHeight; //!< SS Antenna Height [m]
145
  double m_lambda; //!< The wavelength
146
  double m_minDistance; //!< minimum distance [m]
141
  double m_minDistance; //!< minimum distance [m]
147
  double m_frequency; //!< frequency [Hz]
142
  double m_frequency; //!< frequency [Hz]
148
  double m_shadowing; //!< Shadowing loss [dB]
143
  double m_shadowing; //!< Shadowing loss [dB]
(-)a/src/propagation/model/itu-r-1411-los-propagation-loss-model.cc (-8 / +19 lines)
 Lines 59-74    Link Here 
59
}
59
}
60
60
61
double
61
double
62
ItuR1411LosPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
62
ItuR1411LosPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b,
63
                                          double frequency) const
63
{
64
{
64
  NS_LOG_FUNCTION (this);
65
  NS_LOG_FUNCTION (this);
66
  double lambda = 299792458.0 / frequency;
65
  double dist = a->GetDistanceFrom (b);
67
  double dist = a->GetDistanceFrom (b);
66
  double lossLow = 0.0;
68
  double lossLow = 0.0;
67
  double lossUp = 0.0;
69
  double lossUp = 0.0;
68
  NS_ASSERT_MSG (a->GetPosition ().z > 0 && b->GetPosition ().z > 0, "nodes' height must be greater than 0");
70
  NS_ASSERT_MSG (a->GetPosition ().z > 0 && b->GetPosition ().z > 0, "nodes' height must be greater than 0");
69
  double Lbp = std::fabs (20 * std::log10 ((m_lambda * m_lambda) / (8 * M_PI * a->GetPosition ().z * b->GetPosition ().z)));
71
  double Lbp = std::fabs (20 * std::log10 ((lambda * lambda) / (8 * M_PI * a->GetPosition ().z * b->GetPosition ().z)));
70
  double Rbp = (4 * a->GetPosition ().z * b->GetPosition ().z) / m_lambda;
72
  double Rbp = (4 * a->GetPosition ().z * b->GetPosition ().z) / lambda;
71
  NS_LOG_LOGIC (this << " Lbp " << Lbp << " Rbp " << Rbp << " lambda " << m_lambda);
73
  NS_LOG_LOGIC (this << " Lbp " << Lbp << " Rbp " << Rbp << " lambda " << lambda);
72
  if (dist <= Rbp)
74
  if (dist <= Rbp)
73
    {
75
    {
74
      lossLow = Lbp + 20 * std::log10 (dist / Rbp);
76
      lossLow = Lbp + 20 * std::log10 (dist / Rbp);
 Lines 90-105    Link Here 
90
ItuR1411LosPropagationLossModel::SetFrequency (double freq)
92
ItuR1411LosPropagationLossModel::SetFrequency (double freq)
91
{
93
{
92
  NS_ASSERT (freq > 0.0);
94
  NS_ASSERT (freq > 0.0);
93
  m_lambda = 299792458.0 / freq;
95
  m_frequency = freq;
94
}
96
}
95
97
96
98
97
double 
99
double 
98
ItuR1411LosPropagationLossModel::DoCalcRxPower (double txPowerDbm,
100
ItuR1411LosPropagationLossModel::DoCalcRxPower (double txPowerDbm,
99
						Ptr<MobilityModel> a,
101
                                                Ptr<MobilityModel> a,
100
						Ptr<MobilityModel> b) const
102
                                                Ptr<MobilityModel> b,
103
                                                double frequency) const
101
{
104
{
102
  return (txPowerDbm - GetLoss (a, b));
105
  return txPowerDbm - GetLoss (a, b, frequency);
106
}
107
108
double 
109
ItuR1411LosPropagationLossModel::DoCalcRxPower (double txPowerDbm,
110
                                                Ptr<MobilityModel> a,
111
                                                Ptr<MobilityModel> b) const
112
{
113
  return txPowerDbm - GetLoss (a, b, m_frequency);
103
}
114
}
104
115
105
int64_t
116
int64_t
(-)a/src/propagation/model/itu-r-1411-los-propagation-loss-model.h (-2 / +7 lines)
 Lines 65-75    Link Here 
65
   * 
65
   * 
66
   * \param a the first mobility model
66
   * \param a the first mobility model
67
   * \param b the second mobility model
67
   * \param b the second mobility model
68
   * \param frequency the carrier frequency
68
   * 
69
   * 
69
   * \return the loss in dBm for the propagation between
70
   * \return the loss in dBm for the propagation between
70
   * the two given mobility models
71
   * the two given mobility models
71
   */
72
   */
72
  double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
73
  double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
73
74
74
private:
75
private:
75
  /**
76
  /**
 Lines 88-97    Link Here 
88
89
89
  virtual double DoCalcRxPower (double txPowerDbm,
90
  virtual double DoCalcRxPower (double txPowerDbm,
90
                                Ptr<MobilityModel> a,
91
                                Ptr<MobilityModel> a,
92
                                Ptr<MobilityModel> b,
93
                                double frequency) const;
94
  virtual double DoCalcRxPower (double txPowerDbm,
95
                                Ptr<MobilityModel> a,
91
                                Ptr<MobilityModel> b) const;
96
                                Ptr<MobilityModel> b) const;
92
  virtual int64_t DoAssignStreams (int64_t stream);
97
  virtual int64_t DoAssignStreams (int64_t stream);
93
  
98
  
94
  double m_lambda; //!< wavelength
99
  double m_frequency; //!< frequency in Hz
95
};
100
};
96
101
97
} // namespace ns3
102
} // namespace ns3
(-)a/src/propagation/model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc (-11 / +21 lines)
 Lines 99-109    Link Here 
99
}
99
}
100
100
101
double
101
double
102
ItuR1411NlosOverRooftopPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
102
ItuR1411NlosOverRooftopPropagationLossModel::GetLoss (Ptr<MobilityModel> a,
103
                                                      Ptr<MobilityModel> b,
104
                                                      double frequency) const
103
{
105
{
104
  NS_LOG_FUNCTION (this << a << b);
106
  NS_LOG_FUNCTION (this << a << b);
105
  double Lori = 0.0;
107
  double Lori = 0.0;
106
  double fmhz = m_frequency / 1e6;
108
  double fmhz = frequency / 1e6;
109
  double lambda = 299792458.0 / frequency;
107
110
108
  NS_ASSERT_MSG (((m_streetsOrientation >= 0) && (m_streetsOrientation <= 90)),
111
  NS_ASSERT_MSG (((m_streetsOrientation >= 0) && (m_streetsOrientation <= 90)),
109
                 " Street Orientation must be in [0,90]");
112
                 " Street Orientation must be in [0,90]");
 Lines 125-133    Link Here 
125
  double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z);
128
  double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z);
126
  NS_ASSERT_MSG (hm > 0 && hb > 0, "nodes' height must be greater then 0");
129
  NS_ASSERT_MSG (hm > 0 && hb > 0, "nodes' height must be greater then 0");
127
  double Dhb = hb - m_rooftopHeight;
130
  double Dhb = hb - m_rooftopHeight;
128
  double ds = (m_lambda * distance * distance) / (Dhb * Dhb);
131
  double ds = (distance * distance) / (Dhb * Dhb);
129
  double Lmsd = 0.0;
132
  double Lmsd = 0.0;
130
  NS_LOG_LOGIC (this << " build " << m_buildingsExtend << " ds " << ds << " roof " << m_rooftopHeight << " hb " << hb << " lambda " << m_lambda);
133
  NS_LOG_LOGIC (this << " build " << m_buildingsExtend << " ds " << ds << " roof " << m_rooftopHeight << " hb " << hb << " lambda " << lambda);
131
  if (ds < m_buildingsExtend)
134
  if (ds < m_buildingsExtend)
132
    {
135
    {
133
      double Lbsh = 0.0;
136
      double Lbsh = 0.0;
 Lines 179-189    Link Here 
179
        }
182
        }
180
      else if (hb > m_rooftopHeight)
183
      else if (hb > m_rooftopHeight)
181
        {
184
        {
182
          Qm = 2.35 * pow (Dhb / distance * std::sqrt (m_buildingSeparation / m_lambda), 0.9);
185
          Qm = 2.35 * pow (Dhb / distance * std::sqrt (m_buildingSeparation / lambda), 0.9);
183
        }
186
        }
184
      else
187
      else
185
        {
188
        {
186
          Qm = m_buildingSeparation / (2 * M_PI * distance) * std::sqrt (m_lambda / rho) * (1 / theta - (1 / (2 * M_PI + theta)));
189
          Qm = m_buildingSeparation / (2 * M_PI * distance) * std::sqrt (lambda / rho) * (1 / theta - (1 / (2 * M_PI + theta)));
187
        }
190
        }
188
      Lmsd = -10 * std::log10 (Qm * Qm);
191
      Lmsd = -10 * std::log10 (Qm * Qm);
189
    }
192
    }
 Lines 208-223    Link Here 
208
ItuR1411NlosOverRooftopPropagationLossModel::SetFrequency (double freq)
211
ItuR1411NlosOverRooftopPropagationLossModel::SetFrequency (double freq)
209
{
212
{
210
  m_frequency = freq;
213
  m_frequency = freq;
211
  m_lambda = 299792458.0 / freq;
212
}
214
}
213
215
214
215
double 
216
double 
216
ItuR1411NlosOverRooftopPropagationLossModel::DoCalcRxPower (double txPowerDbm,
217
ItuR1411NlosOverRooftopPropagationLossModel::DoCalcRxPower (double txPowerDbm,
217
						Ptr<MobilityModel> a,
218
                                                            Ptr<MobilityModel> a,
218
						Ptr<MobilityModel> b) const
219
                                                            Ptr<MobilityModel> b,
220
                                                            double frequency) const
219
{
221
{
220
  return (txPowerDbm - GetLoss (a, b));
222
  return txPowerDbm - GetLoss (a, b, frequency);
223
}
224
225
double 
226
ItuR1411NlosOverRooftopPropagationLossModel::DoCalcRxPower (double txPowerDbm,
227
                                                            Ptr<MobilityModel> a,
228
                                                            Ptr<MobilityModel> b) const
229
{
230
  return txPowerDbm - GetLoss (a, b, m_frequency);
221
}
231
}
222
232
223
int64_t
233
int64_t
(-)a/src/propagation/model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.h (-3 / +7 lines)
 Lines 65-75    Link Here 
65
   * 
65
   * 
66
   * \param a the first mobility model
66
   * \param a the first mobility model
67
   * \param b the second mobility model
67
   * \param b the second mobility model
68
   * \param frequency the carrier frequency
68
   * 
69
   * 
69
   * \return the loss in dBm for the propagation between
70
   * \return the loss in dBm for the propagation between
70
   * the two given mobility models
71
   * the two given mobility models
71
   */
72
   */
72
  double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
73
  double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
73
74
74
private:
75
private:
75
  /**
76
  /**
 Lines 88-98    Link Here 
88
89
89
  virtual double DoCalcRxPower (double txPowerDbm,
90
  virtual double DoCalcRxPower (double txPowerDbm,
90
                                Ptr<MobilityModel> a,
91
                                Ptr<MobilityModel> a,
92
                                Ptr<MobilityModel> b,
93
                                double frequency) const;
94
  virtual double DoCalcRxPower (double txPowerDbm,
95
                                Ptr<MobilityModel> a,
91
                                Ptr<MobilityModel> b) const;
96
                                Ptr<MobilityModel> b) const;
92
  virtual int64_t DoAssignStreams (int64_t stream);
97
  virtual int64_t DoAssignStreams (int64_t stream);
93
  
98
  
94
  double m_frequency; //!< frequency in MHz
99
  double m_frequency; //!< frequency in Hz
95
  double m_lambda; //!< wavelength
96
  EnvironmentType m_environment; //!< Environment Scenario
100
  EnvironmentType m_environment; //!< Environment Scenario
97
  CitySize m_citySize; //!< Dimension of the city
101
  CitySize m_citySize; //!< Dimension of the city
98
  double m_rooftopHeight; //!< in meters
102
  double m_rooftopHeight; //!< in meters
(-)a/src/propagation/model/jakes-propagation-loss-model.cc (-1 / +2 lines)
 Lines 54-60    Link Here 
54
double
54
double
55
JakesPropagationLossModel::DoCalcRxPower (double txPowerDbm,
55
JakesPropagationLossModel::DoCalcRxPower (double txPowerDbm,
56
                                          Ptr<MobilityModel> a,
56
                                          Ptr<MobilityModel> a,
57
                                          Ptr<MobilityModel> b) const
57
                                          Ptr<MobilityModel> b,
58
                                          double frequency) const
58
{
59
{
59
  Ptr<JakesProcess> pathData = m_propagationCache.GetPathData (a, b, 0 /**Spectrum model uid is not used in PropagationLossModel*/);
60
  Ptr<JakesProcess> pathData = m_propagationCache.GetPathData (a, b, 0 /**Spectrum model uid is not used in PropagationLossModel*/);
60
  if (pathData == 0)
61
  if (pathData == 0)
(-)a/src/propagation/model/jakes-propagation-loss-model.h (-1 / +2 lines)
 Lines 62-68    Link Here 
62
  JakesPropagationLossModel & operator = (const JakesPropagationLossModel &);
62
  JakesPropagationLossModel & operator = (const JakesPropagationLossModel &);
63
  double DoCalcRxPower (double txPowerDbm,
63
  double DoCalcRxPower (double txPowerDbm,
64
                        Ptr<MobilityModel> a,
64
                        Ptr<MobilityModel> a,
65
                        Ptr<MobilityModel> b) const;
65
                        Ptr<MobilityModel> b,
66
                        double frequency) const;
66
  virtual int64_t DoAssignStreams (int64_t stream);
67
  virtual int64_t DoAssignStreams (int64_t stream);
67
68
68
  /**
69
  /**
(-)a/src/propagation/model/kun-2600-mhz-propagation-loss-model.cc (-2 / +3 lines)
 Lines 65-72    Link Here 
65
65
66
double 
66
double 
67
Kun2600MhzPropagationLossModel::DoCalcRxPower (double txPowerDbm,
67
Kun2600MhzPropagationLossModel::DoCalcRxPower (double txPowerDbm,
68
					       Ptr<MobilityModel> a,
68
                                               Ptr<MobilityModel> a,
69
					       Ptr<MobilityModel> b) const
69
                                               Ptr<MobilityModel> b,
70
                                               double frequency) const
70
{
71
{
71
  return (txPowerDbm - GetLoss (a, b));
72
  return (txPowerDbm - GetLoss (a, b));
72
}
73
}
(-)a/src/propagation/model/kun-2600-mhz-propagation-loss-model.h (-1 / +2 lines)
 Lines 78-84    Link Here 
78
  // inherited from PropagationLossModel
78
  // inherited from PropagationLossModel
79
  virtual double DoCalcRxPower (double txPowerDbm,
79
  virtual double DoCalcRxPower (double txPowerDbm,
80
                                Ptr<MobilityModel> a,
80
                                Ptr<MobilityModel> a,
81
                                Ptr<MobilityModel> b) const;
81
                                Ptr<MobilityModel> b,
82
                                double frequency) const;
82
  virtual int64_t DoAssignStreams (int64_t stream);
83
  virtual int64_t DoAssignStreams (int64_t stream);
83
  
84
  
84
};
85
};
(-)a/src/propagation/model/okumura-hata-propagation-loss-model.cc (-6 / +17 lines)
 Lines 73-84    Link Here 
73
}
73
}
74
74
75
double
75
double
76
OkumuraHataPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
76
OkumuraHataPropagationLossModel::GetLoss (Ptr<MobilityModel> a,
77
                                          Ptr<MobilityModel> b,
78
                                          double frequency) const
77
{
79
{
78
  double loss = 0.0;
80
  double loss = 0.0;
79
  double fmhz = m_frequency / 1e6;
81
  double fmhz = frequency / 1e6;
80
  double dist = a->GetDistanceFrom (b) / 1000.0; 
82
  double dist = a->GetDistanceFrom (b) / 1000.0; 
81
  if (m_frequency <= 1.500e9)
83
  if (frequency <= 1.500e9)
82
    {
84
    {
83
      // standard Okumura Hata 
85
      // standard Okumura Hata 
84
      // see eq. (4.4.1) in the COST 231 final report
86
      // see eq. (4.4.1) in the COST 231 final report
 Lines 146-155    Link Here 
146
148
147
double 
149
double 
148
OkumuraHataPropagationLossModel::DoCalcRxPower (double txPowerDbm,
150
OkumuraHataPropagationLossModel::DoCalcRxPower (double txPowerDbm,
149
						Ptr<MobilityModel> a,
151
                                                Ptr<MobilityModel> a,
150
						Ptr<MobilityModel> b) const
152
                                                Ptr<MobilityModel> b,
153
                                                double frequency) const
151
{
154
{
152
  return (txPowerDbm - GetLoss (a, b));
155
  return (txPowerDbm - GetLoss (a, b, frequency));
156
}
157
158
double 
159
OkumuraHataPropagationLossModel::DoCalcRxPower (double txPowerDbm,
160
                                                Ptr<MobilityModel> a,
161
                                                Ptr<MobilityModel> b) const
162
{
163
  return (txPowerDbm - GetLoss (a, b, m_frequency));
153
}
164
}
154
165
155
int64_t
166
int64_t
(-)a/src/propagation/model/okumura-hata-propagation-loss-model.h (-1 / +6 lines)
 Lines 57-67    Link Here 
57
  /** 
57
  /** 
58
   * \param a the first mobility model
58
   * \param a the first mobility model
59
   * \param b the second mobility model
59
   * \param b the second mobility model
60
   * \param frequency the carrier frequency
60
   * 
61
   * 
61
   * \return the loss in dBm for the propagation between
62
   * \return the loss in dBm for the propagation between
62
   * the two given mobility models
63
   * the two given mobility models
63
   */
64
   */
64
  double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
65
  double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double frequency) const;
65
66
66
private:
67
private:
67
  /**
68
  /**
 Lines 80-85    Link Here 
80
81
81
  virtual double DoCalcRxPower (double txPowerDbm,
82
  virtual double DoCalcRxPower (double txPowerDbm,
82
                                Ptr<MobilityModel> a,
83
                                Ptr<MobilityModel> a,
84
                                Ptr<MobilityModel> b,
85
                                double frequency) const;
86
  virtual double DoCalcRxPower (double txPowerDbm,
87
                                Ptr<MobilityModel> a,
83
                                Ptr<MobilityModel> b) const;
88
                                Ptr<MobilityModel> b) const;
84
  virtual int64_t DoAssignStreams (int64_t stream);
89
  virtual int64_t DoAssignStreams (int64_t stream);
85
  
90
  
(-)a/src/propagation/model/propagation-loss-model.cc (-12 / +75 lines)
 Lines 72-77    Link Here 
72
double
72
double
73
PropagationLossModel::CalcRxPower (double txPowerDbm,
73
PropagationLossModel::CalcRxPower (double txPowerDbm,
74
                                   Ptr<MobilityModel> a,
74
                                   Ptr<MobilityModel> a,
75
                                   Ptr<MobilityModel> b,
76
                                   double frequency) const
77
{
78
  double self = DoCalcRxPower (txPowerDbm, a, b, frequency);
79
  if (m_next != 0)
80
    {
81
      self = m_next->CalcRxPower (self, a, b, frequency);
82
    }
83
  return self;
84
}
85
86
double
87
PropagationLossModel::CalcRxPower (double txPowerDbm,
88
                                   Ptr<MobilityModel> a,
75
                                   Ptr<MobilityModel> b) const
89
                                   Ptr<MobilityModel> b) const
76
{
90
{
77
  double self = DoCalcRxPower (txPowerDbm, a, b);
91
  double self = DoCalcRxPower (txPowerDbm, a, b);
 Lines 94-99    Link Here 
94
  return (currentStream - stream);
108
  return (currentStream - stream);
95
}
109
}
96
110
111
double
112
PropagationLossModel::DoCalcRxPower (double txPowerDbm,
113
                                     Ptr<MobilityModel> a,
114
                                     Ptr<MobilityModel> b) const
115
{
116
  return DoCalcRxPower (txPowerDbm, a, b, 0.0 /* ignored */);
117
}
118
97
// ------------------------------------------------------------------------- //
119
// ------------------------------------------------------------------------- //
98
120
99
NS_OBJECT_ENSURE_REGISTERED (RandomPropagationLossModel);
121
NS_OBJECT_ENSURE_REGISTERED (RandomPropagationLossModel);
 Lines 124-129    Link Here 
124
double
146
double
125
RandomPropagationLossModel::DoCalcRxPower (double txPowerDbm,
147
RandomPropagationLossModel::DoCalcRxPower (double txPowerDbm,
126
                                           Ptr<MobilityModel> a,
148
                                           Ptr<MobilityModel> a,
149
                                           Ptr<MobilityModel> b,
150
                                           double frequency) const
151
{
152
  double rxc = -m_variable->GetValue ();
153
  NS_LOG_DEBUG ("attenuation coefficient="<<rxc<<"Db");
154
  return txPowerDbm + rxc;
155
}
156
157
double
158
RandomPropagationLossModel::DoCalcRxPower (double txPowerDbm,
159
                                           Ptr<MobilityModel> a,
127
                                           Ptr<MobilityModel> b) const
160
                                           Ptr<MobilityModel> b) const
128
{
161
{
129
  double rxc = -m_variable->GetValue ();
162
  double rxc = -m_variable->GetValue ();
 Lines 224-231    Link Here 
224
double 
257
double 
225
FriisPropagationLossModel::DoCalcRxPower (double txPowerDbm,
258
FriisPropagationLossModel::DoCalcRxPower (double txPowerDbm,
226
                                          Ptr<MobilityModel> a,
259
                                          Ptr<MobilityModel> a,
227
                                          Ptr<MobilityModel> b) const
260
                                          Ptr<MobilityModel> b,
261
                                          double frequency) const
228
{
262
{
263
  static const double C = 299792458.0; // speed of light in vacuum
264
  double lambda = C / frequency;
265
229
  /*
266
  /*
230
   * Friis free space equation:
267
   * Friis free space equation:
231
   * where Pt, Gr, Gr and P are in Watt units
268
   * where Pt, Gr, Gr and P are in Watt units
 Lines 256-262    Link Here 
256
   * lambda: wavelength (m)
293
   * lambda: wavelength (m)
257
   */
294
   */
258
  double distance = a->GetDistanceFrom (b);
295
  double distance = a->GetDistanceFrom (b);
259
  if (distance < 3*m_lambda)
296
  if (distance < 3*lambda)
260
    {
297
    {
261
      NS_LOG_WARN ("distance not within the far field region => inaccurate propagation loss value");
298
      NS_LOG_WARN ("distance not within the far field region => inaccurate propagation loss value");
262
    }
299
    }
 Lines 264-276    Link Here 
264
    {
301
    {
265
      return txPowerDbm - m_minLoss;
302
      return txPowerDbm - m_minLoss;
266
    }
303
    }
267
  double numerator = m_lambda * m_lambda;
304
  double numerator = lambda * lambda;
268
  double denominator = 16 * M_PI * M_PI * distance * distance * m_systemLoss;
305
  double denominator = 16 * M_PI * M_PI * distance * distance * m_systemLoss;
269
  double lossDb = -10 * log10 (numerator / denominator);
306
  double lossDb = -10 * log10 (numerator / denominator);
270
  NS_LOG_DEBUG ("distance=" << distance<< "m, loss=" << lossDb <<"dB");
307
  NS_LOG_DEBUG ("distance=" << distance<< "m, loss=" << lossDb <<"dB");
271
  return txPowerDbm - std::max (lossDb, m_minLoss);
308
  return txPowerDbm - std::max (lossDb, m_minLoss);
272
}
309
}
273
310
311
double 
312
FriisPropagationLossModel::DoCalcRxPower (double txPowerDbm,
313
                                          Ptr<MobilityModel> a,
314
                                          Ptr<MobilityModel> b) const
315
{
316
  return DoCalcRxPower (txPowerDbm, a, b, m_frequency);
317
}
318
274
int64_t
319
int64_t
275
FriisPropagationLossModel::DoAssignStreams (int64_t stream)
320
FriisPropagationLossModel::DoAssignStreams (int64_t stream)
276
{
321
{
 Lines 374-381    Link Here 
374
double 
419
double 
375
TwoRayGroundPropagationLossModel::DoCalcRxPower (double txPowerDbm,
420
TwoRayGroundPropagationLossModel::DoCalcRxPower (double txPowerDbm,
376
                                                 Ptr<MobilityModel> a,
421
                                                 Ptr<MobilityModel> a,
377
                                                 Ptr<MobilityModel> b) const
422
                                                 Ptr<MobilityModel> b,
423
                                                 double frequency) const
378
{
424
{
425
  static const double C = 299792458.0; // speed of light in vacuum
426
  double lambda = C / frequency;
427
379
  /*
428
  /*
380
   * Two-Ray Ground equation:
429
   * Two-Ray Ground equation:
381
   *
430
   *
 Lines 419-430    Link Here 
419
   *
468
   *
420
   */
469
   */
421
470
422
  double dCross = (4 * M_PI * txAntHeight * rxAntHeight) / m_lambda;
471
  double dCross = (4 * M_PI * txAntHeight * rxAntHeight) / lambda;
423
  double tmp = 0;
472
  double tmp = 0;
424
  if (distance <= dCross)
473
  if (distance <= dCross)
425
    {
474
    {
426
      // We use Friis
475
      // We use Friis
427
      double numerator = m_lambda * m_lambda;
476
      double numerator = lambda * lambda;
428
      tmp = M_PI * distance;
477
      tmp = M_PI * distance;
429
      double denominator = 16 * tmp * tmp * m_systemLoss;
478
      double denominator = 16 * tmp * tmp * m_systemLoss;
430
      double pr = 10 * std::log10 (numerator / denominator);
479
      double pr = 10 * std::log10 (numerator / denominator);
 Lines 445-450    Link Here 
445
    }
494
    }
446
}
495
}
447
496
497
double 
498
TwoRayGroundPropagationLossModel::DoCalcRxPower (double txPowerDbm,
499
                                                 Ptr<MobilityModel> a,
500
                                                 Ptr<MobilityModel> b) const
501
{
502
  return DoCalcRxPower (txPowerDbm, a, b, m_frequency);
503
}
504
448
int64_t
505
int64_t
449
TwoRayGroundPropagationLossModel::DoAssignStreams (int64_t stream)
506
TwoRayGroundPropagationLossModel::DoAssignStreams (int64_t stream)
450
{
507
{
 Lines 506-512    Link Here 
506
double
563
double
507
LogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm,
564
LogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm,
508
                                                Ptr<MobilityModel> a,
565
                                                Ptr<MobilityModel> a,
509
                                                Ptr<MobilityModel> b) const
566
                                                Ptr<MobilityModel> b,
567
                                                double frequency) const
510
{
568
{
511
  double distance = a->GetDistanceFrom (b);
569
  double distance = a->GetDistanceFrom (b);
512
  if (distance <= m_referenceDistance)
570
  if (distance <= m_referenceDistance)
 Lines 598-604    Link Here 
598
double 
656
double 
599
ThreeLogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm,
657
ThreeLogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm,
600
                                                     Ptr<MobilityModel> a,
658
                                                     Ptr<MobilityModel> a,
601
                                                     Ptr<MobilityModel> b) const
659
                                                     Ptr<MobilityModel> b,
660
                                                     double frequency) const
602
{
661
{
603
  double distance = a->GetDistanceFrom (b);
662
  double distance = a->GetDistanceFrom (b);
604
  NS_ASSERT (distance >= 0);
663
  NS_ASSERT (distance >= 0);
 Lines 700-706    Link Here 
700
double
759
double
701
NakagamiPropagationLossModel::DoCalcRxPower (double txPowerDbm,
760
NakagamiPropagationLossModel::DoCalcRxPower (double txPowerDbm,
702
                                             Ptr<MobilityModel> a,
761
                                             Ptr<MobilityModel> a,
703
                                             Ptr<MobilityModel> b) const
762
                                             Ptr<MobilityModel> b,
763
                                             double frequency) const
704
{
764
{
705
  // select m parameter
765
  // select m parameter
706
766
 Lines 793-799    Link Here 
793
double
853
double
794
FixedRssLossModel::DoCalcRxPower (double txPowerDbm,
854
FixedRssLossModel::DoCalcRxPower (double txPowerDbm,
795
                                  Ptr<MobilityModel> a,
855
                                  Ptr<MobilityModel> a,
796
                                  Ptr<MobilityModel> b) const
856
                                  Ptr<MobilityModel> b,
857
                                  double frequency) const
797
{
858
{
798
  return m_rss;
859
  return m_rss;
799
}
860
}
 Lines 864-870    Link Here 
864
double 
925
double 
865
MatrixPropagationLossModel::DoCalcRxPower (double txPowerDbm,
926
MatrixPropagationLossModel::DoCalcRxPower (double txPowerDbm,
866
                                           Ptr<MobilityModel> a,
927
                                           Ptr<MobilityModel> a,
867
                                           Ptr<MobilityModel> b) const
928
                                           Ptr<MobilityModel> b,
929
                                           double frequency) const
868
{
930
{
869
  std::map<MobilityPair, double>::const_iterator i = m_loss.find (std::make_pair (a, b));
931
  std::map<MobilityPair, double>::const_iterator i = m_loss.find (std::make_pair (a, b));
870
932
 Lines 911-917    Link Here 
911
double
973
double
912
RangePropagationLossModel::DoCalcRxPower (double txPowerDbm,
974
RangePropagationLossModel::DoCalcRxPower (double txPowerDbm,
913
                                          Ptr<MobilityModel> a,
975
                                          Ptr<MobilityModel> a,
914
                                          Ptr<MobilityModel> b) const
976
                                          Ptr<MobilityModel> b,
977
                                          double frequency) const
915
{
978
{
916
  double distance = a->GetDistanceFrom (b);
979
  double distance = a->GetDistanceFrom (b);
917
  if (distance <= m_range)
980
  if (distance <= m_range)
(-)a/src/propagation/model/propagation-loss-model.h (-7 / +61 lines)
 Lines 87-96    Link Here 
87
   * \param txPowerDbm current transmission power (in dBm)
87
   * \param txPowerDbm current transmission power (in dBm)
88
   * \param a the mobility model of the source
88
   * \param a the mobility model of the source
89
   * \param b the mobility model of the destination
89
   * \param b the mobility model of the destination
90
   * \param frequency the carrier frequency
90
   * \returns the reception power after adding/multiplying propagation loss (in dBm)
91
   * \returns the reception power after adding/multiplying propagation loss (in dBm)
91
   */
92
   */
92
  double CalcRxPower (double txPowerDbm,
93
  double CalcRxPower (double txPowerDbm,
93
                      Ptr<MobilityModel> a,
94
                      Ptr<MobilityModel> a,
95
                      Ptr<MobilityModel> b,
96
                      double frequency) const;
97
98
  /**
99
   * Returns the Rx Power taking into account all the PropagationLossModel(s)
100
   * chained to the current one.
101
   *
102
   * \param txPowerDbm current transmission power (in dBm)
103
   * \param a the mobility model of the source
104
   * \param b the mobility model of the destination
105
   * \returns the reception power after adding/multiplying propagation loss (in dBm)
106
   * \deprecated This method will go away in future versions of ns-3.
107
   * See https://www.nsnam.org/bugzilla/show_bug.cgi?id=2122
108
   */
109
  NS_DEPRECATED
110
  double CalcRxPower (double txPowerDbm,
111
                      Ptr<MobilityModel> a,
94
                      Ptr<MobilityModel> b) const;
112
                      Ptr<MobilityModel> b) const;
95
113
96
  /**
114
  /**
 Lines 128-138    Link Here 
128
   * \param txPowerDbm current transmission power (in dBm)
146
   * \param txPowerDbm current transmission power (in dBm)
129
   * \param a the mobility model of the source
147
   * \param a the mobility model of the source
130
   * \param b the mobility model of the destination
148
   * \param b the mobility model of the destination
149
   * \param frequency the carrier frequency
131
   * \returns the reception power after adding/multiplying propagation loss (in dBm)
150
   * \returns the reception power after adding/multiplying propagation loss (in dBm)
132
   */
151
   */
133
  virtual double DoCalcRxPower (double txPowerDbm,
152
  virtual double DoCalcRxPower (double txPowerDbm,
134
                                Ptr<MobilityModel> a,
153
                                Ptr<MobilityModel> a,
135
                                Ptr<MobilityModel> b) const = 0;
154
                                Ptr<MobilityModel> b,
155
                                double frequency) const = 0;
156
157
  /**
158
   * Returns the Rx Power taking into account only the particular
159
   * PropagationLossModel.
160
   *
161
   * \param txPowerDbm current transmission power (in dBm)
162
   * \param a the mobility model of the source
163
   * \param b the mobility model of the destination
164
   * \returns the reception power after adding/multiplying propagation loss (in dBm)
165
   * \deprecated This method will go away in future versions of ns-3.
166
   * See https://www.nsnam.org/bugzilla/show_bug.cgi?id=2122
167
   */
168
  NS_DEPRECATED
169
  virtual double DoCalcRxPower (double txPowerDbm,
170
                                Ptr<MobilityModel> a,
171
                                Ptr<MobilityModel> b) const;
136
172
137
  /**
173
  /**
138
   * Subclasses must implement this; those not using random variables
174
   * Subclasses must implement this; those not using random variables
 Lines 176-181    Link Here 
176
  RandomPropagationLossModel & operator = (const RandomPropagationLossModel &);
212
  RandomPropagationLossModel & operator = (const RandomPropagationLossModel &);
177
  virtual double DoCalcRxPower (double txPowerDbm,
213
  virtual double DoCalcRxPower (double txPowerDbm,
178
                                Ptr<MobilityModel> a,
214
                                Ptr<MobilityModel> a,
215
                                Ptr<MobilityModel> b,
216
                                double frequency) const;
217
  virtual double DoCalcRxPower (double txPowerDbm,
218
                                Ptr<MobilityModel> a,
179
                                Ptr<MobilityModel> b) const;
219
                                Ptr<MobilityModel> b) const;
180
  virtual int64_t DoAssignStreams (int64_t stream);
220
  virtual int64_t DoAssignStreams (int64_t stream);
181
  Ptr<RandomVariableStream> m_variable; //!< random generator
221
  Ptr<RandomVariableStream> m_variable; //!< random generator
 Lines 320-325    Link Here 
320
360
321
  virtual double DoCalcRxPower (double txPowerDbm,
361
  virtual double DoCalcRxPower (double txPowerDbm,
322
                                Ptr<MobilityModel> a,
362
                                Ptr<MobilityModel> a,
363
                                Ptr<MobilityModel> b,
364
                                double frequency) const;
365
  virtual double DoCalcRxPower (double txPowerDbm,
366
                                Ptr<MobilityModel> a,
323
                                Ptr<MobilityModel> b) const;
367
                                Ptr<MobilityModel> b) const;
324
  virtual int64_t DoAssignStreams (int64_t stream);
368
  virtual int64_t DoAssignStreams (int64_t stream);
325
369
 Lines 440-445    Link Here 
440
484
441
  virtual double DoCalcRxPower (double txPowerDbm,
485
  virtual double DoCalcRxPower (double txPowerDbm,
442
                                Ptr<MobilityModel> a,
486
                                Ptr<MobilityModel> a,
487
                                Ptr<MobilityModel> b,
488
                                double frequency) const;
489
  virtual double DoCalcRxPower (double txPowerDbm,
490
                                Ptr<MobilityModel> a,
443
                                Ptr<MobilityModel> b) const;
491
                                Ptr<MobilityModel> b) const;
444
  virtual int64_t DoAssignStreams (int64_t stream);
492
  virtual int64_t DoAssignStreams (int64_t stream);
445
493
 Lines 528-534    Link Here 
528
576
529
  virtual double DoCalcRxPower (double txPowerDbm,
577
  virtual double DoCalcRxPower (double txPowerDbm,
530
                                Ptr<MobilityModel> a,
578
                                Ptr<MobilityModel> a,
531
                                Ptr<MobilityModel> b) const;
579
                                Ptr<MobilityModel> b,
580
                                double frequency) const;
532
  virtual int64_t DoAssignStreams (int64_t stream);
581
  virtual int64_t DoAssignStreams (int64_t stream);
533
582
534
  /**
583
  /**
 Lines 611-617    Link Here 
611
660
612
  virtual double DoCalcRxPower (double txPowerDbm,
661
  virtual double DoCalcRxPower (double txPowerDbm,
613
                                Ptr<MobilityModel> a,
662
                                Ptr<MobilityModel> a,
614
                                Ptr<MobilityModel> b) const;
663
                                Ptr<MobilityModel> b,
664
                                double frequency) const;
615
  virtual int64_t DoAssignStreams (int64_t stream);
665
  virtual int64_t DoAssignStreams (int64_t stream);
616
666
617
  double m_distance0; //!< Beginning of the first (near) distance field
667
  double m_distance0; //!< Beginning of the first (near) distance field
 Lines 682-688    Link Here 
682
732
683
  virtual double DoCalcRxPower (double txPowerDbm,
733
  virtual double DoCalcRxPower (double txPowerDbm,
684
                                Ptr<MobilityModel> a,
734
                                Ptr<MobilityModel> a,
685
                                Ptr<MobilityModel> b) const;
735
                                Ptr<MobilityModel> b,
736
                                double frequency) const;
686
  virtual int64_t DoAssignStreams (int64_t stream);
737
  virtual int64_t DoAssignStreams (int64_t stream);
687
738
688
  double m_distance1; //!< Distance1
739
  double m_distance1; //!< Distance1
 Lines 744-750    Link Here 
744
795
745
  virtual double DoCalcRxPower (double txPowerDbm,
796
  virtual double DoCalcRxPower (double txPowerDbm,
746
                                Ptr<MobilityModel> a,
797
                                Ptr<MobilityModel> a,
747
                                Ptr<MobilityModel> b) const;
798
                                Ptr<MobilityModel> b,
799
                                double frequency) const;
748
800
749
  virtual int64_t DoAssignStreams (int64_t stream);
801
  virtual int64_t DoAssignStreams (int64_t stream);
750
  double m_rss; //!< the received signal strength
802
  double m_rss; //!< the received signal strength
 Lines 803-809    Link Here 
803
855
804
  virtual double DoCalcRxPower (double txPowerDbm,
856
  virtual double DoCalcRxPower (double txPowerDbm,
805
                                Ptr<MobilityModel> a,
857
                                Ptr<MobilityModel> a,
806
                                Ptr<MobilityModel> b) const;
858
                                Ptr<MobilityModel> b,
859
                                double frequency) const;
807
860
808
  virtual int64_t DoAssignStreams (int64_t stream);
861
  virtual int64_t DoAssignStreams (int64_t stream);
809
private:
862
private:
 Lines 850-856    Link Here 
850
  RangePropagationLossModel& operator= (const RangePropagationLossModel&);
903
  RangePropagationLossModel& operator= (const RangePropagationLossModel&);
851
  virtual double DoCalcRxPower (double txPowerDbm,
904
  virtual double DoCalcRxPower (double txPowerDbm,
852
                                Ptr<MobilityModel> a,
905
                                Ptr<MobilityModel> a,
853
                                Ptr<MobilityModel> b) const;
906
                                Ptr<MobilityModel> b,
907
                                double frequency) const;
854
  virtual int64_t DoAssignStreams (int64_t stream);
908
  virtual int64_t DoAssignStreams (int64_t stream);
855
private:
909
private:
856
  double m_range; //!< Maximum Transmission Range (meters)
910
  double m_range; //!< Maximum Transmission Range (meters)
(-)a/src/propagation/test/itu-r-1411-los-test-suite.cc (-1 / +1 lines)
 Lines 82-88    Link Here 
82
  Ptr<ItuR1411LosPropagationLossModel> propagationLossModel = CreateObject<ItuR1411LosPropagationLossModel> ();
82
  Ptr<ItuR1411LosPropagationLossModel> propagationLossModel = CreateObject<ItuR1411LosPropagationLossModel> ();
83
  propagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq));
83
  propagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq));
84
84
85
  double loss = propagationLossModel->GetLoss (mma, mmb);
85
  double loss = propagationLossModel->GetLoss (mma, mmb, m_freq);
86
86
87
  NS_LOG_INFO ("Calculated loss: " << loss);
87
  NS_LOG_INFO ("Calculated loss: " << loss);
88
  NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
88
  NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
(-)a/src/propagation/test/itu-r-1411-nlos-over-rooftop-test-suite.cc (-1 / +1 lines)
 Lines 88-94    Link Here 
88
  propagationLossModel->SetAttribute ("Environment", EnumValue (m_env));
88
  propagationLossModel->SetAttribute ("Environment", EnumValue (m_env));
89
  propagationLossModel->SetAttribute ("CitySize", EnumValue (m_city));
89
  propagationLossModel->SetAttribute ("CitySize", EnumValue (m_city));
90
90
91
  double loss = propagationLossModel->GetLoss (mma, mmb);
91
  double loss = propagationLossModel->GetLoss (mma, mmb, m_freq);
92
92
93
  NS_LOG_INFO ("Calculated loss: " << loss);
93
  NS_LOG_INFO ("Calculated loss: " << loss);
94
  NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
94
  NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
(-)a/src/propagation/test/okumura-hata-test-suite.cc (-1 / +1 lines)
 Lines 88-94    Link Here 
88
  propagationLossModel->SetAttribute ("Environment", EnumValue (m_env));
88
  propagationLossModel->SetAttribute ("Environment", EnumValue (m_env));
89
  propagationLossModel->SetAttribute ("CitySize", EnumValue (m_city));
89
  propagationLossModel->SetAttribute ("CitySize", EnumValue (m_city));
90
90
91
  double loss = propagationLossModel->GetLoss (mma, mmb);
91
  double loss = propagationLossModel->GetLoss (mma, mmb, m_freq);
92
92
93
  NS_LOG_INFO ("Calculated loss: " << loss);
93
  NS_LOG_INFO ("Calculated loss: " << loss);
94
  NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
94
  NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
(-)a/src/propagation/test/propagation-loss-model-test-suite.cc (-14 / +19 lines)
 Lines 70-76    Link Here 
70
70
71
  // the test vectors have been determined for a wavelength of 0.125 m 
71
  // the test vectors have been determined for a wavelength of 0.125 m 
72
  // which corresponds to a frequency of 2398339664.0 Hz in the vacuum
72
  // which corresponds to a frequency of 2398339664.0 Hz in the vacuum
73
  Config::SetDefault ("ns3::FriisPropagationLossModel::Frequency", DoubleValue (2398339664.0));
73
  double frequency{2398339664.0};
74
  Config::SetDefault ("ns3::FriisPropagationLossModel::Frequency", DoubleValue (frequency));
74
  Config::SetDefault ("ns3::FriisPropagationLossModel::SystemLoss", DoubleValue (1.0));
75
  Config::SetDefault ("ns3::FriisPropagationLossModel::SystemLoss", DoubleValue (1.0));
75
76
76
  // Select a reference transmit power
77
  // Select a reference transmit power
 Lines 124-130    Link Here 
124
    {
125
    {
125
      testVector = m_testVectors.Get (i);
126
      testVector = m_testVectors.Get (i);
126
      b->SetPosition (testVector.m_position);
127
      b->SetPosition (testVector.m_position);
127
      double resultdBm = lossModel->CalcRxPower (testVector.m_pt, a, b);
128
      double resultdBm = lossModel->CalcRxPower (testVector.m_pt, a, b, frequency);
128
      double resultW = std::pow (10.0, resultdBm/10.0)/1000;
129
      double resultW = std::pow (10.0, resultdBm/10.0)/1000;
129
      NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
130
      NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
130
    }
131
    }
 Lines 167-173    Link Here 
167
{
168
{
168
  // the test vectors have been determined for a wavelength of 0.125 m 
169
  // the test vectors have been determined for a wavelength of 0.125 m 
169
  // which corresponds to a frequency of 2398339664.0 Hz in the vacuum
170
  // which corresponds to a frequency of 2398339664.0 Hz in the vacuum
170
  Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::Frequency", DoubleValue (2398339664.0));
171
  double frequency{2398339664.0};
172
  Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::Frequency", DoubleValue (frequency));
171
  Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::SystemLoss", DoubleValue (1.0));
173
  Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::SystemLoss", DoubleValue (1.0));
172
174
173
  // set antenna height to 1.5m above z coordinate
175
  // set antenna height to 1.5m above z coordinate
 Lines 254-260    Link Here 
254
    {
256
    {
255
      testVector = m_testVectors.Get (i);
257
      testVector = m_testVectors.Get (i);
256
      b->SetPosition (testVector.m_position);
258
      b->SetPosition (testVector.m_position);
257
      double resultdBm = lossModel->CalcRxPower (testVector.m_pt, a, b);
259
      double resultdBm = lossModel->CalcRxPower (testVector.m_pt, a, b, frequency);
258
      double resultW = std::pow (10.0, resultdBm / 10.0) / 1000;
260
      double resultW = std::pow (10.0, resultdBm / 10.0) / 1000;
259
      NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
261
      NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
260
    }
262
    }
 Lines 293-299    Link Here 
293
LogDistancePropagationLossModelTestCase::DoRun (void)
295
LogDistancePropagationLossModelTestCase::DoRun (void)
294
{
296
{
295
  // reference loss at 2.4 GHz is 40.045997
297
  // reference loss at 2.4 GHz is 40.045997
296
  Config::SetDefault ("ns3::LogDistancePropagationLossModel::ReferenceLoss", DoubleValue (40.045997));
298
  double frequency{40.045997};
299
  Config::SetDefault ("ns3::LogDistancePropagationLossModel::ReferenceLoss", DoubleValue (frequency));
297
  Config::SetDefault ("ns3::LogDistancePropagationLossModel::Exponent", DoubleValue (3));
300
  Config::SetDefault ("ns3::LogDistancePropagationLossModel::Exponent", DoubleValue (3));
298
301
299
  // Select a reference transmit power
302
  // Select a reference transmit power
 Lines 342-348    Link Here 
342
    {
345
    {
343
      testVector = m_testVectors.Get (i);
346
      testVector = m_testVectors.Get (i);
344
      b->SetPosition (testVector.m_position);
347
      b->SetPosition (testVector.m_position);
345
      double resultdBm = lossModel->CalcRxPower (testVector.m_pt, a, b);
348
      double resultdBm = lossModel->CalcRxPower (testVector.m_pt, a, b, frequency);
346
      double resultW = std::pow (10.0, resultdBm/10.0)/1000;
349
      double resultW = std::pow (10.0, resultdBm/10.0)/1000;
347
      NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
350
      NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
348
    }
351
    }
 Lines 370-375    Link Here 
370
void
373
void
371
MatrixPropagationLossModelTestCase::DoRun (void)
374
MatrixPropagationLossModelTestCase::DoRun (void)
372
{
375
{
376
  double frequency{0.0}; // Does not matter for MatrixPropagationLossModel
373
  Ptr<MobilityModel> m[3];
377
  Ptr<MobilityModel> m[3];
374
  for (int i = 0; i < 3; ++i)
378
  for (int i = 0; i < 3; ++i)
375
    {
379
    {
 Lines 386-397    Link Here 
386
  loss.SetLoss (m[2], m[0], 100, /*symmetric = */ false);
390
  loss.SetLoss (m[2], m[0], 100, /*symmetric = */ false);
387
  // default from 1 to 2
391
  // default from 1 to 2
388
392
389
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[0], m[1]), -10, "Loss 0 -> 1 incorrect");
393
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[0], m[1], frequency), -10, "Loss 0 -> 1 incorrect");
390
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[1], m[0]), -10, "Loss 1 -> 0 incorrect");
394
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[1], m[0], frequency), -10, "Loss 1 -> 0 incorrect");
391
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[0], m[2]), -30, "Loss 0 -> 2 incorrect");
395
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[0], m[2], frequency), -30, "Loss 0 -> 2 incorrect");
392
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[2], m[0]), -100, "Loss 2 -> 0 incorrect");
396
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[2], m[0], frequency), -100, "Loss 2 -> 0 incorrect");
393
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[1], m[2]), 0, "Loss 1 -> 2 incorrect");
397
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[1], m[2], frequency), 0, "Loss 1 -> 2 incorrect");
394
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[2], m[1]), 0, "Loss 2 -> 1 incorrect");
398
  NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[2], m[1], frequency), 0, "Loss 2 -> 1 incorrect");
395
399
396
  Simulator::Destroy ();
400
  Simulator::Destroy ();
397
}
401
}
 Lines 418-423    Link Here 
418
void
422
void
419
RangePropagationLossModelTestCase::DoRun (void)
423
RangePropagationLossModelTestCase::DoRun (void)
420
{
424
{
425
  double frequency{0.0}; // Does not matter for RangePropagationLossModel
421
  Config::SetDefault ("ns3::RangePropagationLossModel::MaxRange", DoubleValue (127.2));
426
  Config::SetDefault ("ns3::RangePropagationLossModel::MaxRange", DoubleValue (127.2));
422
  Ptr<MobilityModel> a = CreateObject<ConstantPositionMobilityModel> (); 
427
  Ptr<MobilityModel> a = CreateObject<ConstantPositionMobilityModel> (); 
423
  a->SetPosition (Vector (0,0,0));
428
  a->SetPosition (Vector (0,0,0));
 Lines 428-437    Link Here 
428
433
429
  double txPwrdBm = -80.0;
434
  double txPwrdBm = -80.0;
430
  double tolerance = 1e-6;
435
  double tolerance = 1e-6;
431
  double resultdBm = lossModel->CalcRxPower (txPwrdBm, a, b);
436
  double resultdBm = lossModel->CalcRxPower (txPwrdBm, a, b, frequency);
432
  NS_TEST_EXPECT_MSG_EQ_TOL (resultdBm, txPwrdBm, tolerance, "Got unexpected rcv power");
437
  NS_TEST_EXPECT_MSG_EQ_TOL (resultdBm, txPwrdBm, tolerance, "Got unexpected rcv power");
433
  b->SetPosition (Vector (127.25,0,0));  // beyond range
438
  b->SetPosition (Vector (127.25,0,0));  // beyond range
434
  resultdBm = lossModel->CalcRxPower (txPwrdBm, a, b);
439
  resultdBm = lossModel->CalcRxPower (txPwrdBm, a, b, frequency);
435
  NS_TEST_EXPECT_MSG_EQ_TOL (resultdBm, -1000.0, tolerance, "Got unexpected rcv power");
440
  NS_TEST_EXPECT_MSG_EQ_TOL (resultdBm, -1000.0, tolerance, "Got unexpected rcv power");
436
  Simulator::Destroy ();
441
  Simulator::Destroy ();
437
}
442
}

Return to bug 2122