Changeset 9519 for ossiedev/branches/hvolos/components/MIMODec/MIMODec.cpp
 Timestamp:
 08/22/09 22:18:16 (5 years ago)
 Files:

 1 modified
Legend:
 Unmodified
 Added
 Removed

ossiedev/branches/hvolos/components/MIMODec/MIMODec.cpp
r9492 r9519 18 18 Mr=1; 19 19 Nt=1; 20 MIMOmethod= "STBC";20 MIMOmethod=0; 21 21 Modmethod="BPSK"; 22 22 … … 99 99 if (strcmp(props[i].id, "DCE:74a38a7c3b3e11deb7e00000e80014f9") == 0) { 100 100 const char * prop_str; 101 //string prop_str; 101 102 props[i].value >>= prop_str; 102 MIMOmethod=prop_str; 103 //prop_str=prop_char; 104 105 if (strcmp(prop_str,"MRC")) { 106 MIMOmethod=0; 107 108 } else if (strcmp(prop_str,"STBC")) { 109 MIMOmethod=1; 110 111 } else if (strcmp(prop_str,"VBLAST")) { 112 MIMOmethod=2; 113 }; 103 114 } 104 115 … … 128 139 129 140 while (1) { 130 Mr=4; 131 Nt=2; 141 //Mr=4; 142 //Nt=2; 143 132 144 NH=Mr*Nt; 133 145 dataIn>getData(I_in, Q_in); … … 143 155 144 156 cx_mat H(Mr,Nt); 157 MIMOmethod=0; 158 std::cout<<Mr<<"X"<<Nt<<" M:"<< MIMOmethod<<" DL:"<<Data_length<<std::endl; 145 159 for (int i=0;i<Mr;i++) { 146 160 for (int j=0;j<Nt;j++) { 147 161 H(i,j)=cx_double((*I_in)[i*Mr+j],(*Q_in)[i*Mr+j])/10000.0; 148 //std::cout<<"Iin:"<<(*I_in)[i*2+j]; 162 //std::cout<<"Iin:"<<(*I_in)[i*2+j]<<" "; 163 std::cout<<"H("<<i<<","<<j<<")="<<H(i,j)<<" "; 149 164 } 150 165 } 151 //std::cout<<std::endl; 152 153 /*Alamouti 154 for i=1:2:length(RX_symbols1), 155 r1=RX_symbols1(i); 156 r2=RX_symbols1(i+1); 157 RX_symbols(i)=r1*conj(H(1,1))+conj(r2)*H(1,2); 158 RX_symbols(i+1)=r1*conj(H(1,2))conj(r2)*H(1,1); 159 end; 160 */ 166 std::cout<<std::endl; 161 167 162 168 cx_double r1; 163 169 cx_double r2; 164 170 cx_mat rx_symbols(((Data_lengthNH)/Mr),1); 165 short int j=0; 166 //std::cout<<"Decode"<<std::endl; 167 //std::cout<<"Hdec="<<H; 168 169 for (short int i=NH; i<Data_length;i+=2*Mr) { 170 rx_symbols(j,0)=0; 171 rx_symbols(j+1,0)=0; 172 173 for (short int k=0;k<Mr;k++) { 174 r1=cx_double((*I_in)[i+k],(*Q_in)[i+k]); 175 r2=cx_double((*I_in)[i+Mr+k],(*Q_in)[i+Mr+k]); 176 rx_symbols(j,0)+=r1*conj(H(k,0))+conj(r2)*H(k,1); 177 rx_symbols(j+1,0)+=r1*conj(H(k,1))conj(r2)*H(k,0); 178 171 short int j=0; 172 173 switch (MIMOmethod) { 174 case 0: 175 j=0; 176 177 for (short int i=NH; i<Data_length;i+=Mr) { 178 rx_symbols(j,0)=0; 179 180 for (short int k=0;k<Mr;k++) { 181 r1=cx_double((*I_in)[i+k],(*Q_in)[i+k]); 182 rx_symbols(j,0)+=r1*conj(H(k,0)); 183 std::cout<<i<<","<<j<<","<<k<<std::endl; 184 } 185 186 j+=1; 179 187 } 180 188 181 j+=2; 182 } 189 break; 190 case 1: 191 //std::cout<<std::endl; 192 193 /*Alamouti 194 for i=1:2:length(RX_symbols1), 195 r1=RX_symbols1(i); 196 r2=RX_symbols1(i+1); 197 RX_symbols(i)=r1*conj(H(1,1))+conj(r2)*H(1,2); 198 RX_symbols(i+1)=r1*conj(H(1,2))conj(r2)*H(1,1); 199 end; 200 */ 201 202 203 204 j=0; 205 //std::cout<<"Decode"<<std::endl; 206 //std::cout<<"Hdec="<<H; 207 208 for (short int i=NH; i<Data_length;i+=2*Mr) { 209 rx_symbols(j,0)=0; 210 rx_symbols(j+1,0)=0; 211 212 for (short int k=0;k<Mr;k++) { 213 r1=cx_double((*I_in)[i+k],(*Q_in)[i+k]); 214 r2=cx_double((*I_in)[i+Mr+k],(*Q_in)[i+Mr+k]); 215 rx_symbols(j,0)+=r1*conj(H(k,0))+conj(r2)*H(k,1); 216 rx_symbols(j+1,0)+=r1*conj(H(k,1))conj(r2)*H(k,0); 217 218 } 219 220 j+=2; 221 } 222 223 break; 224 case 2: 225 break; 226 } 227 183 228 double scale=1; 184 229 for (short int i=0; i<((Data_lengthNH)/Mr);i++) {