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

(-)a/CHANGES.html (+8 lines)
 Lines 88-93    Link Here 
88
<li>New Tag, PacketSocketTag, to carry the dest address of a packet and the packet type</li>
88
<li>New Tag, PacketSocketTag, to carry the dest address of a packet and the packet type</li>
89
<li>New Tag, DeviceNameTag, to carry the ns3 device name from where a packet is coming</li>
89
<li>New Tag, DeviceNameTag, to carry the ns3 device name from where a packet is coming</li>
90
<li>New Error Model, BurstError model, to determine which bursts of packets are errored corresponding to an underlying distribution, burst rate, and burst size</li>
90
<li>New Error Model, BurstError model, to determine which bursts of packets are errored corresponding to an underlying distribution, burst rate, and burst size</li>
91
<li>To make the API more uniform across the various
92
  PropagationLossModel classes, the Set/GetLambda methods of the
93
  FriisPropagationLossModel and TwoRayGroundPropagationLossModel
94
  classes have been changed to Set/GetFrequency, and now a Frequency
95
  attribute is exported which replaces the pre-existing Lambda
96
  attribute. Any previous user code setting a value for Lambda should
97
  be changed to set instead a value of Frequency = C / Lambda, with C
98
  = 299792458.0. </li>
91
</ul>
99
</ul>
92
100
93
<h2>Changes to existing API:</h2>
101
<h2>Changes to existing API:</h2>
(-)a/RELEASE_NOTES (+1 lines)
 Lines 38-43    Link Here 
38
- bug 1256 - Unnecessary SND.NXT advance, missing ACK for Out of Order segments
38
- bug 1256 - Unnecessary SND.NXT advance, missing ACK for Out of Order segments
39
- bug 1318 - Ipv6L3Protocol::LocalDeliver can get stuck in an infinte loop
39
- bug 1318 - Ipv6L3Protocol::LocalDeliver can get stuck in an infinte loop
40
- bug 1409 - Add an attribute "SystemId" to configure the ID for MPI
40
- bug 1409 - Add an attribute "SystemId" to configure the ID for MPI
41
- bug 1421 - Frequency dependent propagation loss models need uniform Frequency / Lambda attribute
41
- bug 1434 - DSR throughput not comparable to other protocols for manet example
42
- bug 1434 - DSR throughput not comparable to other protocols for manet example
42
- bug 1502 - Shutdown on tcp socket seems to misbehave
43
- bug 1502 - Shutdown on tcp socket seems to misbehave
43
- bug 1503 - BlockAckManager infine loop
44
- bug 1503 - BlockAckManager infine loop
(-)a/src/propagation/model/propagation-loss-model.cc (-30 / +30 lines)
 Lines 148-157    Link Here 
148
  static TypeId tid = TypeId ("ns3::FriisPropagationLossModel")
148
  static TypeId tid = TypeId ("ns3::FriisPropagationLossModel")
149
    .SetParent<PropagationLossModel> ()
149
    .SetParent<PropagationLossModel> ()
150
    .AddConstructor<FriisPropagationLossModel> ()
150
    .AddConstructor<FriisPropagationLossModel> ()
151
    .AddAttribute ("Lambda", 
151
    .AddAttribute ("Frequency", 
152
                   "The wavelength  (default is 5.15 GHz at 300 000 km/s).",
152
                   "The carrier frequency (in Hz) at which propagation occurs  (default is 5.15 GHz).",
153
                   DoubleValue (300000000.0 / 5.150e9),
153
                   DoubleValue (5.150e9),
154
                   MakeDoubleAccessor (&FriisPropagationLossModel::m_lambda),
154
                   MakeDoubleAccessor (&FriisPropagationLossModel::SetFrequency,
155
                                       &FriisPropagationLossModel::GetFrequency),
155
                   MakeDoubleChecker<double> ())
156
                   MakeDoubleChecker<double> ())
156
    .AddAttribute ("SystemLoss", "The system loss",
157
    .AddAttribute ("SystemLoss", "The system loss",
157
                   DoubleValue (1.0),
158
                   DoubleValue (1.0),
 Lines 190-209    Link Here 
190
{
191
{
191
  return m_minDistance;
192
  return m_minDistance;
192
}
193
}
194
193
void
195
void
194
FriisPropagationLossModel::SetLambda (double frequency, double speed)
196
FriisPropagationLossModel::SetFrequency (double frequency)
195
{
197
{
196
  m_lambda = speed / frequency;
198
  m_frequency = frequency;
199
  static const double C = 299792458.0; // speed of light in vacuum
200
  m_lambda = C / frequency;
197
}
201
}
198
void
202
199
FriisPropagationLossModel::SetLambda (double lambda)
203
double
204
FriisPropagationLossModel::GetFrequency (void) const
200
{
205
{
201
  m_lambda = lambda;
206
  return m_frequency;
202
}
203
double
204
FriisPropagationLossModel::GetLambda (void) const
205
{
206
  return m_lambda;
207
}
207
}
208
208
209
double
209
double
 Lines 285-294    Link Here 
285
  static TypeId tid = TypeId ("ns3::TwoRayGroundPropagationLossModel")
285
  static TypeId tid = TypeId ("ns3::TwoRayGroundPropagationLossModel")
286
    .SetParent<PropagationLossModel> ()
286
    .SetParent<PropagationLossModel> ()
287
    .AddConstructor<TwoRayGroundPropagationLossModel> ()
287
    .AddConstructor<TwoRayGroundPropagationLossModel> ()
288
    .AddAttribute ("Lambda",
288
    .AddAttribute ("Frequency", 
289
                   "The wavelength  (default is 5.15 GHz at 300 000 km/s).",
289
                   "The carrier frequency (in Hz) at which propagation occurs  (default is 5.15 GHz).",
290
                   DoubleValue (300000000.0 / 5.150e9),
290
                   DoubleValue (5.150e9),
291
                   MakeDoubleAccessor (&TwoRayGroundPropagationLossModel::m_lambda),
291
                   MakeDoubleAccessor (&TwoRayGroundPropagationLossModel::SetFrequency,
292
                                       &TwoRayGroundPropagationLossModel::GetFrequency),
292
                   MakeDoubleChecker<double> ())
293
                   MakeDoubleChecker<double> ())
293
    .AddAttribute ("SystemLoss", "The system loss",
294
    .AddAttribute ("SystemLoss", "The system loss",
294
                   DoubleValue (1.0),
295
                   DoubleValue (1.0),
 Lines 337-356    Link Here 
337
{
338
{
338
  m_heightAboveZ = heightAboveZ;
339
  m_heightAboveZ = heightAboveZ;
339
}
340
}
340
void 
341
341
TwoRayGroundPropagationLossModel::SetLambda (double frequency, double speed)
342
void
343
TwoRayGroundPropagationLossModel::SetFrequency (double frequency)
342
{
344
{
343
  m_lambda = speed / frequency;
345
  m_frequency = frequency;
346
  static const double C = 299792458.0; // speed of light in vacuum
347
  m_lambda = C / frequency;
344
}
348
}
345
void 
349
346
TwoRayGroundPropagationLossModel::SetLambda (double lambda)
350
double
351
TwoRayGroundPropagationLossModel::GetFrequency (void) const
347
{
352
{
348
  m_lambda = lambda;
353
  return m_frequency;
349
}
350
double 
351
TwoRayGroundPropagationLossModel::GetLambda (void) const
352
{
353
  return m_lambda;
354
}
354
}
355
355
356
double 
356
double 
 Lines 415-421    Link Here 
415
   *
415
   *
416
   */
416
   */
417
417
418
  double dCross = (4 * PI * txAntHeight * rxAntHeight) / GetLambda ();
418
  double dCross = (4 * PI * txAntHeight * rxAntHeight) / m_lambda;
419
  double tmp = 0;
419
  double tmp = 0;
420
  if (distance <= dCross)
420
  if (distance <= dCross)
421
    {
421
    {
(-)a/src/propagation/model/propagation-loss-model.h (-24 / +24 lines)
 Lines 171-176    Link Here 
171
 * This model is invalid for small distance values.
171
 * This model is invalid for small distance values.
172
 * The current implementation returns the txpower as the rxpower
172
 * The current implementation returns the txpower as the rxpower
173
 * for any distance smaller than MinDistance.
173
 * for any distance smaller than MinDistance.
174
 * 
175
 * In the implementation,  \f$ \lambda \f$ is calculated as 
176
 * \f$ \frac{C}{f} \f$, where  \f$ C = 299792458\f$ m/s is the speed of light in
177
 * vacuum, and \f$ f \f$ is the frequency in Hz which can be configured by
178
 * the user via the Frequency attribute.
174
 */
179
 */
175
class FriisPropagationLossModel : public PropagationLossModel
180
class FriisPropagationLossModel : public PropagationLossModel
176
{
181
{
 Lines 179-197    Link Here 
179
  FriisPropagationLossModel ();
184
  FriisPropagationLossModel ();
180
  /**
185
  /**
181
   * \param frequency (Hz)
186
   * \param frequency (Hz)
182
   * \param speed (m/s)
183
   *
187
   *
184
   * Set the main wavelength used in the Friis model 
188
   * Set the carrier frequency used in the Friis model 
185
   * calculation.
189
   * calculation.
186
   */
190
   */
187
  void SetLambda (double frequency, double speed);
191
  void SetFrequency (double frequency);
188
  /**
189
   * \param lambda (m) the wavelength
190
   *
191
   * Set the main wavelength used in the Friis model 
192
   * calculation.
193
   */
194
  void SetLambda (double lambda);
195
  /**
192
  /**
196
   * \param systemLoss (dimension-less)
193
   * \param systemLoss (dimension-less)
197
   *
194
   *
 Lines 213-221    Link Here 
213
  double GetMinDistance (void) const;
210
  double GetMinDistance (void) const;
214
211
215
  /**
212
  /**
216
   * \returns the current wavelength (m)
213
   * \returns the current frequency (Hz)
217
   */
214
   */
218
  double GetLambda (void) const;
215
  double GetFrequency (void) const;
219
  /**
216
  /**
220
   * \returns the current system loss (dimension-less)
217
   * \returns the current system loss (dimension-less)
221
   */
218
   */
 Lines 233-238    Link Here 
233
230
234
  static const double PI;
231
  static const double PI;
235
  double m_lambda;
232
  double m_lambda;
233
  double m_frequency;
236
  double m_systemLoss;
234
  double m_systemLoss;
237
  double m_minDistance;
235
  double m_minDistance;
238
};
236
};
 Lines 259-285    Link Here 
259
 * The crossover distance, below which Friis is used, is calculated as follows:
257
 * The crossover distance, below which Friis is used, is calculated as follows:
260
 *
258
 *
261
 * \f$ dCross = \frac{(4 * pi * Ht * Hr)}{lambda} \f$
259
 * \f$ dCross = \frac{(4 * pi * Ht * Hr)}{lambda} \f$
260
 *
261
 * In the implementation,  \f$ \lambda \f$ is calculated as 
262
 * \f$ \frac{C}{f} \f$, where  \f$ C = 299792458\f$ m/s is the speed of light in
263
 * vacuum, and \f$ f \f$ is the frequency in Hz which can be configured by
264
 * the user via the Frequency attribute.
262
 */
265
 */
263
class TwoRayGroundPropagationLossModel : public PropagationLossModel
266
class TwoRayGroundPropagationLossModel : public PropagationLossModel
264
{
267
{
265
public:
268
public:
266
  static TypeId GetTypeId (void);
269
  static TypeId GetTypeId (void);
267
  TwoRayGroundPropagationLossModel ();
270
  TwoRayGroundPropagationLossModel ();
271
268
  /**
272
  /**
269
   * \param frequency (Hz)
273
   * \param frequency (Hz)
270
   * \param speed (m/s)
271
   *
274
   *
272
   * Set the main wavelength used in the TwoRayGround model 
275
   * Set the carrier frequency used in the TwoRayGround model 
273
   * calculation.
276
   * calculation.
274
   */
277
   */
275
  void SetLambda (double frequency, double speed);
278
  void SetFrequency (double frequency);
276
  /**
279
277
   * \param lambda (m) the wavelength
278
   *
279
   * Set the main wavelength used in the TwoRayGround model 
280
   * calculation.
281
   */
282
  void SetLambda (double lambda);
283
  /**
280
  /**
284
   * \param systemLoss (dimension-less)
281
   * \param systemLoss (dimension-less)
285
   *
282
   *
 Lines 297-306    Link Here 
297
   * \returns the minimum distance.
294
   * \returns the minimum distance.
298
   */
295
   */
299
  double GetMinDistance (void) const;
296
  double GetMinDistance (void) const;
297
300
  /**
298
  /**
301
   * \returns the current wavelength (m)
299
   * \returns the current frequency (Hz)
302
   */
300
   */
303
  double GetLambda (void) const;
301
  double GetFrequency (void) const;
302
304
  /**
303
  /**
305
   * \returns the current system loss (dimension-less)
304
   * \returns the current system loss (dimension-less)
306
   */
305
   */
 Lines 324-329    Link Here 
324
323
325
  static const double PI;
324
  static const double PI;
326
  double m_lambda;
325
  double m_lambda;
326
  double m_frequency;
327
  double m_systemLoss;
327
  double m_systemLoss;
328
  double m_minDistance;
328
  double m_minDistance;
329
  double m_heightAboveZ;
329
  double m_heightAboveZ;
(-)a/src/propagation/test/propagation-loss-model-test-suite.cc (-4 / +6 lines)
 Lines 68-75    Link Here 
68
  // The ns-3 testing manual gives more background on the values selected
68
  // The ns-3 testing manual gives more background on the values selected
69
  // for this test.  First, set a few defaults. 
69
  // for this test.  First, set a few defaults. 
70
70
71
  // wavelength at 2.4 GHz is 0.125m
71
  // the test vectors have been determined for a wavelength of 0.125 m 
72
  Config::SetDefault ("ns3::FriisPropagationLossModel::Lambda", DoubleValue (0.125));
72
  // which corresponds to a frequency of 2398339664.0 Hz in the vacuum
73
  Config::SetDefault ("ns3::FriisPropagationLossModel::Frequency", DoubleValue (2398339664.0));
73
  Config::SetDefault ("ns3::FriisPropagationLossModel::SystemLoss", DoubleValue (1.0));
74
  Config::SetDefault ("ns3::FriisPropagationLossModel::SystemLoss", DoubleValue (1.0));
74
75
75
  // Select a reference transmit power
76
  // Select a reference transmit power
 Lines 164-171    Link Here 
164
void
165
void
165
TwoRayGroundPropagationLossModelTestCase::DoRun (void)
166
TwoRayGroundPropagationLossModelTestCase::DoRun (void)
166
{
167
{
167
  // wavelength at 2.4 GHz is 0.125m
168
  // the test vectors have been determined for a wavelength of 0.125 m 
168
  Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::Lambda", DoubleValue (0.125));
169
  // which corresponds to a frequency of 2398339664.0 Hz in the vacuum
170
  Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::Frequency", DoubleValue (2398339664.0));
169
  Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::SystemLoss", DoubleValue (1.0));
171
  Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::SystemLoss", DoubleValue (1.0));
170
172
171
  // set antenna height to 1.5m above z coordinate
173
  // set antenna height to 1.5m above z coordinate

Return to bug 1421