Merge branch 'develop' into develop-nr
This commit is contained in:
@@ -39,13 +39,14 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include "platform_constants.h"
|
||||
#ifdef UE_NAS_USE_TUN
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_tun.h>
|
||||
#include "openairinterface5g_limits.h"
|
||||
#endif
|
||||
|
||||
#include "pdcp.h"
|
||||
|
||||
char nl_rx_buf[NL_MAX_PAYLOAD];
|
||||
|
||||
@@ -54,20 +55,15 @@ struct nlmsghdr *nas_nlh_tx = NULL;
|
||||
struct nlmsghdr *nas_nlh_rx = NULL;
|
||||
struct iovec nas_iov_tx;
|
||||
struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)};
|
||||
#ifdef UE_NAS_USE_TUN
|
||||
int nas_sock_fd[NUMBER_OF_UE_MAX];
|
||||
#else
|
||||
int nas_sock_fd;
|
||||
#endif
|
||||
|
||||
int nas_sock_fd[MAX_MOBILES_PER_ENB];
|
||||
|
||||
struct msghdr nas_msg_tx;
|
||||
struct msghdr nas_msg_rx;
|
||||
|
||||
#define GRAAL_NETLINK_ID 31
|
||||
|
||||
#ifdef UE_NAS_USE_TUN
|
||||
|
||||
static int tun_alloc(char *dev)
|
||||
{
|
||||
static int tun_alloc(char *dev) {
|
||||
struct ifreq ifr;
|
||||
int fd, err;
|
||||
|
||||
@@ -77,66 +73,58 @@ static int tun_alloc(char *dev)
|
||||
}
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
|
||||
/* Flags: IFF_TUN - TUN device (no Ethernet headers)
|
||||
* IFF_TAP - TAP device
|
||||
*
|
||||
* IFF_NO_PI - Do not provide packet information
|
||||
*/
|
||||
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
|
||||
if( *dev )
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
|
||||
if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){
|
||||
close(fd);
|
||||
return err;
|
||||
if( *dev )
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
|
||||
if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) {
|
||||
close(fd);
|
||||
return err;
|
||||
}
|
||||
|
||||
strcpy(dev, ifr.ifr_name);
|
||||
return fd;
|
||||
}
|
||||
|
||||
int netlink_init(void)
|
||||
{
|
||||
int i;
|
||||
int netlink_init_tun(char *ifprefix, int num_if) {
|
||||
int ret;
|
||||
|
||||
char ifname[64];
|
||||
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
|
||||
sprintf(ifname, "oip%d", i+1);
|
||||
|
||||
for (int i = 0; i < num_if; i++) {
|
||||
sprintf(ifname, "oaitun_%.3s%d",ifprefix,i+1);
|
||||
nas_sock_fd[i] = tun_alloc(ifname);
|
||||
|
||||
if (nas_sock_fd[i] == -1) {
|
||||
printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd[i],errno, strerror(errno));
|
||||
printf("[NETLINK] Error opening socket %s (%d:%s)\n",ifname,errno, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd[i]);
|
||||
|
||||
#if !defined(PDCP_USE_NETLINK_QUEUES)
|
||||
printf("[NETLINK]Opened socket %s with fd %d\n",ifname,nas_sock_fd[i]);
|
||||
ret = fcntl(nas_sock_fd[i],F_SETFL,O_NONBLOCK);
|
||||
|
||||
if (ret == -1) {
|
||||
printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
|
||||
#if defined(LINK_ENB_PDCP_TO_IP_DRIVER)
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
if (LINK_ENB_PDCP_TO_IP_DRIVER) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&nas_src_addr, 0, sizeof(nas_src_addr));
|
||||
nas_src_addr.nl_family = AF_NETLINK;
|
||||
nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
|
||||
nas_src_addr.nl_groups = 0; /* not in mcast groups */
|
||||
ret = bind(nas_sock_fd[i], (struct sockaddr*)&nas_src_addr, sizeof(nas_src_addr));
|
||||
|
||||
|
||||
|
||||
ret = bind(nas_sock_fd[i], (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
|
||||
memset(&nas_dest_addr, 0, sizeof(nas_dest_addr));
|
||||
nas_dest_addr.nl_family = AF_NETLINK;
|
||||
nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
|
||||
nas_dest_addr.nl_groups = 0; /* unicast */
|
||||
|
||||
// TX PART
|
||||
nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
@@ -144,7 +132,6 @@ int netlink_init(void)
|
||||
nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD);
|
||||
nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */
|
||||
nas_nlh_tx->nlmsg_flags = 0;
|
||||
|
||||
nas_iov_tx.iov_base = (void *)nas_nlh_tx;
|
||||
nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len;
|
||||
memset(&nas_msg_tx,0,sizeof(nas_msg_tx));
|
||||
@@ -152,61 +139,50 @@ int netlink_init(void)
|
||||
nas_msg_tx.msg_namelen = sizeof(nas_dest_addr);
|
||||
nas_msg_tx.msg_iov = &nas_iov_tx;
|
||||
nas_msg_tx.msg_iovlen = 1;
|
||||
|
||||
|
||||
// RX PART
|
||||
memset(&nas_msg_rx,0,sizeof(nas_msg_rx));
|
||||
nas_msg_rx.msg_name = (void *)&nas_src_addr;
|
||||
nas_msg_rx.msg_namelen = sizeof(nas_src_addr);
|
||||
nas_msg_rx.msg_iov = &nas_iov_rx;
|
||||
nas_msg_rx.msg_iovlen = 1;
|
||||
}
|
||||
} /* for */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* UE_NAS_USE_TUN */
|
||||
|
||||
int netlink_init(void)
|
||||
{
|
||||
int netlink_init(void) {
|
||||
int ret;
|
||||
nas_sock_fd[0] = socket(PF_NETLINK, SOCK_RAW,GRAAL_NETLINK_ID);
|
||||
|
||||
nas_sock_fd = socket(PF_NETLINK, SOCK_RAW,GRAAL_NETLINK_ID);
|
||||
if (nas_sock_fd[0] == -1) {
|
||||
printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd[0],errno, strerror(errno));
|
||||
|
||||
if (nas_sock_fd == -1) {
|
||||
printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd,errno, strerror(errno));
|
||||
#if defined(LINK_ENB_PDCP_TO_IP_DRIVER)
|
||||
exit(1);
|
||||
#endif
|
||||
if (LINK_ENB_PDCP_TO_IP_DRIVER) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd);
|
||||
|
||||
#if !defined(PDCP_USE_NETLINK_QUEUES)
|
||||
ret = fcntl(nas_sock_fd,F_SETFL,O_NONBLOCK);
|
||||
printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd[0]);
|
||||
ret = fcntl(nas_sock_fd[0],F_SETFL,O_NONBLOCK);
|
||||
|
||||
if (ret == -1) {
|
||||
printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
|
||||
#if defined(LINK_ENB_PDCP_TO_IP_DRIVER)
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
if (LINK_ENB_PDCP_TO_IP_DRIVER) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&nas_src_addr, 0, sizeof(nas_src_addr));
|
||||
nas_src_addr.nl_family = AF_NETLINK;
|
||||
nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
|
||||
nas_src_addr.nl_groups = 0; /* not in mcast groups */
|
||||
ret = bind(nas_sock_fd, (struct sockaddr*)&nas_src_addr, sizeof(nas_src_addr));
|
||||
|
||||
|
||||
|
||||
ret = bind(nas_sock_fd[0], (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
|
||||
memset(&nas_dest_addr, 0, sizeof(nas_dest_addr));
|
||||
nas_dest_addr.nl_family = AF_NETLINK;
|
||||
nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
|
||||
nas_dest_addr.nl_groups = 0; /* unicast */
|
||||
|
||||
// TX PART
|
||||
nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
@@ -214,7 +190,6 @@ int netlink_init(void)
|
||||
nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD);
|
||||
nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */
|
||||
nas_nlh_tx->nlmsg_flags = 0;
|
||||
|
||||
nas_iov_tx.iov_base = (void *)nas_nlh_tx;
|
||||
nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len;
|
||||
memset(&nas_msg_tx,0,sizeof(nas_msg_tx));
|
||||
@@ -222,16 +197,12 @@ int netlink_init(void)
|
||||
nas_msg_tx.msg_namelen = sizeof(nas_dest_addr);
|
||||
nas_msg_tx.msg_iov = &nas_iov_tx;
|
||||
nas_msg_tx.msg_iovlen = 1;
|
||||
|
||||
|
||||
// RX PART
|
||||
memset(&nas_msg_rx,0,sizeof(nas_msg_rx));
|
||||
nas_msg_rx.msg_name = (void *)&nas_src_addr;
|
||||
nas_msg_rx.msg_namelen = sizeof(nas_src_addr);
|
||||
nas_msg_rx.msg_iov = &nas_iov_rx;
|
||||
nas_msg_rx.msg_iovlen = 1;
|
||||
|
||||
return(nas_sock_fd);
|
||||
return(nas_sock_fd[0]);
|
||||
}
|
||||
|
||||
#endif /* UE_NAS_USE_TUN */
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#define EMU_PROTO_H_
|
||||
|
||||
void init_bypass (void);
|
||||
void bypass_init ( unsigned int (*tx_handlerP) (unsigned char,char*, unsigned int*, unsigned int*),unsigned int (*rx_handlerP) (unsigned char,char*,unsigned int));
|
||||
void bypass_init ( unsigned int (*tx_handlerP) (unsigned char,char *, unsigned int *, unsigned int *),unsigned int (*rx_handlerP) (unsigned char,char *,unsigned int));
|
||||
int bypass_rx_data(unsigned int frame, unsigned int last_slot,
|
||||
unsigned int next_slot, uint8_t is_master);
|
||||
void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
|
||||
@@ -43,7 +43,7 @@ void bypass_tx_data (emu_transport_info_t Type, unsigned int frame, unsigned int
|
||||
|
||||
void emulation_tx_rx(void);
|
||||
|
||||
unsigned int emul_tx_handler(unsigned char Mode,char *Tx_buffer,unsigned int* Nbytes,unsigned int *Nb_flows);
|
||||
unsigned int emul_tx_handler(unsigned char Mode,char *Tx_buffer,unsigned int *Nbytes,unsigned int *Nb_flows);
|
||||
unsigned int emul_rx_handler(unsigned char Mode,char *rx_buffer, unsigned int Nbytes);
|
||||
|
||||
unsigned int emul_rx_data(void);
|
||||
@@ -62,5 +62,6 @@ int multicast_link_read_data_from_sock(uint8_t eNB_flag);
|
||||
void clear_eNB_transport_info(uint8_t);
|
||||
void clear_UE_transport_info(uint8_t);
|
||||
int netlink_init(void);
|
||||
int netlink_init_tun(char *ifsuffix, int num_if);
|
||||
|
||||
#endif /* EMU_PROTO_H_ */
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
@@ -0,0 +1,172 @@
|
||||
|
||||
static int cmpdouble(const void *p1, const void *p2) {
|
||||
return *(double *)p1 > *(double *)p2;
|
||||
}
|
||||
|
||||
double median(varArray_t *input) {
|
||||
return *(double *)((uint8_t *)(input+1)+(input->size/2)*input->atomSize);
|
||||
}
|
||||
|
||||
double q1(varArray_t *input) {
|
||||
return *(double *)((uint8_t *)(input+1)+(input->size/4)*input->atomSize);
|
||||
}
|
||||
|
||||
double q3(varArray_t *input) {
|
||||
return *(double *)((uint8_t *)(input+1)+(3*input->size/4)*input->atomSize);
|
||||
}
|
||||
|
||||
void dumpVarArray(varArray_t *input) {
|
||||
double *ptr=dataArray(input);
|
||||
printf("dumping size=%ld\n", input->size);
|
||||
|
||||
for (int i=0; i < input->size; i++)
|
||||
printf("%.1f:", *ptr++);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
void sumUpStats(time_stats_t * res, time_stats_t * src, int lastActive) {
|
||||
reset_meas(res);
|
||||
for (int i=0; i<RX_NB_TH; i++) {
|
||||
res->diff+=src[i].diff;
|
||||
res->diff_square+=src[i].diff_square;
|
||||
res->trials+=src[i].trials;
|
||||
if (src[i].max > res->max)
|
||||
res->max=src[i].max;
|
||||
}
|
||||
res->p_time=src[lastActive].p_time;
|
||||
}
|
||||
void sumUpStatsSlot(time_stats_t *res, time_stats_t src[RX_NB_TH][2], int lastActive) {
|
||||
reset_meas(res);
|
||||
for (int i=0; i<RX_NB_TH; i++) {
|
||||
res->diff+=src[i][0].diff+src[i][1].diff;
|
||||
res->diff_square+=src[i][0].diff_square+src[i][1].diff_square;
|
||||
res->trials+=src[i][0].trials+src[i][1].trials;
|
||||
if (src[i][0].max > res->max)
|
||||
res->max=src[i][0].max;
|
||||
if (src[i][1].max > res->max)
|
||||
res->max=src[i][1].max;}
|
||||
int last=src[lastActive][0].in < src[lastActive][1].in? 1 : 0 ;
|
||||
res->p_time=src[lastActive][last].p_time;
|
||||
}
|
||||
|
||||
double squareRoot(time_stats_t *ptr) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials -
|
||||
pow((double)ptr->diff/ptr->trials*timeBase,2));
|
||||
}
|
||||
|
||||
void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
printf("%-43s %6.2f us (%d trials)\n",
|
||||
txt,
|
||||
(double)ptr->diff/ptr->trials*timeBase,
|
||||
ptr->trials);
|
||||
printf(" Statistics std=%.2f, median=%.2f, q1=%.2f, q3=%.2f µs (on %ld trials)\n",
|
||||
squareRoot(ptr), median(sortedList),q1(sortedList),q3(sortedList), sortedList->size);
|
||||
}
|
||||
|
||||
void printStatIndent(time_stats_t *ptr, char *txt) {
|
||||
printf("|__ %-38s %6.2f us (%3d trials)\n",
|
||||
txt,
|
||||
ptr->trials?inMicroS(ptr->diff/ptr->trials):0,
|
||||
ptr->trials);
|
||||
}
|
||||
|
||||
void printStatIndent2(time_stats_t *ptr, char *txt) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
printf(" |__ %-34s %6.2f us (%3d trials)\n",
|
||||
txt,
|
||||
ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0,
|
||||
ptr->trials);
|
||||
}
|
||||
|
||||
void printStatIndent3(time_stats_t *ptr, char *txt) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
printf(" |__ %-30s %6.2f us (%3d trials)\n",
|
||||
txt,
|
||||
ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0,
|
||||
ptr->trials);
|
||||
}
|
||||
|
||||
|
||||
void logDistribution(FILE* fd, time_stats_t *ptr, varArray_t *sortedList, int dropped) {
|
||||
fprintf(fd,"%f;%f;%f;%f;%f;%f;%d;",
|
||||
squareRoot(ptr),
|
||||
(double)ptr->max, *(double*)dataArray(sortedList),
|
||||
median(sortedList),q1(sortedList),q3(sortedList),
|
||||
dropped);
|
||||
}
|
||||
|
||||
struct option * parse_oai_options(paramdef_t *options) {
|
||||
int l;
|
||||
|
||||
for(l=0; options[l].optname[0]!=0; l++) {};
|
||||
|
||||
struct option *long_options=calloc(sizeof(struct option),l);
|
||||
|
||||
for(int i=0; options[i].optname[0]!=0; i++) {
|
||||
long_options[i].name=options[i].optname;
|
||||
long_options[i].has_arg=options[i].paramflags==PARAMFLAG_BOOL?no_argument:required_argument;
|
||||
|
||||
if ( options[i].voidptr)
|
||||
switch (options[i].type) {
|
||||
case TYPE_INT:
|
||||
*options[i].iptr=options[i].defintval;
|
||||
break;
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
*options[i].dblptr=options[i].defdblval;
|
||||
break;
|
||||
|
||||
case TYPE_UINT8:
|
||||
*options[i].u8ptr=options[i].defintval;
|
||||
break;
|
||||
|
||||
case TYPE_UINT16:
|
||||
*options[i].u16ptr=options[i].defintval;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("not parsed type for default value %s\n", options[i].optname );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
continue;
|
||||
};
|
||||
return long_options;
|
||||
}
|
||||
|
||||
void display_options_values(paramdef_t *options, int verbose) {
|
||||
for(paramdef_t * ptr=options; ptr->optname[0]!=0; ptr++) {
|
||||
char varText[256]="need specific display";
|
||||
|
||||
if (ptr->voidptr != NULL) {
|
||||
if ( (ptr->paramflags & PARAMFLAG_BOOL) )
|
||||
strcpy(varText, *(bool *)ptr->iptr ? "True": "False" );
|
||||
else switch (ptr->type) {
|
||||
case TYPE_INT:
|
||||
sprintf(varText,"%d",*ptr->iptr);
|
||||
break;
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
sprintf(varText,"%.2f",*ptr->dblptr);
|
||||
break;
|
||||
|
||||
case TYPE_UINT8:
|
||||
sprintf(varText,"%d",(int)*ptr->u8ptr);
|
||||
break;
|
||||
|
||||
case TYPE_UINT16:
|
||||
sprintf(varText,"%d",(int)*ptr->u16ptr);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("not decoded type\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
printf("--%-20s set to %s\n",ptr->optname, varText);
|
||||
if (verbose) printf("%s\n",ptr->helpstr);
|
||||
}
|
||||
}
|
||||
+941
-1307
File diff suppressed because it is too large
Load Diff
+1857
-2034
File diff suppressed because it is too large
Load Diff
Regular → Executable
Executable → Regular
@@ -36,7 +36,7 @@
|
||||
#include "LAYER2/MAC/vars.h"
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#endif //XFORMS
|
||||
|
||||
|
||||
@@ -52,11 +52,8 @@ double cpuf;
|
||||
DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2_1E[2];
|
||||
#define UL_RB_ALLOC 0x1ff;
|
||||
#define CCCH_RB_ALLOC computeRIV(eNB->frame_parms.N_RB_UL,0,2)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,l,l2,aa,aarx,k;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1=0.0;
|
||||
uint8_t snr1set=0;
|
||||
@@ -64,48 +61,34 @@ int main(int argc, char **argv)
|
||||
int **txdata;
|
||||
double s_re0[2*30720],s_im0[2*30720],s_re1[2*30720],s_im1[2*30720];
|
||||
double r_re0[2*30720],r_im0[2*30720],r_re1[2*30720],r_im1[2*30720];
|
||||
double *s_re[2]={s_re0,s_re1},*s_im[2]={s_im0,s_im1},*r_re[2]={r_re0,r_re1},*r_im[2]={r_im0,r_im1};
|
||||
double *s_re[2]= {s_re0,s_re1},*s_im[2]= {s_im0,s_im1},*r_re[2]= {r_re0,r_re1},*r_im[2]= {r_im0,r_im1};
|
||||
double iqim = 0.0;
|
||||
int subframe=1;
|
||||
char fname[40];//, vname[40];
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=2;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
FILE *fd;
|
||||
|
||||
int eNB_id = 0;
|
||||
unsigned char mcs=0,awgn_flag=0,round;
|
||||
|
||||
int n_frames=1;
|
||||
channel_desc_t *eNB2UE;
|
||||
uint32_t nsymb,tx_lev,tx_lev_dB;
|
||||
uint8_t extended_prefix_flag=1;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
int hold_channel=0;
|
||||
|
||||
|
||||
uint16_t NB_RB=25;
|
||||
|
||||
int tdd_config=3;
|
||||
|
||||
SCM_t channel_model=MBSFN;
|
||||
|
||||
|
||||
unsigned char *input_buffer;
|
||||
unsigned short input_buffer_length;
|
||||
unsigned int ret;
|
||||
|
||||
unsigned int trials,errs[4]= {0,0,0,0}; //,round_trials[4]={0,0,0,0};
|
||||
|
||||
uint8_t N_RB_DL=25,osf=1;
|
||||
uint32_t perfect_ce = 0;
|
||||
|
||||
lte_frame_type_t frame_type = FDD;
|
||||
|
||||
uint32_t Nsoft = 1827072;
|
||||
|
||||
/*
|
||||
#ifdef XFORMS
|
||||
#ifdef XFORMS
|
||||
FD_lte_phy_scope_ue *form_ue;
|
||||
char title[255];
|
||||
|
||||
@@ -113,114 +96,110 @@ int main(int argc, char **argv)
|
||||
form_ue = create_lte_phy_scope_ue();
|
||||
sprintf (title, "LTE DL SCOPE UE");
|
||||
fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
logInit();
|
||||
number_of_cards = 1;
|
||||
|
||||
while ((c = getopt (argc, argv, "ahA:Cp:n:s:S:t:x:y:z:N:F:R:O:dm:i:Y")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
awgn_flag=1;
|
||||
break;
|
||||
case 'a':
|
||||
awgn_flag=1;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
frame_type = 0;
|
||||
break;
|
||||
case 'd':
|
||||
frame_type = 0;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
mcs=atoi(optarg);
|
||||
break;
|
||||
case 'm':
|
||||
mcs=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
input_snr_step = atof(optarg);
|
||||
break;
|
||||
case 'i':
|
||||
input_snr_step = atof(optarg);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p': // subframe no;
|
||||
subframe=atoi(optarg);
|
||||
break;
|
||||
case 'p': // subframe no;
|
||||
subframe=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
|
||||
if ((N_RB_DL!=6) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=100)) {
|
||||
printf("Unsupported Bandwidth %d\n",N_RB_DL);
|
||||
exit(-1);
|
||||
}
|
||||
if ((N_RB_DL!=6) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=100)) {
|
||||
printf("Unsupported Bandwidth %d\n",N_RB_DL);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
perfect_ce = 1;
|
||||
break;
|
||||
case 'Y':
|
||||
perfect_ce = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(subframe) -N cell_id -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -i snr increment -z RXant \n",argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN Channel\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(subframe) -N cell_id -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -i snr increment -z RXant \n",argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN Channel\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (awgn_flag == 1)
|
||||
channel_model = AWGN;
|
||||
|
||||
@@ -229,7 +208,6 @@ int main(int argc, char **argv)
|
||||
if ((subframe == 0) || (subframe == 5) || // TDD and FDD SFn 0,5;
|
||||
((frame_type == FDD) && ((subframe == 4) || (subframe == 9))) || // FDD SFn 4,9;
|
||||
((frame_type == TDD ) && ((subframe<3) || (subframe==6)))) { // TDD SFn 1,2,6;
|
||||
|
||||
printf("Illegal subframe %d for eMBMS transmission (frame_type %d)\n",subframe,frame_type);
|
||||
exit(-1);
|
||||
}
|
||||
@@ -239,16 +217,16 @@ int main(int argc, char **argv)
|
||||
|
||||
lte_param_init(n_tx,
|
||||
n_tx,
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
frame_type,
|
||||
Nid_cell,
|
||||
tdd_config,
|
||||
N_RB_DL,
|
||||
0,
|
||||
osf,
|
||||
perfect_ce);
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
frame_type,
|
||||
Nid_cell,
|
||||
tdd_config,
|
||||
N_RB_DL,
|
||||
0,
|
||||
osf,
|
||||
perfect_ce);
|
||||
|
||||
if (snr1set==0) {
|
||||
if (n_frames==1)
|
||||
@@ -258,7 +236,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &eNB->frame_parms;
|
||||
|
||||
if (awgn_flag == 0)
|
||||
@@ -270,7 +247,6 @@ int main(int argc, char **argv)
|
||||
printf("Cannot open %s, check permissions\n",fname);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
if (awgn_flag==0)
|
||||
fprintf(fd,"SNR_%d_%d=[];errs_mch_%d_%d=[];mch_trials_%d_%d=[];\n",
|
||||
@@ -284,23 +260,18 @@ int main(int argc, char **argv)
|
||||
mcs,N_RB_DL);
|
||||
|
||||
fflush(fd);
|
||||
|
||||
txdata = eNB->common_vars.txdata[0];
|
||||
|
||||
nsymb = 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d, AWGN %d\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb,awgn_flag);
|
||||
|
||||
eNB2UE = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
// Create transport channel structures for 2 transport blocks (MIMO)
|
||||
eNB->dlsch_MCH = new_eNB_dlsch(1,8,Nsoft,N_RB_DL,0,&eNB->frame_parms);
|
||||
|
||||
@@ -310,7 +281,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
UE->dlsch_MCH[0] = new_ue_dlsch(1,8,Nsoft,MAX_TURBO_ITERATIONS_MBSFN,N_RB_DL,0);
|
||||
|
||||
eNB->frame_parms.num_MBSFN_config = 1;
|
||||
eNB->frame_parms.MBSFN_config[0].radioframeAllocationPeriod = 0;
|
||||
eNB->frame_parms.MBSFN_config[0].radioframeAllocationOffset = 0;
|
||||
@@ -321,7 +291,6 @@ int main(int argc, char **argv)
|
||||
UE->frame_parms.MBSFN_config[0].radioframeAllocationOffset = 0;
|
||||
UE->frame_parms.MBSFN_config[0].fourFrames_flag = 0;
|
||||
UE->frame_parms.MBSFN_config[0].mbsfn_SubframeConfig=0xff; // activate all possible subframes
|
||||
|
||||
fill_eNB_dlsch_MCH(eNB,mcs,1,0);
|
||||
fill_UE_dlsch_MCH(UE,mcs,1,0,0);
|
||||
|
||||
@@ -333,7 +302,6 @@ int main(int argc, char **argv)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
input_buffer_length = eNB->dlsch_MCH->harq_processes[0]->TBS/8;
|
||||
input_buffer = (unsigned char *)malloc(input_buffer_length+4);
|
||||
memset(input_buffer,0,input_buffer_length+4);
|
||||
@@ -342,14 +310,12 @@ int main(int argc, char **argv)
|
||||
input_buffer[i]= (unsigned char)(taus()&0xff);
|
||||
}
|
||||
|
||||
|
||||
snr_step = input_snr_step;
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=snr_step) {
|
||||
UE->proc.proc_rxtx[0].frame_tx=0;
|
||||
eNB->proc.proc_rxtx[0].frame_tx=0;
|
||||
eNB->proc.proc_rxtx[0].subframe_tx=subframe;
|
||||
|
||||
errs[0]=0;
|
||||
errs[1]=0;
|
||||
errs[2]=0;
|
||||
@@ -365,14 +331,11 @@ int main(int argc, char **argv)
|
||||
// printf("Trial %d\n",trials);
|
||||
fflush(stdout);
|
||||
round=0;
|
||||
|
||||
//if (trials%100==0)
|
||||
//eNB2UE[0]->first_run = 1;
|
||||
eNB2UE->first_run = 1;
|
||||
memset(&eNB->common_vars.txdataF[0][0][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t));
|
||||
generate_mch(eNB,&eNB->proc.proc_rxtx[0],input_buffer);
|
||||
|
||||
|
||||
PHY_ofdm_mod(eNB->common_vars.txdataF[0][0], // input,
|
||||
txdata[0], // output
|
||||
frame_parms->ofdm_symbol_size,
|
||||
@@ -382,7 +345,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (n_frames==1) {
|
||||
LOG_M("txsigF0.m","txsF0", &eNB->common_vars.txdataF[0][0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],
|
||||
nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
//if (eNB->frame_parms.nb_antennas_tx>1)
|
||||
//LOG_M("txsigF1.m","txsF1", &eNB->lte_eNB_common_vars.txdataF[eNB_id][1][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
}
|
||||
@@ -400,11 +363,9 @@ int main(int argc, char **argv)
|
||||
if (n_frames==1) {
|
||||
printf("tx_lev = %d (%d dB)\n",tx_lev,tx_lev_dB);
|
||||
// LOG_M("txsig0.m","txs0", &eNB->common_vars.txdata[0][0][subframe* eNB->frame_parms.samples_per_tti],
|
||||
|
||||
// eNB->frame_parms.samples_per_tti,1,1);
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<2*frame_parms->samples_per_tti; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
s_re[aa][i] = ((double)(((short *)eNB->common_vars.txdata[0][aa]))[(2*subframe*UE->frame_parms.samples_per_tti) + (i<<1)]);
|
||||
@@ -415,7 +376,6 @@ int main(int argc, char **argv)
|
||||
//Multipath channel
|
||||
multipath_channel(eNB2UE,s_re,s_im,r_re,r_im,
|
||||
2*frame_parms->samples_per_tti,hold_channel);
|
||||
|
||||
//AWGN
|
||||
sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)eNB->frame_parms.ofdm_symbol_size/(NB_RB*12)) - SNR;
|
||||
sigma2 = pow(10,sigma2_dB/10);
|
||||
@@ -426,67 +386,70 @@ int main(int argc, char **argv)
|
||||
for (i=0; i<2*frame_parms->samples_per_tti; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
//printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]);
|
||||
((short*) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i] =
|
||||
((short *) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i] =
|
||||
(short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
((short*) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i+1] =
|
||||
((short *) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i+1] =
|
||||
(short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
}
|
||||
}
|
||||
|
||||
for (l=2; l<12; l++) {
|
||||
|
||||
slot_fep_mbsfn(UE,
|
||||
l,
|
||||
subframe%10,
|
||||
0,
|
||||
0);
|
||||
if (UE->perfect_ce==1) {
|
||||
// fill in perfect channel estimates
|
||||
freq_channel(eNB2UE,UE->frame_parms.N_RB_DL,12*UE->frame_parms.N_RB_DL + 1);
|
||||
for(k=0; k<NUMBER_OF_eNB_MAX; k++) {
|
||||
for(aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
|
||||
((int16_t *) UE->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[k][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP);
|
||||
((int16_t *) UE->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[k][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (l==6)
|
||||
for (l2=2;l2<7;l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
if (l==6)
|
||||
for (l2=2;l2<7;l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
if (l==11)
|
||||
for (l2=7;l2<12;l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
if (UE->perfect_ce==1) {
|
||||
// fill in perfect channel estimates
|
||||
freq_channel(eNB2UE,UE->frame_parms.N_RB_DL,12*UE->frame_parms.N_RB_DL + 1);
|
||||
|
||||
for(k=0; k<NUMBER_OF_eNB_MAX; k++) {
|
||||
for(aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
|
||||
((int16_t *) UE->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[k][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+
|
||||
(aa*frame_parms->nb_antennas_rx)][i].x*AMP);
|
||||
((int16_t *) UE->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[k][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+
|
||||
(aa*frame_parms->nb_antennas_rx)][i].y*AMP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (l==6)
|
||||
for (l2=2; l2<7; l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
|
||||
if (l==6)
|
||||
for (l2=2; l2<7; l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
|
||||
if (l==11)
|
||||
for (l2=7; l2<12; l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
}
|
||||
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->G = get_G(&UE->frame_parms,
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->nb_rb,
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even,
|
||||
get_Qm(UE->dlsch_MCH[0]->harq_processes[0]->mcs),
|
||||
1,2,
|
||||
UE->proc.proc_rxtx[0].frame_tx,subframe,0);
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->nb_rb,
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even,
|
||||
get_Qm(UE->dlsch_MCH[0]->harq_processes[0]->mcs),
|
||||
1,2,
|
||||
UE->proc.proc_rxtx[0].frame_tx,subframe,0);
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->Qm = get_Qm(UE->dlsch_MCH[0]->harq_processes[0]->mcs);
|
||||
|
||||
dlsch_unscrambling(&UE->frame_parms,1,UE->dlsch_MCH[0],
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->G,
|
||||
UE->pdsch_vars_MCH[0]->llr[0],0,subframe<<1);
|
||||
|
||||
ret = dlsch_decoding(UE,
|
||||
UE->pdsch_vars_MCH[0]->llr[0],
|
||||
&UE->frame_parms,
|
||||
@@ -497,7 +460,7 @@ int main(int argc, char **argv)
|
||||
0,0,0);
|
||||
|
||||
if (n_frames==1)
|
||||
printf("MCH decoding returns %d\n",ret);
|
||||
printf("MCH decoding returns %u\n",ret);
|
||||
|
||||
if (ret == (1+UE->dlsch_MCH[0]->max_turbo_iterations))
|
||||
errs[0]++;
|
||||
@@ -506,15 +469,15 @@ int main(int argc, char **argv)
|
||||
eNB->proc.proc_rxtx[0].frame_tx++;
|
||||
}
|
||||
|
||||
printf("errors %d/%d (Pe %e)\n",errs[round],trials,(double)errs[round]/trials);
|
||||
printf("errors %u/%u (Pe %e)\n",errs[round],trials,(double)errs[round]/trials);
|
||||
|
||||
if (awgn_flag==0)
|
||||
fprintf(fd,"SNR_%d_%d = [SNR_%d_%d %f]; errs_mch_%d_%d =[errs_mch_%d_%d %d]; mch_trials_%d_%d =[mch_trials_%d_%d %d];\n",
|
||||
fprintf(fd,"SNR_%d_%d = [SNR_%d_%d %f]; errs_mch_%d_%d =[errs_mch_%d_%d %u]; mch_trials_%d_%d =[mch_trials_%d_%d %u];\n",
|
||||
mcs,N_RB_DL,mcs,N_RB_DL,SNR,
|
||||
mcs,N_RB_DL,mcs,N_RB_DL,errs[0],
|
||||
mcs,N_RB_DL,mcs,N_RB_DL,trials);
|
||||
else
|
||||
fprintf(fd,"SNR_awgn_%d = [SNR_awgn_%d %f]; errs_mch_awgn_%d =[errs_mch_awgn_%d %d]; mch_trials_awgn_%d =[mch_trials_awgn_%d %d];\n",
|
||||
fprintf(fd,"SNR_awgn_%d = [SNR_awgn_%d %f]; errs_mch_awgn_%d =[errs_mch_awgn_%d %u]; mch_trials_awgn_%d =[mch_trials_awgn_%d %u];\n",
|
||||
N_RB_DL,N_RB_DL,SNR,
|
||||
N_RB_DL,N_RB_DL,errs[0],
|
||||
N_RB_DL,N_RB_DL,trials);
|
||||
@@ -525,7 +488,6 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (n_frames==1) {
|
||||
printf("Dumping PMCH files ( G %d)\n",UE->dlsch_MCH[0]->harq_processes[0]->G);
|
||||
dump_mch(UE,0,
|
||||
@@ -536,9 +498,7 @@ int main(int argc, char **argv)
|
||||
printf("Freeing dlsch structures\n");
|
||||
free_eNB_dlsch(eNB->dlsch_MCH);
|
||||
free_ue_dlsch(UE->dlsch_MCH[0]);
|
||||
|
||||
fclose(fd);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "LAYER2/MAC/vars.h"
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#endif
|
||||
|
||||
#include "OCG_vars.h"
|
||||
@@ -58,11 +58,8 @@ int32_t dummy2[2048*14];
|
||||
int32_t dummy3[2048*14];
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,l,aa;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1;
|
||||
uint8_t snr1set=0;
|
||||
@@ -81,127 +78,119 @@ int main(int argc, char **argv)
|
||||
int trial, n_trials, ntrials=1, n_errors,n_errors2,n_alamouti;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
int n_frames=1;
|
||||
channel_desc_t *eNB2UE,*eNB2UE1 = NULL,*eNB2UE2 = NULL;
|
||||
uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
|
||||
uint8_t extended_prefix_flag=0;
|
||||
int8_t interf1=-21,interf2=-21;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
FILE *input_fd=NULL,*pbch_file_fd=NULL;
|
||||
char input_val_str[50],input_val_str2[50];
|
||||
// double input_val1,input_val2;
|
||||
// uint16_t amask=0;
|
||||
uint8_t frame_mod4,num_pdcch_symbols = 0;
|
||||
uint16_t NB_RB=25;
|
||||
|
||||
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||
|
||||
//DCI_ALLOC_t dci_alloc[8];
|
||||
uint8_t abstraction_flag=0;//,calibration_flag=0;
|
||||
double pbch_sinr;
|
||||
int pbch_tx_ant;
|
||||
uint8_t N_RB_DL=25,osf=1;
|
||||
|
||||
unsigned char frame_type = 0;
|
||||
unsigned char pbch_phase = 0;
|
||||
|
||||
#ifdef XFORMS
|
||||
FD_lte_phy_scope_ue *form_ue;
|
||||
char title[255];
|
||||
#endif
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
logInit();
|
||||
number_of_cards = 1;
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:N:F:GR:O:dP:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
output_fd = fopen(optarg,"w");
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
output_fd = fopen(optarg,"w");
|
||||
|
||||
if (output_fd==NULL) {
|
||||
printf("Error opening %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (output_fd==NULL) {
|
||||
printf("Error opening %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
frame_type = 1;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
case 'd':
|
||||
frame_type = 1;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
case 'i':
|
||||
interf1=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
case 'j':
|
||||
interf2=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
interf1=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
interf2=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 't':
|
||||
Td= atof(optarg);
|
||||
break;
|
||||
*/
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'r':
|
||||
@@ -212,111 +201,111 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
abstraction_flag=1;
|
||||
ntrials=10000;
|
||||
msg("Running Abstraction test\n");
|
||||
pbch_file_fd=fopen(optarg,"r");
|
||||
case 'A':
|
||||
abstraction_flag=1;
|
||||
ntrials=10000;
|
||||
msg("Running Abstraction test\n");
|
||||
pbch_file_fd=fopen(optarg,"r");
|
||||
|
||||
if (pbch_file_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (pbch_file_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
// case 'C':
|
||||
// calibration_flag=1;
|
||||
// msg("Running Abstraction calibration for Bias removal\n");
|
||||
// break;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
input_fd = fopen(optarg,"r");
|
||||
case 'F':
|
||||
input_fd = fopen(optarg,"r");
|
||||
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
pbch_phase = atoi(optarg);
|
||||
case 'P':
|
||||
pbch_phase = atoi(optarg);
|
||||
|
||||
if (pbch_phase>3)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||
if (pbch_phase>3)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
// printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
// printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +313,6 @@ int main(int argc, char **argv)
|
||||
n_tx=2;
|
||||
|
||||
lte_param_init(n_tx, n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,3,N_RB_DL,0,osf,0);
|
||||
|
||||
eNB1 = malloc(sizeof(PHY_VARS_eNB));
|
||||
eNB2 = malloc(sizeof(PHY_VARS_eNB));
|
||||
UE->measurements.n_adj_cells=2;
|
||||
@@ -334,19 +322,16 @@ int main(int argc, char **argv)
|
||||
for (i=0; i<3; i++)
|
||||
lte_gold(&eNB->frame_parms,UE->lte_gold_table[i],Nid_cell+i);
|
||||
|
||||
memcpy((void*)&eNB1->frame_parms,(void*)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
memcpy((void *)&eNB1->frame_parms,(void *)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
eNB1->frame_parms.Nid_cell=Nid_cell+1;
|
||||
eNB1->frame_parms.nushift=(Nid_cell+1)%6;
|
||||
eNB1->Mod_id=1;
|
||||
|
||||
memcpy((void*)&eNB2->frame_parms,(void*)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
memcpy((void *)&eNB2->frame_parms,(void *)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
eNB2->frame_parms.Nid_cell=Nid_cell+2;
|
||||
eNB2->frame_parms.nushift=(Nid_cell+2)%6;
|
||||
eNB2->Mod_id=2;
|
||||
|
||||
phy_init_lte_eNB(eNB1,0,0);
|
||||
phy_init_lte_eNB(eNB2,0,0);
|
||||
|
||||
#ifdef XFORMS
|
||||
fl_initialize (&argc, argv, NULL, 0, 0);
|
||||
form_ue = create_lte_phy_scope_ue();
|
||||
@@ -362,38 +347,27 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &eNB->frame_parms;
|
||||
|
||||
|
||||
|
||||
txdata = eNB->common_vars.txdata[0];
|
||||
txdata1 = eNB1->common_vars.txdata[0];
|
||||
txdata2 = eNB2->common_vars.txdata[0];
|
||||
|
||||
|
||||
s_re = malloc(2*sizeof(double*));
|
||||
s_im = malloc(2*sizeof(double*));
|
||||
s_re1 = malloc(2*sizeof(double*));
|
||||
s_im1 = malloc(2*sizeof(double*));
|
||||
s_re2 = malloc(2*sizeof(double*));
|
||||
s_im2 = malloc(2*sizeof(double*));
|
||||
r_re = malloc(2*sizeof(double*));
|
||||
r_im = malloc(2*sizeof(double*));
|
||||
r_re1 = malloc(2*sizeof(double*));
|
||||
r_im1 = malloc(2*sizeof(double*));
|
||||
r_re2 = malloc(2*sizeof(double*));
|
||||
r_im2 = malloc(2*sizeof(double*));
|
||||
|
||||
s_re = malloc(2*sizeof(double *));
|
||||
s_im = malloc(2*sizeof(double *));
|
||||
s_re1 = malloc(2*sizeof(double *));
|
||||
s_im1 = malloc(2*sizeof(double *));
|
||||
s_re2 = malloc(2*sizeof(double *));
|
||||
s_im2 = malloc(2*sizeof(double *));
|
||||
r_re = malloc(2*sizeof(double *));
|
||||
r_im = malloc(2*sizeof(double *));
|
||||
r_re1 = malloc(2*sizeof(double *));
|
||||
r_im1 = malloc(2*sizeof(double *));
|
||||
r_re2 = malloc(2*sizeof(double *));
|
||||
r_im2 = malloc(2*sizeof(double *));
|
||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d, interf (%d,%d)\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb,interf1,interf2);
|
||||
|
||||
printf("eNB1->common_vars.txdataF[0][0] = %p\n",
|
||||
eNB1->common_vars.txdataF[0][0]);
|
||||
|
||||
|
||||
DLSCH_alloc_pdu2.rah = 0;
|
||||
DLSCH_alloc_pdu2.rballoc = DLSCH_RB_ALLOC;
|
||||
DLSCH_alloc_pdu2.TPC = 0;
|
||||
@@ -405,12 +379,11 @@ int main(int argc, char **argv)
|
||||
DLSCH_alloc_pdu2.rv1 = 0;
|
||||
// Forget second codeword
|
||||
DLSCH_alloc_pdu2.tpmi = (transmission_mode==6 ? 5 : 0) ; // precoding
|
||||
|
||||
eNB2UE = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
@@ -419,8 +392,8 @@ int main(int argc, char **argv)
|
||||
eNB2UE1 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
4,
|
||||
0);
|
||||
@@ -429,20 +402,18 @@ int main(int argc, char **argv)
|
||||
eNB2UE2 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
8,
|
||||
0);
|
||||
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
|
||||
s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -455,7 +426,6 @@ int main(int argc, char **argv)
|
||||
bzero(s_re2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im2[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_im2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
|
||||
r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -487,7 +457,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (input_fd==NULL) {
|
||||
|
||||
// for (i=0;i<6;i++)
|
||||
// pbch_pdu[i] = i;
|
||||
pbch_pdu[0]=100;
|
||||
@@ -515,7 +484,6 @@ int main(int argc, char **argv)
|
||||
&eNB->frame_parms,
|
||||
(eNB->frame_parms.Ncp==0) ? 5 : 4,
|
||||
10);
|
||||
|
||||
} else {
|
||||
generate_sss(eNB->common_vars.txdataF[0],
|
||||
AMP,
|
||||
@@ -537,8 +505,6 @@ int main(int argc, char **argv)
|
||||
&eNB->frame_parms,
|
||||
2,
|
||||
12);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -552,16 +518,12 @@ int main(int argc, char **argv)
|
||||
dci_alloc[1].L = 3;
|
||||
dci_alloc[1].rnti = 0x1234;
|
||||
*/
|
||||
|
||||
printf("Generating PBCH for mode1_flag = %d\n", eNB->frame_parms.mode1_flag);
|
||||
|
||||
|
||||
generate_pilots(eNB,
|
||||
eNB->common_vars.txdataF[0],
|
||||
AMP,
|
||||
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
|
||||
|
||||
/*
|
||||
num_pdcch_symbols = generate_dci_top(1,
|
||||
dci_alloc,
|
||||
@@ -572,7 +534,6 @@ int main(int argc, char **argv)
|
||||
0);
|
||||
*/
|
||||
|
||||
|
||||
if (num_pdcch_symbols<3) {
|
||||
printf("Less than 3 pdcch symbols\n");
|
||||
// exit(-1);
|
||||
@@ -584,7 +545,7 @@ int main(int argc, char **argv)
|
||||
dummybuf[2] = dummy2;
|
||||
dummybuf[3] = dummy3;
|
||||
generate_pbch(&eNB->pbch,
|
||||
(int32_t**)dummybuf,
|
||||
(int32_t **)dummybuf,
|
||||
AMP,
|
||||
&eNB->frame_parms,
|
||||
pbch_pdu,
|
||||
@@ -618,15 +579,12 @@ int main(int argc, char **argv)
|
||||
eNB1->common_vars.txdataF[0],
|
||||
AMP,
|
||||
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
|
||||
|
||||
generate_pbch(&eNB1->pbch,
|
||||
eNB1->common_vars.txdataF[0],
|
||||
AMP,
|
||||
&eNB1->frame_parms,
|
||||
pbch_pdu,
|
||||
0);
|
||||
|
||||
}
|
||||
|
||||
if (interf2>-20) {
|
||||
@@ -638,27 +596,19 @@ int main(int argc, char **argv)
|
||||
0);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
generate_pilots(eNB2,
|
||||
eNB2->common_vars.txdataF[0],
|
||||
AMP,
|
||||
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
|
||||
|
||||
generate_pbch(&eNB2->pbch,
|
||||
eNB2->common_vars.txdataF[0],
|
||||
AMP,
|
||||
&eNB2->frame_parms,
|
||||
pbch_pdu,
|
||||
0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// LOG_M("pilotsF.m","rsF",txdataF[0],frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
LOG_M("txsigF0.m","txsF0", eNB->common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
|
||||
|
||||
if (eNB->frame_parms.nb_antennas_tx>1)
|
||||
@@ -668,9 +618,6 @@ int main(int argc, char **argv)
|
||||
tx_lev1 = 0;
|
||||
tx_lev2 = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (frame_parms->Ncp == 1)
|
||||
PHY_ofdm_mod(eNB->common_vars.txdataF[0][aa], // input,
|
||||
@@ -743,7 +690,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
// tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||
|
||||
LOG_M("txsig0.m","txs0", txdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
|
||||
if (frame_parms->nb_antennas_tx>1)
|
||||
@@ -762,17 +708,17 @@ int main(int argc, char **argv)
|
||||
i=0;
|
||||
|
||||
while (!feof(input_fd)) {
|
||||
if (fscanf(input_fd,"%s %s",input_val_str,input_val_str2) != 2) { //&input_val1,&input_val2);
|
||||
if (fscanf(input_fd,"%49s %49s",input_val_str,input_val_str2) != 2) { //&input_val1,&input_val2);
|
||||
printf("%s:%d:%s: error with fscanf, exiting\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((i%4)==0) {
|
||||
((short*)txdata[0])[i/2] = (short)((1<<15)*strtod(input_val_str,NULL));
|
||||
((short*)txdata[0])[(i/2)+1] = (short)((1<<15)*strtod(input_val_str2,NULL));
|
||||
((short *)txdata[0])[i/2] = (short)((1<<15)*strtod(input_val_str,NULL));
|
||||
((short *)txdata[0])[(i/2)+1] = (short)((1<<15)*strtod(input_val_str2,NULL));
|
||||
|
||||
if ((i/4)<100)
|
||||
printf("sample %d => %e + j%e (%d +j%d)\n",i/4,strtod(input_val_str,NULL),strtod(input_val_str2,NULL),((short*)txdata[0])[i/4],((short*)txdata[0])[(i/4)+1]);//1,input_val2,);
|
||||
printf("sample %d => %e + j%e (%d +j%d)\n",i/4,strtod(input_val_str,NULL),strtod(input_val_str2,NULL),((short *)txdata[0])[i/4],((short *)txdata[0])[(i/4)+1]); //1,input_val2,);
|
||||
}
|
||||
|
||||
i++;
|
||||
@@ -789,7 +735,6 @@ int main(int argc, char **argv)
|
||||
// tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||
}
|
||||
|
||||
|
||||
// multipath channel
|
||||
|
||||
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
@@ -809,10 +754,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
||||
|
||||
|
||||
n_errors = 0;
|
||||
n_errors2 = 0;
|
||||
n_alamouti = 0;
|
||||
@@ -824,8 +766,6 @@ int main(int argc, char **argv)
|
||||
printf("*********************** trial %d ***************************\n",trial);
|
||||
|
||||
while (pbch_sinr>-2.0) {
|
||||
|
||||
|
||||
multipath_channel(eNB2UE,s_re,s_im,r_re,r_im,
|
||||
2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,0);
|
||||
|
||||
@@ -882,8 +822,8 @@ int main(int argc, char **argv)
|
||||
r_im[aa][i] += (pow(10.0,.05*interf1)*r_im1[aa][i] + pow(10.0,.05*interf2)*r_im2[aa][i]);
|
||||
}
|
||||
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) UE->common_vars.rxdata[aa])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) UE->common_vars.rxdata[aa])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -892,7 +832,6 @@ int main(int argc, char **argv)
|
||||
10*log10(signal_energy(&UE->common_vars.rxdata[0][frame_parms->samples_per_tti/2],4*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// optional: read rx_frame from file
|
||||
if ((rx_frame_file = fopen("rx_frame.dat","r")) == NULL)
|
||||
@@ -911,19 +850,15 @@ int main(int argc, char **argv)
|
||||
fclose(rx_frame_file);
|
||||
*/
|
||||
|
||||
|
||||
for (l=0; l<eNB->frame_parms.symbols_per_tti; l++) {
|
||||
|
||||
// subframe_offset = (l/eNB->frame_parms.symbols_per_tti)*eNB->frame_parms.samples_per_tti;
|
||||
// printf("subframe_offset = %d\n",subframe_offset);
|
||||
|
||||
slot_fep(UE,
|
||||
l%(eNB->frame_parms.symbols_per_tti/2),
|
||||
l/(eNB->frame_parms.symbols_per_tti/2),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
0);
|
||||
|
||||
if (l==0) {
|
||||
lte_ue_measurements(UE,
|
||||
@@ -961,16 +896,14 @@ int main(int argc, char **argv)
|
||||
//sprintf(fname,"dl_ch00_%d.m",l);
|
||||
//sprintf(vname,"dl_ch00_%d",l);
|
||||
//LOG_M(fname,vname,&(common_vars->dl_ch_estimates[0][frame_parms->ofdm_symbol_size*(l%6)]),frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
lte_est_freq_offset(UE->common_vars.common_vars_rx_data_per_thread[/*subframe*/0&0x1].dl_ch_estimates[0],
|
||||
&UE->frame_parms,
|
||||
l,
|
||||
&freq_offset,
|
||||
1);
|
||||
1);
|
||||
}
|
||||
|
||||
if (l==((eNB->frame_parms.Ncp==0)?10:9)) {
|
||||
|
||||
for (frame_mod4=0; frame_mod4<4; frame_mod4++) {
|
||||
pbch_tx_ant = rx_pbch(&UE->common_vars,
|
||||
UE->pbch_vars[0],
|
||||
@@ -1003,7 +936,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((pbch_tx_ant>0) && (pbch_tx_ant<4)) {
|
||||
if (n_frames==1)
|
||||
msg("pbch decoded sucessfully mode1_flag %d, frame_mod4 %d, tx_ant %d!\n",
|
||||
@@ -1023,7 +955,6 @@ int main(int argc, char **argv)
|
||||
UE,
|
||||
0,0,1);
|
||||
#endif
|
||||
|
||||
} //noise trials
|
||||
|
||||
if (abstraction_flag==1) {
|
||||
@@ -1049,7 +980,6 @@ int main(int argc, char **argv)
|
||||
} // NSR
|
||||
|
||||
if (n_frames==1) {
|
||||
|
||||
LOG_M("H00.m","h00",&(UE->common_vars.common_vars_rx_data_per_thread[/*subframe*/0&0x1].dl_ch_estimates[0][0][0]),((frame_parms->Ncp==0)?7:6)*(eNB->frame_parms.ofdm_symbol_size),1,1);
|
||||
|
||||
if (n_tx==2)
|
||||
@@ -1062,7 +992,6 @@ int main(int argc, char **argv)
|
||||
LOG_M("PBCH_rxF_llr.m","pbch_llr",UE->pbch_vars[0]->llr,(frame_parms->Ncp==0) ? 1920 : 1728,1,4);
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
@@ -1074,15 +1003,15 @@ int main(int argc, char **argv)
|
||||
free(s_im);
|
||||
free(r_re);
|
||||
free(r_im);
|
||||
|
||||
|
||||
lte_sync_time_free();
|
||||
|
||||
if (write_output_file)
|
||||
fclose(output_fd);
|
||||
|
||||
return(n_errors);
|
||||
if (input_fd != NULL)
|
||||
fclose(input_fd);
|
||||
|
||||
return(n_errors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Regular → Executable
File diff suppressed because it is too large
Load Diff
@@ -48,11 +48,8 @@ extern uint16_t prach_root_sequence_map0_3[838];
|
||||
|
||||
void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,aa,aarx;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1=0.0,ue_speed0=0.0,ue_speed1=0.0;
|
||||
uint8_t snr1set=0;
|
||||
@@ -64,7 +61,6 @@ int main(int argc, char **argv)
|
||||
int trial; //, ntrials=1;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
uint8_t awgn_flag=0;
|
||||
uint8_t hs_flag=0;
|
||||
int n_frames=1;
|
||||
@@ -73,9 +69,7 @@ int main(int argc, char **argv)
|
||||
uint8_t extended_prefix_flag=0;
|
||||
// int8_t interf1=-19,interf2=-19;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
SCM_t channel_model=Rayleigh1;
|
||||
|
||||
// uint8_t abstraction_flag=0,calibration_flag=0;
|
||||
// double prach_sinr;
|
||||
uint8_t osf=1,N_RB_DL=25;
|
||||
@@ -91,211 +85,212 @@ int main(int argc, char **argv)
|
||||
double ue_speed = 0;
|
||||
int NCS_config = 1,rootSequenceIndex=0;
|
||||
int threequarter_fs = 0;
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
logInit();
|
||||
|
||||
number_of_cards = 1;
|
||||
|
||||
|
||||
|
||||
while ((c = getopt (argc, argv, "hHaA:Cr:p:g:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
printf("Running AWGN simulation\n");
|
||||
awgn_flag = 1;
|
||||
/* ntrials not used later, no need to set */
|
||||
//ntrials=1;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
delay = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
case 'a':
|
||||
printf("Running AWGN simulation\n");
|
||||
awgn_flag = 1;
|
||||
/* ntrials not used later, no need to set */
|
||||
//ntrials=1;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
case 'd':
|
||||
delay = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
channel_model=Rayleigh8;
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
channel_model=Rayleigh1;
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
channel_model=Rayleigh1_corr;
|
||||
break;
|
||||
|
||||
case 'K':
|
||||
channel_model=Rayleigh1_anticorr;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
channel_model=Rice8;
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
channel_model=Rice1;
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
channel_model=Rayleigh1_800;
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
threequarter_fs=1;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
preamble_tx=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
ue_speed0 = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
ue_speed1 = atoi(optarg);
|
||||
ue_speed1set = 1;
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
NCS_config = atoi(optarg);
|
||||
|
||||
if ((NCS_config > 15) || (NCS_config < 0))
|
||||
printf("Illegal NCS_config %d, (should be 0-15)\n",NCS_config);
|
||||
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
channel_model=Rayleigh8;
|
||||
|
||||
case 'I':
|
||||
channel_model=Rayleigh1;
|
||||
|
||||
case 'J':
|
||||
channel_model=Rayleigh1_corr;
|
||||
|
||||
case 'K':
|
||||
channel_model=Rayleigh1_anticorr;
|
||||
printf("High-Speed Flag enabled\n");
|
||||
hs_flag = 1;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
channel_model=Rice8;
|
||||
rootSequenceIndex = atoi(optarg);
|
||||
|
||||
case 'M':
|
||||
channel_model=Rice1;
|
||||
if ((rootSequenceIndex < 0) || (rootSequenceIndex > 837))
|
||||
printf("Illegal rootSequenceNumber %d, (should be 0-837)\n",rootSequenceIndex);
|
||||
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
channel_model=Rayleigh1_800;
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
threequarter_fs=1;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
preamble_tx=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
ue_speed0 = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
ue_speed1 = atoi(optarg);
|
||||
ue_speed1set = 1;
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
NCS_config = atoi(optarg);
|
||||
|
||||
if ((NCS_config > 15) || (NCS_config < 0))
|
||||
printf("Illegal NCS_config %d, (should be 0-15)\n",NCS_config);
|
||||
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
printf("High-Speed Flag enabled\n");
|
||||
hs_flag = 1;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
rootSequenceIndex = atoi(optarg);
|
||||
|
||||
if ((rootSequenceIndex < 0) || (rootSequenceIndex > 837))
|
||||
printf("Illegal rootSequenceNumber %d, (should be 0-837)\n",rootSequenceIndex);
|
||||
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -a(wgn on) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN channel and not multipath\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-g [A,B,C,D,E,F,G,I,N] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) or Rayleigh1 (I) or Rayleigh1_800 (N) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-z Number of RX antennas used in eNB\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
// printf("-f PRACH format (0=1,1=2,2=3,3=4)\n");
|
||||
printf("-d Channel delay \n");
|
||||
printf("-v Starting UE velocity in km/h, runs from 'v' to 'v+50km/h'. If n_frames is 1 just 'v' is simulated \n");
|
||||
printf("-V Ending UE velocity in km/h, runs from 'v' to 'V'");
|
||||
printf("-L rootSequenceIndex (0-837)\n");
|
||||
printf("-Z NCS_config (ZeroCorrelationZone) (0-15)\n");
|
||||
printf("-H Run with High-Speed Flag enabled \n");
|
||||
printf("-R Number of PRB (6,15,25,50,75,100)\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
case 'h':
|
||||
printf("%s -h(elp) -a(wgn on) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN channel and not multipath\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-g [A,B,C,D,E,F,G,I,N] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) or Rayleigh1 (I) or Rayleigh1_800 (N) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-z Number of RX antennas used in eNB\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
// printf("-f PRACH format (0=1,1=2,2=3,3=4)\n");
|
||||
printf("-d Channel delay \n");
|
||||
printf("-v Starting UE velocity in km/h, runs from 'v' to 'v+50km/h'. If n_frames is 1 just 'v' is simulated \n");
|
||||
printf("-V Ending UE velocity in km/h, runs from 'v' to 'V'");
|
||||
printf("-L rootSequenceIndex (0-837)\n");
|
||||
printf("-Z NCS_config (ZeroCorrelationZone) (0-15)\n");
|
||||
printf("-H Run with High-Speed Flag enabled \n");
|
||||
printf("-R Number of PRB (6,15,25,50,75,100)\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,17 +299,16 @@ int main(int argc, char **argv)
|
||||
|
||||
lte_param_init(n_tx,
|
||||
n_tx,
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
FDD,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
threequarter_fs,
|
||||
osf,
|
||||
0);
|
||||
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
FDD,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
threequarter_fs,
|
||||
osf,
|
||||
0);
|
||||
|
||||
if (snr1set==0) {
|
||||
if (n_frames==1)
|
||||
@@ -331,30 +325,22 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &eNB->frame_parms;
|
||||
|
||||
|
||||
txdata = UE->common_vars.txdata;
|
||||
printf("txdata %p\n",&txdata[0][subframe*frame_parms->samples_per_tti]);
|
||||
|
||||
s_re = malloc(2*sizeof(double*));
|
||||
s_im = malloc(2*sizeof(double*));
|
||||
r_re = malloc(2*sizeof(double*));
|
||||
r_im = malloc(2*sizeof(double*));
|
||||
s_re = malloc(2*sizeof(double *));
|
||||
s_im = malloc(2*sizeof(double *));
|
||||
r_re = malloc(2*sizeof(double *));
|
||||
r_im = malloc(2*sizeof(double *));
|
||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb);
|
||||
|
||||
|
||||
|
||||
msg("[SIM] Using SCM/101\n");
|
||||
UE2eNB = new_channel_desc_scm(UE->frame_parms.nb_antennas_tx,
|
||||
eNB->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
0.0,
|
||||
delay,
|
||||
0);
|
||||
@@ -365,12 +351,10 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
|
||||
s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
|
||||
r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -382,30 +366,22 @@ int main(int argc, char **argv)
|
||||
UE->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=NCS_config;
|
||||
UE->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag=hs_flag;
|
||||
UE->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
|
||||
|
||||
|
||||
eNB->frame_parms.prach_config_common.rootSequenceIndex=rootSequenceIndex;
|
||||
eNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0;
|
||||
eNB->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=NCS_config;
|
||||
eNB->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag=hs_flag;
|
||||
eNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
|
||||
|
||||
eNB->node_function = eNodeB_3GPP;
|
||||
eNB->proc.subframe_rx = subframe;
|
||||
eNB->proc.subframe_prach = subframe;
|
||||
|
||||
/* N_ZC not used later, so prach_fmt is also useless, don't set */
|
||||
//prach_fmt = get_prach_fmt(eNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
||||
// eNB->frame_parms.frame_type);
|
||||
/* N_ZC not used later, no need to set */
|
||||
//N_ZC = (prach_fmt <4)?839:139;
|
||||
|
||||
compute_prach_seq(&eNB->frame_parms.prach_config_common,eNB->frame_parms.frame_type,eNB->X_u);
|
||||
|
||||
compute_prach_seq(&UE->frame_parms.prach_config_common,UE->frame_parms.frame_type,UE->X_u);
|
||||
|
||||
UE->prach_vars[0]->amp = AMP;
|
||||
|
||||
UE->prach_resources[0] = &prach_resources;
|
||||
|
||||
if (preamble_tx == 99)
|
||||
@@ -416,18 +392,14 @@ int main(int argc, char **argv)
|
||||
|
||||
UE->prach_resources[0]->ra_PreambleIndex = preamble_tx;
|
||||
UE->prach_resources[0]->ra_TDD_map_index = 0;
|
||||
|
||||
tx_lev = generate_prach(UE,
|
||||
0, //eNB_id,
|
||||
subframe,
|
||||
0); //Nf
|
||||
|
||||
/* tx_lev_dB not used later, no need to set */
|
||||
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||
|
||||
LOG_M("txsig0_new.m","txs0", &txdata[0][subframe*frame_parms->samples_per_tti],frame_parms->samples_per_tti,1,1);
|
||||
//LOG_M("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
|
||||
// multipath channel
|
||||
dump_prach_config(&eNB->frame_parms,subframe);
|
||||
|
||||
@@ -450,8 +422,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
||||
for (ue_speed=ue_speed0; ue_speed<ue_speed1; ue_speed+=10) {
|
||||
delay_avg = 0.0;
|
||||
@@ -461,7 +431,6 @@ int main(int argc, char **argv)
|
||||
prach_errors=0;
|
||||
|
||||
for (trial=0; trial<n_frames; trial++) {
|
||||
|
||||
sigma2_dB = 10*log10((double)tx_lev) - SNR;
|
||||
|
||||
if (n_frames==1)
|
||||
@@ -471,7 +440,6 @@ int main(int argc, char **argv)
|
||||
sigma2 = pow(10,sigma2_dB/10);
|
||||
// printf("Sigma2 %f (sigma2_dB %f)\n",sigma2,sigma2_dB);
|
||||
|
||||
|
||||
if (awgn_flag == 0) {
|
||||
multipath_tv_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
2*frame_parms->samples_per_tti,0);
|
||||
@@ -485,9 +453,8 @@ int main(int argc, char **argv)
|
||||
|
||||
for (i=0; i<frame_parms->samples_per_tti; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,7 +463,6 @@ int main(int argc, char **argv)
|
||||
preamble_delay_list,
|
||||
0, //Nf
|
||||
0); //tdd_mapindex
|
||||
|
||||
preamble_energy_max = preamble_energy_list[0];
|
||||
preamble_max = 0;
|
||||
|
||||
@@ -524,8 +490,8 @@ int main(int argc, char **argv)
|
||||
LOG_M("prach0.m","prach0", &txdata[0][subframe*frame_parms->samples_per_tti],frame_parms->samples_per_tti,1,1);
|
||||
LOG_M("prachF0.m","prachF0", &eNB->prach_vars.prachF[0],24576,1,1);
|
||||
LOG_M("rxsig0.m","rxs0",
|
||||
&eNB->common_vars.rxdata[0][0][subframe*frame_parms->samples_per_tti],
|
||||
frame_parms->samples_per_tti,1,1);
|
||||
&eNB->common_vars.rxdata[0][0][subframe*frame_parms->samples_per_tti],
|
||||
frame_parms->samples_per_tti,1,1);
|
||||
LOG_M("rxsigF0.m","rxsF0", eNB->prach_vars.rxsigF[0],6144,1,1);
|
||||
LOG_M("prach_preamble.m","prachp",&eNB->X_u[0],839,1,1);
|
||||
}
|
||||
@@ -539,7 +505,6 @@ int main(int argc, char **argv)
|
||||
// printf("(%f,%f)\n",SNR,(double)prach_errors/(double)n_frames);
|
||||
} //SNR loop
|
||||
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
@@ -551,11 +516,8 @@ int main(int argc, char **argv)
|
||||
free(s_im);
|
||||
free(r_re);
|
||||
free(r_im);
|
||||
|
||||
lte_sync_time_free();
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,37 +45,29 @@ PHY_VARS_UE *UE;
|
||||
|
||||
double cpuf;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,l,aa;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1=0.0;
|
||||
uint8_t snr1set=0;
|
||||
//mod_sym_t **txdataF;
|
||||
int **txdata;
|
||||
double s_re0[30720],s_re1[30720],s_im0[30720],s_im1[30720],r_re0[30720],r_im0[30720],r_re1[30720],r_im1[30720];
|
||||
double *s_re[2]={s_re0,s_re1};
|
||||
double *s_im[2]={s_im0,s_im1};
|
||||
double *r_re[2]={r_re0,r_re1};
|
||||
double *r_im[2]={r_im0,r_im1};
|
||||
double *s_re[2]= {s_re0,s_re1};
|
||||
double *s_im[2]= {s_im0,s_im1};
|
||||
double *r_re[2]= {r_re0,r_re1};
|
||||
double *r_im[2]= {r_im0,r_im1};
|
||||
double ricean_factor=0.0000005,iqim=0.0;
|
||||
|
||||
int trial, n_trials, ntrials=1, n_errors;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
unsigned char eNB_id = 0;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
int n_frames=1;
|
||||
channel_desc_t *UE2eNB;
|
||||
uint32_t nsymb,tx_lev;
|
||||
uint8_t extended_prefix_flag=0;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
SCM_t channel_model=Rayleigh1_corr;
|
||||
|
||||
// double pucch_sinr;
|
||||
uint8_t osf=1,N_RB_DL=25;
|
||||
uint32_t pucch_tx=0,pucch1_missed=0,pucch1_false=0,pucch3_false=0,sig;
|
||||
@@ -90,202 +82,203 @@ int main(int argc, char **argv)
|
||||
double stat_no_sig,stat_sig;
|
||||
uint8_t N0=40;
|
||||
uint8_t pucch1_thres=10;
|
||||
|
||||
uint16_t n1_pucch = 0;
|
||||
uint16_t n2_pucch = 0;
|
||||
uint16_t n3_pucch = 20;
|
||||
|
||||
uint16_t n_rnti=0x1234;
|
||||
|
||||
number_of_cards = 1;
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
while ((c = getopt (argc, argv, "har:pf:g:n:s:S:x:y:z:N:F:T:R:")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
printf("Running AWGN simulation\n");
|
||||
channel_model = AWGN;
|
||||
ntrials=1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
if (atoi(optarg)==0)
|
||||
pucch_format = pucch_format1;
|
||||
else if (atoi(optarg)==1)
|
||||
pucch_format = pucch_format1a;
|
||||
else if (atoi(optarg)==2)
|
||||
pucch_format = pucch_format1b;
|
||||
else if (atoi(optarg)==6) // 3,4,5 is reserved for format2,2a,2b
|
||||
pucch_format = pucch_format3;
|
||||
else {
|
||||
printf("Unsupported pucch_format %d\n",atoi(optarg));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
case 'a':
|
||||
printf("Running AWGN simulation\n");
|
||||
channel_model = AWGN;
|
||||
ntrials=1;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
case 'f':
|
||||
if (atoi(optarg)==0)
|
||||
pucch_format = pucch_format1;
|
||||
else if (atoi(optarg)==1)
|
||||
pucch_format = pucch_format1a;
|
||||
else if (atoi(optarg)==2)
|
||||
pucch_format = pucch_format1b;
|
||||
else if (atoi(optarg)==6) // 3,4,5 is reserved for format2,2a,2b
|
||||
pucch_format = pucch_format3;
|
||||
else {
|
||||
printf("Unsupported pucch_format %d\n",atoi(optarg));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
channel_model=Rayleigh8;
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
channel_model=Rayleigh1;
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
channel_model=Rayleigh1_corr;
|
||||
break;
|
||||
|
||||
case 'K':
|
||||
channel_model=Rayleigh1_anticorr;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
channel_model=Rice8;
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
channel_model=Rice1;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
printf("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
printf("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
ricean_factor = pow(10,-.1*atof(optarg));
|
||||
|
||||
if (ricean_factor>1) {
|
||||
printf("Ricean factor must be between 0 and 1\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
printf("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
printf("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
printf("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
N0 = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
pucch1_thres = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
channel_model=Rayleigh8;
|
||||
|
||||
case 'I':
|
||||
channel_model=Rayleigh1;
|
||||
|
||||
case 'J':
|
||||
channel_model=Rayleigh1_corr;
|
||||
|
||||
case 'K':
|
||||
channel_model=Rayleigh1_anticorr;
|
||||
|
||||
case 'L':
|
||||
channel_model=Rice8;
|
||||
|
||||
case 'M':
|
||||
channel_model=Rice1;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
printf("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
printf("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
ricean_factor = pow(10,-.1*atof(optarg));
|
||||
|
||||
if (ricean_factor>1) {
|
||||
printf("Ricean factor must be between 0 and 1\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
printf("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
printf("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
printf("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
N0 = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
pucch1_thres = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -a(wgn on) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -r Ricean_FactordB -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN channel and not multipath\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-r Ricean factor (dB, 0 means Rayleigh, 100 is almost AWGN\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Noise variance in dB\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-f PUCCH format (0=1,1=1a,2=1b,6=3), formats 2/2a/2b not supported\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
case 'h':
|
||||
printf("%s -h(elp) -a(wgn on) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -r Ricean_FactordB -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN channel and not multipath\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-r Ricean factor (dB, 0 means Rayleigh, 100 is almost AWGN\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Noise variance in dB\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-f PUCCH format (0=1,1=1a,2=1b,6=3), formats 2/2a/2b not supported\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,17 +292,16 @@ int main(int argc, char **argv)
|
||||
|
||||
lte_param_init(n_tx,
|
||||
n_tx,
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
FDD,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
0,
|
||||
osf,
|
||||
0);
|
||||
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
FDD,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
0,
|
||||
osf,
|
||||
0);
|
||||
|
||||
if (snr1set==0) {
|
||||
if (n_frames==1)
|
||||
@@ -319,42 +311,30 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &eNB->frame_parms;
|
||||
|
||||
|
||||
txdata = eNB->common_vars.txdata[eNB_id];
|
||||
|
||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb);
|
||||
|
||||
|
||||
|
||||
printf("[SIM] Using SCM/101\n");
|
||||
UE2eNB = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
0.0,
|
||||
0,
|
||||
0);
|
||||
|
||||
|
||||
if (UE2eNB==NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
init_ncs_cell(&eNB->frame_parms,eNB->ncs_cell);
|
||||
|
||||
init_ncs_cell(&UE->frame_parms,UE->ncs_cell);
|
||||
|
||||
init_ul_hopping(&eNB->frame_parms);
|
||||
init_ul_hopping(&UE->frame_parms);
|
||||
|
||||
eNB->frame_parms.pucch_config_common.deltaPUCCH_Shift = 2;
|
||||
eNB->frame_parms.pucch_config_common.nRB_CQI = 4;
|
||||
eNB->frame_parms.pucch_config_common.nCS_AN = 6;
|
||||
@@ -362,40 +342,38 @@ int main(int argc, char **argv)
|
||||
UE->frame_parms.pucch_config_common.nRB_CQI = 4;
|
||||
UE->frame_parms.pucch_config_common.nCS_AN = 6;
|
||||
|
||||
|
||||
if( (pucch_format == pucch_format1) || (pucch_format == pucch_format1a) || (pucch_format == pucch_format1b) ){
|
||||
if( (pucch_format == pucch_format1) || (pucch_format == pucch_format1a) || (pucch_format == pucch_format1b) ) {
|
||||
pucch_payload = 0;
|
||||
generate_pucch1x(UE->common_vars.txdataF,
|
||||
frame_parms,
|
||||
UE->ncs_cell,
|
||||
pucch_format,
|
||||
&pucch_config_dedicated,
|
||||
n1_pucch,
|
||||
0, //shortened_format,
|
||||
&pucch_payload,
|
||||
AMP, //amp,
|
||||
subframe); //subframe
|
||||
}else if( pucch_format == pucch_format3){
|
||||
for(i=0;i<pucch3_payload_size;i++)
|
||||
frame_parms,
|
||||
UE->ncs_cell,
|
||||
pucch_format,
|
||||
&pucch_config_dedicated,
|
||||
n1_pucch,
|
||||
0, //shortened_format,
|
||||
&pucch_payload,
|
||||
AMP, //amp,
|
||||
subframe); //subframe
|
||||
} else if( pucch_format == pucch_format3) {
|
||||
for(i=0; i<pucch3_payload_size; i++)
|
||||
pucch3_payload[i]=(uint8_t)(taus()&0x1);
|
||||
|
||||
generate_pucch3x(UE->common_vars.txdataF,
|
||||
frame_parms,
|
||||
UE->ncs_cell,
|
||||
pucch_format,
|
||||
&pucch_config_dedicated,
|
||||
n3_pucch,
|
||||
0, //shortened_format,
|
||||
pucch3_payload,
|
||||
AMP, //amp,
|
||||
subframe, //subframe
|
||||
n_rnti); //rnti
|
||||
frame_parms,
|
||||
UE->ncs_cell,
|
||||
pucch_format,
|
||||
&pucch_config_dedicated,
|
||||
n3_pucch,
|
||||
0, //shortened_format,
|
||||
pucch3_payload,
|
||||
AMP, //amp,
|
||||
subframe, //subframe
|
||||
n_rnti); //rnti
|
||||
}
|
||||
|
||||
LOG_M("txsigF0.m","txsF0", &UE->common_vars.txdataF[0][2*subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX],OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX*nsymb,1,1);
|
||||
|
||||
tx_lev = 0;
|
||||
|
||||
|
||||
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (frame_parms->Ncp == 1)
|
||||
PHY_ofdm_mod(&UE->common_vars.txdataF[aa][2*subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX], // input,
|
||||
@@ -413,16 +391,12 @@ int main(int argc, char **argv)
|
||||
//apply_7_5_kHz(UE,UE->common_vars.txdata[aa],1+(subframe<<1));
|
||||
apply_7_5_kHz(UE,&txdata[aa][eNB->frame_parms.samples_per_tti*subframe],0);
|
||||
apply_7_5_kHz(UE,&txdata[aa][eNB->frame_parms.samples_per_tti*subframe],1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
tx_lev += signal_energy(&txdata[aa][subframe*eNB->frame_parms.samples_per_tti],
|
||||
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOG_M("txsig0.m","txs0", txdata[0], FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
//LOG_M("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
|
||||
@@ -435,28 +409,19 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
||||
|
||||
printf("n_frames %d SNR %f\n",n_frames,SNR);
|
||||
|
||||
n_errors = 0;
|
||||
pucch_tx = 0;
|
||||
pucch1_missed=0;
|
||||
pucch1_false=0;
|
||||
pucch3_false=0;
|
||||
|
||||
stat_no_sig = 0;
|
||||
stat_sig = 0;
|
||||
|
||||
for (trial=0; trial<n_frames; trial++) {
|
||||
|
||||
|
||||
|
||||
multipath_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
eNB->frame_parms.samples_per_tti,0);
|
||||
|
||||
sigma2_dB = N0;//10*log10((double)tx_lev) - SNR;
|
||||
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);
|
||||
|
||||
@@ -478,11 +443,11 @@ int main(int argc, char **argv)
|
||||
sig=1;
|
||||
} else {
|
||||
if (trial<(n_frames>>1)) {
|
||||
//printf("no sig =>");
|
||||
//printf("no sig =>");
|
||||
sig= 0;
|
||||
} else {
|
||||
sig=1;
|
||||
//printf("sig =>");
|
||||
//printf("sig =>");
|
||||
pucch_tx++;
|
||||
}
|
||||
}
|
||||
@@ -493,14 +458,11 @@ int main(int argc, char **argv)
|
||||
// fill measurement symbol (19) with noise
|
||||
for (i=0; i<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
if (n_trials==0) {
|
||||
@@ -508,14 +470,12 @@ int main(int argc, char **argv)
|
||||
// r_im[aa][i] += (pow(10.0,.05*interf1)*r_im1[aa][i] + pow(10.0,.05*interf2)*r_im2[aa][i]);
|
||||
}
|
||||
|
||||
|
||||
if (sig==1) {
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) (((tx_gain*r_re[aa][i]) +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) (((tx_gain*r_im[aa][i]) + (iqim*r_re[aa][i]*tx_gain) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) (((tx_gain*r_re[aa][i]) +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) (((tx_gain*r_im[aa][i]) + (iqim*r_re[aa][i]*tx_gain) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
} else {
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -524,7 +484,6 @@ int main(int argc, char **argv)
|
||||
remove_7_5_kHz(eNB,1+(subframe<<1));
|
||||
|
||||
for (l=0; l<eNB->frame_parms.symbols_per_tti/2; l++) {
|
||||
|
||||
slot_fep_ul(&eNB->frame_parms,
|
||||
&eNB->common_vars,
|
||||
l,
|
||||
@@ -539,16 +498,13 @@ int main(int argc, char **argv)
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// if (sig == 1)
|
||||
// printf("*");
|
||||
lte_eNB_I0_measurements(eNB,
|
||||
subframe,
|
||||
0,
|
||||
0,
|
||||
1);
|
||||
eNB->measurements[0].n0_power_tot_dB = N0;//(int8_t)(sigma2_dB-10*log10(eNB->frame_parms.ofdm_symbol_size/(12*NB_RB)));
|
||||
stat = rx_pucch(eNB,
|
||||
@@ -580,9 +536,9 @@ int main(int argc, char **argv)
|
||||
}*/
|
||||
} else if( (pucch_format==pucch_format1a) || (pucch_format==pucch_format1b) ) {
|
||||
pucch1_false = (pucch_payload_rx != pucch_payload) ? (pucch1_false+1) : pucch1_false;
|
||||
} else if (pucch_format==pucch_format3){
|
||||
for(i=0;i<pucch3_payload_size;i++){
|
||||
if(pucch3_payload[i]!=pucch3_payload_rx[i]){
|
||||
} else if (pucch_format==pucch_format3) {
|
||||
for(i=0; i<pucch3_payload_size; i++) {
|
||||
if(pucch3_payload[i]!=pucch3_payload_rx[i]) {
|
||||
pucch3_false = (pucch3_false+1);
|
||||
break;
|
||||
}
|
||||
@@ -611,11 +567,8 @@ int main(int argc, char **argv)
|
||||
LOG_M("rxsigF0.m","rxsF0", &eNB->common_vars.rxdataF[0][0][0],512*nsymb*2,2,1);
|
||||
}
|
||||
|
||||
|
||||
lte_sync_time_free();
|
||||
|
||||
return(n_errors);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "LAYER2/MAC/vars.h"
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#endif
|
||||
|
||||
#include "OCG_vars.h"
|
||||
@@ -58,11 +58,8 @@ mod_sym_t dummy2[2048*14];
|
||||
mod_sym_t dummy3[2048*14];
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,l,aa;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1;
|
||||
uint8_t snr1set=0;
|
||||
@@ -82,226 +79,192 @@ int main(int argc, char **argv)
|
||||
int trial, n_trials, ntrials=1, n_errors,n_errors2,n_alamouti;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
int n_frames=1;
|
||||
channel_desc_t *eNB2UE,*eNB2UE1,*eNB2UE2;
|
||||
uint32_t nsymb,tx_lev,tx_lev1,tx_lev2;
|
||||
uint8_t extended_prefix_flag=0;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
FILE *input_fd=NULL,*pbch_file_fd=NULL;
|
||||
char input_val_str[50],input_val_str2[50];
|
||||
// double input_val1,input_val2;
|
||||
// uint16_t amask=0;
|
||||
uint8_t frame_mod4,num_pdcch_symbols;
|
||||
uint16_t NB_RB=25;
|
||||
|
||||
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||
|
||||
DCI_ALLOC_t dci_alloc[8];
|
||||
uint8_t abstraction_flag=0;//,calibration_flag=0;
|
||||
int pbch_tx_ant;
|
||||
uint8_t N_RB_DL=100,osf=1;
|
||||
|
||||
unsigned char frame_type = FDD;
|
||||
unsigned char pbch_phase = 0;
|
||||
|
||||
#ifdef XFORMS
|
||||
FD_lte_phy_scope_ue *form_ue;
|
||||
char title[255];
|
||||
#endif
|
||||
|
||||
logInit();
|
||||
number_of_cards = 1;
|
||||
openair_daq_vars.rx_rf_mode = 1;
|
||||
|
||||
/*
|
||||
rxdataF = (int **)malloc16(2*sizeof(int*));
|
||||
rxdataF[0] = (int *)malloc16(FRAME_LENGTH_BYTES);
|
||||
rxdataF[1] = (int *)malloc16(FRAME_LENGTH_BYTES);
|
||||
|
||||
rxdata = (int **)malloc16(2*sizeof(int*));
|
||||
rxdata[0] = (int *)malloc16(FRAME_LENGTH_BYTES);
|
||||
rxdata[1] = (int *)malloc16(FRAME_LENGTH_BYTES);
|
||||
*/
|
||||
while ((c = getopt (argc, argv, "f:hpf:g:n:s:S:t:x:y:z:N:F:GdP:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
output_fd = fopen(optarg,"w");
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
output_fd = fopen(optarg,"w");
|
||||
|
||||
if (output_fd==NULL) {
|
||||
printf("Error opening %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (output_fd==NULL) {
|
||||
printf("Error opening %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
frame_type = TDD;
|
||||
break;
|
||||
case 'd':
|
||||
frame_type = TDD;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
abstraction_flag=1;
|
||||
ntrials=10000;
|
||||
msg("Running Abstraction test\n");
|
||||
pbch_file_fd=fopen(optarg,"r");
|
||||
|
||||
if (pbch_file_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
input_fd = fopen(optarg,"r");
|
||||
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
case 'P':
|
||||
pbch_phase = atoi(optarg);
|
||||
|
||||
if (pbch_phase>3)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 't':
|
||||
Td= atof(optarg);
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
*/
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'r':
|
||||
ricean_factor = pow(10,-.1*atof(optarg));
|
||||
if (ricean_factor>1) {
|
||||
printf("Ricean factor must be between 0 and 1\n");
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
abstraction_flag=1;
|
||||
ntrials=10000;
|
||||
msg("Running Abstraction test\n");
|
||||
pbch_file_fd=fopen(optarg,"r");
|
||||
|
||||
if (pbch_file_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// case 'C':
|
||||
// calibration_flag=1;
|
||||
// msg("Running Abstraction calibration for Bias removal\n");
|
||||
// break;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
input_fd = fopen(optarg,"r");
|
||||
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
pbch_phase = atoi(optarg);
|
||||
|
||||
if (pbch_phase>3)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,16 +272,15 @@ int main(int argc, char **argv)
|
||||
n_tx=2;
|
||||
|
||||
lte_param_init(n_tx,
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
frame_type,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
osf,
|
||||
0);
|
||||
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
frame_type,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
osf,
|
||||
0);
|
||||
#ifdef XFORMS
|
||||
fl_initialize (&argc, argv, NULL, 0, 0);
|
||||
form_ue = create_lte_phy_scope_ue();
|
||||
@@ -334,38 +296,27 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &PHY_vars_eNB->lte_frame_parms;
|
||||
|
||||
|
||||
|
||||
txdata = PHY_vars_eNB->lte_eNB_common_vars.txdata[0];
|
||||
txdata1 = PHY_vars_eNB1->lte_eNB_common_vars.txdata[0];
|
||||
txdata2 = PHY_vars_eNB2->lte_eNB_common_vars.txdata[0];
|
||||
|
||||
|
||||
s_re = malloc(2*sizeof(double*));
|
||||
s_im = malloc(2*sizeof(double*));
|
||||
s_re1 = malloc(2*sizeof(double*));
|
||||
s_im1 = malloc(2*sizeof(double*));
|
||||
s_re2 = malloc(2*sizeof(double*));
|
||||
s_im2 = malloc(2*sizeof(double*));
|
||||
r_re = malloc(2*sizeof(double*));
|
||||
r_im = malloc(2*sizeof(double*));
|
||||
r_re1 = malloc(2*sizeof(double*));
|
||||
r_im1 = malloc(2*sizeof(double*));
|
||||
r_re2 = malloc(2*sizeof(double*));
|
||||
r_im2 = malloc(2*sizeof(double*));
|
||||
|
||||
s_re = malloc(2*sizeof(double *));
|
||||
s_im = malloc(2*sizeof(double *));
|
||||
s_re1 = malloc(2*sizeof(double *));
|
||||
s_im1 = malloc(2*sizeof(double *));
|
||||
s_re2 = malloc(2*sizeof(double *));
|
||||
s_im2 = malloc(2*sizeof(double *));
|
||||
r_re = malloc(2*sizeof(double *));
|
||||
r_im = malloc(2*sizeof(double *));
|
||||
r_re1 = malloc(2*sizeof(double *));
|
||||
r_im1 = malloc(2*sizeof(double *));
|
||||
r_re2 = malloc(2*sizeof(double *));
|
||||
r_im2 = malloc(2*sizeof(double *));
|
||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb);
|
||||
|
||||
printf("PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][0] = %p\n",
|
||||
PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][0]);
|
||||
|
||||
|
||||
DLSCH_alloc_pdu2.rah = 0;
|
||||
DLSCH_alloc_pdu2.rballoc = DLSCH_RB_ALLOC;
|
||||
DLSCH_alloc_pdu2.TPC = 0;
|
||||
@@ -377,16 +328,14 @@ int main(int argc, char **argv)
|
||||
DLSCH_alloc_pdu2.rv1 = 0;
|
||||
// Forget second codeword
|
||||
DLSCH_alloc_pdu2.tpmi = (transmission_mode==6 ? 5 : 0) ; // precoding
|
||||
|
||||
eNB2UE = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
|
||||
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
@@ -394,7 +343,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
|
||||
s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -407,7 +355,6 @@ int main(int argc, char **argv)
|
||||
bzero(s_re2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im2[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_im2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
|
||||
r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -450,9 +397,7 @@ int main(int argc, char **argv)
|
||||
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 5 : 4,
|
||||
10);
|
||||
*/
|
||||
|
||||
} else {
|
||||
|
||||
generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
|
||||
AMP,
|
||||
&PHY_vars_eNB->lte_frame_parms,
|
||||
@@ -473,11 +418,8 @@ int main(int argc, char **argv)
|
||||
&PHY_vars_eNB->lte_frame_parms,
|
||||
2,
|
||||
12);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
generate_pilots(PHY_vars_eNB,
|
||||
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
|
||||
@@ -494,7 +436,6 @@ int main(int argc, char **argv)
|
||||
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
|
||||
0);
|
||||
*/
|
||||
|
||||
/*
|
||||
if (num_pdcch_symbols<3) {
|
||||
printf("Less than 3 pdcch symbols\n");
|
||||
@@ -530,9 +471,6 @@ int main(int argc, char **argv)
|
||||
tx_lev1 = 0;
|
||||
tx_lev2 = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_tx; aa++) {
|
||||
if (frame_parms->Ncp == 1)
|
||||
PHY_ofdm_mod(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][aa], // input,
|
||||
@@ -552,7 +490,6 @@ int main(int argc, char **argv)
|
||||
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
|
||||
}
|
||||
|
||||
|
||||
LOG_M("txsig0.m","txs0", txdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
|
||||
if (frame_parms->nb_antennas_tx>1)
|
||||
@@ -567,19 +504,14 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
||||
|
||||
|
||||
n_errors = 0;
|
||||
n_errors2 = 0;
|
||||
n_alamouti = 0;
|
||||
|
||||
for (trial=0; trial<n_frames; trial++) {
|
||||
|
||||
multipath_channel(eNB2UE,s_re,s_im,r_re,r_im,
|
||||
2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,0);
|
||||
|
||||
sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size/(double)(12*NB_RB)) - SNR;
|
||||
|
||||
if (n_frames==1)
|
||||
@@ -603,8 +535,8 @@ int main(int argc, char **argv)
|
||||
//printf("n_trial %d\n",n_trials);
|
||||
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_rx; aa++) {
|
||||
((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,8 +546,6 @@ int main(int argc, char **argv)
|
||||
printf("rx_level data symbol %f\n",
|
||||
10*log10(signal_energy(&PHY_vars_UE->lte_ue_common_vars.rxdata[0][frame_parms->samples_per_tti/2],4*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES)));
|
||||
}
|
||||
|
||||
|
||||
} //noise trials
|
||||
} // trials
|
||||
|
||||
@@ -629,30 +559,65 @@ int main(int argc, char **argv)
|
||||
} // NSR
|
||||
|
||||
if (n_frames==1) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
|
||||
if (s_im1)
|
||||
free(s_im1[i]);
|
||||
|
||||
if (s_im2)
|
||||
free(s_im2[i]);
|
||||
|
||||
free(r_re[i]);
|
||||
|
||||
if (r_re1)
|
||||
free(r_re1[i]);
|
||||
|
||||
if (r_re2)
|
||||
free(r_re2[i]);
|
||||
|
||||
free(r_im[i]);
|
||||
|
||||
if (s_re1)
|
||||
free(s_re1[i]);
|
||||
|
||||
if (s_re2)
|
||||
free(s_re2[i]);
|
||||
|
||||
if (r_im1)
|
||||
free(r_im1[i]);
|
||||
|
||||
if (r_im2)
|
||||
free(r_im2[i]);
|
||||
}
|
||||
|
||||
free(s_re);
|
||||
free(s_re1);
|
||||
free(s_re2);
|
||||
free(s_im);
|
||||
free(s_im1);
|
||||
free(s_im2);
|
||||
free(r_re);
|
||||
free(r_re1);
|
||||
free(r_re2);
|
||||
free(r_im);
|
||||
|
||||
|
||||
free(r_im1);
|
||||
free(r_im2);
|
||||
lte_sync_time_free();
|
||||
|
||||
if (write_output_file)
|
||||
fclose(output_fd);
|
||||
|
||||
return(n_errors);
|
||||
if (input_fd)
|
||||
fclose(input_fd);
|
||||
|
||||
if (pbch_file_fd)
|
||||
fclose(pbch_file_fd);
|
||||
|
||||
return(n_errors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+109
-248
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The OpenAirInterface Software Alliance licenses this file to You under
|
||||
the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.openairinterface.org/?page_id=698
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-------------------------------------------------------------------------------
|
||||
For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
contact@openairinterface.org
|
||||
*/
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file ulsim.c
|
||||
\brief Top-level UL simulator
|
||||
@@ -55,37 +55,12 @@
|
||||
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#include "dummy_functions.c"
|
||||
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "common/config/config_load_configmodule.h"
|
||||
double cpuf;
|
||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||
//#define MCS_COUNT 23//added for PHY abstraction
|
||||
static int cmpdouble(const void *p1, const void *p2) {
|
||||
return *(double *)p1 > *(double *)p2;
|
||||
}
|
||||
|
||||
double median(varArray_t *input) {
|
||||
return *(double *)((uint8_t *)(input+1)+(input->size/2)*input->atomSize);
|
||||
}
|
||||
|
||||
double q1(varArray_t *input) {
|
||||
return *(double *)((uint8_t *)(input+1)+(input->size/4)*input->atomSize);
|
||||
}
|
||||
|
||||
double q3(varArray_t *input) {
|
||||
return *(double *)((uint8_t *)(input+1)+(3*input->size/4)*input->atomSize);
|
||||
}
|
||||
|
||||
void dumpVarArray(varArray_t *input) {
|
||||
double *ptr=dataArray(input);
|
||||
printf("dumping size=%ld\n", input->size);
|
||||
|
||||
for (int i=0; i < input->size; i++)
|
||||
printf("%.1f:", *ptr++);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#include <openair1/SIMULATION/LTE_PHY/common_sim.h>
|
||||
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
|
||||
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
|
||||
//Added for PHY abstractionopenair1/PHY/TOOLS/lte_phy_scope.h
|
||||
@@ -106,12 +81,12 @@ double t_tx_min = 1000000000; /*!< \brief initial min process time for tx */
|
||||
double t_rx_min = 1000000000; /*!< \brief initial min process time for tx */
|
||||
int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
|
||||
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
|
||||
int nfapi_mode = 0;
|
||||
|
||||
|
||||
extern void fep_full(RU_t *ru);
|
||||
extern void ru_fep_full_2thread(RU_t *ru);
|
||||
extern void eNB_fep_full(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
|
||||
extern void eNB_fep_full_2thread(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
|
||||
extern void eNB_fep_full(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc);
|
||||
extern void eNB_fep_full_2thread(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc);
|
||||
|
||||
nfapi_dl_config_request_t DL_req;
|
||||
nfapi_ul_config_request_t UL_req;
|
||||
@@ -121,30 +96,7 @@ nfapi_tx_request_pdu_t tx_pdu_list[MAX_NUM_TX_REQUEST_PDU];
|
||||
nfapi_tx_request_t TX_req;
|
||||
Sched_Rsp_t sched_resp;
|
||||
|
||||
char *parallel_config = NULL;
|
||||
char *worker_config = NULL;
|
||||
static THREAD_STRUCT thread_struct;
|
||||
void set_parallel_conf(char *parallel_conf)
|
||||
{
|
||||
if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD;
|
||||
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_SPLIT;
|
||||
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_TRX_SPLIT;
|
||||
printf("[CONFIG] parallel conf is set to %d\n",thread_struct.parallel_conf);
|
||||
}
|
||||
void set_worker_conf(char *worker_conf)
|
||||
{
|
||||
if(strcmp(worker_conf,"WORKER_DISABLE")==0) thread_struct.worker_conf = WORKER_DISABLE;
|
||||
else if(strcmp(worker_conf,"WORKER_ENABLE")==0) thread_struct.worker_conf = WORKER_ENABLE;
|
||||
printf("[CONFIG] worker conf is set to %d\n",thread_struct.worker_conf);
|
||||
}
|
||||
PARALLEL_CONF_t get_thread_parallel_conf(void)
|
||||
{
|
||||
return thread_struct.parallel_conf;
|
||||
}
|
||||
WORKER_CONF_t get_thread_worker_conf(void)
|
||||
{
|
||||
return thread_struct.worker_conf;
|
||||
}
|
||||
THREAD_STRUCT thread_struct;
|
||||
|
||||
void
|
||||
fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu,
|
||||
@@ -348,48 +300,8 @@ void fill_ulsch_dci(PHY_VARS_eNB *eNB,
|
||||
ul_req->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
|
||||
}
|
||||
|
||||
void printStatIndent(time_stats_t *ptr, char *txt) {
|
||||
printf("|__ %-50s %.2f us (%d trials)\n",
|
||||
txt,
|
||||
inMicroS(ptr->diff/ptr->trials),
|
||||
ptr->trials);
|
||||
}
|
||||
|
||||
void printStatIndent2(time_stats_t *ptr, char *txt, int turbo_iter) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
printf(" |__ %-45s %.2f us (cycles/block %7g, %5d trials)\n",
|
||||
txt,
|
||||
((double)ptr->diff)/ptr->trials*timeBase,
|
||||
round(((double)ptr->diff)/turbo_iter),
|
||||
ptr->trials);
|
||||
}
|
||||
|
||||
double squareRoot(time_stats_t *ptr) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials -
|
||||
pow((double)ptr->diff/ptr->trials*timeBase,2));
|
||||
}
|
||||
|
||||
void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
printf("%-50s :%.2f us (%d trials)\n",
|
||||
txt,
|
||||
(double)ptr->diff/ptr->trials*timeBase,
|
||||
ptr->trials);
|
||||
printf("|__ Statistics std=%.2f, median=%.2f, q1=%.2f, q3=%.2f µs (on %ld trials)\n",
|
||||
squareRoot(ptr), median(sortedList),q1(sortedList),q3(sortedList), sortedList->size);
|
||||
}
|
||||
|
||||
void logDistribution(FILE* fd, time_stats_t *ptr, varArray_t *sortedList, int dropped) {
|
||||
fprintf(fd,"%f;%f;%f;%f;%f;%f;%d;",
|
||||
squareRoot(ptr),
|
||||
(double)ptr->max, *(double*)dataArray(sortedList),
|
||||
median(sortedList),q1(sortedList),q3(sortedList),
|
||||
dropped);
|
||||
}
|
||||
|
||||
enum eTypes { eBool, eInt, eFloat, eText };
|
||||
static int verbose,disable_bundling=0,cqi_flag=0, extended_prefix_flag=0, test_perf=0, subframe=3, transmission_m=1,n_rx=1;
|
||||
static int verbose,help,disable_bundling=0,cqi_flag=0, extended_prefix_flag=0, test_perf=0, subframe=3, transmission_m=1,n_rx=1;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i,j,aa,u;
|
||||
@@ -437,19 +349,6 @@ int main(int argc, char **argv) {
|
||||
char input_val_str[50],input_val_str2[50];
|
||||
// FILE *rx_frame_file;
|
||||
FILE *csv_fdUL=NULL;
|
||||
/*
|
||||
FILE *fperen=NULL;
|
||||
char fperen_name[512];
|
||||
|
||||
FILE *fmageren=NULL;
|
||||
char fmageren_name[512];
|
||||
|
||||
FILE *flogeren=NULL;
|
||||
char flogeren_name[512];
|
||||
*/
|
||||
/* FILE *ftxlev;
|
||||
char ftxlev_name[512];
|
||||
*/
|
||||
char csv_fname[512];
|
||||
static int n_frames=5000;
|
||||
static int n_ch_rlz = 1;
|
||||
@@ -475,7 +374,6 @@ int main(int argc, char **argv) {
|
||||
double effective_rate=0.0;
|
||||
char channel_model_input[10]= {0};
|
||||
static int max_turbo_iterations=4;
|
||||
static int parallel_flag=0;
|
||||
int nb_rb_set = 0;
|
||||
int sf;
|
||||
static int threequarter_fs=0;
|
||||
@@ -493,8 +391,9 @@ int main(int argc, char **argv) {
|
||||
TX_req.tx_request_body.tx_pdu_list = tx_pdu_list;
|
||||
cpu_freq_GHz = (double)get_cpu_freq_GHz();
|
||||
cpuf = cpu_freq_GHz;
|
||||
set_parallel_conf("PARALLEL_SINGLE_THREAD");
|
||||
printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
|
||||
AssertFatal(load_configmodule(argc,argv) != NULL,
|
||||
AssertFatal(load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) != NULL,
|
||||
"cannot load configuration module, exiting\n");
|
||||
logInit();
|
||||
set_glog(OAILOG_WARNING);
|
||||
@@ -502,18 +401,18 @@ int main(int argc, char **argv) {
|
||||
// enable these lines if you need debug info
|
||||
// however itti will catch all signals, so ctrl-c won't work anymore
|
||||
// alternatively you can disable ITTI completely in CMakeLists.txt
|
||||
//itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL);
|
||||
//set_comp_log(PHY,LOG_DEBUG,LOG_MED,1);
|
||||
//set_glog(LOG_DEBUG,LOG_MED);
|
||||
// itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL);
|
||||
// set_comp_log(PHY,LOG_DEBUG,LOG_HIGH,1);
|
||||
// set_glog(LOG_DEBUG,LOG_HIGH);
|
||||
//hapZEbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:LF
|
||||
static paramdef_t options[] = {
|
||||
{ "awgn", "Additive white gaussian noise", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL },
|
||||
{ "awgn", "Use AWGN channel and not multipath", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL },
|
||||
{ "BnbRBs", "The LTE bandwith in RBs (100 is 20MHz)",0, iptr:&N_RB_DL, defintval:25, TYPE_INT, 0 },
|
||||
{ "mcs", "The MCS to use", 0, iptr:&mcs, defintval:10, TYPE_INT, 0 },
|
||||
{ "nb_frame", "number of frame in a test",0, iptr:&n_frames, defintval:1, TYPE_INT, 0 },
|
||||
{ "snr", "starting snr", 0, dblptr:&snr0, defdblval:-2.9, TYPE_DOUBLE, 0 },
|
||||
{ "wsnrInterrupt", "snr int ?", 0, dblptr:&snr_int, defdblval:30, TYPE_DOUBLE, 0 },
|
||||
{ "e_snr_step", "step increasint snr",0, dblptr:&input_snr_step, defdblval:0.2, TYPE_DOUBLE, 0 },
|
||||
{ "e_snr_step", "step increasing snr",0, dblptr:&input_snr_step, defdblval:0.2, TYPE_DOUBLE, 0 },
|
||||
{ "rb_dynamic", "number of rb in dynamic allocation",0, iptr:NULL, defintval:0, TYPE_INT, 0 },
|
||||
{ "first_rb", "first rb used in dynamic allocation",0, iptr:&first_rb, defintval:0, TYPE_INT, 0 },
|
||||
{ "osrs", "enable srs generation",PARAMFLAG_BOOL, iptr:&srs_flag, defintval:0, TYPE_INT, 0 },
|
||||
@@ -522,7 +421,7 @@ int main(int argc, char **argv) {
|
||||
{ "Doppler", "Maximum doppler shift",0, dblptr:&maxDoppler, defdblval:0.0, TYPE_DOUBLE, 0 },
|
||||
{ "Zdump", "dump table",PARAMFLAG_BOOL, iptr:&dump_table, defintval:0, TYPE_INT, 0 },
|
||||
{ "Forms", "Display the soft scope", PARAMFLAG_BOOL, iptr:&xforms, defintval:0, TYPE_INT, 0 },
|
||||
{ "Lparallel", "Enable parallel execution", PARAMFLAG_BOOL, iptr:¶llel_flag, defintval:0, TYPE_INT, 0 },
|
||||
{ "Lparallel", "Enable parallel execution",0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0 },
|
||||
{ "Iterations", "Number of iterations of turbo decoder", 0, iptr:&max_turbo_iterations, defintval:4, TYPE_INT, 0 },
|
||||
{ "Performance", "Display CPU perfomance of each L1 piece", PARAMFLAG_BOOL, iptr:NULL, defintval:0, TYPE_INT, 0 },
|
||||
{ "Q_cqi", "Enable CQI", PARAMFLAG_BOOL, iptr:&cqi_flag, defintval:0, TYPE_INT, 0 },
|
||||
@@ -540,40 +439,13 @@ int main(int argc, char **argv) {
|
||||
{ "bundling_disable", "bundling disable",PARAMFLAG_BOOL, iptr:&disable_bundling, defintval:0, TYPE_INT, 0 },
|
||||
{ "Y", "n_ch_rlz",0, iptr:&n_ch_rlz, defintval:1, TYPE_INT, 0 },
|
||||
{ "X", "abstx", PARAMFLAG_BOOL, iptr:&abstx, defintval:0, TYPE_INT, 0 },
|
||||
{ "Operf", "test perf mode ?",0, iptr:&test_perf, defintval:0, TYPE_INT, 0 },
|
||||
{ "Operf", "Set the percentage of effective rate to testbench the modem performance (typically 30 and 70, range 1-100)",0, iptr:&test_perf, defintval:0, TYPE_INT, 0 },
|
||||
{ "verbose", "display debug text", PARAMFLAG_BOOL, iptr:&verbose, defintval:0, TYPE_INT, 0 },
|
||||
{ "help", "display help and exit", PARAMFLAG_BOOL, iptr:&help, defintval:0, TYPE_INT, 0 },
|
||||
{ "", "",0, iptr:NULL, defintval:0, TYPE_INT, 0 },
|
||||
};
|
||||
int l;
|
||||
|
||||
for(l=0; options[l].optname[0]!=0; l++) {};
|
||||
|
||||
struct option *long_options=calloc(sizeof(struct option),l);
|
||||
|
||||
for(int i=0; options[i].optname[0]!=0; i++) {
|
||||
long_options[i].name=options[i].optname;
|
||||
long_options[i].has_arg=options[i].paramflags==PARAMFLAG_BOOL?no_argument:required_argument;
|
||||
|
||||
if ( options[i].voidptr)
|
||||
switch (options[i].type) {
|
||||
case TYPE_INT:
|
||||
*options[i].iptr=options[i].defintval;
|
||||
break;
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
*options[i].dblptr=options[i].defdblval;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("not parsed type for default value %s\n", options[i].optname );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
continue;
|
||||
};
|
||||
|
||||
struct option *long_options = parse_oai_options(options);
|
||||
int option_index;
|
||||
|
||||
int res;
|
||||
|
||||
while ((res=getopt_long_only(argc, argv, "", long_options, &option_index)) == 0) {
|
||||
@@ -589,6 +461,14 @@ int main(int argc, char **argv) {
|
||||
*(double *)options[option_index].dblptr=atof(optarg);
|
||||
break;
|
||||
|
||||
case TYPE_UINT8:
|
||||
*(uint8_t *)options[option_index].dblptr=atoi(optarg);
|
||||
break;
|
||||
|
||||
case TYPE_UINT16:
|
||||
*(uint16_t *)options[option_index].dblptr=atoi(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("not decoded type.\n");
|
||||
exit(1);
|
||||
@@ -684,8 +564,12 @@ int main(int argc, char **argv) {
|
||||
opp_enabled=1;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
set_parallel_conf(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Wrong option\n");
|
||||
printf("Wrong option: %s\n",long_options[option_index].name);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
@@ -696,36 +580,15 @@ int main(int argc, char **argv) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
paramdef_t *ptr=options ;
|
||||
if (help || verbose )
|
||||
display_options_values(options, true);
|
||||
|
||||
for( ptr=options; ptr->optname[0]!=0; ptr++) {
|
||||
char varText[256]="need specific display";
|
||||
if (help)
|
||||
exit(0);
|
||||
|
||||
if (ptr->voidptr != NULL) {
|
||||
if ( (ptr->paramflags & PARAMFLAG_BOOL) )
|
||||
strcpy(varText, *(bool *)ptr->iptr ? "True": "False" );
|
||||
else switch (ptr->type) {
|
||||
case TYPE_INT:
|
||||
sprintf(varText,"%d",*ptr->iptr);
|
||||
break;
|
||||
if (thread_struct.parallel_conf != PARALLEL_SINGLE_THREAD)
|
||||
set_worker_conf("WORKER_ENABLE");
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
sprintf(varText,"%.2f",*ptr->dblptr);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("not decoded type\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
printf("Option: %20s set to %s\n",ptr->optname, varText);
|
||||
|
||||
if (verbose)
|
||||
printf("%s\n",ptr->helpstr);
|
||||
}
|
||||
set_parallel_conf("PARALLEL_RU_L1_TRX_SPLIT");
|
||||
set_worker_conf("WORKER_ENABLE");
|
||||
RC.nb_L1_inst = 1;
|
||||
RC.nb_RU = 1;
|
||||
lte_param_init(&eNB,&UE,&ru,
|
||||
@@ -743,7 +606,7 @@ int main(int argc, char **argv) {
|
||||
threequarter_fs,
|
||||
osf,
|
||||
0);
|
||||
RC.eNB = (PHY_VARS_eNB ***)malloc(sizeof(PHY_VARS_eNB **));
|
||||
RC.eNB = (PHY_VARS_eNB ** *)malloc(sizeof(PHY_VARS_eNB **));
|
||||
RC.eNB[0] = (PHY_VARS_eNB **)malloc(sizeof(PHY_VARS_eNB *));
|
||||
RC.ru = (RU_t **)malloc(sizeof(RC.ru));
|
||||
RC.eNB[0][0] = eNB;
|
||||
@@ -761,7 +624,7 @@ int main(int argc, char **argv) {
|
||||
eNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = eNB->cqi_raw_pdu_list;
|
||||
printf("lte_param_init done\n");
|
||||
// for a call to phy_reset_ue later we need PHY_vars_UE_g allocated and pointing to UE
|
||||
PHY_vars_UE_g = (PHY_VARS_UE ***)malloc(sizeof(PHY_VARS_UE **));
|
||||
PHY_vars_UE_g = (PHY_VARS_UE ** *)malloc(sizeof(PHY_VARS_UE **));
|
||||
PHY_vars_UE_g[0] = (PHY_VARS_UE **) malloc(sizeof(PHY_VARS_UE *));
|
||||
PHY_vars_UE_g[0][0] = UE;
|
||||
|
||||
@@ -873,7 +736,7 @@ int main(int argc, char **argv) {
|
||||
UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0);
|
||||
printf("ULSCH %p\n",UE->ulsch[0]);
|
||||
|
||||
if (parallel_flag == 1) {
|
||||
if(get_thread_worker_conf() == WORKER_ENABLE) {
|
||||
extern void init_fep_thread(PHY_VARS_eNB *, pthread_attr_t *);
|
||||
extern void init_td_thread(PHY_VARS_eNB *);
|
||||
init_fep_thread(eNB,NULL);
|
||||
@@ -924,7 +787,7 @@ int main(int argc, char **argv) {
|
||||
UE->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
|
||||
eNB->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
|
||||
UE->mac_enabled=0;
|
||||
eNB_rxtx_proc_t *proc_rxtx = &eNB->proc.proc_rxtx[subframe&1];
|
||||
L1_rxtx_proc_t *proc_rxtx = &eNB->proc.L1_proc;
|
||||
UE_rxtx_proc_t *proc_rxtx_ue = &UE->proc.proc_rxtx[subframe&1];
|
||||
proc_rxtx->frame_rx=1;
|
||||
proc_rxtx->subframe_rx=subframe;
|
||||
@@ -946,7 +809,7 @@ int main(int argc, char **argv) {
|
||||
if (cqi_flag == 1) coded_bits_per_codeword-=UE->ulsch[0]->O;
|
||||
|
||||
rate = (double)dlsch_tbs25[get_I_TBS(mcs)][nb_rb-1]/(coded_bits_per_codeword);
|
||||
printf("Rate = %f (mod %d), coded bits %d\n",rate,get_Qm_ul(mcs),coded_bits_per_codeword);
|
||||
printf("Rate = %f (mod %d), coded bits %u\n",rate,get_Qm_ul(mcs),coded_bits_per_codeword);
|
||||
|
||||
for (ch_realization=0; ch_realization<n_ch_rlz; ch_realization++) {
|
||||
/*
|
||||
@@ -1008,7 +871,7 @@ int main(int argc, char **argv) {
|
||||
i=0;
|
||||
|
||||
while (!feof(input_fdUL)) {
|
||||
ret=fscanf(input_fdUL,"%s %s",input_val_str,input_val_str2);//&input_val1,&input_val2);
|
||||
ret=fscanf(input_fdUL,"%49s %49s",input_val_str,input_val_str2);//&input_val1,&input_val2);
|
||||
|
||||
if (ret != 2) printf("ERROR: error reading file\n");
|
||||
|
||||
@@ -1095,7 +958,7 @@ int main(int argc, char **argv) {
|
||||
eNB->ulsch[0]->harq_processes[harq_pid]->round=round;
|
||||
UE->ulsch[0]->harq_processes[harq_pid]->round=round;
|
||||
|
||||
if (n_frames==1) printf("filling ulsch: Trial %d : Round %d (subframe %d, frame %d)\n",trials,round,proc_rxtx_ue->subframe_tx,proc_rxtx_ue->frame_tx);
|
||||
if (n_frames==1) printf("filling ulsch: Trial %u : Round %d (subframe %d, frame %d)\n",trials,round,proc_rxtx_ue->subframe_tx,proc_rxtx_ue->frame_tx);
|
||||
|
||||
round_trials[round]++;
|
||||
UL_req.sfn_sf = (1<<4)+subframe;
|
||||
@@ -1186,10 +1049,10 @@ int main(int argc, char **argv) {
|
||||
sigma2_dB = N0;//-10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12));//10*log10((double)tx_lev) +10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12)) - SNR;
|
||||
sigma2 = pow(10,sigma2_dB/10);
|
||||
// compute tx_gain to achieve target SNR (per resource element!)
|
||||
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);//*(nb_rb*12/(double)UE->frame_parms.ofdm_symbol_size)/(double)tx_lev);
|
||||
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);// *(nb_rb*12/(double)UE->frame_parms.ofdm_symbol_size)/(double)tx_lev);
|
||||
|
||||
if (n_frames==1)
|
||||
printf("tx_lev = %d (%d.%d dB,%f), gain %f\n",tx_lev,tx_lev_dB/10,tx_lev_dB,10*log10((double)tx_lev),10*log10(tx_gain));
|
||||
printf("tx_lev = %u (%u.%u dB,%f), gain %f\n",tx_lev,tx_lev_dB/10,tx_lev_dB,10*log10((double)tx_lev),10*log10(tx_gain));
|
||||
|
||||
// fill measurement symbol (19) with noise
|
||||
for (i=0; i<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
@@ -1224,7 +1087,7 @@ int main(int argc, char **argv) {
|
||||
// calculate freq domain representation to compute SINR
|
||||
freq_channel(UE2eNB, N_RB_DL,12*N_RB_DL + 1);
|
||||
// snr=pow(10.0,.1*SNR);
|
||||
fprintf(csv_fdUL,"%f,%d,%d,%f,%f,%f,",SNR,tx_lev,tx_lev_dB,sigma2_dB,tx_gain,SNR2);
|
||||
fprintf(csv_fdUL,"%f,%u,%u,%f,%f,%f,",SNR,tx_lev,tx_lev_dB,sigma2_dB,tx_gain,SNR2);
|
||||
|
||||
//fprintf(csv_fdUL,"%f,",SNR);
|
||||
for (u=0; u<12*nb_rb; u++) {
|
||||
@@ -1280,13 +1143,12 @@ int main(int argc, char **argv) {
|
||||
if (eNB->frame_parms.nb_antennas_rx>1) LOG_M("rxsig1UL.m","rxs1", &ru->common.rxdata[1][eNB->frame_parms.samples_per_tti*subframe],eNB->frame_parms.samples_per_tti,1,1);
|
||||
}
|
||||
|
||||
start_meas(&eNB->phy_proc_rx);
|
||||
ru->feprx = (parallel_flag == 1) ? ru_fep_full_2thread : fep_full;
|
||||
eNB->td = (parallel_flag == 1) ? ulsch_decoding_data_2thread : ulsch_decoding_data;
|
||||
start_meas(&eNB->phy_proc_rx);
|
||||
ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? ru_fep_full_2thread : fep_full;
|
||||
ru->feprx(ru);
|
||||
phy_procedures_eNB_uespec_RX(eNB,proc_rxtx);
|
||||
stop_meas(&eNB->phy_proc_rx);
|
||||
|
||||
stop_meas(&eNB->phy_proc_rx);
|
||||
|
||||
if (cqi_flag > 0) {
|
||||
cqi_error = 0;
|
||||
|
||||
@@ -1351,11 +1213,10 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
|
||||
|
||||
if (round == 4) exit(-1);
|
||||
round=5;
|
||||
}
|
||||
|
||||
if (n_frames==1) printf("round %d errors %d/%d\n",round,errs[round],trials);
|
||||
if (n_frames==1) printf("round %d errors %u/%u\n",round,errs[round],trials);
|
||||
|
||||
round++;
|
||||
|
||||
@@ -1413,7 +1274,7 @@ int main(int argc, char **argv) {
|
||||
LOG_UDUMPMSG(SIM,dataArray(table_rx),table_rx->size,LOG_DUMP_DOUBLE,"The receiver raw data: \n");
|
||||
}
|
||||
|
||||
printf("\n**********rb: %d ***mcs : %d *********SNR = %f dB (%f): TX %d dB (gain %f dB), N0W %f dB, I0 %d dB, delta_IF %d [ (%d,%d) dB / (%d,%d) dB ]**************************\n",
|
||||
printf("\n**********rb: %d ***mcs : %d *********SNR = %f dB (%f): TX %u dB (gain %f dB), N0W %f dB, I0 %d dB, delta_IF %d [ (%d,%d) dB / (%d,%d) dB ]**************************\n",
|
||||
nb_rb,mcs,SNR,SNR2,
|
||||
tx_lev_dB,
|
||||
20*log10(tx_gain),
|
||||
@@ -1425,7 +1286,7 @@ int main(int argc, char **argv) {
|
||||
eNB->measurements.n0_power_dB[0],
|
||||
eNB->measurements.n0_power_dB[1]);
|
||||
effective_rate = ((double)(round_trials[0])/((double)round_trials[0] + round_trials[1] + round_trials[2] + round_trials[3]));
|
||||
printf("Errors (%d/%d %d/%d %d/%d %d/%d), Pe = (%e,%e,%e,%e) => effective rate %f (%3.1f%%,%f,%f), normalized delay %f (%f)\n",
|
||||
printf("Errors (%u/%u %u/%u %u/%u %u/%u), Pe = (%e,%e,%e,%e) => effective rate %f (%3.1f%%,%f,%f), normalized delay %f (%f)\n",
|
||||
errs[0],
|
||||
round_trials[0],
|
||||
errs[1],
|
||||
@@ -1447,16 +1308,16 @@ int main(int argc, char **argv) {
|
||||
(1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0]));
|
||||
|
||||
if (cqi_flag >0) {
|
||||
printf("CQI errors %d/%d,false positives %d/%d, CQI false negatives %d/%d\n",
|
||||
printf("CQI errors %d/%u,false positives %d/%u, CQI false negatives %d/%u\n",
|
||||
cqi_errors,round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3],
|
||||
cqi_crc_falsepositives,round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3],
|
||||
cqi_crc_falsenegatives,round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3]);
|
||||
}
|
||||
|
||||
if (eNB->ulsch[0]->harq_processes[harq_pid]->o_ACK[0] > 0)
|
||||
printf("ACK/NAK errors %d/%d\n",ack_errors,round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3]);
|
||||
printf("ACK/NAK errors %d/%u\n",ack_errors,round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3]);
|
||||
|
||||
fprintf(bler_fd,"%f;%d;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d\n",
|
||||
fprintf(bler_fd,"%f;%d;%d;%d;%f;%u;%u;%u;%u;%u;%u;%u;%u\n",
|
||||
SNR,
|
||||
mcs,
|
||||
nb_rb,
|
||||
@@ -1483,20 +1344,18 @@ int main(int argc, char **argv) {
|
||||
printStatIndent(&UE->ulsch_rate_matching_stats,"ULSCH rate-matching time");
|
||||
printStatIndent(&UE->ulsch_interleaving_stats,"ULSCH sub-block interleaving");
|
||||
printStatIndent(&UE->ulsch_multiplexing_stats,"ULSCH multiplexing time");
|
||||
printDistribution(&eNB->phy_proc_rx,table_rx,"\nTotal PHY proc rx subframe");
|
||||
printDistribution(&ru->ofdm_demod_stats,table_rx_fft,"OFDM_demod time");
|
||||
printDistribution(&eNB->ulsch_demodulation_stats,table_rx_demod,"ULSCH demodulation time");
|
||||
printf("ULSCH Decoding time (%.2f Mbit/s, avg iter %.2f) :%.2f us (%d trials, max %.2f)\n",
|
||||
UE->ulsch[0]->harq_processes[harq_pid]->TBS/1000.0,(double)iter_trials,
|
||||
(double)eNB->ulsch_decoding_stats.diff/eNB->ulsch_decoding_stats.trials*timeBase,
|
||||
eNB->ulsch_decoding_stats.trials,
|
||||
printf("\n");
|
||||
printDistribution(&eNB->phy_proc_rx,table_rx,"Total PHY proc rx subframe");
|
||||
printDistribution(&ru->ofdm_demod_stats,table_rx_fft,"|__ OFDM_demod time");
|
||||
printDistribution(&eNB->ulsch_demodulation_stats,table_rx_demod,"|__ ULSCH demodulation time");
|
||||
printDistribution(&eNB->ulsch_decoding_stats,table_rx_dec,"|__ ULSCH Decoding time");
|
||||
printf(" (%.2f Mbit/s, avg iter %.2f, max %.2f)\n",
|
||||
UE->ulsch[0]->harq_processes[harq_pid]->TBS/1000.0,
|
||||
(double)iter_trials,
|
||||
(double)eNB->ulsch_decoding_stats.max*timeBase);
|
||||
printf("|__ Statistics std: %.2fus median %.2fus q1 %.2fus q3 %.2fus \n",
|
||||
squareRoot(&eNB->ulsch_decoding_stats),
|
||||
median(table_rx_dec), q1(table_rx_dec), q3(table_rx_dec));
|
||||
printStatIndent(&eNB->ulsch_deinterleaving_stats,"sub-block interleaving" );
|
||||
printStatIndent(&eNB->ulsch_demultiplexing_stats,"sub-block demultiplexing" );
|
||||
printStatIndent(&eNB->ulsch_rate_unmatching_stats,"sub-block rate-matching" );
|
||||
printStatIndent2(&eNB->ulsch_deinterleaving_stats,"sub-block interleaving" );
|
||||
printStatIndent2(&eNB->ulsch_demultiplexing_stats,"sub-block demultiplexing" );
|
||||
printStatIndent2(&eNB->ulsch_rate_unmatching_stats,"sub-block rate-matching" );
|
||||
printf("|__ turbo_decoder(%d bits), avg iterations: %.1f %.2f us (%d cycles, %d trials)\n",
|
||||
eNB->ulsch[0]->harq_processes[harq_pid]->Cminus ?
|
||||
eNB->ulsch[0]->harq_processes[harq_pid]->Kminus :
|
||||
@@ -1505,13 +1364,13 @@ int main(int argc, char **argv) {
|
||||
(double)eNB->ulsch_turbo_decoding_stats.diff/eNB->ulsch_turbo_decoding_stats.trials*timeBase,
|
||||
(int)((double)eNB->ulsch_turbo_decoding_stats.diff/eNB->ulsch_turbo_decoding_stats.trials),
|
||||
eNB->ulsch_turbo_decoding_stats.trials);
|
||||
printStatIndent2(&eNB->ulsch_tc_init_stats,"init", eNB->ulsch_tc_init_stats.trials);
|
||||
printStatIndent2(&eNB->ulsch_tc_alpha_stats,"alpha", eNB->ulsch_tc_init_stats.trials);
|
||||
printStatIndent2(&eNB->ulsch_tc_beta_stats,"beta", eNB->ulsch_tc_init_stats.trials);
|
||||
printStatIndent2(&eNB->ulsch_tc_gamma_stats,"gamma", eNB->ulsch_tc_init_stats.trials);
|
||||
printStatIndent2(&eNB->ulsch_tc_ext_stats,"ext", eNB->ulsch_tc_init_stats.trials);
|
||||
printStatIndent2(&eNB->ulsch_tc_intl1_stats,"turbo internal interleaver", eNB->ulsch_tc_init_stats.trials);
|
||||
printStatIndent2(&eNB->ulsch_tc_intl2_stats,"intl2+HardDecode+CRC", eNB->ulsch_tc_init_stats.trials);
|
||||
printStatIndent3(&eNB->ulsch_tc_init_stats,"init");
|
||||
printStatIndent3(&eNB->ulsch_tc_alpha_stats,"alpha");
|
||||
printStatIndent3(&eNB->ulsch_tc_beta_stats,"beta");
|
||||
printStatIndent3(&eNB->ulsch_tc_gamma_stats,"gamma");
|
||||
printStatIndent3(&eNB->ulsch_tc_ext_stats,"ext");
|
||||
printStatIndent3(&eNB->ulsch_tc_intl1_stats,"turbo internal interleaver");
|
||||
printStatIndent3(&eNB->ulsch_tc_intl2_stats,"intl2+HardDecode+CRC");
|
||||
}
|
||||
|
||||
if(abstx) { //ABSTRACTION
|
||||
@@ -1531,7 +1390,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
if ( (test_perf != 0) && (100 * effective_rate > test_perf )) {
|
||||
//fprintf(time_meas_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3\n");
|
||||
fprintf(time_meas_fd,"%f;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d;",
|
||||
fprintf(time_meas_fd,"%f;%d;%d;%f;%u;%u;%u;%u;%u;%u;%u;%u;",
|
||||
SNR,
|
||||
mcs,
|
||||
eNB->ulsch[0]->harq_processes[harq_pid]->TBS,
|
||||
@@ -1545,7 +1404,7 @@ int main(int argc, char **argv) {
|
||||
errs[3],
|
||||
round_trials[3]);
|
||||
//fprintf(time_meas_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3;ND;\n");
|
||||
fprintf(time_meas_fd,"%f;%d;%d;%f;%2.1f;%f;%d;%d;%d;%d;%d;%d;%d;%d;%e;%e;%e;%e;%f;%f;",
|
||||
fprintf(time_meas_fd,"%f;%d;%d;%f;%2.1f;%f;%u;%u;%u;%u;%u;%u;%u;%u;%e;%e;%e;%e;%f;%f;",
|
||||
SNR,
|
||||
mcs,
|
||||
eNB->ulsch[0]->harq_processes[harq_pid]->TBS,
|
||||
@@ -1590,34 +1449,34 @@ int main(int argc, char **argv) {
|
||||
);
|
||||
//fprintf(time_meas_fd,"UE_PROC_TX_STD;UE_PROC_TX_MAX;UE_PROC_TX_MIN;UE_PROC_TX_MED;UE_PROC_TX_Q1;UE_PROC_TX_Q3;UE_PROC_TX_DROPPED;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%d;",
|
||||
squareRoot(&UE->phy_proc_tx), t_tx_max, t_tx_min, median(table_tx), q1(table_tx), q3(table_tx), n_tx_dropped);
|
||||
squareRoot(&UE->phy_proc_tx), t_tx_max, t_tx_min, median(table_tx), q1(table_tx), q3(table_tx), n_tx_dropped);
|
||||
//fprintf(time_meas_fd,"IFFT;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;",
|
||||
squareRoot(&UE->ofdm_mod_stats),
|
||||
squareRoot(&UE->ofdm_mod_stats),
|
||||
median(table_tx_ifft),q1(table_tx_ifft),q3(table_tx_ifft));
|
||||
//fprintf(time_meas_fd,"MOD;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;",
|
||||
squareRoot(&UE->ulsch_modulation_stats),
|
||||
squareRoot(&UE->ulsch_modulation_stats),
|
||||
median(table_tx_mod), q1(table_tx_mod), q3(table_tx_mod));
|
||||
//fprintf(time_meas_fd,"ENC;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;",
|
||||
squareRoot(&UE->ulsch_encoding_stats),
|
||||
squareRoot(&UE->ulsch_encoding_stats),
|
||||
median(table_tx_enc),q1(table_tx_enc),q3(table_tx_enc));
|
||||
//fprintf(time_meas_fd,"eNB_PROC_RX_STD;eNB_PROC_RX_MAX;eNB_PROC_RX_MIN;eNB_PROC_RX_MED;eNB_PROC_RX_Q1;eNB_PROC_RX_Q3;eNB_PROC_RX_DROPPED;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%d;",
|
||||
squareRoot(&eNB->phy_proc_rx), t_rx_max, t_rx_min,
|
||||
squareRoot(&eNB->phy_proc_rx), t_rx_max, t_rx_min,
|
||||
median(table_rx), q1(table_rx), q3(table_rx), n_rx_dropped);
|
||||
//fprintf(time_meas_fd,"FFT;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;",
|
||||
squareRoot(&ru->ofdm_demod_stats),
|
||||
squareRoot(&ru->ofdm_demod_stats),
|
||||
median(table_rx_fft), q1(table_rx_fft), q3(table_rx_fft));
|
||||
//fprintf(time_meas_fd,"DEMOD;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;",
|
||||
squareRoot(&eNB->ulsch_demodulation_stats),
|
||||
squareRoot(&eNB->ulsch_demodulation_stats),
|
||||
median(table_rx_demod), q1(table_rx_demod), q3(table_rx_demod));
|
||||
//fprintf(time_meas_fd,"DEC;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f\n",
|
||||
squareRoot(&eNB->ulsch_decoding_stats),
|
||||
squareRoot(&eNB->ulsch_decoding_stats),
|
||||
median(table_rx_dec), q1(table_rx_dec), q3(table_rx_dec));
|
||||
printf("[passed] effective rate : %f (%2.1f%%,%f)): log and break \n",rate*effective_rate, 100*effective_rate, rate );
|
||||
break;
|
||||
@@ -1650,5 +1509,7 @@ int main(int argc, char **argv) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */
|
||||
uint64_t get_softmodem_optmask(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
openair0_device openair0;
|
||||
volatile int oai_exit=0;
|
||||
|
||||
void exit_function(const char* file, const char* function, const int line,const char *s) {
|
||||
void exit_function(const char* file, const char* function, const int line,const char *s) {
|
||||
const char * msg= s==NULL ? "no comment": s;
|
||||
printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg);
|
||||
exit(-1);
|
||||
printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
extern unsigned int dlsch_tbs25[27][25],TBStable[27][110];
|
||||
|
||||
@@ -32,17 +32,14 @@
|
||||
|
||||
// NEW code with lookup table for sin/cos based on delay profile (TO BE TESTED)
|
||||
|
||||
double **cos_lut=NULL,**sin_lut=NULL;
|
||||
double **cos_lut=NULL,* *sin_lut=NULL;
|
||||
|
||||
|
||||
//#if 1
|
||||
|
||||
|
||||
|
||||
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
{
|
||||
|
||||
|
||||
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
double delta_f,freq; // 90 kHz spacing
|
||||
double delay;
|
||||
int16_t f;
|
||||
@@ -50,21 +47,18 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
|
||||
if ((n_samples&1)==0) {
|
||||
fprintf(stderr, "freq_channel_init: n_samples has to be odd\n");
|
||||
return(-1);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
cos_lut = (double **)malloc(n_samples*sizeof(double*));
|
||||
sin_lut = (double **)malloc(n_samples*sizeof(double*));
|
||||
|
||||
cos_lut = (double **)malloc(n_samples*sizeof(double *));
|
||||
sin_lut = (double **)malloc(n_samples*sizeof(double *));
|
||||
delta_f = nb_rb*180000/(n_samples-1);
|
||||
|
||||
for (f=-(n_samples>>1); f<=(n_samples>>1); f++) {
|
||||
freq=delta_f*(double)f*1e-6;// due to the fact that delays is in mus
|
||||
|
||||
cos_lut[f+(n_samples>>1)] = (double *)malloc((int)desc->nb_taps*sizeof(double));
|
||||
sin_lut[f+(n_samples>>1)] = (double *)malloc((int)desc->nb_taps*sizeof(double));
|
||||
|
||||
|
||||
for (l=0; l<(int)desc->nb_taps; l++) {
|
||||
if (desc->nb_taps==1)
|
||||
delay = desc->delays[l];
|
||||
@@ -74,17 +68,13 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
cos_lut[f+(n_samples>>1)][l] = cos(2*M_PI*freq*delay);
|
||||
sin_lut[f+(n_samples>>1)][l] = sin(2*M_PI*freq*delay);
|
||||
//printf("values cos:%d, sin:%d\n", cos_lut[f][l], sin_lut[f][l]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
{
|
||||
|
||||
|
||||
int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
int16_t f,f2,d;
|
||||
uint8_t aarx,aatx,l;
|
||||
double *clut,*slut;
|
||||
@@ -95,7 +85,7 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
// n_samples has to be a odd number because we assume the spectrum is symmetric around the DC and includes the DC
|
||||
if ((n_samples&1)==0) {
|
||||
fprintf(stderr, "freq_channel: n_samples has to be odd\n");
|
||||
return(-1);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// printf("no of taps:%d,",(int)desc->nb_taps);
|
||||
@@ -104,6 +94,7 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
// we are initializing the lut for the largets possible n_samples=12*nb_rb+1
|
||||
// if called with n_samples<12*nb_rb+1, we decimate the lut
|
||||
n_samples_max=12*nb_rb+1;
|
||||
|
||||
if (init_freq_channel(desc,nb_rb,n_samples_max)==0)
|
||||
freq_channel_init=1;
|
||||
else
|
||||
@@ -111,9 +102,7 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
}
|
||||
|
||||
d=(n_samples_max-1)/(n_samples-1);
|
||||
|
||||
//printf("no_samples=%d, n_samples_max=%d, d=%d\n",n_samples,n_samples_max,d);
|
||||
|
||||
start_meas(&desc->interp_freq);
|
||||
|
||||
for (f=-n_samples_max/2,f2=-n_samples/2; f<n_samples_max/2; f+=d,f2++) {
|
||||
@@ -126,7 +115,6 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y=0.0;
|
||||
|
||||
for (l=0; l<(int)desc->nb_taps; l++) {
|
||||
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x+=(desc->a[l][aarx+(aatx*desc->nb_rx)].x*clut[l]+
|
||||
desc->a[l][aarx+(aatx*desc->nb_rx)].y*slut[l]);
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].x*slut[l]+
|
||||
@@ -137,7 +125,6 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
}
|
||||
|
||||
stop_meas(&desc->interp_freq);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -146,16 +133,13 @@ double compute_pbch_sinr(channel_desc_t *desc,
|
||||
channel_desc_t *desc_i2,
|
||||
double snr_dB,double snr_i1_dB,
|
||||
double snr_i2_dB,
|
||||
uint16_t nb_rb)
|
||||
{
|
||||
|
||||
uint16_t nb_rb) {
|
||||
double avg_sinr,snr=pow(10.0,.1*snr_dB),snr_i1=pow(10.0,.1*snr_i1_dB),snr_i2=pow(10.0,.1*snr_i2_dB);
|
||||
uint16_t f;
|
||||
uint8_t aarx,aatx;
|
||||
double S;
|
||||
struct complex S_i1;
|
||||
struct complex S_i2;
|
||||
|
||||
avg_sinr=0.0;
|
||||
|
||||
// printf("nb_rb %d\n",nb_rb);
|
||||
@@ -202,18 +186,14 @@ double compute_sinr(channel_desc_t *desc,
|
||||
channel_desc_t *desc_i2,
|
||||
double snr_dB,double snr_i1_dB,
|
||||
double snr_i2_dB,
|
||||
uint16_t nb_rb)
|
||||
{
|
||||
|
||||
uint16_t nb_rb) {
|
||||
double avg_sinr,snr=pow(10.0,.1*snr_dB),snr_i1=pow(10.0,.1*snr_i1_dB),snr_i2=pow(10.0,.1*snr_i2_dB);
|
||||
uint16_t f;
|
||||
uint8_t aarx,aatx;
|
||||
double S;
|
||||
struct complex S_i1;
|
||||
struct complex S_i2;
|
||||
|
||||
DevAssert( nb_rb > 0 );
|
||||
|
||||
avg_sinr=0.0;
|
||||
|
||||
// printf("nb_rb %d\n",nb_rb);
|
||||
@@ -256,12 +236,9 @@ double compute_sinr(channel_desc_t *desc,
|
||||
int pbch_polynomial_degree=6;
|
||||
double pbch_awgn_polynomial[7]= {-7.2926e-05, -2.8749e-03, -4.5064e-02, -3.5301e-01, -1.4655e+00, -3.6282e+00, -6.6907e+00};
|
||||
|
||||
void load_pbch_desc(FILE *pbch_file_fd)
|
||||
{
|
||||
|
||||
void load_pbch_desc(FILE *pbch_file_fd) {
|
||||
int i, ret;
|
||||
char dummy[25];
|
||||
|
||||
ret = fscanf(pbch_file_fd,"%d",&pbch_polynomial_degree);
|
||||
|
||||
if (ret < 0) {
|
||||
@@ -277,7 +254,7 @@ void load_pbch_desc(FILE *pbch_file_fd)
|
||||
printf("PBCH polynomial : ");
|
||||
|
||||
for (i=0; i<=pbch_polynomial_degree; i++) {
|
||||
ret = fscanf(pbch_file_fd,"%s",dummy);
|
||||
ret = fscanf(pbch_file_fd,"%24s",dummy);
|
||||
|
||||
if (ret < 0) {
|
||||
printf("fscanf failed: %s\n", strerror(errno));
|
||||
@@ -291,9 +268,7 @@ void load_pbch_desc(FILE *pbch_file_fd)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
double pbch_bler(double sinr)
|
||||
{
|
||||
|
||||
double pbch_bler(double sinr) {
|
||||
int i;
|
||||
double log10_bler=pbch_awgn_polynomial[pbch_polynomial_degree];
|
||||
double sinrpow=sinr;
|
||||
@@ -317,6 +292,5 @@ double pbch_bler(double sinr)
|
||||
|
||||
//printf ("sinr %f bler %f\n",sinr,bler);
|
||||
return(bler);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -31,17 +31,14 @@
|
||||
enum sector {SEC1, SEC2, SEC3};
|
||||
scenario_desc_t scenario;
|
||||
|
||||
void get_chan_desc(node_desc_t* node_tx, node_desc_t* node_rx, channel_desc_t *ch_desc, scenario_desc_t* scenario)
|
||||
{
|
||||
void get_chan_desc(node_desc_t *node_tx, node_desc_t *node_rx, channel_desc_t *ch_desc, scenario_desc_t *scenario) {
|
||||
double dist;
|
||||
dist = sqrt(pow((node_tx->x - node_rx->x), 2) + pow((node_tx->y - node_rx->y), 2));
|
||||
|
||||
/* conversion of distance into KM 3gpp (36-942)*/
|
||||
ch_desc->path_loss_dB = (128.1 + 37.6 * log10(dist/1000));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
int enb_count = 16;
|
||||
int ue_count = 50;
|
||||
double sect_angle[3]= {0,2*PI/3,4*PI/3};
|
||||
@@ -75,19 +72,16 @@ int main()
|
||||
"bler_9.csv", "bler_10.csv", "bler_11.csv", "bler_12.csv", "bler_13.csv", "bler_14.csv", "bler_15.csv", "bler_16.csv",
|
||||
"bler_17.csv", "bler_18.csv", "bler_19.csv", "bler_20.csv", "bler_21.csv", "bler_22.csv"
|
||||
};
|
||||
|
||||
double beta[MCS_COUNT] = {0, 0, 0, 0, 0.9459960937499999, 1.2912109374999994, 1.0133789062499998, 1.000390625,
|
||||
1.02392578125, 1.8595703124999998, 2.424389648437498, 2.3946533203124982, 2.5790039062499988,
|
||||
2.4084960937499984, 2.782617187499999, 2.7868652343749996, 3.92099609375, 4.0392578125,
|
||||
4.56109619140625, 5.03338623046875, 5.810888671875, 6.449108886718749
|
||||
};
|
||||
|
||||
double enb_position[][2] = {{1100,1100},{1100,2100},{1100,3100},{1100,4100},
|
||||
{2100,1100},{2100,2100},{2100,3100},{2100,4100},
|
||||
{3100,1100},{3100,2100},{3100,3100},{3100,4100},
|
||||
{4100,1100},{4100,2100},{4100,3100},{4100,4100}
|
||||
};
|
||||
|
||||
double ue_position[][2] = {{3340,4740},{1500,620},{1780,4220},{1300,3540},{780,3100},
|
||||
{1140,540},{1340,3660},{860,1220},{2700,2140},{3860,3060},
|
||||
{3740,1060},{1700,3060},{2180,1620},{4420,1060},{1300,3340},
|
||||
@@ -99,15 +93,12 @@ int main()
|
||||
{3420,2820},{1580,3940},{660,2100},{2740,1180},{2500,2500},
|
||||
{3580,3580},{3740,3140},{3020,3020},{4340,4140},{980,4300}
|
||||
};
|
||||
|
||||
randominit(0);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int tabl_len=0;
|
||||
double local_table[MCS_COUNT][9][9];
|
||||
|
||||
for (mcs = 5; mcs <= MCS_COUNT; mcs++) {
|
||||
|
||||
fp = fopen(file_name[mcs - 1],"r");
|
||||
|
||||
if (fp == NULL) {
|
||||
@@ -117,7 +108,6 @@ int main()
|
||||
tabl_len=0;
|
||||
|
||||
while (!feof(fp)) {
|
||||
|
||||
sinr_bler = strtok(buffer, ";");
|
||||
local_table[mcs-1][0][tabl_len] = atof(sinr_bler);
|
||||
sinr_bler = strtok(NULL,";");
|
||||
@@ -133,12 +123,8 @@ int main()
|
||||
|
||||
for (tabl_len=0; tabl_len<9; tabl_len++)
|
||||
printf("%lf %lf \n ",local_table[mcs-1][0][tabl_len],local_table[mcs-1][1][tabl_len]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
for (enb_index = 0; enb_index < enb_count; enb_index++)
|
||||
@@ -172,7 +158,6 @@ int main()
|
||||
ul_channel[ue_index][enb_index] = new_channel_desc_scm(1, 1, SCM_C, 7.68, 0, 0, 0);
|
||||
dl_channel[ue_index][enb_index] = new_channel_desc_scm(1, 1, SCM_C, 7.68, 0, 0, 0);
|
||||
//printf("ue %d enb %d\n", ue_index, enb_index);
|
||||
|
||||
/* Calculating the angle in the range -pi to pi from the slope */
|
||||
//(ue_data[ue_index])->alpha_rad[enb_index] = (double)(atan2((ue_data[ue_index]->x - enb_data[enb_index]->x), (ue_data[ue_index]->y - enb_data[enb_index]->y)));
|
||||
ue_data[ue_index]->alpha_rad[enb_index] = atan2((ue_data[ue_index]->x - enb_data[enb_index]->x), (ue_data[ue_index]->y - enb_data[enb_index]->y));
|
||||
@@ -190,8 +175,7 @@ int main()
|
||||
|
||||
/* gain = -min(Am , 12 * (theta/theta_3dB)^2) */
|
||||
gain_max = (gain_sec[SEC1] > gain_sec[SEC2]) ? ((gain_sec[SEC1] > gain_sec[SEC3]) ? gain_sec[SEC1]:gain_sec[SEC3]) :
|
||||
((gain_sec[SEC2] > gain_sec[SEC3]) ? gain_sec[SEC2]:gain_sec[SEC3]);
|
||||
|
||||
((gain_sec[SEC2] > gain_sec[SEC3]) ? gain_sec[SEC2]:gain_sec[SEC3]);
|
||||
get_chan_desc(enb_data[enb_index], ue_data[ue_index], ul_channel[ue_index][enb_index], &scenario);
|
||||
get_chan_desc(enb_data[enb_index], ue_data[ue_index], dl_channel[ue_index][enb_index], &scenario);
|
||||
|
||||
@@ -204,7 +188,6 @@ int main()
|
||||
|
||||
//return_value = random_channel(ul_channel[ue_index][enb_index]);
|
||||
return_value = random_channel(dl_channel[ue_index][enb_index]);
|
||||
|
||||
/* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann´s constant T = room temperature B = bandwidth */
|
||||
/* Taken as constant for the time being since the BW is not changing */
|
||||
thermal_noise = -105; //value in dBm
|
||||
@@ -222,7 +205,6 @@ int main()
|
||||
- (thermal_noise + ue_data[ue_index]->rx_noise_level)
|
||||
+ 10 * log10 (pow(dl_channel[ue_index][enb_index]->chF[0][count].r, 2)
|
||||
+ pow(dl_channel[ue_index][enb_index]->chF[0][count].i, 2));
|
||||
|
||||
//printf("Dl_link SNR for res. block %d is %lf\n", count, sinr[enb_index][count]);
|
||||
}
|
||||
}
|
||||
@@ -252,7 +234,6 @@ int main()
|
||||
//printf("mcs value %d \n",mcs);
|
||||
//printf("beta value %lf \n",-beta[mcs-1]);
|
||||
//printf("snr_eff value %lf \n",log(sinr_eff[ue_index][mcs-1]));
|
||||
|
||||
sinr_eff[ue_index][mcs-1] = -beta[mcs-1] *log((sinr_eff[ue_index][mcs-1])/(2*nb_rb));//
|
||||
//printf("snr_eff value %lf \n",sinr_eff[ue_index][mcs-1]);
|
||||
sinr_eff[ue_index][mcs-1] = 10 * log10(sinr_eff[ue_index][mcs-1]);
|
||||
@@ -264,9 +245,7 @@ int main()
|
||||
}
|
||||
|
||||
sinr_eff[ue_index][mcs-1] /= 10;
|
||||
|
||||
//printf("Effective snr %lf \n",sinr_eff[ue_index][mcs-1]);
|
||||
|
||||
bler[ue_index][mcs-1] = 0;
|
||||
|
||||
/*line_num = 0;
|
||||
@@ -295,37 +274,31 @@ int main()
|
||||
}
|
||||
fclose(fp);*/
|
||||
for (tabl_len=0; tabl_len<9; tabl_len++) {
|
||||
|
||||
if(tabl_len==0)
|
||||
if (sinr_eff[ue_index][mcs-1] < local_table[mcs-1][0][tabl_len]) {
|
||||
bler[ue_index][mcs-1] = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (sinr_eff[ue_index][mcs-1] == local_table[mcs-1][0][tabl_len]) {
|
||||
bler[ue_index][mcs-1] = local_table[mcs-1][1][tabl_len];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//printf("\n###Dl_link UE %d attached to eNB %d \n MCS %d effective SNR %lf BLER %lf", ue_index, att_enb_index, mcs,sinr_eff[ue_index][mcs-1],bler[ue_index][mcs-1]);
|
||||
}
|
||||
|
||||
//printf("\n\n");
|
||||
|
||||
printf("\n Ue_ix enb_ix mcs5 mcs6 mcs7 mcs8 mcs9 mcs10 mcs11 mcs12 mcs13\
|
||||
mcs14 mcs15 mcs16 mcs17 mcs18 mcs19 mcs20 mcs21 mcs22\n");
|
||||
|
||||
printf("SINR %4d %4d %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\
|
||||
%+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\n",
|
||||
%+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\n",
|
||||
ue_index, att_enb_index, sinr_eff[ue_index][4], sinr_eff[ue_index][5], sinr_eff[ue_index][6], sinr_eff[ue_index][7],
|
||||
sinr_eff[ue_index][8], sinr_eff[ue_index][9], sinr_eff[ue_index][10], sinr_eff[ue_index][11], sinr_eff[ue_index][12],
|
||||
sinr_eff[ue_index][13], sinr_eff[ue_index][14], sinr_eff[ue_index][15], sinr_eff[ue_index][16], sinr_eff[ue_index][17],
|
||||
sinr_eff[ue_index][18], sinr_eff[ue_index][19], sinr_eff[ue_index][20], sinr_eff[ue_index][21], sinr_eff[ue_index][22]);
|
||||
|
||||
printf("BLER %4d %4d %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\
|
||||
%+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\n",
|
||||
%+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\n",
|
||||
ue_index, att_enb_index, bler[ue_index][4], bler[ue_index][5], bler[ue_index][6], bler[ue_index][7],
|
||||
bler[ue_index][8], bler[ue_index][9], bler[ue_index][10], bler[ue_index][11], bler[ue_index][12],
|
||||
bler[ue_index][13], bler[ue_index][14], bler[ue_index][15], bler[ue_index][16], bler[ue_index][17],
|
||||
|
||||
@@ -27,20 +27,15 @@
|
||||
|
||||
unsigned int *generate_gauss_LUT(unsigned char Nbits,
|
||||
unsigned char L
|
||||
)
|
||||
{
|
||||
|
||||
) {
|
||||
unsigned int *LUT_ptr,i;
|
||||
|
||||
LUT_ptr = (unsigned int *)malloc((1<<(Nbits-1))*sizeof(int));
|
||||
assert(LUT_ptr);
|
||||
|
||||
|
||||
for (i=0; i<(1<<(Nbits-1)); i++) {
|
||||
LUT_ptr[i] = (unsigned int)((double)((unsigned int)(1<<31))*erf(i*L/(double)(1<<(Nbits-1))));
|
||||
|
||||
#ifdef LUTDEBUG
|
||||
printf("pos %d : LUT_ptr[%d]=%x (%f)\n",i,i,LUT_ptr[i],(double)(erf(i*L/(double)(1<<(Nbits-1)))));
|
||||
printf("pos %u : LUT_ptr[%u]=%x (%f)\n",i,i,LUT_ptr[i],(double)(erf(i*L/(double)(1<<(Nbits-1)))));
|
||||
#endif //LUTDEBUG
|
||||
}
|
||||
|
||||
@@ -51,40 +46,29 @@ unsigned int *generate_gauss_LUT(unsigned char Nbits,
|
||||
|
||||
int gauss(unsigned int *gauss_LUT,
|
||||
unsigned char Nbits
|
||||
)
|
||||
{
|
||||
|
||||
) {
|
||||
unsigned int search_pos,step_size,u,tmp,tmpm1,tmpp1,s;
|
||||
|
||||
// Get a 32-bit uniform random-variable
|
||||
u = taus();
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("u = %u\n",u);
|
||||
#endif //DEBUG
|
||||
|
||||
// if it is larger than 2^31 (here negative), save the sign and rescale down to 31-bits.
|
||||
|
||||
s = u & 0x80000000;
|
||||
u &= 0x7fffffff;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("u = %x,s=%d\n",u,s);
|
||||
printf("u = %x,s=%u\n",u,s);
|
||||
#endif //DEBUG
|
||||
|
||||
search_pos = (1<<(Nbits-2)); // starting position of the binary search
|
||||
step_size = search_pos;
|
||||
|
||||
do {
|
||||
|
||||
step_size >>= 1;
|
||||
|
||||
tmp = gauss_LUT[search_pos];
|
||||
tmpm1 = gauss_LUT[search_pos-1];
|
||||
tmpp1 = gauss_LUT[search_pos+1];
|
||||
#ifdef DEBUG
|
||||
printf("search_pos %d, step_size %d: t %x tm %x,tp %x\n",search_pos,step_size,tmp,tmpm1,tmpp1);
|
||||
printf("search_pos %u, step_size %u: t %x tm %x,tp %x\n",search_pos,step_size,tmp,tmpm1,tmpp1);
|
||||
#endif //DEBUG
|
||||
|
||||
if (u <= tmp)
|
||||
@@ -96,12 +80,10 @@ int gauss(unsigned int *gauss_LUT,
|
||||
return s==0 ? search_pos : - search_pos;
|
||||
else
|
||||
search_pos += step_size;
|
||||
|
||||
} while (step_size > 0);
|
||||
|
||||
// If it gets here we're beyond the positive edge so return max
|
||||
return s==0 ? (1<<(Nbits-1))-1 : 1-((1<<(Nbits-1)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -109,9 +91,7 @@ int gauss(unsigned int *gauss_LUT,
|
||||
|
||||
#define Nhistbits 8
|
||||
|
||||
void main(int argc,char **argv)
|
||||
{
|
||||
|
||||
void main(int argc,char **argv) {
|
||||
unsigned int *gauss_LUT_ptr,i;
|
||||
unsigned int hist[(1<<Nhistbits)];
|
||||
int gvar,maxg=0,ming=9999999,maxnum=0,L,Ntrials,Nbits;
|
||||
@@ -125,7 +105,6 @@ void main(int argc,char **argv)
|
||||
Nbits = atoi(argv[1]);
|
||||
L = atoi(argv[2]);
|
||||
Ntrials = atoi(argv[3]);
|
||||
|
||||
set_taus_seed();
|
||||
// Generate Gaussian LUT 12-bit quantization over 5 standard deviations
|
||||
gauss_LUT_ptr = generate_gauss_LUT(Nbits,L);
|
||||
@@ -134,7 +113,6 @@ void main(int argc,char **argv)
|
||||
hist[i] = 0;
|
||||
|
||||
for (i=0; i<Ntrials; i++) {
|
||||
|
||||
gvar = gauss(gauss_LUT_ptr,Nbits);
|
||||
|
||||
if (gvar == ((1<<(Nbits-1))-1))
|
||||
@@ -151,10 +129,8 @@ void main(int argc,char **argv)
|
||||
|
||||
printf("Tail probability = %e(%x)\n",2*erfc((double)L*gauss_LUT_ptr[(1<<(Nbits-1))-1]/(unsigned int)(1<<31)),gauss_LUT_ptr[(1<<(Nbits-1))-1]);
|
||||
printf("max %d, min %d, mean %f, stddev %f, Pr(maxnum)=%e(%d)\n",maxg,ming,meang,sqrt(varg),(double)maxnum/Ntrials,maxnum);
|
||||
|
||||
// for (i=0;i<(1<<Nhistbits);i++)
|
||||
// printf("%d : %u\n",i,hist[i]);
|
||||
|
||||
free(gauss_LUT_ptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,24 +37,18 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
double **rx_sig_re,
|
||||
double **rx_sig_im,
|
||||
uint16_t length,
|
||||
uint8_t keep_channel)
|
||||
{
|
||||
|
||||
double complex **tx,**rx,***H_t,*rx_temp;//, *tv_H_t;
|
||||
uint8_t keep_channel) {
|
||||
double complex **tx,**rx,* **H_t,*rx_temp; //, *tv_H_t;
|
||||
double path_loss = pow(10,desc->path_loss_dB/20);
|
||||
int i,j,k,dd;
|
||||
|
||||
dd = abs(desc->channel_offset);
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
printf("[TV CHANNEL] keep = %d : path_loss = %g (%f), nb_rx %d, nb_tx %d, dd %d, len %d max_doppler %d\n",keep_channel,path_loss,desc->path_loss_dB,desc->nb_rx,desc->nb_tx,dd,desc->channel_length,
|
||||
printf("[TV CHANNEL] keep = %d : path_loss = %g (%f), nb_rx %d, nb_tx %d, dd %d, len %d max_doppler %g\n",keep_channel,path_loss,desc->path_loss_dB,desc->nb_rx,desc->nb_tx,dd,desc->channel_length,
|
||||
desc->max_Doppler);
|
||||
#endif
|
||||
|
||||
tx = (double complex **)malloc(desc->nb_tx*sizeof(double complex));
|
||||
rx = (double complex **)malloc(desc->nb_rx*sizeof(double complex));
|
||||
|
||||
H_t= (double complex ***) malloc(desc->nb_tx*desc->nb_rx*sizeof(double complex **));
|
||||
H_t= (double complex ** *) malloc(desc->nb_tx*desc->nb_rx*sizeof(double complex **));
|
||||
// tv_H_t = (double complex *) malloc(length*sizeof(double complex));
|
||||
rx_temp= (double complex *) calloc(length,sizeof(double complex));
|
||||
|
||||
@@ -128,17 +122,13 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
}
|
||||
|
||||
free(H_t);
|
||||
|
||||
free(rx_temp);
|
||||
}
|
||||
|
||||
//TODO: make phi_rad a parameter of this function
|
||||
void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length)
|
||||
{
|
||||
|
||||
void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length) {
|
||||
int i,j,p,l,k;
|
||||
double *alpha,*phi_rad,pi=acos(-1),*w_Hz;
|
||||
|
||||
alpha = (double *)calloc(desc->nb_paths,sizeof(double));
|
||||
phi_rad = (double *)calloc(desc->nb_paths,sizeof(double));
|
||||
w_Hz = (double *)calloc(desc->nb_paths,sizeof(double));
|
||||
@@ -203,21 +193,17 @@ void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length)
|
||||
}
|
||||
|
||||
// time varying convolution
|
||||
void tv_conv(double complex **h, double complex *x, double complex *y, uint16_t nb_samples, uint8_t nb_taps, int dd)
|
||||
{
|
||||
|
||||
void tv_conv(double complex **h, double complex *x, double complex *y, uint16_t nb_samples, uint8_t nb_taps, int dd) {
|
||||
int i,j;
|
||||
|
||||
for(i=0; i<((int)nb_samples-dd); i++) {
|
||||
for(j=0; j<nb_taps; j++) {
|
||||
if(i>j)
|
||||
y[i+dd] += creal(h[i][j])*creal(x[i-j])-cimag(h[i][j])*cimag(x[i-j]) + I*(creal(h[i][j])*cimag(x[i-j])+cimag(h[i][j])*creal(x[i-j]));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double frand_a_b(double a, double b)
|
||||
{
|
||||
double frand_a_b(double a, double b) {
|
||||
return (rand()/(double)RAND_MAX)*(b-a)+a;
|
||||
}
|
||||
|
||||
Executable → Regular
Reference in New Issue
Block a user