INET Framework for OMNeT++/OMNEST
inet::physicallayer::DSSSOQPSK16Modulation Class Reference

#include <DSSSOQPSK16Modulation.h>

Inheritance diagram for inet::physicallayer::DSSSOQPSK16Modulation:
inet::physicallayer::APSKModulationBase inet::physicallayer::IAPSKModulation inet::physicallayer::IModulation inet::physicallayer::IPrintableObject

Public Member Functions

 DSSSOQPSK16Modulation ()
 
virtual ~DSSSOQPSK16Modulation ()
 
double calculateBER (double snir, Hz bandwidth, bps bitrate) const override
 Returns the bit error rate as a function of the signal to noise and interference ratio, the bandwidth, and the gross (physical) bitrate. More...
 
double calculateSER (double snir, Hz bandwidth, bps bitrate) const override
 Returns the symbol error rate as a function of the signal to noise and interference ratio, the bandwidth, and the gross (physical) bitrate. More...
 
- Public Member Functions inherited from inet::physicallayer::APSKModulationBase
 APSKModulationBase (const std::vector< APSKSymbol > *constellation)
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual const std::vector< APSKSymbol > * getConstellation () const
 
virtual unsigned int getConstellationSize () const override
 
virtual unsigned int getCodeWordSize () const override
 
virtual const APSKSymbolmapToConstellationDiagram (const ShortBitVector &symbol) const
 
virtual ShortBitVector demapToBitRepresentation (const APSKSymbol *symbol) const
 
- Public Member Functions inherited from inet::physicallayer::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string getInfoStringRepresentation () const
 
virtual std::string getDetailStringRepresentation () const
 
virtual std::string getDebugStringRepresentation () const
 
virtual std::string getTraceStringRepresentation () const
 
virtual std::string getCompleteStringRepresentation () const
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
- Static Public Member Functions inherited from inet::physicallayer::APSKModulationBase
static const APSKModulationBasefindModulation (const char *name)
 
- Protected Attributes inherited from inet::physicallayer::APSKModulationBase
const std::vector< APSKSymbol > * constellation
 
const unsigned int codeWordSize
 
const unsigned int constellationSize
 

Constructor & Destructor Documentation

inet::physicallayer::DSSSOQPSK16Modulation::DSSSOQPSK16Modulation ( )
24  :
25  APSKModulationBase(new std::vector<APSKSymbol>())
26 {
27 }
APSKModulationBase(const std::vector< APSKSymbol > *constellation)
Definition: APSKModulationBase.cc:32
inet::physicallayer::DSSSOQPSK16Modulation::~DSSSOQPSK16Modulation ( )
virtual
29  {
30  delete constellation;
31 }
const std::vector< APSKSymbol > * constellation
Definition: APSKModulationBase.h:35

Member Function Documentation

double inet::physicallayer::DSSSOQPSK16Modulation::calculateBER ( double  snir,
Hz  bandwidth,
bps  bitrate 
) const
overridevirtual

Returns the bit error rate as a function of the signal to noise and interference ratio, the bandwidth, and the gross (physical) bitrate.

Implements inet::physicallayer::IModulation.

34 {
35  // Taken from MiXiM 802.15.4 decider by Karl Wessel
36  // Valid for IEEE 802.15.4 2.45 GHz OQPSK modulation
37  // Following formula is defined in IEEE 802.15.4 standard, please check the
38  // 2006 standard, page 268, section E.4.1.8 Bit error rate (BER)
39  // calculations, formula 7). Here you can see that the factor of 20.0 is correct ;).
40 
41  // without these, the calculation does not make sense
42  ASSERT(bandwidth >= MHz(2));
43  ASSERT(bitrate == kbps(250));
44 
45  const double dSNRFct = 20.0 * snir;
46  double dSumK = 0;
47  register int k = 2;
48 
49  /* following loop was optimized by using n_choose_k symmetries
50  for (k=2; k <= 16; ++k) {
51  dSumK += pow(-1.0, k) * n_choose_k(16, k) * exp(dSNRFct * (1.0 / k - 1.0));
52  }
53  */
54 
55  // n_choose_k(16, k) == n_choose_k(16, 16-k)
56  for ( ; k < 8; k += 2) {
57  // k will be 2, 4, 6 (symmetric values: 14, 12, 10)
58  dSumK += math::n_choose_k(16, k) * (exp(dSNRFct * (1.0 / k - 1.0)) + exp(dSNRFct * (1.0 / (16 - k) - 1.0)));
59  }
60 
61  // for k = 8 (which does not have a symmetric value)
62  k = 8;
63  dSumK += math::n_choose_k(16, k) * exp(dSNRFct * (1.0 / k - 1.0));
64  for (k = 3; k < 8; k += 2) {
65  // k will be 3, 5, 7 (symmetric values: 13, 11, 9)
66  dSumK -= math::n_choose_k(16, k) * (exp(dSNRFct * (1.0 / k - 1.0)) + exp(dSNRFct * (1.0 / (16 - k) - 1.0)));
67  }
68 
69  // for k = 15 (because of missing k=1 value)
70  k = 15;
71  dSumK -= math::n_choose_k(16, k) * exp(dSNRFct * (1.0 / k - 1.0));
72 
73  // for k = 16 (because of missing k=0 value)
74  k = 16;
75  dSumK += math::n_choose_k(16, k) * exp(dSNRFct * (1.0 / k - 1.0));
76  return (8.0 / 15) * (1.0 / 16) * dSumK;
77 }
scale< bps, 1, 1000 > kbps
Definition: Units.h:986
double n_choose_k(int n, int k)
Implementation of the n choose k (binomial coefficient) function, from the MiXiM Framework Author Kar...
Definition: INETMath.h:197
mega< Hz >::type MHz
Definition: Units.h:906
const double k
Definition: QAM16Modulation.cc:24
double inet::physicallayer::DSSSOQPSK16Modulation::calculateSER ( double  snir,
Hz  bandwidth,
bps  bitrate 
) const
overridevirtual

Returns the symbol error rate as a function of the signal to noise and interference ratio, the bandwidth, and the gross (physical) bitrate.

Implements inet::physicallayer::IModulation.

80 {
81  return NAN;
82 }

The documentation for this class was generated from the following files: