Commit 9b594ff3 authored by Roberto Louro Magueta's avatar Roberto Louro Magueta Committed by luis_pereira87

Fix AWGN channel

parent abb6fadd
......@@ -354,7 +354,7 @@ int main(int argc, char **argv)
printf("-b number of HARQ bits (1-2)\n");
printf("-B payload to be transmitted on PUCCH\n");
printf("-m initial cyclic shift m0\n");
printf("-T to check nacktoack miss for format 1");
printf("-T to check nacktoack miss for format 1\n");
exit (-1);
break;
}
......
......@@ -1616,6 +1616,22 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
struct complexd phase, alpha, beta;
start_meas(&desc->random_channel);
// For AWGN channel, the received signal (Srx) is equal to transmitted signal (Stx) plus noise (N), i.e., Srx = Stx + N,
// therefore, the channel matrix is the identity matrix.
if (desc->modelid == AWGN) {
for (aarx=0; aarx<desc->nb_rx; aarx++) {
for (aatx = 0; aatx < desc->nb_tx; aatx++) {
desc->ch[aarx+(aatx*desc->nb_rx)][0].r = aarx%desc->nb_tx == aatx ? 1.0 : 0.0;
desc->ch[aarx+(aatx*desc->nb_rx)][0].i = 0.0;
acorr[aarx+(aatx*desc->nb_rx)].r = desc->ch[aarx+(aatx*desc->nb_rx)][0].r;
acorr[aarx+(aatx*desc->nb_rx)].i = desc->ch[aarx+(aatx*desc->nb_rx)][0].i;
}
}
cblas_zcopy(desc->nb_tx*desc->nb_rx, (void *) acorr, 1, (void *) desc->a[0], 1);
stop_meas(&desc->random_channel);
desc->first_run = 0;
return 0;
}
bzero(acorr,desc->nb_tx*desc->nb_rx*sizeof(struct complexd));
for (i=0; i<(int)desc->nb_taps; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment