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

#include <Ieee80211OFDMInterleaver.h>

Inheritance diagram for inet::physicallayer::Ieee80211OFDMInterleaver:
inet::physicallayer::IInterleaver inet::physicallayer::IPrintableObject

Public Member Functions

 Ieee80211OFDMInterleaver (const Ieee80211OFDMInterleaving *interleaving)
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
BitVector interleave (const BitVector &bits) const override
 
BitVector deinterleave (const BitVector &bits) const override
 
int getNumberOfCodedBitsPerSymbol () const
 
int getNumberOfCodedBitsPerSubcarrier () const
 
const Ieee80211OFDMInterleavinggetInterleaving () const override
 
- 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
 

Protected Attributes

int numberOfCodedBitsPerSymbol
 
int numberOfCodedBitsPerSubcarrier
 
int s
 
const Ieee80211OFDMInterleavinginterleaving = nullptr
 

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
}
 

Constructor & Destructor Documentation

inet::physicallayer::Ieee80211OFDMInterleaver::Ieee80211OFDMInterleaver ( const Ieee80211OFDMInterleaving interleaving)
78 {
82 }
int getNumberOfCodedBitsPerSubcarrier() const
Definition: Ieee80211OFDMInterleaving.h:38
const Ieee80211OFDMInterleaving * interleaving
Definition: Ieee80211OFDMInterleaver.h:42
double max(double a, double b)
Returns the greater of the given parameters.
Definition: INETMath.h:161
int numberOfCodedBitsPerSymbol
Definition: Ieee80211OFDMInterleaver.h:39
int getNumberOfCodedBitsPerSymbol() const
Definition: Ieee80211OFDMInterleaving.h:39
int numberOfCodedBitsPerSubcarrier
Definition: Ieee80211OFDMInterleaver.h:40
int s
Definition: Ieee80211OFDMInterleaver.h:41

Member Function Documentation

BitVector inet::physicallayer::Ieee80211OFDMInterleaver::deinterleave ( const BitVector bits) const
overridevirtual

Implements inet::physicallayer::IInterleaver.

Referenced by inet::physicallayer::Ieee80211OFDMInterleaverModule::deinterleave().

56 {
57  if (interleavedBits.getSize() % numberOfCodedBitsPerSymbol)
58  throw cRuntimeError("interleavedBits length must be a multiple of numberOfCodedBitsPerSymbol = %d", numberOfCodedBitsPerSymbol);
59  EV_DEBUG << "Deinterleaving the following bits: " << interleavedBits << endl;
60  int numberOfSymbols = interleavedBits.getSize() / numberOfCodedBitsPerSymbol;
61  BitVector deinterleavedBits;
62  for (int i = 0; i < numberOfSymbols; i++) {
63  for (int j = 0; j < numberOfCodedBitsPerSymbol; j++) {
64  // i = s × Floor(j/s) + (j + Floor(16 × j/N_CBPS )) mod s, j = 0,1,... N CBPS - 1,
65  // where s = max(N_BPSC / 2, 1).
66  int firstPerm = s * floor(j / s) + (j + (int)floor(16 * j / numberOfCodedBitsPerSymbol)) % s;
67  // k = 16 × i - (N_CBPS - 1)Floor(16 × i/N_CBPS ), i = 0,1,... N_CBPS - 1
68  int secondPerm = 16 * firstPerm - (numberOfCodedBitsPerSymbol - 1) * floor(16 * firstPerm / numberOfCodedBitsPerSymbol);
69  int shiftedSecondPerm = secondPerm + i * numberOfCodedBitsPerSymbol;
70  deinterleavedBits.setBit(shiftedSecondPerm, interleavedBits.getBit(i * numberOfCodedBitsPerSymbol + j));
71  }
72  }
73  EV_DEBUG << "The deinterleaved bits are: " << deinterleavedBits << endl;
74  return deinterleavedBits;
75 }
int numberOfCodedBitsPerSymbol
Definition: Ieee80211OFDMInterleaver.h:39
int s
Definition: Ieee80211OFDMInterleaver.h:41
const Ieee80211OFDMInterleaving* inet::physicallayer::Ieee80211OFDMInterleaver::getInterleaving ( ) const
inlineoverridevirtual

Implements inet::physicallayer::IInterleaver.

Referenced by inet::physicallayer::Ieee80211OFDMInterleaverModule::getInterleaving().

52 { return interleaving; }
const Ieee80211OFDMInterleaving * interleaving
Definition: Ieee80211OFDMInterleaver.h:42
int inet::physicallayer::Ieee80211OFDMInterleaver::getNumberOfCodedBitsPerSubcarrier ( ) const
inline
int numberOfCodedBitsPerSubcarrier
Definition: Ieee80211OFDMInterleaver.h:40
int inet::physicallayer::Ieee80211OFDMInterleaver::getNumberOfCodedBitsPerSymbol ( ) const
inline
int numberOfCodedBitsPerSymbol
Definition: Ieee80211OFDMInterleaver.h:39
BitVector inet::physicallayer::Ieee80211OFDMInterleaver::interleave ( const BitVector bits) const
overridevirtual

Implements inet::physicallayer::IInterleaver.

Referenced by inet::physicallayer::Ieee80211OFDMInterleaverModule::interleave().

33 {
34  if (deinterleavedBits.getSize() % numberOfCodedBitsPerSymbol)
35  throw cRuntimeError("deinterleavedBits length = %d must be a multiple of numberOfCodedBitsPerSymbol = %d", deinterleavedBits.getSize(), numberOfCodedBitsPerSymbol);
36  int numberOfSymbols = deinterleavedBits.getSize() / numberOfCodedBitsPerSymbol;
37  EV_DEBUG << "Interleaving the following bits: " << deinterleavedBits << endl;
38  BitVector interleavedBits;
39  for (int i = 0; i < numberOfSymbols; i++) {
40  for (int j = 0; j < numberOfCodedBitsPerSymbol; j++) {
41  // First permutation: (N_CBPS /16) (k mod 16) + Floor(k/16), k = 0,1,...,N_CBPS - 1.
42  int firstPerm = (numberOfCodedBitsPerSymbol / 16) * (j % 16) + floor(j / 16);
43  // Second permutation: j = s × Floor(i/s) + (i + N_CBPS - Floor(16 × i/N_CBPS )) mod s, i = 0,1,... N_CBPS – 1,
44  // where s = max(N_BPSC / 2, 1).
45  int secondPerm = s * floor(firstPerm / s)
46  + (firstPerm + numberOfCodedBitsPerSymbol - (int)floor(16 * firstPerm / numberOfCodedBitsPerSymbol)) % s;
47  int shiftedSecondPerm = secondPerm + i * numberOfCodedBitsPerSymbol;
48  interleavedBits.setBit(shiftedSecondPerm, deinterleavedBits.getBit(i * numberOfCodedBitsPerSymbol + j));
49  }
50  }
51  EV_DEBUG << "The interleaved bits are: " << interleavedBits << endl;
52  return interleavedBits;
53 }
int numberOfCodedBitsPerSymbol
Definition: Ieee80211OFDMInterleaver.h:39
int s
Definition: Ieee80211OFDMInterleaver.h:41
std::ostream & inet::physicallayer::Ieee80211OFDMInterleaver::printToStream ( std::ostream &  stream,
int  level 
) const
overridevirtual

Prints this object to the provided output stream.

Function calls to operator<< with pointers or references either const or not are all forwarded to this function.

Reimplemented from inet::physicallayer::IPrintableObject.

Referenced by inet::physicallayer::Ieee80211OFDMInterleaverModule::printToStream().

25 {
26  stream << "Ieee80211Interleaver";
27  if (level <= PRINT_LEVEL_TRACE)
28  stream << ", interleaving = " << printObjectToString(interleaving, level + 1);
29  return stream;
30 }
std::string printObjectToString(const IPrintableObject *object, int level)
Definition: IPrintableObject.h:73
const Ieee80211OFDMInterleaving * interleaving
Definition: Ieee80211OFDMInterleaver.h:42

Member Data Documentation

const Ieee80211OFDMInterleaving* inet::physicallayer::Ieee80211OFDMInterleaver::interleaving = nullptr
protected

Referenced by printToStream().

int inet::physicallayer::Ieee80211OFDMInterleaver::numberOfCodedBitsPerSubcarrier
protected
int inet::physicallayer::Ieee80211OFDMInterleaver::numberOfCodedBitsPerSymbol
protected
int inet::physicallayer::Ieee80211OFDMInterleaver::s
protected

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