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

(-)a/src/wifi/model/interference-helper.cc (-93 / +170 lines)
 Lines 267-286    Link Here 
267
}
267
}
268
268
269
double
269
double
270
InterferenceHelper::CalculatePer (Ptr<const InterferenceHelper::Event> event, NiChanges *ni) const
270
InterferenceHelper::CalculatePlcpPayloadPer (Ptr<const InterferenceHelper::Event> event, NiChanges *ni) const
271
{
271
{
272
  double psr = 1.0; /* Packet Success Rate */
272
  double psr = 1.0; /* Packet Success Rate */
273
  NiChanges::iterator j = ni->begin ();
273
  NiChanges::iterator j = ni->begin ();
274
  Time previous = (*j).GetTime ();
274
  Time previous = (*j).GetTime ();
275
  WifiMode payloadMode = event->GetPayloadMode ();
275
  WifiMode payloadMode = event->GetPayloadMode ();
276
  WifiPreamble preamble = event->GetPreambleType ();
276
  WifiPreamble preamble = event->GetPreambleType ();
277
 WifiMode MfHeaderMode ;
278
 if (preamble==WIFI_PREAMBLE_HT_MF)
279
   {
280
    MfHeaderMode = WifiPhy::GetMFPlcpHeaderMode (payloadMode, preamble); //return L-SIG mode
281
282
   }
283
  WifiMode headerMode = WifiPhy::GetPlcpHeaderMode (payloadMode, preamble);
284
  Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (payloadMode, preamble); //packet start time+ preamble
277
  Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (payloadMode, preamble); //packet start time+ preamble
285
  Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (payloadMode, preamble);//packet start time+ preamble+L SIG
278
  Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (payloadMode, preamble);//packet start time+ preamble+L SIG
286
  Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble);//packet start time+ preamble+L SIG+HT SIG
279
  Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble);//packet start time+ preamble+L SIG+HT SIG
 Lines 309-382    Link Here 
309
            { 
302
            { 
310
               //Case 2ai and 2aii: All formats
303
               //Case 2ai and 2aii: All formats
311
               psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
304
               psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
305
                                                               noiseInterferenceW,
306
                                                               payloadMode),
307
                                                 current - plcpPayloadStart,
308
                                                 payloadMode);
309
                
310
            }
311
        }
312
      //Case 3: previous is in HT-SIG: Non HT will not enter here since it didn't enter in the last two and they are all the same for non HT
313
      else if (previous >= plcpHsigHeaderStart)
314
        {
315
          //Case 3a: cuurent after payload start
316
          if (current >= plcpPayloadStart)
317
             {
318
                   psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
319
                                                                   noiseInterferenceW,
320
                                                                   payloadMode),
321
                                                     current - plcpPayloadStart,
322
                                                     payloadMode);
323
                 
324
              }
325
326
        }
327
      //Case 4: previous in L-SIG: GF will not reach here because it will execute the previous if and exit
328
      else if (previous >= plcpHeaderStart)
329
        {
330
          //Case 4a: current after payload start  
331
          if (current >= plcpPayloadStart)
332
             {
333
                   psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
334
                                                                   noiseInterferenceW,
335
                                                                   payloadMode),
336
                                                     current - plcpPayloadStart,
337
                                                     payloadMode);
338
339
              }
340
        }
341
      //Case 5: previous is in the preamble works for all cases
342
      else
343
        {
344
          if (current >= plcpPayloadStart)
345
            {
346
              //for all
347
              psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
312
                                                              noiseInterferenceW,
348
                                                              noiseInterferenceW,
313
                                                              payloadMode),
349
                                                              payloadMode),
314
                                                current - plcpPayloadStart,
350
                                                current - plcpPayloadStart,
315
                                                payloadMode);
351
                                                payloadMode); 
316
                
352
             
317
              }
353
            }
318
        }
354
        }
319
      //Case 3: previous is in HT-SIG: Non HT will not enter here since it didn't enter in the last two and they are all the same for non HT
355
320
      else if (previous >=plcpHsigHeaderStart)
356
      noiseInterferenceW += (*j).GetDelta ();
357
      previous = (*j).GetTime ();
358
      j++;
359
    }
360
361
  double per = 1 - psr;
362
  return per;
363
}
364
365
double
366
InterferenceHelper::CalculatePlcpHeaderPer (Ptr<const InterferenceHelper::Event> event, NiChanges *ni) const
367
{
368
  double psr = 1.0; /* Packet Success Rate */
369
  NiChanges::iterator j = ni->begin ();
370
  Time previous = (*j).GetTime ();
371
  WifiMode payloadMode = event->GetPayloadMode ();
372
  WifiPreamble preamble = event->GetPreambleType ();
373
  WifiMode MfHeaderMode ;
374
  if (preamble == WIFI_PREAMBLE_HT_MF)
375
    {
376
      MfHeaderMode = WifiPhy::GetMFPlcpHeaderMode (payloadMode, preamble); //return L-SIG mode
377
    }
378
  WifiMode headerMode = WifiPhy::GetPlcpHeaderMode (payloadMode, preamble);
379
  Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (payloadMode, preamble); // packet start time + preamble
380
  Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (payloadMode, preamble); // packet start time + preamble+L SIG
381
  Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble); // packet start time + preamble + L SIG + HT SIG
382
  Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble, event->GetTxVector()); // packet start time + preamble + L SIG + HT SIG + Training
383
  double noiseInterferenceW = (*j).GetDelta ();
384
  double powerW = event->GetRxPowerW ();
385
    j++;
386
  while (ni->end () != j)
387
    {
388
      Time current = (*j).GetTime ();
389
      NS_ASSERT (current >= previous);
390
      //Case 1: previous is in HT-SIG: Non HT will not enter here since it didn't enter in the last two and they are all the same for non HT
391
      if (previous >= plcpHsigHeaderStart)
321
        {
392
        {
322
          //Case 3a: cuurent after payload start
393
          //Case 1a: cuurent after payload start
323
          if (current >=plcpPayloadStart)
394
          if (current >= plcpPayloadStart)
324
             {
395
             {
325
                   psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
396
326
                                                              noiseInterferenceW,
327
                                                              payloadMode),
328
                                                current - plcpPayloadStart,
329
                                                payloadMode);
330
                 
397
                 
331
                    psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
398
                    psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
332
                                                              noiseInterferenceW,
399
                                                                    noiseInterferenceW,
333
                                                              headerMode),
400
                                                                    headerMode),
334
                                               plcpHtTrainingSymbolsStart - previous,
401
                                                      plcpHtTrainingSymbolsStart - previous,
335
                                                headerMode);
402
                                                      headerMode);
336
              }
403
              }
337
          //case 3b: current after HT training symbols start
404
          //case 1b: current after HT training symbols start
338
          else if (current >=plcpHtTrainingSymbolsStart)
405
          else if (current >=plcpHtTrainingSymbolsStart)
339
             {
406
             {
340
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
407
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
341
                                                                noiseInterferenceW,
408
                                                                noiseInterferenceW,
342
                                                                headerMode),
409
                                                                headerMode),
343
                                                   plcpHtTrainingSymbolsStart - previous,
410
                                                  plcpHtTrainingSymbolsStart - previous,
344
                                                   headerMode);  
411
                                                  headerMode);
345
                   
412
                   
346
             }
413
             }
347
         //Case 3c: current is with previous in HT sig
414
         //Case 1c: current is with previous in HT sig
348
         else
415
         else
349
            {
416
            {
350
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
417
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
351
                                                                noiseInterferenceW,
418
                                                                noiseInterferenceW,
352
                                                                headerMode),
419
                                                                headerMode),
353
                                                   current- previous,
420
                                                  current - previous,
354
                                                   headerMode);  
421
                                                  headerMode);
355
                   
422
                   
356
            }
423
            }
357
      }
424
      }
358
      //Case 4: previous in L-SIG: GF will not reach here because it will execute the previous if and exit
425
      // Case 2: previous in L-SIG: GF will not reach here because it will execute the previous if and exit
359
      else if (previous >= plcpHeaderStart)
426
      else if (previous >= plcpHeaderStart)
360
        {
427
        {
361
          //Case 4a: current after payload start  
428
          // Case 2a: current after payload start
362
          if (current >=plcpPayloadStart)
429
          if (current >= plcpPayloadStart)
363
             {
430
             {
364
                   psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
431
              // Case 2ai: Non HT format (No HT-SIG or Training Symbols)
365
                                                              noiseInterferenceW,
366
                                                              payloadMode),
367
                                                      current - plcpPayloadStart,
368
                                                      payloadMode);
369
                    //Case 4ai: Non HT format (No HT-SIG or Training Symbols)
370
              if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT) //plcpHtTrainingSymbolsStart==plcpHeaderStart)
432
              if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT) //plcpHtTrainingSymbolsStart==plcpHeaderStart)
371
                {
433
                {
372
                    psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
434
                    psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
373
                                                              noiseInterferenceW,
435
                                                                    noiseInterferenceW,
374
                                                              headerMode),
436
                                                                    headerMode),
375
                                                plcpPayloadStart - previous,
437
                                                      plcpPayloadStart - previous,
376
                                                headerMode);
438
                                                      headerMode);
377
                }
439
                }
378
440
              else
379
               else{
441
                {
380
                    psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
442
                    psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
381
                                                              noiseInterferenceW,
443
                                                              noiseInterferenceW,
382
                                                              headerMode),
444
                                                              headerMode),
 Lines 389-396    Link Here 
389
                                                      MfHeaderMode);
451
                                                      MfHeaderMode);
390
                 }
452
                 }
391
              }
453
              }
392
           //Case 4b: current in HT training symbol. non HT will not come here since it went in previous if or if the previous ifis not true this will be not true        
454
          // Case 2b: current in HT training symbol. non HT will not come here since it went in previous if or if the previous ifis not true this will be not true
393
          else if (current >=plcpHtTrainingSymbolsStart)
455
          else if (current >= plcpHtTrainingSymbolsStart)
394
             {
456
             {
395
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
457
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
396
                                                              noiseInterferenceW,
458
                                                              noiseInterferenceW,
 Lines 403-410    Link Here 
403
                                                   plcpHsigHeaderStart - previous,
465
                                                   plcpHsigHeaderStart - previous,
404
                                                   MfHeaderMode);
466
                                                   MfHeaderMode);
405
              }
467
              }
406
          //Case 4c: current in H sig.non HT will not come here since it went in previous if or if the previous ifis not true this will be not true
468
          // Case 2c: current in H sig. non HT will not come here since it went in previous if or if the previous ifis not true this will be not true
407
          else if (current >=plcpHsigHeaderStart)
469
          else if (current >= plcpHsigHeaderStart)
408
             {
470
             {
409
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
471
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
410
                                                                noiseInterferenceW,
472
                                                                noiseInterferenceW,
 Lines 418-464    Link Here 
418
                                                   MfHeaderMode);
480
                                                   MfHeaderMode);
419
481
420
             }
482
             }
421
         //Case 4d: Current with prev in L SIG
483
         // Case 2d: Current with prev in L SIG
422
         else 
484
         else 
423
            {
485
            {
424
                //Case 4di: Non HT format (No HT-SIG or Training Symbols)
486
              // Case 4di: Non HT format (No HT-SIG or Training Symbols)
425
              if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT) //plcpHtTrainingSymbolsStart==plcpHeaderStart)
487
              if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT) //plcpHtTrainingSymbolsStart==plcpHeaderStart)
426
                {
488
                {
427
                    psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
489
                    psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
428
                                                              noiseInterferenceW,
490
                                                                    noiseInterferenceW,
429
                                                              headerMode),
491
                                                                    headerMode),
430
                                                current - previous,
492
                                                      current - previous,
431
                                                headerMode);
493
                                                      headerMode);
432
                }
494
                }
433
               else
495
              else
434
                {
496
                {
435
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
497
                    psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
436
                                                               noiseInterferenceW,
498
                                                               noiseInterferenceW,
437
                                                               MfHeaderMode),
499
                                                               MfHeaderMode),
438
                                                 current - previous,
500
                                                      current - previous,
439
                                                 MfHeaderMode);
501
                                                      MfHeaderMode);
440
                }
502
                }
441
            }
503
            }
442
        }
504
        }
443
      //Case 5: previous is in the preamble works for all cases
505
      // Case 3: previous is in the preamble works for all cases
444
      else
506
      else
445
        {
507
        {
446
          if (current >= plcpPayloadStart)
508
          if (current >= plcpPayloadStart)
447
            {
509
            {
448
              //for all
510
              // Non HT format (No HT-SIG or Training Symbols)
449
              psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
450
                                                              noiseInterferenceW,
451
                                                              payloadMode),
452
                                                current - plcpPayloadStart,
453
                                                payloadMode); 
454
             
455
               // Non HT format (No HT-SIG or Training Symbols)
456
              if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT)
511
              if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT)
457
                 psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
512
                 psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
458
                                                                 noiseInterferenceW,
513
                                                                 noiseInterferenceW,
459
                                                                  headerMode),
514
                                                                 headerMode),
460
                                                    plcpPayloadStart - plcpHeaderStart,
515
                                                   plcpPayloadStart - plcpHeaderStart,
461
                                                    headerMode);
516
                                                   headerMode);
462
              else
517
              else
463
              // Greenfield or Mixed format
518
              // Greenfield or Mixed format
464
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
519
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
 Lines 473-496    Link Here 
473
                                                   plcpHsigHeaderStart-plcpHeaderStart,
528
                                                   plcpHsigHeaderStart-plcpHeaderStart,
474
                                                   MfHeaderMode);             
529
                                                   MfHeaderMode);             
475
            }
530
            }
476
          else if (current >=plcpHtTrainingSymbolsStart )
531
          else if (current >= plcpHtTrainingSymbolsStart )
477
          { 
532
          { 
478
              // Non HT format will not come here since it will execute prev if
533
              // Non HT format will not come here since it will execute prev if
479
              // Greenfield or Mixed format
534
              // Greenfield or Mixed format
480
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
535
              psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
481
                                                                noiseInterferenceW,
536
                                                              noiseInterferenceW,
482
                                                                headerMode),
537
                                                              headerMode),
483
                                                  plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
538
                                                plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
484
                                                  headerMode);
539
                                                headerMode);
540
              // Greenfield
485
              if (preamble == WIFI_PREAMBLE_HT_MF)
541
              if (preamble == WIFI_PREAMBLE_HT_MF)
486
                 psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
542
                {
487
                                                                 noiseInterferenceW,
543
                    psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
488
                                                                 MfHeaderMode),
544
                                                                    noiseInterferenceW,
489
                                                   plcpHsigHeaderStart-plcpHeaderStart,
545
                                                                    MfHeaderMode),
490
                                                   MfHeaderMode);       
546
                                                      plcpHsigHeaderStart-plcpHeaderStart,
547
                                                      MfHeaderMode);
548
                }
491
           }
549
           }
492
          //non HT will not come here     
550
          // non HT will not come here
493
          else if (current >=plcpHsigHeaderStart)
551
          else if (current >= plcpHsigHeaderStart)
494
             { 
552
             { 
495
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
553
                psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
496
                                                                noiseInterferenceW,
554
                                                                noiseInterferenceW,
 Lines 513-529    Link Here 
513
                 {
571
                 {
514
                 psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
572
                 psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
515
                                                                 noiseInterferenceW,
573
                                                                 noiseInterferenceW,
516
                                                                  headerMode),
574
                                                                 headerMode),
517
                                                    current - plcpHeaderStart,
575
                                                   current - plcpHeaderStart,
518
                                                    headerMode);
576
                                                   headerMode);
519
                 }
577
                 }
520
              else
578
              else
521
                 {
579
                 {
522
              psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
580
              psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
523
                                                              noiseInterferenceW,
581
                                                              noiseInterferenceW,
524
                                                             MfHeaderMode),
582
                                                              MfHeaderMode),
525
                                               current - plcpHeaderStart,
583
                                                current - plcpHeaderStart,
526
                                               MfHeaderMode);
584
                                                MfHeaderMode);
527
                       }
585
                       }
528
            }
586
            }
529
        }
587
        }
 Lines 537-545    Link Here 
537
  return per;
595
  return per;
538
}
596
}
539
597
540
541
struct InterferenceHelper::SnrPer
598
struct InterferenceHelper::SnrPer
542
InterferenceHelper::CalculateSnrPer (Ptr<InterferenceHelper::Event> event)
599
InterferenceHelper::CalculatePlcpPayloadSnrPer (Ptr<InterferenceHelper::Event> event)
543
{
600
{
544
  NiChanges ni;
601
  NiChanges ni;
545
  double noiseInterferenceW = CalculateNoiseInterferenceW (event, &ni);
602
  double noiseInterferenceW = CalculateNoiseInterferenceW (event, &ni);
 Lines 550-556    Link Here 
550
  /* calculate the SNIR at the start of the packet and accumulate
607
  /* calculate the SNIR at the start of the packet and accumulate
551
   * all SNIR changes in the snir vector.
608
   * all SNIR changes in the snir vector.
552
   */
609
   */
553
  double per = CalculatePer (event, &ni);
610
  double per = CalculatePlcpPayloadPer (event, &ni);
611
612
  struct SnrPer snrPer;
613
  snrPer.snr = snr;
614
  snrPer.per = per;
615
  return snrPer;
616
}
617
618
struct InterferenceHelper::SnrPer
619
InterferenceHelper::CalculatePlcpHeaderSnrPer (Ptr<InterferenceHelper::Event> event)
620
{
621
  NiChanges ni;
622
  double noiseInterferenceW = CalculateNoiseInterferenceW (event, &ni);
623
  double snr = CalculateSnr (event->GetRxPowerW (),
624
                             noiseInterferenceW,
625
                             WifiPhy::GetPlcpHeaderMode (event->GetPayloadMode (), event->GetPreambleType ()));
626
627
  /* calculate the SNIR at the start of the plcp header and accumulate
628
   * all SNIR changes in the snir vector.
629
   */
630
  double per = CalculatePlcpHeaderPer (event, &ni);
554
631
555
  struct SnrPer snrPer;
632
  struct SnrPer snrPer;
556
  snrPer.snr = snr;
633
  snrPer.snr = snr;
(-)a/src/wifi/model/interference-helper.h (-5 / +22 lines)
 Lines 182-194    Link Here 
182
                                      Time duration, double rxPower, WifiTxVector txvector);
182
                                      Time duration, double rxPower, WifiTxVector txvector);
183
183
184
  /**
184
  /**
185
   * Calculate the SNIR at the start of the packet and accumulate
185
   * Calculate the SNIR at the start of the plcp payload and accumulate
186
   * all SNIR changes in the snir vector.
186
   * all SNIR changes in the snir vector.
187
   *
187
   *
188
   * \param event the event corresponding to the first time the packet arrives
188
   * \param event the event corresponding to the first time the corresponding packet arrives
189
   * \return struct of SNR and PER
189
   * \return struct of SNR and PER
190
   */
190
   */
191
  struct InterferenceHelper::SnrPer CalculateSnrPer (Ptr<InterferenceHelper::Event> event);
191
  struct InterferenceHelper::SnrPer CalculatePlcpPayloadSnrPer (Ptr<InterferenceHelper::Event> event);
192
  /**
193
   * Calculate the SNIR at the start of the plcp header and accumulate
194
   * all SNIR changes in the snir vector.
195
   *
196
   * \param event the event corresponding to the first time the corresponding packet arrives
197
   * \return struct of SNR and PER
198
   */
199
  struct InterferenceHelper::SnrPer CalculatePlcpHeaderSnrPer (Ptr<InterferenceHelper::Event> event);
192
  /**
200
  /**
193
   * Notify that RX has started.
201
   * Notify that RX has started.
194
   */
202
   */
 Lines 284-297    Link Here 
284
   */
292
   */
285
  double CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode) const;
293
  double CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode) const;
286
  /**
294
  /**
287
   * Calculate the error rate of the given packet. The packet can be divided into
295
   * Calculate the error rate of the given plcp payload. The plcp payload can be divided into
288
   * multiple chunks (e.g. due to interference from other transmissions).
296
   * multiple chunks (e.g. due to interference from other transmissions).
289
   *
297
   *
290
   * \param event
298
   * \param event
291
   * \param ni
299
   * \param ni
292
   * \return the error rate of the packet
300
   * \return the error rate of the packet
293
   */
301
   */
294
  double CalculatePer (Ptr<const Event> event, NiChanges *ni) const;
302
  double CalculatePlcpPayloadPer (Ptr<const Event> event, NiChanges *ni) const;
303
  /**
304
   * Calculate the error rate of the plcp header. The plcp header can be divided into
305
   * multiple chunks (e.g. due to interference from other transmissions).
306
   *
307
   * \param event
308
   * \param ni
309
   * \return the error rate of the packet
310
   */
311
  double CalculatePlcpHeaderPer (Ptr<const Event> event, NiChanges *ni) const;
295
312
296
  double m_noiseFigure; /**< noise figure (linear) */
313
  double m_noiseFigure; /**< noise figure (linear) */
297
  Ptr<ErrorRateModel> m_errorRateModel;
314
  Ptr<ErrorRateModel> m_errorRateModel;
(-)a/src/wifi/model/wifi-phy.cc (+10 lines)
 Lines 584-589    Link Here 
584
    + GetPayloadDuration (size, txvector, preamble, frequency, packetType, incFlag);
584
    + GetPayloadDuration (size, txvector, preamble, frequency, packetType, incFlag);
585
  return duration;
585
  return duration;
586
}
586
}
587
Time
588
WifiPhy::CalculatePlcpDuration (WifiTxVector txvector, WifiPreamble preamble)
589
{
590
  WifiMode payloadMode=txvector.GetMode();
591
  Time duration = GetPlcpPreambleDuration (payloadMode, preamble)
592
    + GetPlcpHeaderDuration (payloadMode, preamble)
593
    + GetPlcpHtSigHeaderDuration (preamble)
594
    + GetPlcpHtTrainingSymbolDuration (preamble, txvector);
595
  return duration;
596
}
587
597
588
void
598
void
589
WifiPhy::NotifyTxBegin (Ptr<const Packet> packet)
599
WifiPhy::NotifyTxBegin (Ptr<const Packet> packet)
(-)a/src/wifi/model/wifi-phy.h (+7 lines)
 Lines 295-300    Link Here 
295
   *          the transmission of these bytes.
295
   *          the transmission of these bytes.
296
   */
296
   */
297
  Time CalculateTxDuration (uint32_t size, WifiTxVector txvector, enum WifiPreamble preamble, double frequency, uint8_t packetType, uint8_t incFlag);
297
  Time CalculateTxDuration (uint32_t size, WifiTxVector txvector, enum WifiPreamble preamble, double frequency, uint8_t packetType, uint8_t incFlag);
298
  
299
  /**
300
   * \param txvector the transmission parameters used for this packet
301
   * \param preamble the type of preamble to use for this packet.
302
   * \return the total amount of time this PHY will stay busy for the transmission of the plcp.
303
   */
304
  Time CalculatePlcpDuration (WifiTxVector txvector, enum WifiPreamble preamble);
298
305
299
  /**
306
  /**
300
   * \param preamble the type of preamble
307
   * \param preamble the type of preamble
(-)a/src/wifi/model/yans-wifi-channel.cc (-1 / +1 lines)
 Lines 125-131    Link Here 
125
YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, double *atts,
125
YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, double *atts,
126
                          WifiTxVector txVector, WifiPreamble preamble) const
126
                          WifiTxVector txVector, WifiPreamble preamble) const
127
{
127
{
128
  m_phyList[i]->StartReceivePacket (packet, *atts, txVector, preamble,*(atts+1), NanoSeconds(*(atts+2)));
128
  m_phyList[i]->StartReceivePlcp (packet, *atts, txVector, preamble,*(atts+1), NanoSeconds(*(atts+2)));
129
  delete[] atts;
129
  delete[] atts;
130
}
130
}
131
131
(-)a/src/wifi/model/yans-wifi-phy.cc (-61 / +132 lines)
 Lines 173-180    Link Here 
173
  :  m_initialized (false),
173
  :  m_initialized (false),
174
    m_channelNumber (1),
174
    m_channelNumber (1),
175
    m_endRxEvent (),
175
    m_endRxEvent (),
176
    m_endPlcpRxEvent(),
176
    m_channelStartingFrequency (0),
177
    m_channelStartingFrequency (0),
177
    m_mpdusNum(0)
178
    m_mpdusNum(0),
179
    m_plcpSuccess (false)
178
{
180
{
179
  NS_LOG_FUNCTION (this);
181
  NS_LOG_FUNCTION (this);
180
  m_random = CreateObject<UniformRandomVariable> ();
182
  m_random = CreateObject<UniformRandomVariable> ();
 Lines 397-402    Link Here 
397
    {
399
    {
398
    case YansWifiPhy::RX:
400
    case YansWifiPhy::RX:
399
      NS_LOG_DEBUG ("drop packet because of channel switching while reception");
401
      NS_LOG_DEBUG ("drop packet because of channel switching while reception");
402
      m_endPlcpRxEvent.Cancel();
400
      m_endRxEvent.Cancel ();
403
      m_endRxEvent.Cancel ();
401
      goto switchChannel;
404
      goto switchChannel;
402
      break;
405
      break;
 Lines 514-532    Link Here 
514
{
517
{
515
  m_state->SetReceiveErrorCallback (callback);
518
  m_state->SetReceiveErrorCallback (callback);
516
}
519
}
520
517
void
521
void
518
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
522
YansWifiPhy::StartReceivePlcp (Ptr<Packet> packet,
519
                                 double rxPowerDbm,
523
                               double rxPowerDbm,
520
                                 WifiTxVector txVector,
524
                               WifiTxVector txVector,
521
                                 enum WifiPreamble preamble, 
525
                               enum WifiPreamble preamble,
522
                                 uint8_t packetType, Time rxDuration)
526
                               uint8_t packetType, Time rxDuration)
523
{
527
{
528
  // This function should be later split to check separately wether plcp preamble and plcp header can be successfully received.
529
  // Note: plcp preamble reception is not yet modeled.
524
  NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode()<< preamble << (uint32_t)packetType);
530
  NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode()<< preamble << (uint32_t)packetType);
525
  AmpduTag ampduTag;
531
  AmpduTag ampduTag;
532
  WifiMode txMode = txVector.GetMode();
533
  
526
  rxPowerDbm += m_rxGainDb;
534
  rxPowerDbm += m_rxGainDb;
527
  double rxPowerW = DbmToW (rxPowerDbm);
535
  double rxPowerW = DbmToW (rxPowerDbm);
528
  WifiMode txMode = txVector.GetMode();
529
  Time endRx = Simulator::Now () + rxDuration;
536
  Time endRx = Simulator::Now () + rxDuration;
537
  Time plcpDuration = CalculatePlcpDuration (txVector, preamble);
530
538
531
  Ptr<InterferenceHelper::Event> event;
539
  Ptr<InterferenceHelper::Event> event;
532
  event = m_interference.Add (packet->GetSize (),
540
  event = m_interference.Add (packet->GetSize (),
 Lines 534-546    Link Here 
534
                              preamble,
542
                              preamble,
535
                              rxDuration,
543
                              rxDuration,
536
                              rxPowerW,
544
                              rxPowerW,
537
		          txVector);  // we need it to calculate duration of HT training symbols
545
                              txVector);
538
546
    
539
  switch (m_state->GetState ())
547
  switch (m_state->GetState ())
540
    {
548
    {
541
    case YansWifiPhy::SWITCHING:
549
    case YansWifiPhy::SWITCHING:
542
      NS_LOG_DEBUG ("drop packet because of channel switching");
550
      NS_LOG_DEBUG ("drop packet because of channel switching");
543
      NotifyRxDrop (packet);
551
      NotifyRxDrop (packet);
552
      m_plcpSuccess = false;
544
      /*
553
      /*
545
       * Packets received on the upcoming channel are added to the event list
554
       * Packets received on the upcoming channel are added to the event list
546
       * during the switching state. This way the medium can be correctly sensed
555
       * during the switching state. This way the medium can be correctly sensed
 Lines 580-650    Link Here 
580
      break;
589
      break;
581
    case YansWifiPhy::CCA_BUSY:
590
    case YansWifiPhy::CCA_BUSY:
582
    case YansWifiPhy::IDLE:
591
    case YansWifiPhy::IDLE:
583
      if (rxPowerW > m_edThresholdW)
592
      if (rxPowerW > m_edThresholdW) //checked here, no need to check in the payload reception (current implementation assumes constant rx power over the packet duration)
584
        {
593
        {
585
          if (IsModeSupported (txMode) || IsMcsSupported(txMode))
594
          if (preamble == WIFI_PREAMBLE_NONE && m_mpdusNum == 0)
586
            {
595
            {
587
              if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0)
596
              NS_LOG_DEBUG ("drop packet because no preamble has been received");
588
                {
589
                  //received the first MPDU in an MPDU
590
                  m_mpdusNum = ampduTag.GetNoOfMpdus()-1;
591
                }
592
              else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
593
                {
594
                  //received the other MPDUs that are part of the A-MPDU
595
                  if (ampduTag.GetNoOfMpdus() < m_mpdusNum)
596
                    {
597
                      NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetNoOfMpdus());
598
                      m_mpdusNum = ampduTag.GetNoOfMpdus();
599
                    }
600
                  else
601
                      m_mpdusNum--;
602
                }
603
              else if (preamble != WIFI_PREAMBLE_NONE && m_mpdusNum > 0 )
604
                {
605
                  NS_LOG_DEBUG ("Didn't receive the last MPDUs from an A-MPDU " << m_mpdusNum);
606
                  m_mpdusNum = 0;
607
                }
608
              else if (preamble == WIFI_PREAMBLE_NONE && m_mpdusNum == 0)
609
                {
610
                  NS_LOG_DEBUG ("drop packet because no preamble has been received");
611
                  NotifyRxDrop (packet);
612
                  goto maybeCcaBusy;
613
                }
614
              NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
615
              // sync to signal
616
              m_state->SwitchToRx (rxDuration);
617
              NS_ASSERT (m_endRxEvent.IsExpired ());
618
              NotifyRxBegin (packet);
619
              m_interference.NotifyRxStart ();
620
              m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
621
                                                  packet,
622
                                                  event);
623
            }
624
          else
625
            {
626
              NS_LOG_DEBUG ("drop packet because it was sent using an unsupported mode (" << txMode << ")");
627
              NotifyRxDrop (packet);
597
              NotifyRxDrop (packet);
628
              goto maybeCcaBusy;
598
              goto maybeCcaBusy;
629
            }
599
            }
600
          else if (preamble == WIFI_PREAMBLE_NONE && m_plcpSuccess == false) // A-MPDU reception fails
601
            {
602
              NS_LOG_DEBUG ("Drop MPDU because no plcp has been received");
603
              NotifyRxDrop (packet);
604
              goto maybeCcaBusy;
605
            }
606
           else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0)
607
            {
608
              //received the first MPDU in an MPDU
609
              m_mpdusNum = ampduTag.GetNoOfMpdus()-1;
610
            }
611
           else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
612
            {
613
              //received the other MPDUs that are part of the A-MPDU
614
              if (ampduTag.GetNoOfMpdus() < m_mpdusNum)
615
                {
616
                    NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetNoOfMpdus());
617
                    m_mpdusNum = ampduTag.GetNoOfMpdus();
618
                }
619
              else
620
                m_mpdusNum--;
621
            }
622
          else if (preamble != WIFI_PREAMBLE_NONE && m_mpdusNum > 0 )
623
            {
624
              NS_LOG_DEBUG ("Didn't receive the last MPDUs from an A-MPDU " << m_mpdusNum);
625
              m_mpdusNum = 0;
626
            }
627
            
628
          NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
629
          // sync to signal
630
          m_state->SwitchToRx (rxDuration);
631
          NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
632
          NotifyRxBegin (packet);
633
          m_interference.NotifyRxStart ();
634
            
635
          if (preamble != WIFI_PREAMBLE_NONE)
636
          {
637
            NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
638
            m_endPlcpRxEvent = Simulator::Schedule (plcpDuration, &YansWifiPhy::StartReceivePacket, this,
639
                                                    packet, txVector, preamble, packetType, event);
640
          }
641
            
642
          NS_ASSERT (m_endRxEvent.IsExpired ());
643
          m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
644
                                              packet, preamble, packetType, event);
630
        }
645
        }
631
      else
646
      else
632
        {
647
        {
633
          NS_LOG_DEBUG ("drop packet because signal power too Small (" <<
648
          NS_LOG_DEBUG ("drop packet because signal power too Small (" <<
634
                        rxPowerW << "<" << m_edThresholdW << ")");
649
                        rxPowerW << "<" << m_edThresholdW << ")");
635
          NotifyRxDrop (packet);
650
          NotifyRxDrop (packet);
651
          m_plcpSuccess = false;
636
          goto maybeCcaBusy;
652
          goto maybeCcaBusy;
637
        }
653
        }
638
      break;
654
      break;
639
    case YansWifiPhy::SLEEP:
655
    case YansWifiPhy::SLEEP:
640
      NS_LOG_DEBUG ("drop packet because in sleep mode");
656
      NS_LOG_DEBUG ("drop packet because in sleep mode");
641
      NotifyRxDrop (packet);
657
      NotifyRxDrop (packet);
658
      m_plcpSuccess = false;
642
      break;
659
      break;
643
    }
660
    }
644
661
645
  return;
662
  return;
646
663
  
647
maybeCcaBusy:
664
  maybeCcaBusy:
648
  // We are here because we have received the first bit of a packet and we are
665
  // We are here because we have received the first bit of a packet and we are
649
  // not going to be able to synchronize on it
666
  // not going to be able to synchronize on it
650
  // In this model, CCA becomes busy when the aggregation of all signals as
667
  // In this model, CCA becomes busy when the aggregation of all signals as
 Lines 656-661    Link Here 
656
      m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
673
      m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
657
    }
674
    }
658
}
675
}
676
void
677
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
678
                                 WifiTxVector txVector,
679
                                 enum WifiPreamble preamble, 
680
                                 uint8_t packetType,
681
                                 Ptr<InterferenceHelper::Event> event)
682
{
683
  NS_LOG_FUNCTION (this << packet << txVector.GetMode()<< preamble << (uint32_t)packetType);
684
  NS_ASSERT (IsStateRx ());
685
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
686
  AmpduTag ampduTag;
687
  WifiMode txMode = txVector.GetMode();
688
  
689
  struct InterferenceHelper::SnrPer snrPer;
690
  snrPer = m_interference.CalculatePlcpHeaderSnrPer (event);
691
  
692
  NS_LOG_DEBUG ("snr=" << snrPer.snr << ", per=" << snrPer.per);
693
694
    if (m_random->GetValue () > snrPer.per) //plcp reception succeeded
695
      {
696
          if (IsModeSupported (txMode) || IsMcsSupported(txMode))
697
            {
698
              NS_LOG_DEBUG ("receiving plcp payload"); //endReceive is already scheduled
699
              m_plcpSuccess = true;
700
            }
701
          else //mode is not allowed
702
            {
703
              NS_LOG_DEBUG ("drop packet because it was sent using an unsupported mode (" << txMode << ")");
704
              NotifyRxDrop (packet);
705
              m_plcpSuccess = false;
706
            }
707
      }
708
    else //plcp reception failed
709
      {
710
        NS_LOG_DEBUG ("drop packet because plcp reception failed");
711
        NotifyRxDrop (packet);
712
        m_plcpSuccess = false;
713
      }
714
}
659
715
660
void
716
void
661
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
717
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
 Lines 668-674    Link Here 
668
   *  - we are idle
724
   *  - we are idle
669
   */
725
   */
670
  NS_ASSERT (!m_state->IsStateTx () && !m_state->IsStateSwitching ());
726
  NS_ASSERT (!m_state->IsStateTx () && !m_state->IsStateSwitching ());
671
727
  
672
  if (m_state->IsStateSleep ())
728
  if (m_state->IsStateSleep ())
673
    {
729
    {
674
      NS_LOG_DEBUG ("Dropping packet because in sleep mode");
730
      NS_LOG_DEBUG ("Dropping packet because in sleep mode");
 Lines 679-684    Link Here 
679
  Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble, GetFrequency(), packetType, 1);
735
  Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble, GetFrequency(), packetType, 1);
680
  if (m_state->IsStateRx ())
736
  if (m_state->IsStateRx ())
681
    {
737
    {
738
      m_endPlcpRxEvent.Cancel ();
682
      m_endRxEvent.Cancel ();
739
      m_endRxEvent.Cancel ();
683
      m_interference.NotifyRxEnd ();
740
      m_interference.NotifyRxEnd ();
684
    }
741
    }
 Lines 948-966    Link Here 
948
}
1005
}
949
1006
950
void
1007
void
951
YansWifiPhy::EndReceive (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event)
1008
YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event)
952
{
1009
{
953
  NS_LOG_FUNCTION (this << packet << event);
1010
  NS_LOG_FUNCTION (this << packet << event);
954
  NS_ASSERT (IsStateRx ());
1011
  NS_ASSERT (IsStateRx ());
955
  NS_ASSERT (event->GetEndTime () == Simulator::Now ());
1012
  NS_ASSERT (event->GetEndTime () == Simulator::Now ());
956
1013
957
  struct InterferenceHelper::SnrPer snrPer;
1014
  struct InterferenceHelper::SnrPer snrPer;
958
  snrPer = m_interference.CalculateSnrPer (event);
1015
  snrPer = m_interference.CalculatePlcpPayloadSnrPer (event);
959
  m_interference.NotifyRxEnd ();
1016
  m_interference.NotifyRxEnd ();
960
1017
  
961
  NS_LOG_DEBUG ("mode=" << (event->GetPayloadMode ().GetDataRate ()) <<
1018
  if (m_plcpSuccess == true)
962
                ", snr=" << snrPer.snr << ", per=" << snrPer.per << ", size=" << packet->GetSize ());
1019
  {
963
  if (m_random->GetValue () > snrPer.per)
1020
    NS_LOG_DEBUG ("mode=" << (event->GetPayloadMode ().GetDataRate ()) <<
1021
                  ", snr=" << snrPer.snr << ", per=" << snrPer.per << ", size=" << packet->GetSize ());
1022
  
1023
    if (m_random->GetValue () > snrPer.per)
964
    {
1024
    {
965
      NotifyRxEnd (packet);
1025
      NotifyRxEnd (packet);
966
      uint32_t dataRate500KbpsUnits;
1026
      uint32_t dataRate500KbpsUnits;
 Lines 978-989    Link Here 
978
      NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
1038
      NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
979
      m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());
1039
      m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());
980
    }
1040
    }
981
  else
1041
    else
982
    {
1042
    {
983
      /* failure. */
1043
      /* failure. */
984
      NotifyRxDrop (packet);
1044
      NotifyRxDrop (packet);
985
      m_state->SwitchFromRxEndError (packet, snrPer.snr);
1045
      m_state->SwitchFromRxEndError (packet, snrPer.snr);
986
    }
1046
    }
1047
  }
1048
  else
1049
  {
1050
    m_state->SwitchFromRxEndError (packet, snrPer.snr); //notify rx end
1051
  }
1052
    
1053
  if (preamble == WIFI_PREAMBLE_NONE && packetType == 2)
1054
    {
1055
      m_plcpSuccess = false;
1056
    }
1057
    
987
}
1058
}
988
1059
989
int64_t
1060
int64_t
(-)a/src/wifi/model/yans-wifi-phy.h (-6 / +24 lines)
 Lines 100-120    Link Here 
100
  double GetChannelFrequencyMhz () const;
100
  double GetChannelFrequencyMhz () const;
101
101
102
  /**
102
  /**
103
   * Starting receiving the packet (i.e. the first bit of the preamble has arrived).
103
   * Starting receiving the plcp of a packet (i.e. the first bit of the preamble has arrived).
104
   *
104
   *
105
   * \param packet the arriving packet
105
   * \param packet the arriving packet
106
   * \param rxPowerDbm the receive power in dBm
106
   * \param rxPowerDbm the receive power in dBm
107
   * \param txVector the TXVECTOR of the arriving packet
107
   * \param txVector the TXVECTOR of the arriving packet
108
   * \param preamble the preamble of the arriving packet
108
   * \param preamble the preamble of the arriving packet
109
   * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU) 
109
   * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU) 
110
   * \param rxDuration the duration needed for the reception of the arriving packet
110
   * \param rxDuration the duration needed for the reception of the packet
111
   */
112
  void StartReceivePlcp (Ptr<Packet> packet,
113
                         double rxPowerDbm,
114
                         WifiTxVector txVector,
115
                         WifiPreamble preamble,
116
                         uint8_t packetType,
117
                         Time rxDuration);
118
  /**
119
   * Starting receiving the payload of a packet (i.e. the first bit of the packet has arrived).
120
   *
121
   * \param packet the arriving packet
122
   * \param txVector the TXVECTOR of the arriving packet
123
   * \param preamble the preamble of the arriving packet
124
   * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU) 
125
   * \param event the corresponding event of the first time the packet arrives
111
   */
126
   */
112
  void StartReceivePacket (Ptr<Packet> packet,
127
  void StartReceivePacket (Ptr<Packet> packet,
113
                           double rxPowerDbm,
114
                           WifiTxVector txVector,
128
                           WifiTxVector txVector,
115
                           WifiPreamble preamble,
129
                           WifiPreamble preamble,
116
                           uint8_t packetType,
130
                           uint8_t packetType,
117
                           Time rxDuration);
131
                           Ptr<InterferenceHelper::Event> event);
118
132
119
  /**
133
  /**
120
   * Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
134
   * Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
 Lines 462-474    Link Here 
462
   * The last bit of the packet has arrived.
476
   * The last bit of the packet has arrived.
463
   *
477
   *
464
   * \param packet the packet that the last bit has arrived
478
   * \param packet the packet that the last bit has arrived
479
   * \param preamble the preamble of the arriving packet
480
   * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
465
   * \param event the corresponding event of the first time the packet arrives
481
   * \param event the corresponding event of the first time the packet arrives
466
   */
482
   */
467
  void EndReceive (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event);
483
  void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event);
468
484
469
private:
485
private:
470
  virtual void DoInitialize (void);
486
  virtual void DoInitialize (void);
471
487
  
472
  bool     m_initialized;         //!< Flag for runtime initialization
488
  bool     m_initialized;         //!< Flag for runtime initialization
473
  double   m_edThresholdW;        //!< Energy detection threshold in watts
489
  double   m_edThresholdW;        //!< Energy detection threshold in watts
474
  double   m_ccaMode1ThresholdW;  //!< Clear channel assessment (CCA) threshold in watts
490
  double   m_ccaMode1ThresholdW;  //!< Clear channel assessment (CCA) threshold in watts
 Lines 533-538    Link Here 
533
  std::vector<uint32_t> m_bssMembershipSelectorSet;
549
  std::vector<uint32_t> m_bssMembershipSelectorSet;
534
  std::vector<uint8_t> m_deviceMcsSet;
550
  std::vector<uint8_t> m_deviceMcsSet;
535
  EventId m_endRxEvent;
551
  EventId m_endRxEvent;
552
  EventId m_endPlcpRxEvent;
536
553
537
  Ptr<UniformRandomVariable> m_random;  //!< Provides uniform random variables.
554
  Ptr<UniformRandomVariable> m_random;  //!< Provides uniform random variables.
538
  double m_channelStartingFrequency;    //!< Standard-dependent center frequency of 0-th channel in MHz
555
  double m_channelStartingFrequency;    //!< Standard-dependent center frequency of 0-th channel in MHz
 Lines 540-545    Link Here 
540
  InterferenceHelper m_interference;    //!< Pointer to InterferenceHelper
557
  InterferenceHelper m_interference;    //!< Pointer to InterferenceHelper
541
  Time m_channelSwitchDelay;            //!< Time required to switch between channel
558
  Time m_channelSwitchDelay;            //!< Time required to switch between channel
542
  uint16_t m_mpdusNum;                  //!< carries the number of expected mpdus that are part of an A-MPDU
559
  uint16_t m_mpdusNum;                  //!< carries the number of expected mpdus that are part of an A-MPDU
560
  bool m_plcpSuccess;                   //!< Flag if the PLCP of the packet or the first MPDU in an A-MPDU has been received
543
};
561
};
544
562
545
} // namespace ns3
563
} // namespace ns3

Return to bug 2066