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::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, int evFlags=0) 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::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string printToString () const
 
virtual std::string printToString (int level, int evFlags=0) const
 
virtual std::string getInfoStringRepresentation (int evFlags=0) const
 
virtual std::string getDetailStringRepresentation (int evFlags=0) const
 
virtual std::string getDebugStringRepresentation (int evFlags=0) const
 
virtual std::string getTraceStringRepresentation (int evFlags=0) const
 
virtual std::string getCompleteStringRepresentation (int evFlags=0) const
 

Static Public Attributes

static const DsssOqpsk16Modulation singleton
 

Additional Inherited Members

- Public Types inherited from inet::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
enum  PrintFlag { PRINT_FLAG_FORMATTED = (1 << 0), PRINT_FLAG_MULTILINE = (1 << 1) }
 
- Static Public Member Functions inherited from inet::physicallayer::ApskModulationBase
const static 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

◆ DsssOqpsk16Modulation()

inet::physicallayer::DsssOqpsk16Modulation::DsssOqpsk16Modulation ( )
16  :
17  // TODO fill in the correct real and imaginary parts
18  ApskModulationBase(new std::vector<ApskSymbol>({ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN),
19  ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN),
20  ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN),
21  ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN), ApskSymbol(NaN, NaN)}))
22 {
23 }

◆ ~DsssOqpsk16Modulation()

inet::physicallayer::DsssOqpsk16Modulation::~DsssOqpsk16Modulation ( )
virtual
25  {
26  delete constellation;
27 }

Member Function Documentation

◆ calculateBER()

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.

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

◆ calculateSER()

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.

78 {
79  return NAN;
80 }

Member Data Documentation

◆ singleton

const DsssOqpsk16Modulation inet::physicallayer::DsssOqpsk16Modulation::singleton
static

The documentation for this class was generated from the following files:
inet::physicallayer::ApskModulationBase::ApskModulationBase
ApskModulationBase(const std::vector< ApskSymbol > *constellation)
Definition: ApskModulationBase.cc:23
inet::units::units::kbps
kilo< bps >::type kbps
Definition: Units.h:1170
NaN
#define NaN
Definition: INETMath.h:91
inet::physicallayer::k
const double k
Definition: Qam1024Modulation.cc:14
inet::math::n_choose_k
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:194
inet::physicallayer::ApskModulationBase::constellation
const std::vector< ApskSymbol > * constellation
Definition: ApskModulationBase.h:25
inet::units::units::MHz
mega< Hz >::type MHz
Definition: Units.h:1083