Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

diffdemodulator.h

Go to the documentation of this file.
00001 /*-*-c++-*-*****************************************************************
00002                           diffdemodulator.h  -  description
00003                              -------------------
00004     begin                : Thu Feb 19 2004
00005     copyright            : (C) 2004 by Christian Stimming
00006     email                : stimming@tuhh.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00024  *   MA  02111-1307  USA                                                   *
00025  *                                                                         *
00026  ***************************************************************************/
00027 
00028 #ifndef _DIFFDEMODULATOR_H
00029 #define _DIFFDEMODULATOR_H
00030 
00031 #include "demodulator.h"
00032 
00033 namespace simthlib
00034 {
00035 
00036 
00037 
00040 class DiffDemodulator : public Demodulator
00041 {
00042    friend class AdachiDemodulator;
00043 
00044    public:
00045 
00048       DiffDemodulator(int deviceID, simth::DeviceSystemIntf* system, 
00049         const simth::PropertyList& pl,
00050         simth::SequenceType outType )
00051      : Demodulator(deviceID, system, pl, outType) { };
00052 
00053       virtual void demodulate(const simth::ModSeq &receivedSym, simth::LlvSeq *correspondingLlrValues,
00054                   double noise = 0, const simth::ModSeq* trans = NULL) = 0;
00055 
00056       virtual void demodulate(const simth::ModSeq &receivedSym, simth::LlrSeq *correspondingLlrValues,
00057 
00058                   double noise = 0, const simth::ModSeq* trans = NULL) = 0;
00059 
00064       virtual void adachiDemodulate(const simth::ModSeq &receivedSym,
00065                     simth::LlvSeq *correspondingLlvValues1, simth::LlvSeq *correspondingLlvValues2,
00066                     double noise = 0, const simth::ModSeq* trans = NULL) = 0;
00067 
00074       virtual int ConcatData(int data1, int data2) const = 0;
00075 
00076       virtual int getInputLength(int outputLength) const;
00077 
00078 };
00079 
00090 class DiffDemodulatorMapping : public DiffDemodulator
00091 {
00092       MappingScheme* usedMapping;
00093 
00094    public:
00095 
00099       DiffDemodulatorMapping(int deviceID, simth::DeviceSystemIntf* system, 
00100         const simth::PropertyList& pl,
00101         std::auto_ptr<MappingScheme> mapp, simth::SequenceType outType );
00102 
00103       ~DiffDemodulatorMapping();
00104 
00105       int getSymbolIndex(int dataValue) const
00106       {return usedMapping->getSymbolIndex(dataValue);}
00107 
00108       int getDataValue(int symbolIndex) const
00109       {return usedMapping->getDataValue(symbolIndex);}
00110 
00111       /* For differential modulation: If the data words data1 and data2 lead
00112      from the modulation symbol s0 to s1 and s2 then this function returns
00113      the data word which leads directly from s0 to s2.
00114 
00115       */
00116       virtual int ConcatData(int data1, int data2) const;
00117 
00118       virtual void print(std::ostream &os) const;
00119 };
00120 
00129 class DiffDemodulatorMetric : public DiffDemodulatorMapping
00130 {
00131       friend class AdachiDemodulator;
00132 
00133 
00134       //Hier werden die differenziell decodierten Symbole reingeschrieben
00135       simth::ModSeq::storage_type diffDecodedSymbols;
00136 
00137 
00138    protected:
00145       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv,
00146                   Complex h2, Complex h1, double noise) const = 0;
00147 
00153       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv) const = 0;
00154 
00155    public:
00156 
00157       //Constructor
00158       DiffDemodulatorMetric(int deviceID, simth::DeviceSystemIntf* system, 
00159         const simth::PropertyList& pl,
00160         std::auto_ptr<MappingScheme> mapp, simth::SequenceType outType );
00161 
00165       virtual ~DiffDemodulatorMetric() = 0;
00166 
00167 
00168       virtual void demodulate(const simth::ModSeq &receivedSym, simth::LlvSeq *correspondingLlrValues,
00169                   double noise = 0, const simth::ModSeq* trans = NULL);
00170 
00171       virtual void demodulate(const simth::ModSeq &receivedSym, simth::LlrSeq *correspondingLlrValues,
00172                   double noise = 0, const simth::ModSeq* trans = NULL);
00173 
00178       virtual void adachiDemodulate(const simth::ModSeq &receivedSym,
00179                     simth::LlvSeq *correspondingLlvValues1, simth::LlvSeq *correspondingLlvValues2,
00180                     double noise = 0, const simth::ModSeq* trans = NULL);
00181 
00182 };
00183 
00184 
00185 
00186 inline DiffDemodulatorMetric::~DiffDemodulatorMetric()
00187 {}
00188 
00189 
00190 
00191 
00192 class DiffSubSeqDemodulatorMetric : public DiffDemodulatorMetric
00193 {
00194 
00195       int subSeqLen;
00196 
00197    protected:
00198 
00199    public:
00200 
00204       DiffSubSeqDemodulatorMetric(int deviceID, simth::DeviceSystemIntf* system, 
00205         const simth::PropertyList& pl,
00206         std::auto_ptr<MappingScheme> mapp, int subSeqLength, simth::SequenceType outType)
00207      : DiffDemodulatorMetric(deviceID, system, pl, mapp, outType), subSeqLen(subSeqLength) {};
00208 
00212       virtual ~DiffSubSeqDemodulatorMetric() = 0;
00213 
00214       virtual void demodulate(const simth::ModSeq &receivedSym, simth::LlvSeq *correspondingLlvValues,
00215                   double noise = 0, const simth::ModSeq* trans = NULL);
00216 
00217       virtual void demodulate(const simth::ModSeq &receivedSym, simth::LlrSeq *correspondingLlrValues,
00218                   double noise = 0, const simth::ModSeq* trans = NULL);
00219 
00220 
00221       virtual void adachiDemodulate(const simth::ModSeq &receivedSym,
00222                     simth::LlvSeq *correspondingLlvValues1, simth::LlvSeq *correspondingLlvValues2,
00223                     double noise = 0, const simth::ModSeq* trans = NULL);
00224 
00225       virtual void print(std::ostream &os) const;
00226 };
00227 
00228 inline DiffSubSeqDemodulatorMetric::~DiffSubSeqDemodulatorMetric()
00229 {}
00230 
00231 
00235 class DpskDemodulator : public DiffSubSeqDemodulatorMetric
00236 {
00237 
00238    private:
00239 
00240       PskConstellationDiagram* usedConstellationDiagram;
00241 
00242       bool onlyPhaseEqualisation_;
00243 
00244    protected:
00245 
00246 
00247 
00248    public:
00249 
00250       virtual Complex getComplSymbol(int symbolIndex) const
00251       {return usedConstellationDiagram->getComplSymbol(symbolIndex);}
00252 
00253       double getPhase(int symbIndex) const
00254       {return usedConstellationDiagram->getPhase(symbIndex);}
00255 
00256       double getAmplitude(int symbIndex) const
00257       {return usedConstellationDiagram->getAmplitude(symbIndex);}
00258 
00259    public:
00260 
00261       DpskDemodulator(int deviceID, simth::DeviceSystemIntf* system, 
00262         const simth::PropertyList& pl,
00263         int bitsPerState, int SubSeqLen, map_type mapMode, simth::SequenceType outType);
00264       ~DpskDemodulator();
00265 
00266 
00267       bool onlyPhaseEqualisation() const {return onlyPhaseEqualisation_;}
00268       void setOnlyPhaseEqualisationOn() {onlyPhaseEqualisation_=true;}
00269 
00270       virtual int getBitsPerSymbol() const
00271       {return usedConstellationDiagram->getBitsPerSymbol();}
00272 
00273       virtual int getNumStates() const
00274       {return usedConstellationDiagram->getNumStates();}
00275 
00276       virtual void print(std::ostream &os) const;
00277 };
00278 
00279 
00280 inline DpskDemodulator::~DpskDemodulator()
00281 {
00282    if(usedConstellationDiagram != NULL) {
00283       delete usedConstellationDiagram;
00284    }
00285 }
00286 
00287 
00294 class DpskDemodulatorQC : public DpskDemodulator
00295 {
00296 
00297 
00298    private:
00299 
00300       mutable std::vector<Complex> correctedConstellation1;
00301       mutable std::vector<Complex> correctedConstellation2;
00302 
00303       //Defines the way of metric calculation.
00304       virtual void MetricQC(Complex sym, Complex prev_sym, simth::Llv* llv,
00305                 Complex sc2, Complex sc1, double noise) const;
00306       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv,
00307                   Complex h2, Complex h1, double noise) const;
00308       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00309    public:
00310       DpskDemodulatorQC(int deviceID, simth::DeviceSystemIntf* system, 
00311             const simth::PropertyList& pl);
00312 
00316       DpskDemodulatorQC(int deviceID, simth::DeviceSystemIntf* system, 
00317             const simth::PropertyList& pl,
00318             int bitsPerState, int SubSeqLen, map_type mapMode, simth::SequenceType outType);
00319 
00320       ~DpskDemodulatorQC();
00321 
00322       virtual void print(std::ostream &os) const;
00323 };
00324 
00325 
00326 
00332 class DpskDemodulatorDD : public DpskDemodulator
00333 {
00334 
00335    protected:
00336       //Determines the way of metric calculation.
00337 
00338       virtual void MetricDD(Complex sym, Complex prev_sym, simth::Llv* llv) const = 0;
00339       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv,
00340                   Complex h2, Complex h1, double noise) const;
00341       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00342    public:
00343       DpskDemodulatorDD(int deviceID, simth::DeviceSystemIntf* system, 
00344         const simth::PropertyList& pl,
00345         int bitsPerState, int SubSeqLen, map_type mapMode, simth::SequenceType outType)
00346      : DpskDemodulator(deviceID, system, pl, bitsPerState, SubSeqLen, mapMode, outType){};
00347 
00348       ~DpskDemodulatorDD();
00349       virtual void print(std::ostream &os) const;
00350 };
00351 
00352 
00353 
00354 
00355 
00359 class DpskDemDD_STD : public DpskDemodulatorDD
00360 {
00361 
00362    protected:
00363       //Determines the way of metric calculation.
00364       virtual void MetricDD(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00365    public:
00366       DpskDemDD_STD(int deviceID, simth::DeviceSystemIntf* system, 
00367             const simth::PropertyList& pl)
00368      : DpskDemodulatorDD(
00369         deviceID, system, pl, 
00370         pl.getProperty<int>("bits_per_symbol"),
00371         pl.getProperty<int>("sub_seq_length"),
00372         string2map_type(pl.getProperty<std::string>("mapping")),
00373         simth::string2SequenceType(pl.getProperty<std::string>("output_type")))
00374       { };
00375 
00379       DpskDemDD_STD(int deviceID, simth::DeviceSystemIntf* system, 
00380         const simth::PropertyList& pl,
00381         int bitsPerState, int SubSeqLen, map_type mapMode, simth::SequenceType outType)
00382      : DpskDemodulatorDD(deviceID, system, pl, bitsPerState, SubSeqLen, mapMode, outType){};
00383 
00384       ~DpskDemDD_STD();
00385       virtual void print(std::ostream &os) const;
00386 };
00387 
00388 
00389 inline DpskDemDD_STD::~DpskDemDD_STD()
00390 {}
00391 
00392 
00397 class DpskDemDD_AWGN : public DpskDemodulatorDD
00398 {
00399 
00400    protected:
00401       //Determines the way of metric calculation.
00402       virtual void MetricDD(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00403    public:
00404       DpskDemDD_AWGN(int deviceID, simth::DeviceSystemIntf* system, 
00405              const simth::PropertyList& pl)
00406      : DpskDemodulatorDD(
00407         deviceID, system, pl, 
00408         pl.getProperty<int>("bits_per_symbol"),
00409         pl.getProperty<int>("sub_seq_length"),
00410         string2map_type(pl.getProperty<std::string>("mapping")),
00411         simth::string2SequenceType(pl.getProperty<std::string>("output_type")))
00412       { };
00413 
00416       DpskDemDD_AWGN(int deviceID, simth::DeviceSystemIntf* system, 
00417              const simth::PropertyList& pl,
00418              int bitsPerState, int SubSeqLen, map_type mapMode, simth::SequenceType outType)
00419      : DpskDemodulatorDD(deviceID, system, pl, bitsPerState, SubSeqLen, mapMode, outType){};
00420 
00421       ~DpskDemDD_AWGN();
00422       virtual void print(std::ostream &os) const;
00423 };
00424 
00425 
00426 inline DpskDemDD_AWGN::~DpskDemDD_AWGN()
00427 {}
00428 
00429 
00430 
00439 class DpskDemDD_MIN : public DpskDemodulatorDD
00440 {
00441 
00442    protected:
00443       //Determines the way of metric calculation.
00444       virtual void MetricDD(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00445    public:
00446       DpskDemDD_MIN(int deviceID, simth::DeviceSystemIntf* system, 
00447             const simth::PropertyList& pl)
00448      : DpskDemodulatorDD(
00449         deviceID, system, pl, 
00450         pl.getProperty<int>("bits_per_symbol"),
00451         pl.getProperty<int>("sub_seq_length"),
00452         string2map_type(pl.getProperty<std::string>("mapping")),
00453         simth::string2SequenceType(pl.getProperty<std::string>("output_type")))
00454       { };
00455 
00458       DpskDemDD_MIN(int deviceID, simth::DeviceSystemIntf* system, 
00459         const simth::PropertyList& pl,
00460         int bitsPerState, int SubSeqLen, map_type mapMode, simth::SequenceType outType)
00461      : DpskDemodulatorDD(deviceID, system, pl, bitsPerState, SubSeqLen, mapMode, outType){};
00462 
00463       ~DpskDemDD_MIN(){};
00464       virtual void print(std::ostream &os) const;
00465 };
00466 
00471 class DpskDemDD_KARSTEN : public DpskDemodulatorDD
00472 {
00473       
00474    protected:
00475       //Determines the way of metric calculation.
00476       
00477       virtual void MetricDD(Complex sym, Complex prev_sym,
00478                 simth::Llv* llv) const;
00479    public:
00480       DpskDemDD_KARSTEN(int deviceID, simth::DeviceSystemIntf* system, 
00481             const simth::PropertyList& pl)
00482      : DpskDemodulatorDD(
00483         deviceID, system, pl, 
00484         pl.getProperty<int>("bits_per_symbol"),
00485         pl.getProperty<int>("sub_seq_length"),
00486         string2map_type(pl.getProperty<std::string>("mapping")),
00487         simth::string2SequenceType(pl.getProperty<std::string>("output_type")))
00488       { };
00489 
00492       DpskDemDD_KARSTEN(int deviceID, simth::DeviceSystemIntf* system, 
00493         const simth::PropertyList& pl,
00494         int bitsPerState, 
00495             int SubSeqLen, 
00496             map_type mapMode, simth::SequenceType outType)
00497      : DpskDemodulatorDD(deviceID, system, pl, bitsPerState, SubSeqLen, 
00498                  mapMode, outType)
00499       {};
00500       ~DpskDemDD_KARSTEN() {};
00501       virtual void print(std::ostream &os) const;
00502 };
00503 
00504 
00505 
00506 
00507 
00512 class DaskDemodulator : public DiffSubSeqDemodulatorMetric
00513 {
00514    private:
00515 
00516       ApskConstellationDiagram* usedConstellationDiagram;
00517 
00518 
00519    protected:
00520 
00521       simth::checkedVector<double> logAmplQuotients;
00522 
00523    public:
00524 
00525       virtual Complex getComplSymbol(int symbolIndex) const
00526       {return usedConstellationDiagram->getComplSymbol(symbolIndex);}
00527 
00528       double getPhase(int symbIndex) const
00529       {return usedConstellationDiagram->getPhase(symbIndex);}
00530 
00531       double getAmplitude(int symbIndex) const
00532       {return usedConstellationDiagram->getAmplitude(symbIndex);}
00533 
00534 
00535       int getNumAmplitudes() const
00536       {return 1<<(usedConstellationDiagram->bitsPerAmpl());}
00537 
00538       int getNumPhases() const
00539       {return 1;}
00540 
00544       int getNumAmplitudeBits() const
00545       {return usedConstellationDiagram->bitsPerAmpl();}
00546 
00550       int getNumPhaseBits() const
00551       {return 0;}
00552 
00553 
00554    public:
00557       DaskDemodulator(int deviceID, simth::DeviceSystemIntf* system, 
00558         const simth::PropertyList& pl,
00559         int bitsPerState, double amplFactor, double amplAddend,
00560               int SubSeqLen, map_type mapMode, simth::SequenceType outType);
00561 
00562       ~DaskDemodulator();
00563 
00564       virtual int getBitsPerSymbol() const
00565       {return usedConstellationDiagram->getBitsPerSymbol();}
00566 
00567       virtual int getNumStates() const
00568       {return usedConstellationDiagram->getNumStates();}
00569 
00570 
00571       virtual void print(std::ostream &os) const;
00572 
00573 };
00574 
00575 
00576 
00584 class DaskDemodulatorQC : public DaskDemodulator
00585 {
00586    private:
00587       mutable std::vector<Complex> correctedConstellation1;
00588       mutable std::vector<Complex> correctedConstellation2;
00589 
00590    protected:
00591       //Determines the way of metric calculation.
00592       virtual void MetricQC(Complex sym, Complex prev_sym, simth::Llv* llv,
00593                 Complex sc2, Complex sc1, double noise) const;
00594 
00595       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv,
00596                   Complex h2, Complex h1, double noise) const;
00597       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00598    public:
00599 
00600       DaskDemodulatorQC(int deviceID, simth::DeviceSystemIntf* system, 
00601         const simth::PropertyList& pl,
00602         int bitsPerState, double amplFactor, double amplAddend,
00603             int SubSeqLen, map_type mapMode, simth::SequenceType outType);
00604 
00605       ~DaskDemodulatorQC(){};
00606 
00607       virtual void print(std::ostream &os) const;
00608 
00609 };
00610 
00611 
00617 class DaskDemodulatorDD : public DaskDemodulator
00618 {
00619    private:
00620 
00621 
00622    protected:
00623 
00624       simth::checkedVector<double> logAmplQuotients;
00625 
00626       //Determines the way of metric calculation.
00627 
00628       virtual void MetricDD(Complex sym, Complex prev_sym, simth::Llv* llv) const = 0;
00629 
00630       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv,
00631                   Complex h2, Complex h1, double noise) const;
00632       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00633    public:
00634 
00635       DaskDemodulatorDD(int deviceID, simth::DeviceSystemIntf* system, 
00636         const simth::PropertyList& pl,
00637         int bitsPerState, double amplFactor,
00638             int SubSeqLen, map_type mapMode, simth::SequenceType outType);
00639 
00640       ~DaskDemodulatorDD(){};
00641 
00642       virtual void print(std::ostream &os) const;
00643 
00644 };
00645 
00646 
00650 class DaskDemDD_STD : public DaskDemodulatorDD
00651 {
00652 
00653    protected:
00654       //Determines the way of metric calculation.
00655 
00656       virtual void MetricDD(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00657    public:
00658 
00665       DaskDemDD_STD(int deviceID, simth::DeviceSystemIntf* system, 
00666             const simth::PropertyList& pl,
00667             int bitsPerState, double amplFactor,
00668             int subSeqLen, map_type mapMode, simth::SequenceType outType);
00669 
00670       virtual void print(std::ostream &os) const;
00671 };
00672 
00673 
00674 
00675 
00676 
00683 // /** Abstract base class of DAPSK Demodulator.
00684  
00685 // */
00686 // class DapskDemodulator : public DiffSubSeqDemodulatorMetric
00687 // {
00688 //    private:
00689 
00690 //       ApskConstellationDiagram* usedConstellationDiagram;
00691 
00692 
00693 //    protected:
00694 
00695 
00696 //       virtual Complex getComplSymbol(int symbolIndex) const
00697 //       {return usedConstellationDiagram->getComplSymbol(symbolIndex);}
00698 
00699 //       double getPhase(int symbIndex) const
00700 //       {return usedConstellationDiagram->getPhase(symbIndex);}
00701 
00702 //       double getAmplitude(int symbIndex) const
00703 //       {return usedConstellationDiagram->getAmplitude(symbIndex);}
00704 
00705 
00706 //       int getNumAmplitudes() const
00707 //       {return 1<<(usedConstellationDiagram->bitsPerAmpl());}
00708 
00709 //       int getNumPhases() const
00710 //       {return 1<<(usedConstellationDiagram->bitsPerPhase());}
00711 
00712 //       /**Returns the number of bits classifying the amplitude
00713 
00714 //       */
00715 //       int getNumAmplitudeBits() const
00716 //       {return usedConstellationDiagram->bitsPerAmpl();}
00717 
00718 //       /**Returns the number of bits classifying the phases.
00719 
00720 //       */
00721 //       int getNumPhaseBits() const
00722 //       {return usedConstellationDiagram->bitsPerPhase();}
00723 
00724 //    public:
00725 //       /** Class constructor; The subSeqLen determines the distance between two reference symbols used for differential
00726 //    decoding, i.e. a sequence can contain several sub sequences that are independently from each
00727 //    other differentially encoded. The outType determines
00728 //    the type of the output sequence which could be a simth::Llv sequence or an simth::LLR_ sequence (see
00729 //    simth::LlvSeq and simth::LlrSeq)                         
00730 //       */
00731 //       DapskDemodulator(int deviceID, simth::DeviceSystemIntf* system, 
00732 //      const simth::PropertyList& pl,
00733 //      const ApskConstellationMaker& diagrMaker,
00734 //             int bitsPerState, int SubSeqLen, map_type mapMode, simth::SequenceType outType);
00735 
00736 //       ~DapskDemodulator();
00737 
00738 //       virtual int getBitsPerSymbol() const
00739 //       {return usedConstellationDiagram->getBitsPerSymbol();}
00740 
00741 //       virtual int getNumStates() const
00742 //       {return usedConstellationDiagram->getNumStates();}
00743 
00744 
00745 //       /* For differential modulation: If the data words data1 and data2 lead
00746 //   from the modulation symbol s0 to s1 and s2 then this function returns
00747 //   the data word which leads directly from s0 to s2.
00748 //       */
00749 //       virtual int ConcatData(int data1, int data2) const;
00750 
00751 //       virtual void print(std::ostream &os) const;
00752 // };
00753 
00754 
00758 class Da_PskDemodulator : public DiffDemodulator
00759 {
00760       DaskDemodulator* amplDemod;
00761       DpskDemodulator* phaseDemod;
00762 
00763       mutable simth::LlrSeq::storage_type cacheAmplLlr;
00764       mutable simth::LlrSeq::storage_type cachePhaseLlr;
00765 
00766       mutable simth::LlrSeq::storage_type cacheAmplLlv;
00767       mutable simth::LlrSeq::storage_type cachePhaseLlv;
00768 
00769       //used for adachi modulation:
00770       mutable simth::LlrSeq::storage_type cacheAmplLlv2;
00771       mutable simth::LlrSeq::storage_type cachePhaseLlv2;
00772 
00773       const int bitsPerSymbol_;
00774       const int numStates_;
00775 
00776       virtual Complex getComplSymbol(int symbolIndex) const;
00777 
00781       int getNumAmplitudeBits() const
00782       {return amplDemod->getBitsPerSymbol();}
00783 
00787       int getNumPhaseBits() const
00788       {return phaseDemod->getBitsPerSymbol();}
00789 
00790       void invariante();
00791 
00792    public:
00793 
00796       Da_PskDemodulator(int deviceID,simth::DeviceSystemIntf* system, const simth::PropertyList& pl);
00797 
00798       /* Constructor with explicit arguments.
00799        */
00800       Da_PskDemodulator(int deviceID, 
00801             simth::DeviceSystemIntf* system, 
00802             const simth::PropertyList& pl,
00803             int bitsPerAmpl,int bitsPerPhase, int subSeqLength, 
00804             detect_type detectType, map_type mapping,simth::SequenceType outType);
00805 
00808       Da_PskDemodulator(int deviceID, simth::DeviceSystemIntf* system, 
00809         const simth::PropertyList& pl,
00810         DaskDemodulator* amplDemod_, DpskDemodulator* phaseDemod_, simth::SequenceType outType);
00811 
00812 
00813      ~Da_PskDemodulator();
00814 
00815      void updateInputLengths( );
00816 
00817       virtual void demodulate(const simth::ModSeq &receivedSym, simth::LlrSeq *correspondingLlrValues,
00818                   double noise = 0, const simth::ModSeq* trans = NULL);
00819       virtual void demodulate(const simth::ModSeq &receivedSym, simth::LlvSeq *correspondingLlvValues,
00820                   double noise = 0, const simth::ModSeq* trans = NULL);
00821 
00822       virtual void adachiDemodulate(const simth::ModSeq &receivedSym,
00823                     simth::LlvSeq *correspondingLlvValues1, simth::LlvSeq *correspondingLlvValues2,
00824                     double noise = 0, const simth::ModSeq* trans = NULL);
00825 
00826 
00827       /* For differential modulation: If the data words data1 and data2 lead
00828      from the modulation symbol s0 to s1 and s2 then this function returns
00829      the data word which leads directly from s0 to s2.
00830 
00831       */
00832       virtual int ConcatData(int data1, int data2) const;
00833 
00834 
00835       virtual int getBitsPerSymbol() const;
00836 
00837       virtual int getNumStates() const;
00838 
00839       virtual void print(std::ostream &os) const;
00840 
00841 };
00842 
00843 inline void Da_PskDemodulator::invariante()
00844 {
00845    if(DEBUG) {
00846       if( (1<<getBitsPerSymbol()) != amplDemod->getNumStates() * phaseDemod->getNumStates() ) {
00847      throw std::logic_error("Da_PskDemodulator::DapskDemodulator(...) : error 1");
00848       }
00849       if(getNumStates() != amplDemod->getNumStates() * phaseDemod->getNumStates()) {
00850      throw std::logic_error("Da_PskDemodulator::DapskDemodulator(...) : error 2");
00851       }
00852    }
00853 }
00854 
00855                    
00856 
00857 // /** DAPSK Demodulator with quasi coherent differential demodulation  (i.e. requires ambigous channel information)
00858 //     MetricQC() determines the way of metric calculation. Since this function is  virtual it can
00859 //     be overridene by a derived class.
00860  
00861 // */
00862 // class DapskDemodulatorQC : public DapskDemodulator
00863 // {
00864 //    public:
00865 //       /** Deprecated. Only for old init-function where the argument
00866 //        * detect_type is hidden in the modulation_type string. */
00867 //       DapskDemodulatorQC(int deviceID, simth::DeviceSystemIntf* system, 
00868 //           const simth::PropertyList& pl,
00869 //      int bitsPerState, int SubSeqLen, detect_type mode, map_type mapMode, simth::SequenceType outType);
00870 
00871 //       DapskDemodulatorQC(int deviceID, simth::DeviceSystemIntf* system, 
00872 //           const simth::PropertyList& pl);
00873 
00874 //       ~DapskDemodulatorQC(){};
00875 //       virtual void print(std::ostream &os) const;
00876 
00877 //    protected:
00878 //       //Determines the way of metric calculation.
00879 
00880 //       virtual void MetricQC(Complex sym, Complex prev_sym, simth::Llv* llv,
00881 //              Complex sc2, Complex sc1, double noise) const;
00882 
00883 //       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv,
00884 //                Complex h2, Complex h1, double noise) const;
00885 //       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00886 
00887 //    private:
00888 //       mutable std::vector<Complex> correctedConstellation1;
00889 //       mutable std::vector<Complex> correctedConstellation2;
00890 
00891 
00892 // };
00893 
00894 
00895 
00896 // /** DAPSK Demodulator with incoherent differential demodulation  (i.e. without any channel information)
00897 //     Due to MetricDD() which determines the way of metric calculation, this class is
00898 //     an abstract class.
00899  
00900 // */
00901 // class DapskDemodulatorDD : public DapskDemodulator
00902 // {
00903 
00904 //    protected:
00905 
00906 //       simth::checkedVector<double> logAmplQuotients;
00907 
00908 //       //Determines the way of metric calculation.
00909 
00910 //       virtual void MetricDD(Complex sym, Complex prev_sym, simth::Llv* llv) const = 0;
00911 //       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv,
00912 //                Complex h2, Complex h1, double noise) const;
00913 //       virtual void MakeMetric(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00914 
00915 //    public:
00916 
00917 //       DapskDemodulatorDD(int deviceID, simth::DeviceSystemIntf* system, 
00918 //      const simth::PropertyList& pl,
00919 //      int bitsPerState, int SubSeqLen, map_type mapMode, simth::SequenceType outType);
00920 
00921 //       ~DapskDemodulatorDD();
00922 
00923 // };
00924 
00925 
00926 // inline DapskDemodulatorDD::~DapskDemodulatorDD()
00927 // {}
00928 
00929 
00930 // /** DPSK Demodulator with incoherent differential demodulation and standard metric calculation
00931  
00932 // */
00933 // class DapskDemDD_STD : public DapskDemodulatorDD
00934 // {
00935 
00936 //    protected:
00937 //       //Determines the way of metric calculation.
00938 //       virtual void AmplMetricDD(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00939 //       virtual void PhaseMetricDD(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00940 //       virtual void MetricDD(Complex sym, Complex prev_sym, simth::Llv* llv) const;
00941 //    public:
00942 //       DapskDemDD_STD(int deviceID, simth::DeviceSystemIntf* system, 
00943 //           const simth::PropertyList& pl)
00944 //   : DapskDemodulatorDD(
00945 //      deviceID, system, pl, 
00946 //      pl.getProperty<int>("bits_per_symbol"),
00947 //      pl.getProperty<int>("sub_seq_length"),
00948 //      string2map_type(pl.getProperty<std::string>("mapping")),
00949 //      simth::string2SequenceType(pl.getProperty<std::string>("output_type")))
00950 //       { };
00951 
00952 //       /** DEPRECATED. Only existing for compatibility to old
00953 //        * AdachiDemodulator code. */
00954 //       DapskDemDD_STD(int deviceID, simth::DeviceSystemIntf* system, 
00955 //      const simth::PropertyList& pl,
00956 //      int bitsPerState, int SubSeqLen, map_type mapMode, simth::SequenceType outType)
00957 //   : DapskDemodulatorDD(deviceID, system, pl, bitsPerState, SubSeqLen, mapMode, outType){};
00958 //       ~DapskDemDD_STD();
00959 //       virtual void print(std::ostream &os) const;
00960 // };
00961 
00962 
00963 // inline DapskDemDD_STD::~DapskDemDD_STD()
00964 // {}
00965 
00966 
00967 
00968 
00969 
00970 
00971 
00972 // /** DAPSK Demodulator with incoherent differential demodulation and standard metric calculation
00973 //     for both amplitude and phase bits.
00974  
00975 // */
00976 // class Da_PskDemDD_STD : public Da_PskDemodulator
00977 // {
00978 
00979 //    public:
00980 //       /** Class constructor; the number of bits per phase, the number of
00981 //    bits per amplitude and the amplitude factor are given as argument.
00982 //    (An amplitude addend that is used in other DAPSK modulator/Demodulator
00983 //    classes makes no sense for incoherent demodulation applied in this class.)
00984 //    Hence the amplitude of the i-th amplitude ring is is computed by:
00985 //    \f$a_i = f^i + i*0 = f^i\f$
00986 //    where f is the amplitude Factor and A is the amplitude addend that equals zero here.
00987 //    The outType determines
00988 //    the type of the output sequence which could be a simth::Llv sequence or an simth::LLR_ sequence (see
00989 //    simth::LlvSeq and simth::LlrSeq)                         
00990 //       */
00991 //       Da_PskDemDD_STD(int deviceID, simth::DeviceSystemIntf* system, 
00992 //      const simth::PropertyList& pl,
00993 //      int bitsPerAmpl, int bitsPerPhase, double amplFactor,
00994 //      int SubSeqLen, map_type mapMode, simth::SequenceType outType);
00995 
00996 //       /** Constructor that parameters are included in the property list.
00997 //        */
00998 //       Da_PskDemDD_STD(int deviceID, simth::DeviceSystemIntf* system, 
00999 //      const simth::PropertyList& pl);
01000 
01001 
01002 
01003 // };
01004 
01005 
01006 
01007 // /** DAPSK Demodulator with coherent differential demodulation and standard metric calculation
01008 //     for both amplitude and phase bits.
01009  
01010 // */
01011 // class Da_PskDemDD_QC : public Da_PskDemodulator
01012 // {
01013 
01014 //    public:
01015 
01016 //       /** Class constructor; the number of bits per phase, the number of
01017 //    bits per amplitude and the amplitude factor are given as argument.
01018 //    (An amplitude addend that is used in other DAPSK modulator/Demodulator
01019 //    classes makes no sense for incoherent demodulation applied in this class.)
01020 //    Hence the amplitude of the i-th amplitude ring is is computed by:
01021 //    \f$a_i = f^i + i*0 = f^i\f$
01022 //    where f is the amplitude Factor and A is the amplitude addend that equals zero here.
01023 //    The outType determines
01024 //    the type of the output sequence which could be a simth::Llv sequence or an simth::LLR_ sequence (see
01025 //    simth::LlvSeq and simth::LlrSeq)                         
01026 //       */
01027 //       Da_PskDemDD_QC(int deviceID, simth::DeviceSystemIntf* system, 
01028 //           const simth::PropertyList& pl,
01029 //           int bitsPerAmpl, int bitsPerPhase, double amplFactor,double amplAddend,
01030 //           int SubSeqLen, map_type mapMode, simth::SequenceType outType);
01031 
01032 
01033 // };
01034 
01035 
01036 typedef  Da_PskDemodulator DapskDemodulator;
01037 //typedef Da_PskDemDD_STD DapskDemDD_STD;
01038 //typedef Da_PskDemDD_QC DapskDemodulatorQC;  
01039 
01040 } // namespace
01041 
01042 
01043 #endif // _DIFFDEMODULATOR_H

Generated on Tue Aug 9 14:35:10 2005 for simtheticlib by  doxygen 1.4.1