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

#include <ConvolutionalCode.h>

Inheritance diagram for inet::physicallayer::ConvolutionalCode:
inet::physicallayer::IForwardErrorCorrection inet::physicallayer::IPrintableObject inet::physicallayer::Ieee80211ConvolutionalCode

Public Member Functions

 ConvolutionalCode (const char *transferFunctionMatrix, const char *puncturingMatrix, const char *constraintLengthVector, int codeRatePuncturingK, int codeRatePuncturingN, const char *mode)
 
int getCodeRatePuncturingK () const
 
int getCodeRatePuncturingN () const
 
const char * getConstraintLengthVector () const
 
const char * getMode () const
 
const char * getPuncturingMatrix () const
 
const char * getTransferFunctionMatrix () const
 
std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual double getCodeRate () const override
 
virtual int getEncodedLength (int decodedLength) const override
 
virtual int getDecodedLength (int encodedLength) const override
 
virtual double computeNetBitErrorRate (double grossBitErrorRate) 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

const char * transferFunctionMatrix
 
const char * puncturingMatrix
 
const char * constraintLengthVector
 
int codeRatePuncturingK
 
int codeRatePuncturingN
 
int memory
 
const char * mode
 

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::ConvolutionalCode::ConvolutionalCode ( const char *  transferFunctionMatrix,
const char *  puncturingMatrix,
const char *  constraintLengthVector,
int  codeRatePuncturingK,
int  codeRatePuncturingN,
const char *  mode 
)
24  :
30  memory(0),
31  mode(mode)
32 {
33  cStringTokenizer tokenizer(constraintLengthVector);
34  while (tokenizer.hasMoreTokens())
35  memory = std::max(memory, atoi(tokenizer.nextToken()) - 1);
36 }
int codeRatePuncturingN
Definition: ConvolutionalCode.h:34
const char * puncturingMatrix
Definition: ConvolutionalCode.h:31
double max(double a, double b)
Returns the greater of the given parameters.
Definition: INETMath.h:161
int memory
Definition: ConvolutionalCode.h:35
const char * transferFunctionMatrix
Definition: ConvolutionalCode.h:30
int codeRatePuncturingK
Definition: ConvolutionalCode.h:33
const char * mode
Definition: ConvolutionalCode.h:36
const char * constraintLengthVector
Definition: ConvolutionalCode.h:32

Member Function Documentation

double inet::physicallayer::ConvolutionalCode::computeNetBitErrorRate ( double  grossBitErrorRate) const
overridevirtual

Implements inet::physicallayer::IForwardErrorCorrection.

66 {
67  double p = grossBitErrorRate;
68  double netBitErrorRate;
69  if (codeRatePuncturingK == 1 && codeRatePuncturingN == 2) {
70  if (memory == 1)
71  netBitErrorRate = pow(p, 2) * (14 - 23 * p + 16 * pow(p, 2) + 2 * pow(p, 3) - 16 * pow(p, 4) + 8 * pow(p, 5))
72  / ((1 + 3 * pow(p, 2) - 2 * pow(p, 3)) * (2 - p + 4 * pow(p, 2) - 4 * pow(p, 3)));
73  else if (memory == 2)
74  netBitErrorRate = 44 * pow(p, 3) + 3519.0 / 8.0 * pow(p, 4) - 14351.0 / 32.0 * pow(p, 5) - 1267079.0 / 64.0 * pow(p, 6) - 31646405.0 / 512.0 * pow(p, 7) + 978265739.0 / 2048.0 * pow(p, 8) + 3931764263.0 / 1024.0 * pow(p, 9) - 48978857681.0 / 32768.0 * pow(p, 10);
75  else
76  throw cRuntimeError("Not yet implemented");
77  }
78  else
79  throw cRuntimeError("Not yet implemented");
80  return std::max(std::min(netBitErrorRate, 1.0), 0.0);
81 }
int codeRatePuncturingN
Definition: ConvolutionalCode.h:34
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SCTPAssociation.h:270
double max(double a, double b)
Returns the greater of the given parameters.
Definition: INETMath.h:161
int memory
Definition: ConvolutionalCode.h:35
int codeRatePuncturingK
Definition: ConvolutionalCode.h:33
double inet::physicallayer::ConvolutionalCode::getCodeRate ( ) const
overridevirtual

Implements inet::physicallayer::IForwardErrorCorrection.

48 {
50 }
int codeRatePuncturingN
Definition: ConvolutionalCode.h:34
int codeRatePuncturingK
Definition: ConvolutionalCode.h:33
const char* inet::physicallayer::ConvolutionalCode::getConstraintLengthVector ( ) const
inline

Referenced by inet::physicallayer::ConvolutionalCoder::ConvolutionalCoder().

43 { return constraintLengthVector; }
const char * constraintLengthVector
Definition: ConvolutionalCode.h:32
int inet::physicallayer::ConvolutionalCode::getDecodedLength ( int  encodedLength) const
overridevirtual

Implements inet::physicallayer::IForwardErrorCorrection.

Referenced by inet::physicallayer::Ieee80211LayeredOFDMTransmitter::appendPadding(), and inet::physicallayer::Ieee80211OFDMDataMode::getDuration().

59 {
60  ASSERT(encodedLength % codeRatePuncturingN == 0);
61  return encodedLength * codeRatePuncturingK / codeRatePuncturingN;
62 }
int codeRatePuncturingN
Definition: ConvolutionalCode.h:34
int codeRatePuncturingK
Definition: ConvolutionalCode.h:33
int inet::physicallayer::ConvolutionalCode::getEncodedLength ( int  decodedLength) const
overridevirtual

Implements inet::physicallayer::IForwardErrorCorrection.

Referenced by inet::physicallayer::Ieee80211LayeredOFDMTransmitter::createScalarAnalogModel().

53 {
54  ASSERT(decodedLength % codeRatePuncturingK == 0);
55  return decodedLength * codeRatePuncturingN / codeRatePuncturingK;
56 }
int codeRatePuncturingN
Definition: ConvolutionalCode.h:34
int codeRatePuncturingK
Definition: ConvolutionalCode.h:33
const char* inet::physicallayer::ConvolutionalCode::getMode ( ) const
inline

Referenced by inet::physicallayer::ConvolutionalCoder::ConvolutionalCoder().

44 { return mode; }
const char * mode
Definition: ConvolutionalCode.h:36
const char* inet::physicallayer::ConvolutionalCode::getPuncturingMatrix ( ) const
inline

Referenced by inet::physicallayer::ConvolutionalCoder::ConvolutionalCoder().

45 { return puncturingMatrix; }
const char * puncturingMatrix
Definition: ConvolutionalCode.h:31
const char* inet::physicallayer::ConvolutionalCode::getTransferFunctionMatrix ( ) const
inline

Referenced by inet::physicallayer::ConvolutionalCoder::ConvolutionalCoder().

46 { return transferFunctionMatrix; }
const char * transferFunctionMatrix
Definition: ConvolutionalCode.h:30
std::ostream & inet::physicallayer::ConvolutionalCode::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.

39 {
40  stream << "ConvolutionalCode";
41  if (level <= PRINT_LEVEL_TRACE)
42  stream << ", codeRatePuncturingK = " << codeRatePuncturingK
43  << ", codeRatePuncturingN = " << codeRatePuncturingN;
44  return stream;
45 }
int codeRatePuncturingN
Definition: ConvolutionalCode.h:34
int codeRatePuncturingK
Definition: ConvolutionalCode.h:33

Member Data Documentation

const char* inet::physicallayer::ConvolutionalCode::constraintLengthVector
protected
int inet::physicallayer::ConvolutionalCode::memory
protected
const char* inet::physicallayer::ConvolutionalCode::mode
protected
const char* inet::physicallayer::ConvolutionalCode::puncturingMatrix
protected
const char* inet::physicallayer::ConvolutionalCode::transferFunctionMatrix
protected

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