Commit 3b4a5f25 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge remote-tracking branch 'origin/develop' into enhancement-64-phy_test

Conflicts:
	openair1/SCHED/phy_procedures_lte_ue.c
	targets/SIMU/USER/oaisim_functions.c
parents 61203648 46fb7bb3
......@@ -12,7 +12,7 @@ trap handle_ctrl_c INT
source $OPENAIR_DIR/cmake_targets/tools/test_helper
#SUDO="sudo -E "
SUDO="sudo -E -S"
tdir=$OPENAIR_DIR/cmake_targets/autotests
rm -fr $tdir/bin
mkdir -p $tdir/bin
......@@ -404,14 +404,12 @@ until [ -z "$1" ]
esac
done
if [ "$SET_PASSWORD" == "1" ]; then
mypassword=$passwd
else
read -s -p "Enter Password: " mypassword
if [ "$SET_PASSWORD" != "1" ]; then
read -s -p "Enter Password: " passwd
fi
tmpfile=`mktemp`
echo \'$passwd\' | $SUDO echo $HOME >& $tmpfile
echo $passwd | $SUDO echo $HOME > $tmpfile
tstsudo=`cat $tmpfile`
if [ "$tstsudo" != "$HOME" ]; then
echo "$USER might not have sudo privileges. Exiting"
......@@ -509,7 +507,7 @@ for search_expr in "${test_case_array[@]}"
if [ "$class" == "compilation" ]; then
test_compile "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags"
elif [ "$class" == "execution" ]; then
$SUDO killall -q oaisim_nos1
echo \'passwd\' | $SUDO killall -q oaisim_nos1
test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$mypassword" "$test_config_file"
else
echo "Unexpected class of test case...Skipping the test case $name ...."
......
This diff is collapsed.
......@@ -42,13 +42,13 @@ THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
source $THIS_SCRIPT_PATH/tools/build_helper
MSC_GEN="False"
XFORMS="False"
XFORMS="True"
PRINT_STATS="False"
VCD_TIMING="False"
LOWLATENCY_FLAG_USER="False"
FORCE_LOWLATENCY_FLAG_USER=""
REL="Rel10"
HW="EXMIMO"
HW="None"
TP="None"
NOS1=0
EPC=0
......@@ -91,7 +91,7 @@ Options
default is Rel10,
Rel8 limits the implementation to 3GPP Release 8 version
-w | --hardware
EXMIMO (Default), USRP, BLADERF, LMSSDR, None
EXMIMO, USRP, BLADERF, ETHERNET, LMSSDR, None (Default)
Adds this RF board support (in external packages installation and in compilation)
-t | --transport protocol
ETHERNET , None
......@@ -760,9 +760,9 @@ fi
rm -fr $OPENAIR_DIR/cmake_targets/autotests/log
mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
if [ "$RUN_GROUP" -eq "1" ]; then
$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" -p '$mypassword' >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" -p $mypassword >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
else
$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -p '$mypassword' >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -p $mypassword >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
fi
wait
else
......
......@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(XFORMS True)
set(DEBUG_PHY False)
set(MU_RECIEVER False)
......
......@@ -38,23 +38,16 @@ extern int card;
#endif
void
phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id)
phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
{
uint16_t rx_power_fil_dB;
#ifdef EXMIMO
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
uint16_t i;
#endif
int rssi;
rssi = dB_fixed(phy_vars_ue->PHY_measurements.rssi);
if (rssi>0) rx_power_fil_dB = rssi;
else rx_power_fil_dB = phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id];
LOG_D(PHY,"Gain control: rssi %d (%d,%d)\n",
rssi,
rx_power_fil_dB,
phy_vars_ue->PHY_measurements.rssi,
phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id]
);
......
......@@ -213,6 +213,7 @@ int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,floa
//! Automatic gain control
void phy_adjust_gain (PHY_VARS_UE *phy_vars_ue,
uint32_t rx_power_fil_dB,
unsigned char eNB_id);
int lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
......
......@@ -483,13 +483,10 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
*eNB_id = sync_source;
#ifdef DEBUG_PHY
msg("[PHY][UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d\n",
sync_source,peak_pos,peak_val);
LOG_D(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2);
#ifdef DEBUG_PHY
if (debug_cnt == 0) {
write_output("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
write_output("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
......
......@@ -280,7 +280,6 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
uint8_t flip_fdd_ncp,flip_fdd_ecp,flip_tdd_ncp,flip_tdd_ecp;
// uint16_t Nid_cell_fdd_ncp=0,Nid_cell_fdd_ecp=0,Nid_cell_tdd_ncp=0,Nid_cell_tdd_ecp=0;
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->lte_frame_parms;
int i;
int ret=-1;
int aarx,rx_power=0;
/*#ifdef OAI_USRP
......@@ -309,34 +308,6 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n",phy_vars_ue->Mod_id,sync_pos,phy_vars_ue->lte_ue_common_vars.eNb_id);
#endif
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
rx_power += signal_energy(&phy_vars_ue->lte_ue_common_vars.rxdata[aarx][sync_pos2],
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] = dB_fixed(rx_power/frame_parms->nb_antennas_rx);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",phy_vars_ue->Mod_id,phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] );
#endif
#ifdef EXMIMO
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
//phy_adjust_gain(phy_vars_ue,0);
gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[0],0);
#else
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain(phy_vars_ue,0);
#endif
#endif
#endif
#endif
// SSS detection
// PSS is hypothesized in last symbol of first slot in Frame
......@@ -592,6 +563,65 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
}
// gain control
if (ret!=0) { //we are not synched, so we cannot use rssi measurement (which is based on channel estimates)
rx_power = 0;
// do a measurement on the best guess of the PSS
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
rx_power += signal_energy(&phy_vars_ue->lte_ue_common_vars.rxdata[aarx][sync_pos2],
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
/*
// do a measurement on the full frame
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
rx_power += signal_energy(&phy_vars_ue->lte_ue_common_vars.rxdata[aarx][0],
frame_parms->samples_per_tti*10);
*/
// we might add a low-pass filter here later
phy_vars_ue->PHY_measurements.rx_power_avg[0] = rx_power/frame_parms->nb_antennas_rx;
phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] = dB_fixed(phy_vars_ue->PHY_measurements.rx_power_avg[0]);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",phy_vars_ue->Mod_id,phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] );
#endif
#ifdef EXMIMO
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
//phy_adjust_gain(phy_vars_ue,0);
gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[0],0);
#else
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain(phy_vars_ue,phy_vars_ue->PHY_measurements.rx_power_avg_dB[0],0);
#endif
#endif
#endif
#endif
}
else {
#ifdef EXMIMO
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
//phy_adjust_gain(phy_vars_ue,0);
gain_control_all(dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
#else
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain(phy_vars_ue,dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
#endif
#endif
#endif
#endif
}
// exit_fun("debug exit");
return ret;
}
......
......@@ -1530,13 +1530,13 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
if (phy_vars_ue->frame_rx%100==0)
gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id],0);
gain_control_all(dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
#else
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain (phy_vars_ue,0);
phy_adjust_gain (phy_vars_ue,dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
#endif
#endif
#endif
......
......@@ -61,25 +61,7 @@
extern unsigned int dlsch_tbs25[27][25],TBStable[27][110];
extern unsigned char offset_mumimo_llr_drange_fix;
#ifdef XFORMS
#include "PHY/TOOLS/lte_phy_scope.h"
#endif
//#define AWGN
//#define NO_DCI
//#define ABSTRACTION
/*
#define RBmask0 0x00fc00fc
#define RBmask1 0x0
#define RBmask2 0x0
#define RBmask3 0x0
*/
PHY_VARS_eNB *PHY_vars_eNB;
PHY_VARS_UE *PHY_vars_UE;
......@@ -237,10 +219,9 @@ int main(int argc, char **argv)
short *uncoded_ber_bit=NULL;
uint8_t N_RB_DL=25,osf=1;
frame_t frame_type = FDD;
#ifdef XFORMS
int xforms=0;
FD_lte_phy_scope_ue *form_ue;
char title[255];
#endif
uint32_t DLSCH_RB_ALLOC = 0x1fff;
int numCCE=0;
int dci_length_bytes=0,dci_length=0;
......@@ -305,7 +286,7 @@ int main(int argc, char **argv)
// num_layers = 1;
perfect_ce = 0;
while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:Y")) != -1) {
while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:XY")) != -1) {
switch (c) {
case 'a':
awgn_flag = 1;
......@@ -557,6 +538,10 @@ int main(int argc, char **argv)
break;
case 'X':
xforms=1;
break;
case 'Y':
perfect_ce=1;
break;
......@@ -636,21 +621,20 @@ int main(int argc, char **argv)
if ((transmission_mode > 1) && (n_tx != 2))
printf("n_tx must be >1 for transmission_mode %d\n",transmission_mode);
#ifdef XFORMS
fl_initialize (&argc, argv, NULL, 0, 0);
form_ue = create_lte_phy_scope_ue();
sprintf (title, "LTE PHY SCOPE eNB");
fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
if (!dual_stream_UE==0) {
openair_daq_vars.use_ia_receiver = 1;
fl_set_button(form_ue->button_0,1);
fl_set_object_label(form_ue->button_0, "IA Receiver ON");
fl_set_object_color(form_ue->button_0, FL_GREEN, FL_GREEN);
if (xforms==1) {
fl_initialize (&argc, argv, NULL, 0, 0);
form_ue = create_lte_phy_scope_ue();
sprintf (title, "LTE PHY SCOPE eNB");
fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
if (!dual_stream_UE==0) {
openair_daq_vars.use_ia_receiver = 1;
fl_set_button(form_ue->button_0,1);
fl_set_object_label(form_ue->button_0, "IA Receiver ON");
fl_set_object_color(form_ue->button_0, FL_GREEN, FL_GREEN);
}
}
#endif
if (transmission_mode==5) {
n_users = 2;
printf("dual_stream_UE=%d\n", dual_stream_UE);
......@@ -3496,13 +3480,13 @@ PMI_FEEDBACK:
// PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->round++;
}
#ifdef XFORMS
phy_scope_UE(form_ue,
PHY_vars_UE,
eNB_id,
0,// UE_id
subframe);
#endif
if (xforms==1) {
phy_scope_UE(form_ue,
PHY_vars_UE,
eNB_id,
0,// UE_id
subframe);
}
} //round
......
......@@ -52,9 +52,7 @@
#include "LAYER2/MAC/vars.h"
#include "OCG_vars.h"
#ifdef XFORMS
#include "PHY/TOOLS/lte_phy_scope.h"
#endif
extern unsigned short dftsizes[33];
extern short *ul_ref_sigs[30][2][33];
......@@ -74,12 +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 ;
#ifdef XFORMS
int xforms=0;
FD_lte_phy_scope_enb *form_enb;
char title[255];
#endif
/*the following parameters are used to control the processing times*/
double t_tx_max = -1000000000; /*!< \brief initial max process time for tx */
......@@ -204,7 +199,7 @@ int main(int argc, char **argv)
logInit();
while ((c = getopt (argc, argv, "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:L")) != -1) {
while ((c = getopt (argc, argv, "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")) != -1) {
switch (c) {
case 'a':
channel_model = AWGN;
......@@ -454,6 +449,10 @@ int main(int argc, char **argv)
max_turbo_iterations=atoi(optarg);
break;
case 'F':
xforms=1;
break;
case 'Z':
dump_table = 1;
break;
......@@ -594,12 +593,12 @@ int main(int argc, char **argv)
}
#ifdef XFORMS
fl_initialize (&argc, argv, NULL, 0, 0);
form_enb = create_lte_phy_scope_enb();
sprintf (title, "LTE PHY SCOPE eNB");
fl_show_form (form_enb->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
#endif
if (xforms==1) {
fl_initialize (&argc, argv, NULL, 0, 0);
form_enb = create_lte_phy_scope_enb();
sprintf (title, "LTE PHY SCOPE eNB");
fl_show_form (form_enb->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
}
PHY_vars_UE->lte_ue_pdcch_vars[0]->crnti = 14;
......@@ -1354,9 +1353,9 @@ int main(int argc, char **argv)
if ((errs[0]>=100) && (trials>(n_frames/2)))
break;
#ifdef XFORMS
phy_scope_eNB(form_enb,PHY_vars_eNB,0);
#endif
if (xforms==1)
phy_scope_eNB(form_enb,PHY_vars_eNB,0);
/*calculate the total processing time for each packet, get the max, min, and number of packets that exceed t>3000us*/
double t_tx = (double)PHY_vars_UE->phy_proc_tx.p_time/cpu_freq_GHz/1000.0;
......
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "10";
////////// Physical parameters:
component_carriers = (
{
frame_type = "TDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 38;
downlink_frequency = 2580000000L;
uplink_frequency_offset = 0;
Nid_cell = 0;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 25;
rx_gain = 20;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = 0;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 0;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -108;
pusch_alpha = "AL1";
pucch_p0_Nominal = -108;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 2;
rach_preambleInitialReceivedTargetPower = -100;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
}
);
////////// MME parameters:
mme_ip_address = ( { ipv4 = "0.0.0.0";
ipv6 = "0::0";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "none";
ENB_IPV4_ADDRESS_FOR_S1_MME = "0.0.0.0/24";
ENB_INTERFACE_NAME_FOR_S1U = "none";
ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24";
ENB_PORT_FOR_S1U = 2153; # Spec 2152
};
log_config :
{
global_log_level ="trace";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="trace";
phy_log_verbosity ="medium";
mac_log_level ="trace";
mac_log_verbosity ="medium";
rlc_log_level ="trace";
rlc_log_verbosity ="medium";
pdcp_log_level ="trace";
pdcp_log_verbosity ="medium";
rrc_log_level ="trace";
rrc_log_verbosity ="medium";
gtpu_log_level ="debug";
gtpu_log_verbosity ="medium";
udp_log_level ="debug";
udp_log_verbosity ="medium";
osa_log_level ="debug";
osa_log_verbosity ="low";
};
}
);
......@@ -169,8 +169,6 @@ void do_DL_sig(double **r_re0,double **r_im0,
int32_t **dl_channel_est = PHY_vars_UE_g[UE_id][CC_id]->lte_ue_common_vars.dl_ch_estimates[0];
// double scale = pow(10.0,(enb_data[att_eNB_id]->tx_power_dBm + eNB2UE[att_eNB_id][UE_id]->path_loss_dB + (double) PHY_vars_UE_g[UE_id]->rx_total_gain_dB)/20.0);
double scale = pow(10.0,(frame_parms->pdsch_config_common.referenceSignalPower+eNB2UE[att_eNB_id][UE_id][CC_id]->path_loss_dB + (double) PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB)/20.0);
//this factor is not really needed (it was actually wrong in the non abstraction mode)
//scale = scale * sqrt(512.0/300.0); //TODO: make this variable for all BWs
LOG_D(OCM,"scale =%lf (%d dB)\n",scale,(int) (20*log10(scale)));
// freq_channel(desc1,frame_parms->N_RB_DL,nb_samples);
//write_output("channel.m","ch",desc1->ch[0],desc1->channel_length,1,8);
......@@ -204,12 +202,13 @@ void do_DL_sig(double **r_re0,double **r_im0,
// calculate the SNR for the attached eNB (this assumes eNB always uses PMI stored in eNB_UE_stats; to be improved)
init_snr(eNB2UE[att_eNB_id][UE_id][CC_id], enb_data[att_eNB_id], ue_data[UE_id], PHY_vars_UE_g[UE_id][CC_id]->sinr_dB, &PHY_vars_UE_g[UE_id][CC_id]->N0,
PHY_vars_UE_g[UE_id][CC_id]->transmission_mode[att_eNB_id], PHY_vars_eNB_g[att_eNB_id][CC_id]->eNB_UE_stats[UE_id].DL_pmi_single,PHY_vars_eNB_g[att_eNB_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off);
PHY_vars_UE_g[UE_id][CC_id]->transmission_mode[att_eNB_id], PHY_vars_eNB_g[att_eNB_id][CC_id]->eNB_UE_stats[UE_id].DL_pmi_single,
PHY_vars_eNB_g[att_eNB_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off,PHY_vars_eNB_g[att_eNB_id][CC_id]->lte_frame_parms.N_RB_DL);
// calculate sinr here
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
if (att_eNB_id != eNB_id) {
calculate_sinr(eNB2UE[eNB_id][UE_id][CC_id], enb_data[eNB_id], ue_data[UE_id], PHY_vars_UE_g[UE_id][CC_id]->sinr_dB);
calculate_sinr(eNB2UE[eNB_id][UE_id][CC_id], enb_data[eNB_id], ue_data[UE_id], PHY_vars_UE_g[UE_id][CC_id]->sinr_dB,PHY_vars_eNB_g[att_eNB_id][CC_id]->lte_frame_parms.N_RB_DL);
}
}
} // hold channel
......@@ -220,18 +219,6 @@ void do_DL_sig(double **r_re0,double **r_im0,
Call do_OFDM_mod from phy_procedures_eNB_TX function
*/
//for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
// Compute RX signal for UE = UE_id
/*
for (i=0;i<(frame_parms->samples_per_tti>>1);i++) {
for (aa=0;aa<nb_antennas_rx;aa++) {
r_re[aa][i]=0.0;
r_im[aa][i]=0.0;
}
}
*/
// printf("r_re[0] %p\n",r_re[0]);
for (aa=0; aa<nb_antennas_rx; aa++) {
memset((void*)r_re[aa],0,(frame_parms->samples_per_tti>>1)*sizeof(double));
......
......@@ -75,9 +75,9 @@
#include "SCHED/defs.h"
#include "SCHED/vars.h"
#ifdef XFORMS
//#ifdef XFORMS
#include "PHY/TOOLS/lte_phy_scope.h"
#endif
//#endif
#ifdef SMBV
// Rohde&Schwarz SMBV100A vector signal generator
......@@ -163,9 +163,10 @@ extern uint16_t Nid_cell;
extern LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
#ifdef XFORMS
//#ifdef XFORMS
int otg_enabled;
#endif
int xforms=0;
//#endif
time_stats_t oaisim_stats;
time_stats_t oaisim_stats_f;
......@@ -446,17 +447,18 @@ l2l1_task (void *args_p)
char fname[64], vname[64];
int sf;
protocol_ctxt_t ctxt;
#ifdef XFORMS
//#ifdef XFORMS
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
// at eNB 0, an UL scope for every UE
FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX];
FD_lte_phy_scope_ue *form_ue[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX];
char title[255];
char xname[32] = "oaisim";
int xargc = 1;
char *xargv[1];
#endif
//#endif
#define PRINT_STATS
#ifdef PRINT_STATS
int len;
FILE *UE_stats[NUMBER_OF_UE_MAX];
......@@ -485,31 +487,34 @@ l2l1_task (void *args_p)
PHY_vars_eNB_g[eNB_inst][CC_id]->proc[9].frame_tx = 1;
}
#ifdef XFORMS
xargv[0] = xname;
fl_initialize (&xargc, xargv, NULL, 0, 0);
eNB_inst = 0;
for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) {
// DL scope at UEs
form_ue[UE_inst] = create_lte_phy_scope_ue();
sprintf (title, "LTE DL SCOPE eNB %d to UE %d", eNB_inst, UE_inst);
fl_show_form (form_ue[UE_inst]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
// UL scope at eNB 0
form_enb[UE_inst] = create_lte_phy_scope_enb();
sprintf (title, "LTE UL SCOPE UE %d to eNB %d", UE_inst, eNB_inst);
fl_show_form (form_enb[UE_inst]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
if (openair_daq_vars.use_ia_receiver == 1) {
fl_set_button(form_ue[UE_inst]->button_0,1);
fl_set_object_label(form_ue[UE_inst]->button_0, "IA Receiver ON");
fl_set_object_color(form_ue[UE_inst]->button_0, FL_GREEN, FL_GREEN);
//#ifdef XFORMS
if (xforms==1) {
xargv[0] = xname;
fl_initialize (&xargc, xargv, NULL, 0, 0);
eNB_inst = 0;
for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) {
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
// DL scope at UEs
form_ue[CC_id][UE_inst] = create_lte_phy_scope_ue();
sprintf (title, "LTE DL SCOPE eNB %d to UE %d CC_id %d", eNB_inst, UE_inst, CC_id);
fl_show_form (form_ue[CC_id][UE_inst]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
if (openair_daq_vars.use_ia_receiver == 1) {
fl_set_button(form_ue[CC_id][UE_inst]->button_0,1);
fl_set_object_label(form_ue[CC_id][UE_inst]->button_0, "IA Receiver ON");
fl_set_object_color(form_ue[CC_id][UE_inst]->button_0, FL_GREEN, FL_GREEN);
}
}
// UL scope at eNB 0
form_enb[UE_inst] = create_lte_phy_scope_enb();
sprintf (title, "LTE UL SCOPE UE %d to eNB %d", UE_inst, eNB_inst);
fl_show_form (form_enb[UE_inst]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
}
}
#endif
//#endif
#ifdef PRINT_STATS
......@@ -1176,23 +1181,26 @@ l2l1_task (void *args_p)
1, 1);
}
#ifdef XFORMS
//#ifdef XFORMS
if (xforms==1) {
eNB_inst = 0;
for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) {
phy_scope_UE(form_ue[UE_inst],
PHY_vars_UE_g[UE_inst][0],
eNB_inst,
UE_inst,
7);
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
phy_scope_UE(form_ue[CC_id][UE_inst],
PHY_vars_UE_g[UE_inst][CC_id],
eNB_inst,
UE_inst,
7);
}
phy_scope_eNB(form_enb[UE_inst],
PHY_vars_eNB_g[eNB_inst][0],
UE_inst);
}
#endif
}
//#endif
#ifdef SMBV
......
......@@ -62,9 +62,9 @@ void extract_position(node_list* input_node_list, node_desc_t**, int nb_nodes);/
void get_beta_map(void);//Abstraction changes
void get_MIESM_param(void);
void init_snr(channel_desc_t *, node_desc_t *, node_desc_t *, double*, double*, uint8_t, uint16_t, uint8_t);//Abstraction changes
void init_snr(channel_desc_t *, node_desc_t *, node_desc_t *, double*, double*, uint8_t, uint16_t, uint8_t, uint16_t);//Abstraction changes
void init_snr_up(channel_desc_t *, node_desc_t *, node_desc_t *, double*, double*, uint16_t, uint16_t);//Abstraction changes
void calculate_sinr(channel_desc_t *, node_desc_t *, node_desc_t *, double *sinr_dB);//Abstraction changes
void calculate_sinr(channel_desc_t *, node_desc_t *, node_desc_t *, double *sinr_dB, uint16_t);//Abstraction changes
void get_beta_map(void);
int dlsch_abstraction_EESM(double* sinr_dB, uint32_t rb_alloc[4], uint8_t mcs, uint8_t); //temporary testing for PHY abstraction
int dlsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint32_t rb_alloc[4], uint8_t mcs,uint8_t);
......
......@@ -172,6 +172,8 @@ extern pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSe
extern time_stats_t dl_chan_stats;
extern time_stats_t ul_chan_stats;
extern int xforms;
void get_simulation_options(int argc, char *argv[])
{
int option;
......@@ -208,7 +210,9 @@ void get_simulation_options(int argc, char *argv[])
LONG_OPTION_MALLOC_TRACE_ENABLED,
LONG_OPTION_CBA_BACKOFF_TIMER,
LONG_OPTION_PHYTEST,
LONG_OPTION_XFORMS,
};
static struct option long_options[] = {
......@@ -241,6 +245,7 @@ void get_simulation_options(int argc, char *argv[])
{"cba-backoff", required_argument, 0, LONG_OPTION_CBA_BACKOFF_TIMER},
{"phy-test", no_argument, NULL, LONG_OPTION_PHYTEST},
{"xforms", no_argument, 0, LONG_OPTION_XFORMS},
{NULL, 0, NULL, 0}
};
......@@ -405,6 +410,10 @@ void get_simulation_options(int argc, char *argv[])
break;
#endif
case LONG_OPTION_XFORMS:
xforms=1;
break;
case 'a':
abstraction_flag = 1;
break;
......@@ -999,7 +1008,7 @@ void init_openair1(void)
PHY_vars_UE_g[UE_id][CC_id]->tx_power_max_dBm=23;
PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB=160;
PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB=100;
// update UE_mode for each eNB_id not just 0
if (abstraction_flag == 0)
......@@ -1282,8 +1291,7 @@ void update_ocm()
//pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE
if (eNB_id == (UE_id % NB_eNB_INST)) {
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower;
UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB = -132.24 + snr_dB -
PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower; //+20 to offset the difference in tx power of the UE wrt eNB
UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB = -132.24 + snr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower;
} else {
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower;
UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower;
......@@ -1302,6 +1310,7 @@ void update_ocm()
#ifdef OPENAIR2
void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
{
#if defined(USER_MODE) && defined(OAI_EMU)
int rrc_state=0;
......
......@@ -244,20 +244,19 @@ void calc_path_loss(node_desc_t* enb_data, node_desc_t* ue_data, channel_desc_t
void init_snr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_data, double* sinr_dB, double* N0, uint8_t transmission_mode, uint16_t q, uint8_t dl_power_off)
void init_snr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_data, double* sinr_dB, double* N0, uint8_t transmission_mode, uint16_t q, uint8_t dl_power_off, uint16_t nb_rb)
{
uint16_t nb_rb = 25; //No. of resource blocks
double thermal_noise,abs_channel,channelx, channely,channelx_i, channely_i ;
int count;
int aarx,aatx;
uint8_t qq;
/* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann's constant T = room temperature B = bandwidth */
thermal_noise = -174 + 10*log10(eNB2UE->sampling_rate*1e6); //value in dBm
/* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann's constant T = room temperature B = bandwidth*/
thermal_noise = -174 + 10*log10(15000); //per RE; value in dBm
//for (aarx=0; aarx<eNB2UE->nb_rx; aarx++)
*N0 = thermal_noise + ue_data->rx_noise_level;//? all the element have the same noise level?????
*N0 = thermal_noise + ue_data->rx_noise_level;
LOG_D(OCM,"Path loss %lf, noise (N0) %lf, signal %lf, snr %lf\n",
eNB2UE->path_loss_dB,
......@@ -549,15 +548,14 @@ void init_snr_up(channel_desc_t* UE2eNB, node_desc_t *enb_data, node_desc_t *ue_
#endif
void calculate_sinr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_data, double *sinr_dB)
void calculate_sinr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_data, double *sinr_dB, uint16_t nb_rb)
{
double sir, thermal_noise;
short nb_rb = 25; //No. of resource blocks
short count;
/* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann's constant T = room temperature B = bandwidth */
thermal_noise = -174 + 10*log10(eNB2UE->sampling_rate*1e6); //value in dBm
thermal_noise = -174 + 10*log10(15000); //per RE, value in dBm
for (count = 0; count < 12 * nb_rb; count++) {
sir = enb_data->tx_power_dBm
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment