Merge branch 'develop' into ldpc-decoder-codegen
Conflicts: cmake_targets/CMakeLists.txt cmake_targets/build_oai openair1/PHY/TOOLS/time_meas.h
This commit is contained in:
@@ -231,7 +231,6 @@ void clear_UE_transport_info(uint8_t nb_UE)
|
||||
|
||||
for (UE_id=0; UE_id<nb_UE; UE_id++)
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
UE_transport_info_TB_index[UE_id][CC_id]=0;
|
||||
memset((void *)&UE_transport_info[UE_id][CC_id].cntl,0,sizeof(UE_cntl));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,6 @@ extern eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
|
||||
extern uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
|
||||
|
||||
extern UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
|
||||
extern uint16_t UE_transport_info_TB_index[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
|
||||
|
||||
extern UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][MAX_NUM_CCs][2];
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@
|
||||
* \email: lionel.gauthier@eurecom.fr
|
||||
*/
|
||||
|
||||
#ifndef __SOCKET_H__
|
||||
# define __SOCKET_H__
|
||||
#ifndef __SIMULATION_ETH_TRANSPORT_SOCKET__H__
|
||||
#define __SIMULATION_ETH_TRANSPORT_SOCKET__H__
|
||||
|
||||
# ifdef SOCKET_C
|
||||
# define private_socket(x) x
|
||||
# define public_socket(x) x
|
||||
|
||||
@@ -58,7 +58,6 @@ eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
|
||||
uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
|
||||
|
||||
UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
|
||||
uint16_t UE_transport_info_TB_index[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
|
||||
|
||||
UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][MAX_NUM_CCs][2];
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -50,13 +46,13 @@ void sumUpStatsSlot(time_stats_t *res, time_stats_t src[RX_NB_TH][2], int lastAc
|
||||
}
|
||||
|
||||
double squareRoot(time_stats_t *ptr) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
double timeBase=1/(1000*get_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);
|
||||
double timeBase=1/(1000*get_cpu_freq_GHz());
|
||||
printf("%-43s %6.2f us (%d trials)\n",
|
||||
txt,
|
||||
(double)ptr->diff/ptr->trials*timeBase,
|
||||
@@ -73,7 +69,7 @@ void printStatIndent(time_stats_t *ptr, char *txt) {
|
||||
}
|
||||
|
||||
void printStatIndent2(time_stats_t *ptr, char *txt) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
double timeBase=1/(1000*get_cpu_freq_GHz());
|
||||
printf(" |__ %-34s %6.2f us (%3d trials)\n",
|
||||
txt,
|
||||
ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0,
|
||||
@@ -81,7 +77,7 @@ void printStatIndent2(time_stats_t *ptr, char *txt) {
|
||||
}
|
||||
|
||||
void printStatIndent3(time_stats_t *ptr, char *txt) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
double timeBase=1/(1000*get_cpu_freq_GHz());
|
||||
printf(" |__ %-30s %6.2f us (%3d trials)\n",
|
||||
txt,
|
||||
ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0,
|
||||
|
||||
@@ -60,16 +60,19 @@
|
||||
#include "dummy_functions.c"
|
||||
#include "executables/thread-common.h"
|
||||
#include "executables/split_headers.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
void feptx_ofdm(RU_t *ru, int frame, int subframe);
|
||||
void feptx_prec(RU_t *ru, int frame, int subframe);
|
||||
|
||||
double cpuf;
|
||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
|
||||
//#define MCS_COUNT 23//added for PHY abstraction
|
||||
#include <openair1/SIMULATION/LTE_PHY/common_sim.h>
|
||||
|
||||
int otg_enabled=0;
|
||||
THREAD_STRUCT thread_struct;
|
||||
nfapi_ue_release_request_body_t release_rntis;
|
||||
|
||||
/*the following parameters are used to control the processing times calculations*/
|
||||
double t_tx_max = -1000000000; /*!< \brief initial max process time for tx */
|
||||
double t_rx_max = -1000000000; /*!< \brief initial max process time for rx */
|
||||
@@ -78,6 +81,12 @@ double t_rx_min = 1000000000; /*!< \brief initial min process time for rx */
|
||||
int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
|
||||
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
|
||||
|
||||
double DS_TDL = .03;
|
||||
static int cmpdouble(const void *p1, const void *p2) {
|
||||
return *(double *)p1 > *(double *)p2;
|
||||
}
|
||||
RAN_CONTEXT_t RC;
|
||||
|
||||
int emulate_rf = 0;
|
||||
int split73=0;
|
||||
void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) {
|
||||
@@ -161,7 +170,7 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
|
||||
// Multipath channel
|
||||
if (awgn_flag == 0) {
|
||||
multipath_channel(eNB2UE[round],s_re,s_im,r_re,r_im,
|
||||
2*UE->frame_parms.samples_per_tti,hold_channel);
|
||||
2*UE->frame_parms.samples_per_tti,hold_channel,0);
|
||||
|
||||
// printf("amc: ****************** eNB2UE[%d]->n_rx = %d,dd %d\n",round,eNB2UE[round]->nb_rx,eNB2UE[round]->channel_offset);
|
||||
if(abstx==1 && num_rounds>1)
|
||||
@@ -173,7 +182,7 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
|
||||
|
||||
if (UE->perfect_ce==1) {
|
||||
// fill in perfect channel estimates
|
||||
freq_channel(eNB2UE[round],UE->frame_parms.N_RB_DL,12*UE->frame_parms.N_RB_DL + 1);
|
||||
freq_channel(eNB2UE[round],UE->frame_parms.N_RB_DL,12*UE->frame_parms.N_RB_DL + 1, 15);
|
||||
/*
|
||||
LOG_M("channel.m","ch",eNB2UE[round]->ch[0],eNB2UE[round]->channel_length,1,8);
|
||||
LOG_M("channelF.m","chF",eNB2UE[round]->chF[0],12*UE->frame_parms.N_RB_DL + 1,1,8);
|
||||
@@ -184,52 +193,52 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
|
||||
if(abstx) {
|
||||
if (trials==0 && round==0) {
|
||||
// calculate freq domain representation to compute SINR
|
||||
freq_channel(eNB2UE[0], ru->frame_parms->N_RB_DL,2*ru->frame_parms->N_RB_DL + 1);
|
||||
freq_channel(eNB2UE[0], ru->frame_parms->N_RB_DL,2*ru->frame_parms->N_RB_DL + 1, 15);
|
||||
// snr=pow(10.0,.1*SNR);
|
||||
fprintf(csv_fd,"%f,",SNR);
|
||||
|
||||
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
|
||||
for (aarx=0; aarx<eNB2UE[0]->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<eNB2UE[0]->nb_tx; aatx++) {
|
||||
channelx = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].x;
|
||||
channely = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].y;
|
||||
channelx = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].r;
|
||||
channely = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].i;
|
||||
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(num_rounds>1) {
|
||||
freq_channel(eNB2UE[1], ru->frame_parms->N_RB_DL,2*ru->frame_parms->N_RB_DL + 1);
|
||||
freq_channel(eNB2UE[1], ru->frame_parms->N_RB_DL,2*ru->frame_parms->N_RB_DL + 1, 15);
|
||||
|
||||
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
|
||||
for (aarx=0; aarx<eNB2UE[1]->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<eNB2UE[1]->nb_tx; aatx++) {
|
||||
channelx = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].x;
|
||||
channely = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].y;
|
||||
channelx = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].r;
|
||||
channely = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].i;
|
||||
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
freq_channel(eNB2UE[2], ru->frame_parms->N_RB_DL,2*ru->frame_parms->N_RB_DL + 1);
|
||||
freq_channel(eNB2UE[2], ru->frame_parms->N_RB_DL,2*ru->frame_parms->N_RB_DL + 1, 15);
|
||||
|
||||
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
|
||||
for (aarx=0; aarx<eNB2UE[2]->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<eNB2UE[2]->nb_tx; aatx++) {
|
||||
channelx = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].x;
|
||||
channely = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].y;
|
||||
channelx = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].r;
|
||||
channely = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].i;
|
||||
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
freq_channel(eNB2UE[3], ru->frame_parms->N_RB_DL,2*ru->frame_parms->N_RB_DL + 1);
|
||||
freq_channel(eNB2UE[3], ru->frame_parms->N_RB_DL,2*ru->frame_parms->N_RB_DL + 1, 15);
|
||||
|
||||
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
|
||||
for (aarx=0; aarx<eNB2UE[3]->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<eNB2UE[3]->nb_tx; aatx++) {
|
||||
channelx = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].x;
|
||||
channely = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].y;
|
||||
channelx = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].r;
|
||||
channely = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].i;
|
||||
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
|
||||
}
|
||||
}
|
||||
@@ -482,7 +491,7 @@ int n_ch_rlz = 1;
|
||||
int rx_sample_offset = 0;
|
||||
int xforms=0;
|
||||
int dump_table=0;
|
||||
int loglvl=OAILOG_WARNING;
|
||||
int loglvl=OAILOG_INFO;
|
||||
int mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0;
|
||||
int two_thread_flag=0;
|
||||
int num_rounds = 4;//,fix_rounds=0;
|
||||
@@ -665,7 +674,7 @@ int main(int argc, char **argv) {
|
||||
{ "XForms", "Display the soft scope", PARAMFLAG_BOOL, iptr:&xforms, defintval:0, TYPE_INT, 0 },
|
||||
{ "Yperfect_ce","Perfect CE", PARAMFLAG_BOOL, iptr:&perfect_ce, defintval:0, TYPE_INT, 0 },
|
||||
{ "Zdump", "dump table",PARAMFLAG_BOOL, iptr:&dump_table, defintval:0, TYPE_INT, 0 },
|
||||
{ "Loglvl", "log level",0, iptr:&loglvl, defintval:OAILOG_DEBUG, TYPE_INT, 0 },
|
||||
{ "Loglvl", "log level",0, iptr:&loglvl, defintval:OAILOG_INFO, TYPE_INT, 0 },
|
||||
{ "zn_rx", "Number of RX antennas used in UE",0, iptr:NULL, defintval:2, TYPE_INT, 0 },
|
||||
{ "gchannel", "[A:M] Use 3GPP 25.814 SCM-A/B/C/D('A','B','C','D') or 36-101 EPA('E'), EVA ('F'),ETU('G') models (ignores delay spread and Ricean factor), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr ('K'), Rice8('L'), Rice1('M')",0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0 },
|
||||
{ "verbose", "display debug text", PARAMFLAG_BOOL, iptr:&verbose, defintval:0, TYPE_INT, 0 },
|
||||
@@ -900,7 +909,6 @@ int main(int argc, char **argv) {
|
||||
// moreover you need to init itti with the following line
|
||||
// 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);
|
||||
T_stdout = 1;
|
||||
|
||||
if (common_flag == 0) {
|
||||
@@ -929,9 +937,10 @@ int main(int argc, char **argv) {
|
||||
|
||||
NB_RB = conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL);
|
||||
} else {
|
||||
if (rballocset==0) NB_RB = 8;
|
||||
if (rballocset==0) NB_RB = 2+TPC;
|
||||
else NB_RB = DLSCH_RB_ALLOC;
|
||||
|
||||
printf("Common PDSCH: NB_RB = %d\n",NB_RB);
|
||||
AssertFatal(NB_RB <= N_RB_DL,"illegal NB_RB %d\n",NB_RB);
|
||||
}
|
||||
|
||||
@@ -1172,9 +1181,10 @@ int main(int argc, char **argv) {
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
DS_TDL,
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
reset_meas(&eNB2UE[0]->random_channel);
|
||||
reset_meas(&eNB2UE[0]->interp_time);
|
||||
|
||||
@@ -1185,9 +1195,10 @@ int main(int argc, char **argv) {
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
DS_TDL,
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
reset_meas(&eNB2UE[n]->random_channel);
|
||||
reset_meas(&eNB2UE[n]->interp_time);
|
||||
}
|
||||
|
||||
@@ -689,7 +689,6 @@ int main(int argc, char **argv)
|
||||
// moreover you need to init itti with the following line
|
||||
// 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);
|
||||
|
||||
if (common_flag == 0) {
|
||||
switch (N_RB_DL) {
|
||||
@@ -989,7 +988,7 @@ int main(int argc, char **argv)
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if(num_rounds>1) {
|
||||
for(n=1; n<8; n++)
|
||||
@@ -1000,7 +999,7 @@ int main(int argc, char **argv)
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
}
|
||||
|
||||
if (eNB2UE[0]==NULL) {
|
||||
|
||||
@@ -834,7 +834,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if(num_rounds>1) {
|
||||
for(n=1; n<4; n++)
|
||||
@@ -845,7 +845,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
}
|
||||
|
||||
if (eNB2UE[0]==NULL) {
|
||||
|
||||
@@ -67,6 +67,11 @@ int ue_query_mch(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
|
||||
sub_frame_t subframe, uint8_t eNB_index,
|
||||
uint8_t * sync_area, uint8_t * mcch_active){ return(0);}
|
||||
|
||||
|
||||
int ue_query_mch_fembms(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
|
||||
sub_frame_t subframe, uint8_t eNB_index,
|
||||
uint8_t * sync_area, uint8_t * mcch_active){ return(0);}
|
||||
|
||||
void dl_phy_sync_success(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
unsigned char eNB_index, uint8_t first_sync){}
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<gpib/ib.h>
|
||||
#include"gpib_send.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <gpib/ib.h>
|
||||
#include "gpib_send.h"
|
||||
void gpib_send(unsigned int gpib_board, unsigned int gpib_device, char *command_string )
|
||||
{
|
||||
unsigned short addlist[2] = {gpib_device, NOADDR};
|
||||
|
||||
+2204
-391
File diff suppressed because it is too large
Load Diff
@@ -386,7 +386,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (interf1>-20)
|
||||
eNB2UE1 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
@@ -396,7 +396,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
4,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (interf2>-20)
|
||||
eNB2UE2 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
@@ -406,7 +406,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
8,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
|
||||
@@ -708,7 +708,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
L1_rxtx_proc_t *proc_rxtx = (subframe == 0)? &eNB->proc.L1_proc: &eNB->proc.L1_proc_tx;
|
||||
eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,N_RB_DL,0);
|
||||
UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0);
|
||||
|
||||
@@ -343,7 +343,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
0.0,
|
||||
delay,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (UE2eNB==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
|
||||
@@ -283,7 +283,6 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
logInit();
|
||||
//itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL);
|
||||
g_log->log_component[PHY].level = LOG_DEBUG;
|
||||
g_log->log_component[PHY].flag = LOG_HIGH;
|
||||
|
||||
@@ -324,7 +323,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
0.0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (UE2eNB==NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
|
||||
@@ -335,7 +335,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
|
||||
@@ -724,7 +724,7 @@ int main(int argc, char **argv) {
|
||||
BW,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (interf1>-20)
|
||||
eNB2UE1 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
|
||||
@@ -733,7 +733,7 @@ int main(int argc, char **argv) {
|
||||
BW,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (interf2>-20)
|
||||
eNB2UE2 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
|
||||
@@ -742,7 +742,7 @@ int main(int argc, char **argv) {
|
||||
BW,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
|
||||
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
|
||||
double rx_gain;
|
||||
int rx_pwr2, target_rx_pwr_dB;
|
||||
|
||||
struct complex **ch;
|
||||
struct complexd **ch;
|
||||
unsigned char first_call = 1;
|
||||
|
||||
LTE_DL_FRAME_PARMS frame_parms;
|
||||
@@ -169,10 +169,10 @@ int main(int argc, char **argv)
|
||||
|
||||
channel_length = (int) 11+2*BW*Td;
|
||||
|
||||
ch = (struct complex**) malloc(4 * sizeof(struct complex*));
|
||||
ch = (struct complexd**) malloc(4 * sizeof(struct complexd*));
|
||||
|
||||
for (i = 0; i<4; i++)
|
||||
ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex));
|
||||
ch[i] = (struct complexd*) malloc(channel_length * sizeof(struct complexd));
|
||||
|
||||
randominit(0);
|
||||
set_taus_seed(0);
|
||||
|
||||
@@ -55,9 +55,11 @@
|
||||
#include "executables/thread-common.h"
|
||||
#include "targets/RT/USER/lte-softmodem.h"
|
||||
#include "executables/split_headers.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
||||
|
||||
double cpuf;
|
||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
|
||||
//#define MCS_COUNT 23//added for PHY abstraction
|
||||
#include <openair1/SIMULATION/LTE_PHY/common_sim.h>
|
||||
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
|
||||
@@ -70,6 +72,9 @@ node_desc_t *ue_data[NUMBER_OF_UE_MAX];
|
||||
extern uint16_t beta_ack[16],beta_ri[16],beta_cqi[16];
|
||||
//extern char* namepointer_chMag ;
|
||||
int xforms=0;
|
||||
THREAD_STRUCT thread_struct;
|
||||
nfapi_ue_release_request_body_t release_rntis;
|
||||
|
||||
FD_lte_phy_scope_enb *form_enb;
|
||||
char title[255];
|
||||
|
||||
@@ -80,8 +85,11 @@ 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 */
|
||||
static int cmpdouble(const void *p1, const void *p2) {
|
||||
return *(double *)p1 > *(double *)p2;
|
||||
}
|
||||
|
||||
|
||||
RAN_CONTEXT_t RC;
|
||||
int split73=0;
|
||||
void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) {
|
||||
AssertFatal(false, "Must not be called in this context\n");
|
||||
@@ -339,13 +347,12 @@ int main(int argc, char **argv) {
|
||||
int UE_id = 0;
|
||||
static int nb_rb=25,first_rb=0,mcs=0,round=0;
|
||||
//unsigned char l;
|
||||
static int awgn_flag = 0 ;
|
||||
SCM_t channel_model=Rice1;
|
||||
unsigned char *input_buffer=0,harq_pid;
|
||||
unsigned short input_buffer_length;
|
||||
unsigned int ret;
|
||||
unsigned int coded_bits_per_codeword,nsymb;
|
||||
unsigned int tx_lev=0,tx_lev_dB,trials,errs[4]= {0,0,0,0},round_trials[4]= {0,0,0,0};
|
||||
unsigned int tx_lev=0,tx_lev_dB,trials,errs[5]= {0,0,0,0,0},round_trials[4]= {0,0,0,0};
|
||||
FILE *bler_fd=NULL;
|
||||
char bler_fname[512];
|
||||
FILE *time_meas_fd=NULL;
|
||||
@@ -401,12 +408,11 @@ int main(int argc, char **argv) {
|
||||
printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
|
||||
AssertFatal(load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) != NULL, "Cannot load configuration module, exiting\n");
|
||||
logInit();
|
||||
set_glog(OAILOG_WARNING);
|
||||
set_glog(OAILOG_INFO);
|
||||
T_stdout = 1;
|
||||
// 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_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
|
||||
@@ -729,9 +735,10 @@ int main(int argc, char **argv) {
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
30e-9,
|
||||
forgetting_factor,
|
||||
delay,
|
||||
0);
|
||||
0, 0);
|
||||
// set Doppler
|
||||
UE2eNB->max_Doppler = maxDoppler;
|
||||
|
||||
@@ -1083,21 +1090,19 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (awgn_flag == 0) {
|
||||
if (UE2eNB->max_Doppler == 0) {
|
||||
multipath_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
eNB->frame_parms.samples_per_tti,hold_channel);
|
||||
} else {
|
||||
multipath_tv_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
2*eNB->frame_parms.samples_per_tti,hold_channel);
|
||||
}
|
||||
if (UE2eNB->max_Doppler == 0) {
|
||||
multipath_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
eNB->frame_parms.samples_per_tti,hold_channel,0);
|
||||
} else {
|
||||
multipath_tv_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
2*eNB->frame_parms.samples_per_tti,hold_channel);
|
||||
}
|
||||
|
||||
if(abstx) {
|
||||
if(saving_bler==0)
|
||||
if (trials==0 && round==0) {
|
||||
// calculate freq domain representation to compute SINR
|
||||
freq_channel(UE2eNB, N_RB_DL,12*N_RB_DL + 1);
|
||||
freq_channel(UE2eNB, N_RB_DL,12*N_RB_DL + 1, 15);
|
||||
// snr=pow(10.0,.1*SNR);
|
||||
fprintf(csv_fdUL,"%f,%u,%u,%f,%f,%f,",SNR,tx_lev,tx_lev_dB,sigma2_dB,tx_gain,SNR2);
|
||||
|
||||
@@ -1106,8 +1111,8 @@ int main(int argc, char **argv) {
|
||||
for (aarx=0; aarx<UE2eNB->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<UE2eNB->nb_tx; aatx++) {
|
||||
// abs_channel = (eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].x*eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].x + eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].y*eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].y);
|
||||
channelx = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].x;
|
||||
channely = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].y;
|
||||
channelx = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].r;
|
||||
channely = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].i;
|
||||
// if(transmission_m==5){
|
||||
fprintf(csv_fdUL,"%e+i*(%e),",channelx,channely);
|
||||
// }
|
||||
@@ -1133,6 +1138,15 @@ int main(int argc, char **argv) {
|
||||
sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
}
|
||||
}
|
||||
if (n_frames==1)
|
||||
for (i=0; i<eNB->frame_parms.samples_per_tti; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
((short *) &ru->common.rxdata[aa][eNB->frame_parms.samples_per_tti*(subframe+1)%10])[2*i] =
|
||||
(short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
((short *) &ru->common.rxdata[aa][eNB->frame_parms.samples_per_tti*(subframe+1)%10])[2*i+1] =
|
||||
(short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
}
|
||||
}
|
||||
|
||||
if (n_frames<=10) {
|
||||
printf("rx_level Null symbol %f\n",10*log10((double)signal_energy((int *)
|
||||
@@ -1158,9 +1172,10 @@ int main(int argc, char **argv) {
|
||||
start_meas(&eNB->phy_proc_rx);
|
||||
ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? ru_fep_full_2thread : fep_full;
|
||||
ru->feprx(ru,subframe);
|
||||
if (n_frames==1) lte_eNB_I0_measurements(eNB,(subframe+1)%10,0,1);
|
||||
|
||||
phy_procedures_eNB_uespec_RX(eNB,proc_rxtx);
|
||||
stop_meas(&eNB->phy_proc_rx);
|
||||
|
||||
if (cqi_flag > 0) {
|
||||
cqi_error = 0;
|
||||
|
||||
@@ -1200,6 +1215,9 @@ int main(int argc, char **argv) {
|
||||
eNB->ulsch[0]->harq_processes[harq_pid]->uci_format,0,eNB->frame_parms.N_RB_DL);
|
||||
|
||||
dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
|
||||
dump_I0_stats(stdout,eNB);
|
||||
dump_ulsch_stats(stdout,eNB,0);
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@@ -1260,14 +1278,16 @@ int main(int argc, char **argv) {
|
||||
if (t_rx > 2000 )
|
||||
n_rx_dropped++;
|
||||
|
||||
appendVarArray(table_tx, &t_tx);
|
||||
appendVarArray(table_tx_ifft, &t_tx_ifft);
|
||||
appendVarArray(table_tx_mod, &t_tx_mod );
|
||||
appendVarArray(table_tx_enc, &t_tx_enc );
|
||||
appendVarArray(table_rx, &t_rx );
|
||||
appendVarArray(table_rx_fft, &t_rx_fft );
|
||||
appendVarArray(table_rx_demod, &t_rx_demod );
|
||||
appendVarArray(table_rx_dec, &t_rx_dec );
|
||||
if (trials < 1000) {
|
||||
appendVarArray(table_tx, &t_tx);
|
||||
appendVarArray(table_tx_ifft, &t_tx_ifft);
|
||||
appendVarArray(table_tx_mod, &t_tx_mod );
|
||||
appendVarArray(table_tx_enc, &t_tx_enc );
|
||||
appendVarArray(table_rx, &t_rx );
|
||||
appendVarArray(table_rx_fft, &t_rx_fft );
|
||||
appendVarArray(table_rx_demod, &t_rx_demod );
|
||||
appendVarArray(table_rx_dec, &t_rx_dec );
|
||||
}
|
||||
} //trials
|
||||
|
||||
// sort table
|
||||
@@ -1286,6 +1306,7 @@ int main(int argc, char **argv) {
|
||||
LOG_UDUMPMSG(SIM,dataArray(table_rx),table_rx->size,LOG_DUMP_DOUBLE,"The receiver raw data: \n");
|
||||
}
|
||||
|
||||
dump_ulsch_stats(stdout,eNB,0);
|
||||
printf("\n**********rb: %d ***mcs : %d *********SNR = %f dB (%f): TX %u dB (gain %f dB), N0W %f dB, I0 %u dB, delta_IF %d [ (%d,%d) dB / (%u,%u) dB ]**************************\n",
|
||||
nb_rb,mcs,SNR,SNR2,
|
||||
tx_lev_dB,
|
||||
|
||||
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
|
||||
double amps[8] = {0.3868472 , 0.3094778 , 0.1547389 , 0.0773694 , 0.0386847 , 0.0193424 , 0.0096712 , 0.0038685};
|
||||
double aoa=.03,ricean_factor=1; //0.0000005;
|
||||
int channel_length;
|
||||
struct complex **ch;
|
||||
struct complexd **ch;
|
||||
unsigned char pbch_pdu[6];
|
||||
int sync_pos, sync_pos_slot;
|
||||
FILE *rx_frame_file;
|
||||
@@ -170,10 +170,10 @@ int main(int argc, char **argv)
|
||||
bzero(r_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
}
|
||||
|
||||
ch = (struct complex**) malloc(4 * sizeof(struct complex*));
|
||||
ch = (struct complexd**) malloc(4 * sizeof(struct complexd*));
|
||||
|
||||
for (i = 0; i<4; i++)
|
||||
ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex));
|
||||
ch[i] = (struct complexd*) malloc(channel_length * sizeof(struct complexd));
|
||||
|
||||
generate_srs_tx(lte_frame_parms,lte_ue_common_vars->txdataF[0],AMP,0);
|
||||
generate_drs_puch(lte_frame_parms,lte_ue_common_vars->txdataF[0],AMP,0,first_rb,nb_rb);
|
||||
|
||||
@@ -37,10 +37,9 @@
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "PHY/MODULATION/modulation_eNB.h"
|
||||
#include "PHY/MODULATION/modulation_UE.h"
|
||||
#include "PHY/NR_REFSIG/nr_mod_table.h"
|
||||
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
#include "openair1/SIMULATION/TOOLS/sim.h"
|
||||
@@ -53,19 +52,23 @@
|
||||
PHY_VARS_gNB *gNB;
|
||||
PHY_VARS_NR_UE *UE;
|
||||
RAN_CONTEXT_t RC;
|
||||
UE_nr_rxtx_proc_t proc;
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
double cpuf;
|
||||
uint8_t nfapi_mode = 0;
|
||||
//uint8_t nfapi_mode = 0;
|
||||
uint16_t NB_UE_INST = 1;
|
||||
|
||||
|
||||
uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3};
|
||||
uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
||||
|
||||
// needed for some functions
|
||||
PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
|
||||
uint16_t n_rnti = 0x1234;
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
@@ -106,15 +109,17 @@ int main(int argc, char **argv)
|
||||
int ret;
|
||||
//int run_initial_sync=0;
|
||||
int loglvl = OAILOG_WARNING;
|
||||
uint8_t dlsch_threads = 0;
|
||||
float target_error_rate = 0.01;
|
||||
uint64_t SSB_positions=0x01;
|
||||
uint16_t nb_symb_sch = 12;
|
||||
uint16_t nb_rb = 50;
|
||||
uint8_t Imcs = 9;
|
||||
uint8_t mcs_table = 0;
|
||||
|
||||
double DS_TDL = .03;
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
char gNBthreads[128]="n";
|
||||
|
||||
if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
exit_fun("[NR_DLSCHSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
@@ -122,7 +127,7 @@ int main(int argc, char **argv)
|
||||
//logInit();
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt(argc, argv, "df:hpVg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:L:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "df:hpVg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:L:X:")) != -1) {
|
||||
switch (c) {
|
||||
/*case 'f':
|
||||
write_output_file = 1;
|
||||
@@ -135,9 +140,9 @@ int main(int argc, char **argv)
|
||||
|
||||
break;*/
|
||||
|
||||
/*case 'd':
|
||||
frame_type = 1;
|
||||
break;*/
|
||||
case 'd':
|
||||
dlsch_threads = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch ((char) *optarg) {
|
||||
@@ -288,6 +293,11 @@ int main(int argc, char **argv)
|
||||
nb_rb = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
strncpy(gNBthreads, optarg, sizeof(gNBthreads));
|
||||
gNBthreads[sizeof(gNBthreads)-1]=0;
|
||||
break;
|
||||
|
||||
/*case 'x':
|
||||
transmission_mode = atoi(optarg);
|
||||
break;*/
|
||||
@@ -317,6 +327,7 @@ int main(int argc, char **argv)
|
||||
//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");
|
||||
printf("-d number of dlsch threads, 0: no dlsch parallelization\n");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
@@ -328,6 +339,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (snr1set == 0)
|
||||
snr1 = snr0 + 10;
|
||||
init_dlsch_tpool(dlsch_threads);
|
||||
|
||||
if (ouput_vcd)
|
||||
vcd_signal_dumper_init("/tmp/openair_dump_nr_dlschsim.vcd");
|
||||
@@ -335,7 +347,8 @@ int main(int argc, char **argv)
|
||||
gNB2UE = new_channel_desc_scm(n_tx, n_rx, channel_model,
|
||||
61.44e6, //N_RB2sampling_rate(N_RB_DL),
|
||||
40e6, //N_RB2channel_bandwidth(N_RB_DL),
|
||||
0, 0, 0);
|
||||
DS_TDL,
|
||||
0, 0, 0, 0);
|
||||
|
||||
if (gNB2UE == NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
@@ -345,6 +358,8 @@ int main(int argc, char **argv)
|
||||
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
|
||||
gNB = RC.gNB[0];
|
||||
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
||||
initTpool(gNBthreads, gNB->threadPool, true);
|
||||
//gNB_config = &gNB->gNB_config;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
@@ -353,7 +368,7 @@ int main(int argc, char **argv)
|
||||
frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL;
|
||||
crcTableInit();
|
||||
nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell,SSB_positions);
|
||||
phy_init_nr_gNB(gNB, 0, 0);
|
||||
phy_init_nr_gNB(gNB, 0, 1); //lowmem
|
||||
//init_eNB_afterRU();
|
||||
frame_length_complex_samples = frame_parms->samples_per_subframe;
|
||||
//frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
|
||||
@@ -422,13 +437,15 @@ int main(int argc, char **argv)
|
||||
UE->dlsch_SI[0] = new_nr_ue_dlsch(1, 1, Nsoft, 5, N_RB_DL, 0);
|
||||
UE->dlsch_ra[0] = new_nr_ue_dlsch(1, 1, Nsoft, 5, N_RB_DL, 0);
|
||||
unsigned char harq_pid = 0; //dlsch->harq_ids[subframe];
|
||||
NR_gNB_DLSCH_t *dlsch = gNB->dlsch[0][0];
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_processes[harq_pid]->pdsch_pdu.pdsch_pdu_rel15;
|
||||
processingData_L1tx_t msgDataTx;
|
||||
init_DLSCH_struct(gNB, &msgDataTx);
|
||||
NR_gNB_DLSCH_t *dlsch = msgDataTx.dlsch[0][0];
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15;
|
||||
//time_stats_t *rm_stats, *te_stats, *i_stats;
|
||||
uint8_t is_crnti = 0, llr8_flag = 0;
|
||||
unsigned int TBS = 8424;
|
||||
unsigned int available_bits;
|
||||
uint8_t nb_re_dmrs = 6;
|
||||
uint8_t nb_re_dmrs = 6; // No data in dmrs symbol
|
||||
uint16_t length_dmrs = 1;
|
||||
unsigned char mod_order;
|
||||
uint16_t rate;
|
||||
@@ -442,7 +459,7 @@ int main(int argc, char **argv)
|
||||
mod_order = nr_get_Qm_dl(Imcs, mcs_table);
|
||||
rate = nr_get_code_rate_dl(Imcs, mcs_table);
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
|
||||
TBS = nr_compute_tbs(mod_order,rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, Nl);
|
||||
TBS = nr_compute_tbs(mod_order,rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, 0, Nl);
|
||||
printf("available bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
|
||||
//dlsch->harq_ids[subframe]= 0;
|
||||
rel15->rbSize = nb_rb;
|
||||
@@ -455,10 +472,10 @@ int main(int argc, char **argv)
|
||||
rel15->dmrsConfigType = NFAPI_NR_DMRS_TYPE1;
|
||||
rel15->dlDmrsSymbPos = 4;
|
||||
rel15->mcsIndex[0] = Imcs;
|
||||
rel15->numDmrsCdmGrpsNoData = 1;
|
||||
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
|
||||
short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384);
|
||||
short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384);
|
||||
double errors_bit_uncoded = 0;
|
||||
//unsigned char *estimated_output;
|
||||
unsigned char *estimated_output_bit;
|
||||
unsigned char *test_input_bit;
|
||||
@@ -475,8 +492,9 @@ int main(int argc, char **argv)
|
||||
harq_process->Qm = mod_order;
|
||||
harq_process->rvidx = rvidx;
|
||||
harq_process->R = rate;
|
||||
harq_process->dmrsConfigType = 1;
|
||||
harq_process->dmrsConfigType = NFAPI_NR_DMRS_TYPE1;
|
||||
harq_process->dlDmrsSymbPos = 4;
|
||||
harq_process->n_dmrs_cdm_groups = 1;
|
||||
printf("harq process ue mcs = %d Qm = %d, symb %d\n", harq_process->mcs, harq_process->Qm, nb_symb_sch);
|
||||
unsigned char *test_input;
|
||||
test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8);
|
||||
@@ -495,8 +513,10 @@ int main(int argc, char **argv)
|
||||
|
||||
//printf("crc32: [0]->0x%08x\n",crc24c(test_input, 32));
|
||||
// generate signal
|
||||
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32)));
|
||||
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
|
||||
if (input_fd == NULL) {
|
||||
nr_dlsch_encoding(test_input, frame, slot, dlsch, frame_parms,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
nr_dlsch_encoding(gNB, test_input, frame, slot, dlsch, frame_parms,output,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
}
|
||||
|
||||
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
|
||||
@@ -504,7 +524,6 @@ int main(int argc, char **argv)
|
||||
n_false_positive = 0;
|
||||
|
||||
for (trial = 0; trial < n_trials; trial++) {
|
||||
errors_bit_uncoded = 0;
|
||||
for (i = 0; i < available_bits; i++) {
|
||||
#ifdef DEBUG_CODER
|
||||
if ((i&0xf)==0)
|
||||
@@ -513,11 +532,12 @@ int main(int argc, char **argv)
|
||||
|
||||
//if (i<16)
|
||||
// printf("encoder output f[%d] = %d\n",i,dlsch->harq_processes[0]->f[i]);
|
||||
if (dlsch->harq_processes[0]->f[i] == 0)
|
||||
|
||||
if (output[i] == 0)
|
||||
modulated_input[i] = 1.0; ///sqrt(2); //QPSK
|
||||
else
|
||||
modulated_input[i] = -1.0; ///sqrt(2);
|
||||
|
||||
|
||||
//if (i<16) printf("modulated_input[%d] = %d\n",i,modulated_input[i]);
|
||||
//SNR =10;
|
||||
SNR_lin = pow(10, SNR / 10.0);
|
||||
@@ -535,18 +555,14 @@ int main(int argc, char **argv)
|
||||
i,modulated_input[i],
|
||||
i,channel_output_fixed[i]);
|
||||
*/
|
||||
|
||||
//Uncoded BER
|
||||
if (channel_output_fixed[i] < 0)
|
||||
channel_output_uncoded[i] = 1; //QPSK demod
|
||||
else
|
||||
channel_output_uncoded[i] = 0;
|
||||
|
||||
if (channel_output_uncoded[i] != dlsch->harq_processes[harq_pid]->f[i])
|
||||
errors_bit_uncoded = errors_bit_uncoded + 1;
|
||||
}
|
||||
|
||||
//if (errors_bit_uncoded>10)
|
||||
//printf("errors bits uncoded %f\n", errors_bit_uncoded);
|
||||
#ifdef DEBUG_CODER
|
||||
printf("\n");
|
||||
exit(-1);
|
||||
@@ -554,7 +570,7 @@ int main(int argc, char **argv)
|
||||
|
||||
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING0, VCD_FUNCTION_IN);
|
||||
|
||||
ret = nr_dlsch_decoding(UE, channel_output_fixed, &UE->frame_parms,
|
||||
ret = nr_dlsch_decoding(UE, &proc, 0, channel_output_fixed, &UE->frame_parms,
|
||||
dlsch0_ue, dlsch0_ue->harq_processes[0], frame, nb_symb_sch,
|
||||
slot,harq_pid, is_crnti, llr8_flag);
|
||||
|
||||
@@ -628,7 +644,7 @@ int main(int argc, char **argv)
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
printf("gNB %d\n", i);
|
||||
free_gNB_dlsch(&(gNB->dlsch[0][i]),N_RB_DL);
|
||||
free_gNB_dlsch(&(msgDataTx.dlsch[0][i]),N_RB_DL);
|
||||
printf("UE %d\n", i);
|
||||
free_nr_ue_dlsch(&(UE->dlsch[0][0][i]),N_RB_DL);
|
||||
}
|
||||
|
||||
+845
-271
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,37 @@
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0); }
|
||||
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
|
||||
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
|
||||
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
|
||||
//int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) { return(0); }
|
||||
//int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
|
||||
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
|
||||
|
||||
int32_t get_uldl_offset(int nr_bandP) { return(0); }
|
||||
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
|
||||
nfapi_mode_t nfapi_mod;
|
||||
nfapi_mode_t nfapi_getmode(void) {
|
||||
return nfapi_mod;
|
||||
}
|
||||
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); }
|
||||
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
|
||||
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
|
||||
fapi_nr_dci_indication_t *dci_ind,
|
||||
fapi_nr_rx_indication_t *rx_ind,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
uint8_t gNB_id) {}
|
||||
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||
uint8_t pdu_type,
|
||||
uint8_t gNB_id,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
NR_UE_DLSCH_t *dlsch0,
|
||||
NR_UE_DLSCH_t *dlsch1,
|
||||
uint16_t n_pdus) {}
|
||||
|
||||
@@ -0,0 +1,353 @@
|
||||
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0); }
|
||||
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
|
||||
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
|
||||
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
|
||||
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
|
||||
|
||||
int32_t get_uldl_offset(int nr_bandP) { return(0); }
|
||||
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
|
||||
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); }
|
||||
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
|
||||
/*
|
||||
* 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 ra_procedures.c
|
||||
* \brief Routines for UE MAC-layer Random Access procedures (TS 38.321, Release 15)
|
||||
* \author R. Knopp, Navid Nikaein, Guido Casati
|
||||
* \date 2019
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr navid.nikaein@eurecom.fr, guido.casati@iis.fraunhofer.de
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "PHY_INTERFACE/phy_interface_extern.h"
|
||||
#include "SCHED_UE/sched_UE.h"
|
||||
#include "COMMON/mac_rrc_primitives.h"
|
||||
#include "RRC/LTE/rrc_extern.h"
|
||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "OCG.h"
|
||||
#include "OCG_extern.h"
|
||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"*/
|
||||
|
||||
/* Tools */
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
|
||||
/* RRC */
|
||||
#include "NR_RACH-ConfigCommon.h"
|
||||
|
||||
/* PHY */
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
||||
|
||||
/* MAC */
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "NR_MAC_COMMON/nr_mac.h"
|
||||
#include "LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
|
||||
extern int64_t table_6_3_3_2_2_prachConfig_Index [256][9];
|
||||
extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9];
|
||||
|
||||
//extern uint8_t nfapi_mode;
|
||||
|
||||
// WIP
|
||||
// This routine implements Section 5.1.2 (UE Random Access Resource Selection)
|
||||
// and Section 5.1.3 (Random Access Preamble Transmission) from 3GPP TS 38.321
|
||||
void nr_get_prach_resources(module_id_t mod_id,
|
||||
int CC_id,
|
||||
uint8_t gNB_id,
|
||||
uint8_t t_id,
|
||||
NR_PRACH_RESOURCES_t *prach_resources,
|
||||
NR_RACH_ConfigDedicated_t * rach_ConfigDedicated){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon;
|
||||
// NR_BeamFailureRecoveryConfig_t *beam_failure_recovery_config = &mac->RA_BeamFailureRecoveryConfig; // todo
|
||||
|
||||
int messagePowerOffsetGroupB = 0, messageSizeGroupA, PLThreshold, sizeOfRA_PreamblesGroupA, numberOfRA_Preambles, i, deltaPreamble_Msg3 = 0;
|
||||
uint8_t noGroupB = 0, s_id, f_id, ul_carrier_id, msg1_FDM, prach_ConfigIndex, SFN_nbr, Msg3_size;
|
||||
|
||||
// NR_RSRP_Range_t rsrp_ThresholdSSB; // todo
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
//////////* UE Random Access Resource Selection *//////////
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// todo:
|
||||
// - switch initialisation cases
|
||||
// -- RA initiated by beam failure recovery operation (subclause 5.17 TS 38.321)
|
||||
// --- SSB selection, set prach_resources->ra_PreambleIndex
|
||||
// -- RA initiated by PDCCH: ra_preamble_index provided by PDCCH && ra_PreambleIndex != 0b000000
|
||||
// --- set PREAMBLE_INDEX to ra_preamble_index
|
||||
// --- select the SSB signalled by PDCCH
|
||||
// -- RA initiated for SI request:
|
||||
// --- SSB selection, set prach_resources->ra_PreambleIndex
|
||||
|
||||
// if (rach_ConfigDedicated) { // This is for network controlled Mobility
|
||||
// // operation for contention-free RA resources when:
|
||||
// // - available SSB with SS-RSRP above rsrp-ThresholdSSB: SSB selection
|
||||
// // - availalbe CSI-RS with CSI-RSRP above rsrp-ThresholdCSI-RS: CSI-RS selection
|
||||
// prach_resources->ra_PreambleIndex = rach_ConfigDedicated->ra_PreambleIndex;
|
||||
// return;
|
||||
// }
|
||||
|
||||
//////////* Contention-based RA preamble selection *//////////
|
||||
// todo:
|
||||
// - selection of SSB with SS-RSRP above rsrp-ThresholdSSB else select any SSB
|
||||
// - todo determine next available PRACH occasion
|
||||
|
||||
// rsrp_ThresholdSSB = *nr_rach_ConfigCommon->rsrp_ThresholdSSB;
|
||||
|
||||
AssertFatal(mac->nr_rach_ConfigCommon != NULL, "[UE %d] FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id);
|
||||
|
||||
nr_rach_ConfigCommon = mac->nr_rach_ConfigCommon;
|
||||
|
||||
Msg3_size = mac->RA_Msg3_size;
|
||||
numberOfRA_Preambles = *nr_rach_ConfigCommon->totalNumberOfRA_Preambles;
|
||||
|
||||
if (!nr_rach_ConfigCommon->groupBconfigured) {
|
||||
noGroupB = 1;
|
||||
} else {
|
||||
// RA preambles group B is configured
|
||||
// - Defining the number of RA preambles in RA Preamble Group A for each SSB */
|
||||
sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA;
|
||||
switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){
|
||||
/* - Threshold to determine the groups of RA preambles */
|
||||
case 0:
|
||||
messageSizeGroupA = 56;
|
||||
break;
|
||||
case 1:
|
||||
messageSizeGroupA = 144;
|
||||
break;
|
||||
case 2:
|
||||
messageSizeGroupA = 208;
|
||||
break;
|
||||
case 3:
|
||||
messageSizeGroupA = 256;
|
||||
break;
|
||||
case 4:
|
||||
messageSizeGroupA = 282;
|
||||
break;
|
||||
case 5:
|
||||
messageSizeGroupA = 480;
|
||||
break;
|
||||
case 6:
|
||||
messageSizeGroupA = 640;
|
||||
break;
|
||||
case 7:
|
||||
messageSizeGroupA = 800;
|
||||
break;
|
||||
case 8:
|
||||
messageSizeGroupA = 1000;
|
||||
break;
|
||||
case 9:
|
||||
messageSizeGroupA = 72;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0,"Unknown ra_Msg3SizeGroupA %lu\n", nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA);
|
||||
/* todo cases 10 -15*/
|
||||
}
|
||||
|
||||
/* Power offset for preamble selection in dB */
|
||||
messagePowerOffsetGroupB = -9999;
|
||||
switch (nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB){
|
||||
case 0:
|
||||
messagePowerOffsetGroupB = -9999;
|
||||
break;
|
||||
case 1:
|
||||
messagePowerOffsetGroupB = 0;
|
||||
break;
|
||||
case 2:
|
||||
messagePowerOffsetGroupB = 5;
|
||||
break;
|
||||
case 3:
|
||||
messagePowerOffsetGroupB = 8;
|
||||
break;
|
||||
case 4:
|
||||
messagePowerOffsetGroupB = 10;
|
||||
break;
|
||||
case 5:
|
||||
messagePowerOffsetGroupB = 12;
|
||||
break;
|
||||
case 6:
|
||||
messagePowerOffsetGroupB = 15;
|
||||
break;
|
||||
case 7:
|
||||
messagePowerOffsetGroupB = 18;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PLThreshold = prach_resources->RA_PCMAX - nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB;
|
||||
|
||||
/* Msg3 has not been transmitted yet */
|
||||
if (first_Msg3 == 1) {
|
||||
if (noGroupB == 1) {
|
||||
// use Group A preamble
|
||||
prach_resources->ra_PreambleIndex = (taus()) % numberOfRA_Preambles;
|
||||
mac->RA_usedGroupA = 1;
|
||||
} else if ((Msg3_size < messageSizeGroupA) && (get_nr_PL(mod_id, CC_id, gNB_id) > PLThreshold)) {
|
||||
// Group B is configured and RA preamble Group A is used
|
||||
// - todo add condition on CCCH_sdu_size for initiation by CCCH
|
||||
prach_resources->ra_PreambleIndex = (taus()) % sizeOfRA_PreamblesGroupA;
|
||||
mac->RA_usedGroupA = 1;
|
||||
} else {
|
||||
// Group B preamble is configured and used
|
||||
// the first sizeOfRA_PreamblesGroupA RA preambles belong to RA Preambles Group A
|
||||
// the remaining belong to RA Preambles Group B
|
||||
prach_resources->ra_PreambleIndex = sizeOfRA_PreamblesGroupA + (taus()) % (numberOfRA_Preambles - sizeOfRA_PreamblesGroupA);
|
||||
mac->RA_usedGroupA = 0;
|
||||
}
|
||||
} else { // Msg3 is being retransmitted
|
||||
if (mac->RA_usedGroupA == 1 && noGroupB == 1) {
|
||||
prach_resources->ra_PreambleIndex = (taus()) % numberOfRA_Preambles;
|
||||
} else if (mac->RA_usedGroupA == 1 && noGroupB == 0){
|
||||
prach_resources->ra_PreambleIndex = (taus()) % sizeOfRA_PreamblesGroupA;
|
||||
} else {
|
||||
prach_resources->ra_PreambleIndex = sizeOfRA_PreamblesGroupA + (taus()) % (numberOfRA_Preambles - sizeOfRA_PreamblesGroupA);
|
||||
}
|
||||
}
|
||||
|
||||
// todo determine next available PRACH occasion
|
||||
// - if RA initiated for SI request and ra_AssociationPeriodIndex and si-RequestPeriod are configured
|
||||
// - else if SSB is selected above
|
||||
// - else if CSI-RS is selected above
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//////////* Random Access Preamble Transmission (5.1.3 TS 38.321) *//////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// todo:
|
||||
// - condition on notification of suspending power ramping counter from lower layer (5.1.3 TS 38.321)
|
||||
// - check if SSB or CSI-RS have not changed since the selection in the last RA Preamble tranmission
|
||||
// - Extend RA_rnti computation (e.g. f_id selection, ul_carrier_id are hardcoded)
|
||||
|
||||
if (mac->RA_PREAMBLE_TRANSMISSION_COUNTER > 1)
|
||||
mac->RA_PREAMBLE_TRANSMISSION_COUNTER++;
|
||||
|
||||
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = nr_get_Po_NOMINAL_PUSCH(prach_resources, mod_id, CC_id);
|
||||
|
||||
// RA-RNTI computation (associated to PRACH occasion in which the RA Preamble is transmitted)
|
||||
// 1) this does not apply to contention-free RA Preamble for beam failure recovery request
|
||||
// 2) getting star_symb, SFN_nbr from table 6.3.3.2-3 (TDD and FR1 scenario)
|
||||
|
||||
switch (nr_rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM){ // todo this is not used
|
||||
case 0:
|
||||
msg1_FDM = 1;
|
||||
break;
|
||||
case 1:
|
||||
msg1_FDM = 2;
|
||||
break;
|
||||
case 2:
|
||||
msg1_FDM = 4;
|
||||
break;
|
||||
case 3:
|
||||
msg1_FDM = 8;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0,"Unknown msg1_FDM %lu\n", nr_rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM);
|
||||
}
|
||||
|
||||
prach_ConfigIndex = nr_rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex;
|
||||
|
||||
// ra_RNTI computation
|
||||
// - todo: this is for TDD FR1 only
|
||||
// - ul_carrier_id: UL carrier used for RA preamble transmission, hardcoded for NUL carrier
|
||||
// - f_id: index of the PRACH occasion in the frequency domain
|
||||
// - s_id is starting symbol of the PRACH occasion [0...14]
|
||||
// - t_id is the first slot of the PRACH occasion in a system frame [0...80]
|
||||
|
||||
ul_carrier_id = 0; // NUL
|
||||
f_id = nr_rach_ConfigCommon->rach_ConfigGeneric.msg1_FrequencyStart;
|
||||
SFN_nbr = table_6_3_3_2_3_prachConfig_Index[prach_ConfigIndex][4];
|
||||
s_id = table_6_3_3_2_3_prachConfig_Index[prach_ConfigIndex][5];
|
||||
|
||||
// Pick the first slot of the PRACH occasion in a system frame
|
||||
for (i = 0; i < 10; i++){
|
||||
if (((SFN_nbr & (1 << i)) >> i) == 1){
|
||||
t_id = 2*i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
prach_resources->ra_RNTI = 1 + s_id + 14 * t_id + 1120 * f_id + 8960 * ul_carrier_id;
|
||||
mac->ra_rnti = prach_resources->ra_RNTI;
|
||||
|
||||
LOG_D(MAC, "Computed ra_RNTI is %d", prach_resources->ra_RNTI);
|
||||
}
|
||||
|
||||
// TbD: RA_attempt_number not used
|
||||
void nr_Msg1_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint8_t gNB_id){
|
||||
AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
mac->ra_state = WAIT_RAR;
|
||||
// Start contention resolution timer
|
||||
mac->RA_attempt_number++;
|
||||
}
|
||||
|
||||
void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, slot_t slotP, uint8_t gNB_id){
|
||||
AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
|
||||
LOG_D(MAC,"[UE %d][RAPROC] Frame %d : Msg3_tx: Starting contention resolution timer\n", mod_id, frameP);
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
// start contention resolution timer
|
||||
mac->RA_contention_resolution_cnt = 0;
|
||||
mac->RA_contention_resolution_timer_active = 1;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
///////* Random Access Preamble Initialization (5.1.1 TS 38.321) *///////
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
/// Handling inizialization by PDCCH order, MAC entity or RRC (TS 38.300)
|
||||
/// Only one RA procedure is ongoing at any point in time in a MAC entity
|
||||
/// the RA procedure on a SCell shall only be initiated by PDCCH order
|
||||
|
||||
// WIP
|
||||
// todo TS 38.321:
|
||||
// - check if carrier to use is explicitly signalled then do (1) RA CARRIER SELECTION (SUL, NUL) (2) set PCMAX
|
||||
// - BWP operation (subclause 5.15 TS 38.321)
|
||||
// - handle initialization by beam failure recovery
|
||||
// - handle initialization by handover
|
||||
// - handle transmission on DCCH using PRACH (during handover, or sending SR for example)
|
||||
// - take into account MAC CEs in size_sdu (currently hardcoded size to 1 MAC subPDU and 1 padding subheader)
|
||||
// - fix rrc data req logic
|
||||
// - retrieve TBS
|
||||
// - add mac_rrc_nr_data_req_ue, etc ...
|
||||
// - add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
|
||||
|
||||
|
||||
@@ -55,172 +55,19 @@ signed char quantize(double D, double x, unsigned char B) {
|
||||
return ((char) qxd);
|
||||
}
|
||||
|
||||
void fill_scc(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_RB_DL,int N_RB_UL,int mu_dl,int mu_ul) {
|
||||
|
||||
*scc->physCellId=0; \
|
||||
// *scc->n_TimingAdvanceOffset=NR_ServingCellConfigCommon__n_TimingAdvanceOffset_n0;
|
||||
*scc->ssb_periodicityServingCell=NR_ServingCellConfigCommon__ssb_periodicityServingCell_ms20;
|
||||
scc->dmrs_TypeA_Position=NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2;
|
||||
*scc->ssbSubcarrierSpacing=NR_SubcarrierSpacing_kHz30;
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB=641032;
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]=78;
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA=640000;
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier=0;
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing=NR_SubcarrierSpacing_kHz30;
|
||||
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth=N_RB_DL;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth=13036;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing=mu_dl;//NR_SubcarrierSpacing_kHz30;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero=12;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero=0;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[0]->k0=0;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[0]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[0]->startSymbolAndLength=40;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[1]->k0=0;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[1]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[1]->startSymbolAndLength=53;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[2]->k0=0;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[2]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[2]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[3]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[3]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[3]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[4]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[4]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[4]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[5]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[5]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[5]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[6]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[6]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[6]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[7]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[7]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[7]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[8]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[8]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[8]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[9]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[9]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[9]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[10]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[10]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[10]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[11]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[11]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[11]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[12]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[12]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[12]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[13]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[13]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[13]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[14]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[14]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[14]->startSymbolAndLength=54;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[15]->k0=-1;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[15]->mappingType=NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[15]->startSymbolAndLength=54;
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]=78;
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA=-1;
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier=0;
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing=NR_SubcarrierSpacing_kHz30;
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth=N_RB_UL;
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->p_Max=20;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth=13036;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing=mu_ul;//NR_SubcarrierSpacing_kHz30;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex=98;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM=NR_RACH_ConfigGeneric__msg1_FDM_one;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart=0;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig=13;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.preambleReceivedTargetPower=-118;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.preambleTransMax=NR_RACH_ConfigGeneric__preambleTransMax_n10;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.powerRampingStep=NR_RACH_ConfigGeneric__powerRampingStep_dB2;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.ra_ResponseWindow=NR_RACH_ConfigGeneric__ra_ResponseWindow_sl20;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present=NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one=NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n64;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ra_ContentionResolutionTimer=NR_RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rsrp_ThresholdSSB=19;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present=NR_RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139=0;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig=NR_RACH_ConfigCommon__restrictedSetConfig_unrestrictedSet;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->k2=2;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->k2=2;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->startSymbolAndLength=69;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->k2=2;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[3]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[3]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[3]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[4]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[4]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[4]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[5]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[5]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[5]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[6]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[6]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[6]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[7]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[7]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[7]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[8]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[8]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[8]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[9]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[9]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[9]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[10]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[10]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[10]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[11]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[11]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[11]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[12]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[12]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[12]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[13]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[13]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[13]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[14]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[14]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[14]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[15]->k2=33;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[15]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[15]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble=1;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->p0_NominalWithGrant=-90;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_GroupHopping=NR_PUCCH_ConfigCommon__pucch_GroupHopping_neither;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->hoppingId=40;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal=-90;
|
||||
scc->ssb_PositionsInBurst->present=NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap;
|
||||
*ssb_bitmap=0xff;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing=NR_SubcarrierSpacing_kHz30;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity=NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots=7;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols=6;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots=2;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols=4;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity=321;
|
||||
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots=-1;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSymbols=-1;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofUplinkSlots=-1;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofUplinkSymbols=-1;
|
||||
scc->ss_PBCH_BlockPower=20;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing=-1;
|
||||
}
|
||||
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {return(0);}
|
||||
//NR_IF_Module_t *NR_IF_Module_init(int Mod_id){return(NULL);}
|
||||
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
|
||||
|
||||
void fill_scc_sim(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_RB_DL,int N_RB_UL,int mu_dl,int mu_ul);
|
||||
void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap);
|
||||
void prepare_scc(NR_ServingCellConfigCommon_t *scc);
|
||||
s1ap_eNB_config_t s1ap_config;
|
||||
uint32_t s1ap_generate_eNB_id(void) {return 0;}
|
||||
void prepare_scd(NR_ServingCellConfig_t *scd);
|
||||
ngap_gNB_config_t ngap_config;
|
||||
uint32_t ngap_generate_gNB_id(void) {return 0;}
|
||||
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) { return;}
|
||||
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) { return;}
|
||||
|
||||
void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) { return;}
|
||||
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) { return;}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,16 +28,17 @@
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "PHY/types.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
||||
#include "PHY/NR_REFSIG/nr_mod_table.h"
|
||||
#include "PHY/MODULATION/modulation_eNB.h"
|
||||
#include "PHY/MODULATION/modulation_UE.h"
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
||||
#include "PHY/phy_vars.h"
|
||||
@@ -46,7 +47,8 @@
|
||||
#include "openair1/SIMULATION/RF/rf.h"
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||
|
||||
#include "openair1/PHY/MODULATION/nr_modulation.h"
|
||||
#include <executables/softmodem-common.h>
|
||||
//#define DEBUG_NR_PBCHSIM
|
||||
|
||||
PHY_VARS_gNB *gNB;
|
||||
@@ -55,12 +57,44 @@ RAN_CONTEXT_t RC;
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
double cpuf;
|
||||
uint8_t nfapi_mode = 0;
|
||||
//uint8_t nfapi_mode = 0;
|
||||
uint16_t NB_UE_INST = 1;
|
||||
|
||||
// needed for some functions
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
|
||||
uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3};
|
||||
uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
||||
|
||||
uint64_t get_softmodem_optmask(void) {return 0;}
|
||||
softmodem_params_t *get_softmodem_params(void) {return 0;}
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int n_ss) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int eNB_id, PDSCH_t pdsch,
|
||||
NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int gNB_id,
|
||||
PDSCH_t pdsch,
|
||||
NR_UE_DLSCH_t *dlsch0,
|
||||
NR_UE_DLSCH_t *dlsch1,
|
||||
int *dlsch_errors,
|
||||
uint8_t dlsch_parallel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
int N_RB_DL,
|
||||
@@ -94,22 +128,27 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
//gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED;
|
||||
|
||||
gNB->mac_enabled = 1;
|
||||
fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
|
||||
fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
|
||||
fp->dl_CarrierFreq = 3600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
|
||||
fp->ul_CarrierFreq = 3600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
|
||||
if (mu>2) fp->nr_band = 257;
|
||||
else fp->nr_band = 78;
|
||||
fp->threequarter_fs= 0;
|
||||
|
||||
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
|
||||
|
||||
fp->ofdm_offset_divisor = UINT_MAX;
|
||||
nr_init_frame_parms(gNB_config, fp);
|
||||
init_timeshift_rotation(fp);
|
||||
|
||||
init_symbol_rotation(fp);
|
||||
|
||||
gNB->configured = 1;
|
||||
LOG_I(PHY,"gNB configured\n");
|
||||
}
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
int i,aa;//,l;
|
||||
int i,aa,start_symbol;
|
||||
double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0;
|
||||
double cfo=0;
|
||||
uint8_t snr1set=0;
|
||||
@@ -395,6 +434,7 @@ int main(int argc, char **argv)
|
||||
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
|
||||
gNB = RC.gNB[0];
|
||||
gNB->ofdm_offset_divisor = UINT_MAX;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
frame_parms->nb_antennas_rx = n_rx;
|
||||
@@ -404,41 +444,40 @@ int main(int argc, char **argv)
|
||||
frame_parms->ssb_type = nr_ssb_type_C;
|
||||
|
||||
nr_phy_config_request_sim_pbchsim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
||||
phy_init_nr_gNB(gNB,0,0);
|
||||
phy_init_nr_gNB(gNB,0,1);
|
||||
nr_set_ssb_first_subcarrier(&gNB->gNB_config,frame_parms);
|
||||
|
||||
uint8_t n_hf = 0;
|
||||
int cyclic_prefix_type = NFAPI_CP_NORMAL;
|
||||
|
||||
double fs, eps;
|
||||
double fs=0, eps;
|
||||
double scs = 30000;
|
||||
double bw = 100e6;
|
||||
|
||||
switch (mu) {
|
||||
case 1:
|
||||
scs = 30000;
|
||||
if (N_RB_DL == 217) {
|
||||
fs = 122.88e6;
|
||||
bw = 80e6;
|
||||
|
||||
}
|
||||
else if (N_RB_DL == 245) {
|
||||
fs = 122.88e6;
|
||||
bw = 90e6;
|
||||
}
|
||||
else if (N_RB_DL == 273) {
|
||||
fs = 122.88e6;
|
||||
bw = 100e6;
|
||||
}
|
||||
else if (N_RB_DL == 106) {
|
||||
fs = 61.44e6;
|
||||
bw = 40e6;
|
||||
}
|
||||
else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL);
|
||||
break;
|
||||
|
||||
|
||||
scs = 30000;
|
||||
frame_parms->Lmax = 8;
|
||||
if (N_RB_DL == 217) {
|
||||
fs = 122.88e6;
|
||||
bw = 80e6;
|
||||
}
|
||||
else if (N_RB_DL == 245) {
|
||||
fs = 122.88e6;
|
||||
bw = 90e6;
|
||||
}
|
||||
else if (N_RB_DL == 273) {
|
||||
fs = 122.88e6;
|
||||
bw = 100e6;
|
||||
}
|
||||
else if (N_RB_DL == 106) {
|
||||
fs = 61.44e6;
|
||||
bw = 40e6;
|
||||
}
|
||||
else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL);
|
||||
break;
|
||||
case 3:
|
||||
frame_parms->Lmax = 64;
|
||||
scs = 120000;
|
||||
if (N_RB_DL == 66) {
|
||||
fs = 122.88e6;
|
||||
@@ -447,6 +486,7 @@ int main(int argc, char **argv)
|
||||
else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL);
|
||||
break;
|
||||
}
|
||||
|
||||
// cfo with respect to sub-carrier spacing
|
||||
eps = cfo/scs;
|
||||
|
||||
@@ -466,9 +506,10 @@ int main(int argc, char **argv)
|
||||
channel_model,
|
||||
fs,
|
||||
bw,
|
||||
300e-9,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (gNB2UE==NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
@@ -499,7 +540,6 @@ int main(int argc, char **argv)
|
||||
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
|
||||
txdata[i] = malloc(frame_length_complex_samples*sizeof(int));
|
||||
bzero(r_re[i],frame_length_complex_samples*sizeof(int));
|
||||
|
||||
}
|
||||
|
||||
if (pbch_file_fd!=NULL) {
|
||||
@@ -525,35 +565,69 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
nr_gold_pbch(UE);
|
||||
|
||||
processingData_L1tx_t msgDataTx;
|
||||
// generate signal
|
||||
if (input_fd==NULL) {
|
||||
gNB->pbch_configured = 1;
|
||||
|
||||
gNB->ssb_pdu.ssb_pdu_rel15.bchPayload = 0;
|
||||
|
||||
for (int slot=0;slot<frame_parms->slots_per_frame;slot++) {
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++)
|
||||
memset(gNB->common_vars.txdataF[aa],0,frame_parms->samples_per_slot_wCP*sizeof(int32_t));
|
||||
|
||||
nr_common_signal_procedures (gNB,frame,slot);
|
||||
for (i=0; i<frame_parms->Lmax; i++) {
|
||||
if((SSB_positions >> i) & 0x01) {
|
||||
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (cyclic_prefix_type == 1) {
|
||||
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
} else {
|
||||
nr_normal_prefix_mod(gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
14,
|
||||
frame_parms);
|
||||
}
|
||||
}
|
||||
msgDataTx.ssb[i].ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33;
|
||||
msgDataTx.ssb[i].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = i;
|
||||
|
||||
start_symbol = nr_get_ssb_start_symbol(frame_parms,i);
|
||||
int slot = start_symbol/14;
|
||||
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++)
|
||||
memset(gNB->common_vars.txdataF[aa],0,frame_parms->samples_per_slot_wCP*sizeof(int32_t));
|
||||
|
||||
nr_common_signal_procedures (gNB,frame,slot,msgDataTx.ssb[i].ssb_pdu);
|
||||
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (cyclic_prefix_type == 1) {
|
||||
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
} else {
|
||||
/*nr_normal_prefix_mod(gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
14,
|
||||
frame_parms);*/
|
||||
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
||||
(int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
1,
|
||||
frame_parms->nb_prefix_samples0,
|
||||
CYCLIC_PREFIX);
|
||||
|
||||
apply_nr_rotation(frame_parms,
|
||||
(int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
slot,
|
||||
0,
|
||||
1,
|
||||
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples0);
|
||||
|
||||
PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size],
|
||||
(int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
13,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
|
||||
apply_nr_rotation(frame_parms,
|
||||
(int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size],
|
||||
slot,
|
||||
1,
|
||||
13,
|
||||
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],frame_length_complex_samples_no_prefix,1,1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[1],frame_length_complex_samples_no_prefix,1,1);
|
||||
@@ -562,9 +636,9 @@ int main(int argc, char **argv)
|
||||
printf("Reading %d samples from file to antenna buffer %d\n",frame_length_complex_samples,0);
|
||||
UE->UE_fo_compensation = 1; // perform fo compensation when samples from file are used
|
||||
if (fread(txdata[0],
|
||||
sizeof(int32_t),
|
||||
frame_length_complex_samples,
|
||||
input_fd) != frame_length_complex_samples) {
|
||||
sizeof(int32_t),
|
||||
frame_length_complex_samples,
|
||||
input_fd) != frame_length_complex_samples) {
|
||||
printf("error reading from file\n");
|
||||
//exit(-1);
|
||||
}
|
||||
@@ -639,38 +713,35 @@ int main(int argc, char **argv)
|
||||
}
|
||||
if (UE->is_synchronized == 0) {
|
||||
UE_nr_rxtx_proc_t proc={0};
|
||||
ret = nr_initial_sync(&proc, UE, normal_txrx,1);
|
||||
ret = nr_initial_sync(&proc, UE, 1, 0, 0);
|
||||
printf("nr_initial_sync1 returns %d\n",ret);
|
||||
if (ret<0) n_errors++;
|
||||
}
|
||||
else {
|
||||
UE_nr_rxtx_proc_t proc={0};
|
||||
UE->rx_offset=0;
|
||||
uint8_t ssb_index = 0;
|
||||
while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb
|
||||
frame_parms->ssb_index = ssb_index;
|
||||
UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms);
|
||||
UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index);
|
||||
|
||||
int ssb_slot = (ssb_index>>1)+(n_hf*frame_parms->slots_per_frame);
|
||||
int ssb_slot = (UE->symbol_offset/14)+(n_hf*(frame_parms->slots_per_frame>>1));
|
||||
for (int i=UE->symbol_offset+1; i<UE->symbol_offset+4; i++) {
|
||||
nr_slot_fep(UE,
|
||||
i%frame_parms->symbols_per_slot,
|
||||
ssb_slot,
|
||||
0,
|
||||
0);
|
||||
nr_slot_fep(UE,
|
||||
&proc,
|
||||
i%frame_parms->symbols_per_slot,
|
||||
ssb_slot);
|
||||
|
||||
nr_pbch_channel_estimation(UE,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
|
||||
nr_pbch_channel_estimation(UE,&proc,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
|
||||
|
||||
}
|
||||
UE_nr_rxtx_proc_t proc={0};
|
||||
|
||||
ret = nr_rx_pbch(UE,
|
||||
&proc,
|
||||
UE->pbch_vars[0],
|
||||
frame_parms,
|
||||
0,
|
||||
ssb_index%8,
|
||||
SISO,
|
||||
UE->high_speed_flag);
|
||||
&proc,
|
||||
UE->pbch_vars[0],
|
||||
frame_parms,
|
||||
0,
|
||||
ssb_index%8,
|
||||
SISO);
|
||||
|
||||
if (ret==0) {
|
||||
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically
|
||||
@@ -681,9 +752,9 @@ int main(int argc, char **argv)
|
||||
|
||||
payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte);
|
||||
for (i=0;i<3;i++){
|
||||
payload_ret += (UE->pbch_vars[0]->decoded_output[i] == (gNB->ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)));
|
||||
payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((msgDataTx.ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff));
|
||||
}
|
||||
//printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->rx_ind.rx_indication_body->mib_pdu.additional_bits);
|
||||
//printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte);
|
||||
//printf("ret %d\n", payload_ret);
|
||||
if (payload_ret!=4)
|
||||
n_errors_payload++;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,11 +33,11 @@
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
||||
#include "PHY/NR_REFSIG/nr_mod_table.h"
|
||||
#include "PHY/MODULATION/modulation_eNB.h"
|
||||
#include "PHY/MODULATION/modulation_UE.h"
|
||||
#include "PHY/NR_ESTIMATION/nr_ul_estimation.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/pucch_nr.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||
|
||||
|
||||
PHY_VARS_gNB *gNB;
|
||||
PHY_VARS_NR_UE *UE;
|
||||
RAN_CONTEXT_t RC;
|
||||
@@ -53,20 +54,24 @@ openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
double cpuf;
|
||||
uint8_t nfapi_mode = 0;
|
||||
//uint8_t nfapi_mode = 0;
|
||||
uint16_t NB_UE_INST = 1;
|
||||
uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3};
|
||||
uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
||||
|
||||
// needed for some functions
|
||||
PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}};
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
int i,aa=0;//,l;
|
||||
int i;//,l;
|
||||
double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0;
|
||||
double cfo=0;
|
||||
uint8_t snr1set=0;
|
||||
int **txdata;
|
||||
int **txdataF,**rxdataF;
|
||||
double **s_re,**s_im,**r_re,**r_im;
|
||||
//int sync_pos, sync_pos_slot;
|
||||
//FILE *rx_frame_file;
|
||||
@@ -76,34 +81,40 @@ int main(int argc, char **argv)
|
||||
//int freq_offset;
|
||||
//int subframe_offset;
|
||||
//char fname[40], vname[40];
|
||||
int trial,n_trials=100,n_errors=0,ack_nack_errors=0;
|
||||
int trial,n_trials=100,n_errors=0,ack_nack_errors=0,sr_errors=0;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint16_t Nid_cell=0;
|
||||
uint64_t SSB_positions=0x01;
|
||||
channel_desc_t *gNB2UE;
|
||||
channel_desc_t *UE2gNB;
|
||||
int format=0;
|
||||
//uint8_t extended_prefix_flag=0;
|
||||
FILE *input_fd=NULL;
|
||||
uint8_t nacktoack_flag=0;
|
||||
//uint8_t nacktoack_flag=0;
|
||||
int16_t amp=0x7FFF;
|
||||
int nr_tti_tx=0;
|
||||
uint64_t actual_payload=0,payload_received;//payload bits b7b6...b2b1b0 where b7..b3=0 b2b1=HARQ b0 is SR. payload maximum value is 7 for pucch format 0
|
||||
int nr_slot_tx=0;
|
||||
int nr_frame_tx=0;
|
||||
uint64_t actual_payload=0,payload_received;
|
||||
int nr_bit=1; // maximum value possible is 2
|
||||
uint8_t m0=0;// higher layer paramater initial cyclic shift
|
||||
uint8_t nrofSymbols=1; //number of OFDM symbols can be 1-2 for format 1
|
||||
uint8_t startingSymbolIndex=0; // resource allocated see 9.2.1, 38.213 for more info.should be actually present in the resource set provided
|
||||
uint16_t startingPRB=0,startingPRB_intraSlotHopping=0; //PRB number not sure see 9.2.1, 38.213 for more info. Should be actually present in the resource set provided
|
||||
uint16_t nrofPRB=2;
|
||||
uint8_t timeDomainOCC=0;
|
||||
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||
|
||||
|
||||
double DS_TDL = .03;
|
||||
|
||||
double delay_us = 0;
|
||||
int N_RB_DL=273,mu=1;
|
||||
float target_error_rate=0.01;
|
||||
float target_error_rate=0.001;
|
||||
int frame_length_complex_samples;
|
||||
//int frame_length_complex_samples_no_prefix;
|
||||
NR_DL_FRAME_PARMS *frame_parms;
|
||||
//unsigned char frame_type = 0;
|
||||
int loglvl=OAILOG_WARNING;
|
||||
|
||||
int sr_flag = 0;
|
||||
int pucch_DTX_thres = 50;
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
@@ -112,9 +123,8 @@ int main(int argc, char **argv)
|
||||
|
||||
randominit(0);
|
||||
logInit();
|
||||
set_glog(loglvl);
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:f:g:i:P:b:T:n:o:s:S:x:y:z:N:F:GR:IL")) != -1) {
|
||||
while ((c = getopt (argc, argv, "f:hA:f:g:i:I:P:B:b:t:T:m:n:r:o:s:S:x:y:z:N:F:GR:IL:q:cd:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
//write_output_file=1;
|
||||
@@ -157,6 +167,20 @@ int main(int argc, char **argv)
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
case 'H':
|
||||
channel_model = TDL_C;
|
||||
DS_TDL = .030; // 30 ns
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
channel_model = TDL_C;
|
||||
DS_TDL = .3; // 300ns
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
channel_model=TDL_D;
|
||||
DS_TDL = .03;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unsupported channel model!\n");
|
||||
@@ -184,11 +208,11 @@ int main(int argc, char **argv)
|
||||
printf("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
/*
|
||||
|
||||
case 't':
|
||||
Td= atof(optarg);
|
||||
pucch_DTX_thres= atoi(optarg);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
@@ -205,6 +229,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case 'd':
|
||||
delay_us=atof(optarg);
|
||||
break;
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
@@ -228,7 +255,7 @@ int main(int argc, char **argv)
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
if ((n_rx==0) || (n_rx>8)) {
|
||||
printf("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
@@ -257,14 +284,32 @@ int main(int argc, char **argv)
|
||||
case 'i':
|
||||
nrofSymbols=(uint8_t)atoi(optarg);
|
||||
break;
|
||||
case 'I':
|
||||
startingSymbolIndex=(uint8_t)atoi(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
startingPRB=atoi(optarg);
|
||||
break;
|
||||
case 'q':
|
||||
nrofPRB=atoi(optarg);
|
||||
break;
|
||||
case 'P':
|
||||
format=atoi(optarg);
|
||||
break;
|
||||
case 'm':
|
||||
m0=atoi(optarg);
|
||||
break;
|
||||
case 'b':
|
||||
nr_bit=atoi(optarg);
|
||||
break;
|
||||
case 'c':
|
||||
sr_flag=1;
|
||||
break;
|
||||
case 'B':
|
||||
actual_payload=atoi(optarg);
|
||||
break;
|
||||
case 'T':
|
||||
nacktoack_flag=(uint8_t)atoi(optarg);
|
||||
//nacktoack_flag=(uint8_t)atoi(optarg);
|
||||
target_error_rate=0.001;
|
||||
break;
|
||||
default:
|
||||
@@ -292,23 +337,46 @@ int main(int argc, char **argv)
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
printf("-i Enter number of ofdm symbols for pucch\n");
|
||||
printf("-I Starting symbol index for pucch\n");
|
||||
printf("-r PUCCH starting PRB\n");
|
||||
printf("-q PUCCH number of PRB\n");
|
||||
printf("-P Enter the format of PUCCH\n");
|
||||
printf("-b number of HARQ bits (1-2)\n");
|
||||
printf("-B payload to be transmitted on PUCCH\n");
|
||||
printf("-m initial cyclic shift m0\n");
|
||||
printf("-T to check nacktoack miss for format 1");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
double phase = (1<<mu)*30e-3*delay_us;
|
||||
|
||||
set_glog(loglvl);
|
||||
|
||||
if (snr1set==0) snr1 = snr0+10;
|
||||
|
||||
printf("Initializing gNodeB for mu %d, N_RB_DL %d\n",mu,N_RB_DL);
|
||||
printf("Initializing gNodeB for mu %d, N_RB_DL %d, n_rx %d\n",mu,N_RB_DL,n_rx);
|
||||
|
||||
if((format!=0) && (format!=1) && (format!=2)){
|
||||
printf("PUCCH format %d not supported\n",format);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
AssertFatal(((format < 2)&&(nr_bit<3)&&(actual_payload<5)) ||
|
||||
((format == 2)&&(nr_bit>2)&&(nr_bit<65)),"illegal combination format %d, nr_bit %d\n",
|
||||
format,nr_bit);
|
||||
int do_DTX=0;
|
||||
if ((format < 2) && (actual_payload == 4)) do_DTX=1;
|
||||
|
||||
actual_payload &= ((1<<nr_bit)-1);
|
||||
|
||||
printf("Transmitted payload is %ld, do_DTX = %d\n",actual_payload,do_DTX);
|
||||
|
||||
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
|
||||
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
|
||||
gNB = RC.gNB[0];
|
||||
|
||||
gNB->pucch0_thres = pucch_DTX_thres;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
frame_parms->nb_antennas_rx = n_rx;
|
||||
@@ -360,9 +428,9 @@ int main(int argc, char **argv)
|
||||
printf("FFO = %lf; IFO = %d\n",eps-IFO,IFO);
|
||||
}
|
||||
|
||||
gNB2UE = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, 0, 0, 0);
|
||||
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0, 0);
|
||||
|
||||
if (gNB2UE==NULL) {
|
||||
if (UE2gNB==NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
exit(-1);
|
||||
}
|
||||
@@ -370,143 +438,320 @@ int main(int argc, char **argv)
|
||||
frame_length_complex_samples = frame_parms->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
||||
//frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
|
||||
|
||||
s_re = malloc(2*sizeof(double*));
|
||||
s_im = malloc(2*sizeof(double*));
|
||||
r_re = malloc(2*sizeof(double*));
|
||||
r_im = malloc(2*sizeof(double*));
|
||||
txdata = malloc(2*sizeof(int*));
|
||||
|
||||
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));
|
||||
bzero(r_im[i],frame_length_complex_samples*sizeof(double));
|
||||
|
||||
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
|
||||
txdata[i] = malloc(frame_length_complex_samples*sizeof(int));
|
||||
bzero(r_re[i],frame_length_complex_samples*sizeof(int));
|
||||
|
||||
s_re = malloc(n_tx*sizeof(double*));
|
||||
s_im = malloc(n_tx*sizeof(double*));
|
||||
r_re = malloc(n_rx*sizeof(double*));
|
||||
r_im = malloc(n_rx*sizeof(double*));
|
||||
txdataF = malloc(n_tx*sizeof(int*));
|
||||
rxdataF = malloc(n_rx*sizeof(int*));
|
||||
gNB->common_vars.rxdataF=rxdataF;
|
||||
memcpy((void*)&gNB->frame_parms,(void*)frame_parms,sizeof(frame_parms));
|
||||
for (int aatx=0; aatx<n_tx; aatx++) {
|
||||
s_re[aatx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
||||
s_im[aatx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
||||
printf("Allocating %d samples for txdataF\n",frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size);
|
||||
txdataF[aatx] = memalign(32,14*frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
bzero(txdataF[aatx],14*frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
}
|
||||
|
||||
for (int aarx=0; aarx<n_rx; aarx++) {
|
||||
r_re[aarx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
||||
r_im[aarx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
||||
printf("Allocating %d samples for rxdataF\n",frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size);
|
||||
rxdataF[aarx] = memalign(32,14*frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
bzero(rxdataF[aarx],14*frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
}
|
||||
|
||||
uint8_t mcs=0;
|
||||
int shift = 0;
|
||||
if(format==0){
|
||||
if (sr_flag)
|
||||
shift = 1<<nr_bit;
|
||||
if (nr_bit ==0)
|
||||
mcs=table1_mcs[0];
|
||||
else if(nr_bit==1)
|
||||
mcs=table1_mcs[actual_payload+shift];
|
||||
else if(nr_bit==2)
|
||||
mcs=table2_mcs[actual_payload+shift];
|
||||
else AssertFatal(1==0,"Either nr_bit %d or sr_flag %d must be non-zero\n", nr_bit, sr_flag);
|
||||
}
|
||||
else if (format == 2 && nr_bit > 11) gNB->uci_polarParams = nr_polar_params(2, nr_bit, nrofPRB, 1, NULL);
|
||||
|
||||
startingPRB_intraSlotHopping = N_RB_DL-1;
|
||||
uint32_t hopping_id = Nid_cell;
|
||||
uint32_t dmrs_scrambling_id = 0;
|
||||
uint32_t data_scrambling_id = 0;
|
||||
|
||||
//configure UE
|
||||
UE = malloc(sizeof(PHY_VARS_NR_UE));
|
||||
UE = calloc(1,sizeof(PHY_VARS_NR_UE));
|
||||
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
||||
//phy_init_nr_top(UE); //called from init_nr_ue_signal
|
||||
|
||||
UE->frame_parms.nb_antennas_rx=1;
|
||||
UE->perfect_ce = 0;
|
||||
|
||||
if(eps!=0.0)
|
||||
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
|
||||
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
|
||||
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0)
|
||||
{
|
||||
printf("Error at UE NR initialisation\n");
|
||||
exit(-1);
|
||||
}
|
||||
uint8_t mcs=0;
|
||||
startingPRB_intraSlotHopping=N_RB_DL-1;
|
||||
pucch_GroupHopping_t PUCCH_GroupHopping=UE->pucch_config_common_nr->pucch_GroupHopping;
|
||||
uint32_t n_id=UE->pucch_config_common_nr->hoppingId;
|
||||
if((format!=0) && (format!=1)){
|
||||
printf("format not supported\n");
|
||||
exit(0);
|
||||
|
||||
fapi_nr_ul_config_pucch_pdu pucch_tx_pdu;
|
||||
if (format==0) {
|
||||
pucch_tx_pdu.format_type = 0;
|
||||
pucch_tx_pdu.nr_of_symbols = nrofSymbols;
|
||||
pucch_tx_pdu.start_symbol_index = startingSymbolIndex;
|
||||
pucch_tx_pdu.bwp_start = 0;
|
||||
pucch_tx_pdu.prb_start = startingPRB;
|
||||
pucch_tx_pdu.hopping_id = hopping_id;
|
||||
pucch_tx_pdu.group_hop_flag = 0;
|
||||
pucch_tx_pdu.sequence_hop_flag = 0;
|
||||
pucch_tx_pdu.freq_hop_flag = 0;
|
||||
pucch_tx_pdu.mcs = mcs;
|
||||
pucch_tx_pdu.initial_cyclic_shift = 0;
|
||||
pucch_tx_pdu.second_hop_prb = startingPRB_intraSlotHopping;
|
||||
}
|
||||
if(nacktoack_flag==0){
|
||||
if(format==0){
|
||||
if(nr_bit==1){
|
||||
actual_payload=2;
|
||||
mcs=table1_mcs[actual_payload];
|
||||
}
|
||||
else if(nr_bit==2){
|
||||
actual_payload=6;
|
||||
mcs=table2_mcs[actual_payload];
|
||||
}
|
||||
else{
|
||||
printf("Number of HARQ bits possible is 1-2\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(nr_bit==1)
|
||||
actual_payload=1;
|
||||
else if(nr_bit==2)
|
||||
actual_payload=3;
|
||||
else{
|
||||
printf("number of bits carried by PUCCH format1 is 1-2\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
for(SNR=snr0;SNR<=snr1;SNR=SNR+1){
|
||||
if (format==2) {
|
||||
pucch_tx_pdu.format_type = 2;
|
||||
pucch_tx_pdu.rnti = 0x1234;
|
||||
pucch_tx_pdu.n_bit = nr_bit;
|
||||
pucch_tx_pdu.payload = actual_payload;
|
||||
pucch_tx_pdu.nr_of_symbols = nrofSymbols;
|
||||
pucch_tx_pdu.start_symbol_index = startingSymbolIndex;
|
||||
pucch_tx_pdu.bwp_start = 0;
|
||||
pucch_tx_pdu.prb_start = startingPRB;
|
||||
pucch_tx_pdu.prb_size = nrofPRB;
|
||||
pucch_tx_pdu.hopping_id = hopping_id;
|
||||
pucch_tx_pdu.group_hop_flag = 0;
|
||||
pucch_tx_pdu.sequence_hop_flag = 0;
|
||||
pucch_tx_pdu.freq_hop_flag = 0;
|
||||
pucch_tx_pdu.dmrs_scrambling_id = dmrs_scrambling_id;
|
||||
pucch_tx_pdu.data_scrambling_id = data_scrambling_id;
|
||||
pucch_tx_pdu.second_hop_prb = startingPRB_intraSlotHopping;
|
||||
}
|
||||
|
||||
pucch_GroupHopping_t PUCCH_GroupHopping = pucch_tx_pdu.group_hop_flag + (pucch_tx_pdu.sequence_hop_flag<<1);
|
||||
|
||||
for(SNR=snr0;SNR<=snr1;SNR+=1){
|
||||
ack_nack_errors=0;
|
||||
sr_errors=0;
|
||||
n_errors = 0;
|
||||
sigma2_dB = 20*log10((double)amp/32767)-SNR;
|
||||
sigma2 = pow(10,sigma2_dB/10);
|
||||
for (trial=0; trial<n_trials; trial++) {
|
||||
bzero(txdata[0],frame_length_complex_samples*sizeof(int));
|
||||
for (int aatx=0;aatx<1;aatx++)
|
||||
bzero(txdataF[aatx],frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
if(format==0 && do_DTX==0){
|
||||
nr_generate_pucch0(UE, txdataF, frame_parms, amp, nr_slot_tx, &pucch_tx_pdu);
|
||||
} else if (format == 1 && do_DTX==0){
|
||||
nr_generate_pucch1(UE, txdataF, frame_parms, amp, nr_slot_tx, &pucch_tx_pdu);
|
||||
} else if (do_DTX == 0){
|
||||
nr_generate_pucch2(UE, txdataF, frame_parms, amp, nr_slot_tx, &pucch_tx_pdu);
|
||||
}
|
||||
|
||||
// SNR Computation
|
||||
// standard says: SNR = S / N, where S is the total signal energy, N is the noise energy in the transmission bandwidth (i.e. N_RB_DL resource blocks)
|
||||
// txlev = S.
|
||||
int txlev = signal_energy(&txdataF[0][startingSymbolIndex*frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size);
|
||||
|
||||
// sigma2 is variance per dimension, so N/(N_RB*12)
|
||||
// so, sigma2 = N/(N_RB_DL*12) => (S/SNR)/(N_RB*12)
|
||||
int N_RB = (format == 0 || format == 1) ? 1 : nrofPRB;
|
||||
sigma2_dB = 10*log10(txlev*(N_RB_DL/N_RB))-SNR;
|
||||
sigma2 = pow(10.0,sigma2_dB/10.0);
|
||||
|
||||
if (n_trials==1) printf("txlev %d (%f dB), offset %d, sigma2 %f ( %f dB)\n",txlev,10*log10(txlev),startingSymbolIndex*frame_parms->ofdm_symbol_size,sigma2,sigma2_dB);
|
||||
|
||||
int i0;
|
||||
double txr,txi,rxr,rxi,nr,ni;
|
||||
for (int symb=0; symb<gNB->frame_parms.symbols_per_slot;symb++) {
|
||||
if (symb<startingSymbolIndex || symb >= startingSymbolIndex+nrofSymbols) {
|
||||
i0 = symb*gNB->frame_parms.ofdm_symbol_size;
|
||||
for (int re=0;re<N_RB_DL*12;re++) {
|
||||
i=i0+((gNB->frame_parms.first_carrier_offset + re)%gNB->frame_parms.ofdm_symbol_size);
|
||||
for (int aarx=0;aarx<n_rx;aarx++) {
|
||||
nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
((int16_t*)rxdataF[aarx])[i<<1] = (int16_t)(100.0*(nr)/sqrt((double)txlev));
|
||||
((int16_t*)rxdataF[aarx])[1+(i<<1)] = (int16_t)(100.0*(ni)/sqrt((double)txlev));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
random_channel(UE2gNB,0);
|
||||
freq_channel(UE2gNB,N_RB_DL,2*N_RB_DL+1,scs/1000);
|
||||
struct complexd phasor;
|
||||
double rxr_tmp;
|
||||
for (int symb=0; symb<nrofSymbols; symb++) {
|
||||
i0 = (startingSymbolIndex + symb)*gNB->frame_parms.ofdm_symbol_size;
|
||||
for (int re=0;re<N_RB_DL*12;re++) {
|
||||
i=i0+((gNB->frame_parms.first_carrier_offset + re)%gNB->frame_parms.ofdm_symbol_size);
|
||||
phasor.r = cos(2*M_PI*phase*re);
|
||||
phasor.i = sin(2*M_PI*phase*re);
|
||||
for (int aarx=0;aarx<n_rx;aarx++) {
|
||||
txr = (double)(((int16_t *)txdataF[0])[(i<<1)]);
|
||||
txi = (double)(((int16_t *)txdataF[0])[1+(i<<1)]);
|
||||
rxr = txr*UE2gNB->chF[aarx][re].r - txi*UE2gNB->chF[aarx][re].i;
|
||||
rxi = txr*UE2gNB->chF[aarx][re].i + txi*UE2gNB->chF[aarx][re].r;
|
||||
rxr_tmp = rxr*phasor.r - rxi*phasor.i;
|
||||
rxi = rxr*phasor.i + rxi*phasor.r;
|
||||
rxr = rxr_tmp;
|
||||
nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
((int16_t*)rxdataF[aarx])[i<<1] = (int16_t)(100.0*(rxr + nr)/sqrt((double)txlev));
|
||||
((int16_t*)rxdataF[aarx])[1+(i<<1)]=(int16_t)(100.0*(rxi + ni)/sqrt((double)txlev));
|
||||
|
||||
if (n_trials==1 && abs(txr) > 0) printf("symb %d, re %d , aarx %d : txr %f, txi %f, chr %f, chi %f, nr %f, ni %f, rxr %f, rxi %f => %d,%d\n",
|
||||
symb, re, aarx, txr,txi,
|
||||
UE2gNB->chF[aarx][re].r,UE2gNB->chF[aarx][re].i,
|
||||
nr,ni, rxr,rxi,
|
||||
((int16_t*)rxdataF[aarx])[i<<1],((int16_t*)rxdataF[aarx])[1+(i<<1)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int rxlev=0;
|
||||
for (int aarx=0;aarx<n_rx;aarx++) rxlev += signal_energy(&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||
frame_parms->ofdm_symbol_size);
|
||||
|
||||
int rxlev_pucch=0;
|
||||
|
||||
for (int aarx=0;aarx<n_rx;aarx++) rxlev_pucch += signal_energy(&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||
12);
|
||||
|
||||
// set UL mask for pucch allocation
|
||||
for (int s=0;s<frame_parms->symbols_per_slot;s++){
|
||||
if (s>=startingSymbolIndex && s<(startingSymbolIndex+nrofSymbols))
|
||||
for (int rb=0; rb<N_RB; rb++) {
|
||||
int rb2 = rb+startingPRB;
|
||||
gNB->rb_mask_ul[s][rb2>>5] |= (1<<(rb2&31));
|
||||
}
|
||||
}
|
||||
|
||||
// noise measurement (all PRBs)
|
||||
gNB_I0_measurements(gNB, nr_slot_tx, 0, gNB->frame_parms.symbols_per_slot);
|
||||
|
||||
if (n_trials==1) printf("noise rxlev %d (%d dB), rxlev pucch %d dB sigma2 %f dB, SNR %f, TX %f, I0 (pucch) %d, I0 (avg) %d\n",rxlev,dB_fixed(rxlev),dB_fixed(rxlev_pucch),sigma2_dB,SNR,10*log10((double)txlev*UE->frame_parms.ofdm_symbol_size/12),gNB->measurements.n0_subband_power_tot_dB[startingPRB],gNB->measurements.n0_subband_power_avg_dB);
|
||||
if(format==0){
|
||||
nr_generate_pucch0(UE,txdata,frame_parms,UE->pucch_config_dedicated,amp,nr_tti_tx,m0,mcs,nrofSymbols,startingSymbolIndex,startingPRB);
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu;
|
||||
nfapi_nr_pucch_pdu_t pucch_pdu;
|
||||
gNB->uci_stats[0].rnti = 0x1234;
|
||||
pucch_pdu.rnti = 0x1234;
|
||||
pucch_pdu.subcarrier_spacing = 1;
|
||||
pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1;
|
||||
pucch_pdu.sequence_hop_flag = (PUCCH_GroupHopping>>1)&1;
|
||||
pucch_pdu.bit_len_harq = nr_bit;
|
||||
pucch_pdu.bit_len_csi_part1 = 0;
|
||||
pucch_pdu.bit_len_csi_part2 = 0;
|
||||
pucch_pdu.sr_flag = sr_flag;
|
||||
pucch_pdu.nr_of_symbols = nrofSymbols;
|
||||
pucch_pdu.hopping_id = hopping_id;
|
||||
pucch_pdu.initial_cyclic_shift = 0;
|
||||
pucch_pdu.start_symbol_index = startingSymbolIndex;
|
||||
pucch_pdu.prb_start = startingPRB;
|
||||
pucch_pdu.bwp_start = 0;
|
||||
pucch_pdu.bwp_size = N_RB_DL;
|
||||
if (nrofSymbols>1) {
|
||||
pucch_pdu.freq_hop_flag = 1;
|
||||
pucch_pdu.second_hop_prb = N_RB_DL-1;
|
||||
}
|
||||
else pucch_pdu.freq_hop_flag = 0;
|
||||
|
||||
nr_decode_pucch0(gNB, nr_frame_tx, nr_slot_tx,&uci_pdu,&pucch_pdu);
|
||||
if(sr_flag==1){
|
||||
if (uci_pdu.sr->sr_indication == 0 || uci_pdu.sr->sr_confidence_level == 1)
|
||||
sr_errors+=1;
|
||||
}
|
||||
// harq value 0 -> pass
|
||||
// confidence value 0 -> good confidence
|
||||
const int harq_value0 = uci_pdu.harq->harq_list[0].harq_value;
|
||||
const int harq_value1 = uci_pdu.harq->harq_list[1].harq_value;
|
||||
const int confidence_lvl = uci_pdu.harq->harq_confidence_level;
|
||||
if(nr_bit>0){
|
||||
if (nr_bit==1 && do_DTX == 0)
|
||||
ack_nack_errors+=(actual_payload^(!harq_value0));
|
||||
else if (do_DTX == 0)
|
||||
ack_nack_errors+=(((actual_payload&1)^(!harq_value0))+((actual_payload>>1)^(!harq_value1)));
|
||||
else if ((!confidence_lvl && !harq_value0) ||
|
||||
(!confidence_lvl && nr_bit == 2 && !harq_value1))
|
||||
ack_nack_errors++;
|
||||
free(uci_pdu.harq->harq_list);
|
||||
}
|
||||
}
|
||||
else{
|
||||
nr_generate_pucch1(UE,txdata,frame_parms,UE->pucch_config_dedicated,actual_payload,amp,nr_tti_tx,m0,nrofSymbols,startingSymbolIndex,startingPRB,startingPRB_intraSlotHopping,0,nr_bit);
|
||||
}
|
||||
for(i=0; i<frame_length_complex_samples; i++) {
|
||||
r_re[aa][i]=((double)(((int16_t *)txdata[0])[(i<<1)])/32767 + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
r_im[aa][i]=((double)(((int16_t *)txdata[0])[(i<<1)+1])/32767+ sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
r_re[aa][i]=r_re[0][i]/(sqrt(sigma2/2)+1);
|
||||
r_im[aa][i]=r_im[0][i]/(sqrt(sigma2/2)+1);
|
||||
if(r_re[aa][i]<-1)
|
||||
r_re[aa][i]=-1;
|
||||
else if(r_re[aa][i]>1)
|
||||
r_re[aa][i]=1;
|
||||
if(r_im[aa][i]<-1)
|
||||
r_im[aa][i]=-1;
|
||||
else if(r_im[aa][i]>1)
|
||||
r_im[aa][i]=1;
|
||||
((int16_t *)txdata[aa])[(i<<1)] = (int16_t)round(r_re[aa][i]*32767);
|
||||
((int16_t *)txdata[aa])[(i<<1)+1] =(int16_t)round(r_im[aa][i]*32767);
|
||||
}
|
||||
if(format==0){
|
||||
nr_decode_pucch0(txdata,PUCCH_GroupHopping,n_id,&(payload_received),frame_parms,amp,nr_tti_tx,m0,nrofSymbols,startingSymbolIndex,startingPRB,nr_bit);
|
||||
if(nr_bit==1)
|
||||
ack_nack_errors+=(((actual_payload^payload_received)&2)>>1);
|
||||
else
|
||||
ack_nack_errors+=(((actual_payload^payload_received)&2)>>1) + (((actual_payload^payload_received)&4)>>2);
|
||||
}
|
||||
else{
|
||||
nr_decode_pucch1(txdata,PUCCH_GroupHopping,n_id,&(payload_received),frame_parms,amp,nr_tti_tx,m0,nrofSymbols,startingSymbolIndex,startingPRB,startingPRB_intraSlotHopping,timeDomainOCC,nr_bit);
|
||||
else if (format==1) {
|
||||
nr_decode_pucch1(rxdataF,PUCCH_GroupHopping,hopping_id,
|
||||
&(payload_received),frame_parms,amp,nr_slot_tx,
|
||||
m0,nrofSymbols,startingSymbolIndex,startingPRB,
|
||||
startingPRB_intraSlotHopping,timeDomainOCC,nr_bit);
|
||||
if(nr_bit==1)
|
||||
ack_nack_errors+=((actual_payload^payload_received)&1);
|
||||
else
|
||||
ack_nack_errors+=((actual_payload^payload_received)&1) + (((actual_payload^payload_received)&2)>>1);
|
||||
}
|
||||
else if (format==2) {
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t uci_pdu;
|
||||
nfapi_nr_pucch_pdu_t pucch_pdu;
|
||||
pucch_pdu.rnti = 0x1234;
|
||||
pucch_pdu.subcarrier_spacing = 1;
|
||||
pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1;
|
||||
pucch_pdu.sequence_hop_flag = (PUCCH_GroupHopping>>1)&1;
|
||||
pucch_pdu.bit_len_csi_part1 = nr_bit;
|
||||
pucch_pdu.bit_len_harq = 0;
|
||||
pucch_pdu.bit_len_csi_part2 = 0;
|
||||
pucch_pdu.sr_flag = 0;
|
||||
pucch_pdu.nr_of_symbols = nrofSymbols;
|
||||
pucch_pdu.hopping_id = hopping_id;
|
||||
pucch_pdu.initial_cyclic_shift = 0;
|
||||
pucch_pdu.start_symbol_index = startingSymbolIndex;
|
||||
pucch_pdu.prb_size = nrofPRB;
|
||||
pucch_pdu.prb_start = startingPRB;
|
||||
pucch_pdu.dmrs_scrambling_id = dmrs_scrambling_id;
|
||||
pucch_pdu.data_scrambling_id = data_scrambling_id;
|
||||
if (nrofSymbols>1) {
|
||||
pucch_pdu.freq_hop_flag = 1;
|
||||
pucch_pdu.second_hop_prb = N_RB_DL-1;
|
||||
}
|
||||
else pucch_pdu.freq_hop_flag = 0;
|
||||
nr_decode_pucch2(gNB,nr_slot_tx,&uci_pdu,&pucch_pdu);
|
||||
int csi_part1_bytes=pucch_pdu.bit_len_csi_part1>>3;
|
||||
if ((pucch_pdu.bit_len_csi_part1&7) > 0) csi_part1_bytes++;
|
||||
for (int i=0;i<csi_part1_bytes;i++) {
|
||||
if (uci_pdu.csi_part1.csi_part1_payload[i] != ((uint8_t*)&actual_payload)[i]) {
|
||||
ack_nack_errors++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(uci_pdu.csi_part1.csi_part1_payload);
|
||||
|
||||
}
|
||||
n_errors=((actual_payload^payload_received)&1)+(((actual_payload^payload_received)&2)>>1)+(((actual_payload^payload_received)&4)>>2)+n_errors;
|
||||
}
|
||||
printf("SNR=%f, n_trials=%d, n_bit_errors=%d\n",SNR,n_trials,n_errors);
|
||||
if((float)ack_nack_errors/(float)(nr_bit*n_trials)<=target_error_rate){
|
||||
if (sr_flag == 1)
|
||||
printf("SR: SNR=%f, n_trials=%d, n_bit_errors=%d\n",SNR,n_trials,sr_errors);
|
||||
if(nr_bit > 0)
|
||||
printf("ACK/NACK: SNR=%f, n_trials=%d, n_bit_errors=%d\n",SNR,n_trials,ack_nack_errors);
|
||||
if((float)(ack_nack_errors+sr_errors)/(float)(n_trials)<=target_error_rate){
|
||||
printf("PUCCH test OK\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
free(r_re[i]);
|
||||
free(r_im[i]);
|
||||
free(txdata[i]);
|
||||
for (int aatx=0; aatx<n_tx; aatx++) {
|
||||
free(s_re[aatx]);
|
||||
free(s_im[aatx]);
|
||||
free(txdataF[aatx]);
|
||||
}
|
||||
for (int aarx=0; aarx<n_rx; aarx++) {
|
||||
free(r_re[aarx]);
|
||||
free(r_im[aarx]);
|
||||
free(rxdataF[aarx]);
|
||||
}
|
||||
free(s_re);
|
||||
free(s_im);
|
||||
free(r_re);
|
||||
free(r_im);
|
||||
free(txdata);
|
||||
free(txdataF);
|
||||
free(rxdataF);
|
||||
|
||||
if (output_fd) fclose(output_fd);
|
||||
if (input_fd) fclose(input_fd);
|
||||
|
||||
@@ -34,10 +34,9 @@
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
||||
#include "PHY/NR_REFSIG/nr_mod_table.h"
|
||||
#include "PHY/MODULATION/modulation_eNB.h"
|
||||
#include "PHY/MODULATION/modulation_UE.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||
@@ -46,6 +45,7 @@
|
||||
#include "openair1/SIMULATION/RF/rf.h"
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||
#include "common/utils/threadPool/thread-pool.h"
|
||||
|
||||
//#define DEBUG_NR_ULSCHSIM
|
||||
|
||||
@@ -54,8 +54,13 @@ PHY_VARS_NR_UE *UE;
|
||||
RAN_CONTEXT_t RC;
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3};
|
||||
uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
||||
|
||||
double cpuf;
|
||||
uint8_t nfapi_mode = 0;
|
||||
//uint8_t nfapi_mode = 0;
|
||||
uint16_t NB_UE_INST = 1;
|
||||
|
||||
// needed for some functions
|
||||
@@ -63,6 +68,44 @@ PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
|
||||
uint16_t n_rnti = 0x1234;
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
|
||||
int nr_postDecode_sim(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
|
||||
ldpcDecode_t *rdata = (ldpcDecode_t*) NotifiedFifoData(req);
|
||||
NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
|
||||
NR_gNB_ULSCH_t *ulsch = rdata->ulsch;
|
||||
int r = rdata->segment_r;
|
||||
|
||||
bool decodeSuccess = (rdata->decodeIterations <= rdata->decoderParms.numMaxIter);
|
||||
ulsch_harq->processedSegments++;
|
||||
gNB->nbDecode--;
|
||||
|
||||
if (decodeSuccess) {
|
||||
memcpy(ulsch_harq->b+rdata->offset,
|
||||
ulsch_harq->c[r],
|
||||
rdata->Kr_bytes - (ulsch_harq->F>>3) -((ulsch_harq->C>1)?3:0));
|
||||
} else {
|
||||
if ( rdata->nbSegments != ulsch_harq->processedSegments ) {
|
||||
int nb=abortTpool(gNB->threadPool, req->key);
|
||||
nb+=abortNotifiedFIFO(gNB->respDecode, req->key);
|
||||
gNB->nbDecode-=nb;
|
||||
AssertFatal(ulsch_harq->processedSegments+nb == rdata->nbSegments,"processed: %d, aborted: %d, total %d\n",
|
||||
ulsch_harq->processedSegments, nb, rdata->nbSegments);
|
||||
ulsch_harq->processedSegments=rdata->nbSegments;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// if all segments are done
|
||||
if (rdata->nbSegments == ulsch_harq->processedSegments) {
|
||||
if (decodeSuccess) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
ulsch->last_iteration_cnt = rdata->decodeIterations;
|
||||
return 0;
|
||||
}
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
@@ -88,13 +131,15 @@ int main(int argc, char **argv)
|
||||
NR_DL_FRAME_PARMS *frame_parms;
|
||||
double sigma;
|
||||
unsigned char qbits = 8;
|
||||
int ret;
|
||||
int ret=0;
|
||||
int loglvl = OAILOG_WARNING;
|
||||
uint64_t SSB_positions=0x01;
|
||||
uint16_t nb_symb_sch = 12;
|
||||
uint16_t nb_rb = 50;
|
||||
uint8_t Imcs = 9;
|
||||
|
||||
double DS_TDL = .03;
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
@@ -314,13 +359,12 @@ int main(int argc, char **argv)
|
||||
snr1 = snr0 + 10;
|
||||
|
||||
gNB2UE = new_channel_desc_scm(n_tx,
|
||||
n_rx,
|
||||
channel_model,
|
||||
n_rx,
|
||||
channel_model,
|
||||
61.44e6, //N_RB2sampling_rate(N_RB_DL),
|
||||
40e6, //N_RB2channel_bandwidth(N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
DS_TDL,
|
||||
0,0,0, 0);
|
||||
|
||||
if (gNB2UE == NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
@@ -333,6 +377,11 @@ int main(int argc, char **argv)
|
||||
gNB = RC.gNB[0];
|
||||
//gNB_config = &gNB->gNB_config;
|
||||
|
||||
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
||||
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||
char tp_param[] = "n";
|
||||
initTpool(tp_param, gNB->threadPool, true);
|
||||
initNotifiedFIFO(gNB->respDecode);
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
frame_parms->nb_antennas_rx = n_rx;
|
||||
@@ -345,7 +394,7 @@ int main(int argc, char **argv)
|
||||
|
||||
nr_phy_config_request_sim(gNB, N_RB_UL, N_RB_UL, mu, Nid_cell, SSB_positions);
|
||||
|
||||
phy_init_nr_gNB(gNB, 0, 0);
|
||||
phy_init_nr_gNB(gNB, 0, 1); //lowmem
|
||||
|
||||
//configure UE
|
||||
UE = malloc(sizeof(PHY_VARS_NR_UE));
|
||||
@@ -391,7 +440,7 @@ int main(int argc, char **argv)
|
||||
mod_order = nr_get_Qm_ul(Imcs, 0);
|
||||
code_rate = nr_get_code_rate_ul(Imcs, 0);
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
|
||||
TBS = nr_compute_tbs(mod_order,code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, Nl);
|
||||
TBS = nr_compute_tbs(mod_order,code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, 0, Nl);
|
||||
|
||||
printf("\nAvailable bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
|
||||
|
||||
@@ -402,9 +451,8 @@ int main(int argc, char **argv)
|
||||
rel15_ul->mcs_index = Imcs;
|
||||
rel15_ul->pusch_data.rv_index = rvidx;
|
||||
rel15_ul->nrOfLayers = Nl;
|
||||
//rel15_ul->length_dmrs = length_dmrs;
|
||||
rel15_ul->target_code_rate = code_rate;
|
||||
rel15_ul->pusch_data.tb_size = TBS>>3;
|
||||
rel15_ul->pusch_data.tb_size = TBS/8;
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
|
||||
@@ -424,15 +472,6 @@ int main(int argc, char **argv)
|
||||
for (i = 0; i < TBS / 8; i++)
|
||||
test_input[i] = (unsigned char) rand();
|
||||
|
||||
|
||||
/////////////////////////[adk] preparing NR_UE_ULSCH_t parameters///////////////////////// A HOT FIX until creating nfapi_nr_ul_config_ulsch_pdu_rel15_t
|
||||
///////////
|
||||
ulsch_ue->nb_re_dmrs = nb_re_dmrs;
|
||||
ulsch_ue->length_dmrs = length_dmrs;
|
||||
ulsch_ue->rnti = n_rnti;
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////[adk] preparing UL harq_process parameters/////////////////////////
|
||||
///////////
|
||||
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
|
||||
@@ -442,13 +481,14 @@ int main(int argc, char **argv)
|
||||
|
||||
if (harq_process_ul_ue) {
|
||||
|
||||
harq_process_ul_ue->mcs = Imcs;
|
||||
harq_process_ul_ue->Nl = Nl;
|
||||
harq_process_ul_ue->nb_rb = nb_rb;
|
||||
harq_process_ul_ue->number_of_symbols = nb_symb_sch;
|
||||
harq_process_ul_ue->pusch_pdu.rnti = n_rnti;
|
||||
harq_process_ul_ue->pusch_pdu.mcs_index = Imcs;
|
||||
harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl;
|
||||
harq_process_ul_ue->pusch_pdu.rb_size = nb_rb;
|
||||
harq_process_ul_ue->pusch_pdu.nr_of_symbols = nb_symb_sch;
|
||||
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords;
|
||||
harq_process_ul_ue->rvidx = rvidx;
|
||||
harq_process_ul_ue->TBS = TBS;
|
||||
harq_process_ul_ue->pusch_pdu.pusch_data.rv_index = rvidx;
|
||||
harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = TBS/8;
|
||||
harq_process_ul_ue->a = &test_input[0];
|
||||
|
||||
}
|
||||
@@ -461,9 +501,10 @@ int main(int argc, char **argv)
|
||||
|
||||
/////////////////////////ULSCH coding/////////////////////////
|
||||
///////////
|
||||
unsigned int G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, Nl);
|
||||
|
||||
if (input_fd == NULL) {
|
||||
nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid);
|
||||
nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
@@ -534,10 +575,15 @@ int main(int argc, char **argv)
|
||||
rel15_ul->qam_mod_order,
|
||||
rel15_ul->nrOfLayers);
|
||||
|
||||
ret = nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms, rel15_ul,
|
||||
nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms, rel15_ul,
|
||||
frame, subframe, harq_pid, G);
|
||||
while (gNB->nbDecode > 0) {
|
||||
notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool);
|
||||
ret = nr_postDecode_sim(gNB, req);
|
||||
delNotifiedFIFO_elt(req);
|
||||
}
|
||||
|
||||
if (ret > ulsch_gNB->max_ldpc_iterations)
|
||||
if (ret)
|
||||
n_errors++;
|
||||
|
||||
//count errors
|
||||
|
||||
+1181
-417
File diff suppressed because it is too large
Load Diff
@@ -115,6 +115,11 @@ int ue_query_mch(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
|
||||
sub_frame_t subframe, uint8_t eNB_index,
|
||||
uint8_t * sync_area, uint8_t * mcch_active){ return(0);}
|
||||
|
||||
|
||||
int ue_query_mch_fembms(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
|
||||
sub_frame_t subframe, uint8_t eNB_index,
|
||||
uint8_t * sync_area, uint8_t * mcch_active){ return(0);}
|
||||
|
||||
void dl_phy_sync_success(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
unsigned char eNB_index, uint8_t first_sync){}
|
||||
@@ -137,6 +142,15 @@ void thread_top_init(char *thread_name,
|
||||
|
||||
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0);}
|
||||
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
|
||||
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
|
||||
|
||||
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
|
||||
|
||||
|
||||
@@ -51,16 +51,16 @@
|
||||
|
||||
void display_frame_configuration(NR_DL_FRAME_PARMS *frame_parms) {
|
||||
|
||||
printf("\nTdd configuration tti %d downlink %d uplink %d period %d \n", frame_parms->ttis_per_subframe, frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots,
|
||||
printf("\nTdd configuration tti %d downlink %d uplink %d period %d \n", frame_parms->slots_per_subframe, frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots,
|
||||
frame_parms->p_tdd_UL_DL_Configuration->nrofUplinkSlots, frame_parms->p_tdd_UL_DL_Configuration->dl_UL_TransmissionPeriodicity);
|
||||
|
||||
int k = (TDD_CONFIG_NB_FRAMES * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) - 1; //19;
|
||||
int tti = 0;
|
||||
for (int j = 0; j < TDD_CONFIG_NB_FRAMES * frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; j++) {
|
||||
for (int j = 0; j < TDD_CONFIG_NB_FRAMES * frame_parms->slots_per_frame; j++) {
|
||||
int frame = 0;
|
||||
if (j != 0) {
|
||||
frame = (frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)/j;
|
||||
tti = (j)%(frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
frame = j / frame_parms->slots_per_frame;
|
||||
tti = j % frame_parms->slots_per_frame;
|
||||
}
|
||||
else {
|
||||
frame = 0;
|
||||
@@ -99,9 +99,10 @@ void display_frame_configuration(NR_DL_FRAME_PARMS *frame_parms) {
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
void set_tti_test(NR_DL_FRAME_PARMS *frame_parms, int ttis_per_subframe)
|
||||
void set_tti_test(NR_DL_FRAME_PARMS *frame_parms, int slots_per_subframe)
|
||||
{
|
||||
frame_parms->ttis_per_subframe = ttis_per_subframe;
|
||||
frame_parms->slots_per_subframe = slots_per_subframe;
|
||||
frame_parms->slots_per_frame = slots_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
@@ -94,6 +94,7 @@ extern int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode);
|
||||
int test_synchro_pss_sss_nr(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_sequence_number)
|
||||
{
|
||||
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
|
||||
UE_nr_rxtx_proc_t proc = {0};
|
||||
int synchro_position;
|
||||
int offset;
|
||||
int16_t *tmp;
|
||||
@@ -130,7 +131,7 @@ int test_synchro_pss_sss_nr(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, in
|
||||
|
||||
#endif
|
||||
|
||||
rx_sss_nr(PHY_vars_UE, &metric_fdd_ncp, &phase_fdd_ncp);
|
||||
rx_sss_nr(PHY_vars_UE, &proc, &metric_fdd_ncp, &phase_fdd_ncp);
|
||||
|
||||
#if TEST_SYNCHRO_TIMING_PSS
|
||||
|
||||
@@ -244,7 +245,7 @@ void set_sequence_sss(PHY_VARS_NR_UE *PHY_vars_UE, int offset, int slot_offset)
|
||||
void insert_sequence_sss(PHY_VARS_NR_UE *PHY_vars_UE, int offset)
|
||||
{
|
||||
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
|
||||
int samples_for_half_frame = (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti)>>1;
|
||||
int samples_for_half_frame = frame_parms->samples_per_frame / 2;
|
||||
|
||||
set_sequence_sss(PHY_vars_UE, offset, 0);
|
||||
|
||||
@@ -327,7 +328,7 @@ int test_synchro_pss_sss(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int s
|
||||
|
||||
int sync_pos2 = synchro_position - frame_parms->nb_prefix_samples;
|
||||
|
||||
int sync_pos_slot = (frame_parms->samples_per_tti>>1) - frame_parms->ofdm_symbol_size - frame_parms->nb_prefix_samples;
|
||||
int sync_pos_slot = (frame_parms->samples_per_slot>>1) - frame_parms->ofdm_symbol_size - frame_parms->nb_prefix_samples;
|
||||
|
||||
if (sync_pos2 >= sync_pos_slot)
|
||||
PHY_vars_UE->rx_offset = sync_pos2 - sync_pos_slot;
|
||||
|
||||
@@ -300,7 +300,7 @@ typedef enum {
|
||||
|
||||
void set_random_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int amp) {
|
||||
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
|
||||
int samples_for_frame = (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti);
|
||||
int samples_for_frame = frame_parms->samples_per_frame;
|
||||
int16_t random;
|
||||
int16_t *data_p;
|
||||
random_data_format_t data_format = SINUSOIDAL_DATA;
|
||||
@@ -394,7 +394,7 @@ void set_random_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int amp) {
|
||||
|
||||
int set_pss_in_rx_buffer_from_external_buffer(PHY_VARS_NR_UE *PHY_vars_UE, short *input_buffer) {
|
||||
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
|
||||
int samples_for_frame = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_subframe; /* both i and q */
|
||||
int samples_for_frame = frame_parms->samples_per_frame; /* both i and q */
|
||||
|
||||
for (int aa=0; aa<PHY_vars_UE->frame_parms.nb_antennas_rx; aa++) {
|
||||
for (int i = 0; i < samples_for_frame; i++) {
|
||||
|
||||
@@ -69,12 +69,6 @@ typedef struct {
|
||||
int number_of_fail;
|
||||
} test_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t ofdm_symbol_size;
|
||||
uint32_t samples_per_tti;
|
||||
uint32_t samples_per_subframe;
|
||||
} save_frame_parms_t;
|
||||
|
||||
/*************** GLOBAL VARIABLES***********************************/
|
||||
|
||||
EXTERN PHY_VARS_eNB *PHY_vars_eNB;
|
||||
|
||||
@@ -58,7 +58,7 @@ int test_pucch_generators(PHY_VARS_NR_UE *ue) {
|
||||
int occ_Index = 0;
|
||||
uint64_t pucch_payload = 0;
|
||||
int tx_amp = 512;
|
||||
int nr_tti_tx = 0;
|
||||
int nr_slot_tx = 0;
|
||||
int N_UCI = 0; /* size in bits for Uplink Control Information */
|
||||
|
||||
switch(format) {
|
||||
@@ -67,7 +67,7 @@ int test_pucch_generators(PHY_VARS_NR_UE *ue) {
|
||||
&ue->frame_parms,
|
||||
&ue->pucch_config_dedicated_nr[gNB_id],
|
||||
tx_amp,
|
||||
nr_tti_tx,
|
||||
nr_slot_tx,
|
||||
(uint8_t)m_0,
|
||||
(uint8_t)m_CS,
|
||||
nb_symbols_total,
|
||||
@@ -82,7 +82,7 @@ int test_pucch_generators(PHY_VARS_NR_UE *ue) {
|
||||
&ue->pucch_config_dedicated_nr[gNB_id],
|
||||
pucch_payload,
|
||||
tx_amp,
|
||||
nr_tti_tx,
|
||||
nr_slot_tx,
|
||||
(uint8_t)m_0,
|
||||
nb_symbols_total,
|
||||
starting_symbol_index,
|
||||
@@ -95,13 +95,13 @@ int test_pucch_generators(PHY_VARS_NR_UE *ue) {
|
||||
|
||||
case pucch_format2_nr: {
|
||||
nr_generate_pucch2(ue,
|
||||
ue->pdcch_vars[ue->current_thread_id[nr_tti_tx]][gNB_id]->crnti,
|
||||
ue->pdcch_vars[thread_number][gNB_id]->crnti,
|
||||
ue->common_vars.txdataF,
|
||||
&ue->frame_parms,
|
||||
&ue->pucch_config_dedicated_nr[gNB_id],
|
||||
pucch_payload,
|
||||
tx_amp,
|
||||
nr_tti_tx,
|
||||
nr_slot_tx,
|
||||
nb_symbols_total,
|
||||
starting_symbol_index,
|
||||
nb_of_prbs,
|
||||
@@ -113,14 +113,14 @@ int test_pucch_generators(PHY_VARS_NR_UE *ue) {
|
||||
case pucch_format3_nr:
|
||||
case pucch_format4_nr: {
|
||||
nr_generate_pucch3_4(ue,
|
||||
ue->pdcch_vars[ue->current_thread_id[nr_tti_tx]][gNB_id]->crnti,
|
||||
ue->pdcch_vars[thread_number][gNB_id]->crnti,
|
||||
ue->common_vars.txdataF,
|
||||
&ue->frame_parms,
|
||||
format,
|
||||
&ue->pucch_config_dedicated_nr[gNB_id],
|
||||
pucch_payload,
|
||||
tx_amp,
|
||||
nr_tti_tx,
|
||||
nr_slot_tx,
|
||||
nb_symbols_total,
|
||||
starting_symbol_index,
|
||||
nb_of_prbs,
|
||||
|
||||
@@ -169,7 +169,7 @@ int test_pucch_basic_error(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pr
|
||||
|
||||
printf("%s", tst_separator);
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_FIRST;
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_FIRST;
|
||||
|
||||
printf("\n => Test : No harq feedback on going\n");
|
||||
|
||||
@@ -180,9 +180,9 @@ int test_pucch_basic_error(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pr
|
||||
}
|
||||
|
||||
/* set a tx slot with no ack */
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
|
||||
printf("\n => Test : Error due to acknownlegment not set \n");
|
||||
|
||||
@@ -232,7 +232,7 @@ int test_pucch_basic_error(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pr
|
||||
v_return = -1;
|
||||
}
|
||||
|
||||
ue->n_connected_eNB = 2;
|
||||
ue->n_connected_gNB = 2;
|
||||
|
||||
printf("\n => Test : Error due to PUCCH format with multiple cells not already implemented \n");
|
||||
|
||||
@@ -240,7 +240,7 @@ int test_pucch_basic_error(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pr
|
||||
v_return = -1;
|
||||
}
|
||||
|
||||
ue->n_connected_eNB = 1;
|
||||
ue->n_connected_gNB = 1;
|
||||
|
||||
return (v_return);
|
||||
}
|
||||
@@ -267,7 +267,7 @@ int test_pucch_common_config_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_
|
||||
common_pucch_configuration(ue, gNB_id, TST_PUCCH_COMMON_CONFIG_INDEX_OK);
|
||||
|
||||
/* set a tx slot with no ack */
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||
|
||||
harq_status->ack = DL_ACK;
|
||||
|
||||
@@ -290,9 +290,9 @@ int test_pucch_common_config_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_
|
||||
|
||||
/* set a second ack on a different downlink harq process */
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_SECOND;
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_SECOND;
|
||||
|
||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_SECOND].harq_ack;
|
||||
harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_SECOND].harq_ack;
|
||||
|
||||
harq_status->n_CCE = 2;
|
||||
harq_status->N_CCE = 4;
|
||||
@@ -300,7 +300,7 @@ int test_pucch_common_config_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_
|
||||
harq_status->send_harq_status = 1;
|
||||
harq_status->vDAI_DL = 2;
|
||||
harq_status->ack = DL_ACK;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
|
||||
printf("\n => Test : PUCCH format from common config in dedicated mode: two positive downlink ACKnowledgments \n");
|
||||
|
||||
@@ -316,7 +316,7 @@ int test_pucch_common_config_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_
|
||||
v_return = -1;
|
||||
}
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack.ack = DL_NACK;
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack.ack = DL_NACK;
|
||||
|
||||
printf("\n => Test : PUCCH format from common config in dedicated mode: two negative downlink ACKnowledgments \n");
|
||||
|
||||
@@ -563,11 +563,11 @@ int test_pucch_dedicated_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_id,
|
||||
|
||||
printf("%s", tst_separator);
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_FIRST;
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_FIRST;
|
||||
|
||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||
harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
harq_status->send_harq_status = 1;
|
||||
harq_status->vDAI_DL = 1;
|
||||
harq_status->ack = DL_ACK;
|
||||
@@ -582,11 +582,11 @@ int test_pucch_dedicated_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_id,
|
||||
for (int i = 0; i < TST_NB_STEP_SINGLE_TRANSPORT_BLOCK; i++) {
|
||||
|
||||
/* set a tx slot with no ack */
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid = dl_harq_pid[i];
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid = dl_harq_pid[i];
|
||||
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
harq_status->send_harq_status = 1;
|
||||
harq_status->vDAI_DL = i+1;
|
||||
harq_status->ack = DL_ACK;
|
||||
@@ -616,11 +616,11 @@ int test_pucch_dedicated_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_id,
|
||||
for (i = 1; i < TST_NB_STEP_SINGLE_TRANSPORT_BLOCK; i = i+2) {
|
||||
|
||||
/* set a tx slot with no ack */
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid = dl_harq_pid[i];
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid = dl_harq_pid[i];
|
||||
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
harq_status->send_harq_status = 1;
|
||||
harq_status->vDAI_DL = i+1;
|
||||
harq_status->ack = DL_ACK;
|
||||
@@ -677,14 +677,14 @@ int test_pucch_dedicated_two_transport_blocks(PHY_VARS_NR_UE *ue, int gNB_id, UE
|
||||
|
||||
for (int code_word = 0; code_word < 2; code_word++) {
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->Number_MCS_HARQ_DL_DCI = 2;
|
||||
ue->dlsch[proc->thread_id][gNB_id][code_word]->Number_MCS_HARQ_DL_DCI = 2;
|
||||
|
||||
/* set a tx slot with no ack */
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->current_harq_pid = dl_harq_pid[i];
|
||||
ue->dlsch[proc->thread_id][gNB_id][code_word]->current_harq_pid = dl_harq_pid[i];
|
||||
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
harq_status->send_harq_status = 1;
|
||||
harq_status->vDAI_DL = i+1;
|
||||
harq_status->ack = DL_ACK;
|
||||
@@ -697,7 +697,7 @@ int test_pucch_dedicated_two_transport_blocks(PHY_VARS_NR_UE *ue, int gNB_id, UE
|
||||
reset_harq = TRUE;
|
||||
}
|
||||
|
||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
|
||||
harq_status->pucch_resource_indicator = pucch_resource_indicator[i][j];
|
||||
|
||||
@@ -720,21 +720,21 @@ int test_pucch_dedicated_two_transport_blocks(PHY_VARS_NR_UE *ue, int gNB_id, UE
|
||||
|
||||
for (int code_word = 0; code_word < 2; code_word++) {
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->Number_MCS_HARQ_DL_DCI = 2;
|
||||
ue->dlsch[proc->thread_id][gNB_id][code_word]->Number_MCS_HARQ_DL_DCI = 2;
|
||||
|
||||
/* set a tx slot with no ack */
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->current_harq_pid = dl_harq_pid[i];
|
||||
ue->dlsch[proc->thread_id][gNB_id][code_word]->current_harq_pid = dl_harq_pid[i];
|
||||
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
harq_status->send_harq_status = 1;
|
||||
harq_status->vDAI_DL = i+1;
|
||||
harq_status->ack = DL_ACK;
|
||||
|
||||
for (int j = 0 ; j < 2; j++) {
|
||||
|
||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
|
||||
harq_status->pucch_resource_indicator = pucch_resource_indicator[i][j];
|
||||
}
|
||||
@@ -754,21 +754,21 @@ int test_pucch_dedicated_two_transport_blocks(PHY_VARS_NR_UE *ue, int gNB_id, UE
|
||||
|
||||
for (int code_word = 0; code_word < 2; code_word++) {
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->Number_MCS_HARQ_DL_DCI = 2;
|
||||
ue->dlsch[proc->thread_id][gNB_id][code_word]->Number_MCS_HARQ_DL_DCI = 2;
|
||||
|
||||
/* set a tx slot with no ack */
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->current_harq_pid = dl_harq_pid[i];
|
||||
ue->dlsch[proc->thread_id][gNB_id][code_word]->current_harq_pid = dl_harq_pid[i];
|
||||
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
harq_status->send_harq_status = 1;
|
||||
harq_status->vDAI_DL = i+1;
|
||||
harq_status->ack = DL_ACK;
|
||||
|
||||
for (int j = 0 ; j < 2; j++) {
|
||||
|
||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||
|
||||
harq_status->pucch_resource_indicator = pucch_resource_indicator[i][j];
|
||||
}
|
||||
@@ -935,7 +935,7 @@ int test_sr_alone_dedicated(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *p
|
||||
}
|
||||
|
||||
/* restore single transport block */
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->Number_MCS_HARQ_DL_DCI = 1;
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->Number_MCS_HARQ_DL_DCI = 1;
|
||||
|
||||
return (v_return);
|
||||
}
|
||||
@@ -976,11 +976,11 @@ int test_sr_ack_dedicated(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pro
|
||||
|
||||
NR_UE_HARQ_STATUS_t *harq_status;
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_FIRST;
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_FIRST;
|
||||
|
||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||
harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
harq_status->send_harq_status = 1;
|
||||
harq_status->vDAI_DL = 1;
|
||||
harq_status->ack = DL_ACK;
|
||||
@@ -1015,11 +1015,11 @@ int test_sr_ack_dedicated(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pro
|
||||
|
||||
/* set a second harq ack context */
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_SECOND;
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_SECOND;
|
||||
|
||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_SECOND].harq_ack;
|
||||
harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_SECOND].harq_ack;
|
||||
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
harq_status->send_harq_status = 1;
|
||||
harq_status->vDAI_DL = 2;
|
||||
harq_status->ack = DL_ACK;
|
||||
@@ -1073,7 +1073,7 @@ int test_csi_dedicated(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *proc)
|
||||
|
||||
printf("%s", tst_separator);
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid = NR_MAX_DLSCH_HARQ_PROCESSES;
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid = NR_MAX_DLSCH_HARQ_PROCESSES;
|
||||
|
||||
set_csi_nr( 4, 0x0E );
|
||||
|
||||
@@ -1090,11 +1090,11 @@ int test_csi_dedicated(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *proc)
|
||||
|
||||
NR_UE_HARQ_STATUS_t *harq_status;
|
||||
|
||||
ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_FIRST;
|
||||
ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid = TST_DL_HARQ_PID_FIRST;
|
||||
|
||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||
harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||
|
||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
||||
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||
harq_status->send_harq_status = 1;
|
||||
harq_status->vDAI_DL = 1;
|
||||
harq_status->ack = DL_ACK;
|
||||
@@ -1168,9 +1168,11 @@ int test_pucch(PHY_VARS_NR_UE *ue)
|
||||
assert(0);
|
||||
}
|
||||
|
||||
proc->frame_tx = 0;
|
||||
proc->nr_tti_rx = 0;
|
||||
proc->nr_tti_tx = (proc->nr_tti_rx + NR_UE_CAPABILITY_SLOT_RX_TO_TX)%(ue->frame_parms.ttis_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
proc->frame_rx = 0;
|
||||
proc->nr_slot_rx = 0;
|
||||
|
||||
proc->frame_tx = proc->frame_rx + (proc->nr_slot_rx + NR_UE_CAPABILITY_SLOT_RX_TO_TX) / ue->frame_parms.slots_per_frame;
|
||||
proc->nr_slot_tx = (proc->nr_slot_rx + NR_UE_CAPABILITY_SLOT_RX_TO_TX) % ue->frame_parms.slots_per_frame;
|
||||
|
||||
init_pucch_power_configuration( ue, gNB_id);
|
||||
|
||||
|
||||
@@ -223,12 +223,12 @@ int test_srs_periodicity(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc)
|
||||
}
|
||||
printf("srs period %d offset %d \n", srs_current_period, p_srs_resource->SRS_Offset);
|
||||
|
||||
int duration = (10 * srs_current_period)/(NR_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->ttis_per_subframe);
|
||||
int duration = (10 * srs_current_period) / frame_parms->slots_per_frame;
|
||||
|
||||
for (int frame_tx = 0; frame_tx < duration; frame_tx++) {
|
||||
for (int slot_tx = 0; slot_tx < (NR_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->ttis_per_subframe); slot_tx++) {
|
||||
proc->frame_tx = frame_tx;
|
||||
proc->nr_tti_tx = slot_tx;
|
||||
for (int slot_tx = 0; slot_tx < frame_parms->slots_per_frame; slot_tx++) {
|
||||
proc->frame_tx = frame_tx;
|
||||
proc->nr_slot_tx = slot_tx;
|
||||
if (ue_srs_procedure_nr( ue, proc, 0) == 0) {
|
||||
printf("test_srs_periodicity srs at frame %d slot %d \n", frame_tx, slot_tx);
|
||||
}
|
||||
@@ -372,7 +372,7 @@ int test_srs(PHY_VARS_NR_UE *PHY_vars_UE)
|
||||
/* start test of sounding reference signals */
|
||||
default_srs_configuration(frame_parms);
|
||||
|
||||
txptr = calloc(frame_parms->samples_per_tti , sizeof(int32_t));
|
||||
txptr = calloc(frame_parms->samples_per_slot , sizeof(int32_t));
|
||||
if (txptr == NULL) {
|
||||
printf("Error test_srs: memory allocation problem txptr \n");
|
||||
assert(0);
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
|
||||
int test_synchro_pss_sss_nr(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, NR_DL_FRAME_PARMS *frame_parms_gNB, test_t *test)
|
||||
{
|
||||
UE_nr_rxtx_proc_t proc = {0};
|
||||
VOID_PARAMETER test;
|
||||
int synchro_position;
|
||||
int offset;
|
||||
@@ -133,7 +134,7 @@ int test_synchro_pss_sss_nr(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, NR
|
||||
|
||||
#endif
|
||||
|
||||
rx_sss_nr(PHY_vars_UE, &metric_fdd_ncp, &phase_fdd_ncp);
|
||||
rx_sss_nr(PHY_vars_UE, &proc, &metric_fdd_ncp, &phase_fdd_ncp);
|
||||
|
||||
#if TEST_SYNCHRO_TIMING_PSS
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# Channel simulation source files
|
||||
|
||||
1. [random_channel.c](../random_channel.c)
|
||||
1. [sim.h](../sim.h)
|
||||
|
||||
|
||||
|
||||
[channel simulation main page](channel_simulation.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
@@ -0,0 +1,13 @@
|
||||
# OAI channel simulation feature
|
||||
|
||||
oai includes a channel simulation feature that any component can use to alter time domain samples of a RF channel by applying pre-defined models as defined, for example, in 3GPP TR 36.873 or TR 38.901
|
||||
|
||||
Definition, configuration and run-time modification of a channel model are implemented in common code included in UEs, gNb, eNB and used when running with the rfsimulator or the L1 simulator. Phy simulators are also using channel simulation but configuration is done via dedicated command line options. The rfsimulator is the only option to get access to all the configurations and run-time modifications features of oai channel simulation.
|
||||
|
||||
## Documentation
|
||||
|
||||
* [runtime usage](rtusage.md)
|
||||
* [developer usage](devusage.md)
|
||||
* [module architecture](arch.md)
|
||||
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
@@ -0,0 +1,7 @@
|
||||
### channel simulation developer usage
|
||||
|
||||
|
||||
[Configuring the channel simulation](rtusage.md)
|
||||
|
||||
[channel simulation main page](channel_simulation.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
@@ -0,0 +1,69 @@
|
||||
## configuring the channel simulation
|
||||
Oai channel simulation is using the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify some channel model parameters
|
||||
|
||||
All channel simulation parameters are defined in the `channelmod` section. Most parameters are specific to a channel model and are only used by the rfsimulator.
|
||||
|
||||
### global parameters
|
||||
|
||||
| name | type | default | description |
|
||||
|:---:|:---:|:---:|:----|
|
||||
| `max_chan` | integer | `25` | Maximum number of channel model that can be defined in the system. Must be greater than the number of model definitions in the model list loaded at init time. |
|
||||
| `modellist` | character string | `DefaultChannelList` | Name of the channel models list to load at init time. |
|
||||
|
||||
### Model lists
|
||||
|
||||
Several model lists can be defined in the oai configuration file. One, defined by the `modellist` parameter is loaded at init time. In the configuration file each model list item describes a channel model using a group of parameters:
|
||||
|
||||
| parameter name | type | default | description |
|
||||
|:---:|:---:|:---:|:----|
|
||||
| `model name` | character string | mandatory |name of the model, as used in the code to retrieve a model definition|
|
||||
| `type` | | `AWGN` | name of the channel modelization algorithm applied on rf signal. The list of available model types can be listed via the [telnet server](../../telnetsrv/DOC/telnetsrv.md) or by entering an invalid type name |
|
||||
| `ploss_dB` | real (float) | | path loss of the channel, in dB |
|
||||
| `noise_power_dB` | real (double) | | noise of the channel in dB |
|
||||
| `forgetfact` | real (double) | | |
|
||||
| `offset` | integer | | |
|
||||
| `ds_tdl` | real double | | |
|
||||
|
||||
Channel simulation parameters can also be specified on the command line:
|
||||
|
||||
```bash
|
||||
./lte-softmodem -O ../../../ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf --noS1 --rfsim --rfsimulator.options chanmod --rfsimulator.serveraddr enb --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120
|
||||
```
|
||||
### Using the telnet server to modify channel simulator parameters
|
||||
The telnet server includes a `channelmod` command which can be used to dynamically modify some channel model parameters. This command is only available when channel simulation is enabled (via `rfsimulator.options chanmod` option when running the rfsimulator. `channelmod` command has its own help:
|
||||
|
||||
```
|
||||
$ telnet 127.0.0.1 9090
|
||||
Trying 127.0.0.1...
|
||||
Connected to 127.0.0.1.
|
||||
Escape character is '^]'.
|
||||
|
||||
softmodem_enb> help
|
||||
.....................................
|
||||
module 6 = channelmod:
|
||||
channelmod help
|
||||
channelmod show <predef,current>
|
||||
channelmod modify <channelid> <param> <value>
|
||||
module 7 = rfsimu:
|
||||
rfsimu setmodel <model name> <model type>
|
||||
softmodem_enb> channelmod help
|
||||
channelmod commands can be used to display or modify channel models parameters
|
||||
channelmod show predef: display predefined model algorithms available in oai
|
||||
channelmod show current: display the currently used models in the running executable
|
||||
channelmod modify <model index> <param name> <param value>: set the specified parameters in a current model to the given value
|
||||
<model index> specifies the model, the show current model command can be used to list the current models indexes
|
||||
<param name> can be one of "riceanf", "aoa", "randaoa", "ploss", "noise_power_dB", "offset", "forgetf"
|
||||
softmodem_enb>
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The [rfsimulator documentation](../../../../targets/ARCH/rfsimulator/README.md ) has also some specific information when using the channel simulation via this tool.
|
||||
|
||||
[channel simulation main page](channel_simulation.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
@@ -39,7 +39,7 @@ double **cos_lut=NULL,* *sin_lut=NULL;
|
||||
|
||||
|
||||
|
||||
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,int scs) {
|
||||
double delta_f,freq; // 90 kHz spacing
|
||||
double delay;
|
||||
int16_t f;
|
||||
@@ -52,7 +52,7 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
|
||||
cos_lut = (double **)malloc(n_samples*sizeof(double *));
|
||||
sin_lut = (double **)malloc(n_samples*sizeof(double *));
|
||||
delta_f = nb_rb*180000/(n_samples-1);
|
||||
delta_f = nb_rb*12*scs*1000/(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
|
||||
@@ -67,14 +67,14 @@ 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]);
|
||||
// printf("values cos:%f, sin:%f\n", cos_lut[f+(n_samples>>1)][l], sin_lut[f+(n_samples>>1)][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,int scs) {
|
||||
int16_t f,f2,d;
|
||||
uint8_t aarx,aatx,l;
|
||||
double *clut,*slut;
|
||||
@@ -95,14 +95,14 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
// 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)
|
||||
if (init_freq_channel(desc,nb_rb,n_samples_max,scs)==0)
|
||||
freq_channel_init=1;
|
||||
else
|
||||
return(-1);
|
||||
}
|
||||
|
||||
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);
|
||||
// printf("no_samples=%d, n_samples_max=%d, d=%d,nb_taps %d\n",n_samples,n_samples_max,d,desc->nb_taps);
|
||||
start_meas(&desc->interp_freq);
|
||||
|
||||
for (f=-n_samples_max/2,f2=-n_samples/2; f<n_samples_max/2; f+=d,f2++) {
|
||||
@@ -111,14 +111,15 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<desc->nb_tx; aatx++) {
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x=0.0;
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y=0.0;
|
||||
AssertFatal(n_samples/2+f2 < (2+(275*12)),"reading past chF %d (n_samples %d, f2 %d)\n",n_samples/2+f2,n_samples,f2);
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].r=0.0;
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].i=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]+
|
||||
desc->a[l][aarx+(aatx*desc->nb_rx)].y*clut[l]);
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].r+=(desc->a[l][aarx+(aatx*desc->nb_rx)].r*clut[l]+
|
||||
desc->a[l][aarx+(aatx*desc->nb_rx)].i*slut[l]);
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].i+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].r*slut[l]+
|
||||
desc->a[l][aarx+(aatx*desc->nb_rx)].i*clut[l]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,42 +139,42 @@ double compute_pbch_sinr(channel_desc_t *desc,
|
||||
uint16_t f;
|
||||
uint8_t aarx,aatx;
|
||||
double S;
|
||||
struct complex S_i1;
|
||||
struct complex S_i2;
|
||||
struct complexd S_i1;
|
||||
struct complexd S_i2;
|
||||
avg_sinr=0.0;
|
||||
|
||||
// printf("nb_rb %d\n",nb_rb);
|
||||
for (f=(nb_rb-6); f<(nb_rb+6); f++) {
|
||||
S = 0.0;
|
||||
S_i1.x =0.0;
|
||||
S_i1.y =0.0;
|
||||
S_i2.x =0.0;
|
||||
S_i2.y =0.0;
|
||||
S_i1.r =0.0;
|
||||
S_i1.i =0.0;
|
||||
S_i2.r =0.0;
|
||||
S_i2.i =0.0;
|
||||
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<desc->nb_tx; aatx++) {
|
||||
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
// printf("%d %d chF[%d] => (%f,%f)\n",aarx,aatx,f,desc->chF[aarx+(aatx*desc->nb_rx)][f].x,desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
|
||||
if (desc_i1) {
|
||||
S_i1.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S_i1.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x);
|
||||
S_i1.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
S_i1.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r);
|
||||
}
|
||||
|
||||
if (desc_i2) {
|
||||
S_i2.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S_i2.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x);
|
||||
S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// printf("snr %f f %d : S %f, S_i1 %f, S_i2 %f\n",snr,f-nb_rb,S,snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y),snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y));
|
||||
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y)+snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y)));
|
||||
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.r*S_i1.r + S_i1.i*S_i1.i)+snr_i2*sqrt(S_i2.r*S_i2.r + S_i2.i*S_i2.i)));
|
||||
}
|
||||
|
||||
// printf("avg_sinr %f (%f,%f,%f)\n",avg_sinr/12.0,snr,snr_i1,snr_i2);
|
||||
@@ -191,42 +192,42 @@ double compute_sinr(channel_desc_t *desc,
|
||||
uint16_t f;
|
||||
uint8_t aarx,aatx;
|
||||
double S;
|
||||
struct complex S_i1;
|
||||
struct complex S_i2;
|
||||
struct complexd S_i1;
|
||||
struct complexd S_i2;
|
||||
DevAssert( nb_rb > 0 );
|
||||
avg_sinr=0.0;
|
||||
|
||||
// printf("nb_rb %d\n",nb_rb);
|
||||
for (f=0; f<2*nb_rb; f++) {
|
||||
S = 0.0;
|
||||
S_i1.x =0.0;
|
||||
S_i1.y =0.0;
|
||||
S_i2.x =0.0;
|
||||
S_i2.y =0.0;
|
||||
S_i1.r =0.0;
|
||||
S_i1.i =0.0;
|
||||
S_i2.r =0.0;
|
||||
S_i2.i =0.0;
|
||||
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<desc->nb_tx; aatx++) {
|
||||
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
|
||||
if (desc_i1) {
|
||||
S_i1.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S_i1.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x);
|
||||
S_i1.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
S_i1.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r);
|
||||
}
|
||||
|
||||
if (desc_i2) {
|
||||
S_i2.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S_i2.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x);
|
||||
S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
S_i2.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// printf("f %d : S %f, S_i1 %f, S_i2 %f\n",f-nb_rb,snr*S,snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y),snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y));
|
||||
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y)+snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y)));
|
||||
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.r*S_i1.r + S_i1.i*S_i1.i)+snr_i2*sqrt(S_i2.r*S_i2.r + S_i2.i*S_i2.i)));
|
||||
}
|
||||
|
||||
// printf("avg_sinr %f (%f,%f,%f)\n",avg_sinr/12.0,snr,snr_i1,snr_i2);
|
||||
|
||||
@@ -70,16 +70,16 @@ void do_DL_sig(sim_t *sim,
|
||||
|
||||
double s_re0[30720];
|
||||
double s_re1[30720];
|
||||
double *s_re[2];
|
||||
double *s_re[RC.nb_RU];
|
||||
double s_im0[30720];
|
||||
double s_im1[30720];
|
||||
double *s_im[2];
|
||||
double *s_im[RC.nb_RU];
|
||||
double r_re00[30720];
|
||||
double r_re01[30720];
|
||||
double *r_re0[2];
|
||||
double *r_re0[RC.nb_RU];
|
||||
double r_im00[30720];
|
||||
double r_im01[30720];
|
||||
double *r_im0[2];
|
||||
double *r_im0[RC.nb_RU];
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
s_re[0] = s_re0;
|
||||
@@ -180,7 +180,7 @@ void do_DL_sig(sim_t *sim,
|
||||
|
||||
//RU2UE[eNB_id][UE_id]->path_loss_dB = 0;
|
||||
multipath_channel(sim->RU2UE[ru_id][UE_id][CC_id],s_re,s_im,r_re0,r_im0,
|
||||
length,hold_channel);
|
||||
length,hold_channel,0);
|
||||
#ifdef DEBUG_SIM
|
||||
rx_pwr = signal_energy_fp2(sim->RU2UE[ru_id][UE_id][CC_id]->ch[0],
|
||||
sim->RU2UE[ru_id][UE_id][CC_id]->channel_length)*sim->RU2UE[ru_id][UE_id][CC_id]->channel_length;
|
||||
@@ -320,16 +320,16 @@ void do_UL_sig(sim_t *sim,
|
||||
|
||||
double s_re0[30720];
|
||||
double s_re1[30720];
|
||||
double *s_re[2];
|
||||
double *s_re[NB_UE_INST];
|
||||
double s_im0[30720];
|
||||
double s_im1[30720];
|
||||
double *s_im[2];
|
||||
double *s_im[NB_UE_INST];
|
||||
double r_re00[30720];
|
||||
double r_re01[30720];
|
||||
double *r_re0[2];
|
||||
double *r_re0[NB_UE_INST];
|
||||
double r_im00[30720];
|
||||
double r_im01[30720];
|
||||
double *r_im0[2];
|
||||
double *r_im0[NB_UE_INST];
|
||||
|
||||
s_re[0] = s_re0;
|
||||
s_im[0] = s_im0;
|
||||
@@ -394,7 +394,7 @@ void do_UL_sig(sim_t *sim,
|
||||
|
||||
|
||||
multipath_channel(sim->UE2RU[UE_id][ru_id][CC_id],s_re,s_im,r_re0,r_im0,
|
||||
frame_parms->samples_per_tti,hold_channel);
|
||||
frame_parms->samples_per_tti,hold_channel,0);
|
||||
|
||||
|
||||
rx_pwr = signal_energy_fp2(sim->UE2RU[UE_id][ru_id][CC_id]->ch[0],
|
||||
|
||||
@@ -57,11 +57,11 @@ R22_sqrt_int(2:2:end,:,:) = imag(R22_sqrt);
|
||||
|
||||
%%
|
||||
fid = fopen('scm_corrmat.h','w');
|
||||
fprintf(fid,'double R22_sqrt[][] = {\n');
|
||||
fprintf(fid,'static double R22_sqrt[][] = {\n');
|
||||
for i=1:size(Gamma,3)
|
||||
fprintf(fid,'{');
|
||||
fprintf(fid,'%f, ',R22_sqrt_int(:,:,i));
|
||||
fprintf(fid,'\b\b},\n');
|
||||
end
|
||||
fprintf(fid,'};\n');
|
||||
fclose(fid)
|
||||
fclose(fid)
|
||||
|
||||
@@ -39,12 +39,13 @@ uint8_t multipath_channel_nosigconv(channel_desc_t *desc)
|
||||
//#define CHANNEL_SSE
|
||||
#ifdef CHANNEL_SSE
|
||||
void multipath_channel(channel_desc_t *desc,
|
||||
double tx_sig_re[2][30720*2],
|
||||
double tx_sig_im[2][30720*2],
|
||||
double rx_sig_re[2][30720*2],
|
||||
double rx_sig_im[2][30720*2],
|
||||
double tx_sig_re[NB_ANTENNAS_TX][30720*2],
|
||||
double tx_sig_im[NB_ANTENANS_TX][30720*2],
|
||||
double rx_sig_re[NB_ANTENNAS_RX][30720*2],
|
||||
double rx_sig_im[NB_ANTENNAS_RX][30720*2],
|
||||
uint32_t length,
|
||||
uint8_t keep_channel)
|
||||
uint8_t keep_channel,
|
||||
int log_channel)
|
||||
{
|
||||
|
||||
int i,ii,j,l;
|
||||
@@ -145,16 +146,17 @@ void multipath_channel(channel_desc_t *desc,
|
||||
|
||||
#else
|
||||
void multipath_channel(channel_desc_t *desc,
|
||||
double *tx_sig_re[2],
|
||||
double *tx_sig_im[2],
|
||||
double *rx_sig_re[2],
|
||||
double *rx_sig_im[2],
|
||||
double *tx_sig_re[NB_ANTENNAS_TX],
|
||||
double *tx_sig_im[NB_ANTENNAS_TX],
|
||||
double *rx_sig_re[NB_ANTENNAS_RX],
|
||||
double *rx_sig_im[NB_ANTENNAS_RX],
|
||||
uint32_t length,
|
||||
uint8_t keep_channel)
|
||||
uint8_t keep_channel,
|
||||
int log_channel)
|
||||
{
|
||||
|
||||
int i,ii,j,l;
|
||||
struct complex rx_tmp,tx;
|
||||
struct complexd rx_tmp,tx;
|
||||
|
||||
double path_loss = pow(10,desc->path_loss_dB/20);
|
||||
int dd;
|
||||
@@ -181,31 +183,37 @@ void multipath_channel(channel_desc_t *desc,
|
||||
|
||||
for (i=0; i<((int)length-dd); i++) {
|
||||
for (ii=0; ii<desc->nb_rx; ii++) {
|
||||
rx_tmp.x = 0;
|
||||
rx_tmp.y = 0;
|
||||
rx_tmp.r = 0;
|
||||
rx_tmp.i = 0;
|
||||
|
||||
for (j=0; j<desc->nb_tx; j++) {
|
||||
for (l = 0; l<(int)desc->channel_length; l++) {
|
||||
if ((i>=0) && (i-l)>=0) {
|
||||
tx.x = tx_sig_re[j][i-l];
|
||||
tx.y = tx_sig_im[j][i-l];
|
||||
tx.r = tx_sig_re[j][i-l];
|
||||
tx.i = tx_sig_im[j][i-l];
|
||||
} else {
|
||||
tx.x =0;
|
||||
tx.y =0;
|
||||
tx.r =0;
|
||||
tx.i =0;
|
||||
}
|
||||
|
||||
rx_tmp.x += (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].x) - (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].y);
|
||||
rx_tmp.y += (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].x) + (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].y);
|
||||
rx_tmp.r += (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].r) - (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].i);
|
||||
rx_tmp.i += (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].r) + (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].i);
|
||||
|
||||
if (i==0 && log_channel == 1) {
|
||||
printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].r,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].i,2.0)),
|
||||
desc->ch[ii+(j*desc->nb_rx)][l].r,
|
||||
desc->ch[ii+(j*desc->nb_rx)][l].i);
|
||||
}
|
||||
} //l
|
||||
} // j
|
||||
|
||||
rx_sig_re[ii][i+dd] = rx_tmp.x*path_loss;
|
||||
rx_sig_im[ii][i+dd] = rx_tmp.y*path_loss;
|
||||
/*
|
||||
if ((ii==0)&&((i%32)==0)) {
|
||||
printf("%p %p %f,%f => %e,%e\n",rx_sig_re[ii],rx_sig_im[ii],rx_tmp.x,rx_tmp.y,rx_sig_re[ii][i-dd],rx_sig_im[ii][i-dd]);
|
||||
}
|
||||
*/
|
||||
rx_sig_re[ii][i+dd] = rx_tmp.r*path_loss;
|
||||
rx_sig_im[ii][i+dd] = rx_tmp.i*path_loss;
|
||||
#ifdef DEBUG_CHANNEL
|
||||
if ((i%32)==0) {
|
||||
printf("rx aa %d: %p %p %f,%f => %e,%e\n",ii,rx_sig_re[ii],rx_sig_im[ii],rx_tmp.x,rx_tmp.y,rx_sig_re[ii][i-dd],rx_sig_im[ii][i-dd]);
|
||||
}
|
||||
#endif
|
||||
//rx_sig_re[ii][i] = sqrt(.5)*(tx_sig_re[0][i] + tx_sig_re[1][i]);
|
||||
//rx_sig_im[ii][i] = sqrt(.5)*(tx_sig_im[0][i] + tx_sig_im[1][i]);
|
||||
|
||||
|
||||
@@ -27,30 +27,30 @@
|
||||
#include "SIMULATION/RF/rf.h"
|
||||
#include <complex.h>
|
||||
|
||||
void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length);
|
||||
void tv_channel(channel_desc_t *desc,double complex ***H,uint32_t length);
|
||||
double frand_a_b(double a, double b);
|
||||
void tv_conv(double complex **h, double complex *x, double complex *y, uint16_t nb_samples, uint8_t nb_taps, int delay);
|
||||
void tv_conv(double complex **h, double complex *x, double complex *y, uint32_t nb_samples, uint8_t nb_taps, int delay);
|
||||
|
||||
void multipath_tv_channel(channel_desc_t *desc,
|
||||
double **tx_sig_re,
|
||||
double **tx_sig_im,
|
||||
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;
|
||||
uint32_t length,
|
||||
uint8_t keep_channel)
|
||||
{
|
||||
|
||||
double complex **tx,**rx,***H_t;
|
||||
double path_loss = pow(10,desc->path_loss_dB/20);
|
||||
int i,j,k,dd;
|
||||
int i,j,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 %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 **));
|
||||
// tv_H_t = (double complex *) malloc(length*sizeof(double complex));
|
||||
rx_temp= (double complex *) calloc(length,sizeof(double complex));
|
||||
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 **));
|
||||
|
||||
for(i=0; i<desc->nb_tx; i++) {
|
||||
tx[i] = (double complex *)calloc(length,sizeof(double complex));
|
||||
@@ -61,10 +61,10 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
}
|
||||
|
||||
for(i=0; i<desc->nb_tx*desc->nb_rx; i++) {
|
||||
H_t[i] = (double complex **) malloc(length*sizeof(double complex *));
|
||||
H_t[i] = (double complex **)malloc(desc->nb_taps*sizeof(double complex *));
|
||||
|
||||
for(j=0; j<length; j++) {
|
||||
H_t[i][j] = (double complex *) calloc (desc->nb_taps,sizeof(double complex));
|
||||
for(j=0; j<desc->nb_taps; j++) {
|
||||
H_t[i][j] = (double complex *)calloc(length,sizeof(double complex));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,11 +82,7 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
|
||||
for(i=0; i<desc->nb_rx; i++) {
|
||||
for(j=0; j<desc->nb_tx; j++) {
|
||||
tv_conv(H_t[i+(j*desc->nb_rx)],tx[j],rx_temp,length,desc->nb_taps,dd);
|
||||
|
||||
for(k=0; k<length; k++) {
|
||||
rx[i][k] += rx_temp[k];
|
||||
}
|
||||
tv_conv(H_t[i+(j*desc->nb_rx)],tx[j],rx[i],length,desc->nb_taps,dd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,10 +93,6 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
}
|
||||
}
|
||||
|
||||
/* for(k=0;k<length;k++) {
|
||||
tv_H_t[k] = H_t[0][k][0];
|
||||
}*/
|
||||
|
||||
for(i=0; i<desc->nb_tx; i++) {
|
||||
free(tx[i]);
|
||||
}
|
||||
@@ -114,7 +106,7 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
free(rx);
|
||||
|
||||
for(i=0; i<desc->nb_rx*desc->nb_tx; i++) {
|
||||
for(j=0; j<length; j++) {
|
||||
for(j=0; j<desc->nb_taps; j++) {
|
||||
free(H_t[i][j]);
|
||||
}
|
||||
|
||||
@@ -122,20 +114,35 @@ 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) {
|
||||
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));
|
||||
void tv_channel(channel_desc_t *desc,double complex ***H,uint32_t length){
|
||||
|
||||
for(i=0; i<desc->nb_paths; i++) {
|
||||
w_Hz[i]=desc->max_Doppler*cos(frand_a_b(0,2*pi));
|
||||
phi_rad[i]=frand_a_b(0,2*pi);
|
||||
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 ***)malloc(desc->nb_rx*desc->nb_tx*sizeof(double **));
|
||||
w_Hz = (double ***)malloc(desc->nb_rx*desc->nb_tx*sizeof(double **));
|
||||
|
||||
for(i=0; i<desc->nb_tx*desc->nb_rx; i++) {
|
||||
phi_rad[i] = (double **) malloc(desc->nb_taps*sizeof(double *));
|
||||
w_Hz[i] = (double **) malloc(desc->nb_taps*sizeof(double *));
|
||||
for(j=0; j<desc->nb_taps; j++) {
|
||||
phi_rad[i][j] = (double *) malloc(desc->nb_paths*sizeof(double));
|
||||
w_Hz[i][j] = (double *) malloc(desc->nb_paths*sizeof(double));
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i<desc->nb_tx*desc->nb_rx; i++) {
|
||||
for (j = 0; j<desc->nb_taps; j++) {
|
||||
for(k=0; k<desc->nb_paths; k++) {
|
||||
w_Hz[i][j][k] = desc->max_Doppler*cos(frand_a_b(0,2*M_PI));
|
||||
phi_rad[i][j][k] = frand_a_b(0,2*M_PI);
|
||||
//printf("w_hz[%d][%d][%d]=f_d*cos(theta) = %f\n",i,j,k,w_Hz[i][j][k]);
|
||||
//printf("phi_rad[%d][%d][%d] = %f\n",i,j,k,phi_rad[i][j][k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(desc->ricean_factor == 1) {
|
||||
@@ -150,56 +157,45 @@ void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// This is the code when we only consider a SISO case
|
||||
for(i=0;i<length;i++)
|
||||
{
|
||||
for(j=0;j<desc->nb_taps;j++)
|
||||
{
|
||||
for(p=0;p<desc->nb_paths;p++)
|
||||
{
|
||||
H[i][j] += sqrt(desc->amps[j]/2)*alpha[p]*cexp(-I*(2*pi*w_Hz[p]*i*(1/(desc->sampling_rate*1e6))+phi_rad[p]));
|
||||
}
|
||||
}
|
||||
}
|
||||
for(j=0;j<desc->nb_paths;j++)
|
||||
{
|
||||
phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->sampling_rate)+phi_rad[j],2*pi);
|
||||
}
|
||||
*/
|
||||
|
||||
// if MIMO
|
||||
// SISO or MIMO
|
||||
for (i=0; i<desc->nb_rx; i++) {
|
||||
for(j=0; j<desc->nb_tx; j++) {
|
||||
for(k=0; k<length; k++) {
|
||||
for(l=0; l<desc->nb_taps; l++) {
|
||||
H[i+(j*desc->nb_rx)][k][l] = 0;
|
||||
|
||||
for(k=0; k<desc->nb_taps; k++) {
|
||||
for(l=0; l<length; l++) {
|
||||
for(p=0; p<desc->nb_paths; p++) {
|
||||
H[i+(j*desc->nb_rx)][k][l] += sqrt(desc->amps[l]/2)*alpha[p]*cexp(I*(2*pi*w_Hz[p]*k*(1/(desc->sampling_rate*1e6))+phi_rad[p]));
|
||||
H[i+(j*desc->nb_rx)][k][l] += sqrt(desc->amps[k])*alpha[p]*cexp(I*(2*pi*w_Hz[i+(j*desc->nb_rx)][k][p]*l*(1/(desc->sampling_rate*1e6))+phi_rad[i+(j*desc->nb_rx)][k][p]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(j=0; j<desc->nb_paths; j++) {
|
||||
phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->sampling_rate)+phi_rad[j],2*pi);
|
||||
//printf("H[tx%d][rx%d][k%d][l%d] = %f+j%f \n",j,i,k,0,creal(H[i+(j*desc->nb_rx)][k][0]),cimag(H[i+(j*desc->nb_rx)][k][0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//accumlate the phase
|
||||
/*for(k=0; k<desc->nb_taps; k++) {
|
||||
* for(j=0; j<desc->nb_paths; j++) {
|
||||
* desc->random_phase[k][j] = fmod(2*pi*w_Hz[k][j]*(length-1)*(1/(desc->sampling_rate*1e6))+phi_rad[k][j],2*pi);
|
||||
* }
|
||||
* }*/
|
||||
free(alpha);
|
||||
for(i=0; i<desc->nb_rx*desc->nb_tx; i++) {
|
||||
for (j=0; j<desc->nb_taps; j++) {
|
||||
free(w_Hz[i][j]);
|
||||
free(phi_rad[i][j]);
|
||||
}
|
||||
free(w_Hz[i]);
|
||||
free(phi_rad[i]);
|
||||
}
|
||||
free(w_Hz);
|
||||
free(phi_rad);
|
||||
}
|
||||
|
||||
// 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) {
|
||||
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]));
|
||||
void tv_conv(double complex **h, double complex *x, double complex *y, uint32_t nb_samples, uint8_t nb_taps, int dd)
|
||||
{
|
||||
for(int i = 0; i < ((int)nb_samples-dd); i++) {
|
||||
for(int j = 0; j < nb_taps; j++) {
|
||||
if(i >= j)
|
||||
y[i+dd] += h[j][i] * x[i-j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include "sim.h"
|
||||
|
||||
|
||||
static uint16_t LUTSin[ResolSinCos+1];
|
||||
/* linear phase noise model */
|
||||
void phase_noise(double ts, int16_t * InRe, int16_t * InIm)
|
||||
{
|
||||
static uint64_t i=0;
|
||||
int32_t x=0 ,y=0;
|
||||
double fd = 300;//0.01*30000
|
||||
int16_t SinValue = 0, CosValue= 0;
|
||||
double IdxDouble = (double)(i*fd * ts * ResolSinCos * 4);
|
||||
int16_t IdxModulo = ((int32_t)(IdxDouble>0 ? IdxDouble+0.5 : IdxDouble-0.5)) % (ResolSinCos*4);
|
||||
IdxModulo = IdxModulo<0 ? IdxModulo+ResolSinCos*4 : IdxModulo;
|
||||
|
||||
if(IdxModulo<2*ResolSinCos) {//< 2 check for 1st and 2nd
|
||||
if(IdxModulo < ResolSinCos) {// 1st Quadrant
|
||||
SinValue = LUTSin[IdxModulo];
|
||||
CosValue = LUTSin[ResolSinCos-IdxModulo];
|
||||
}
|
||||
else {// 2nd Quadrant
|
||||
SinValue = LUTSin[2*ResolSinCos-IdxModulo];
|
||||
CosValue = -LUTSin[IdxModulo-ResolSinCos];
|
||||
}
|
||||
}
|
||||
else {// 3rd and 4th Quadrant
|
||||
if(IdxModulo < 3*ResolSinCos) {// 3rd Quadrant
|
||||
SinValue = -LUTSin[IdxModulo-2*ResolSinCos];
|
||||
CosValue = -LUTSin[3*ResolSinCos-IdxModulo];
|
||||
}
|
||||
else {//4th Quadrant
|
||||
SinValue = -LUTSin[4*ResolSinCos-IdxModulo];
|
||||
CosValue = LUTSin[IdxModulo-3*ResolSinCos];
|
||||
}
|
||||
}
|
||||
x = ( ((int32_t)InRe[0] * CosValue) - ((int32_t)InIm[0] * SinValue ));
|
||||
y = ( ((int32_t)InIm[0] * CosValue) + ((int32_t)InRe[0] * SinValue ));
|
||||
InRe[0]= (int16_t)(x>>14);
|
||||
InIm[0]= (int16_t)(y>>14);
|
||||
i++;
|
||||
}
|
||||
/* Initialisation function for SIN table values */
|
||||
void InitSinLUT( void ) {
|
||||
for ( int i=0; i<(ResolSinCos+1); i++ ) {
|
||||
LUTSin[i] = sin((double)(M_PI*i)/(2*ResolSinCos)) * (1<<14); //Format: Q14
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
double R22_sqrt[6][32] = {
|
||||
static double R22_sqrt[6][32] = {
|
||||
{0.921700, -0.000000, 0.010380, -0.027448, -0.250153, 0.294754, 0.005961, 0.010769, 0.010380, 0.027448, 0.921700, 0.000000, -0.011595, -0.004130, -0.250153, 0.294754, -0.250153, -0.294754, -0.011595, 0.004130, 0.921700, 0.000000, 0.010380, -0.027448, 0.005961, -0.010769, -0.250153, -0.294754, 0.010380, 0.027448, 0.921700, 0.000000},
|
||||
{0.923810, 0.000000, 0.004069, 0.027832, 0.151730, 0.350180, -0.009882, 0.006114, 0.004069, -0.027832, 0.923810, 0.000000, 0.011218, -0.003029, 0.151730, 0.350180, 0.151730, -0.350180, 0.011218, 0.003029, 0.923810, -0.000000, 0.004069, 0.027832, -0.009882, -0.006114, 0.151730, -0.350180, 0.004069, -0.027832, 0.923810, 0.000000},
|
||||
{0.927613, 0.000000, 0.014253, 0.025767, -0.061171, -0.367133, 0.009258, -0.007340, 0.014253, -0.025767, 0.927613, -0.000000, -0.011138, -0.003942, -0.061171, -0.367133, -0.061171, 0.367133, -0.011138, 0.003942, 0.927613, 0.000000, 0.014253, 0.025767, 0.009258, 0.007340, -0.061171, 0.367133, 0.014253, -0.025767, 0.927613, 0.000000},
|
||||
@@ -27,7 +27,7 @@ double R22_sqrt[6][32] = {
|
||||
{0.919726, -0.000000, 0.038700, -0.111146, 0.217804, 0.300925, 0.045531, -0.013659, 0.038700, 0.111146, 0.919726, 0.000000, -0.027201, 0.038983, 0.217804, 0.300925, 0.217804, -0.300925, -0.027201, -0.038983, 0.919726, 0.000000, 0.038700, -0.111146, 0.045531, 0.013659, 0.217804, -0.300925, 0.038700, 0.111146, 0.919726, 0.000000},
|
||||
{0.867608, -0.000000, 0.194097, -0.112414, -0.418811, 0.095938, -0.081264, 0.075727, 0.194097, 0.112414, 0.867608, -0.000000, -0.106125, -0.032801, -0.418811, 0.095938, -0.418811, -0.095938, -0.106125, 0.032801, 0.867608, 0.000000, 0.194097, -0.112414, -0.081264, -0.075727, -0.418811, -0.095938, 0.194097, 0.112414, 0.867608, 0.000000},
|
||||
};
|
||||
double R21_sqrt[6][8] = {
|
||||
static double R21_sqrt[6][8] = {
|
||||
{0.922167, 0.000000,-0.250280, 0.294903,-0.250280, -0.294903,0.922167, 0.000000},
|
||||
{0.924238, 0.000000,0.151801, 0.350342,0.151801, -0.350342,0.924238, 0.000000},
|
||||
{0.928080, 0.000000,-0.061202, -0.367318,-0.061202, 0.367318,0.928080, 0.000000},
|
||||
@@ -35,7 +35,7 @@ double R21_sqrt[6][8] = {
|
||||
{0.927225, 0.000000,0.219580, 0.303378,0.219580, -0.303378,0.927225, 0.000000},
|
||||
{0.896133, 0.000000,-0.432581, 0.099092,-0.432581, -0.099092,0.896133, 0.000000},
|
||||
};
|
||||
double R12_sqrt[6][8] = {
|
||||
static double R12_sqrt[6][8] = {
|
||||
{0.999494, 0.000000,0.011256, -0.029765,0.011256, 0.029765,0.999494, 0.000000},
|
||||
{0.999537, 0.000000,0.004402, 0.030114,0.004402, -0.030114,0.999537, 0.000000},
|
||||
{0.999497, 0.000000,0.015358, 0.027764,0.015358, -0.027764,0.999497, 0.000000},
|
||||
|
||||
+114
-54
@@ -40,6 +40,16 @@ The present clause specifies several numerical functions for testing of digital
|
||||
|
||||
#define NB_SAMPLES_CHANNEL_OFFSET 4
|
||||
|
||||
typedef enum {
|
||||
UNSPECIFIED_MODID=0,
|
||||
RFSIMU_MODULEID=1
|
||||
} channelmod_moduleid_t;
|
||||
#define MODULEID_STR_INIT {"","rfsimulator"}
|
||||
|
||||
#define CHANMODEL_FREE_DELAY 1<<0
|
||||
#define CHANMODEL_FREE_RSQRT_6 1<<1
|
||||
#define CHANMODEL_FREE_RSQRT_NTAPS 1<<2
|
||||
#define CHANMODEL_FREE_AMPS 1<<3
|
||||
typedef struct {
|
||||
///Number of tx antennas
|
||||
uint8_t nb_tx;
|
||||
@@ -54,11 +64,11 @@ typedef struct {
|
||||
///length of impulse response. should be set to 11+2*bw*t_max
|
||||
uint8_t channel_length;
|
||||
///channel state vector. size(state) = nb_taps * (n_tx * n_rx);
|
||||
struct complex **a;
|
||||
struct complexd **a;
|
||||
///interpolated (sample-spaced) channel impulse response. size(ch) = (n_tx * n_rx) * channel_length. ATTENTION: the dimensions of ch are the transposed ones of a. This is to allow the use of BLAS when applying the correlation matrices to the state.
|
||||
struct complex **ch;
|
||||
struct complexd **ch;
|
||||
///Sampled frequency response (90 kHz resolution)
|
||||
struct complex **chF;
|
||||
struct complexd **chF;
|
||||
///Maximum path delay in mus.
|
||||
double Td;
|
||||
///Channel bandwidth in MHz.
|
||||
@@ -74,11 +84,12 @@ typedef struct {
|
||||
///in Hz. if >0 generate a channel with a Clarke's Doppler profile with a maximum Doppler bandwidth max_Doppler. CURRENTLY NOT IMPLEMENTED!
|
||||
double max_Doppler;
|
||||
///Square root of the full correlation matrix size(R_tx) = nb_taps * (n_tx * n_rx) * (n_tx * n_rx).
|
||||
struct complex **R_sqrt;
|
||||
struct complexd **R_sqrt;
|
||||
///path loss including shadow fading in dB
|
||||
double path_loss_dB;
|
||||
///additional delay of channel in samples.
|
||||
int32_t channel_offset;
|
||||
float noise_power_dB;
|
||||
///This parameter (0...1) allows for simple 1st order temporal variation. 0 means a new channel every call, 1 means keep channel constant all the time
|
||||
double forgetting_factor;
|
||||
///needs to be set to 1 for the first call, 0 otherwise.
|
||||
@@ -92,6 +103,16 @@ typedef struct {
|
||||
time_stats_t interp_time;
|
||||
time_stats_t interp_freq;
|
||||
time_stats_t convolution;
|
||||
/// index in the channel descriptors array
|
||||
unsigned int chan_idx;
|
||||
/// id of the channel modeling algorithm
|
||||
int modelid;
|
||||
/// identifies channel descriptor owner (the module which created this descriptor
|
||||
channelmod_moduleid_t module_id;
|
||||
/// name of this descriptor,used for model created from config file at init time
|
||||
char *model_name;
|
||||
/// flags to properly trigger memory free
|
||||
unsigned int free_flags;
|
||||
} channel_desc_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -160,6 +181,11 @@ typedef enum {
|
||||
EVA,
|
||||
ETU,
|
||||
MBSFN,
|
||||
TDL_A,
|
||||
TDL_B,
|
||||
TDL_C,
|
||||
TDL_D,
|
||||
TDL_E,
|
||||
Rayleigh8,
|
||||
Rayleigh1,
|
||||
Rayleigh1_800,
|
||||
@@ -190,6 +216,11 @@ typedef enum {
|
||||
{"EVA",EVA},\
|
||||
{"ETU",ETU},\
|
||||
{"MBSFN",MBSFN},\
|
||||
{"TDL_A",TDL_A},\
|
||||
{"TDL_B",TDL_B},\
|
||||
{"TDL_C",TDL_C},\
|
||||
{"TDL_D",TDL_D},\
|
||||
{"TDL_E",TDL_E},\
|
||||
{"Rayleigh8",Rayleigh8},\
|
||||
{"Rayleigh1",Rayleigh1},\
|
||||
{"Rayleigh1_800",Rayleigh1_800},\
|
||||
@@ -213,11 +244,37 @@ typedef enum {
|
||||
|
||||
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
|
||||
#define CHANNELMOD_SECTION "channelmod"
|
||||
|
||||
/* global channel modelization parameters */
|
||||
#define CHANNELMOD_MODELLIST_PARANAME "modellist"
|
||||
|
||||
#define CHANNELMOD_HELP_MODELLIST "<list name> channel list name in config file describing the model type and its parameters\n"
|
||||
#define CHANNELMOD_PARAMS_DESC { \
|
||||
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB , defdblval:25, TYPE_DOUBLE, 0},\
|
||||
{"sinr_dB", NULL , 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
|
||||
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\
|
||||
{"sinr_dB", NULL, 0, dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
|
||||
{"max_chan", "Max number of runtime models", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\
|
||||
{CHANNELMOD_MODELLIST_PARANAME, CHANNELMOD_HELP_MODELLIST, 0, strptr:(char **)&modellist_name, defstrval:"DefaultChannelList", TYPE_STRING, 60 },\
|
||||
}
|
||||
|
||||
/* parameters for one model */
|
||||
#define CHANNELMOD_MODEL_NAME_PNAME "model_name"
|
||||
#define CHANNELMOD_MODEL_TYPE_PNAME "type"
|
||||
#define CHANNELMOD_MODEL_PL_PNAME "ploss_dB"
|
||||
#define CHANNELMOD_MODEL_NP_PNAME "noise_power_dB"
|
||||
#define CHANNELMOD_MODEL_FF_PNAME "forgetfact"
|
||||
#define CHANNELMOD_MODEL_CO_PNAME "offset"
|
||||
#define CHANNELMOD_MODEL_DT_PNAME "ds_tdl"
|
||||
|
||||
#define CHANNELMOD_MODEL_PARAMS_DESC { \
|
||||
{CHANNELMOD_MODEL_NAME_PNAME, "name of the model\n", 0, strptr:NULL , defstrval:"", TYPE_STRING, 0 },\
|
||||
{CHANNELMOD_MODEL_TYPE_PNAME, "name of the model type\n", 0, strptr:NULL , defstrval:"AWGN", TYPE_STRING, 0 },\
|
||||
{CHANNELMOD_MODEL_PL_PNAME, "channel path loss in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{CHANNELMOD_MODEL_NP_PNAME, "channel noise in dB\n", 0, dblptr:NULL, defdblval:-50, TYPE_DOUBLE, 0 },\
|
||||
{CHANNELMOD_MODEL_FF_PNAME, "channel forget factor ((0 to 1)\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{CHANNELMOD_MODEL_CO_PNAME, "channel offset in samps\n", 0, iptr:NULL, defintval:0, TYPE_INT, 0 },\
|
||||
{CHANNELMOD_MODEL_DT_PNAME, "delay spread for TDL models\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 }\
|
||||
}
|
||||
|
||||
#include "platform_constants.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -243,39 +300,38 @@ typedef struct {
|
||||
} sim_t;
|
||||
|
||||
|
||||
/**
|
||||
\brief This routine initializes a new channel descriptor
|
||||
\param nb_tx Number of TX antennas
|
||||
\param nb_rx Number of RX antennas
|
||||
\param nb_taps Number of taps
|
||||
\param channel_length Length of the interpolated channel impulse response
|
||||
\param amps Linear amplitudes of the taps (length(amps)=channel_length). The values should sum up to 1.
|
||||
\param delays Delays of the taps. If delays==NULL the taps are assumed to be spaced equidistantly between 0 and t_max.
|
||||
\param R_sqrt Channel correlation matrix. If R_sqrt==NULL, no channel correlation is applied.
|
||||
\param Td Maximum path delay in mus.
|
||||
\param BW Channel bandwidth in MHz.
|
||||
\param ricean_factor Ricean factor applied to all taps.
|
||||
\param aoa Anlge of arrival
|
||||
\param forgetting_factor This parameter (0...1) allows for simple 1st order temporal variation
|
||||
\param max_Doppler This is the maximum Doppler frequency for Jakes' Model
|
||||
\param channel_offset This is a time delay to apply to channel
|
||||
\param path_loss_dB This is the path loss in dB
|
||||
\param random_aoa If set to 1, AoA of ricean component is randomized
|
||||
*/
|
||||
|
||||
//channel_desc_t *new_channel_desc(uint8_t nb_tx,uint8_t nb_rx, uint8_t nb_taps, uint8_t channel_length, double *amps, double* delays, struct complex** R_sqrt, double Td, double BW, double ricean_factor, double aoa, double forgetting_factor, double max_Doppler, int32_t channel_offset, double path_loss_dB,uint8_t random_aoa);
|
||||
|
||||
channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
uint8_t nb_rx,
|
||||
SCM_t channel_model,
|
||||
double sampling_rate,
|
||||
double channel_bandwidth,
|
||||
double TDL_DS,
|
||||
double forgetting_factor,
|
||||
int32_t channel_offset,
|
||||
double path_loss_dB);
|
||||
double path_loss_dB,
|
||||
float noise_power_dB);
|
||||
|
||||
channel_desc_t *find_channel_desc_fromname( char *modelname );
|
||||
|
||||
|
||||
/**
|
||||
\brief free memory allocated for a model descriptor
|
||||
\param ch points to the model, which cannot be used after calling this fuction
|
||||
*/
|
||||
void free_channel_desc_scm(channel_desc_t *ch);
|
||||
|
||||
/**
|
||||
\brief This set the ownerid of a model descriptor, can be later used to check what module created a channel model
|
||||
\param cdesc points to the model descriptor
|
||||
\param module_id identifies the channel model. should be define as a macro in simu.h
|
||||
*/
|
||||
void set_channeldesc_owner(channel_desc_t *cdesc, channelmod_moduleid_t module_id);
|
||||
/**
|
||||
\brief This function set a model name to a model descriptor, can be later used to identify a allocated channel model
|
||||
\param cdesc points to the model descriptor
|
||||
\param module_name is the C string to use as model name for the channel pointed by cdesc
|
||||
*/
|
||||
void set_channeldesc_name(channel_desc_t *cdesc,char *modelname);
|
||||
/** \fn void random_channel(channel_desc_t *desc)
|
||||
\brief This routine generates a random channel response (time domain) according to a tapped delay line model.
|
||||
\param desc Pointer to the channel descriptor
|
||||
@@ -283,12 +339,13 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
|
||||
|
||||
/**\fn void multipath_channel(channel_desc_t *desc,
|
||||
double tx_sig_re[2],
|
||||
double tx_sig_im[2],
|
||||
double rx_sig_re[2],
|
||||
double rx_sig_im[2],
|
||||
double tx_sig_re[NB_ANTENNAS_TX],
|
||||
double tx_sig_im[NB_ANTENANS_TX],
|
||||
double rx_sig_re[NB_ANTENNAS_RX],
|
||||
double rx_sig_im[NB_ANTENNAS_RX],
|
||||
uint32_t length,
|
||||
uint8_t keep_channel)
|
||||
uint8_t keep_channel,
|
||||
int log_channel)
|
||||
|
||||
\brief This function generates and applys a random frequency selective random channel model.
|
||||
@param desc Pointer to channel descriptor
|
||||
@@ -298,15 +355,17 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
|
||||
@param rx_sig_im output signal (imaginary component)
|
||||
@param length Length of input signal
|
||||
@param keep_channel Set to 1 to keep channel constant for null-B/F
|
||||
@param log_channel=1 make channel coefficients come out for first sample of input
|
||||
*/
|
||||
|
||||
void multipath_channel(channel_desc_t *desc,
|
||||
double *tx_sig_re[2],
|
||||
double *tx_sig_im[2],
|
||||
double *rx_sig_re[2],
|
||||
double *rx_sig_im[2],
|
||||
double *tx_sig_re[NB_ANTENNAS_TX],
|
||||
double *tx_sig_im[NB_ANTENNAS_TX],
|
||||
double *rx_sig_re[NB_ANTENNAS_RX],
|
||||
double *rx_sig_im[NB_ANTENNAS_RX],
|
||||
uint32_t length,
|
||||
uint8_t keep_channel);
|
||||
uint8_t keep_channel,
|
||||
int log_channel);
|
||||
/*
|
||||
\fn double compute_pbch_sinr(channel_desc_t *desc,
|
||||
channel_desc_t *desc_i1,
|
||||
@@ -418,38 +477,39 @@ int gauss(unsigned int *gauss_LUT,unsigned char Nbits);
|
||||
double gaussdouble(double,double);
|
||||
void randominit(unsigned int seed_init);
|
||||
double uniformrandom(void);
|
||||
int 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);
|
||||
int freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples,int scs);
|
||||
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs);
|
||||
uint8_t multipath_channel_nosigconv(channel_desc_t *desc);
|
||||
void multipath_tv_channel(channel_desc_t *desc,
|
||||
double **tx_sig_re,
|
||||
double **tx_sig_im,
|
||||
double **rx_sig_re,
|
||||
double **rx_sig_im,
|
||||
uint16_t length,
|
||||
uint32_t length,
|
||||
uint8_t keep_channel);
|
||||
|
||||
/**@} */
|
||||
/**@} */
|
||||
|
||||
void rxAddInput( struct complex16 *input_sig,
|
||||
struct complex16 *after_channel_sig,
|
||||
int rxAnt,
|
||||
channel_desc_t *channelDesc,
|
||||
int nbSamples,
|
||||
uint64_t TS,
|
||||
uint32_t CirSize
|
||||
);
|
||||
|
||||
int modelid_fromname(char *modelname);
|
||||
int modelid_fromstrtype(char *modeltype);
|
||||
double channelmod_get_snr_dB(void);
|
||||
double channelmod_get_sinr_dB(void);
|
||||
void init_channelmod(void) ;
|
||||
|
||||
int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) ;
|
||||
double N_RB2sampling_rate(uint16_t N_RB);
|
||||
double N_RB2channel_bandwidth(uint16_t N_RB);
|
||||
|
||||
#include "targets/RT/USER/rfsim.h"
|
||||
/* Linear phase noise model */
|
||||
/*!
|
||||
\brief This function produce phase noise and add to input signal
|
||||
\param ts Sampling time
|
||||
\param *Re *Im Real and Imag part of the signal
|
||||
*/
|
||||
//look-up table for the sine (cosine) function
|
||||
#define ResolSinCos 100
|
||||
void InitSinLUT( void );
|
||||
void phase_noise(double ts, int16_t * InRe, int16_t * InIm);
|
||||
|
||||
|
||||
void do_DL_sig(sim_t *sim,
|
||||
uint16_t subframe,
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
//#include "SIMULATION/TOOLS/sim.h"
|
||||
|
||||
|
||||
unsigned int s0, s1, s2, b;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user