00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef DEMODULATION_HEADER
00029 #define DEMODULATION_HEADER
00030
00031 #include <iostream>
00032 #include <fstream>
00033 #include <complex>
00034 #include <vector>
00035 #include <cmath>
00036
00037 #include "signals.h"
00038 #include "misc.h"
00039 #include "phbib.h"
00040 #include "basicdevice.h"
00041 #include "interfaces.h"
00042
00043 #include "modulationschemes.h"
00044 #include "bitmapping.h"
00045
00046 namespace simthlib
00047 {
00048
00049 using simth::Complex;
00050
00051 class Demodulator;
00052
00053
00054 std::ostream& operator<<(std::ostream &os, const Demodulator& demod);
00055
00056
00057
00077 class Demodulator : public simth::Device
00078 {
00079
00080 simth::SequenceType outputType_;
00081
00082
00083 double snr;
00084
00085 virtual int getInputLength(int outputLength) const = 0;
00086
00087 protected:
00088
00089 simth::SequenceType outputType() const {return outputType_;}
00090
00091 virtual Complex getComplSymbol(int symbolIndex) const = 0;
00092
00093
00094 virtual double SNR() const {return snr;}
00095 virtual void setSNR(double newSNR){snr = newSNR;}
00096
00097 public:
00100 Demodulator(int deviceID, simth::DeviceSystemIntf* system,
00101 const simth::PropertyList& pl,
00102 simth::SequenceType outType);
00103
00104 virtual void updateInputLengths();
00105 virtual void updateOutputLengths();
00106
00107
00116 virtual void demodulate(const simth::ModSeq &receivedSym, simth::LlrSeq *correspondingLlrValues,
00117 double noise = 0, const simth::ModSeq* trans = NULL) = 0;
00118
00122 virtual void demodulate(const simth::ModSeq &receivedSym, simth::LlvSeq *correspondingLlvValues,
00123 double noise = 0, const simth::ModSeq* trans = NULL ) = 0;
00124
00125 virtual int getBitsPerSymbol() const = 0;
00126
00127 virtual int getNumStates() const = 0;
00128
00129 virtual void process();
00130
00131 virtual void print(std::ostream &os) const;
00132
00133 virtual void startOfSimulation();
00134
00137 static void init(const std::string fileName, simth::Device** dev, simth::DeviceSystemIntf* sysPtr, int ID,
00138 const std::string& regionQualifier = "");
00139 };
00140
00141
00142 }
00143
00144 #endif