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
00031 #ifndef WSSUSCHANNEL2_H
00032 #define WSSUSCHANNEL2_H
00033
00034 #include <iostream>
00035 #include <fstream>
00036 #include <complex>
00037
00038 #include <simthetic/phbib.h>
00039 #include <simthetic/phrand.h>
00040 #include <simthetic/signals.h>
00041 #include <simthetic/basicdevice.h>
00042 #include <simthetic/interfaces.h>
00043
00044 #include <simtheticlib/delayprofile.h>
00045
00046 namespace simthlib {
00047 class OfdmReceiver;
00048 class OfdmTransmitter;
00049 }
00050
00051 using namespace simthlib;
00052
00053 #include "matrixseq.h"
00054 #include "mimo-channel.h"
00055
00056
00057
00058
00061 namespace mimo {
00062
00137 class WSSUSChannel2 : public MIMOChannel
00138 {
00139 public:
00143 class PathParam {
00144 public:
00150 double phase;
00151
00153 int delay;
00154
00157 double ampl;
00158 };
00159
00162 class ScattererParam
00163 {
00164 public:
00166 double angle;
00167
00169 double dopp_freq;
00170
00174 double delta_phi;
00175 };
00176 private:
00177
00179 double rice_factor;
00180
00181 protected:
00184 unsigned num_paths;
00185
00187 double max_delay;
00188
00190 double max_doppler;
00191
00193 unsigned L_T;
00195 unsigned L_R;
00198 unsigned paths_per_scatterer;
00199
00201 typedef std::vector<ScattererParam> ScatVect;
00203 ScatVect scatterers_tx;
00205 CMatrix steering_tx;
00206 CMatrix doppler_tx;
00207
00209 ScatVect scatterers_rx;
00211 CMatrix steering_rx;
00212 CMatrix doppler_rx;
00213
00215 typedef std::vector<PathParam> PathVect;
00217 PathVect h_pathparams;
00220 CMatrixSeq::storage_type h_paths;
00221
00223 AntennaArray *array_geometry_tx;
00225 AntennaArray *array_geometry_rx;
00226
00228 double delta_t;
00229
00230 protected:
00232 VectorTimeSignal::storage_type prevsym;
00237 bool firstSequence;
00238
00240 mutable MatrixTimeSignal::storage_type imp_resp;
00241
00242 private:
00244 enum Normalization_Mode {
00246 STD,
00256 TIME,
00268 FREQ,
00280 TIME_TOTAL,
00285 FREQ_TOTAL
00286 };
00288 Normalization_Mode normMode;
00290 double normFactor;
00292 void resetNormalizeFactor();
00294 double freqDist;
00296 int numFreqs;
00298 unsigned normDuration;
00301 unsigned normDurationLeft;
00302
00303
00304 RayleighRng rayleigh_rng;
00305
00307 void adjustDeltaT(double newDeltaT);
00308
00310 simth::UniformRng AoARng;
00311 simth::UniformRng AoDRng;
00312
00314 simth::UniformRng coupling_phase_rng;
00315
00316 protected:
00317
00318
00319
00320 mutable MatrixFreqSignal::storage_type cacheTransfer;
00322 mutable int cacheTime;
00323 mutable bool isTransferCacheValid;
00325 bool timevariant;
00326
00328 int current_time;
00329
00330
00331
00332 protected:
00334 int roundTimeToSamples(double value) const;
00335
00338 virtual double diceNewDelay() const = 0;
00339
00346 virtual double diceNewPhase() const = 0;
00347
00353 virtual double diceNewAmpl() const;
00354
00359 virtual double diceNewAoA() const;
00360
00365 virtual double diceNewAoD() const;
00366
00367 public:
00382 WSSUSChannel2(int deviceID,
00383 DeviceSystemIntf* system,
00384 const simth::PropertyList& pl,
00385 double maxDelay,
00386 double max_doppler);
00387
00389 virtual ~WSSUSChannel2();
00390
00416 virtual void refresh();
00417
00439 void getTransfer(int relative_time, MatrixFreqSignal& trans) const;
00440
00446 void transmit(const VectorTimeSignal &insym, VectorTimeSignal& outsym);
00447
00450 void setRiceFactor(double rf);
00451
00455 void setRiceFactor_dB(double rf);
00456
00457
00460 void setTimeNormalization(unsigned duration = 0);
00461
00466 void setFreqNormalization(double freqDist, int numFreqs,
00467 unsigned duration = 0);
00468
00472 virtual void startOfSimulation();
00473
00474 virtual void print(std::ostream &os) const;
00475
00476 protected:
00477 void getImpulseResponse(int relative_time, MatrixTimeSignal &t,
00478 int increment_time = 0) const;
00479
00480 };
00481
00482
00483 inline int WSSUSChannel2::roundTimeToSamples(double value) const
00484 {
00485 return int(value / delta_t + 0.5);
00486 }
00487
00488
00489
00490
00491
00492
00498 class WSSUSChannel2JakesUniform : public WSSUSChannel2
00499 {
00500 private:
00502 UniformRng uniformPhaseRng;
00503 protected:
00507 virtual double diceNewPhase() const;
00508 public:
00518 WSSUSChannel2JakesUniform(int deviceID,
00519 DeviceSystemIntf* system,
00520 const simth::PropertyList& pl,
00521 double max_doppler,
00522 double maxDelay);
00524 virtual ~WSSUSChannel2JakesUniform();
00525 };
00526
00527
00551 class WSSUSChannel2ExpDelay : public WSSUSChannel2JakesUniform
00552 {
00553 private:
00555 ExponentialDelayProfile *expDelay;
00556 protected:
00559 virtual double diceNewDelay() const;
00570 WSSUSChannel2ExpDelay(int deviceID,
00571 DeviceSystemIntf* system,
00572 const simth::PropertyList& pl,
00573 double max_doppler, double delayAttenuation,
00574 double max_delay);
00575 public:
00582 WSSUSChannel2ExpDelay(int deviceID,
00583 DeviceSystemIntf* system,
00584 const simth::PropertyList& pl);
00585
00586 virtual ~WSSUSChannel2ExpDelay();
00587 };
00588
00589
00590
00595 class WSSUSChannel2Scattering : public WSSUSChannel2ExpDelay
00596 {
00597 public:
00604 WSSUSChannel2Scattering(int deviceID,
00605 DeviceSystemIntf* system,
00606 const simth::PropertyList& pl)
00607 : WSSUSChannel2ExpDelay(deviceID, system, pl,
00608 pl.getProperty<double>("max_doppler"),
00609 (-log(DELAY_THRESHOLD)/pl.getProperty<double>("max_signal_delay")),
00610 pl.getProperty<double>("max_signal_delay")) {};
00611 };
00612
00613
00614
00617 class WSSUSChannel2TU : public WSSUSChannel2ExpDelay
00618 {
00619 public:
00626 WSSUSChannel2TU(int deviceID,
00627 DeviceSystemIntf* system,
00628 const simth::PropertyList& pl)
00629 :WSSUSChannel2ExpDelay(deviceID, system, pl,
00630 pl.getProperty<double>("max_doppler"),
00631 1e6,
00632 7e-6) {};
00633 };
00634
00635
00636
00637 }
00638
00640
00641
00642
00643 #endif