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
00030 #ifndef WSSUSCHANNEL_H
00031 #define WSSUSCHANNEL_H
00032
00033 #include <iostream>
00034 #include <fstream>
00035 #include <complex>
00036
00037 #include <simthetic/phbib.h>
00038 #include <simthetic/phrand.h>
00039 #include <simthetic/signals.h>
00040 #include <simthetic/basicdevice.h>
00041 #include <simthetic/interfaces.h>
00042
00043 #include <simtheticlib/delayprofile.h>
00044
00045 namespace simthlib {
00046 class OfdmReceiver;
00047 class OfdmTransmitter;
00048 }
00049
00050 using namespace simthlib;
00051
00052 #include "matrixseq.h"
00053 #include "mimo-channel.h"
00054
00055
00056
00057
00060 namespace mimo {
00061
00065 class PathParam {
00066 public:
00072 double phase;
00073
00075 double dopp_freq;
00076
00078 int delay;
00079
00083 double delta_phi;
00084
00086 double alpha;
00087
00089 double beta;
00090
00092 mimo::CVector v_alpha;
00093
00095 mimo::CVector v_beta;
00096
00099 double ampl;
00100 };
00101
00176 class WSSUSChannel : public MIMOChannel
00177 {
00178 private:
00179
00181 double rice_factor;
00182
00183 protected:
00185 unsigned num_paths;
00186
00188 double max_delay;
00189
00191 typedef std::vector<PathParam> PathContainer;
00192
00194 PathContainer paths;
00195
00197 AntennaArray *array_geometry;
00198
00200 double delta_t;
00201
00202 private:
00204 int num_freq;
00205
00206 protected:
00208 VectorTimeSignal::storage_type prevsym;
00213 bool firstSequence;
00214
00216 int roundTimeToSamples(double value) const;
00217
00218 private:
00220 enum Normalization_Mode {
00222 STD,
00232 TIME,
00244 FREQ,
00256 TIME_TOTAL,
00261 FREQ_TOTAL
00262 };
00264 Normalization_Mode normMode;
00266 double normFactor;
00268 void resetNormalizeFactor();
00270 double freqDist;
00272 int numFreqs;
00274 unsigned normDuration;
00277 unsigned normDurationLeft;
00278
00279
00280 RayleighRng rayleigh_rng;
00281
00283 void adjustDeltaT(double newDeltaT);
00284
00286 DiscreteUniformRng AoARng;
00287 DiscreteUniformRng AoDRng;
00288
00290 simth::UniformRng coupling_phase_rng;
00291
00292 protected:
00293
00294
00295
00296 mutable MatrixFreqSignal::storage_type cacheTransfer;
00298 mutable int cacheTime;
00299 mutable bool isTransferCacheValid;
00300
00301 bool timevariant;
00302
00303 private:
00304
00305 simthlib::OfdmReceiver *ofdm_recv;
00306 simthlib::OfdmTransmitter *ofdm_trans;
00307
00308
00309 unsigned num_carrier;
00310 double carrier_dist;
00311 unsigned maxantenna;
00312
00313
00314 std::vector<TimeSignal*> time_samples;
00315 std::vector<ModSeq*> freq_samples;
00316 CVectorSeq::storage_type freq_vectors_in;
00317 CVectorSeq::storage_type freq_vectors_out;
00318
00319
00320
00321 protected:
00324 virtual double diceNewDelay() const = 0;
00325
00332 virtual double diceNewPhase() const = 0;
00333
00339 virtual double diceNewAmpl() const;
00340
00343 virtual double diceNewDopplerFreq() const = 0;
00344
00349 virtual double diceNewAoA() const;
00350
00355 virtual double diceNewAoD() const;
00356
00357 public:
00371 WSSUSChannel(int deviceID,
00372 DeviceSystemIntf* system,
00373 const simth::PropertyList& pl,
00374 double maxDelay);
00375
00377 virtual ~WSSUSChannel();
00378
00404 virtual void refresh();
00405
00427 void getTransfer(int relative_time, MatrixFreqSignal& trans) const;
00428
00434 void transmit(const VectorTimeSignal &insym, VectorTimeSignal& outsym);
00435
00438 void setRiceFactor(double rf);
00439
00443 void setRiceFactor_dB(double rf);
00444
00445
00448 void setTimeNormalization(unsigned duration = 0);
00449
00454 void setFreqNormalization(double freqDist, int numFreqs,
00455 unsigned duration = 0);
00456
00460 virtual void startOfSimulation();
00461
00462 virtual void print(std::ostream &os) const;
00463
00464 protected:
00465 void getImpulseResponse(int relative_time, MatrixTimeSignal &t) const;
00466
00467 };
00468
00469
00470 inline int WSSUSChannel::roundTimeToSamples(double value) const
00471 {
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481 return int(value / delta_t + 0.5);
00482 }
00483
00484
00485
00486
00487
00488
00494 class WSSUSChannelJakesUniform : public WSSUSChannel
00495 {
00496 private:
00498 UniformRng uniformPhaseRng;
00500 JakesRng* jakesDoppFreqRng;
00501 protected:
00505 virtual double diceNewPhase() const;
00508 virtual double diceNewDopplerFreq() const;
00509 public:
00519 WSSUSChannelJakesUniform(int deviceID,
00520 DeviceSystemIntf* system,
00521 const simth::PropertyList& pl,
00522 double max_doppler,
00523 double maxDelay);
00525 virtual ~WSSUSChannelJakesUniform();
00526 };
00527
00528
00552 class WSSUSChannelExpDelay : public WSSUSChannelJakesUniform
00553 {
00554 private:
00556 ExponentialDelayProfile *expDelay;
00557 protected:
00560 virtual double diceNewDelay() const;
00571 WSSUSChannelExpDelay(int deviceID,
00572 DeviceSystemIntf* system,
00573 const simth::PropertyList& pl,
00574 double max_doppler, double delayAttenuation,
00575 double max_delay);
00576 public:
00583 WSSUSChannelExpDelay(int deviceID,
00584 DeviceSystemIntf* system,
00585 const simth::PropertyList& pl);
00586
00587 virtual ~WSSUSChannelExpDelay();
00588 };
00589
00590
00591
00594 class WSSUSChannelBU : public WSSUSChannelJakesUniform
00595 {
00596 private:
00598 BuDelayProfile buDelay;
00599 protected:
00600 virtual double diceNewDelay() const;
00601 public:
00608 WSSUSChannelBU(int deviceID,
00609 DeviceSystemIntf* system,
00610 const simth::PropertyList& pl);
00611 virtual ~WSSUSChannelBU() {};
00612
00613 };
00614
00615
00618 class WSSUSChannelHT : public WSSUSChannelJakesUniform
00619 {
00620 private:
00622 HtDelayProfile htDelay;
00623
00624 protected:
00625 virtual double diceNewDelay() const;
00626 public:
00633 WSSUSChannelHT(int deviceID,
00634 DeviceSystemIntf* system,
00635 const simth::PropertyList& pl);
00636
00637 virtual ~WSSUSChannelHT() {};
00638
00639 };
00640
00641
00646 class WSSUSChannelScattering : public WSSUSChannelExpDelay
00647 {
00648 public:
00655 WSSUSChannelScattering(int deviceID,
00656 DeviceSystemIntf* system,
00657 const simth::PropertyList& pl)
00658 : WSSUSChannelExpDelay(deviceID, system, pl,
00659 pl.getProperty<double>("max_doppler"),
00660 (-log(DELAY_THRESHOLD)/pl.getProperty<double>("max_signal_delay")),
00661 pl.getProperty<double>("max_signal_delay")) {};
00662 };
00663
00664
00671 class WSSUSChannelFreqTimeCorr : public WSSUSChannelExpDelay
00672 {
00673 public:
00681 WSSUSChannelFreqTimeCorr(int deviceID,
00682 DeviceSystemIntf* system,
00683 const simth::PropertyList& pl);
00684 };
00685
00692 class WSSUSChannelRA : public WSSUSChannelExpDelay
00693 {
00694 public:
00701 WSSUSChannelRA(int deviceID,
00702 DeviceSystemIntf* system,
00703 const simth::PropertyList& pl)
00704 :WSSUSChannelExpDelay(deviceID, system, pl,
00705 pl.getProperty<double>("max_doppler"),
00706 1e6*9.2,
00707 0.7e-6) {}
00708 };
00709
00712 class WSSUSChannelTU : public WSSUSChannelExpDelay
00713 {
00714 public:
00721 WSSUSChannelTU(int deviceID,
00722 DeviceSystemIntf* system,
00723 const simth::PropertyList& pl)
00724 :WSSUSChannelExpDelay(deviceID, system, pl,
00725 pl.getProperty<double>("max_doppler"),
00726 1e6,
00727 7e-6) {};
00728 };
00729
00730
00731
00732
00740 class FileWssusChannel : public WSSUSChannel
00741 {
00742 private:
00744 std::string filename;
00745 unsigned realiz_index;
00746
00747 public:
00749 FileWssusChannel(int deviceID,
00750 DeviceSystemIntf* system,
00751 const simth::PropertyList& pl);
00753 ~FileWssusChannel();
00754
00757 void refresh();
00758
00760 double diceNewDelay() const { return 0; };
00762 double diceNewPhase() const { return 0; };
00764 double diceNewDopplerFreq() const { return 0; };
00765
00766 void setSNR(double snr);
00767 void startOfSimulation();
00768
00769 };
00770
00771
00772 }
00773
00775
00776
00777
00778 #endif