diff --git a/targets/Makefile.common b/targets/Makefile.common
index 824c7be45025be0502f47e5618894da603b30500..c655479d175873677da981746e0cca579fe064d3 100644
--- a/targets/Makefile.common
+++ b/targets/Makefile.common
@@ -41,6 +41,7 @@ include $(COMMON_UTILS_DIR)/Makefile.inc
 include $(OPENAIR_TARGETS)/COMMON/Makefile.inc
 include $(OPENAIR2_DIR)/NAS/Makefile.inc
 
+COMMON_CFLAGS           += -DMAX_NUM_CCs=1
 ifdef USE_MME
 COMMON_CFLAGS		+= -DENABLE_USE_MME
 ENABLE_ITTI = 1
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band39.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band39.conf
index db760b97f7015501fb458351cb5985a1d7fab1fc..43201d970794e4ac25b1f8865e664e61252e83df 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band39.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band39.conf
@@ -34,8 +34,79 @@ eNBs =
     
     component_carriers = (
     		       	 {
-			 cell_id                 = 0;
-             N_RB_DL                 = 25;
+  			   frame_type					      = "TDD";	
+                           tdd_config 					      = 3;
+                           tdd_config_s            			      = 0;
+ 			   prefix_type             			      = "NORMAL";
+  			   eutra_band              			      = 39;
+                           downlink_frequency      			      = 1910000000L;
+                           uplink_frequency_offset 			      = 0;
+  
+  			   Nid_cell					      = 0;
+                           N_RB_DL                 			      = 50;
+                           Nid_cell_mbsfn          			      = 0;
+                           nb_antennas_tx          			      = 1;
+                           nb_antennas_rx          			      = 1; 
+                           prach_root              			      = 22;
+                           prach_config_index      			      = 3;
+                           prach_high_speed        			      = "DISABLE";
+  	                   prach_zero_correlation  			      = 0;
+                           prach_freq_offset       			      = 0;
+			   pucch_delta_shift       			      = 1;
+                           pucch_nRB_CQI           			      = 1;
+                           pucch_nCS_AN            			      = 0;
+                           pucch_n1_AN             			      = 32;
+                           pdsch_referenceSignalPower 			      = -24;
+                           pdsch_p_b                  			      = 0;
+                           pusch_n_SB                 			      = 1; 
+                           pusch_enable64QAM          			      = "DISABLE";
+			   pusch_hoppingMode                                  = "interSubFrame";
+			   pusch_hoppingOffset                                = 4;
+     	                   pusch_groupHoppingEnabled  			      = "DISABLE";
+	                   pusch_groupAssignment      			      = 0;
+	                   pusch_sequenceHoppingEnabled		   	      = "DISABLE";
+	                   pusch_nDMRS1                                       = 1;
+	                   phich_duration                                     = "NORMAL";
+	                   phich_resource                                     = "ONESIXTH";
+	                   srs_enable                                         = "DISABLE";
+	               /*  srs_BandwidthConfig                                =;
+	                   srs_SubframeConfig                                 =;
+	                   srs_ackNackST                                      =;
+	                   srs_MaxUpPts                                       =;*/  
+
+	                   pusch_p0_Nominal                                   = -95; 
+	                   pusch_alpha                                        = "AL08";
+	                   pucch_p0_Nominal                                   = -117;
+	                   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                          = 52;
+                           rach_preamblesGroupAConfig                         = "DISABLE";
+/*
+                           rach_sizeOfRA_PreamblesGroupA                      = ;
+                           rach_messageSizeGroupA                             = ;
+                           rach_messagePowerOffsetGroupB                      = ; 
+*/
+                           rach_powerRampingStep                              = 2;
+	                   rach_preambleInitialReceivedTargetPower            = -104;
+                           rach_preambleTransMax                              = 6;
+	                   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;
 			 }
 			 );
     
diff --git a/targets/RT/USER/Makefile b/targets/RT/USER/Makefile
index 586123b71680bee5f66692d79e15808688558144..d59b42a0a8e201279cb874805c37af025e5ddf5f 100644
--- a/targets/RT/USER/Makefile
+++ b/targets/RT/USER/Makefile
@@ -79,6 +79,8 @@ CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENA
 endif
 
 CFLAGS += -DENABLE_VCD_FIFO
+CFLAGS += -DMAX_NUM_CCs=1
+
 
 TOP_DIR = $(OPENAIR1_DIR)
 include $(OPENAIR1_DIR)/PHY/Makefile.inc
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 6daa3352fc02c15a7d76a9fe0828e8628f146455..e95d095f0476b4dca70a124f99bd92c0238cdfab 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -301,7 +301,7 @@ static int                      mbox_bounds[20] =   {8,16,24,30,38,46,54,60,68,7
 //static int                      mbox_bounds[20] =   {6,14,22,28,36,44,52,58,66,74,82,88,96,104,112,118,126,134,142, 148}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
 #endif
 
-static LTE_DL_FRAME_PARMS      *frame_parms;
+static LTE_DL_FRAME_PARMS      *frame_parms[MAX_NUM_CCs];
 
 int multi_thread=1;
 
@@ -720,7 +720,7 @@ void *l2l1_task(void *arg)
 #endif
 
 
-void do_OFDM_mod(int subframe,PHY_VARS_eNB *phy_vars_eNB) {
+void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) {
 
   unsigned int aa,slot_offset, slot_offset_F;
   int dummy_tx_b[7680*4] __attribute__((aligned(16)));
@@ -872,7 +872,7 @@ static void * eNB_thread_tx(void *param) {
     }
     
     
-    do_OFDM_mod(proc->subframe_tx,PHY_vars_eNB_g[0][proc->CC_id]);  
+    do_OFDM_mod_rt(proc->subframe_tx,PHY_vars_eNB_g[0][proc->CC_id]);  
     
     if (pthread_mutex_lock(&proc->mutex_tx) != 0) {
       printf("[openair][SCHED][eNB] error locking mutex for eNB TX proc %d\n",proc->subframe);
@@ -1370,7 +1370,7 @@ static void *eNB_thread(void *arg)
 	    LOG_I(PHY,"[eNB] Single thread slot %d\n",slot);
 	      phy_procedures_eNB_lte ((2+(slot>>1))%10, PHY_vars_eNB_g[0], 0, no_relay,NULL);
 	      for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-		do_OFDM_mod((2+(slot>>1))%10,PHY_vars_eNB_g[0][CC_id]);
+		do_OFDM_mod_rt((2+(slot>>1))%10,PHY_vars_eNB_g[0][CC_id]);
 	      }
 	  }
 	}
@@ -1814,26 +1814,28 @@ static void get_options (int argc, char **argv) {
       online_log_messages =1;
       break;
     case 'r':
-      switch(atoi(optarg)) {
-      case 6:
-	frame_parms->N_RB_DL=6;
-	frame_parms->N_RB_UL=6;
-	break;
-      case 25:
-	frame_parms->N_RB_DL=25;
-	frame_parms->N_RB_UL=25;
-	break;
-      case 50:
-	frame_parms->N_RB_DL=50;
-	frame_parms->N_RB_UL=50;
-	break;
-      case 100:
-	frame_parms->N_RB_DL=100;
-	frame_parms->N_RB_UL=100;
-	break;
-      default:
-	printf("Unknown N_RB_DL %d, switching to 25\n",atoi(optarg));
-	break;
+      for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+	switch(atoi(optarg)) {
+	case 6:
+	  frame_parms[CC_id]->N_RB_DL=6;
+	  frame_parms[CC_id]->N_RB_UL=6;
+	  break;
+	case 25:
+	  frame_parms[CC_id]->N_RB_DL=25;
+	  frame_parms[CC_id]->N_RB_UL=25;
+	  break;
+	case 50:
+	  frame_parms[CC_id]->N_RB_DL=50;
+	  frame_parms[CC_id]->N_RB_UL=50;
+	  break;
+	case 100:
+	  frame_parms[CC_id]->N_RB_DL=100;
+	  frame_parms[CC_id]->N_RB_UL=100;
+	  break;
+	default:
+	  printf("Unknown N_RB_DL %d, switching to 25\n",atoi(optarg));
+	  break;
+	}
       }
       break;
     case 's':
@@ -1877,17 +1879,18 @@ static void get_options (int argc, char **argv) {
     
     /* Update some simulation parameters */
     for (i=0; i < enb_properties->number; i++) {
-      
-      frame_parms->frame_type =       enb_properties->properties[i]->frame_type;
-      frame_parms->tdd_config =       enb_properties->properties[i]->tdd_config;
-      frame_parms->tdd_config_S =     enb_properties->properties[i]->tdd_config_s;
-      frame_parms->Ncp =              enb_properties->properties[i]->prefix_type;
-
-      //for (j=0; j < enb_properties->properties[i]->nb_cc; j++ ){ 
-	frame_parms->Nid_cell          =  enb_properties->properties[i]->cell_id[0];
-	frame_parms->N_RB_DL          =  enb_properties->properties[i]->N_RB_DL[0];
+      for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+	frame_parms[CC_id]->frame_type =       enb_properties->properties[i]->frame_type[CC_id];
+	frame_parms[CC_id]->tdd_config =       enb_properties->properties[i]->tdd_config[CC_id];
+	frame_parms[CC_id]->tdd_config_S =     enb_properties->properties[i]->tdd_config_s[CC_id];
+	frame_parms[CC_id]->Ncp =              enb_properties->properties[i]->prefix_type[CC_id];
+	
+	//for (j=0; j < enb_properties->properties[i]->nb_cc; j++ ){ 
+	frame_parms[CC_id]->Nid_cell          =  enb_properties->properties[i]->cell_id[CC_id];
+	frame_parms[CC_id]->N_RB_DL          =  enb_properties->properties[i]->N_RB_DL[CC_id];
 	//} // j
-    
+      }
+
       glog_level                     = enb_properties->properties[i]->glog_level;
       glog_verbosity                 = enb_properties->properties[i]->glog_verbosity;
       hw_log_level                   = enb_properties->properties[i]->hw_log_level;
@@ -1956,16 +1959,18 @@ int main(int argc, char **argv) {
 
   mode = normal_txrx;
 
-  frame_parms = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS));
-  /* Set some default values that may be overwritten while reading options */
-  frame_parms->frame_type         = TDD; /* TDD */
-  frame_parms->tdd_config         = 3;
-  frame_parms->tdd_config_S       = 0;
-  frame_parms->N_RB_DL            = 25;
-  frame_parms->N_RB_UL            = 25;
-  frame_parms->Ncp                = NORMAL;
-  frame_parms->Ncp_UL             = NORMAL;
-  frame_parms->Nid_cell           = Nid_cell;
+  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+    frame_parms[CC_id] = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS));
+    /* Set some default values that may be overwritten while reading options */
+    frame_parms[CC_id]->frame_type         = TDD; /* TDD */
+    frame_parms[CC_id]->tdd_config          = 3;
+    frame_parms[CC_id]->tdd_config_S        = 0;
+    frame_parms[CC_id]->N_RB_DL             = 25;
+    frame_parms[CC_id]->N_RB_UL             = 25;
+    frame_parms[CC_id]->Ncp                = NORMAL;
+    frame_parms[CC_id]->Ncp_UL              = NORMAL;
+    frame_parms[CC_id]->Nid_cell            = Nid_cell;
+  }
 
   get_options (argc, argv); //Command-line options
 
@@ -2065,60 +2070,64 @@ int main(int argc, char **argv) {
 #endif
 
   // init the parameters
-  frame_parms->nushift            = 0;
-  if (UE_flag==0)
-    {
-      switch (transmission_mode) {
-      case 1: 
-	frame_parms->nb_antennas_tx     = 1;
-	frame_parms->nb_antennas_rx     = 1;
-	break;
-      case 2:
-      case 5:
-      case 6:
-	frame_parms->nb_antennas_tx     = 2;
-	frame_parms->nb_antennas_rx     = 2;
-	break;
-      default:
-	printf("Unsupported transmission mode %d\n",transmission_mode);
-	exit(-1);
+  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+    frame_parms[CC_id]->nushift            = 0;
+    if (UE_flag==0)
+      {
+	switch (transmission_mode) {
+	case 1: 
+	  frame_parms[CC_id]->nb_antennas_tx     = 1;
+	  frame_parms[CC_id]->nb_antennas_rx     = 1;
+	  break;
+	case 2:
+	case 5:
+	case 6:
+	  frame_parms[CC_id]->nb_antennas_tx     = 2;
+	  frame_parms[CC_id]->nb_antennas_rx     = 2;
+	  break;
+	default:
+	  printf("Unsupported transmission mode %d\n",transmission_mode);
+	  exit(-1);
+	}
       }
-    }
-  else
-    { //UE_flag==1
-      frame_parms->nb_antennas_tx     = 1;
-      frame_parms->nb_antennas_rx     = 1;
-    }
-  frame_parms->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2; //initial value overwritten by initial sync later
-  frame_parms->mode1_flag         = (transmission_mode == 1) ? 1 : 0;
-  frame_parms->phich_config_common.phich_resource = oneSixth;
-  frame_parms->phich_config_common.phich_duration = normal;
-  // UL RS Config
-  frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 0;//n_DMRS1 set to 0
-  frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 0;
-  frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0;
-  frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
-  init_ul_hopping(frame_parms);
-
-  init_frame_parms(frame_parms,1);
-
-  phy_init_top(frame_parms);
-  phy_init_lte_top(frame_parms);
-
-  //init prach for openair1 test
-  frame_parms->prach_config_common.rootSequenceIndex=22; 
-  frame_parms->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=1;
-  frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0; 
-  frame_parms->prach_config_common.prach_ConfigInfo.highSpeedFlag=0;
-  frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
-  // prach_fmt = get_prach_fmt(frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, frame_parms->frame_type);
+    else
+      { //UE_flag==1
+	frame_parms[CC_id]->nb_antennas_tx     = 1;
+	frame_parms[CC_id]->nb_antennas_rx     = 1;
+      }
+    frame_parms[CC_id]->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2; //initial value overwritten by initial sync later
+    frame_parms[CC_id]->mode1_flag         = (transmission_mode == 1) ? 1 : 0;
+    frame_parms[CC_id]->phich_config_common.phich_resource = oneSixth;
+    frame_parms[CC_id]->phich_config_common.phich_duration = normal;
+    // UL RS Config
+    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 0;//n_DMRS1 set to 0
+    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 0;
+    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0;
+    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
+    init_ul_hopping(frame_parms);
+
+    init_frame_parms(frame_parms,1);
+  }
+
+  phy_init_top(frame_parms[0]);
+  phy_init_lte_top(frame_parms[0]);
+
+  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+    //init prach for openair1 test
+    frame_parms[CC_id]->prach_config_common.rootSequenceIndex=22; 
+    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=1;
+    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0; 
+    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0;
+    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
+    // prach_fmt = get_prach_fmt(frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, frame_parms->frame_type);
   // N_ZC = (prach_fmt <4)?839:139;
+  }
 
   if (UE_flag==1) {
     PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE**));
     PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_UE*)*MAX_NUM_CCs);
     for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-      PHY_vars_UE_g[CC_id][0] = init_lte_UE(frame_parms, UE_id,abstraction_flag,transmission_mode);
+      PHY_vars_UE_g[CC_id][0] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag,transmission_mode);
       
 #ifndef OPENAIR2
       for (i=0;i<NUMBER_OF_eNB_MAX;i++) {
@@ -2183,7 +2192,7 @@ int main(int argc, char **argv) {
       PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB**));
       PHY_vars_eNB_g[0] = malloc(sizeof(PHY_VARS_eNB*));
       for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-	PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms,eNB_id,Nid_cell,cooperation_flag,transmission_mode,abstraction_flag);
+	PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],eNB_id,Nid_cell,cooperation_flag,transmission_mode,abstraction_flag);
       
        
 #ifndef OPENAIR2
@@ -2220,9 +2229,9 @@ int main(int argc, char **argv) {
 
 
 
-  dump_frame_parms(frame_parms);
+  dump_frame_parms(frame_parms[0]);
 
-  if(frame_parms->N_RB_DL == 100) {
+  if(frame_parms[0]->N_RB_DL == 100) {
     sample_rate = 30.72e6;
 #ifdef USRP
     samples_per_packets = 2048;
@@ -2234,8 +2243,8 @@ int main(int argc, char **argv) {
     tx_delay = 9;
 #endif
   }
-  else if(frame_parms->N_RB_DL == 50){
-    sample_rate = 15.36e6;
+  else if(frame_parms[0]->N_RB_DL == 50){
+    sample_rate = 15.36es6;
 #ifdef USRP
     samples_per_packets = 2048;
     samples_per_frame = 153600;
@@ -2245,7 +2254,7 @@ int main(int argc, char **argv) {
     tx_delay = 4;
 #endif
   }
-  else if (frame_parms->N_RB_DL == 25) {
+  else if (frame_parms[0]->N_RB_DL == 25) {
     sample_rate = 7.68e6;
 #ifdef USRP
     samples_per_packets = 1024;
@@ -2261,8 +2270,8 @@ int main(int argc, char **argv) {
 
 
   openair0_cfg.sample_rate = sample_rate;
-  openair0_cfg.tx_num_channels = frame_parms->nb_antennas_tx;
-  openair0_cfg.rx_num_channels = frame_parms->nb_antennas_rx;
+  openair0_cfg.tx_num_channels = frame_parms[0]->nb_antennas_tx;
+  openair0_cfg.rx_num_channels = frame_parms[0]->nb_antennas_rx;
   
   for (i=0;i<4;i++) {
     if (UE_flag==1) {
@@ -2334,8 +2343,8 @@ int main(int argc, char **argv) {
       setup_ue_buffers(PHY_vars_UE_g[CC_id][0],frame_parms,ant_offset);
       printf("Setting UE buffer to all-RX\n");
       // Set LSBs for antenna switch (ExpressMIMO)
-      for (i=0; i<frame_parms->samples_per_tti*10; i++)
-	for (aa=0; aa<frame_parms->nb_antennas_tx; aa++)
+      for (i=0; i<frame_parms[CC_id]->samples_per_tti*10; i++)
+	for (aa=0; aa<frame_parms[CC_id]]->nb_antennas_tx; aa++)
 	  PHY_vars_UE_g[CC_id][0]->lte_ue_common_vars.txdata[aa][i] = 0x00010001;
     }
     //p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
@@ -2345,8 +2354,8 @@ int main(int argc, char **argv) {
       setup_eNB_buffers(PHY_vars_eNB_g[CC_id][0],frame_parms,ant_offset);
       printf("Setting eNB buffer to all-RX\n");
       // Set LSBs for antenna switch (ExpressMIMO)
-      for (i=0; i<frame_parms->samples_per_tti*10; i++)
-	for (aa=0; aa<frame_parms->nb_antennas_tx; aa++)
+      for (i=0; i<frame_parms[CC_id]->samples_per_tti*10; i++)
+	for (aa=0; aa<frame_parms[CC_id]->nb_antennas_tx; aa++)
 	  PHY_vars_eNB_g[CC_id][0]->lte_eNB_common_vars.txdata[0][aa][i] = 0x00010001;
     }
   }
@@ -2642,30 +2651,30 @@ int main(int argc, char **argv) {
   return 0;
 }
 
-void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier) {
+void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS **frame_parms, int carrier) {
 
   int i;
 #ifndef USRP
   if (phy_vars_ue) {
-    if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
+    if ((frame_parms[0]->nb_antennas_rx>1) && (carrier>0)) {
       printf("RX antennas > 1 and carrier > 0 not possible\n");
       exit(-1);
     }
 
-    if ((frame_parms->nb_antennas_tx>1) && (carrier>0)) {
+    if ((frame_parms[0]->nb_antennas_tx>1) && (carrier>0)) {
       printf("TX antennas > 1 and carrier > 0 not possible\n");
       exit(-1);
     }
     
     // replace RX signal buffers with mmaped HW versions
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
+    for (i=0;i<frame_parms[0]->nb_antennas_rx;i++) {
       free(phy_vars_ue->lte_ue_common_vars.rxdata[i]);
       phy_vars_ue->lte_ue_common_vars.rxdata[i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
 
 
       printf("rxdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.rxdata[i]);
     }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
+    for (i=0;i<frame_parms[0]->nb_antennas_tx;i++) {
       free(phy_vars_ue->lte_ue_common_vars.txdata[i]);
       phy_vars_ue->lte_ue_common_vars.txdata[i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
 
@@ -2677,7 +2686,7 @@ void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms,
 #endif
 }
 
-void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier) {
+void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS **frame_parms, int carrier) {
 
   int i;
 #ifdef USRP
@@ -2687,18 +2696,18 @@ void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_par
 #endif
 
   if (phy_vars_eNB) {
-    if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
+    if ((frame_parms[0]->nb_antennas_rx>1) && (carrier>0)) {
       printf("RX antennas > 1 and carrier > 0 not possible\n");
       exit(-1);
     }
 
-    if ((frame_parms->nb_antennas_tx>1) && (carrier>0)) {
+    if ((frame_parms[0]->nb_antennas_tx>1) && (carrier>0)) {
       printf("TX antennas > 1 and carrier > 0 not possible\n");
       exit(-1);
     }
 
 #ifdef USRP
-    if (frame_parms->frame_type == TDD) {
+    if (frame_parms[0]->frame_type == TDD) {
       if (phy_vars_eNB->lte_frame_parms.N_RB_DL == 100)
 	N_TA_offset = 624;
       else if (phy_vars_eNB->lte_frame_parms.N_RB_DL == 50)
@@ -2710,7 +2719,7 @@ void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_par
     
     // replace RX signal buffers with mmaped HW versions
 #ifndef USRP
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
+    for (i=0;i<frame_parms[0]->nb_antennas_rx;i++) {
       free(phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
       phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
 
@@ -2720,7 +2729,7 @@ void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_par
 	phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j] = 16-j;
       }
     }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
+    for (i=0;i<frame_parms[0]->nb_antennas_tx;i++) {
       free(phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
       phy_vars_eNB->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
 
@@ -2731,14 +2740,14 @@ void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_par
       }
     }
 #else // USRP
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
+    for (i=0;i<frame_parms[0]->nb_antennas_rx;i++) {
         free(phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
         rxdata = (int32_t*)malloc16(samples_per_frame*sizeof(int32_t));
         phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i] = rxdata-N_TA_offset; // N_TA offset for TDD
         memset(rxdata, 0, samples_per_frame*sizeof(int32_t));
         printf("rxdata[%d] @ %p (%p)\n", i, phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i],rxdata);
     }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
+    for (i=0;i<frame_parms[0]->nb_antennas_tx;i++) {
         free(phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
         txdata = (int32_t*)malloc16(samples_per_frame*sizeof(int32_t));
         phy_vars_eNB->lte_eNB_common_vars.txdata[0][i] = txdata;
diff --git a/targets/RT/USER/sched_dlsch.c b/targets/RT/USER/sched_dlsch.c
index 528e667148e88c7d6eb7abb2db8253400fe3c405..bda74c3ffab4e330c6784c716014bab0bbcb1ab6 100644
--- a/targets/RT/USER/sched_dlsch.c
+++ b/targets/RT/USER/sched_dlsch.c
@@ -224,10 +224,10 @@ static void * dlsch_thread(void *param) {
 #ifdef OPENAIR2
 	mac_xface->ue_send_sdu(phy_vars_ue->Mod_id,
 			       0, // CC_id
-                           phy_vars_ue->frame,
-                           phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->b,
-                           phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->TBS>>3,
-                           eNB_id);
+			       phy_vars_ue->frame,
+			       phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->b,
+			       phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->TBS>>3,
+			       eNB_id);
 #endif
 	phy_vars_ue->total_TBS[eNB_id] =  phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->TBS + phy_vars_ue->total_TBS[eNB_id];
 	phy_vars_ue->total_received_bits[eNB_id] = phy_vars_ue->total_received_bits[eNB_id] + phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->TBS;
diff --git a/targets/SIMU/USER/Makefile b/targets/SIMU/USER/Makefile
index dc4cd726a450f64e36c9c3e10898b1c610dd4f0c..3e141ef97c1520c36ade0b7d1241169f8000dec2 100644
--- a/targets/SIMU/USER/Makefile
+++ b/targets/SIMU/USER/Makefile
@@ -124,6 +124,8 @@ else # default is rel 8
 CFLAGS += -DRel8
 endif
 
+CFLAGS += -DMAX_NUM_CCs=1
+
 ifeq ($(RLC_STOP_ON_LOST_PDU), 1)
 CFLAGS += -DRLC_STOP_ON_LOST_PDU
 endif
@@ -191,7 +193,6 @@ endif
 endif
 endif
 
-CFLAGS += -DMAX_NUM_CCs=1
 include $(OPENAIR1_DIR)/PHY/Makefile.inc
 include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
diff --git a/targets/SIMU/USER/channel_sim.c b/targets/SIMU/USER/channel_sim.c
index 6730b4e80a61079fbaba8c7ab3f20cbb49ce31f1..ba0bfc64f16090d651665fc562b936a868a26b5e 100644
--- a/targets/SIMU/USER/channel_sim.c
+++ b/targets/SIMU/USER/channel_sim.c
@@ -71,71 +71,14 @@
 #include "oaisim.h"
 
 #define RF
-//#define DEBUG_SIM
+#define DEBUG_SIM
 
 int number_rb_ul;
 int first_rbUL ;
 
 extern Signal_buffers_t *signal_buffers_g;
 
-void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms) {
 
-  int aa, slot_offset, slot_offset_F;
-
-  slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7);
-  slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
-  
-  for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
-   if (is_pmch_subframe(frame,next_slot>>1,frame_parms)) {
-      if ((next_slot%2)==0) {
-	LOG_D(OCM,"Frame %d, subframe %d: Doing MBSFN modulation (slot_offset %d)\n",frame,next_slot>>1,slot_offset); 
-	PHY_ofdm_mod(&txdataF[aa][slot_offset_F],        // input
-		     &txdata[aa][slot_offset],         // output
-		     frame_parms->log2_symbol_size,                // log2_fft_size
-		     12,                 // number of symbols
-		     frame_parms->ofdm_symbol_size>>2,               // number of prefix samples
-		     frame_parms->twiddle_ifft,  // IFFT twiddle factors
-		     frame_parms->rev,           // bit-reversal permutation
-		     CYCLIC_PREFIX);
-     
-	if (frame_parms->Ncp == EXTENDED)
-	  PHY_ofdm_mod(&txdataF[aa][slot_offset_F],        // input
-		       &txdata[aa][slot_offset],         // output
-		       frame_parms->log2_symbol_size,                // log2_fft_size
-		       2,                 // number of symbols
-		       frame_parms->nb_prefix_samples,               // number of prefix samples
-		       frame_parms->twiddle_ifft,  // IFFT twiddle factors
-		       frame_parms->rev,           // bit-reversal permutation
-		       CYCLIC_PREFIX);
-	else {
-	  LOG_D(OCM,"Frame %d, subframe %d: Doing PDCCH modulation\n",frame,next_slot>>1); 
-	  normal_prefix_mod(&txdataF[aa][slot_offset_F],
-			    &txdata[aa][slot_offset],
-			    2,
-			    frame_parms);
-	}      
-      }
-    }
-    else {
-      if (frame_parms->Ncp == EXTENDED)
-	PHY_ofdm_mod(&txdataF[aa][slot_offset_F],        // input
-		     &txdata[aa][slot_offset],         // output
-		     frame_parms->log2_symbol_size,                // log2_fft_size
-		     6,                 // number of symbols
-		     frame_parms->nb_prefix_samples,               // number of prefix samples
-		     frame_parms->twiddle_ifft,  // IFFT twiddle factors
-		     frame_parms->rev,           // bit-reversal permutation
-		     CYCLIC_PREFIX);
-      else {
-	normal_prefix_mod(&txdataF[aa][slot_offset_F],
-			  &txdata[aa][slot_offset],
-			  7,
-			  frame_parms);
-      }
-    }  
-  }
-  
-}
 
 void do_DL_sig(double **r_re0,double **r_im0,
                double **r_re,double **r_im,
@@ -162,7 +105,8 @@ void do_DL_sig(double **r_re0,double **r_im0,
   uint8_t nb_antennas_rx = eNB2UE[0][0][CC_id]->nb_rx; // number of rx antennas at UE
   uint8_t nb_antennas_tx = eNB2UE[0][0][CC_id]->nb_tx; // number of tx antennas at eNB
 
-  int subframe_sched = ((next_slot>>1) == 0) ? 9 : ((next_slot>>1)-1);
+  LTE_DL_FRAME_PARMS *fp;
+  //  int subframe_sched = ((next_slot>>1) == 0) ? 9 : ((next_slot>>1)-1);
 
   
   if (next_slot==0)
@@ -176,6 +120,7 @@ void do_DL_sig(double **r_re0,double **r_im0,
     if (!hold_channel) {
       // calculate the random channel from each eNB
       for (eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++) {
+	
         random_channel(eNB2UE[eNB_id][UE_id][CC_id],abstraction_flag);
         /*
 	for (i=0;i<eNB2UE[eNB_id][UE_id]->nb_taps;i++)
@@ -214,7 +159,7 @@ void do_DL_sig(double **r_re0,double **r_im0,
                                  eNB2UE[att_eNB_id][UE_id][CC_id]->channel_length)*eNB2UE[att_eNB_id][UE_id][CC_id]->channel_length;
       LOG_D(OCM,"Channel (CCid %d) eNB %d => UE %d : tx_power %d dBm, path_loss %f dB\n",
             CC_id,att_eNB_id,UE_id,
-            PHY_vars_eNB_g[att_eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower,
+            frame_parms->pdsch_config_common.referenceSignalPower,
             eNB2UE[att_eNB_id][UE_id][CC_id]->path_loss_dB);
 #endif
 
@@ -223,7 +168,7 @@ void do_DL_sig(double **r_re0,double **r_im0,
       channel_desc_t *desc1 = eNB2UE[att_eNB_id][UE_id][CC_id];
       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,(PHY_vars_eNB_g[att_eNB_id][CC_id]->lte_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);
+      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)));
@@ -277,14 +222,7 @@ void do_DL_sig(double **r_re0,double **r_im0,
        Call do_OFDM_mod from phy_procedures_eNB_TX function
     */
    
-    for (eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++) {
-      start_meas(&PHY_vars_eNB_g[eNB_id][CC_id]->ofdm_mod_stats);
-      do_OFDM_mod(PHY_vars_eNB_g[eNB_id][CC_id]->lte_eNB_common_vars.txdataF[0],
-		  PHY_vars_eNB_g[eNB_id][CC_id]->lte_eNB_common_vars.txdata[0],
-		  PHY_vars_eNB_g[eNB_id][CC_id]->proc[subframe_sched].frame_tx,next_slot,
-		  &PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms);
-      stop_meas(&PHY_vars_eNB_g[eNB_id][CC_id]->ofdm_mod_stats);
-    }
+
    
     //for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
       // Compute RX signal for UE = UE_id
@@ -309,7 +247,7 @@ void do_DL_sig(double **r_re0,double **r_im0,
         //	if (((double)PHY_vars_UE_g[UE_id]->tx_power_dBm +
         //	     eNB2UE[eNB_id][UE_id]->path_loss_dB) <= -107.0)
         //	  break;
-        frame_parms = &PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms;
+
         txdata = PHY_vars_eNB_g[eNB_id][CC_id]->lte_eNB_common_vars.txdata[0];
         slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
         slot_offset_meas = ((next_slot&1)==0) ? slot_offset : (slot_offset-(frame_parms->samples_per_tti>>1));
@@ -323,12 +261,14 @@ void do_DL_sig(double **r_re0,double **r_im0,
                                 frame_parms->ofdm_symbol_size,
                                 14,
                                 //				enb_data[eNB_id]->tx_power_dBm);
-                                PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower);
+                                frame_parms->pdsch_config_common.referenceSignalPower,
+				frame_parms->N_RB_DL*12);
 
 #ifdef DEBUG_SIM
-        LOG_D(OCM,"[SIM][DL] eNB %d (CCid %d): tx_pwr %f dBm, for slot %d (subframe %d)\n",
+        LOG_D(OCM,"[SIM][DL] eNB %d (CCid %d): tx_pwr %f dBm (target %f), for slot %d (subframe %d)\n",
               eNB_id,CC_id,
               10*log10(tx_pwr),
+	      frame_parms->pdsch_config_common.referenceSignalPower+10*log10(12.0*frame_parms->N_RB_DL),
               next_slot,
               next_slot>>1);
 #endif
@@ -347,15 +287,16 @@ void do_DL_sig(double **r_re0,double **r_im0,
           printf("ch(%d,%d)[%d] : (%f,%f)\n",eNB_id,UE_id,i,eNB2UE[eNB_id][UE_id][CC_id]->ch[0][i].x,eNB2UE[eNB_id][UE_id][CC_id]->ch[0][i].y);
 #endif
 
-        LOG_D(OCM,"[SIM][DL] Channel eNB %d => UE %d (CCid %d): tx_power %f dBm, path_loss %f dB\n",
+        LOG_D(OCM,"[SIM][DL] Channel eNB %d => UE %d (CCid %d): tx_power %f dBm/RE, path_loss %f dB\n",
               eNB_id,UE_id,CC_id,
-              (double)PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower,
+              (double)frame_parms->pdsch_config_common.referenceSignalPower,
               //	       enb_data[eNB_id]->tx_power_dBm,
               eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB);
 
 #ifdef DEBUG_SIM      
-        rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,512,0)*512.0/300.0;
-        LOG_D(OCM,"[SIM][DL] UE %d : rx_pwr %f dBm for slot %d (subframe %d)\n",UE_id,10*log10(rx_pwr),next_slot,next_slot>>1);
+        rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,frame_parms->ofdm_symbol_size,0)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL);
+        LOG_D(OCM,"[SIM][DL] UE %d : rx_pwr %f dBm/RE (%f dBm RSSI)for slot %d (subframe %d)\n",UE_id,10*log10(rx_pwr/12.0/(double)frame_parms->N_RB_DL),10*log10(rx_pwr),next_slot,next_slot>>1);
+        LOG_D(OCM,"[SIM][DL] UE %d : rx_pwr (noise) -132 dBm/RE (N0fs = %f dBm, N0B = %f dBm) for slot %d (subframe %d)\n",UE_id,10*log10(eNB2UE[eNB_id][UE_id][CC_id]->BW*1e6)+-174, 10*log10(eNB2UE[eNB_id][UE_id][CC_id]->BW*1e6*12*frame_parms->N_RB_DL/(double)frame_parms->ofdm_symbol_size)+-174, next_slot,next_slot>>1);
 #endif      
 
         if (eNB2UE[eNB_id][UE_id][CC_id]->first_run == 1)
@@ -364,7 +305,7 @@ void do_DL_sig(double **r_re0,double **r_im0,
 
         // RF model
 #ifdef DEBUG_SIM
-        LOG_D(OCM,"[SIM][DL] UE %d (CCid %d): rx_gain %d dB for slot %d (subframe %d)\n",UE_id,CC_id,PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB,next_slot,next_slot>>1);
+        LOG_D(OCM,"[SIM][DL] UE %d (CCid %d): rx_gain %d dB (-ADC %f) for slot %d (subframe %d)\n",UE_id,CC_id,PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB,PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB-66.227,next_slot,next_slot>>1);
 #endif
         /*
 	rf_rx(r_re0,
@@ -395,8 +336,8 @@ void do_DL_sig(double **r_re0,double **r_im0,
                      (double)PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB - 66.227);   // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
 
 #ifdef DEBUG_SIM    
-        rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,frame_parms->ofdm_symbol_size,0)*512.0/300;
-        LOG_D(OCM,"[SIM][DL] UE %d : ADC in (eNB %d) %f dB for slot %d (subframe %d)\n",
+        rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,frame_parms->ofdm_symbol_size,0);
+        LOG_D(OCM,"[SIM][DL] UE %d : ADC in (eNB %d) %f dBm for slot %d (subframe %d)\n",
                UE_id,eNB_id,
                10*log10(rx_pwr),next_slot,next_slot>>1);
 #endif    	
@@ -409,8 +350,8 @@ void do_DL_sig(double **r_re0,double **r_im0,
 
       }      
 #ifdef DEBUG_SIM    
-      rx_pwr = signal_energy_fp(r_re,r_im,nb_antennas_rx,frame_parms->ofdm_symbol_size,0)*512.0/300.0;
-      LOG_D(OCM,"[SIM][DL] UE %d : ADC in %f dB for slot %d (subframe %d)\n",UE_id,10*log10(rx_pwr),next_slot,next_slot>>1);  
+      rx_pwr = signal_energy_fp(r_re,r_im,nb_antennas_rx,frame_parms->ofdm_symbol_size,0);
+      LOG_D(OCM,"[SIM][DL] UE %d : ADC in %f dBm for slot %d (subframe %d)\n",UE_id,10*log10(rx_pwr),next_slot,next_slot>>1);  
 #endif    
 
       rxdata = PHY_vars_UE_g[UE_id][CC_id]->lte_ue_common_vars.rxdata;
@@ -426,7 +367,7 @@ void do_DL_sig(double **r_re0,double **r_im0,
 	  12);
       
 #ifdef DEBUG_SIM
-      rx_pwr2 = signal_energy(rxdata[0]+slot_offset,512)*512.0/300.0;
+      rx_pwr2 = signal_energy(rxdata[0]+slot_offset,frame_parms->ofdm_symbol_size)*(frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL));
       LOG_D(OCM,"[SIM][DL] UE %d : rx_pwr (ADC out) %f dB (%d) for slot %d (subframe %d), writing to %p\n",UE_id, 10*log10((double)rx_pwr2),rx_pwr2,next_slot,next_slot>>1,rxdata);  
 #else
       UNUSED_VARIABLE(rx_pwr2);
@@ -541,7 +482,6 @@ if (abstraction_flag!=0) {
       for (UE_id=0;UE_id<NB_UE_INST;UE_id++){
 
         txdata = PHY_vars_UE_g[UE_id][CC_id]->lte_ue_common_vars.txdata;
-        frame_parms = &PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms;
         slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
         slot_offset_meas = ((next_slot&1)==0) ? slot_offset : (slot_offset-(frame_parms->samples_per_tti>>1));
 
@@ -561,26 +501,34 @@ if (abstraction_flag!=0) {
                                   slot_offset_meas,
                                   frame_parms->ofdm_symbol_size,
                                   14,
-                                  PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm);
+                                  (double)PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm-10*log10((double)PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE),
+				  PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE);  // This make the previous argument the total power
           //ue_data[UE_id]->tx_power_dBm);
-#ifdef DEBUG_SIM
-	  LOG_D(OCM,"[SIM][UL] UE %d tx_pwr %f dBm (target %d dBm) for slot %d (subframe %d, slot_offset %d, slot_offset_meas %d)\n",UE_id,10*log10(tx_pwr),PHY_vars_UE_g[UE_id]->tx_power_dBm,next_slot,next_slot>>1,slot_offset,slot_offset_meas);
-#endif
+	  //#ifdef DEBUG_SIM
+	  LOG_D(OCM,"[SIM][UL] UE %d tx_pwr %f dBm (target %d dBm, num_RE %d) for slot %d (subframe %d, slot_offset %d, slot_offset_meas %d)\n",
+		UE_id,
+		10*log10(tx_pwr),
+		PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm,
+		PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE,
+		next_slot,next_slot>>1,slot_offset,slot_offset_meas);
+	  //#endif
 	  
 	  multipath_channel(UE2eNB[UE_id][eNB_id][CC_id],s_re,s_im,r_re0,r_im0,
 			    frame_parms->samples_per_tti>>1,hold_channel);
 
-#ifdef DEBUG_SIM	  
+	  //#ifdef DEBUG_SIM	  
           rx_pwr = signal_energy_fp2(UE2eNB[UE_id][eNB_id][CC_id]->ch[0],
                                      UE2eNB[UE_id][eNB_id][CC_id]->channel_length)*UE2eNB[UE_id][eNB_id][CC_id]->channel_length;
-          LOG_D(OCM,"[SIM][UL] slot %d Channel UE %d => eNB %d : %f dB (hold %d)\n",next_slot,UE_id,eNB_id,10*log10(rx_pwr),hold_channel);
-#endif
+          LOG_D(OCM,"[SIM][UL] slot %d Channel UE %d => eNB %d : %f dB (hold %d,length %d, PL %f)\n",next_slot,UE_id,eNB_id,10*log10(rx_pwr),
+		hold_channel,UE2eNB[UE_id][eNB_id][CC_id]->channel_length,
+		UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB);
+	  //#endif
 
-#ifdef DEBUG_SIM    
+	    //#ifdef DEBUG_SIM    
 	  rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
-	  LOG_D(OCM,"[SIM][UL] eNB %d : rx_pwr %f dB (%f) for slot %d (subframe %d), sptti %d\n",
+	  LOG_D(OCM,"[SIM][UL] eNB %d : rx_pwr %f dBm (%f) for slot %d (subframe %d), sptti %d\n",
 		 eNB_id,10*log10(rx_pwr),rx_pwr,next_slot,next_slot>>1,frame_parms->samples_per_tti);  
-#endif
+	  //#endif
 
 
           if (UE2eNB[UE_id][eNB_id][CC_id]->first_run == 1)
diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c
index ba1361c5a7d597255e6d06cf18e9ae29653d60a6..a0c8cf6a070a4acdbc99ddf3b3f61ef7438af975 100644
--- a/targets/SIMU/USER/init_lte.c
+++ b/targets/SIMU/USER/init_lte.c
@@ -109,7 +109,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
   LOG_D(PHY,"eNB %d : MCH %p\n",eNB_id,PHY_vars_eNB->dlsch_eNB_MCH);
     
 
-  PHY_vars_eNB->rx_total_gain_eNB_dB=140;
+  PHY_vars_eNB->rx_total_gain_eNB_dB=130;
   
   for(i=0;i<NUMBER_OF_UE_MAX;i++)
     PHY_vars_eNB->mu_mimo_mode[i].dl_pow_off = 2;
@@ -188,7 +188,7 @@ PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms,
   }
   return (PHY_vars_RN);
 }
-void init_lte_vars(LTE_DL_FRAME_PARMS **frame_parms,
+void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
 		   uint8_t frame_type,
 		   uint8_t tdd_config,
 		   uint8_t tdd_config_S,
@@ -206,52 +206,57 @@ void init_lte_vars(LTE_DL_FRAME_PARMS **frame_parms,
 
   LOG_I(PHY,"init lte parms: Nid_cell %d, Frame type %d, N_RB_DL %d\n",Nid_cell,frame_type,N_RB_DL);
 
-  *frame_parms = calloc(1, sizeof(LTE_DL_FRAME_PARMS));
-  (*frame_parms)->frame_type         = frame_type;
-  (*frame_parms)->tdd_config         = tdd_config;
-  (*frame_parms)->tdd_config_S       = tdd_config_S;
-  (*frame_parms)->N_RB_DL            = N_RB_DL;
-  (*frame_parms)->N_RB_UL            = (*frame_parms)->N_RB_DL;
-  (*frame_parms)->phich_config_common.phich_resource = oneSixth;
-  (*frame_parms)->phich_config_common.phich_duration = normal;
-  (*frame_parms)->Ncp                = extended_prefix_flag;
-  (*frame_parms)->Nid_cell           = Nid_cell;
-  (*frame_parms)->nushift            = (Nid_cell%6);
-  (*frame_parms)->nb_antennas_tx     = (transmission_mode == 1) ? 1 : 2;
-  (*frame_parms)->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2;
-  (*frame_parms)->nb_antennas_rx     = (transmission_mode == 1) ? 1 : 2;
-  (*frame_parms)->mode1_flag = (transmission_mode == 1) ? 1 : 0;
-
-  init_frame_parms(*frame_parms,1);
-
-  (*frame_parms)->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 0;//n_DMRS1 set to 0
-  (*frame_parms)->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 1;
-  (*frame_parms)->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0;
-  (*frame_parms)->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
-  init_ul_hopping(*frame_parms);
-
-  phy_init_top(*frame_parms);
-
-  phy_init_lte_top(*frame_parms);
+  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+    frame_parms[CC_id] = calloc(1, sizeof(LTE_DL_FRAME_PARMS));
+    (frame_parms[CC_id])->frame_type         = frame_type;
+    (frame_parms[CC_id])->tdd_config         = tdd_config;
+    (frame_parms[CC_id])->tdd_config_S       = tdd_config_S;
+    (frame_parms[CC_id])->N_RB_DL            = N_RB_DL;
+    (frame_parms[CC_id])->N_RB_UL            = (frame_parms[CC_id])->N_RB_DL;
+    (frame_parms[CC_id])->phich_config_common.phich_resource = oneSixth;
+    (frame_parms[CC_id])->phich_config_common.phich_duration = normal;
+    (frame_parms[CC_id])->Ncp                = extended_prefix_flag;
+    (frame_parms[CC_id])->Nid_cell           = Nid_cell;
+    (frame_parms[CC_id])->nushift            = (Nid_cell%6);
+    (frame_parms[CC_id])->nb_antennas_tx     = (transmission_mode == 1) ? 1 : 2;
+    (frame_parms[CC_id])->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2;
+    (frame_parms[CC_id])->nb_antennas_rx     = (transmission_mode == 1) ? 1 : 2;
+    (frame_parms[CC_id])->mode1_flag = (transmission_mode == 1) ? 1 : 0;
+    
+    init_frame_parms(frame_parms[CC_id],1);
+    
+    (frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 0;//n_DMRS1 set to 0
+    (frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 1;
+    (frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0;
+    (frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
+    init_ul_hopping(frame_parms[CC_id]);
+  } 
+
+  
+  phy_init_top(frame_parms[0]);
+  
+  phy_init_lte_top(frame_parms[0]);
 
   PHY_vars_eNB_g = (PHY_VARS_eNB***)malloc(NB_eNB_INST*sizeof(PHY_VARS_eNB**));
   for (eNB_id=0; eNB_id<NB_eNB_INST;eNB_id++){ 
     PHY_vars_eNB_g[eNB_id] = (PHY_VARS_eNB**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_eNB*));
     for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-      PHY_vars_eNB_g[eNB_id][CC_id] = init_lte_eNB(*frame_parms,eNB_id,Nid_cell,cooperation_flag,transmission_mode,abstraction_flag);
+      PHY_vars_eNB_g[eNB_id][CC_id] = init_lte_eNB(frame_parms[CC_id],eNB_id,Nid_cell,cooperation_flag,transmission_mode,abstraction_flag);
       PHY_vars_eNB_g[eNB_id][CC_id]->Mod_id=eNB_id;
       PHY_vars_eNB_g[eNB_id][CC_id]->CC_id=CC_id;
     }
   }
 
-  (*frame_parms)->nb_antennas_tx     = 1;
-  (*frame_parms)->nb_antennas_rx     = nb_antennas_rx;
 
   PHY_vars_UE_g = (PHY_VARS_UE***)malloc(NB_UE_INST*sizeof(PHY_VARS_UE**));
   for (UE_id=0; UE_id<NB_UE_INST;UE_id++){
     PHY_vars_UE_g[UE_id] = (PHY_VARS_UE**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_UE*));
     for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-      PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(*frame_parms, UE_id,abstraction_flag,transmission_mode);
+      (frame_parms[CC_id])->nb_antennas_tx     = 1;
+      (frame_parms[CC_id])->nb_antennas_rx     = nb_antennas_rx;
+
+
+      PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag,transmission_mode);
       PHY_vars_UE_g[UE_id][CC_id]->Mod_id=UE_id;
       PHY_vars_UE_g[UE_id][CC_id]->CC_id=CC_id;
     }
diff --git a/targets/SIMU/USER/init_lte.h b/targets/SIMU/USER/init_lte.h
index d0791a04140bd223a2a61b8bde3eba4ec0a34e34..0c2fcb4fdc62233ec144e90f15d2b72ffa94b32c 100644
--- a/targets/SIMU/USER/init_lte.h
+++ b/targets/SIMU/USER/init_lte.h
@@ -46,7 +46,7 @@ PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms,
 			 uint8_t RN_id,
 			 uint8_t eMBMS_active_state);
 
-void init_lte_vars(LTE_DL_FRAME_PARMS **frame_parms,
+void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
  		   uint8_t frame_type,
 		   uint8_t tdd_config,
 		   uint8_t tdd_config_S,
diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c
index 5c2eaf4940650f613017511e6d683aba20f7b706..a289cba301684ccd3826564cac86e61e31886435 100644
--- a/targets/SIMU/USER/oaisim.c
+++ b/targets/SIMU/USER/oaisim.c
@@ -25,7 +25,7 @@
   
    Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
 
- *******************************************************************************/
+*******************************************************************************/
 
 #include <string.h>
 #include <math.h>
@@ -111,11 +111,11 @@ char           smbv_ip[16];
 #define N_TRIALS              1
 
 /*
- DCI0_5MHz_TDD0_t          UL_alloc_pdu;
- DCI1A_5MHz_TDD_1_6_t      CCCH_alloc_pdu;
- DCI2_5MHz_2A_L10PRB_TDD_t DLSCH_alloc_pdu1;
- DCI2_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2;
- */
+  DCI0_5MHz_TDD0_t          UL_alloc_pdu;
+  DCI1A_5MHz_TDD_1_6_t      CCCH_alloc_pdu;
+  DCI2_5MHz_2A_L10PRB_TDD_t DLSCH_alloc_pdu1;
+  DCI2_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2;
+*/
 
 #define UL_RB_ALLOC            computeRIV(lte_frame_parms->N_RB_UL,0,24)
 #define CCCH_RB_ALLOC          computeRIV(lte_frame_parms->N_RB_UL,0,3)
@@ -159,7 +159,7 @@ extern uint8_t              abstraction_flag;
 extern uint8_t              ethernet_flag;
 extern uint16_t             Nid_cell;
 
-extern LTE_DL_FRAME_PARMS *frame_parms;
+extern LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
 
 #ifdef XFORMS
 int otg_enabled;
@@ -172,26 +172,26 @@ time_stats_t ul_chan_stats;
 
 // this should reflect the channel models in openair1/SIMULATION/TOOLS/defs.h
 mapping small_scale_names[] = {
-    {"custom", custom},
-    {"SCM_A", SCM_A},
-    {"SCM_B", SCM_B},
-    {"SCM_C", SCM_C},
-    {"SCM_D", SCM_D},
-    {"EPA", EPA},
-    {"EVA", EVA},
-    {"ETU", ETU},
-    {"MBSFN", MBSFN},
-    {"Rayleigh8", Rayleigh8},
-    {"Rayleigh1", Rayleigh1},
-    {"Rayleigh1_800", Rayleigh1_800},
-    {"Rayleigh1_corr", Rayleigh1_corr},
-    {"Rayleigh1_anticorr", Rayleigh1_anticorr},
-    {"Rice8", Rice8},
-    {"Rice1", Rice1},
-    {"Rice1_corr", Rice1_corr},
-    {"Rice1_anticorr", Rice1_anticorr},
-    {"AWGN", AWGN},
-    {NULL, -1}
+  {"custom", custom},
+  {"SCM_A", SCM_A},
+  {"SCM_B", SCM_B},
+  {"SCM_C", SCM_C},
+  {"SCM_D", SCM_D},
+  {"EPA", EPA},
+  {"EVA", EVA},
+  {"ETU", ETU},
+  {"MBSFN", MBSFN},
+  {"Rayleigh8", Rayleigh8},
+  {"Rayleigh1", Rayleigh1},
+  {"Rayleigh1_800", Rayleigh1_800},
+  {"Rayleigh1_corr", Rayleigh1_corr},
+  {"Rayleigh1_anticorr", Rayleigh1_anticorr},
+  {"Rice8", Rice8},
+  {"Rice1", Rice1},
+  {"Rice1_corr", Rice1_corr},
+  {"Rice1_anticorr", Rice1_anticorr},
+  {"AWGN", AWGN},
+  {NULL, -1}
 };
 #if !defined(ENABLE_ITTI)
 static void *sigh(void *arg);
@@ -258,12 +258,12 @@ void log_thread_init() {
   log_shutdown = 0;
 
   if ((pthread_mutex_init (&log_lock, NULL) != 0) || (pthread_cond_init (&log_notify, NULL) != 0)) {
-      return;
+    return;
   }
 
   if (pthread_create (&log_thread, NULL, log_thread_function, (void*) NULL) != 0) {
-      log_thread_finalize ();
-      return;
+    log_thread_finalize ();
+    return;
   }
 #endif
 
@@ -276,27 +276,27 @@ int log_thread_finalize() {
 #ifndef LOG_NO_THREAD
 
   if (pthread_mutex_lock (&log_lock) != 0) {
-      return -1;
+    return -1;
   }
 
   log_shutdown = 1;
 
   /* Wake up LOG thread */
   if ((pthread_cond_broadcast (&log_notify) != 0) || (pthread_mutex_unlock (&log_lock) != 0)) {
-      err = -1;
+    err = -1;
   }
   if (pthread_join (log_thread, NULL) != 0) {
-      err = -1;
+    err = -1;
   }
   if (pthread_mutex_unlock (&log_lock) != 0) {
-      err = -1;
+    err = -1;
   }
 
   if (!err) {
-      //log_list_free(&log_list);
-      pthread_mutex_lock (&log_lock);
-      pthread_mutex_destroy (&log_lock);
-      pthread_cond_destroy (&log_notify);
+    //log_list_free(&log_list);
+    pthread_mutex_lock (&log_lock);
+    pthread_mutex_destroy (&log_lock);
+    pthread_cond_destroy (&log_notify);
   }
 #endif
 
@@ -306,9 +306,9 @@ int log_thread_finalize() {
 #if defined(ENABLE_ITTI)
 static void set_cli_start(module_id_t module_idP, uint8_t start) {
   if (module_idP < NB_eNB_INST) {
-      oai_emulation.info.cli_start_enb[module_idP] = start;
+    oai_emulation.info.cli_start_enb[module_idP] = start;
   } else {
-      oai_emulation.info.cli_start_ue[module_idP - NB_eNB_INST] = start;
+    oai_emulation.info.cli_start_ue[module_idP - NB_eNB_INST] = start;
   }
 }
 #endif
@@ -319,58 +319,58 @@ int omv_write(int pfd, node_list* enb_node_list, node_list* ue_node_list, Data_F
   omv_data.end = 0;
   //omv_data.total_num_nodes = NB_UE_INST + NB_eNB_INST;
   for (i = 0; i < NB_eNB_INST; i++) {
-      if (enb_node_list != NULL) {
-          omv_data.geo[i].x = (enb_node_list->node->x_pos < 0.0) ? 0.0 : enb_node_list->node->x_pos;
-          omv_data.geo[i].y = (enb_node_list->node->y_pos < 0.0) ? 0.0 : enb_node_list->node->y_pos;
-          omv_data.geo[i].z = 1.0;
-          omv_data.geo[i].mobility_type = oai_emulation.info.omg_model_enb;
-          omv_data.geo[i].node_type = 0; //eNB
-          enb_node_list = enb_node_list->next;
-          omv_data.geo[i].Neighbors = 0;
-          for (j = NB_eNB_INST; j < NB_UE_INST + NB_eNB_INST; j++) {
-              if (is_UE_active (i, j - NB_eNB_INST) == 1) {
-                  omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors] = j;
-                  omv_data.geo[i].Neighbors++;
-                  LOG_D(
-                      OMG,
-                      "[eNB %d][UE %d] is_UE_active(i,j) %d geo (x%d, y%d) num neighbors %d\n", i, j-NB_eNB_INST, is_UE_active(i,j-NB_eNB_INST), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
-              }
-          }
+    if (enb_node_list != NULL) {
+      omv_data.geo[i].x = (enb_node_list->node->x_pos < 0.0) ? 0.0 : enb_node_list->node->x_pos;
+      omv_data.geo[i].y = (enb_node_list->node->y_pos < 0.0) ? 0.0 : enb_node_list->node->y_pos;
+      omv_data.geo[i].z = 1.0;
+      omv_data.geo[i].mobility_type = oai_emulation.info.omg_model_enb;
+      omv_data.geo[i].node_type = 0; //eNB
+      enb_node_list = enb_node_list->next;
+      omv_data.geo[i].Neighbors = 0;
+      for (j = NB_eNB_INST; j < NB_UE_INST + NB_eNB_INST; j++) {
+	if (is_UE_active (i, j - NB_eNB_INST) == 1) {
+	  omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors] = j;
+	  omv_data.geo[i].Neighbors++;
+	  LOG_D(
+		OMG,
+		"[eNB %d][UE %d] is_UE_active(i,j) %d geo (x%d, y%d) num neighbors %d\n", i, j-NB_eNB_INST, is_UE_active(i,j-NB_eNB_INST), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
+	}
       }
+    }
   }
   for (i = NB_eNB_INST; i < NB_UE_INST + NB_eNB_INST; i++) {
-      if (ue_node_list != NULL) {
-          omv_data.geo[i].x = (ue_node_list->node->x_pos < 0.0) ? 0.0 : ue_node_list->node->x_pos;
-          omv_data.geo[i].y = (ue_node_list->node->y_pos < 0.0) ? 0.0 : ue_node_list->node->y_pos;
-          omv_data.geo[i].z = 1.0;
-          omv_data.geo[i].mobility_type = oai_emulation.info.omg_model_ue;
-          omv_data.geo[i].node_type = 1; //UE
-          //trial
-          omv_data.geo[i].state = 1;
-          omv_data.geo[i].rnti = 88;
-          omv_data.geo[i].connected_eNB = 0;
-          omv_data.geo[i].RSRP = 66;
-          omv_data.geo[i].RSRQ = 55;
-          omv_data.geo[i].Pathloss = 44;
-          omv_data.geo[i].RSSI[0] = 33;
-          omv_data.geo[i].RSSI[1] = 22;
-          if ((sizeof(omv_data.geo[0].RSSI) / sizeof(omv_data.geo[0].RSSI[0])) > 2)
-            {
-              omv_data.geo[i].RSSI[2] = 11;
-            }
-
-          ue_node_list = ue_node_list->next;
-          omv_data.geo[i].Neighbors = 0;
-          for (j = 0; j < NB_eNB_INST; j++) {
-              if (is_UE_active (j, i - NB_eNB_INST) == 1) {
-                  omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors] = j;
-                  omv_data.geo[i].Neighbors++;
-                  LOG_D(
-                      OMG,
-                      "[UE %d][eNB %d] is_UE_active  %d geo (x%d, y%d) num neighbors %d\n", i-NB_eNB_INST, j, is_UE_active(j,i-NB_eNB_INST), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
-              }
-          }
+    if (ue_node_list != NULL) {
+      omv_data.geo[i].x = (ue_node_list->node->x_pos < 0.0) ? 0.0 : ue_node_list->node->x_pos;
+      omv_data.geo[i].y = (ue_node_list->node->y_pos < 0.0) ? 0.0 : ue_node_list->node->y_pos;
+      omv_data.geo[i].z = 1.0;
+      omv_data.geo[i].mobility_type = oai_emulation.info.omg_model_ue;
+      omv_data.geo[i].node_type = 1; //UE
+      //trial
+      omv_data.geo[i].state = 1;
+      omv_data.geo[i].rnti = 88;
+      omv_data.geo[i].connected_eNB = 0;
+      omv_data.geo[i].RSRP = 66;
+      omv_data.geo[i].RSRQ = 55;
+      omv_data.geo[i].Pathloss = 44;
+      omv_data.geo[i].RSSI[0] = 33;
+      omv_data.geo[i].RSSI[1] = 22;
+      if ((sizeof(omv_data.geo[0].RSSI) / sizeof(omv_data.geo[0].RSSI[0])) > 2)
+	{
+	  omv_data.geo[i].RSSI[2] = 11;
+	}
+
+      ue_node_list = ue_node_list->next;
+      omv_data.geo[i].Neighbors = 0;
+      for (j = 0; j < NB_eNB_INST; j++) {
+	if (is_UE_active (j, i - NB_eNB_INST) == 1) {
+	  omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors] = j;
+	  omv_data.geo[i].Neighbors++;
+	  LOG_D(
+		OMG,
+		"[UE %d][eNB %d] is_UE_active  %d geo (x%d, y%d) num neighbors %d\n", i-NB_eNB_INST, j, is_UE_active(j,i-NB_eNB_INST), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
+	}
       }
+    }
   }
   LOG_E(OMG, "pfd %d \n", pfd);
   if (write (pfd, &omv_data, sizeof(struct Data_Flow_Unit)) == -1)
@@ -401,11 +401,11 @@ static module_id_t RN_id    = 0;
 Packet_OTG_List_t *otg_pdcp_buffer;
 
 typedef enum l2l1_task_state_e
-{
-  L2L1_WAITTING,
-  L2L1_RUNNING,
-  L2L1_TERMINATED,
-} l2l1_task_state_t;
+  {
+    L2L1_WAITTING,
+    L2L1_RUNNING,
+    L2L1_TERMINATED,
+  } l2l1_task_state_t;
 
 l2l1_task_state_t     l2l1_state = L2L1_WAITTING;
 
@@ -467,50 +467,50 @@ void *l2l1_task(void *args_p) {
   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);
-      }
+    // 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);
+    }
 
   }
 #endif
 
 #ifdef PRINT_STATS
   for (UE_inst=0;UE_inst<NB_UE_INST;UE_inst++) {
-      sprintf(UE_stats_filename,"UE_stats%d.txt",UE_inst);
-      UE_stats[UE_inst] = fopen (UE_stats_filename, "w");
+    sprintf(UE_stats_filename,"UE_stats%d.txt",UE_inst);
+    UE_stats[UE_inst] = fopen (UE_stats_filename, "w");
   }
   for (eNB_inst=0;eNB_inst<NB_eNB_INST;eNB_inst++) {
-      sprintf(eNB_stats_filename,"eNB_stats%d.txt",eNB_inst);
-      eNB_stats[eNB_inst] = fopen (eNB_stats_filename, "w");
+    sprintf(eNB_stats_filename,"eNB_stats%d.txt",eNB_inst);
+    eNB_stats[eNB_inst] = fopen (eNB_stats_filename, "w");
   }
 
   if(abstraction_flag==0) {
-      for (UE_inst=0;UE_inst<NB_UE_INST;UE_inst++) {
-          sprintf(UE_stats_th_filename,"UE_stats_th%d_tx%d.txt",UE_inst,oai_emulation.info.transmission_mode);
-          UE_stats_th[UE_inst] = fopen (UE_stats_th_filename, "w");
-      }
-      sprintf(eNB_stats_th_filename,"eNB_stats_th_tx%d.txt",oai_emulation.info.transmission_mode);
-      eNB_avg_thr = fopen (eNB_stats_th_filename, "w");
+    for (UE_inst=0;UE_inst<NB_UE_INST;UE_inst++) {
+      sprintf(UE_stats_th_filename,"UE_stats_th%d_tx%d.txt",UE_inst,oai_emulation.info.transmission_mode);
+      UE_stats_th[UE_inst] = fopen (UE_stats_th_filename, "w");
+    }
+    sprintf(eNB_stats_th_filename,"eNB_stats_th_tx%d.txt",oai_emulation.info.transmission_mode);
+    eNB_avg_thr = fopen (eNB_stats_th_filename, "w");
   }
   else {
-      for (UE_inst=0;UE_inst<NB_UE_INST;UE_inst++) {
-          sprintf(UE_stats_th_filename,"UE_stats_abs_th%d_tx%d.txt",UE_inst,oai_emulation.info.transmission_mode);
-          UE_stats_th[UE_inst] = fopen (UE_stats_th_filename, "w");
-      }
-      sprintf(eNB_stats_th_filename,"eNB_stats_abs_th_tx%d.txt",oai_emulation.info.transmission_mode);
-      eNB_avg_thr = fopen (eNB_stats_th_filename, "w");
+    for (UE_inst=0;UE_inst<NB_UE_INST;UE_inst++) {
+      sprintf(UE_stats_th_filename,"UE_stats_abs_th%d_tx%d.txt",UE_inst,oai_emulation.info.transmission_mode);
+      UE_stats_th[UE_inst] = fopen (UE_stats_th_filename, "w");
+    }
+    sprintf(eNB_stats_th_filename,"eNB_stats_abs_th_tx%d.txt",oai_emulation.info.transmission_mode);
+    eNB_avg_thr = fopen (eNB_stats_th_filename, "w");
   }
 #ifdef OPENAIR2
   eNB_l2_stats = fopen ("eNB_l2_stats.txt", "w");
@@ -528,40 +528,40 @@ void *l2l1_task(void *args_p) {
   LOG_I(EMU, "TASK_L2L1 is READY\n");
 
   if (oai_emulation.info.nb_enb_local > 0) {
-      /* Wait for the initialize message */
-      do {
-          if (message_p != NULL) {
-              result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
-              AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
-          }
-          itti_receive_msg (TASK_L2L1, &message_p);
-          msg_name = ITTI_MSG_NAME (message_p);
-          LOG_I(EMU, "TASK_L2L1 received %s in state L2L1_WAITTING\n", msg_name);
-
-          switch (ITTI_MSG_ID(message_p)) {
-          case INITIALIZE_MESSAGE:
-            l2l1_state = L2L1_RUNNING;
-            break;
-
-          case ACTIVATE_MESSAGE:
-            set_cli_start(ITTI_MSG_INSTANCE (message_p), 1);
-            break;
-
-          case DEACTIVATE_MESSAGE:
-            set_cli_start(ITTI_MSG_INSTANCE (message_p), 0);
-            break;
-
-          case TERMINATE_MESSAGE:
-            l2l1_state = L2L1_TERMINATED;
-            break;
-
-          default:
-            LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
-            break;
-          }
-      } while (l2l1_state == L2L1_WAITTING);
-      result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
-      AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+    /* Wait for the initialize message */
+    do {
+      if (message_p != NULL) {
+	result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
+	AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+      }
+      itti_receive_msg (TASK_L2L1, &message_p);
+      msg_name = ITTI_MSG_NAME (message_p);
+      LOG_I(EMU, "TASK_L2L1 received %s in state L2L1_WAITTING\n", msg_name);
+
+      switch (ITTI_MSG_ID(message_p)) {
+      case INITIALIZE_MESSAGE:
+	l2l1_state = L2L1_RUNNING;
+	break;
+
+      case ACTIVATE_MESSAGE:
+	set_cli_start(ITTI_MSG_INSTANCE (message_p), 1);
+	break;
+
+      case DEACTIVATE_MESSAGE:
+	set_cli_start(ITTI_MSG_INSTANCE (message_p), 0);
+	break;
+
+      case TERMINATE_MESSAGE:
+	l2l1_state = L2L1_TERMINATED;
+	break;
+
+      default:
+	LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
+	break;
+      }
+    } while (l2l1_state == L2L1_WAITTING);
+    result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
+    AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
   }
 #endif
   start_meas(&oaisim_stats);
@@ -570,447 +570,455 @@ void *l2l1_task(void *args_p) {
     start_meas(&oaisim_stats_f);
 
 #if defined(ENABLE_ITTI)
-      do {
-          // Checks if a message has been sent to L2L1 task
-          itti_poll_msg (TASK_L2L1, &message_p);
-
-          if (message_p != NULL) {
-              msg_name = ITTI_MSG_NAME (message_p);
-              LOG_I(EMU, "TASK_L2L1 received %s\n", msg_name);
-              switch (ITTI_MSG_ID(message_p)) {
-              case ACTIVATE_MESSAGE:
-                set_cli_start(ITTI_MSG_INSTANCE (message_p), 1);
-                break;
-
-              case DEACTIVATE_MESSAGE:
-                set_cli_start(ITTI_MSG_INSTANCE (message_p), 0);
-                break;
-
-              case TERMINATE_MESSAGE:
-                l2l1_state = L2L1_TERMINATED;
-                break;
-
-              case MESSAGE_TEST:
-                break;
-
-
-              default:
-                LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
-                break;
-              }
-
-              result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
-              AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
-          }
-      } while(message_p != NULL);
+    do {
+      // Checks if a message has been sent to L2L1 task
+      itti_poll_msg (TASK_L2L1, &message_p);
+
+      if (message_p != NULL) {
+	msg_name = ITTI_MSG_NAME (message_p);
+	LOG_I(EMU, "TASK_L2L1 received %s\n", msg_name);
+	switch (ITTI_MSG_ID(message_p)) {
+	case ACTIVATE_MESSAGE:
+	  set_cli_start(ITTI_MSG_INSTANCE (message_p), 1);
+	  break;
+
+	case DEACTIVATE_MESSAGE:
+	  set_cli_start(ITTI_MSG_INSTANCE (message_p), 0);
+	  break;
+
+	case TERMINATE_MESSAGE:
+	  l2l1_state = L2L1_TERMINATED;
+	  break;
+
+	case MESSAGE_TEST:
+	  break;
+
+
+	default:
+	  LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
+	  break;
+	}
+
+	result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
+	AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+      }
+    } while(message_p != NULL);
 #endif
       
-      //Run the aperiodic user-defined events
-      if (oai_emulation.info.oeh_enabled == 1)
-	execute_events(frame);
+    //Run the aperiodic user-defined events
+    if (oai_emulation.info.oeh_enabled == 1)
+      execute_events(frame);
            
-      /*
-     // Handling the cooperation Flag
-     if (cooperation_flag == 2)
-     {
-     if ((PHY_vars_eNB_g[0]->eNB_UE_stats[0].mode == PUSCH) && (PHY_vars_eNB_g[0]->eNB_UE_stats[1].mode == PUSCH))
-     PHY_vars_eNB_g[0]->cooperation_flag = 2;
-     }
-       */
-      if (ue_connection_test == 1) {
-          if ((frame % 20) == 0) {
-              snr_dB += snr_direction;
-              sinr_dB -= snr_direction;
-          }
-          if (snr_dB == -20) {
-              snr_direction = snr_step;
-          }
-          else
-            if (snr_dB == 20) {
-                snr_direction = -snr_step;
-            }
+    /*
+    // Handling the cooperation Flag
+    if (cooperation_flag == 2)
+    {
+    if ((PHY_vars_eNB_g[0]->eNB_UE_stats[0].mode == PUSCH) && (PHY_vars_eNB_g[0]->eNB_UE_stats[1].mode == PUSCH))
+    PHY_vars_eNB_g[0]->cooperation_flag = 2;
+    }
+    */
+    if (ue_connection_test == 1) {
+      if ((frame % 20) == 0) {
+	snr_dB += snr_direction;
+	sinr_dB -= snr_direction;
       }
-
-      oai_emulation.info.frame = frame;
-      //oai_emulation.info.time_ms += 1;
-      oai_emulation.info.time_s += 0.01; // emu time in s, each frame lasts for 10 ms // JNote: TODO check the coherency of the time and frame (I corrected it to 10 (instead of 0.01)
-      // if n_frames not set by the user or is greater than max num frame then set adjust the frame counter
-      if ((oai_emulation.info.n_frames_flag == 0) || (oai_emulation.info.n_frames >= 0xffff)) {
-          frame %= (oai_emulation.info.n_frames - 1);
+      if (snr_dB == -20) {
+	snr_direction = snr_step;
       }
+      else
+	if (snr_dB == 20) {
+	  snr_direction = -snr_step;
+	}
+    }
 
-      update_omg (frame); // frequency is defined in the omg_global params configurable by the user
+    oai_emulation.info.frame = frame;
+    //oai_emulation.info.time_ms += 1;
+    oai_emulation.info.time_s += 0.01; // emu time in s, each frame lasts for 10 ms // JNote: TODO check the coherency of the time and frame (I corrected it to 10 (instead of 0.01)
+    // if n_frames not set by the user or is greater than max num frame then set adjust the frame counter
+    if ((oai_emulation.info.n_frames_flag == 0) || (oai_emulation.info.n_frames >= 0xffff)) {
+      frame %= (oai_emulation.info.n_frames - 1);
+    }
+
+    update_omg (frame); // frequency is defined in the omg_global params configurable by the user
 
-      update_omg_ocm ();
+    update_omg_ocm ();
 
 #ifdef OPENAIR2
-      // check if pipe is still open
-      if ((oai_emulation.info.omv_enabled == 1)) {
-          omv_write (pfd[1], enb_node_list, ue_node_list, omv_data);
-      }
+    // check if pipe is still open
+    if ((oai_emulation.info.omv_enabled == 1)) {
+      omv_write (pfd[1], enb_node_list, ue_node_list, omv_data);
+    }
 #endif
 #ifdef DEBUG_OMG
-/*
+    /*
       if ((((int) oai_emulation.info.time_s) % 100) == 0) {
-          for (UE_inst = oai_emulation.info.first_ue_local; UE_inst < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); UE_inst++) {
-              get_node_position (UE, UE_inst);
-          }
+      for (UE_inst = oai_emulation.info.first_ue_local; UE_inst < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); UE_inst++) {
+      get_node_position (UE, UE_inst);
       }
-*/
+      }
+    */
 #endif
 
-      update_ocm ();
+    update_ocm ();
 
-      for (slot = 0; slot < 20; slot++) {
+    for (slot = 0; slot < 20; slot++) {
 	
-          wait_for_slot_isr ();
+      wait_for_slot_isr ();
 
 #if defined(ENABLE_ITTI)
-          itti_update_lte_time(frame, slot);
+      itti_update_lte_time(frame, slot);
 #endif
 
-          last_slot = (slot - 1) % 20;
-          if (last_slot < 0)
-            last_slot += 20;
-          next_slot = (slot + 1) % 20;
+      last_slot = (slot - 1) % 20;
+      if (last_slot < 0)
+	last_slot += 20;
+      next_slot = (slot + 1) % 20;
 
-          oai_emulation.info.time_ms = frame * 10 + (slot >> 1);
+      oai_emulation.info.time_ms = frame * 10 + (slot >> 1);
 
-          direction = subframe_select (frame_parms, next_slot >> 1);
+      direction = subframe_select (frame_parms[0], next_slot >> 1);
 
 #ifdef PROC
-          if(Channel_Flag==1)
-            Channel_Func(s_re2,s_im2,r_re2,r_im2,r_re02,r_im02,r_re0_d,r_im0_d,r_re0_u,r_im0_u,eNB2UE,UE2eNB,enb_data,ue_data,abstraction_flag,frame_parms,slot);
+      if(Channel_Flag==1)
+	Channel_Func(s_re2,s_im2,r_re2,r_im2,r_re02,r_im02,r_re0_d,r_im0_d,r_re0_u,r_im0_u,eNB2UE,UE2eNB,enb_data,ue_data,abstraction_flag,frame_parms,slot);
 
-          if(Channel_Flag==0)
+      if(Channel_Flag==0)
 #endif
-            {
+	{
 #if defined(ENABLE_ITTI)
-              log_set_instance_type (LOG_INSTANCE_ENB);
+	  log_set_instance_type (LOG_INSTANCE_ENB);
 #endif
 
-              if ((next_slot % 2) == 0)
-                clear_eNB_transport_info (oai_emulation.info.nb_enb_local);
-
-              for (eNB_inst = oai_emulation.info.first_enb_local; (eNB_inst < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)); eNB_inst++) {
-		if (oai_emulation.info.cli_start_enb[eNB_inst] != 0) {
-		  LOG_D(
-			EMU,
-			"PHY procedures eNB %d for frame %d, slot %d (subframe TX %d, RX %d) TDD %d/%d Nid_cell %d\n",
-			eNB_inst,
-			frame,
-			slot,
-			next_slot >> 1,
-			last_slot>>1,
-			PHY_vars_eNB_g[eNB_inst][0]->lte_frame_parms.frame_type,
-			PHY_vars_eNB_g[eNB_inst][0]->lte_frame_parms.tdd_config,
-			PHY_vars_eNB_g[eNB_inst][0]->lte_frame_parms.Nid_cell);
-
+	  if ((next_slot % 2) == 0)
+	    clear_eNB_transport_info (oai_emulation.info.nb_enb_local);
+
+	  for (eNB_inst = oai_emulation.info.first_enb_local; (eNB_inst < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)); eNB_inst++) {
+	    if (oai_emulation.info.cli_start_enb[eNB_inst] != 0) {
+	      if ((slot&1) == 0) 
+		LOG_D(
+		      EMU,
+		      "PHY procedures eNB %d for frame %d, slot %d (subframe TX %d, RX %d) TDD %d/%d Nid_cell %d\n",
+		      eNB_inst,
+		      frame,
+		      slot,
+		      PHY_vars_eNB_g[eNB_inst][0]->proc[slot >> 1].subframe_tx,
+		      PHY_vars_eNB_g[eNB_inst][0]->proc[slot >> 1].subframe_rx,
+		      PHY_vars_eNB_g[eNB_inst][0]->lte_frame_parms.frame_type,
+		      PHY_vars_eNB_g[eNB_inst][0]->lte_frame_parms.tdd_config,
+		      PHY_vars_eNB_g[eNB_inst][0]->lte_frame_parms.Nid_cell);
+		  
 #ifdef OPENAIR2
-                      //Appliation: traffic gen
-                      update_otg_eNB (eNB_inst, oai_emulation.info.time_ms);
+	      //Appliation: traffic gen
+	      update_otg_eNB (eNB_inst, oai_emulation.info.time_ms);
 
-                      //IP/OTG to PDCP and PDCP to IP operation
-                      pdcp_run (frame, 1, 0, eNB_inst); //PHY_vars_eNB_g[eNB_id]->Mod_id
+	      //IP/OTG to PDCP and PDCP to IP operation
+	      pdcp_run (frame, 1, 0, eNB_inst); //PHY_vars_eNB_g[eNB_id]->Mod_id
 #endif
 
-                      // PHY_vars_eNB_g[eNB_id]->frame = frame;
-                      if ((slot&1) == 0) 
-			phy_procedures_eNB_lte (slot>>1,PHY_vars_eNB_g[eNB_inst], abstraction_flag, no_relay, NULL);
+	      // PHY_vars_eNB_g[eNB_id]->frame = frame;
+	      if ((slot&1) == 0) 
+		phy_procedures_eNB_lte (slot>>1,PHY_vars_eNB_g[eNB_inst], abstraction_flag, no_relay, NULL);
 
 #ifdef PRINT_STATS
-                      if(last_slot==9 && frame%10==0)
-                        if(eNB_avg_thr) 
-                          fprintf(eNB_avg_thr,"%d %d\n",PHY_vars_eNB_g[eNB_inst]->proc[slot>>1].frame_tx,
-				  (PHY_vars_eNB_g[eNB_inst]->total_system_throughput)/((PHY_vars_eNB_g[eNB_inst]->proc[slot>>1].frame_tx+1)*10));
-                      if (eNB_stats[eNB_inst]) {
-                          len = dump_eNB_stats(PHY_vars_eNB_g[eNB_inst][0], stats_buffer, 0);
-                          rewind (eNB_stats[eNB_inst]);
-                          fwrite (stats_buffer, 1, len, eNB_stats[eNB_inst]);
-                          fflush(eNB_stats[eNB_inst]);
-                      }
+	      if(last_slot==9 && frame%10==0)
+		if(eNB_avg_thr) 
+		  fprintf(eNB_avg_thr,"%d %d\n",PHY_vars_eNB_g[eNB_inst]->proc[slot>>1].frame_tx,
+			  (PHY_vars_eNB_g[eNB_inst]->total_system_throughput)/((PHY_vars_eNB_g[eNB_inst]->proc[slot>>1].frame_tx+1)*10));
+	      if (eNB_stats[eNB_inst]) {
+		len = dump_eNB_stats(PHY_vars_eNB_g[eNB_inst][0], stats_buffer, 0);
+		rewind (eNB_stats[eNB_inst]);
+		fwrite (stats_buffer, 1, len, eNB_stats[eNB_inst]);
+		fflush(eNB_stats[eNB_inst]);
+	      }
 #ifdef OPENAIR2
-                      if (eNB_l2_stats) {
-                          len = dump_eNB_l2_stats (stats_buffer, 0);
-                          rewind (eNB_l2_stats);
-                          fwrite (stats_buffer, 1, len, eNB_l2_stats);
-                          fflush(eNB_l2_stats);
-                      }
+	      if (eNB_l2_stats) {
+		len = dump_eNB_l2_stats (stats_buffer, 0);
+		rewind (eNB_l2_stats);
+		fwrite (stats_buffer, 1, len, eNB_l2_stats);
+		fflush(eNB_l2_stats);
+	      }
 #endif
 #endif
-		}
-	      }
+	    }
+	  }
 	    	    
-              // Call ETHERNET emulation here
-              //emu_transport (frame, last_slot, next_slot, direction, oai_emulation.info.frame_type, ethernet_flag);
+	  // Call ETHERNET emulation here
+	  //emu_transport (frame, last_slot, next_slot, direction, oai_emulation.info.frame_type, ethernet_flag);
 
 #if defined(ENABLE_ITTI)
-              log_set_instance_type (LOG_INSTANCE_UE);
+	  log_set_instance_type (LOG_INSTANCE_UE);
 #endif
 
-              if ((next_slot % 2) == 0)
-                clear_UE_transport_info (oai_emulation.info.nb_ue_local);
-              for (UE_inst = oai_emulation.info.first_ue_local;
-                  (UE_inst < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local)); UE_inst++) 
-		if (oai_emulation.info.cli_start_ue[UE_inst] != 0) {
+	  if ((next_slot % 2) == 0)
+	    clear_UE_transport_info (oai_emulation.info.nb_ue_local);
+	  for (UE_inst = oai_emulation.info.first_ue_local;
+	       (UE_inst < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local)); UE_inst++) {
+	    if (oai_emulation.info.cli_start_ue[UE_inst] != 0) {
 #if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
 
 #else
-                      if (frame >= (UE_inst * 20))  // activate UE only after 20*UE_id frames so that different UEs turn on separately
+	      if (frame >= (UE_inst * 20))  // activate UE only after 20*UE_id frames so that different UEs turn on separately
 #endif
-                        {
-                          LOG_D(EMU, "PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n",
-                              UE_inst,
-                              frame,
-                              slot,
-                              next_slot >> 1,
-                              last_slot>>1);
-
-                          if (PHY_vars_UE_g[UE_inst][0]->UE_mode[0] != NOT_SYNCHED) {
-                              if (frame > 0) {
-                                  PHY_vars_UE_g[UE_inst][0]->frame = frame;
+		{
+		  LOG_D(EMU, "PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n",
+			UE_inst,
+			frame,
+			slot,
+			next_slot >> 1,
+			last_slot>>1);
+
+		  if (PHY_vars_UE_g[UE_inst][0]->UE_mode[0] != NOT_SYNCHED) {
+		    if (frame > 0) {
+		      PHY_vars_UE_g[UE_inst][0]->frame = frame;
 
 #ifdef OPENAIR2
-                                  //Application
-                                  update_otg_UE (UE_inst, oai_emulation.info.time_ms);
+		      //Application
+		      update_otg_UE (UE_inst, oai_emulation.info.time_ms);
 
-                                  //Access layer
-                                  pdcp_run (frame, 0, UE_inst, 0);
+		      //Access layer
+		      pdcp_run (frame, 0, UE_inst, 0);
 #endif
-				  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-				    phy_procedures_UE_lte (last_slot, next_slot, PHY_vars_UE_g[UE_inst][CC_id], 0, abstraction_flag, normal_txrx,
-							   no_relay, NULL);
-				  }
-                                  ue_data[UE_inst]->tx_power_dBm = PHY_vars_UE_g[UE_inst][0]->tx_power_dBm;
-                              }
-                          }
-                          else {
-                              if (abstraction_flag == 1) {
-                                  LOG_E(
-                                      EMU,
-                                      "sync not supported in abstraction mode (UE%d,mode%d)\n", UE_inst, PHY_vars_UE_g[UE_inst][0]->UE_mode[0]);
-                                  exit (-1);
-                              }
-                              if ((frame > 0) && (last_slot == (LTE_SLOTS_PER_FRAME - 2))) {
-                                  initial_sync (PHY_vars_UE_g[UE_inst][0], normal_txrx);
-
-                                  /*
-                   write_output("dlchan00.m","dlch00",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][0][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
-                   if (PHY_vars_UE_g[0]->lte_frame_parms.nb_antennas_rx>1)
-                   write_output("dlchan01.m","dlch01",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][1][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
-                   write_output("dlchan10.m","dlch10",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][2][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
-                   if (PHY_vars_UE_g[0]->lte_frame_parms.nb_antennas_rx>1)
-                   write_output("dlchan11.m","dlch11",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][3][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
-                   write_output("rxsig.m","rxs",PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata[0],PHY_vars_UE_g[0]->lte_frame_parms.samples_per_tti*10,1,1);
-                   write_output("rxsigF.m","rxsF",PHY_vars_UE_g[0]->lte_ue_common_vars.rxdataF[0],2*PHY_vars_UE_g[0]->lte_frame_parms.symbols_per_tti*PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size,2,1);
-                   write_output("pbch_rxF_ext0.m","pbch_ext0",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->rxdataF_ext[0],6*12*4,1,1);
-                   write_output("pbch_rxF_comp0.m","pbch_comp0",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->rxdataF_comp[0],6*12*4,1,1);
-                   write_output("pbch_rxF_llr.m","pbch_llr",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->llr,(frame_parms->Ncp==0) ? 1920 : 1728,1,4);
-                                   */
-                              }
-                          }
+		      for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+			phy_procedures_UE_lte (last_slot, next_slot, PHY_vars_UE_g[UE_inst][CC_id], 0, abstraction_flag, normal_txrx,
+					       no_relay, NULL);
+		      }
+		      ue_data[UE_inst]->tx_power_dBm = PHY_vars_UE_g[UE_inst][0]->tx_power_dBm;
+		    }
+		  }
+		  else {
+		    if (abstraction_flag == 1) {
+		      LOG_E(
+			    EMU,
+			    "sync not supported in abstraction mode (UE%d,mode%d)\n", UE_inst, PHY_vars_UE_g[UE_inst][0]->UE_mode[0]);
+		      exit (-1);
+		    }
+		    if ((frame > 0) && (last_slot == (LTE_SLOTS_PER_FRAME - 2))) {
+		      initial_sync (PHY_vars_UE_g[UE_inst][0], normal_txrx);
+
+		      /*
+			write_output("dlchan00.m","dlch00",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][0][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
+			if (PHY_vars_UE_g[0]->lte_frame_parms.nb_antennas_rx>1)
+			write_output("dlchan01.m","dlch01",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][1][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
+			write_output("dlchan10.m","dlch10",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][2][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
+			if (PHY_vars_UE_g[0]->lte_frame_parms.nb_antennas_rx>1)
+			write_output("dlchan11.m","dlch11",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][3][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
+			write_output("rxsig.m","rxs",PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata[0],PHY_vars_UE_g[0]->lte_frame_parms.samples_per_tti*10,1,1);
+			write_output("rxsigF.m","rxsF",PHY_vars_UE_g[0]->lte_ue_common_vars.rxdataF[0],2*PHY_vars_UE_g[0]->lte_frame_parms.symbols_per_tti*PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size,2,1);
+			write_output("pbch_rxF_ext0.m","pbch_ext0",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->rxdataF_ext[0],6*12*4,1,1);
+			write_output("pbch_rxF_comp0.m","pbch_comp0",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->rxdataF_comp[0],6*12*4,1,1);
+			write_output("pbch_rxF_llr.m","pbch_llr",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->llr,(frame_parms->Ncp==0) ? 1920 : 1728,1,4);
+		      */
+		    }
+		  }
 #ifdef PRINT_STATS
-                          if(last_slot==2 && frame%10==0) {
-                              if (UE_stats_th[UE_inst]) {
-                                  fprintf(UE_stats_th[UE_inst],"%d %d\n",frame, PHY_vars_UE_g[UE_inst][0]->bitrate[0]/1000);
-                              }
-                          }
-                          if (UE_stats[UE_inst]) {
-                              len = dump_ue_stats (PHY_vars_UE_g[UE_inst][0], stats_buffer, 0, normal_txrx, 0);
-                              rewind (UE_stats[UE_inst]);
-                              fwrite (stats_buffer, 1, len, UE_stats[UE_inst]);
-                              fflush(UE_stats[UE_inst]);
-                          }
+		  if(last_slot==2 && frame%10==0) {
+		    if (UE_stats_th[UE_inst]) {
+		      fprintf(UE_stats_th[UE_inst],"%d %d\n",frame, PHY_vars_UE_g[UE_inst][0]->bitrate[0]/1000);
+		    }
+		  }
+		  if (UE_stats[UE_inst]) {
+		    len = dump_ue_stats (PHY_vars_UE_g[UE_inst][0], stats_buffer, 0, normal_txrx, 0);
+		    rewind (UE_stats[UE_inst]);
+		    fwrite (stats_buffer, 1, len, UE_stats[UE_inst]);
+		    fflush(UE_stats[UE_inst]);
+		  }
 #endif
-                        }
-                  }
-              }
+		}
+	    }
+	  }	       
+    
 #ifdef Rel10
-              for (RN_id=oai_emulation.info.first_rn_local;
-                  RN_id<oai_emulation.info.first_rn_local+oai_emulation.info.nb_rn_local;
-                  RN_id++) {
-                  // UE id and eNB id of the RN
-                  UE_inst= oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local + RN_id;// NB_UE_INST + RN_id
-                  eNB_inst= oai_emulation.info.first_enb_local+oai_emulation.info.nb_enb_local + RN_id;// NB_eNB_INST + RN_id
-                  // currently only works in FDD
-                  if (oai_emulation.info.eMBMS_active_state == 4) {
-                      r_type = multicast_relay;
-                      //LOG_I(EMU,"Activating the multicast relaying\n");
-                  }
-                  else {
-                      LOG_E(EMU,"Not supported eMBMS option when relaying is enabled %d\n", r_type);
-                      exit(-1);
-                  }
-                  PHY_vars_RN_g[RN_id]->frame = frame;
-                  if ( oai_emulation.info.frame_type == 0) {
-                      // RN == UE
-                      if (frame>0) {
-                          if (PHY_vars_UE_g[UE_inst][0]->UE_mode[0] != NOT_SYNCHED) {
-                              LOG_D(EMU,"[RN %d] PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n",
-                                  RN_id, UE_inst, frame, slot, next_slot >> 1,last_slot>>1);
-                              PHY_vars_UE_g[UE_inst][0]->frame = frame;
-                              phy_procedures_UE_lte (last_slot, next_slot, PHY_vars_UE_g[UE_inst][0], 0, abstraction_flag,normal_txrx,
-                                  r_type, PHY_vars_RN_g[RN_id]);
-                          }
-                          else if (last_slot == (LTE_SLOTS_PER_FRAME-2)) {
-                              initial_sync(PHY_vars_UE_g[UE_inst][0],normal_txrx);
-                          }
-                      }
-                      // RN == eNB
-                      LOG_D(EMU,"[RN %d] PHY procedures eNB %d for frame %d, slot %d (subframe TX %d, RX %d)\n",
-                          RN_id, eNB_inst, frame, slot, next_slot >> 1,last_slot>>1);
-                      phy_procedures_eNB_lte(slot>>1, PHY_vars_eNB_g[eNB_inst][0], abstraction_flag,
-                          r_type, PHY_vars_RN_g[RN_id]);
-                  }
-                  else {
-                      LOG_E(EMU,"TDD is not supported for multicast relaying %d\n", r_type);
-                      exit(-1);
-                  }
-              }
+	  for (RN_id=oai_emulation.info.first_rn_local;
+	       RN_id<oai_emulation.info.first_rn_local+oai_emulation.info.nb_rn_local;
+	       RN_id++) {
+	    // UE id and eNB id of the RN
+	    UE_inst= oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local + RN_id;// NB_UE_INST + RN_id
+	    eNB_inst= oai_emulation.info.first_enb_local+oai_emulation.info.nb_enb_local + RN_id;// NB_eNB_INST + RN_id
+	    // currently only works in FDD
+	    if (oai_emulation.info.eMBMS_active_state == 4) {
+	      r_type = multicast_relay;
+	      //LOG_I(EMU,"Activating the multicast relaying\n");
+	    }
+	    else {
+	      LOG_E(EMU,"Not supported eMBMS option when relaying is enabled %d\n", r_type);
+	      exit(-1);
+	    }
+	    PHY_vars_RN_g[RN_id]->frame = frame;
+	    if ( oai_emulation.info.frame_type == 0) {
+	      // RN == UE
+	      if (frame>0) {
+		if (PHY_vars_UE_g[UE_inst][0]->UE_mode[0] != NOT_SYNCHED) {
+		  LOG_D(EMU,"[RN %d] PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n",
+			RN_id, UE_inst, frame, slot, next_slot >> 1,last_slot>>1);
+		  PHY_vars_UE_g[UE_inst][0]->frame = frame;
+		  phy_procedures_UE_lte (last_slot, next_slot, PHY_vars_UE_g[UE_inst][0], 0, abstraction_flag,normal_txrx,
+					 r_type, PHY_vars_RN_g[RN_id]);
+		}
+		else if (last_slot == (LTE_SLOTS_PER_FRAME-2)) {
+		  initial_sync(PHY_vars_UE_g[UE_inst][0],normal_txrx);
+		}
+	      }
+	      // RN == eNB
+	      LOG_D(EMU,"[RN %d] PHY procedures eNB %d for frame %d, slot %d (subframe TX %d, RX %d)\n",
+		    RN_id, eNB_inst, frame, slot, next_slot >> 1,last_slot>>1);
+	      phy_procedures_eNB_lte(slot>>1, PHY_vars_eNB_g[eNB_inst][0], abstraction_flag,
+				     r_type, PHY_vars_RN_g[RN_id]);
+	    }
+	    else {
+	      LOG_E(EMU,"TDD is not supported for multicast relaying %d\n", r_type);
+	      exit(-1);
+	    }
+	  }
 #endif
-              emu_transport (frame, last_slot, next_slot, direction, oai_emulation.info.frame_type, ethernet_flag);
-              if ((direction == SF_DL) || (frame_parms->frame_type == 0)) {
-                  // consider only sec id 0
-                  /*  for (eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++) {
-           if (abstraction_flag == 0) {
-           do_OFDM_mod(PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdataF[0],
-           PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdata[0],
-           frame,next_slot,
-           frame_parms);
-           }
-           }*/
-                  start_meas(&dl_chan_stats);
-		  for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) 
-		    for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-		      do_DL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, eNB2UE, enb_data, ue_data, next_slot, abstraction_flag,frame_parms, UE_inst,CC_id);
-		    }
-		  stop_meas(&dl_chan_stats);
-              }
-              if ((direction == SF_UL) || (frame_parms->frame_type == 0)) { //if ((subframe<2) || (subframe>4))
-                   start_meas(&ul_chan_stats);
-		   for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-		     do_UL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, UE2eNB, enb_data, ue_data, next_slot, abstraction_flag,frame_parms, frame,CC_id); 
-		   }
-		   stop_meas(&ul_chan_stats);
-                  /*
-           int ccc;
-           fprintf(SINRpost,"SINRdb For eNB New Subframe : \n ");
-           for(ccc = 0 ; ccc<301; ccc++)
-           {
-           fprintf(SINRpost,"_ %f ", SINRpost_eff[ccc]);
-           }
-           fprintf(SINRpost,"SINRdb For eNB : %f \n ", SINRpost_eff[ccc]);
-                   */
-              }
-              if ((direction == SF_S)) { //it must be a special subframe
-                  if (next_slot % 2 == 0) { //DL part
-                      /*  for (eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++) {
-             if (abstraction_flag == 0) {
-             do_OFDM_mod(PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdataF[0],
-             PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdata[0],
-             frame,next_slot,
-             frame_parms);
-             }
-             }*/ 
-		    start_meas(&dl_chan_stats);
-		    for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) 
-		      for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-			do_DL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, eNB2UE, enb_data, ue_data, next_slot, abstraction_flag,frame_parms, UE_inst,CC_id);
-		      }
-		    stop_meas(&dl_chan_stats);
-                      /*
-             for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
-             for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
-             for (k=0;k<UE2eNB[1][0]->channel_length;k++)
-             printf("SB(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
-                       */
-                  }
-                  else { // UL part
-		    start_meas(&ul_chan_stats);
-		    for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-                      do_UL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, UE2eNB, enb_data, ue_data, next_slot, abstraction_flag,frame_parms, frame,CC_id);
-		    }
-		    stop_meas(&ul_chan_stats);
-
-                      /*        int ccc;
-             fprintf(SINRpost,"SINRdb For eNB New Subframe : \n ");
-             for(ccc = 0 ; ccc<301; ccc++)
-             {
-             fprintf(SINRpost,"_ %f ", SINRpost_eff[ccc]);
-             }
-             fprintf(SINRpost,"SINRdb For eNB : %f \n ", SINRpost_eff[ccc]);
-             }
-                       */}
-              }
-              if ((last_slot == 1) && (frame == 0) && (abstraction_flag == 0) && (oai_emulation.info.n_frames == 1)) {
-
-                  write_output ("dlchan0.m", "dlch0", &(PHY_vars_UE_g[0][0]->lte_ue_common_vars.dl_ch_estimates[0][0][0]),
-                      (6 * (PHY_vars_UE_g[0][0]->lte_frame_parms.ofdm_symbol_size)), 1, 1);
-                  write_output ("dlchan1.m", "dlch1", &(PHY_vars_UE_g[0][0]->lte_ue_common_vars.dl_ch_estimates[1][0][0]),
-                      (6 * (PHY_vars_UE_g[0][0]->lte_frame_parms.ofdm_symbol_size)), 1, 1);
-                  write_output ("dlchan2.m", "dlch2", &(PHY_vars_UE_g[0][0]->lte_ue_common_vars.dl_ch_estimates[2][0][0]),
-                      (6 * (PHY_vars_UE_g[0][0]->lte_frame_parms.ofdm_symbol_size)), 1, 1);
-                  write_output ("pbch_rxF_comp0.m", "pbch_comp0", PHY_vars_UE_g[0][0]->lte_ue_pbch_vars[0]->rxdataF_comp[0],
-                      6 * 12 * 4, 1, 1);
-                  write_output ("pbch_rxF_llr.m", "pbch_llr", PHY_vars_UE_g[0][0]->lte_ue_pbch_vars[0]->llr,
-                      (frame_parms->Ncp == 0) ? 1920 : 1728, 1, 4);
-              }
-              /*
-         if ((last_slot==1) && (frame==1)) {
-         write_output("dlsch_rxF_comp0.m","dlsch0_rxF_comp0",PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp[0],300*(-(PHY_vars_UE->lte_frame_parms.Ncp*2)+14),1,1);
-         write_output("pdcch_rxF_comp0.m","pdcch0_rxF_comp0",PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->rxdataF_comp[0],4*300,1,1);
-         }
-               */
-      } // if Channel_Flag==0
-
-      } //end of slot
-
-      if ((frame >= 1) && (frame <= 9) && (abstraction_flag == 0)
+	  emu_transport (frame, last_slot, next_slot, direction, oai_emulation.info.frame_type[0], ethernet_flag);
+	  if ((direction == SF_DL) || (frame_parms[0]->frame_type == 0)) {
+	    // consider only sec id 0
+	    /*  for (eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++) {
+		if (abstraction_flag == 0) {
+		do_OFDM_mod(PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdataF[0],
+		PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdata[0],
+		frame,next_slot,
+		frame_parms);
+		}
+		}*/
+	    start_meas(&dl_chan_stats);
+	    for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) 
+	      for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+#warning figure out what to do with UE frame_parms during initial_sync
+		do_DL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, eNB2UE, enb_data, ue_data, next_slot, abstraction_flag,&PHY_vars_eNB_g[0][CC_id]->lte_frame_parms,UE_inst,CC_id);
+	      }
+	    stop_meas(&dl_chan_stats);
+	  }
+	  if ((direction == SF_UL) || (frame_parms[0]->frame_type == 0)) { //if ((subframe<2) || (subframe>4))
+	    start_meas(&ul_chan_stats);
+	    for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+#warning figure out what to do with UE frame_parms during initial_sync
+	      do_UL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, UE2eNB, enb_data, ue_data, next_slot, abstraction_flag,&PHY_vars_eNB_g[0][CC_id]->lte_frame_parms, frame,CC_id); 
+	    }
+	    stop_meas(&ul_chan_stats);
+	    /*
+	      int ccc;
+	      fprintf(SINRpost,"SINRdb For eNB New Subframe : \n ");
+	      for(ccc = 0 ; ccc<301; ccc++)
+	      {
+	      fprintf(SINRpost,"_ %f ", SINRpost_eff[ccc]);
+	      }
+	      fprintf(SINRpost,"SINRdb For eNB : %f \n ", SINRpost_eff[ccc]);
+	    */
+	  }
+	  if ((direction == SF_S)) { //it must be a special subframe
+	    if (next_slot % 2 == 0) { //DL part
+	      /*  for (eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++) {
+		  if (abstraction_flag == 0) {
+		  do_OFDM_mod(PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdataF[0],
+		  PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdata[0],
+		  frame,next_slot,
+		  frame_parms);
+		  }
+		  }*/ 
+	      start_meas(&dl_chan_stats);
+	      for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) 
+		for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+#warning	check dimensions of r_reN,r_imN for multiple CCs
+		  do_DL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, eNB2UE, enb_data, ue_data, next_slot, abstraction_flag,&PHY_vars_eNB_g[0][CC_id]->lte_frame_parms, UE_inst,CC_id);
+		}
+	      stop_meas(&dl_chan_stats);
+	      /*
+		for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
+		for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
+		for (k=0;k<UE2eNB[1][0]->channel_length;k++)
+		printf("SB(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
+	      */
+	    }
+	    else { // UL part
+	      start_meas(&ul_chan_stats);
+	      for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+#warning	check dimensions of r_reN,r_imN for multiple CCs
+		do_UL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, UE2eNB, enb_data, ue_data, next_slot, abstraction_flag,&PHY_vars_eNB_g[0][CC_id]->lte_frame_parms, frame,CC_id);
+	      }
+	      stop_meas(&ul_chan_stats);
+
+	      /*        int ccc;
+			fprintf(SINRpost,"SINRdb For eNB New Subframe : \n ");
+			for(ccc = 0 ; ccc<301; ccc++)
+			{
+			fprintf(SINRpost,"_ %f ", SINRpost_eff[ccc]);
+			}
+			fprintf(SINRpost,"SINRdb For eNB : %f \n ", SINRpost_eff[ccc]);
+			}
+	      */
+	    }
+	  }
+	  if ((last_slot == 1) && (frame == 0) && (abstraction_flag == 0) && (oai_emulation.info.n_frames == 1)) {
+
+	    write_output ("dlchan0.m", "dlch0", &(PHY_vars_UE_g[0][0]->lte_ue_common_vars.dl_ch_estimates[0][0][0]),
+			  (6 * (PHY_vars_UE_g[0][0]->lte_frame_parms.ofdm_symbol_size)), 1, 1);
+	    write_output ("dlchan1.m", "dlch1", &(PHY_vars_UE_g[0][0]->lte_ue_common_vars.dl_ch_estimates[1][0][0]),
+			  (6 * (PHY_vars_UE_g[0][0]->lte_frame_parms.ofdm_symbol_size)), 1, 1);
+	    write_output ("dlchan2.m", "dlch2", &(PHY_vars_UE_g[0][0]->lte_ue_common_vars.dl_ch_estimates[2][0][0]),
+			  (6 * (PHY_vars_UE_g[0][0]->lte_frame_parms.ofdm_symbol_size)), 1, 1);
+	    write_output ("pbch_rxF_comp0.m", "pbch_comp0", PHY_vars_UE_g[0][0]->lte_ue_pbch_vars[0]->rxdataF_comp[0],
+			  6 * 12 * 4, 1, 1);
+	    write_output ("pbch_rxF_llr.m", "pbch_llr", PHY_vars_UE_g[0][0]->lte_ue_pbch_vars[0]->llr,
+			  (frame_parms[0]->Ncp == 0) ? 1920 : 1728, 1, 4);
+	  }
+	  /*
+	    if ((last_slot==1) && (frame==1)) {
+	    write_output("dlsch_rxF_comp0.m","dlsch0_rxF_comp0",PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp[0],300*(-(PHY_vars_UE->lte_frame_parms.Ncp*2)+14),1,1);
+	    write_output("pdcch_rxF_comp0.m","pdcch0_rxF_comp0",PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->rxdataF_comp[0],4*300,1,1);
+	    }
+	  */
+	} // if Channel_Flag==0
+    
+    }//end of slot
+
+    if ((frame >= 1) && (frame <= 9) && (abstraction_flag == 0)
 #ifdef PROC
-          &&(Channel_Flag==0)
+	&&(Channel_Flag==0)
 #endif
-      ) {
-          write_output ("UEtxsig0.m", "txs0", PHY_vars_UE_g[0][0]->lte_ue_common_vars.txdata[0], FRAME_LENGTH_COMPLEX_SAMPLES,
-              1, 1);
-          sprintf (fname, "eNBtxsig%d.m", frame);
-          sprintf (vname, "txs%d", frame);
-          write_output (fname, vname, PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdata[0][0], FRAME_LENGTH_COMPLEX_SAMPLES, 1,
-              1);
-          write_output (
-              "eNBtxsigF0.m", "txsF0", PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdataF[0][0],
-              PHY_vars_eNB_g[0][0]->lte_frame_parms.symbols_per_tti * PHY_vars_eNB_g[0][0]->lte_frame_parms.ofdm_symbol_size, 1,
-              1);
-
-          write_output ("UErxsig0.m", "rxs0", PHY_vars_UE_g[0][0]->lte_ue_common_vars.rxdata[0], FRAME_LENGTH_COMPLEX_SAMPLES,
-              1, 1);
-          write_output ("eNBrxsig0.m", "rxs0", PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.rxdata[0][0],
-              FRAME_LENGTH_COMPLEX_SAMPLES, 1, 1);
-      }
-
+	) {
+      write_output ("UEtxsig0.m", "txs0", PHY_vars_UE_g[0][0]->lte_ue_common_vars.txdata[0], PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10,
+		    1, 1);
+      sprintf (fname, "eNBtxsig%d.m", frame);
+      sprintf (vname, "txs%d", frame);
+      write_output (fname, vname, PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdata[0][0], PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10, 1,
+		    1);
+      write_output (
+		    "eNBtxsigF0.m", "txsF0", PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdataF[0][0],
+		    PHY_vars_eNB_g[0][0]->lte_frame_parms.symbols_per_tti * PHY_vars_eNB_g[0][0]->lte_frame_parms.ofdm_symbol_size, 1,
+		    1);
+      
+      write_output ("UErxsig0.m", "rxs0", PHY_vars_UE_g[0][0]->lte_ue_common_vars.rxdata[0], PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10,
+		    1, 1);
+      write_output ("eNBrxsig0.m", "rxs0", PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.rxdata[0][0],
+		    PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10, 1, 1);
+    }
+    
 #ifdef XFORMS
-      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);
-
-          phy_scope_eNB(form_enb[UE_inst],
-              PHY_vars_eNB_g[eNB_inst][0],
-              UE_inst);
-
-      }
+    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);
+      
+      phy_scope_eNB(form_enb[UE_inst],
+		    PHY_vars_eNB_g[eNB_inst][0],
+		    UE_inst);
+      
+    }
 #endif
-
+    
 #ifdef SMBV
-      if ((frame == config_frames[0]) || (frame == config_frames[1]) || (frame == config_frames[2]) || (frame == config_frames[3])) {
-          smbv_frame_cnt++;
-      }
+    if ((frame == config_frames[0]) || (frame == config_frames[1]) || (frame == config_frames[2]) || (frame == config_frames[3])) {
+      smbv_frame_cnt++;
+    }
 #endif
-      stop_meas(&oaisim_stats_f);
-      //end of frame
-
+  }
+  stop_meas(&oaisim_stats_f);
+    //end of frame
+      
   stop_meas(&oaisim_stats);
 
 #if defined(ENABLE_ITTI)
@@ -1019,580 +1027,580 @@ void *l2l1_task(void *args_p) {
 
 #ifdef PRINT_STATS
   for (UE_inst=0;UE_inst<NB_UE_INST;UE_inst++) {
-      if (UE_stats[UE_inst])
-        fclose (UE_stats[UE_inst]);
-      if(UE_stats_th[UE_inst])
-        fclose (UE_stats_th[UE_inst]);
+    if (UE_stats[UE_inst])
+      fclose (UE_stats[UE_inst]);
+    if(UE_stats_th[UE_inst])
+      fclose (UE_stats_th[UE_inst]);
   }
   for (eNB_inst=0;eNB_inst<NB_eNB_INST;eNB_inst++) {
-      if (eNB_stats[eNB_inst])
-        fclose (eNB_stats[eNB_inst]);
+    if (eNB_stats[eNB_inst])
+      fclose (eNB_stats[eNB_inst]);
   }
   if (eNB_avg_thr)
     fclose (eNB_avg_thr);
   if (eNB_l2_stats)
     fclose (eNB_l2_stats);
-
+  
 #endif
-
+  
   return NULL;
 }
+  
+  /*------------------------------------------------------------------------------*/
+  int main(int argc, char **argv) {
 
-/*------------------------------------------------------------------------------*/
-int main(int argc, char **argv) {
-
-  int32_t i;
-  // pointers signal buffers (s = transmit, r,r0 = receive)
-  clock_t t;
+    int32_t i;
+    // pointers signal buffers (s = transmit, r,r0 = receive)
+    clock_t t;
 
-  //FILE *SINRpost;
-  //char SINRpost_fname[512];
-  // sprintf(SINRpost_fname,"postprocSINR.m");
-  //SINRpost = fopen(SINRpost_fname,"w");
-  // variables/flags which are set by user on command-line
+    //FILE *SINRpost;
+    //char SINRpost_fname[512];
+    // sprintf(SINRpost_fname,"postprocSINR.m");
+    //SINRpost = fopen(SINRpost_fname,"w");
+    // variables/flags which are set by user on command-line
 
 #ifdef SMBV
-  strcpy(smbv_ip,DEFAULT_SMBV_IP);
+    strcpy(smbv_ip,DEFAULT_SMBV_IP);
 #endif
 
-  // time calibration for soft realtime mode  
-  char pbch_file_path[512];
-  FILE *pbch_file_fd;
+    // time calibration for soft realtime mode  
+    char pbch_file_path[512];
+    FILE *pbch_file_fd;
 
 #ifdef PROC
-  int node_id;
-  int port,Process_Flag=0,wgt,Channel_Flag=0,temp;
+    int node_id;
+    int port,Process_Flag=0,wgt,Channel_Flag=0,temp;
 #endif
-  //double **s_re2[MAX_eNB+MAX_UE], **s_im2[MAX_eNB+MAX_UE], **r_re2[MAX_eNB+MAX_UE], **r_im2[MAX_eNB+MAX_UE], **r_re02, **r_im02;
-  //double **r_re0_d[MAX_UE][MAX_eNB], **r_im0_d[MAX_UE][MAX_eNB], **r_re0_u[MAX_eNB][MAX_UE],**r_im0_u[MAX_eNB][MAX_UE];
-  //default parameters
-  rate_adaptation_flag = 0;
-  oai_emulation.info.n_frames = 0xffff; //1024;          //10;
-  oai_emulation.info.n_frames_flag = 0; //fixme
-  snr_dB = 30;
-  cooperation_flag = 0; // default value 0 for no cooperation, 1 for Delay diversity, 2 for Distributed Alamouti
+    //double **s_re2[MAX_eNB+MAX_UE], **s_im2[MAX_eNB+MAX_UE], **r_re2[MAX_eNB+MAX_UE], **r_im2[MAX_eNB+MAX_UE], **r_re02, **r_im02;
+    //double **r_re0_d[MAX_UE][MAX_eNB], **r_im0_d[MAX_UE][MAX_eNB], **r_re0_u[MAX_eNB][MAX_UE],**r_im0_u[MAX_eNB][MAX_UE];
+    //default parameters
+    rate_adaptation_flag = 0;
+    oai_emulation.info.n_frames = 0xffff; //1024;          //10;
+    oai_emulation.info.n_frames_flag = 0; //fixme
+    snr_dB = 30;
+    cooperation_flag = 0; // default value 0 for no cooperation, 1 for Delay diversity, 2 for Distributed Alamouti
 
-  //Default values if not changed by the user in get_simulation_options();
-  pdcp_period = 1;
-  omg_period = 1;
-  // start thread for log gen
-  log_thread_init ();
+    //Default values if not changed by the user in get_simulation_options();
+    pdcp_period = 1;
+    omg_period = 1;
+    // start thread for log gen
+    log_thread_init ();
 
-  init_oai_emulation (); // to initialize everything !!!
+    init_oai_emulation (); // to initialize everything !!!
 
-  // get command-line options
-  get_simulation_options (argc, argv); //Command-line options
+    // get command-line options
+    get_simulation_options (argc, argv); //Command-line options
 
-  // Initialize VCD LOG module
-  vcd_signal_dumper_init (oai_emulation.info.vcd_file);
+    // Initialize VCD LOG module
+    vcd_signal_dumper_init (oai_emulation.info.vcd_file);
 
 #if !defined(ENABLE_ITTI)
-  pthread_t tid;
-  int err;
-  sigset_t sigblock;
-  sigemptyset(&sigblock);
-  sigaddset(&sigblock, SIGHUP);
-  sigaddset(&sigblock, SIGINT);
-  sigaddset(&sigblock, SIGTERM);
-  sigaddset(&sigblock, SIGQUIT);
-  //sigaddset(&sigblock, SIGKILL);
+    pthread_t tid;
+    int err;
+    sigset_t sigblock;
+    sigemptyset(&sigblock);
+    sigaddset(&sigblock, SIGHUP);
+    sigaddset(&sigblock, SIGINT);
+    sigaddset(&sigblock, SIGTERM);
+    sigaddset(&sigblock, SIGQUIT);
+    //sigaddset(&sigblock, SIGKILL);
  
-  if ((err= pthread_sigmask(SIG_BLOCK, &sigblock, NULL)) != 0){
-    printf("SIG_BLOCK error\n");
-    return -1;
-  }
-  if (pthread_create(&tid, NULL, sigh, NULL)) {
-    printf("Pthread for tracing Signals is not created!\n");
-    return -1;
-  } else {
-    printf("Pthread for tracing Signals is created!\n");
-  }
+    if ((err= pthread_sigmask(SIG_BLOCK, &sigblock, NULL)) != 0){
+      printf("SIG_BLOCK error\n");
+      return -1;
+    }
+    if (pthread_create(&tid, NULL, sigh, NULL)) {
+      printf("Pthread for tracing Signals is not created!\n");
+      return -1;
+    } else {
+      printf("Pthread for tracing Signals is created!\n");
+    }
 #endif 
-  // configure oaisim with OCG
-  oaisim_config (); // config OMG and OCG, OPT, OTG, OLG
+    // configure oaisim with OCG
+    oaisim_config (); // config OMG and OCG, OPT, OTG, OLG
 
-  if (ue_connection_test == 1) {
+    if (ue_connection_test == 1) {
       snr_direction = -snr_step;
       snr_dB = 20;
       sinr_dB = -20;
-  }
+    }
 
 #ifdef OPENAIR2
-  init_omv ();
+    init_omv ();
 #endif
-  //Before this call, NB_UE_INST and NB_eNB_INST are not set correctly
-  check_and_adjust_params ();
+    //Before this call, NB_UE_INST and NB_eNB_INST are not set correctly
+    check_and_adjust_params ();
 
-  set_seed = oai_emulation.emulation_config.seed.value;
+    set_seed = oai_emulation.emulation_config.seed.value;
 
-  init_otg_pdcp_buffer ();
+    init_otg_pdcp_buffer ();
 
-  init_seed (set_seed);
+    init_seed (set_seed);
 
-  init_openair1 ();
+    init_openair1 ();
 
-  init_openair2 ();
+    init_openair2 ();
 
-  init_ocm ();
+    init_ocm ();
 
 #ifdef SMBV
-  smbv_init_config(smbv_fname, smbv_nframes);
-  smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->lte_frame_parms);
+    smbv_init_config(smbv_fname, smbv_nframes);
+    smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->lte_frame_parms);
 #endif
-  // add events to future event list: Currently not used
-	//oai_emulation.info.oeh_enabled = 1;
-  if (oai_emulation.info.oeh_enabled == 1)
-    schedule_events();
-
-  // oai performance profiler is enabled 
-  if (oai_emulation.info.opp_enabled == 1)
-    reset_opp_meas();
+    // add events to future event list: Currently not used
+    //oai_emulation.info.oeh_enabled = 1;
+    if (oai_emulation.info.oeh_enabled == 1)
+      schedule_events();
+
+    // oai performance profiler is enabled 
+    if (oai_emulation.info.opp_enabled == 1)
+      reset_opp_meas();
   
-  init_time ();
+    init_time ();
 
-  init_slot_isr ();
+    init_slot_isr ();
 
-  t = clock ();
+    t = clock ();
 
-  LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
+    LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
 
 #if defined(ENABLE_ITTI)
-  // Handle signals until all tasks are terminated
-  if (create_tasks(oai_emulation.info.nb_enb_local, oai_emulation.info.nb_ue_local) >= 0) {
+    // Handle signals until all tasks are terminated
+    if (create_tasks(oai_emulation.info.nb_enb_local, oai_emulation.info.nb_ue_local) >= 0) {
       itti_wait_tasks_end();
-  } else {
+    } else {
       exit(-1); // need a softer mode
-  }
+    }
 #else
-  if (oai_emulation.info.nb_enb_local > 0) {
+    if (oai_emulation.info.nb_enb_local > 0) {
       eNB_app_task(NULL); // do nothing for the moment
-  }
-  l2l1_task (NULL);
+    }
+    l2l1_task (NULL);
 #endif
-  t = clock () - t;
-  LOG_I (EMU,"Duration of the simulation: %f seconds\n", ((float) t) / CLOCKS_PER_SEC);
+    t = clock () - t;
+    LOG_I (EMU,"Duration of the simulation: %f seconds\n", ((float) t) / CLOCKS_PER_SEC);
 
-  //  fclose(SINRpost);
-  LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU Ending <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
+    //  fclose(SINRpost);
+    LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU Ending <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
 
 
-  raise(SIGINT);
-  oai_shutdown();
+    raise(SIGINT);
+    oai_shutdown();
 
-  return (0);
-}
+    return (0);
+  }
 
-void reset_opp_meas(void){
-  uint8_t eNB_id=0,UE_id=0;
+  void reset_opp_meas(void){
+    uint8_t eNB_id=0,UE_id=0;
  
-  reset_meas(&oaisim_stats);
-  reset_meas(&oaisim_stats_f); // frame 
+    reset_meas(&oaisim_stats);
+    reset_meas(&oaisim_stats_f); // frame 
   
-  // init time stats here (including channel)
-  reset_meas(&dl_chan_stats);
-  reset_meas(&ul_chan_stats);
+    // init time stats here (including channel)
+    reset_meas(&dl_chan_stats);
+    reset_meas(&ul_chan_stats);
   
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc_rx);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc_tx);
+    for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc_rx);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc_tx);
     
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->rx_dft_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_channel_estimation_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_freq_offset_estimation_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_decoding_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_rate_unmatching_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_turbo_decoding_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_deinterleaving_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_llr_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_unscrambling_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->rx_dft_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_channel_estimation_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_freq_offset_estimation_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_decoding_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_rate_unmatching_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_turbo_decoding_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_deinterleaving_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_llr_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_unscrambling_stats);
     
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_init_stats);    
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_alpha_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_beta_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_gamma_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_ext_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl1_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl2_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_init_stats);    
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_alpha_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_beta_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_gamma_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_ext_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl1_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl2_stats);
     
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->tx_prach);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->tx_prach);
     
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->ofdm_mod_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_encoding_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_modulation_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_segmentation_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_rate_matching_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_turbo_encoding_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_interleaving_stats);
-    reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_multiplexing_stats);
-    /*
-     * L2 functions
-     */ 
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->ofdm_mod_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_encoding_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_modulation_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_segmentation_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_rate_matching_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_turbo_encoding_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_interleaving_stats);
+      reset_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_multiplexing_stats);
+      /*
+       * L2 functions
+       */ 
     
-    // UE MAC
-    reset_meas(&UE_mac_inst[UE_id].ue_scheduler); // total 
-    reset_meas(&UE_mac_inst[UE_id].tx_ulsch_sdu);  // inlcude rlc_data_req + mac header gen
-    reset_meas(&UE_mac_inst[UE_id].rx_dlsch_sdu); // include mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind and  mac header parser
-    reset_meas(&UE_mac_inst[UE_id].ue_query_mch); 
-    reset_meas(&UE_mac_inst[UE_id].rx_mch_sdu); // include rld_data_ind+ parse mch header 
-    reset_meas(&UE_mac_inst[UE_id].rx_si); // include rlc_data_ind + mac header parser
-
-    reset_meas(&UE_pdcp_stats[UE_id].pdcp_run);
-    reset_meas(&UE_pdcp_stats[UE_id].data_req);
-    reset_meas(&UE_pdcp_stats[UE_id].data_ind);
-    reset_meas(&UE_pdcp_stats[UE_id].apply_security);
-    reset_meas(&UE_pdcp_stats[UE_id].validate_security);
-    reset_meas(&UE_pdcp_stats[UE_id].pdcp_ip);
-    reset_meas(&UE_pdcp_stats[UE_id].ip_pdcp);
+      // UE MAC
+      reset_meas(&UE_mac_inst[UE_id].ue_scheduler); // total 
+      reset_meas(&UE_mac_inst[UE_id].tx_ulsch_sdu);  // inlcude rlc_data_req + mac header gen
+      reset_meas(&UE_mac_inst[UE_id].rx_dlsch_sdu); // include mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind and  mac header parser
+      reset_meas(&UE_mac_inst[UE_id].ue_query_mch); 
+      reset_meas(&UE_mac_inst[UE_id].rx_mch_sdu); // include rld_data_ind+ parse mch header 
+      reset_meas(&UE_mac_inst[UE_id].rx_si); // include rlc_data_ind + mac header parser
+
+      reset_meas(&UE_pdcp_stats[UE_id].pdcp_run);
+      reset_meas(&UE_pdcp_stats[UE_id].data_req);
+      reset_meas(&UE_pdcp_stats[UE_id].data_ind);
+      reset_meas(&UE_pdcp_stats[UE_id].apply_security);
+      reset_meas(&UE_pdcp_stats[UE_id].validate_security);
+      reset_meas(&UE_pdcp_stats[UE_id].pdcp_ip);
+      reset_meas(&UE_pdcp_stats[UE_id].ip_pdcp);
     
-    for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_rx);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_tx);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->rx_prach);
+      for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_rx);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_tx);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->rx_prach);
     
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_mod_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_encoding_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_modulation_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_scrambling_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_rate_matching_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_turbo_encoding_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_interleaving_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_mod_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_encoding_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_modulation_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_scrambling_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_rate_matching_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_turbo_encoding_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_interleaving_stats);
     
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_demod_stats);
-      //reset_meas(&PHY_vars_eNB_g[eNB_id]->rx_dft_stats);
-      //reset_meas(&PHY_vars_eNB_g[eNB_id]->ulsch_channel_estimation_stats);
-      //reset_meas(&PHY_vars_eNB_g[eNB_id]->ulsch_freq_offset_estimation_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_decoding_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demodulation_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_rate_unmatching_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_turbo_decoding_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_deinterleaving_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demultiplexing_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_llr_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_init_stats);    
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_alpha_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_beta_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_gamma_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_ext_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl1_stats);
-      reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl2_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_demod_stats);
+	//reset_meas(&PHY_vars_eNB_g[eNB_id]->rx_dft_stats);
+	//reset_meas(&PHY_vars_eNB_g[eNB_id]->ulsch_channel_estimation_stats);
+	//reset_meas(&PHY_vars_eNB_g[eNB_id]->ulsch_freq_offset_estimation_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_decoding_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demodulation_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_rate_unmatching_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_turbo_decoding_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_deinterleaving_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demultiplexing_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_llr_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_init_stats);    
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_alpha_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_beta_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_gamma_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_ext_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl1_stats);
+	reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl2_stats);
     
-      reset_meas(&eNB2UE[eNB_id][UE_id][0]->random_channel);
-      reset_meas(&eNB2UE[eNB_id][UE_id][0]->interp_time);
-      reset_meas(&eNB2UE[eNB_id][UE_id][0]->interp_freq);
-      reset_meas(&eNB2UE[eNB_id][UE_id][0]->convolution);
-      reset_meas(&UE2eNB[UE_id][eNB_id][0]->random_channel);
-      reset_meas(&UE2eNB[UE_id][eNB_id][0]->interp_time);
-      reset_meas(&UE2eNB[UE_id][eNB_id][0]->interp_freq);
-      reset_meas(&UE2eNB[UE_id][eNB_id][0]->convolution);
-      /* 
-       * L2 functions 
-       */
-      // eNB MAC
-      reset_meas(&eNB_mac_inst[eNB_id].eNB_scheduler); // total 
-      reset_meas(&eNB_mac_inst[eNB_id].schedule_si); // only schedule + tx
-      reset_meas(&eNB_mac_inst[eNB_id].schedule_ra); // only ra
-      reset_meas(&eNB_mac_inst[eNB_id].schedule_ulsch); // onlu ulsch
-      reset_meas(&eNB_mac_inst[eNB_id].fill_DLSCH_dci);// only dci
-      reset_meas(&eNB_mac_inst[eNB_id].schedule_dlsch_preprocessor); // include rlc_data_req + MAC header gen
-      reset_meas(&eNB_mac_inst[eNB_id].schedule_dlsch); // include rlc_data_req + MAC header gen + pre-processor
-      reset_meas(&eNB_mac_inst[eNB_id].schedule_mch); // only embms 
-      reset_meas(&eNB_mac_inst[eNB_id].rx_ulsch_sdu); // include rlc_data_ind + mac header parser
+	reset_meas(&eNB2UE[eNB_id][UE_id][0]->random_channel);
+	reset_meas(&eNB2UE[eNB_id][UE_id][0]->interp_time);
+	reset_meas(&eNB2UE[eNB_id][UE_id][0]->interp_freq);
+	reset_meas(&eNB2UE[eNB_id][UE_id][0]->convolution);
+	reset_meas(&UE2eNB[UE_id][eNB_id][0]->random_channel);
+	reset_meas(&UE2eNB[UE_id][eNB_id][0]->interp_time);
+	reset_meas(&UE2eNB[UE_id][eNB_id][0]->interp_freq);
+	reset_meas(&UE2eNB[UE_id][eNB_id][0]->convolution);
+	/* 
+	 * L2 functions 
+	 */
+	// eNB MAC
+	reset_meas(&eNB_mac_inst[eNB_id].eNB_scheduler); // total 
+	reset_meas(&eNB_mac_inst[eNB_id].schedule_si); // only schedule + tx
+	reset_meas(&eNB_mac_inst[eNB_id].schedule_ra); // only ra
+	reset_meas(&eNB_mac_inst[eNB_id].schedule_ulsch); // onlu ulsch
+	reset_meas(&eNB_mac_inst[eNB_id].fill_DLSCH_dci);// only dci
+	reset_meas(&eNB_mac_inst[eNB_id].schedule_dlsch_preprocessor); // include rlc_data_req + MAC header gen
+	reset_meas(&eNB_mac_inst[eNB_id].schedule_dlsch); // include rlc_data_req + MAC header gen + pre-processor
+	reset_meas(&eNB_mac_inst[eNB_id].schedule_mch); // only embms 
+	reset_meas(&eNB_mac_inst[eNB_id].rx_ulsch_sdu); // include rlc_data_ind + mac header parser
      
-      reset_meas(&eNB_pdcp_stats[eNB_id].pdcp_run);
-      reset_meas(&eNB_pdcp_stats[eNB_id].data_req);
-      reset_meas(&eNB_pdcp_stats[eNB_id].data_ind);
-      reset_meas(&eNB_pdcp_stats[eNB_id].apply_security);
-      reset_meas(&eNB_pdcp_stats[eNB_id].validate_security);
-      reset_meas(&eNB_pdcp_stats[eNB_id].pdcp_ip);
-      reset_meas(&eNB_pdcp_stats[eNB_id].ip_pdcp);
+	reset_meas(&eNB_pdcp_stats[eNB_id].pdcp_run);
+	reset_meas(&eNB_pdcp_stats[eNB_id].data_req);
+	reset_meas(&eNB_pdcp_stats[eNB_id].data_ind);
+	reset_meas(&eNB_pdcp_stats[eNB_id].apply_security);
+	reset_meas(&eNB_pdcp_stats[eNB_id].validate_security);
+	reset_meas(&eNB_pdcp_stats[eNB_id].pdcp_ip);
+	reset_meas(&eNB_pdcp_stats[eNB_id].ip_pdcp);
       
+      }
     }
   }
-}
 
-void print_opp_meas(void){
-  uint8_t eNB_id=0,UE_id=0;
+  void print_opp_meas(void){
+    uint8_t eNB_id=0,UE_id=0;
 
-  print_meas(&oaisim_stats,"[OAI][total_exec_time]", &oaisim_stats,&oaisim_stats);
-  print_meas(&oaisim_stats_f,"[OAI][SF_exec_time]", &oaisim_stats,&oaisim_stats_f);
+    print_meas(&oaisim_stats,"[OAI][total_exec_time]", &oaisim_stats,&oaisim_stats);
+    print_meas(&oaisim_stats_f,"[OAI][SF_exec_time]", &oaisim_stats,&oaisim_stats_f);
   
-  print_meas(&dl_chan_stats,"[DL][chan_stats]",&oaisim_stats,&oaisim_stats_f);
-  print_meas(&ul_chan_stats,"[UL][chan_stats]", &oaisim_stats,&oaisim_stats_f);
+    print_meas(&dl_chan_stats,"[DL][chan_stats]",&oaisim_stats,&oaisim_stats_f);
+    print_meas(&ul_chan_stats,"[UL][chan_stats]", &oaisim_stats,&oaisim_stats_f);
   
-  for (UE_id=0; UE_id<NB_UE_INST;UE_id++) {
-    for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
-      print_meas(&eNB2UE[eNB_id][UE_id][0]->random_channel,"[DL][random_channel]",&oaisim_stats,&oaisim_stats_f);
-      print_meas(&eNB2UE[eNB_id][UE_id][0]->interp_time,"[DL][interp_time]",&oaisim_stats,&oaisim_stats_f);
-      print_meas(&eNB2UE[eNB_id][UE_id][0]->interp_freq,"[DL][interp_freq]",&oaisim_stats,&oaisim_stats_f);
-      print_meas(&eNB2UE[eNB_id][UE_id][0]->convolution,"[DL][convolution]",&oaisim_stats,&oaisim_stats_f);
-
-      print_meas(&UE2eNB[UE_id][eNB_id][0]->random_channel,"[UL][random_channel]",&oaisim_stats,&oaisim_stats_f);
-      print_meas(&UE2eNB[UE_id][eNB_id][0]->interp_time,"[UL][interp_time]",&oaisim_stats,&oaisim_stats_f);
-      print_meas(&UE2eNB[UE_id][eNB_id][0]->interp_freq,"[UL][interp_freq]",&oaisim_stats,&oaisim_stats_f);
-      print_meas(&UE2eNB[UE_id][eNB_id][0]->convolution,"[UL][convolution]",&oaisim_stats,&oaisim_stats_f);
+    for (UE_id=0; UE_id<NB_UE_INST;UE_id++) {
+      for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
+	print_meas(&eNB2UE[eNB_id][UE_id][0]->random_channel,"[DL][random_channel]",&oaisim_stats,&oaisim_stats_f);
+	print_meas(&eNB2UE[eNB_id][UE_id][0]->interp_time,"[DL][interp_time]",&oaisim_stats,&oaisim_stats_f);
+	print_meas(&eNB2UE[eNB_id][UE_id][0]->interp_freq,"[DL][interp_freq]",&oaisim_stats,&oaisim_stats_f);
+	print_meas(&eNB2UE[eNB_id][UE_id][0]->convolution,"[DL][convolution]",&oaisim_stats,&oaisim_stats_f);
+
+	print_meas(&UE2eNB[UE_id][eNB_id][0]->random_channel,"[UL][random_channel]",&oaisim_stats,&oaisim_stats_f);
+	print_meas(&UE2eNB[UE_id][eNB_id][0]->interp_time,"[UL][interp_time]",&oaisim_stats,&oaisim_stats_f);
+	print_meas(&UE2eNB[UE_id][eNB_id][0]->interp_freq,"[UL][interp_freq]",&oaisim_stats,&oaisim_stats_f);
+	print_meas(&UE2eNB[UE_id][eNB_id][0]->convolution,"[UL][convolution]",&oaisim_stats,&oaisim_stats_f);
+      }
     }
-  }
 
-  for (UE_id=0; UE_id<NB_UE_INST;UE_id++) {
-    print_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc,"[UE][total_phy_proc]",&oaisim_stats,&oaisim_stats_f);
+    for (UE_id=0; UE_id<NB_UE_INST;UE_id++) {
+      print_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc,"[UE][total_phy_proc]",&oaisim_stats,&oaisim_stats_f);
     
-    print_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc_rx,"[UE][total_phy_proc_rx]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats,"[UE][ofdm_demod]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->rx_dft_stats,"[UE][rx_dft]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_channel_estimation_stats,"[UE][channel_est]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_freq_offset_estimation_stats,"[UE][freq_offset]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_llr_stats,"[UE][llr]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_unscrambling_stats,"[UE][unscrambling]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_decoding_stats,"[UE][decoding]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_rate_unmatching_stats,"[UE][rate_unmatching]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_deinterleaving_stats,"[UE][deinterleaving]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_turbo_decoding_stats,"[UE][turbo_decoding]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_init_stats,"[UE][ |_tc_init]",&oaisim_stats,&oaisim_stats_f);    
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_alpha_stats,"[UE][ |_tc_alpha]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_beta_stats,"[UE][ |_tc_beta]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_gamma_stats,"[UE][ |_tc_gamma]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_ext_stats,"[UE][ |_tc_ext]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl1_stats,"[UE][ |_tc_intl1]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl2_stats,"[UE][ |_tc_intl2]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc_rx,"[UE][total_phy_proc_rx]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats,"[UE][ofdm_demod]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->rx_dft_stats,"[UE][rx_dft]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_channel_estimation_stats,"[UE][channel_est]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_freq_offset_estimation_stats,"[UE][freq_offset]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_llr_stats,"[UE][llr]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_unscrambling_stats,"[UE][unscrambling]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_decoding_stats,"[UE][decoding]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_rate_unmatching_stats,"[UE][rate_unmatching]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_deinterleaving_stats,"[UE][deinterleaving]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_turbo_decoding_stats,"[UE][turbo_decoding]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_init_stats,"[UE][ |_tc_init]",&oaisim_stats,&oaisim_stats_f);    
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_alpha_stats,"[UE][ |_tc_alpha]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_beta_stats,"[UE][ |_tc_beta]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_gamma_stats,"[UE][ |_tc_gamma]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_ext_stats,"[UE][ |_tc_ext]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl1_stats,"[UE][ |_tc_intl1]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl2_stats,"[UE][ |_tc_intl2]",&oaisim_stats,&oaisim_stats_f);
     
-    print_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc_tx,"[UE][total_phy_proc_tx]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->ofdm_mod_stats,"[UE][ofdm_mod]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_modulation_stats,"[UE][modulation]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_encoding_stats,"[UE][encoding]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_segmentation_stats,"[UE][segmentation]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_rate_matching_stats,"[UE][rate_matching]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_turbo_encoding_stats,"[UE][turbo_encoding]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_interleaving_stats,"[UE][interleaving]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_multiplexing_stats,"[UE][multiplexing]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->phy_proc_tx,"[UE][total_phy_proc_tx]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->ofdm_mod_stats,"[UE][ofdm_mod]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_modulation_stats,"[UE][modulation]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_encoding_stats,"[UE][encoding]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_segmentation_stats,"[UE][segmentation]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_rate_matching_stats,"[UE][rate_matching]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_turbo_encoding_stats,"[UE][turbo_encoding]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_interleaving_stats,"[UE][interleaving]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_UE_g[UE_id][0]->ulsch_multiplexing_stats,"[UE][multiplexing]",&oaisim_stats,&oaisim_stats_f);
 
-  }
+    }
   
-  for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc,"[eNB][total_phy_proc]",&oaisim_stats,&oaisim_stats_f);
-
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_tx,"[eNB][total_phy_proc_tx]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_mod_stats,"[eNB][ofdm_mod]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_modulation_stats,"[eNB][modulation]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_scrambling_stats,"[eNB][scrambling]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_encoding_stats,"[eNB][encoding]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_interleaving_stats,"[eNB][|_interleaving]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_rate_matching_stats,"[eNB][|_rate_matching]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_turbo_encoding_stats,"[eNB][|_turbo_encoding]",&oaisim_stats,&oaisim_stats_f);
+    for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc,"[eNB][total_phy_proc]",&oaisim_stats,&oaisim_stats_f);
+
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_tx,"[eNB][total_phy_proc_tx]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_mod_stats,"[eNB][ofdm_mod]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_modulation_stats,"[eNB][modulation]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_scrambling_stats,"[eNB][scrambling]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_encoding_stats,"[eNB][encoding]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_interleaving_stats,"[eNB][|_interleaving]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_rate_matching_stats,"[eNB][|_rate_matching]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_turbo_encoding_stats,"[eNB][|_turbo_encoding]",&oaisim_stats,&oaisim_stats_f);
     
     
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_rx,"[eNB][total_phy_proc_rx]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_demod_stats,"[eNB][ofdm_demod]",&oaisim_stats,&oaisim_stats_f);
-    //print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_channel_estimation_stats,"[eNB][channel_est]");
-    //print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_freq_offset_estimation_stats,"[eNB][freq_offset]");
-    //print_meas(&PHY_vars_eNB_g[eNB_id][0]->rx_dft_stats,"[eNB][rx_dft]");
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demodulation_stats,"[eNB][demodulation]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_decoding_stats,"[eNB][decoding]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_deinterleaving_stats,"[eNB][|_deinterleaving]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demultiplexing_stats,"[eNB][|_demultiplexing]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_rate_unmatching_stats,"[eNB][|_rate_unmatching]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_turbo_decoding_stats,"[eNB][|_turbo_decoding]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_init_stats,"[eNB][ |_tc_init]",&oaisim_stats,&oaisim_stats_f);    
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_alpha_stats,"[eNB][ |_tc_alpha]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_beta_stats,"[eNB][ |_tc_beta]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_gamma_stats,"[eNB][ |_tc_gamma]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_ext_stats,"[eNB][ |_tc_ext]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl1_stats,"[eNB][ |_tc_intl1]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl2_stats,"[eNB][ |_tc_intl2]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_rx,"[eNB][total_phy_proc_rx]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_demod_stats,"[eNB][ofdm_demod]",&oaisim_stats,&oaisim_stats_f);
+      //print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_channel_estimation_stats,"[eNB][channel_est]");
+      //print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_freq_offset_estimation_stats,"[eNB][freq_offset]");
+      //print_meas(&PHY_vars_eNB_g[eNB_id][0]->rx_dft_stats,"[eNB][rx_dft]");
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demodulation_stats,"[eNB][demodulation]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_decoding_stats,"[eNB][decoding]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_deinterleaving_stats,"[eNB][|_deinterleaving]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demultiplexing_stats,"[eNB][|_demultiplexing]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_rate_unmatching_stats,"[eNB][|_rate_unmatching]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_turbo_decoding_stats,"[eNB][|_turbo_decoding]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_init_stats,"[eNB][ |_tc_init]",&oaisim_stats,&oaisim_stats_f);    
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_alpha_stats,"[eNB][ |_tc_alpha]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_beta_stats,"[eNB][ |_tc_beta]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_gamma_stats,"[eNB][ |_tc_gamma]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_ext_stats,"[eNB][ |_tc_ext]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl1_stats,"[eNB][ |_tc_intl1]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl2_stats,"[eNB][ |_tc_intl2]",&oaisim_stats,&oaisim_stats_f);
     
-    print_meas(&PHY_vars_eNB_g[eNB_id][0]->rx_prach,"[eNB][rx_prach]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&PHY_vars_eNB_g[eNB_id][0]->rx_prach,"[eNB][rx_prach]",&oaisim_stats,&oaisim_stats_f);
 
-  }
+    }
 
- for (UE_id=0; UE_id<NB_UE_INST;UE_id++) {
+    for (UE_id=0; UE_id<NB_UE_INST;UE_id++) {
    
-   print_meas(&UE_mac_inst[UE_id].ue_scheduler,"[UE][mac_scheduler]",&oaisim_stats,&oaisim_stats_f); 
-   print_meas(&UE_mac_inst[UE_id].tx_ulsch_sdu,"[UE][tx_ulsch_sdu]",&oaisim_stats,&oaisim_stats_f);
-   print_meas(&UE_mac_inst[UE_id].rx_dlsch_sdu,"[UE][rx_dlsch_sdu]",&oaisim_stats,&oaisim_stats_f);
-   print_meas(&UE_mac_inst[UE_id].ue_query_mch,"[UE][query_MCH]",&oaisim_stats,&oaisim_stats_f); 
-   print_meas(&UE_mac_inst[UE_id].rx_mch_sdu,"[UE][rx_mch_sdu]",&oaisim_stats,&oaisim_stats_f);
-   print_meas(&UE_mac_inst[UE_id].rx_si,"[UE][rx_si]",&oaisim_stats,&oaisim_stats_f); 
+      print_meas(&UE_mac_inst[UE_id].ue_scheduler,"[UE][mac_scheduler]",&oaisim_stats,&oaisim_stats_f); 
+      print_meas(&UE_mac_inst[UE_id].tx_ulsch_sdu,"[UE][tx_ulsch_sdu]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&UE_mac_inst[UE_id].rx_dlsch_sdu,"[UE][rx_dlsch_sdu]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&UE_mac_inst[UE_id].ue_query_mch,"[UE][query_MCH]",&oaisim_stats,&oaisim_stats_f); 
+      print_meas(&UE_mac_inst[UE_id].rx_mch_sdu,"[UE][rx_mch_sdu]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&UE_mac_inst[UE_id].rx_si,"[UE][rx_si]",&oaisim_stats,&oaisim_stats_f); 
    
-   print_meas(&UE_pdcp_stats[UE_id].pdcp_run,"[UE][total_pdcp_run]",&oaisim_stats,&oaisim_stats_f);
-   print_meas(&UE_pdcp_stats[UE_id].data_req,"[UE][DL][pdcp_data_req]",&oaisim_stats,&oaisim_stats_f);
-   print_meas(&UE_pdcp_stats[UE_id].data_ind,"[UE][UL][pdcp_data_ind]",&oaisim_stats,&oaisim_stats_f);
-
-   print_meas(&UE_pdcp_stats[UE_id].apply_security,"[UE][DL][apply_security]",&oaisim_stats,&oaisim_stats_f);
-   print_meas(&UE_pdcp_stats[UE_id].validate_security,"[UE][UL][validate_security]",&oaisim_stats,&oaisim_stats_f);
-   print_meas(&UE_pdcp_stats[UE_id].ip_pdcp,"[UE][DL][ip_pdcp]",&oaisim_stats,&oaisim_stats_f);
-   print_meas(&UE_pdcp_stats[UE_id].pdcp_ip,"[UE][UL][pdcp_ip]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&UE_pdcp_stats[UE_id].pdcp_run,"[UE][total_pdcp_run]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&UE_pdcp_stats[UE_id].data_req,"[UE][DL][pdcp_data_req]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&UE_pdcp_stats[UE_id].data_ind,"[UE][UL][pdcp_data_ind]",&oaisim_stats,&oaisim_stats_f);
+
+      print_meas(&UE_pdcp_stats[UE_id].apply_security,"[UE][DL][apply_security]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&UE_pdcp_stats[UE_id].validate_security,"[UE][UL][validate_security]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&UE_pdcp_stats[UE_id].ip_pdcp,"[UE][DL][ip_pdcp]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&UE_pdcp_stats[UE_id].pdcp_ip,"[UE][UL][pdcp_ip]",&oaisim_stats,&oaisim_stats_f);
   
-  }
+    }
   
-  for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
+    for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
    
-    print_meas(&eNB_mac_inst[eNB_id].eNB_scheduler,"[eNB][mac_scheduler]",&oaisim_stats,&oaisim_stats_f); 
-    print_meas(&eNB_mac_inst[eNB_id].schedule_si,"[eNB][DL][SI]",&oaisim_stats,&oaisim_stats_f); 
-    print_meas(&eNB_mac_inst[eNB_id].schedule_ra,"[eNB][DL][RA]",&oaisim_stats,&oaisim_stats_f); 
-    print_meas(&eNB_mac_inst[eNB_id].fill_DLSCH_dci,"[eNB][DL/UL][fill_DCI]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&eNB_mac_inst[eNB_id].schedule_dlsch_preprocessor,"[eNB][DL][preprocessor]",&oaisim_stats,&oaisim_stats_f); 
-    print_meas(&eNB_mac_inst[eNB_id].schedule_dlsch,"[eNB][DL][schedule_tx_dlsch]",&oaisim_stats,&oaisim_stats_f); 
-    print_meas(&eNB_mac_inst[eNB_id].schedule_mch,"[eNB][DL][mch]",&oaisim_stats,&oaisim_stats_f); 
-    print_meas(&eNB_mac_inst[eNB_id].schedule_ulsch,"[eNB][UL][ULSCH]",&oaisim_stats,&oaisim_stats_f); 
-    print_meas(&eNB_mac_inst[eNB_id].rx_ulsch_sdu,"[eNB][UL][rx_ulsch_sdu]",&oaisim_stats,&oaisim_stats_f); 
-
-    print_meas(&eNB_pdcp_stats[eNB_id].pdcp_run,"[eNB][pdcp_run]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&eNB_pdcp_stats[eNB_id].data_req,"[eNB][DL][pdcp_data_req]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&eNB_pdcp_stats[eNB_id].data_ind,"[eNB][UL][pdcp_data_ind]",&oaisim_stats,&oaisim_stats_f);
-
-    print_meas(&eNB_pdcp_stats[eNB_id].apply_security,"[eNB][DL][apply_security]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&eNB_pdcp_stats[eNB_id].validate_security,"[eNB][UL][validate_security]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&eNB_pdcp_stats[eNB_id].ip_pdcp,"[eNB][DL][ip_pdcp]",&oaisim_stats,&oaisim_stats_f);
-    print_meas(&eNB_pdcp_stats[eNB_id].pdcp_ip,"[eNB][UL][pdcp_ip]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&eNB_mac_inst[eNB_id].eNB_scheduler,"[eNB][mac_scheduler]",&oaisim_stats,&oaisim_stats_f); 
+      print_meas(&eNB_mac_inst[eNB_id].schedule_si,"[eNB][DL][SI]",&oaisim_stats,&oaisim_stats_f); 
+      print_meas(&eNB_mac_inst[eNB_id].schedule_ra,"[eNB][DL][RA]",&oaisim_stats,&oaisim_stats_f); 
+      print_meas(&eNB_mac_inst[eNB_id].fill_DLSCH_dci,"[eNB][DL/UL][fill_DCI]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&eNB_mac_inst[eNB_id].schedule_dlsch_preprocessor,"[eNB][DL][preprocessor]",&oaisim_stats,&oaisim_stats_f); 
+      print_meas(&eNB_mac_inst[eNB_id].schedule_dlsch,"[eNB][DL][schedule_tx_dlsch]",&oaisim_stats,&oaisim_stats_f); 
+      print_meas(&eNB_mac_inst[eNB_id].schedule_mch,"[eNB][DL][mch]",&oaisim_stats,&oaisim_stats_f); 
+      print_meas(&eNB_mac_inst[eNB_id].schedule_ulsch,"[eNB][UL][ULSCH]",&oaisim_stats,&oaisim_stats_f); 
+      print_meas(&eNB_mac_inst[eNB_id].rx_ulsch_sdu,"[eNB][UL][rx_ulsch_sdu]",&oaisim_stats,&oaisim_stats_f); 
+
+      print_meas(&eNB_pdcp_stats[eNB_id].pdcp_run,"[eNB][pdcp_run]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&eNB_pdcp_stats[eNB_id].data_req,"[eNB][DL][pdcp_data_req]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&eNB_pdcp_stats[eNB_id].data_ind,"[eNB][UL][pdcp_data_ind]",&oaisim_stats,&oaisim_stats_f);
+
+      print_meas(&eNB_pdcp_stats[eNB_id].apply_security,"[eNB][DL][apply_security]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&eNB_pdcp_stats[eNB_id].validate_security,"[eNB][UL][validate_security]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&eNB_pdcp_stats[eNB_id].ip_pdcp,"[eNB][DL][ip_pdcp]",&oaisim_stats,&oaisim_stats_f);
+      print_meas(&eNB_pdcp_stats[eNB_id].pdcp_ip,"[eNB][UL][pdcp_ip]",&oaisim_stats,&oaisim_stats_f);
   
-  }
+    }
   
-}
+  }
 
 
 
- static void *sigh(void *arg) {
+  static void *sigh(void *arg) {
 
-   int signum;
-   sigset_t sigcatch;
-   sigemptyset(&sigcatch);
-   sigaddset(&sigcatch, SIGHUP);
-   sigaddset(&sigcatch, SIGINT);
-   sigaddset(&sigcatch, SIGTERM);
-   sigaddset(&sigcatch, SIGQUIT);
+    int signum;
+    sigset_t sigcatch;
+    sigemptyset(&sigcatch);
+    sigaddset(&sigcatch, SIGHUP);
+    sigaddset(&sigcatch, SIGINT);
+    sigaddset(&sigcatch, SIGTERM);
+    sigaddset(&sigcatch, SIGQUIT);
    
-   for (;;) {
-     sigwait(&sigcatch, &signum);
-     //sigwait(&sigblock, &signum);
-     switch (signum) {
-     case SIGHUP:
-     case SIGINT:
-     case SIGTERM:
-     case SIGQUIT:
-       fprintf(stderr,"received signal %d \n", signum);
-       // no need for mutx: when ITTI not used, this variable is only accessed by this function
-       l2l1_state = L2L1_TERMINATED;
-       break;
-     default:
-       fprintf(stderr,"Unexpected signal %d \n",signum);
-       exit(-1);
-       break;
-     }
-   }
-   pthread_exit(NULL);
- }
-
-
-void oai_shutdown(void) {
-  static int done=0;
-  int i;
-  char interfaceName[8];
+    for (;;) {
+      sigwait(&sigcatch, &signum);
+      //sigwait(&sigblock, &signum);
+      switch (signum) {
+      case SIGHUP:
+      case SIGINT:
+      case SIGTERM:
+      case SIGQUIT:
+	fprintf(stderr,"received signal %d \n", signum);
+	// no need for mutx: when ITTI not used, this variable is only accessed by this function
+	l2l1_state = L2L1_TERMINATED;
+	break;
+      default:
+	fprintf(stderr,"Unexpected signal %d \n",signum);
+	exit(-1);
+	break;
+      }
+    }
+    pthread_exit(NULL);
+  }
+
+
+  void oai_shutdown(void) {
+    static int done=0;
+    int i;
+    char interfaceName[8];
   
-  if (done)
-    return;
+    if (done)
+      return;
 
-  free (otg_pdcp_buffer);
+    free (otg_pdcp_buffer);
 
 #ifdef SMBV
-  if (config_smbv) {
-    smbv_send_config (smbv_fname,smbv_ip);
-  }
+    if (config_smbv) {
+      smbv_send_config (smbv_fname,smbv_ip);
+    }
 #endif
 
-  //Perform KPI measurements
-  if (oai_emulation.info.otg_enabled == 1)
-    kpi_gen ();
+    //Perform KPI measurements
+    if (oai_emulation.info.otg_enabled == 1)
+      kpi_gen ();
 
-  if (oai_emulation.info.opp_enabled == 1)
-    print_opp_meas();
+    if (oai_emulation.info.opp_enabled == 1)
+      print_opp_meas();
   
-  // relase all rx state
-  if (ethernet_flag == 1) {
+    // relase all rx state
+    if (ethernet_flag == 1) {
       emu_transport_release ();
-  }
+    }
 
 #ifdef PROC
-  if (abstraction_flag == 0 && Channel_Flag==0 && Process_Flag==0)
+    if (abstraction_flag == 0 && Channel_Flag==0 && Process_Flag==0)
 #else
-  if (abstraction_flag == 0)
+      if (abstraction_flag == 0)
 #endif
-    {
-      /*
-	#ifdef IFFT_FPGA
-	free(txdataF2[0]);
-	free(txdataF2[1]);
-	free(txdataF2);
-	free(txdata[0]);
-	free(txdata[1]);
-	free(txdata);
-	#endif
-      */
+	{
+	  /*
+	    #ifdef IFFT_FPGA
+	    free(txdataF2[0]);
+	    free(txdataF2[1]);
+	    free(txdataF2);
+	    free(txdata[0]);
+	    free(txdata[1]);
+	    free(txdata);
+	    #endif
+	  */
       
-      for (i = 0; i < 2; i++) {
-	free (s_re[i]);
-	free (s_im[i]);
-	free (r_re[i]);
-	free (r_im[i]);
-      }
-      free (s_re);
-      free (s_im);
-      free (r_re);
-      free (r_im);
+	  for (i = 0; i < 2; i++) {
+	    free (s_re[i]);
+	    free (s_im[i]);
+	    free (r_re[i]);
+	    free (r_im[i]);
+	  }
+	  free (s_re);
+	  free (s_im);
+	  free (r_re);
+	  free (r_im);
       
-      lte_sync_time_free ();
-    }
+	  lte_sync_time_free ();
+	}
   
-  // added for PHY abstraction
-  if (oai_emulation.info.ocm_enabled == 1) {
-    for (eNB_inst = 0; eNB_inst < NUMBER_OF_eNB_MAX; eNB_inst++) {
-      free (enb_data[eNB_inst]);
-    }
-    for (UE_inst = 0; UE_inst < NUMBER_OF_UE_MAX; UE_inst++) {
-      free (ue_data[UE_inst]);
-    }
-  } //End of PHY abstraction changes
+    // added for PHY abstraction
+    if (oai_emulation.info.ocm_enabled == 1) {
+      for (eNB_inst = 0; eNB_inst < NUMBER_OF_eNB_MAX; eNB_inst++) {
+	free (enb_data[eNB_inst]);
+      }
+      for (UE_inst = 0; UE_inst < NUMBER_OF_UE_MAX; UE_inst++) {
+	free (ue_data[UE_inst]);
+      }
+    } //End of PHY abstraction changes
   
 #ifdef OPENAIR2
-  mac_top_cleanup ();
+    mac_top_cleanup ();
 #endif 
 
-  // stop OMG
-  stop_mobility_generator (omg_param_list); //omg_param_list.mobility_type
+    // stop OMG
+    stop_mobility_generator (omg_param_list); //omg_param_list.mobility_type
 #ifdef OPENAIR2
-  if (oai_emulation.info.omv_enabled == 1)
-    omv_end (pfd[1], omv_data);
+    if (oai_emulation.info.omv_enabled == 1)
+      omv_end (pfd[1], omv_data);
 #endif
-  if ((oai_emulation.info.ocm_enabled == 1) && (ethernet_flag == 0) && (ShaF != NULL))
-    destroyMat (ShaF, map1, map2);
+    if ((oai_emulation.info.ocm_enabled == 1) && (ethernet_flag == 0) && (ShaF != NULL))
+      destroyMat (ShaF, map1, map2);
   
-  if ((oai_emulation.info.opt_enabled == 1))
-    terminate_opt ();
+    if ((oai_emulation.info.opt_enabled == 1))
+      terminate_opt ();
 
-  if (oai_emulation.info.cli_enabled)
-    cli_server_cleanup ();
+    if (oai_emulation.info.cli_enabled)
+      cli_server_cleanup ();
 
-  for (i = 0; i < NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++)
-    if (oai_emulation.info.oai_ifup[i] == 1) {
-      sprintf (interfaceName, "oai%d", i);
-      bringInterfaceUp (interfaceName, 0);
-    }
+    for (i = 0; i < NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++)
+      if (oai_emulation.info.oai_ifup[i] == 1) {
+	sprintf (interfaceName, "oai%d", i);
+	bringInterfaceUp (interfaceName, 0);
+      }
   
-  log_thread_finalize ();
-  logClean ();
-  vcd_signal_dumper_close ();
-  done =1;
+    log_thread_finalize ();
+    logClean ();
+    vcd_signal_dumper_close ();
+    done =1;
   
-  LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU shutdown <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
-}
+    LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU shutdown <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
+  }
 
-eNB_MAC_INST* get_eNB_mac_inst(module_id_t module_idP)
-{
-  return (&eNB_mac_inst[module_idP]);
-}
+  eNB_MAC_INST* get_eNB_mac_inst(module_id_t module_idP)
+  {
+    return (&eNB_mac_inst[module_idP]);
+  }
 
-OAI_Emulation* get_OAI_emulation()
-{
-	return &oai_emulation;
-}
+  OAI_Emulation* get_OAI_emulation()
+  {
+    return &oai_emulation;
+  }
diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c
index 146b54613b15a720c29b35d07e659e7cec2e13b5..eade5a128bc5bad4e1ab7da8d42ec2b2d9bf0eb4 100644
--- a/targets/SIMU/USER/oaisim_config.c
+++ b/targets/SIMU/USER/oaisim_config.c
@@ -197,158 +197,159 @@ mapping packet_gen_names[] =
 void init_oai_emulation(void) {
 
   int i;
-
-	oai_emulation.environment_system_config.fading.large_scale.selected_option = "free_space";
-	oai_emulation.environment_system_config.fading.free_space_model_parameters.pathloss_exponent = 3.00;
-	oai_emulation.environment_system_config.fading.free_space_model_parameters.pathloss_0_dB = -100;
-	oai_emulation.environment_system_config.fading.small_scale.selected_option = "AWGN";
-	oai_emulation.environment_system_config.fading.ricean_8tap.rice_factor_dB = 0;
-	oai_emulation.environment_system_config.fading.shadowing.decorrelation_distance_m = 0;
-	oai_emulation.environment_system_config.fading.shadowing.variance_dB = 0;
-	oai_emulation.environment_system_config.fading.shadowing.inter_site_correlation = 0;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.number_of_sectors = 1;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.beam_width_dB = 1.13;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[0] = 0;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[1] = 0;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[2] = 0;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_gain_dBi = 0;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.tx_power_dBm = 15;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.rx_noise_level_dB = 0;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[0] = 0;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[1] = 0;
-	oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[2] = 0;
-	oai_emulation.environment_system_config.antenna.UE_antenna.antenna_gain_dBi = 0;
-	oai_emulation.environment_system_config.antenna.UE_antenna.tx_power_dBm = 20;
-	oai_emulation.environment_system_config.antenna.UE_antenna.rx_noise_level_dB = 0; // noise figure
-	oai_emulation.environment_system_config.wall_penetration_loss_dB = 5;
-	oai_emulation.environment_system_config.system_bandwidth_MB = 7.68;
-	oai_emulation.environment_system_config.system_frequency_GHz = 1.9;
-
-	oai_emulation.topology_config.area.x_m = 1000;
-	oai_emulation.topology_config.area.y_m = 1000;
-	oai_emulation.topology_config.network_type.selected_option = "homogeneous";
-	oai_emulation.topology_config.cell_type.selected_option = "macrocell";
-	oai_emulation.topology_config.relay.number_of_relays = 0;
-	oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option = "STATIC";
+  int CC_id;
+
+  oai_emulation.environment_system_config.fading.large_scale.selected_option = "free_space";
+  oai_emulation.environment_system_config.fading.free_space_model_parameters.pathloss_exponent = 3.00;
+  oai_emulation.environment_system_config.fading.free_space_model_parameters.pathloss_0_dB = -100;
+  oai_emulation.environment_system_config.fading.small_scale.selected_option = "AWGN";
+  oai_emulation.environment_system_config.fading.ricean_8tap.rice_factor_dB = 0;
+  oai_emulation.environment_system_config.fading.shadowing.decorrelation_distance_m = 0;
+  oai_emulation.environment_system_config.fading.shadowing.variance_dB = 0;
+  oai_emulation.environment_system_config.fading.shadowing.inter_site_correlation = 0;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.number_of_sectors = 1;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.beam_width_dB = 1.13;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[0] = 0;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[1] = 0;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[2] = 0;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_gain_dBi = 0;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.tx_power_dBm = 15;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.rx_noise_level_dB = 0;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[0] = 0;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[1] = 0;
+  oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[2] = 0;
+  oai_emulation.environment_system_config.antenna.UE_antenna.antenna_gain_dBi = 0;
+  oai_emulation.environment_system_config.antenna.UE_antenna.tx_power_dBm = 20;
+  oai_emulation.environment_system_config.antenna.UE_antenna.rx_noise_level_dB = 0; // noise figure
+  oai_emulation.environment_system_config.wall_penetration_loss_dB = 5;
+  oai_emulation.environment_system_config.system_bandwidth_MB = 7.68;
+  oai_emulation.environment_system_config.system_frequency_GHz = 1.9;
+  
+  oai_emulation.topology_config.area.x_m = 1000;
+  oai_emulation.topology_config.area.y_m = 1000;
+  oai_emulation.topology_config.network_type.selected_option = "homogeneous";
+  oai_emulation.topology_config.cell_type.selected_option = "macrocell";
+  oai_emulation.topology_config.relay.number_of_relays = 0;
+  oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option = "STATIC";
   oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.selected_option="MAX_RWP_TYPES";
-	//oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.horizontal_grid = 1;
-	//oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.vertical_grid = 1;
-	oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_trip_type.selected_option = "random_destination";
-	oai_emulation.topology_config.mobility.UE_mobility.UE_initial_distribution.selected_option = "random";
-	oai_emulation.topology_config.mobility.UE_mobility.random_UE_distribution.number_of_nodes = 1;
-	oai_emulation.topology_config.mobility.UE_mobility.concentrated_UE_distribution.number_of_nodes = 1;
-	oai_emulation.topology_config.mobility.UE_mobility.grid_UE_distribution.random_grid.number_of_nodes = 1;
-	oai_emulation.topology_config.mobility.UE_mobility.grid_UE_distribution.border_grid.number_of_nodes = 1;
-	oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_speed_mps = 0.1;
-	oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_speed_mps = 20.0;
-	oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_sleep_ms = 0.1;
-	oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_sleep_ms = 5.0;
-	oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_journey_time_ms = 0.1;
-	oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_journey_time_ms = 10.0;
-	oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option = "STATIC";
-	oai_emulation.topology_config.mobility.eNB_mobility.eNB_initial_distribution.selected_option = "random";
+  //oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.horizontal_grid = 1;
+  //oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.vertical_grid = 1;
+  oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_trip_type.selected_option = "random_destination";
+  oai_emulation.topology_config.mobility.UE_mobility.UE_initial_distribution.selected_option = "random";
+  oai_emulation.topology_config.mobility.UE_mobility.random_UE_distribution.number_of_nodes = 1;
+  oai_emulation.topology_config.mobility.UE_mobility.concentrated_UE_distribution.number_of_nodes = 1;
+  oai_emulation.topology_config.mobility.UE_mobility.grid_UE_distribution.random_grid.number_of_nodes = 1;
+  oai_emulation.topology_config.mobility.UE_mobility.grid_UE_distribution.border_grid.number_of_nodes = 1;
+  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_speed_mps = 0.1;
+  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_speed_mps = 20.0;
+  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_sleep_ms = 0.1;
+  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_sleep_ms = 5.0;
+  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_journey_time_ms = 0.1;
+  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_journey_time_ms = 10.0;
+  oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option = "STATIC";
+  oai_emulation.topology_config.mobility.eNB_mobility.eNB_initial_distribution.selected_option = "random";
   oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_x = 1;
   oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_y = 1;
-	oai_emulation.topology_config.mobility.eNB_mobility.random_eNB_distribution.number_of_cells = 1;
-	oai_emulation.topology_config.mobility.eNB_mobility.hexagonal_eNB_distribution.number_of_cells = 1;
-	oai_emulation.topology_config.mobility.eNB_mobility.hexagonal_eNB_distribution.inter_eNB_distance_km = 1;
-	oai_emulation.topology_config.mobility.eNB_mobility.grid_eNB_distribution.number_of_grid_x = 1;
-	oai_emulation.topology_config.mobility.eNB_mobility.grid_eNB_distribution.number_of_grid_y = 1;
-	oai_emulation.topology_config.mobility.eNB_mobility.trace_config.trace_mobility_file = (char*) malloc(256);
-	sprintf(oai_emulation.topology_config.mobility.eNB_mobility.trace_config.trace_mobility_file,"static_1enb.tr");
-	oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file = (char*) malloc(256);
-	sprintf(oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file,"static_2ues.tr");
-	oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command = (char*) malloc(20);
-	sprintf(oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command,"sumo");
-	oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file = (char*) malloc(256);
-	sprintf(oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file,"%s/UTIL/OMG/SUMO/SCENARIOS/scen.sumo.cfg",getenv("OPENAIR2_DIR"));
-	oai_emulation.topology_config.mobility.UE_mobility.sumo_config.start=0;
-	oai_emulation.topology_config.mobility.UE_mobility.sumo_config.end=0;
-	oai_emulation.topology_config.mobility.UE_mobility.sumo_config.step=1; //  1000ms
-	oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip = (char*) malloc(40);
-	sprintf(oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip,"127.0.1.1");
-	oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hport = 8883;
-
-	oai_emulation.application_config.packet_gen_type = "substract_string";
-	for (i = 0; i < NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++) {
-		oai_emulation.application_config.predefined_traffic.source_id[i] = "1:10";
-		oai_emulation.application_config.predefined_traffic.application_type[i] = "no_predefined_traffic";
-		oai_emulation.application_config.predefined_traffic.background[i] = "disable";
-		oai_emulation.application_config.predefined_traffic.aggregation_level[i] = 1;
-		oai_emulation.application_config.predefined_traffic.flow_start[i] = (i+1)*25;
-		oai_emulation.application_config.predefined_traffic.flow_duration[i] = 0xffff;
-
-		oai_emulation.application_config.predefined_traffic.destination_id[i] = 0;
-
-		oai_emulation.application_config.customized_traffic.source_id[i] = "1";
-		oai_emulation.application_config.customized_traffic.destination_id[i] = "2";
-		oai_emulation.application_config.customized_traffic.transport_protocol[i] = "udp";
-		oai_emulation.application_config.customized_traffic.background[i] = "disable";
-		oai_emulation.application_config.customized_traffic.m2m[i] = "disable";
-		oai_emulation.application_config.customized_traffic.ip_version[i] = "ipv4";
-		oai_emulation.application_config.customized_traffic.aggregation_level[i] = 1;
-		oai_emulation.application_config.customized_traffic.flow_start[i] = (i+1)*25;
-		oai_emulation.application_config.customized_traffic.flow_duration[i] = 100;
-		oai_emulation.application_config.customized_traffic.idt_dist[i] = "uniform";
-		oai_emulation.application_config.customized_traffic.idt_min_ms[i] = 100;
-		oai_emulation.application_config.customized_traffic.idt_max_ms[i] = 1000;
-		oai_emulation.application_config.customized_traffic.idt_standard_deviation[i] = 1;
-		oai_emulation.application_config.customized_traffic.idt_lambda[i] = 1;
-		oai_emulation.application_config.customized_traffic.size_dist[i] = "uniform";
-		oai_emulation.application_config.customized_traffic.size_min_byte[i] = 200;
-		oai_emulation.application_config.customized_traffic.size_max_byte[i] = 500;
-		oai_emulation.application_config.customized_traffic.size_standard_deviation[i] = 1;
-		oai_emulation.application_config.customized_traffic.size_lambda[i] = 1;
-		oai_emulation.application_config.customized_traffic.stream[i] = 1;
-		oai_emulation.application_config.customized_traffic.destination_port[i] = 8080;
-		oai_emulation.application_config.customized_traffic.prob_off_pu[i]= 0;
-		oai_emulation.application_config.customized_traffic.prob_off_ed[i]= 0;
-		oai_emulation.application_config.customized_traffic.prob_off_pe[i]= 0;
-		oai_emulation.application_config.customized_traffic.prob_pu_ed[i]= 0;
-		oai_emulation.application_config.customized_traffic.prob_pu_pe[i]= 0;
-		oai_emulation.application_config.customized_traffic.prob_ed_pe[i]= 0;
-		oai_emulation.application_config.customized_traffic.prob_ed_pu[i]= 0;
-		oai_emulation.application_config.customized_traffic.holding_time_off_ed[i]= 0;
-		oai_emulation.application_config.customized_traffic.holding_time_off_pu[i]= 0;
-		oai_emulation.application_config.customized_traffic.holding_time_off_pe[i]= 0;
-		oai_emulation.application_config.customized_traffic.holding_time_pe_off[i]= 0;
-		oai_emulation.application_config.customized_traffic.pu_size_pkts[i]= 0;
-		oai_emulation.application_config.customized_traffic.ed_size_pkts[i]= 0;
-	}
-
-
-
-
-	oai_emulation.emulation_config.emulation_time_ms = 0;
-	oai_emulation.emulation_config.curve = "disable";
-	oai_emulation.emulation_config.background_stats = "disable";
-	oai_emulation.emulation_config.performance_metrics.throughput = "disable";
-	oai_emulation.emulation_config.performance_metrics.latency ="disable";
-	oai_emulation.emulation_config.performance_metrics.loss_rate ="disable";
-	oai_emulation.emulation_config.performance_metrics.owd_radio_access = "disable";
-	oai_emulation.emulation_config.layer.phy = 0;
-	oai_emulation.emulation_config.layer.mac = 0;
-	oai_emulation.emulation_config.layer.rlc = 0;
-	oai_emulation.emulation_config.layer.pdcp = 0;
-	oai_emulation.emulation_config.layer.rrc = 0;
-	oai_emulation.emulation_config.layer.omg = 0;
-	oai_emulation.emulation_config.layer.otg = 0;
-	oai_emulation.emulation_config.layer.emu = 1;
-
-	oai_emulation.emulation_config.log_emu.level = "debug";
-	oai_emulation.emulation_config.log_emu.verbosity = "low";
-	oai_emulation.emulation_config.log_emu.interval = 1;
-	oai_emulation.emulation_config.packet_trace.enabled = 0;
-	oai_emulation.emulation_config.seed.value = 0; // 0 means randomly generated by OAI
-
-	oai_emulation.info.ocg_ok = 0;
-
-
-   // phy related params :
-    oai_emulation.info.n_frames=0xffff; // number of frames simulated by default
-    oai_emulation.info.n_frames_flag=0; // if set, then let the emulation goes to infinity
-
-//status
+  oai_emulation.topology_config.mobility.eNB_mobility.random_eNB_distribution.number_of_cells = 1;
+  oai_emulation.topology_config.mobility.eNB_mobility.hexagonal_eNB_distribution.number_of_cells = 1;
+  oai_emulation.topology_config.mobility.eNB_mobility.hexagonal_eNB_distribution.inter_eNB_distance_km = 1;
+  oai_emulation.topology_config.mobility.eNB_mobility.grid_eNB_distribution.number_of_grid_x = 1;
+  oai_emulation.topology_config.mobility.eNB_mobility.grid_eNB_distribution.number_of_grid_y = 1;
+  oai_emulation.topology_config.mobility.eNB_mobility.trace_config.trace_mobility_file = (char*) malloc(256);
+  sprintf(oai_emulation.topology_config.mobility.eNB_mobility.trace_config.trace_mobility_file,"static_1enb.tr");
+  oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file = (char*) malloc(256);
+  sprintf(oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file,"static_2ues.tr");
+  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command = (char*) malloc(20);
+  sprintf(oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command,"sumo");
+  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file = (char*) malloc(256);
+  sprintf(oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file,"%s/UTIL/OMG/SUMO/SCENARIOS/scen.sumo.cfg",getenv("OPENAIR2_DIR"));
+  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.start=0;
+  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.end=0;
+  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.step=1; //  1000ms
+  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip = (char*) malloc(40);
+  sprintf(oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip,"127.0.1.1");
+  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hport = 8883;
+  
+  oai_emulation.application_config.packet_gen_type = "substract_string";
+  for (i = 0; i < NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++) {
+    oai_emulation.application_config.predefined_traffic.source_id[i] = "1:10";
+    oai_emulation.application_config.predefined_traffic.application_type[i] = "no_predefined_traffic";
+    oai_emulation.application_config.predefined_traffic.background[i] = "disable";
+    oai_emulation.application_config.predefined_traffic.aggregation_level[i] = 1;
+    oai_emulation.application_config.predefined_traffic.flow_start[i] = (i+1)*25;
+    oai_emulation.application_config.predefined_traffic.flow_duration[i] = 0xffff;
+    
+    oai_emulation.application_config.predefined_traffic.destination_id[i] = 0;
+    
+    oai_emulation.application_config.customized_traffic.source_id[i] = "1";
+    oai_emulation.application_config.customized_traffic.destination_id[i] = "2";
+    oai_emulation.application_config.customized_traffic.transport_protocol[i] = "udp";
+    oai_emulation.application_config.customized_traffic.background[i] = "disable";
+    oai_emulation.application_config.customized_traffic.m2m[i] = "disable";
+    oai_emulation.application_config.customized_traffic.ip_version[i] = "ipv4";
+    oai_emulation.application_config.customized_traffic.aggregation_level[i] = 1;
+    oai_emulation.application_config.customized_traffic.flow_start[i] = (i+1)*25;
+    oai_emulation.application_config.customized_traffic.flow_duration[i] = 100;
+    oai_emulation.application_config.customized_traffic.idt_dist[i] = "uniform";
+    oai_emulation.application_config.customized_traffic.idt_min_ms[i] = 100;
+    oai_emulation.application_config.customized_traffic.idt_max_ms[i] = 1000;
+    oai_emulation.application_config.customized_traffic.idt_standard_deviation[i] = 1;
+    oai_emulation.application_config.customized_traffic.idt_lambda[i] = 1;
+    oai_emulation.application_config.customized_traffic.size_dist[i] = "uniform";
+    oai_emulation.application_config.customized_traffic.size_min_byte[i] = 200;
+    oai_emulation.application_config.customized_traffic.size_max_byte[i] = 500;
+    oai_emulation.application_config.customized_traffic.size_standard_deviation[i] = 1;
+    oai_emulation.application_config.customized_traffic.size_lambda[i] = 1;
+    oai_emulation.application_config.customized_traffic.stream[i] = 1;
+    oai_emulation.application_config.customized_traffic.destination_port[i] = 8080;
+    oai_emulation.application_config.customized_traffic.prob_off_pu[i]= 0;
+    oai_emulation.application_config.customized_traffic.prob_off_ed[i]= 0;
+    oai_emulation.application_config.customized_traffic.prob_off_pe[i]= 0;
+    oai_emulation.application_config.customized_traffic.prob_pu_ed[i]= 0;
+    oai_emulation.application_config.customized_traffic.prob_pu_pe[i]= 0;
+    oai_emulation.application_config.customized_traffic.prob_ed_pe[i]= 0;
+    oai_emulation.application_config.customized_traffic.prob_ed_pu[i]= 0;
+    oai_emulation.application_config.customized_traffic.holding_time_off_ed[i]= 0;
+    oai_emulation.application_config.customized_traffic.holding_time_off_pu[i]= 0;
+    oai_emulation.application_config.customized_traffic.holding_time_off_pe[i]= 0;
+    oai_emulation.application_config.customized_traffic.holding_time_pe_off[i]= 0;
+    oai_emulation.application_config.customized_traffic.pu_size_pkts[i]= 0;
+    oai_emulation.application_config.customized_traffic.ed_size_pkts[i]= 0;
+  }
+  
+  
+  
+  
+  oai_emulation.emulation_config.emulation_time_ms = 0;
+  oai_emulation.emulation_config.curve = "disable";
+  oai_emulation.emulation_config.background_stats = "disable";
+  oai_emulation.emulation_config.performance_metrics.throughput = "disable";
+  oai_emulation.emulation_config.performance_metrics.latency ="disable";
+  oai_emulation.emulation_config.performance_metrics.loss_rate ="disable";
+  oai_emulation.emulation_config.performance_metrics.owd_radio_access = "disable";
+  oai_emulation.emulation_config.layer.phy = 0;
+  oai_emulation.emulation_config.layer.mac = 0;
+  oai_emulation.emulation_config.layer.rlc = 0;
+  oai_emulation.emulation_config.layer.pdcp = 0;
+  oai_emulation.emulation_config.layer.rrc = 0;
+  oai_emulation.emulation_config.layer.omg = 0;
+  oai_emulation.emulation_config.layer.otg = 0;
+  oai_emulation.emulation_config.layer.emu = 1;
+  
+  oai_emulation.emulation_config.log_emu.level = "debug";
+  oai_emulation.emulation_config.log_emu.verbosity = "low";
+  oai_emulation.emulation_config.log_emu.interval = 1;
+  oai_emulation.emulation_config.packet_trace.enabled = 0;
+  oai_emulation.emulation_config.seed.value = 0; // 0 means randomly generated by OAI
+  
+  oai_emulation.info.ocg_ok = 0;
+  
+  
+  // phy related params :
+  oai_emulation.info.n_frames=0xffff; // number of frames simulated by default
+  oai_emulation.info.n_frames_flag=0; // if set, then let the emulation goes to infinity
+  
+  //status
   oai_emulation.info.is_primary_master=0;
   oai_emulation.info.master_list=0;
   oai_emulation.info.nb_ue_remote=0;
@@ -415,13 +416,15 @@ void init_oai_emulation(void) {
   oai_emulation.info.g_log_verbosity = 0x15;
   oai_emulation.info.g_log_verbosity_option = "medium";
 
-    oai_emulation.info.frame_type=TDD;
-    oai_emulation.info.frame_type_name="TDD";
-    oai_emulation.info.tdd_config=3;
-    oai_emulation.info.tdd_config_S=0;
-    oai_emulation.info.extended_prefix_flag=0;
-    oai_emulation.info.N_RB_DL=25;
-    oai_emulation.info.transmission_mode=2;
+  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+    oai_emulation.info.frame_type[CC_id]=TDD;
+    oai_emulation.info.frame_type_name[CC_id]="TDD";
+    oai_emulation.info.tdd_config[CC_id]=3;
+    oai_emulation.info.tdd_config_S[CC_id]=0;
+    oai_emulation.info.extended_prefix_flag[CC_id]=0;
+    oai_emulation.info.N_RB_DL[CC_id]=25;
+    oai_emulation.info.transmission_mode[CC_id]=2;
+  }
 
   oai_emulation.profile = "EURECOM";
 }
@@ -431,6 +434,8 @@ void oaisim_config(void) {
 
   // init log gen first
  //initialize the log generator
+
+
   logInit();
 
 #if defined(ENABLE_ITTI)
@@ -558,21 +563,24 @@ int olg_config(void) {
 
 int ocg_config_env(void) {
 // int func related to channel desc from oaisim.c could be moved here
+  int CC_id;
 
   if (oai_emulation.info.ocg_enabled){
-    oai_emulation.info.frame_type = map_str_to_int(frame_type_names, oai_emulation.info.frame_type_name);
-    if (oai_emulation.info.frame_type == -1){
-      LOG_E(EMU,"frame type incorrect %s, set it to TDD \n",oai_emulation.info.frame_type_name);
-      oai_emulation.info.frame_type=TDD;
-    }
-    else
-      LOG_I(EMU,"Frame type is %s \n",oai_emulation.info.frame_type_name);
-    if (oai_emulation.info.frame_type == TDD ){
-      if ((oai_emulation.info.tdd_config > 6) || (oai_emulation.info.tdd_config < 0)) {
-	LOG_E(EMU,"TDD config %d out of range, set it to 3\n",oai_emulation.info.tdd_config);
-	oai_emulation.info.tdd_config=3;
-      } else
-	LOG_I(EMU,"TDD config is set to \n",oai_emulation.info.tdd_config);
+    for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+      oai_emulation.info.frame_type[CC_id] = map_str_to_int(frame_type_names, oai_emulation.info.frame_type_name[CC_id]);
+      if (oai_emulation.info.frame_type[CC_id] == -1){
+	LOG_E(EMU,"frame type incorrect %s, set it to TDD \n",oai_emulation.info.frame_type_name);
+	oai_emulation.info.frame_type[CC_id]=TDD;
+      }
+      else
+	LOG_I(EMU,"Frame type is %s \n",oai_emulation.info.frame_type_name);
+      if (oai_emulation.info.frame_type[CC_id] == TDD ){
+	if ((oai_emulation.info.tdd_config[CC_id] > 6) || (oai_emulation.info.tdd_config[CC_id] < 0)) {
+	  LOG_E(EMU,"TDD config %d out of range, set it to 3\n",oai_emulation.info.tdd_config[CC_id]);
+	  oai_emulation.info.tdd_config[CC_id]=3;
+	} else
+	  LOG_I(EMU,"TDD config is set to \n",oai_emulation.info.tdd_config[CC_id]);
+      }
     }
   }
   return 1;
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index a876a4e01281e08ae9300c4bb3790e9616920eac..888425da78e98ef430474b0032285aa371421dd4 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -106,7 +106,7 @@ uint8_t            beta_ACK              = 0;
 uint8_t            beta_RI               = 0;
 uint8_t            beta_CQI              = 2;
 uint8_t            target_ul_mcs         = 4;
-LTE_DL_FRAME_PARMS *frame_parms     = NULL;
+LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
 int           map1,map2;
 double      **ShaF                  = NULL;
 // pointers signal buffers (s = transmit, r,r0 = receive)
@@ -380,9 +380,9 @@ void get_simulation_options(int argc, char *argv[]) {
         break;
 
       case 'C':
-        oai_emulation.info.tdd_config = atoi (optarg);
-        AssertFatal (oai_emulation.info.tdd_config <= TDD_Config__subframeAssignment_sa6, "Illegal tdd_config %d (should be 0-%d)!",
-            oai_emulation.info.tdd_config, TDD_Config__subframeAssignment_sa6);
+        oai_emulation.info.tdd_config[0] = atoi (optarg);
+        AssertFatal (oai_emulation.info.tdd_config[0] <= TDD_Config__subframeAssignment_sa6, "Illegal tdd_config %d (should be 0-%d)!",
+            oai_emulation.info.tdd_config[0], TDD_Config__subframeAssignment_sa6);
         break;
 
       case 'D':
@@ -390,7 +390,7 @@ void get_simulation_options(int argc, char *argv[]) {
         break;
 
       case 'e':
-        oai_emulation.info.extended_prefix_flag = 1;
+        oai_emulation.info.extended_prefix_flag[0] = 1;
         break;
 
       case 'E':
@@ -404,7 +404,7 @@ void get_simulation_options(int argc, char *argv[]) {
 
       case 'F':                   // set FDD
         printf("Setting Frame to FDD\n");
-        oai_emulation.info.frame_type = 0;
+        oai_emulation.info.frame_type[0] = 0;
         break;
 
       case 'g':
@@ -537,10 +537,10 @@ void get_simulation_options(int argc, char *argv[]) {
         break;
 
       case 'R':
-        oai_emulation.info.N_RB_DL = atoi (optarg);
-        if ((oai_emulation.info.N_RB_DL != 6) && (oai_emulation.info.N_RB_DL != 15) && (oai_emulation.info.N_RB_DL != 25)
-            && (oai_emulation.info.N_RB_DL != 50) && (oai_emulation.info.N_RB_DL != 75) && (oai_emulation.info.N_RB_DL != 100)) {
-            printf("Illegal N_RB_DL %d (should be one of 6,15,25,50,75,100)\n", oai_emulation.info.N_RB_DL);
+        oai_emulation.info.N_RB_DL[0] = atoi (optarg);
+        if ((oai_emulation.info.N_RB_DL[0] != 6) && (oai_emulation.info.N_RB_DL[0] != 15) && (oai_emulation.info.N_RB_DL[0] != 25)
+            && (oai_emulation.info.N_RB_DL[0] != 50) && (oai_emulation.info.N_RB_DL[0] != 75) && (oai_emulation.info.N_RB_DL[0] != 100)) {
+            printf("Illegal N_RB_DL %d (should be one of 6,15,25,50,75,100)\n", oai_emulation.info.N_RB_DL[0]);
             exit (-1);
         }
         break;
@@ -597,8 +597,8 @@ void get_simulation_options(int argc, char *argv[]) {
         break;
 
       case 'x':
-        oai_emulation.info.transmission_mode = atoi (optarg);
-        if ((oai_emulation.info.transmission_mode != 1) &&  (oai_emulation.info.transmission_mode != 2) && (oai_emulation.info.transmission_mode != 5) && (oai_emulation.info.transmission_mode != 6)) {
+        oai_emulation.info.transmission_mode[0] = atoi (optarg);
+        if ((oai_emulation.info.transmission_mode[0] != 1) &&  (oai_emulation.info.transmission_mode[0] != 2) && (oai_emulation.info.transmission_mode[0] != 5) && (oai_emulation.info.transmission_mode[0] != 6)) {
             printf("Unsupported transmission mode %d\n",oai_emulation.info.transmission_mode);
             exit(-1);
         }
@@ -656,10 +656,10 @@ void get_simulation_options(int argc, char *argv[]) {
           conf_config_file_name, oai_emulation.info.nb_enb_local, enb_properties->number);
 
       /* Update some simulation parameters */
-      oai_emulation.info.frame_type =           enb_properties->properties[0]->frame_type;
-      oai_emulation.info.tdd_config =           enb_properties->properties[0]->tdd_config;
-      oai_emulation.info.tdd_config_S =         enb_properties->properties[0]->tdd_config_s;
-      oai_emulation.info.extended_prefix_flag = enb_properties->properties[0]->prefix_type;
+      oai_emulation.info.frame_type[0] =           enb_properties->properties[0]->frame_type[0];
+      oai_emulation.info.tdd_config[0] =           enb_properties->properties[0]->tdd_config[0];
+      oai_emulation.info.tdd_config_S[0] =         enb_properties->properties[0]->tdd_config_s[0];
+      oai_emulation.info.extended_prefix_flag[0] = enb_properties->properties[0]->prefix_type[0];
     }
 }
 
@@ -775,8 +775,8 @@ void init_omv(void) {
         sprintf(z_area, "%f", 200.0 );
         sprintf(frames, "%d", oai_emulation.info.n_frames);
         sprintf(nb_antenna, "%d", 4);
-        sprintf(frame_type, "%s", (oai_emulation.info.frame_type == 0) ? "FDD" : "TDD");
-        sprintf(tdd_config, "%d", oai_emulation.info.tdd_config);
+        sprintf(frame_type, "%s", (oai_emulation.info.frame_type[0] == 0) ? "FDD" : "TDD");
+        sprintf(tdd_config, "%d", oai_emulation.info.tdd_config[0]);
         // execl is used to launch the visualisor
         execl(full_name,"OMV", fdstr, frames, num_enb, num_ue, x_area, y_area, z_area, nb_antenna, frame_type, tdd_config,NULL );
         perror( "error in execl the OMV" );
@@ -808,7 +808,9 @@ void init_openair1(void) {
   int list_index;
 #endif
   // change the nb_connected_eNB
-  init_lte_vars (&frame_parms, oai_emulation.info.frame_type, oai_emulation.info.tdd_config, oai_emulation.info.tdd_config_S,oai_emulation.info.extended_prefix_flag,oai_emulation.info.N_RB_DL, Nid_cell, cooperation_flag, oai_emulation.info.transmission_mode, abstraction_flag,nb_antennas_rx, oai_emulation.info.eMBMS_active_state);
+  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+    init_lte_vars (&frame_parms[CC_id], oai_emulation.info.frame_type[CC_id], oai_emulation.info.tdd_config[CC_id], oai_emulation.info.tdd_config_S[CC_id],oai_emulation.info.extended_prefix_flag[CC_id],oai_emulation.info.N_RB_DL[CC_id], Nid_cell, cooperation_flag, oai_emulation.info.transmission_mode[CC_id], abstraction_flag,nb_antennas_rx, oai_emulation.info.eMBMS_active_state);
+  }
 
   for (eNB_id=0; eNB_id<NB_eNB_INST;eNB_id++){
       for (UE_id=0; UE_id<NB_UE_INST;UE_id++){
@@ -816,12 +818,12 @@ void init_openair1(void) {
           PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_ACK_Index = beta_ACK;
           PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_RI_Index  = beta_RI;
           PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_CQI_Index = beta_CQI;
-          ((PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms).pdsch_config_common).p_b = (frame_parms->nb_antennas_tx_eNB>1) ? 1 : 0; // rho_a = rhob
+          ((PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms).pdsch_config_common).p_b = (frame_parms[CC_id]->nb_antennas_tx_eNB>1) ? 1 : 0; // rho_a = rhob
 	
 	  PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index = beta_ACK;
 	  PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_RI_Index  = beta_RI;
 	  PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index = beta_CQI;
-	  ((PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms).pdsch_config_common).p_b = (frame_parms->nb_antennas_tx_eNB>1) ? 1 : 0; // rho_a = rhob
+	  ((PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms).pdsch_config_common).p_b = (frame_parms[CC_id]->nb_antennas_tx_eNB>1) ? 1 : 0; // rho_a = rhob
 	}
       }
   }
@@ -837,7 +839,7 @@ void init_openair1(void) {
   openair_daq_vars.tdd = 1;
   openair_daq_vars.rx_gain_mode = DAQ_AGC_ON;
 
-  openair_daq_vars.dlsch_transmission_mode = oai_emulation.info.transmission_mode;
+  openair_daq_vars.dlsch_transmission_mode = oai_emulation.info.transmission_mode[0];
 
   openair_daq_vars.target_ue_dl_mcs = target_dl_mcs;
   openair_daq_vars.target_ue_ul_mcs = target_ul_mcs;
@@ -849,7 +851,7 @@ void init_openair1(void) {
   // init_ue_status();
   for (UE_id=0; UE_id<NB_UE_INST;UE_id++) 
     for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++){
-      PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB=130;
+      PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB=160;
       // update UE_mode for each eNB_id not just 0
       if (abstraction_flag == 0)
         PHY_vars_UE_g[UE_id][CC_id]->UE_mode[0] = NOT_SYNCHED;
@@ -903,7 +905,7 @@ void init_ocm(void) {
   module_id_t UE_id, eNB_id;
   int CC_id;
   /* Added for PHY abstraction */
-  LOG_I(OCM,"Running with frame_type %d, Nid_cell %d, N_RB_DL %d, EP %d, mode %d, target dl_mcs %d, rate adaptation %d, nframes %d, abstraction %d, channel %s\n", oai_emulation.info.frame_type, Nid_cell, oai_emulation.info.N_RB_DL, oai_emulation.info.extended_prefix_flag, oai_emulation.info.transmission_mode,target_dl_mcs,rate_adaptation_flag,oai_emulation.info.n_frames,abstraction_flag,oai_emulation.environment_system_config.fading.small_scale.selected_option);
+  LOG_I(OCM,"Running with frame_type %d, Nid_cell %d, N_RB_DL %d, EP %d, mode %d, target dl_mcs %d, rate adaptation %d, nframes %d, abstraction %d, channel %s\n", oai_emulation.info.frame_type[0], Nid_cell, oai_emulation.info.N_RB_DL[0], oai_emulation.info.extended_prefix_flag[0], oai_emulation.info.transmission_mode[0],target_dl_mcs,rate_adaptation_flag,oai_emulation.info.n_frames,abstraction_flag,oai_emulation.environment_system_config.fading.small_scale.selected_option);
 
   if (abstraction_flag) {
 
@@ -943,7 +945,7 @@ void init_ocm(void) {
   }
 
   if (abstraction_flag == 0)
-    init_channel_vars (frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
+    init_channel_vars (frame_parms[0], &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
 
   // initialize channel descriptors
   for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
@@ -1081,14 +1083,14 @@ void update_ocm() {
       for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
 	for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
 	  
-	  //UE2eNB[UE_id][eNB_id]->path_loss_dB = -105 + snr_dB;
+	  //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 = -105 + 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 = -105 + 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
+	    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
 	  }
 	  else {
-	    eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB = -105 + 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 = -105 + sinr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower;
+	    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;
 	  }
 	  LOG_I(OCM,"Path loss from eNB %d to UE %d (CCid %d)=> %f dB (eNB TX %d)\n",eNB_id,UE_id,CC_id,
 		eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB,