00001 /*-*-c++-*-***************************************************************** 00002 maxentropychannel.h - MIMO channel class 00003 ------------------- 00004 begin : Oct 2003 00005 copyright : (C) 2003 by Cornelius Heckrott 00006 email : cornelius.heckrott@tu-harburg.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 00030 #ifndef MAXENTROPYCHANNEL_H 00031 #define MAXENTROPYCHANNEL_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 "matrixseq.h" 00044 #include "mimo-channel.h" 00045 00046 namespace simthlib { 00047 class DelayProfile; 00048 } 00049 00052 namespace mimo { 00153 class MaxEntropyChannel : public MIMOChannel 00154 { 00155 00156 private: 00157 // global_time is set to zero at the beginning of each simulation run 00158 unsigned absolut_time; 00159 // delta_t is the sampling time of the transmitted sequences 00160 double delta_t; 00161 // delta_f is a frequency step in the frequency domain 00162 mutable double delta_f; 00163 // delay_steps stores the values which roundTimeToSamples() is returning 00164 mutable size_t delay_steps; 00165 // scatterers_s holds information about the number of the directions of 00166 // arrival DoA (see Merouane Debbah Page 59/60), to be set in the .par file, 00167 // if it is not declared, default is " DoA: 5 " 00168 unsigned scatterers_s; 00169 // scatterers_s1 holds information about the number of the directions of 00170 // departure DoD (see Merouane Debbah Page 59/60), to be set in the .par file, 00171 // if it is not declared, default is " DoD: 5 " 00172 unsigned scatterers_s1; 00173 // The vector AoD stores the informarion under which angle the different directions 00174 // of departure leave the transmitter. In the same way stores AoA the angles of arrival 00175 mimo::Vector AoD, AoA; 00176 // samples_cache stores the samples that can't be placed in the actual sequence (because 00177 // their delay is to long), they will be written into the next sequence 00178 VectorTimeSignal::storage_type samples_cache; 00179 // PSI_Matrix is a pseudo complex matrix which stores the phase shifts psi 00180 mimo::CMatrix PSI_Matrix; 00181 // the phaseshifts phi at the receiving antennas (a result of the 00182 // different directions of arrival) are stored in the real matrix PHI 00183 mimo::Matrix PHI; 00184 // the doppler frequencies are written into the real matrix PHI_Doppler 00185 mimo::Matrix PHI_Doppler; 00186 // PHI_Matrix with time variant entries, see Merouane Debbah Page 59/60 for details 00187 mutable mimo::CMatrix PHI_Matrix; 00188 // time delay matrix holds information about the delays of the paths 00189 mimo::Matrix DELAY; 00190 // the pseudo complex GAUSS_Matrix contains i.i.d. gaussian variables 00191 mimo::CMatrix GAUSS_Matrix; 00192 // the pseudo complex GAUSS_DELAY_Matrix links a DoD with a DoA 00193 // taking into account a certain delay 00194 mutable mimo::CMatrix GAUSS_DELAY_Matrix; 00195 // an object of the class DelayProfile, to get random delays 00196 simthlib::DelayProfile *PathDelay; 00197 // an object of the class GaussRng, to get random Gauss variables 00198 simth::GaussRng *GaussVar; 00199 // an object of the class UniformRng, to get random angles 00200 UniformRng random_uniform; 00201 // the normfactor depends on the number of scatterers s and s1, 00202 // see Merouane Debbah Page 59/60 for details 00203 double normfactor; 00204 // no_refresh makes sure that no channel refresh is done during transmission/estimation 00205 mutable bool no_refresh; 00206 // is false after first call of refresh() 00207 bool SimulationStart; 00208 // Geometry of the antenna arrays 00209 AntennaArray *thisArray; 00210 // angle of receivers steering vector relative to the antenna array, 00211 // the vectors length is stored in receiver_speed 00212 double ReceiverSteering; 00213 // Whether we actually have the doppler effect 00214 bool have_doppler; 00215 00216 public: 00225 MaxEntropyChannel(int deviceID, DeviceSystemIntf* system, 00226 const simth::PropertyList& pl); 00227 00228 ~MaxEntropyChannel(); 00229 00230 void getTransfer(int relative_time, MatrixFreqSignal &transfer) const; 00231 void transmit(const VectorTimeSignal &insym, VectorTimeSignal &outsym); 00233 int roundTimeToSamples(double value) const; 00235 virtual void refresh(); 00237 void set_normfactor(); 00239 void getImpulseResponse(int relative_time, MatrixTimeSignal &impulse) const; 00242 double get_angle() const; 00246 double get_delay() const; 00248 double get_gauss() const; 00250 virtual void print(std::ostream &os) const; 00251 00252 protected: 00253 void updateInputLengths(); 00254 void updateOutputLengths(); 00255 }; 00256 00257 } // namespace 00259 00260 #endif // MAXENTROPYCHANNEL_H