A Discrete-Event Network Simulator
API
interference-helper.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #include "interference-helper.h"
21 #include "wifi-phy.h"
22 #include "error-rate-model.h"
23 #include "ns3/simulator.h"
24 #include "ns3/log.h"
25 #include <algorithm>
26 
27 namespace ns3 {
28 
29 NS_LOG_COMPONENT_DEFINE ("InterferenceHelper");
30 
31 /****************************************************************
32  * Phy event class
33  ****************************************************************/
34 
36  enum WifiPreamble preamble,
37  Time duration, double rxPower)
38  : m_size (size),
39  m_txVector (txVector),
40  m_preamble (preamble),
41  m_startTime (Simulator::Now ()),
42  m_endTime (m_startTime + duration),
43  m_rxPowerW (rxPower)
44 {
45 }
47 {
48 }
49 
50 Time
52 {
53  return m_endTime - m_startTime;
54 }
55 Time
57 {
58  return m_startTime;
59 }
60 Time
62 {
63  return m_endTime;
64 }
65 double
67 {
68  return m_rxPowerW;
69 }
70 uint32_t
72 {
73  return m_size;
74 }
77 {
78  return m_txVector;
79 }
82 {
83  return m_txVector.GetMode();
84 }
85 enum WifiPreamble
87 {
88  return m_preamble;
89 }
90 
91 
92 /****************************************************************
93  * Class which records SNIR change events for a
94  * short period of time.
95  ****************************************************************/
96 
98  : m_time (time),
99  m_delta (delta)
100 {
101 }
102 Time
104 {
105  return m_time;
106 }
107 double
109 {
110  return m_delta;
111 }
112 bool
114 {
115  return (m_time < o.m_time);
116 }
117 
118 /****************************************************************
119  * The actual InterferenceHelper
120  ****************************************************************/
121 
123  : m_errorRateModel (0),
124  m_firstPower (0.0),
125  m_rxing (false)
126 {
127 }
129 {
130  EraseEvents ();
131  m_errorRateModel = 0;
132 }
133 
135 InterferenceHelper::Add (uint32_t size, WifiTxVector txVector,
136  enum WifiPreamble preamble,
137  Time duration, double rxPowerW)
138 {
140 
141  event = Create<InterferenceHelper::Event> (size,
142  txVector,
143  preamble,
144  duration,
145  rxPowerW);
146  AppendEvent (event);
147  return event;
148 }
149 
150 
151 void
153 {
154  m_noiseFigure = value;
155 }
156 
157 double
159 {
160  return m_noiseFigure;
161 }
162 
163 void
165 {
166  m_errorRateModel = rate;
167 }
168 
171 {
172  return m_errorRateModel;
173 }
174 
175 Time
177 {
178  Time now = Simulator::Now ();
179  double noiseInterferenceW = 0.0;
180  Time end = now;
181  noiseInterferenceW = m_firstPower;
182  for (NiChanges::const_iterator i = m_niChanges.begin (); i != m_niChanges.end (); i++)
183  {
184  noiseInterferenceW += i->GetDelta ();
185  end = i->GetTime ();
186  if (end < now)
187  {
188  continue;
189  }
190  if (noiseInterferenceW < energyW)
191  {
192  break;
193  }
194  }
195  return end > now ? end - now : MicroSeconds (0);
196 }
197 
198 void
200 {
201  Time now = Simulator::Now ();
202  if (!m_rxing)
203  {
204  NiChanges::iterator nowIterator = GetPosition (now);
205  for (NiChanges::iterator i = m_niChanges.begin (); i != nowIterator; i++)
206  {
207  m_firstPower += i->GetDelta ();
208  }
209  m_niChanges.erase (m_niChanges.begin (), nowIterator);
210  m_niChanges.insert (m_niChanges.begin (), NiChange (event->GetStartTime (), event->GetRxPowerW ()));
211  }
212  else
213  {
214  AddNiChangeEvent (NiChange (event->GetStartTime (), event->GetRxPowerW ()));
215  }
216  AddNiChangeEvent (NiChange (event->GetEndTime (), -event->GetRxPowerW ()));
217 
218 }
219 
220 
221 double
222 InterferenceHelper::CalculateSnr (double signal, double noiseInterference, WifiMode mode) const
223 {
224  // thermal noise at 290K in J/s = W
225  static const double BOLTZMANN = 1.3803e-23;
226  // Nt is the power of thermal noise in W
227  double Nt = BOLTZMANN * 290.0 * mode.GetBandwidth ();
228  // receiver noise Floor (W) which accounts for thermal noise and non-idealities of the receiver
229  double noiseFloor = m_noiseFigure * Nt;
230  double noise = noiseFloor + noiseInterference;
231  double snr = signal / noise;
232  return snr;
233 }
234 
235 double
237 {
238  double noiseInterference = m_firstPower;
239  NS_ASSERT (m_rxing);
240  for (NiChanges::const_iterator i = m_niChanges.begin () + 1; i != m_niChanges.end (); i++)
241  {
242  if ((event->GetEndTime () == i->GetTime ()) && event->GetRxPowerW () == -i->GetDelta ())
243  {
244  break;
245  }
246  ni->push_back (*i);
247  }
248  ni->insert (ni->begin (), NiChange (event->GetStartTime (), noiseInterference));
249  ni->push_back (NiChange (event->GetEndTime (), 0));
250  return noiseInterference;
251 }
252 
253 double
255 {
256  if (duration == NanoSeconds (0))
257  {
258  return 1.0;
259  }
260  uint32_t rate = mode.GetPhyRate ();
261  uint64_t nbits = (uint64_t)(rate * duration.GetSeconds ());
262  double csr = m_errorRateModel->GetChunkSuccessRate (mode, snir, (uint32_t)nbits);
263  return csr;
264 }
265 
266 double
268 {
269  double psr = 1.0; /* Packet Success Rate */
270  NiChanges::iterator j = ni->begin ();
271  Time previous = (*j).GetTime ();
272  WifiMode payloadMode = event->GetPayloadMode ();
273  WifiPreamble preamble = event->GetPreambleType ();
274  Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (payloadMode, preamble); //packet start time+ preamble
275  Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (payloadMode, preamble);//packet start time+ preamble+L SIG
276  Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble);//packet start time+ preamble+L SIG+HT SIG
277  Time plcpPayloadStart =plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble,event->GetTxVector()); //packet start time+ preamble+L SIG+HT SIG+Training
278  double noiseInterferenceW = (*j).GetDelta ();
279  double powerW = event->GetRxPowerW ();
280  j++;
281  while (ni->end () != j)
282  {
283  Time current = (*j).GetTime ();
284  NS_ASSERT (current >= previous);
285  //Case 1: Both prev and curr point to the payload
286  if (previous >= plcpPayloadStart)
287  {
288  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
289  noiseInterferenceW,
290  payloadMode),
291  current - previous,
292  payloadMode);
293  }
294  //Case 2: previous is before payload
295  else if (previous >= plcpHtTrainingSymbolsStart)
296  {
297  //Case 2a: current is after payload
298  if (current >= plcpPayloadStart)
299  {
300  //Case 2ai and 2aii: All formats
301  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
302  noiseInterferenceW,
303  payloadMode),
304  current - plcpPayloadStart,
305  payloadMode);
306 
307  }
308  }
309  //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
310  else if (previous >= plcpHsigHeaderStart)
311  {
312  //Case 3a: cuurent after payload start
313  if (current >= plcpPayloadStart)
314  {
315  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
316  noiseInterferenceW,
317  payloadMode),
318  current - plcpPayloadStart,
319  payloadMode);
320 
321  }
322 
323  }
324  //Case 4: previous in L-SIG: GF will not reach here because it will execute the previous if and exit
325  else if (previous >= plcpHeaderStart)
326  {
327  //Case 4a: current after payload start
328  if (current >= plcpPayloadStart)
329  {
330  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
331  noiseInterferenceW,
332  payloadMode),
333  current - plcpPayloadStart,
334  payloadMode);
335 
336  }
337  }
338  //Case 5: previous is in the preamble works for all cases
339  else
340  {
341  if (current >= plcpPayloadStart)
342  {
343  //for all
344  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
345  noiseInterferenceW,
346  payloadMode),
347  current - plcpPayloadStart,
348  payloadMode);
349 
350  }
351  }
352 
353  noiseInterferenceW += (*j).GetDelta ();
354  previous = (*j).GetTime ();
355  j++;
356  }
357 
358  double per = 1 - psr;
359  return per;
360 }
361 
362 double
364 {
365  double psr = 1.0; /* Packet Success Rate */
366  NiChanges::iterator j = ni->begin ();
367  Time previous = (*j).GetTime ();
368  WifiMode payloadMode = event->GetPayloadMode ();
369  WifiPreamble preamble = event->GetPreambleType ();
370  WifiMode MfHeaderMode ;
371  if (preamble == WIFI_PREAMBLE_HT_MF)
372  {
373  MfHeaderMode = WifiPhy::GetMFPlcpHeaderMode (payloadMode, preamble); //return L-SIG mode
374  }
375  WifiMode headerMode = WifiPhy::GetPlcpHeaderMode (payloadMode, preamble);
376  Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (payloadMode, preamble); // packet start time + preamble
377  Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (payloadMode, preamble); // packet start time + preamble+L SIG
378  Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble); // packet start time + preamble + L SIG + HT SIG
379  Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble, event->GetTxVector()); // packet start time + preamble + L SIG + HT SIG + Training
380  double noiseInterferenceW = (*j).GetDelta ();
381  double powerW = event->GetRxPowerW ();
382  j++;
383  while (ni->end () != j)
384  {
385  Time current = (*j).GetTime ();
386  NS_ASSERT (current >= previous);
387  //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
388  if (previous >= plcpHsigHeaderStart)
389  {
390  //Case 1a: cuurent after payload start
391  if (current >= plcpPayloadStart)
392  {
393 
394 
395  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
396  noiseInterferenceW,
397  headerMode),
398  plcpHtTrainingSymbolsStart - previous,
399  headerMode);
400  }
401  //case 1b: current after HT training symbols start
402  else if (current >=plcpHtTrainingSymbolsStart)
403  {
404  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
405  noiseInterferenceW,
406  headerMode),
407  plcpHtTrainingSymbolsStart - previous,
408  headerMode);
409 
410  }
411  //Case 1c: current is with previous in HT sig
412  else
413  {
414  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
415  noiseInterferenceW,
416  headerMode),
417  current - previous,
418  headerMode);
419 
420  }
421  }
422  // Case 2: previous in L-SIG: GF will not reach here because it will execute the previous if and exit
423  else if (previous >= plcpHeaderStart)
424  {
425  // Case 2a: current after payload start
426  if (current >= plcpPayloadStart)
427  {
428  // Case 2ai: Non HT format (No HT-SIG or Training Symbols)
429  if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT) //plcpHtTrainingSymbolsStart==plcpHeaderStart)
430  {
431  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
432  noiseInterferenceW,
433  headerMode),
434  plcpPayloadStart - previous,
435  headerMode);
436  }
437  else
438  {
439  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
440  noiseInterferenceW,
441  headerMode),
442  plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
443  headerMode);
444  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
445  noiseInterferenceW,
446  MfHeaderMode),
447  plcpHsigHeaderStart - previous,
448  MfHeaderMode);
449  }
450  }
451  // 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
452  else if (current >= plcpHtTrainingSymbolsStart)
453  {
454  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
455  noiseInterferenceW,
456  headerMode),
457  plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
458  headerMode);
459  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
460  noiseInterferenceW,
461  MfHeaderMode),
462  plcpHsigHeaderStart - previous,
463  MfHeaderMode);
464  }
465  // 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
466  else if (current >= plcpHsigHeaderStart)
467  {
468  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
469  noiseInterferenceW,
470  headerMode),
471  current - plcpHsigHeaderStart,
472  headerMode);
473  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
474  noiseInterferenceW,
475  MfHeaderMode),
476  plcpHsigHeaderStart - previous,
477  MfHeaderMode);
478 
479  }
480  // Case 2d: Current with prev in L SIG
481  else
482  {
483  // Case 4di: Non HT format (No HT-SIG or Training Symbols)
484  if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT) //plcpHtTrainingSymbolsStart==plcpHeaderStart)
485  {
486  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
487  noiseInterferenceW,
488  headerMode),
489  current - previous,
490  headerMode);
491  }
492  else
493  {
494  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
495  noiseInterferenceW,
496  MfHeaderMode),
497  current - previous,
498  MfHeaderMode);
499  }
500  }
501  }
502  // Case 3: previous is in the preamble works for all cases
503  else
504  {
505  if (current >= plcpPayloadStart)
506  {
507  // Non HT format (No HT-SIG or Training Symbols)
508  if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT)
509  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
510  noiseInterferenceW,
511  headerMode),
512  plcpPayloadStart - plcpHeaderStart,
513  headerMode);
514  else
515  // Greenfield or Mixed format
516  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
517  noiseInterferenceW,
518  headerMode),
519  plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
520  headerMode);
521  if (preamble == WIFI_PREAMBLE_HT_MF)
522  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
523  noiseInterferenceW,
524  MfHeaderMode),
525  plcpHsigHeaderStart-plcpHeaderStart,
526  MfHeaderMode);
527  }
528  else if (current >= plcpHtTrainingSymbolsStart )
529  {
530  // Non HT format will not come here since it will execute prev if
531  // Greenfield or Mixed format
532  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
533  noiseInterferenceW,
534  headerMode),
535  plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
536  headerMode);
537  // Greenfield
538  if (preamble == WIFI_PREAMBLE_HT_MF)
539  {
540  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
541  noiseInterferenceW,
542  MfHeaderMode),
543  plcpHsigHeaderStart-plcpHeaderStart,
544  MfHeaderMode);
545  }
546  }
547  // non HT will not come here
548  else if (current >= plcpHsigHeaderStart)
549  {
550  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
551  noiseInterferenceW,
552  headerMode),
553  current- plcpHsigHeaderStart,
554  headerMode);
555  if (preamble != WIFI_PREAMBLE_HT_GF)
556  {
557  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
558  noiseInterferenceW,
559  MfHeaderMode),
560  plcpHsigHeaderStart-plcpHeaderStart,
561  MfHeaderMode);
562  }
563  }
564  // GF will not come here
565  else if (current >= plcpHeaderStart)
566  {
567  if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT)
568  {
569  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
570  noiseInterferenceW,
571  headerMode),
572  current - plcpHeaderStart,
573  headerMode);
574  }
575  else
576  {
577  psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
578  noiseInterferenceW,
579  MfHeaderMode),
580  current - plcpHeaderStart,
581  MfHeaderMode);
582  }
583  }
584  }
585 
586  noiseInterferenceW += (*j).GetDelta ();
587  previous = (*j).GetTime ();
588  j++;
589  }
590 
591  double per = 1 - psr;
592  return per;
593 }
594 
596 InterferenceHelper::CalculatePlcpPayloadSnrPer (Ptr<InterferenceHelper::Event> event)
597 {
598  NiChanges ni;
599  double noiseInterferenceW = CalculateNoiseInterferenceW (event, &ni);
600  double snr = CalculateSnr (event->GetRxPowerW (),
601  noiseInterferenceW,
602  event->GetPayloadMode ());
603 
604  /* calculate the SNIR at the start of the packet and accumulate
605  * all SNIR changes in the snir vector.
606  */
607  double per = CalculatePlcpPayloadPer (event, &ni);
608 
609  struct SnrPer snrPer;
610  snrPer.snr = snr;
611  snrPer.per = per;
612  return snrPer;
613 }
614 
616 InterferenceHelper::CalculatePlcpHeaderSnrPer (Ptr<InterferenceHelper::Event> event)
617 {
618  NiChanges ni;
619  double noiseInterferenceW = CalculateNoiseInterferenceW (event, &ni);
620  double snr = CalculateSnr (event->GetRxPowerW (),
621  noiseInterferenceW,
622  WifiPhy::GetPlcpHeaderMode (event->GetPayloadMode (), event->GetPreambleType ()));
623 
624  /* calculate the SNIR at the start of the plcp header and accumulate
625  * all SNIR changes in the snir vector.
626  */
627  double per = CalculatePlcpHeaderPer (event, &ni);
628 
629  struct SnrPer snrPer;
630  snrPer.snr = snr;
631  snrPer.per = per;
632  return snrPer;
633 }
634 
635 void
637 {
638  m_niChanges.clear ();
639  m_rxing = false;
640  m_firstPower = 0.0;
641 }
642 InterferenceHelper::NiChanges::iterator
644 {
645  return std::upper_bound (m_niChanges.begin (), m_niChanges.end (), NiChange (moment, 0));
646 
647 }
648 void
650 {
651  m_niChanges.insert (GetPosition (change.GetTime ()), change);
652 }
653 void
655 {
656  m_rxing = true;
657 }
658 void
660 {
661  m_rxing = false;
662 }
663 } // namespace ns3
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
A struct for both SNR and PER.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Control the scheduling of simulation events.
Definition: simulator.h:70
Ptr< ErrorRateModel > GetErrorRateModel(void) const
Return the error rate model.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
bool operator<(const NiChange &o) const
Compare the event time of two NiChange objects (a < o).
std::vector< NiChange > NiChanges
typedef for a vector of NiChanges
handles interference calculations
static Time GetPlcpHtSigHeaderDuration(WifiPreamble preamble)
Definition: wifi-phy.cc:173
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
Time GetEnergyDuration(double energyW)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
static WifiMode GetMFPlcpHeaderMode(WifiMode payloadMode, WifiPreamble preamble)
Definition: wifi-phy.cc:122
double GetRxPowerW(void) const
Return the receive power (w).
Ptr< ErrorRateModel > m_errorRateModel
NiChanges::iterator GetPosition(Time moment)
Returns an iterator to the first nichange, which is later than moment.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:93
uint32_t GetSize(void) const
Return the size of the packet (bytes).
double CalculateChunkSuccessRate(double snir, Time duration, WifiMode mode) const
Calculate the success rate of the chunk given the SINR, duration, and Wi-Fi mode. ...
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:29
void SetErrorRateModel(Ptr< ErrorRateModel > rate)
Set the error rate model for this interference helper.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:334
double CalculateNoiseInterferenceW(Ptr< Event > event, NiChanges *ni) const
Calculate noise and interference power in W.
Time GetStartTime(void) const
Return the start time of the signal.
WifiTxVector GetTxVector(void) const
Return the TXVECTOR of the packet.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:890
NiChanges m_niChanges
Experimental: needed for energy duration calculation.
void AddNiChangeEvent(NiChange change)
Add NiChange to the list at the appropriate position.
static WifiMode GetPlcpHeaderMode(WifiMode payloadMode, WifiPreamble preamble)
Definition: wifi-phy.cc:190
Time GetTime(void) const
Return the event time.
double CalculatePlcpPayloadPer(Ptr< const Event > event, NiChanges *ni) const
Calculate the error rate of the given plcp payload.
uint32_t GetBandwidth(void) const
Definition: wifi-mode.cc:67
static Time GetPlcpHeaderDuration(WifiMode payloadMode, WifiPreamble preamble)
Definition: wifi-phy.cc:263
double m_noiseFigure
noise figure (linear)
static Time GetPlcpHtTrainingSymbolDuration(WifiPreamble preamble, WifiTxVector txvector)
Definition: wifi-phy.cc:136
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void NotifyRxStart()
Notify that RX has started.
Noise and Interference (thus Ni) event.
void EraseEvents(void)
Erase all events.
Ptr< InterferenceHelper::Event > Add(uint32_t size, WifiTxVector txvector, enum WifiPreamble preamble, Time duration, double rxPower)
Add the packet-related signal to interference helper.
uint64_t GetPhyRate(void) const
Definition: wifi-mode.cc:73
double CalculatePlcpHeaderPer(Ptr< const Event > event, NiChanges *ni) const
Calculate the error rate of the plcp header.
double GetDelta(void) const
Return the power.
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:223
Time GetEndTime(void) const
Return the end time of the signal.
enum WifiPreamble GetPreambleType(void) const
Return the preamble type of the packet.
void NotifyRxEnd()
Notify that RX has ended.
NiChange(Time time, double delta)
Create a NiChange at the given time and the amount of NI change.
Time GetDuration(void) const
Return the duration of the signal.
void SetNoiseFigure(double value)
Set the noise figure.
WifiMode GetPayloadMode(void) const
Return the Wi-Fi mode used for the payload.
double CalculateSnr(double signal, double noiseInterference, WifiMode mode) const
Calculate SNR (linear ratio) from the given signal power and noise+interference power.
void AppendEvent(Ptr< Event > event)
Append the given Event.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:882
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:330
double GetNoiseFigure(void) const
Return the noise figure.
Event(uint32_t size, WifiTxVector txvector, enum WifiPreamble preamble, Time duration, double rxPower)
Create an Event with the given parameters.
static Time GetPlcpPreambleDuration(WifiMode payloadMode, WifiPreamble preamble)
Definition: wifi-phy.cc:330