/usr/share/doc/libitpp-dev/html/mimoconv.html is in libitpp-doc 4.3.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Welcome to IT++!</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div style="width: 100%; height: 40px; background-color: #ffff00; border: 1px solid #b0b0b0; margin: 5px 5px 5px 0; padding: 2px;">
<a href="http://itpp.sourceforge.net"><img src="itpp_logo.png" alt="IT++ Logo" style="float: left; border: 0;"></a>
</div>
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<div class="left">
<form id="FSearchBox" action="search.php" method="get">
<img id="MSearchSelect" src="search/mag.png" alt=""/>
<input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"/>
</form>
</div><div class="right"></div>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">MIMO (spatial multiplexing) with convolutional coding </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This example demonstrates how to use the <code>Modulator_ND</code> (MIMO) class for soft-output demodulation. The program simulates a simple convolutionally coded spatial-multiplexing (V-BLAST style) MIMO system with maximum-likelihood, alternatively zero-forcing, demodulation and soft Viterbi decoding, but no iteration between the demodulator and the decoder.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="itcomm_8h.html">itpp/itcomm.h</a>></span></div>
<div class="line"></div>
<div class="line"><span class="keyword">using namespace </span>itpp;</div>
<div class="line"><span class="keyword">using namespace </span>std;</div>
<div class="line"></div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
<div class="line">{</div>
<div class="line"> <span class="comment">// -- modulation and channel parameters (taken from command line input) --</span></div>
<div class="line"> <span class="keywordtype">int</span> nC; <span class="comment">// type of constellation (1=QPSK, 2=16-QAM, 3=64-QAM)</span></div>
<div class="line"> <span class="keywordtype">int</span> nRx; <span class="comment">// number of receive antennas</span></div>
<div class="line"> <span class="keywordtype">int</span> nTx; <span class="comment">// number of transmit antennas</span></div>
<div class="line"> <span class="keywordtype">int</span> Tc; <span class="comment">// coherence time (number of channel vectors with same H)</span></div>
<div class="line"></div>
<div class="line"> <span class="keywordflow">if</span> (argc != 5) {</div>
<div class="line"> cout << <span class="stringliteral">"Usage: cm nTx nRx nC Tc"</span> << endl << <span class="stringliteral">"Example: cm 2 2 1 100000 (2x2 QPSK MIMO on slow fading channel)"</span> << endl;</div>
<div class="line"> exit(1);</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">else</span> {</div>
<div class="line"> sscanf(argv[1], <span class="stringliteral">"%i"</span>, &nTx);</div>
<div class="line"> sscanf(argv[2], <span class="stringliteral">"%i"</span>, &nRx);</div>
<div class="line"> sscanf(argv[3], <span class="stringliteral">"%i"</span>, &nC);</div>
<div class="line"> sscanf(argv[4], <span class="stringliteral">"%i"</span>, &Tc);</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> cout << <span class="stringliteral">"Initializing.. "</span> << nTx << <span class="stringliteral">" TX antennas, "</span> << nRx << <span class="stringliteral">" RX antennas, "</span></div>
<div class="line"> << (1 << nC) << <span class="stringliteral">"-PAM per dimension, coherence time "</span> << Tc << endl;</div>
<div class="line"></div>
<div class="line"> <span class="comment">// -- simulation control parameters --</span></div>
<div class="line"> <span class="keyword">const</span> vec EbN0db = <span class="stringliteral">"-5:0.5:50"</span>; <span class="comment">// SNR range</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">int</span> Nmethods = 2; <span class="comment">// number of demodulators to try</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">int</span> Nbitsmax = 50000000; <span class="comment">// maximum number of bits to ever simulate per SNR point</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">int</span> Nu = 1000; <span class="comment">// length of data packet (before applying channel coding)</span></div>
<div class="line"></div>
<div class="line"> <span class="keywordtype">int</span> Nbers, Nfers; <span class="comment">// target number of bit/frame errors per SNR point</span></div>
<div class="line"> <span class="keywordtype">double</span> BERmin, FERmin; <span class="comment">// BER/FER at which to terminate simulation</span></div>
<div class="line"> <span class="keywordflow">if</span> (Tc == 1) { <span class="comment">// Fast fading channel, BER is of primary interest</span></div>
<div class="line"> BERmin = 0.001; <span class="comment">// stop simulating a given method if BER<this value</span></div>
<div class="line"> FERmin = 1.0e-10; <span class="comment">// stop simulating a given method if FER<this value</span></div>
<div class="line"> Nbers = 1000; <span class="comment">// move to next SNR point after counting 1000 bit errors</span></div>
<div class="line"> Nfers = 200; <span class="comment">// do not stop on this condition</span></div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">else</span> { <span class="comment">// Slow fading channel, FER is of primary interest here</span></div>
<div class="line"> BERmin = 1.0e-15; <span class="comment">// stop simulating a given method if BER<this value</span></div>
<div class="line"> FERmin = 0.01; <span class="comment">// stop simulating a given method if FER<this value</span></div>
<div class="line"> Nbers = -1; <span class="comment">// do not stop on this condition</span></div>
<div class="line"> Nfers = 200; <span class="comment">// move to next SNR point after counting 200 frame errors</span></div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <span class="comment">// -- Channel code parameters --</span></div>
<div class="line"> <a class="code" href="classitpp_1_1Convolutional__Code.html">Convolutional_Code</a> code;</div>
<div class="line"> ivec generator(3);</div>
<div class="line"> generator(0) = 0133; <span class="comment">// use rate 1/3 code</span></div>
<div class="line"> generator(1) = 0165;</div>
<div class="line"> generator(2) = 0171;</div>
<div class="line"> <span class="keywordtype">double</span> rate = 1.0 / 3.0;</div>
<div class="line"> code.<a class="code" href="classitpp_1_1Convolutional__Code.html#ab8ca18ab14b3b6a1e1a1132f0386c84f">set_generator_polynomials</a>(generator, 7);</div>
<div class="line"> bvec dummy;</div>
<div class="line"> code.<a class="code" href="classitpp_1_1Convolutional__Code.html#a47230acfea5aa32cb31e63abca1d222e">encode_tail</a>(<a class="code" href="group__randgen.html#ga5aa06887cf1fd3301b040987924068f0">randb</a>(Nu), dummy);</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">int</span> Nc = <a class="code" href="group__matrix__functions.html#gae48b61b3a51887969bf508abae267292">length</a>(dummy); <span class="comment">// find out how long the coded blocks are</span></div>
<div class="line"></div>
<div class="line"> <span class="comment">// ============= Initialize ====================================</span></div>
<div class="line"></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">int</span> Nctx = (int)(2 * nC * nTx * <a class="code" href="group__convertfunc.html#ga21dd9f813dc0a0342a5d0124b5c2ef33">ceil</a>(<span class="keywordtype">double</span>(Nc) / <span class="keywordtype">double</span>(2 * nC * nTx))); <span class="comment">// Total number of bits to transmit</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">int</span> Nvec = Nctx / (2 * nC * nTx); <span class="comment">// Number of channel vectors to transmit</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">int</span> Nbitspvec = 2 * nC * nTx; <span class="comment">// Number of bits per channel vector</span></div>
<div class="line"></div>
<div class="line"> <span class="comment">// initialize MIMO channel with uniform QAM per complex dimension and Gray coding</span></div>
<div class="line"> <a class="code" href="classitpp_1_1ND__UQAM.html">ND_UQAM</a> chan;</div>
<div class="line"> chan.<a class="code" href="classitpp_1_1ND__UQAM.html#ae52a188982cb681b069e7d6e985a7d06">set_M</a>(nTx, 1 << (2*nC));</div>
<div class="line"> cout << chan << endl;</div>
<div class="line"></div>
<div class="line"> <span class="comment">// initialize interleaver</span></div>
<div class="line"> <a class="code" href="classitpp_1_1Sequence__Interleaver.html">Sequence_Interleaver<bin></a> sequence_interleaver_b(Nctx);</div>
<div class="line"> <a class="code" href="classitpp_1_1Sequence__Interleaver.html">Sequence_Interleaver<int></a> sequence_interleaver_i(Nctx);</div>
<div class="line"> sequence_interleaver_b.randomize_interleaver_sequence();</div>
<div class="line"> sequence_interleaver_i.set_interleaver_sequence(sequence_interleaver_b.get_interleaver_sequence());</div>
<div class="line"></div>
<div class="line"> <span class="comment">// RNG_randomize();</span></div>
<div class="line"></div>
<div class="line"> <a class="code" href="classitpp_1_1Array.html">Array<cvec></a> Y(Nvec); <span class="comment">// received data</span></div>
<div class="line"> <a class="code" href="classitpp_1_1Array.html">Array<cmat></a> H(Nvec / Tc + 1); <span class="comment">// channel matrix (new matrix for each coherence interval)</span></div>
<div class="line"></div>
<div class="line"> ivec Contflag = <a class="code" href="group__specmat.html#ga9130bbac7072b9e18edee4051907a760">ones_i</a>(Nmethods); <span class="comment">// flag to determine whether to run a given demodulator</span></div>
<div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group__logexpfunc.html#ga0c42d158b1f623f9b72c1ccde7e2fd09">pow</a>(2.0, nC*2.0*nTx) > 256) { <span class="comment">// ML decoder too complex..</span></div>
<div class="line"> Contflag(1) = 0;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">if</span> (nTx > nRx) {</div>
<div class="line"> Contflag(0) = 0; <span class="comment">// ZF not for underdetermined systems</span></div>
<div class="line"> }</div>
<div class="line"> cout << <span class="stringliteral">"Running methods: "</span> << Contflag << endl;</div>
<div class="line"></div>
<div class="line"> cout.setf(ios::fixed, ios::floatfield);</div>
<div class="line"> cout.setf(ios::showpoint);</div>
<div class="line"> cout.precision(5);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// ================== Run simulation =======================</span></div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> nsnr = 0; nsnr < <a class="code" href="group__matrix__functions.html#gae48b61b3a51887969bf508abae267292">length</a>(EbN0db); nsnr++) {</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">double</span> Eb = 1.0; <span class="comment">// transmitted energy per information bit</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">double</span> N0 = <a class="code" href="group__logexpfunc.html#ga9a4a3d1188d2ec6a6815c237bd3ab2cc">inv_dB</a>(-EbN0db(nsnr));</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">double</span> sigma2 = N0; <span class="comment">// Variance of each scalar complex noise sample</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">double</span> Es = rate * 2 * nC * Eb; <span class="comment">// Energy per complex scalar symbol</span></div>
<div class="line"> <span class="comment">// (Each transmitted scalar complex symbol contains rate*2*nC</span></div>
<div class="line"> <span class="comment">// information bits.)</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">double</span> Ess = <a class="code" href="group__miscfunc.html#gaf559d29ca56ad3396a4284964b01a9b0">sqrt</a>(Es);</div>
<div class="line"></div>
<div class="line"> <a class="code" href="classitpp_1_1Array.html">Array<BERC></a> berc(Nmethods); <span class="comment">// counter for coded BER</span></div>
<div class="line"> <a class="code" href="classitpp_1_1Array.html">Array<BERC></a> bercu(Nmethods); <span class="comment">// counter for uncoded BER</span></div>
<div class="line"> <a class="code" href="classitpp_1_1Array.html">Array<BLERC></a> ferc(Nmethods); <span class="comment">// counter for coded FER</span></div>
<div class="line"></div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < Nmethods; i++) {</div>
<div class="line"> ferc(i).<a class="code" href="classitpp_1_1BLERC.html#a43db2b81f9aada3bb4b0d644fa188f5e">set_blocksize</a>(Nu);</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nbits = 0;</div>
<div class="line"> <span class="keywordflow">while</span> (nbits < Nbitsmax) {</div>
<div class="line"> nbits += Nu;</div>
<div class="line"></div>
<div class="line"> <span class="comment">// generate and encode random data</span></div>
<div class="line"> bvec inputbits = <a class="code" href="group__randgen.html#ga5aa06887cf1fd3301b040987924068f0">randb</a>(Nu);</div>
<div class="line"> bvec txbits;</div>
<div class="line"> code.<a class="code" href="classitpp_1_1Convolutional__Code.html#a47230acfea5aa32cb31e63abca1d222e">encode_tail</a>(inputbits, txbits);</div>
<div class="line"> <span class="comment">// coded block length is not always a multiple of the number of</span></div>
<div class="line"> <span class="comment">// bits per channel vector</span></div>
<div class="line"> txbits = <a class="code" href="namespaceitpp.html#a696b1a48581ac1a8af3069c12b2e55e3">concat</a>(txbits, <a class="code" href="group__randgen.html#ga5aa06887cf1fd3301b040987924068f0">randb</a>(Nctx - Nc));</div>
<div class="line"> txbits = sequence_interleaver_b.interleave(txbits);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// -- generate channel and data ----</span></div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k < Nvec; k++) {</div>
<div class="line"> <span class="comment">/* A complex valued channel matrix is used here. An</span></div>
<div class="line"><span class="comment"> alternative (with equivalent result) would be to use a</span></div>
<div class="line"><span class="comment"> real-valued (structured) channel matrix of twice the</span></div>
<div class="line"><span class="comment"> dimension.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> <span class="keywordflow">if</span> (k % Tc == 0) { <span class="comment">// generate a new channel realization every Tc intervals</span></div>
<div class="line"> H(k / Tc) = Ess * <a class="code" href="group__randgen.html#ga3c0042e44132fb903d44e7c5a03f5db3">randn_c</a>(nRx, nTx);</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <span class="comment">// modulate and transmit bits</span></div>
<div class="line"> bvec bitstmp = txbits(k * 2 * nTx * nC, (k + 1) * 2 * nTx * nC - 1);</div>
<div class="line"> cvec x = chan.<a class="code" href="classitpp_1_1Modulator__NCD.html#a6e0475c4f4dc96d08f5f4707a9dfaf17">modulate_bits</a>(bitstmp);</div>
<div class="line"> cvec e = <a class="code" href="group__miscfunc.html#gaf559d29ca56ad3396a4284964b01a9b0">sqrt</a>(sigma2) * <a class="code" href="group__randgen.html#ga3c0042e44132fb903d44e7c5a03f5db3">randn_c</a>(nRx);</div>
<div class="line"> Y(k) = H(k / Tc) * x + e;</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <span class="comment">// -- demodulate --</span></div>
<div class="line"> <a class="code" href="classitpp_1_1Array.html">Array<QLLRvec></a> LLRin(Nmethods);</div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < Nmethods; i++) {</div>
<div class="line"> LLRin(i) = <a class="code" href="group__specmat.html#gaf8d2a13297919881ce5d07b855455014">zeros_i</a>(Nctx);</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> QLLRvec llr_apr = <a class="code" href="group__specmat.html#gaf8d2a13297919881ce5d07b855455014">zeros_i</a>(nC * 2 * nTx); <span class="comment">// no a priori input to demodulator</span></div>
<div class="line"> QLLRvec llr_apost = <a class="code" href="group__specmat.html#gaf8d2a13297919881ce5d07b855455014">zeros_i</a>(nC * 2 * nTx);</div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k < Nvec; k++) {</div>
<div class="line"> <span class="comment">// zero forcing demodulation</span></div>
<div class="line"> <span class="keywordflow">if</span> (Contflag(0)) {</div>
<div class="line"> chan.<a class="code" href="classitpp_1_1Modulator__NCD.html#a38842dd03889ee7f7911053d767af86f">demodulate_soft_bits</a>(Y(k), H(k / Tc), sigma2, llr_apr, llr_apost,</div>
<div class="line"> <a class="code" href="classitpp_1_1Modulator__ND.html#a6e3b4c745f904cdb34301aeb4cc03035ad5798fd18f93f399475392b8aee09cba">ND_UQAM::ZF_LOGMAP</a>);</div>
<div class="line"> LLRin(0).set_subvector(k*Nbitspvec, llr_apost);</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <span class="comment">// ML demodulation</span></div>
<div class="line"> <span class="keywordflow">if</span> (Contflag(1)) {</div>
<div class="line"> chan.<a class="code" href="classitpp_1_1Modulator__NCD.html#a38842dd03889ee7f7911053d767af86f">demodulate_soft_bits</a>(Y(k), H(k / Tc), sigma2, llr_apr, llr_apost);</div>
<div class="line"> LLRin(1).set_subvector(k*Nbitspvec, llr_apost);</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <span class="comment">// -- decode and count errors --</span></div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < Nmethods; i++) {</div>
<div class="line"> bvec decoded_bits;</div>
<div class="line"> <span class="keywordflow">if</span> (Contflag(i)) {</div>
<div class="line"> bercu(i).count(txbits(0, Nc - 1), LLRin(i)(0, Nc - 1) < 0); <span class="comment">// uncoded BER</span></div>
<div class="line"> LLRin(i) = sequence_interleaver_i.deinterleave(LLRin(i), 0);</div>
<div class="line"> <span class="comment">// QLLR values must be converted to real numbers since the convolutional decoder wants this</span></div>
<div class="line"> vec llr = chan.<a class="code" href="classitpp_1_1Modulator__ND.html#ab68aa9155f305d9fb4e8d3cab45d5c9d">get_llrcalc</a>().<a class="code" href="classitpp_1_1LLR__calc__unit.html#a6fe45918d01b24059e4173b7bf939f91">to_double</a>(LLRin(i).left(Nc));</div>
<div class="line"> <span class="comment">// llr=-llr; // UNCOMMENT THIS LINE IF COMPILING WITH 3.10.5 OR EARLIER (BEFORE HARMONIZING LLR CONVENTIONS)</span></div>
<div class="line"> code.<a class="code" href="classitpp_1_1Convolutional__Code.html#a9f42d8c8bdb51460ebc7d43deb93bad7">decode_tail</a>(llr, decoded_bits);</div>
<div class="line"> berc(i).<a class="code" href="classitpp_1_1BERC.html#a539b0c989badff3027d97e4693fc9cd7">count</a>(inputbits(0, Nu - 1), decoded_bits(0, Nu - 1)); <span class="comment">// coded BER</span></div>
<div class="line"> ferc(i).<a class="code" href="classitpp_1_1BLERC.html#abe58d4abce92b4b53ad614a28aac20e7">count</a>(inputbits(0, Nu - 1), decoded_bits(0, Nu - 1)); <span class="comment">// coded FER</span></div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* Check whether it is time to terminate the simulation.</span></div>
<div class="line"><span class="comment"> Terminate when all demodulators that are still running have</span></div>
<div class="line"><span class="comment"> counted at least Nbers or Nfers bit/frame errors. */</span></div>
<div class="line"> <span class="keywordtype">int</span> minber = 1000000;</div>
<div class="line"> <span class="keywordtype">int</span> minfer = 1000000;</div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < Nmethods; i++) {</div>
<div class="line"> <span class="keywordflow">if</span> (Contflag(i)) {</div>
<div class="line"> minber = <a class="code" href="group__miscfunc.html#ga5393221565639e9f60d8ae9c05d1efdd">min</a>(minber, <a class="code" href="group__convertfunc.html#ga14bb8e68d119b1dfa214a77d4b3fd382">round_i</a>(berc(i).get_errors()));</div>
<div class="line"> minfer = <a class="code" href="group__miscfunc.html#ga5393221565639e9f60d8ae9c05d1efdd">min</a>(minfer, <a class="code" href="group__convertfunc.html#ga14bb8e68d119b1dfa214a77d4b3fd382">round_i</a>(ferc(i).get_errors()));</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">if</span> (Nbers > 0 && minber > Nbers) { <span class="keywordflow">break</span>;}</div>
<div class="line"> <span class="keywordflow">if</span> (Nfers > 0 && minfer > Nfers) { <span class="keywordflow">break</span>;}</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> cout << <span class="stringliteral">"-----------------------------------------------------"</span> << endl;</div>
<div class="line"> cout << <span class="stringliteral">"Eb/N0: "</span> << EbN0db(nsnr) << <span class="stringliteral">" dB. Simulated "</span> << nbits << <span class="stringliteral">" bits."</span> << endl;</div>
<div class="line"> cout << <span class="stringliteral">" Uncoded BER: "</span> << bercu(0).get_errorrate() << <span class="stringliteral">" (ZF); "</span> << bercu(1).get_errorrate() << <span class="stringliteral">" (ML)"</span> << endl;</div>
<div class="line"> cout << <span class="stringliteral">" Coded BER: "</span> << berc(0).<a class="code" href="classitpp_1_1BERC.html#af17d5f534ba34558d3632a98f29f0519">get_errorrate</a>() << <span class="stringliteral">" (ZF); "</span> << berc(1).<a class="code" href="classitpp_1_1BERC.html#af17d5f534ba34558d3632a98f29f0519">get_errorrate</a>() << <span class="stringliteral">" (ML)"</span> << endl;</div>
<div class="line"> cout << <span class="stringliteral">" Coded FER: "</span> << ferc(0).<a class="code" href="classitpp_1_1BLERC.html#a724ae26011a5389735bf7974775ff3ad">get_errorrate</a>() << <span class="stringliteral">" (ZF); "</span> << ferc(1).<a class="code" href="classitpp_1_1BLERC.html#a724ae26011a5389735bf7974775ff3ad">get_errorrate</a>() << <span class="stringliteral">" (ML)"</span> << endl;</div>
<div class="line"> cout.flush();</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* Check wheter it is time to terminate simulation. Stop when all</span></div>
<div class="line"><span class="comment"> methods have reached the min BER/FER of interest. */</span></div>
<div class="line"> <span class="keywordtype">int</span> contflag = 0;</div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < Nmethods; i++) {</div>
<div class="line"> <span class="keywordflow">if</span> (Contflag(i)) {</div>
<div class="line"> <span class="keywordflow">if</span> (berc(i).get_errorrate() > BERmin) { contflag = 1; }</div>
<div class="line"> <span class="keywordflow">else</span> { Contflag(i) = 0; }</div>
<div class="line"> <span class="keywordflow">if</span> (ferc(i).get_errorrate() > FERmin) { contflag = 1; }</div>
<div class="line"> <span class="keywordflow">else</span> { Contflag(i) = 0; }</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">if</span> (contflag) { <span class="keywordflow">continue</span>; }</div>
<div class="line"> <span class="keywordflow">else</span> {<span class="keywordflow">break</span>; }</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
</div><!-- fragment --><p>To run the program,</p>
<div class="fragment"><div class="line">mimoconv nTx nRx nC Tc</div>
</div><!-- fragment --><p> where</p>
<ul>
<li>nTx=number of transmit antennas</li>
<li>nRx=number of receive antennas</li>
<li>nC=constellation (1=QPSK, 2=16-QAM, 3=64-QAM)</li>
<li>Tc=coherence time (channel uses) </li>
</ul>
</div></div><!-- contents -->
<div style="clear: both; width: 100%; height: 31px; background-color: #ffff00; border: 1px solid #b0b0b0; margin: 5px 5px 5px 0; padding: 2px;">
<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=37044&type=1" alt="SourceForge Logo" style="float: right; border: 0;"></a>
<p style="padding-left: 10px; font-size: 85%;">Generated on Sat Mar 22 2014 05:34:27 for IT++ by <a href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.6</p>
</div>
</body>
</html>
|