diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab
index 8dfa5c4ec4c93895262d81b6909fe54918d2cac1..c3b997a4e89e015722df42a63979073cae3f3351 100644
--- a/ci-scripts/Jenkinsfile-gitlab
+++ b/ci-scripts/Jenkinsfile-gitlab
@@ -66,7 +66,8 @@ pipeline {
             "Test-IF4p5-TDD-Band38-Multi-RRU",
             "Test-eNB-OAI-UE-FDD-Band7",
             "Test-Mono-FDD-Band13-X2-HO",
-            "Test-TDD-Band78-gNB-NR-UE"
+            "Test-TDD-Band78-gNB-NR-UE",
+            "Test-OCP-FDD-Band7"
         ])
         ansiColor('xterm')
     }
@@ -683,6 +684,25 @@ pipeline {
                         }
                     }
                 }
+                stage ("Test OAI OCP-eNB - FDD - Band 7 - B210") {
+                    steps {
+                        script {
+                            triggerSlaveJob ('OCPeNB-FDD-Band7-B210', 'Test-OCP-FDD-Band7')
+                        }
+                    }
+                    post {
+                        always {
+                            script {
+                                finalizeSlaveJob('OCPeNB-FDD-Band7-B210')
+                            }
+                        }
+                        failure {
+                            script {
+                                currentBuild.result = 'FAILURE'
+                            }
+                        }
+                    }
+                }
             }
             post {
                 always {
diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py
new file mode 100644
index 0000000000000000000000000000000000000000..1249f521728c1e846f7dfb8871185d966292aa40
--- /dev/null
+++ b/ci-scripts/args_parse.py
@@ -0,0 +1,229 @@
+
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements.  See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# *      http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# *      contact@openairinterface.org
+# */
+#---------------------------------------------------------------------
+# Python for CI of OAI-eNB + COTS-UE
+#
+#   Required Python Version
+#     Python 3.x
+#
+#   Required Python Package
+#     pexpect
+#---------------------------------------------------------------------
+
+#-----------------------------------------------------------
+# Import Libs
+#-----------------------------------------------------------
+import sys		# arg
+import re		# reg
+import yaml
+
+
+#-----------------------------------------------------------
+# Parsing Command Line Arguements
+#-----------------------------------------------------------
+
+
+def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,HELP):
+
+
+    py_param_file_present = False
+    py_params={}
+
+    while len(argvs) > 1:
+        myArgv = argvs.pop(1)	# 0th is this file's name
+
+	    #--help
+        if re.match('^\-\-help$', myArgv, re.IGNORECASE):
+            HELP.GenericHelp(CONST.Version)
+            sys.exit(0)
+
+	    #--apply=<filename> as parameters file, to replace inline parameters
+        elif re.match('^\-\-Apply=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-Apply=(.+)$', myArgv, re.IGNORECASE)
+            py_params_file = matchReg.group(1)
+            with open(py_params_file,'r') as file:
+          	# The FullLoader parameter handles the conversion from YAML
+        	# scalar values to Python dictionary format
+                py_params = yaml.load(file,Loader=yaml.FullLoader)
+                py_param_file_present = True #to be removed once validated
+	    		#AssignParams(py_params) #to be uncommented once validated
+
+	    #consider inline parameters
+        elif re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE)
+            mode = matchReg.group(1)
+        elif re.match('^\-\-eNBRepository=(.+)$|^\-\-ranRepository(.+)$', myArgv, re.IGNORECASE):
+            if re.match('^\-\-eNBRepository=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNBRepository=(.+)$', myArgv, re.IGNORECASE)
+            else:
+                matchReg = re.match('^\-\-ranRepository=(.+)$', myArgv, re.IGNORECASE)
+            CiTestObj.ranRepository = matchReg.group(1)
+            RAN.ranRepository=matchReg.group(1)
+            HTML.ranRepository=matchReg.group(1)
+            ldpc.ranRepository=matchReg.group(1)
+        elif re.match('^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE):
+            if re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE)
+            else:
+                matchReg = re.match('^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE)
+            doMerge = matchReg.group(1)
+            ldpc.ranAllowMerge=matchReg.group(1)
+            if ((doMerge == 'true') or (doMerge == 'True')):
+                CiTestObj.ranAllowMerge = True
+                RAN.ranAllowMerge=True
+                HTML.ranAllowMerge=True
+        elif re.match('^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE):
+            if re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE)
+            else:
+                matchReg = re.match('^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE)
+            CiTestObj.ranBranch = matchReg.group(1)
+            RAN.ranBranch=matchReg.group(1)
+            HTML.ranBranch=matchReg.group(1)
+            ldpc.ranBranch=matchReg.group(1)
+        elif re.match('^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE):
+            if re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE)
+            else:
+                matchReg = re.match('^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE)
+            CiTestObj.ranCommitID = matchReg.group(1)
+            RAN.ranCommitID=matchReg.group(1)
+            HTML.ranCommitID=matchReg.group(1)
+            ldpc.ranCommitID=matchReg.group(1)
+        elif re.match('^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE):
+            if re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE)
+            else:
+                matchReg = re.match('^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE)
+            CiTestObj.ranTargetBranch = matchReg.group(1)
+            RAN.ranTargetBranch=matchReg.group(1)
+            HTML.ranTargetBranch=matchReg.group(1)
+            ldpc.ranTargetBranch=matchReg.group(1)
+        elif re.match('^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$', myArgv, re.IGNORECASE):
+            if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNBIPAddress=matchReg.group(1)
+                ldpc.eNBIpAddr=matchReg.group(1)
+            elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNB1IPAddress=matchReg.group(1)
+            elif re.match('^\-\-eNB2IPAddress=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNB2IPAddress=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNB2IPAddress=matchReg.group(1)
+        elif re.match('^\-\-eNBUserName=(.+)$|^\-\-eNB[1-2]UserName=(.+)$', myArgv, re.IGNORECASE):
+            if re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNBUserName=matchReg.group(1)
+                ldpc.eNBUserName=matchReg.group(1)
+            elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNB1UserName=matchReg.group(1)
+            elif re.match('^\-\-eNB2UserName=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNB2UserName=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNB2UserName=matchReg.group(1)
+        elif re.match('^\-\-eNBPassword=(.+)$|^\-\-eNB[1-2]Password=(.+)$', myArgv, re.IGNORECASE):
+            if re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNBPassword=matchReg.group(1)
+                ldpc.eNBPassWord=matchReg.group(1)
+            elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNB1Password=matchReg.group(1)
+            elif re.match('^\-\-eNB2Password=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNB2Password=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNB2Password=matchReg.group(1)
+        elif re.match('^\-\-eNBSourceCodePath=(.+)$|^\-\-eNB[1-2]SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
+            if re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNBSourceCodePath=matchReg.group(1)
+                ldpc.eNBSourceCodePath=matchReg.group(1)
+            elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNB1SourceCodePath=matchReg.group(1)
+            elif re.match('^\-\-eNB2SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
+                matchReg = re.match('^\-\-eNB2SourceCodePath=(.+)$', myArgv, re.IGNORECASE)
+                RAN.eNB2SourceCodePath=matchReg.group(1)
+        elif re.match('^\-\-EPCIPAddress=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-EPCIPAddress=(.+)$', myArgv, re.IGNORECASE)
+            EPC.IPAddress=matchReg.group(1)
+        elif re.match('^\-\-EPCUserName=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-EPCUserName=(.+)$', myArgv, re.IGNORECASE)
+            EPC.UserName=matchReg.group(1)
+        elif re.match('^\-\-EPCPassword=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-EPCPassword=(.+)$', myArgv, re.IGNORECASE)
+            EPC.Password=matchReg.group(1)
+        elif re.match('^\-\-EPCSourceCodePath=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-EPCSourceCodePath=(.+)$', myArgv, re.IGNORECASE)
+            EPC.SourceCodePath=matchReg.group(1)
+        elif re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE)
+            if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-Docker', matchReg.group(1), re.IGNORECASE):
+                EPC.Type=matchReg.group(1)
+            else:
+                sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS or OAI-Rel14-Docker)')
+        elif re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE)
+            EPC.ContainerPrefix=matchReg.group(1)
+        elif re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE)
+            CiTestObj.ADBIPAddress = matchReg.group(1)
+        elif re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE)
+            CiTestObj.ADBUserName = matchReg.group(1)
+        elif re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE)
+            if re.match('centralized', matchReg.group(1), re.IGNORECASE) or re.match('distributed', matchReg.group(1), re.IGNORECASE):
+                if re.match('distributed', matchReg.group(1), re.IGNORECASE):
+                    CiTestObj.ADBCentralized = False
+                else:
+                    CiTestObj.ADBCentralized = True
+            else:
+                sys.exit('Invalid ADB Type: ' + matchReg.group(1) + ' -- (should be centralized or distributed)')
+        elif re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE)
+            CiTestObj.ADBPassword = matchReg.group(1)
+        elif re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE)
+            CiTestObj.testXMLfiles.append(matchReg.group(1))
+            HTML.testXMLfiles.append(matchReg.group(1))
+            HTML.nbTestXMLfiles=HTML.nbTestXMLfiles+1
+        elif re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE)
+            CiTestObj.UEIPAddress = matchReg.group(1)
+        elif re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE)
+            CiTestObj.UEUserName = matchReg.group(1)
+        elif re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE)
+            CiTestObj.UEPassword = matchReg.group(1)
+        elif re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE)
+            CiTestObj.UESourceCodePath = matchReg.group(1)
+        elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE):
+            matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE)
+            finalStatus = matchReg.group(1)
+            if ((finalStatus == 'true') or (finalStatus == 'True')):
+                CiTestObj.finalStatus = True
+        else:
+            HELP.GenericHelp(CONST.Version)
+            sys.exit('Invalid Parameter: ' + myArgv)
+
+    return py_param_file_present, py_params, mode
diff --git a/ci-scripts/cls_cots_ue.py b/ci-scripts/cls_cots_ue.py
new file mode 100644
index 0000000000000000000000000000000000000000..6954aa392742f1ca77ee64d46e97b468a2614cff
--- /dev/null
+++ b/ci-scripts/cls_cots_ue.py
@@ -0,0 +1,88 @@
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements.  See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# *      http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# *      contact@openairinterface.org
+# */
+#---------------------------------------------------------------------
+# Python for CI of OAI-eNB + COTS-UE
+#
+#   Required Python Version
+#     Python 3.x
+#
+#   Required Python Package
+#     pexpect
+#---------------------------------------------------------------------
+
+#to use logging.info()
+import logging
+#to create a SSH object locally in the methods
+import sshconnection
+#time.sleep
+import time
+
+class CotsUe:
+	def __init__(self,model,UEIPAddr,UEUserName,UEPassWord):
+		self.model = model
+		self.UEIPAddr = UEIPAddr 
+		self.UEUserName = UEUserName
+		self.UEPassWord = UEPassWord
+		self.runargs = '' #on of off to toggle airplane mode on/off
+		self.__SetAirplaneRetry = 3
+
+#-----------------$
+#PUBLIC Methods$
+#-----------------$
+
+	def Check_Airplane(self):
+		mySSH = sshconnection.SSHConnection()
+		mySSH.open(self.UEIPAddr, self.UEUserName, self.UEPassWord)
+		status=mySSH.cde_check_value('sudo adb shell settings get global airplane_mode_on ', ['0','1'],5)
+		mySSH.close()
+		return status
+
+
+	def Set_Airplane(self,target_state_str):
+		mySSH = sshconnection.SSHConnection()
+		mySSH.open(self.UEIPAddr, self.UEUserName, self.UEPassWord)
+		mySSH.command('sudo adb start-server','$',5)
+		logging.info("Toggling COTS UE Airplane mode to : "+target_state_str)
+		current_state = self.Check_Airplane()
+		if target_state_str.lower()=="on": 
+			target_state=1
+		else:
+			target_state=0
+		if current_state != target_state:
+			#toggle state
+			retry = 0 
+			while (current_state!=target_state) and (retry < self.__SetAirplaneRetry):
+				mySSH.command('sudo adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS', '\$', 5)
+				mySSH.command('sudo adb shell input keyevent 20', '\$', 5)
+				mySSH.command('sudo adb shell input tap 968 324', '\$', 5)
+				time.sleep(1)
+				current_state = self.Check_Airplane()
+				retry+=1
+			if current_state != target_state:
+				logging.error("ATTENTION : Could not toggle to : "+target_state_str)
+				logging.error("Current state is : "+ str(current_state))
+		else:
+			print("Airplane mode is already "+ target_state_str)
+		mySSH.command('sudo adb kill-server','$',5)
+		mySSH.close()
+
+
+
+
diff --git a/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf
index db1c5eae2a1e81ddef717b5c997069b32b68f7f3..d834b23e30a1eb8daeee95b114a1e7e7be0865e0 100644
--- a/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf
@@ -105,6 +105,7 @@ eNBs =
       ue_TimersAndConstants_n310			      = 20;
       ue_TimersAndConstants_n311			      = 1;
       ue_TransmissionMode                                    = 1;
+      mbms_dedicated_serving_cell                       = "DISABLE"
 
       //Parameters for SIB18
       rxPool_sc_CP_Len                                       = "normal";
diff --git a/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf
index de58950df4eed9883c9d63229d92620fbebb618c..a9ccb9f78398951fcd6c78a5bd6965d506600174 100644
--- a/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf
@@ -105,6 +105,8 @@ eNBs =
       ue_TimersAndConstants_n310			      = 20;
       ue_TimersAndConstants_n311			      = 1;
       ue_TransmissionMode                                    = 1;
+      mbms_dedicated_serving_cell                       = "DISABLE"
+
 
       //Parameters for SIB18
       rxPool_sc_CP_Len                                       = "normal";
@@ -247,7 +249,6 @@ MCEs = (
                           );
 
 
-
             NETWORK_INTERFACES :
             {
                 MCE_INTERFACE_NAME_FOR_M2_ENB            = "lo";
@@ -271,12 +272,12 @@ MCEs = (
                 mcch_update_time = 10;
                 mbms_area_config_list = (
                 {
-                   common_sf_allocation_period = 2; #rf4(0) rf8(1) rf16(2) rf32(3) rf64(4) rf128(5) rf256(6)
+                   common_sf_allocation_period = 1; #rf4(0) rf8(1) rf16(2) rf32(3) rf64(4) rf128(5) rf256(6)
                    mbms_area_id = 0;
                    pmch_config_list = (
                    {
-                        allocated_sf_end=64;
-                        data_mcs=10;
+                        allocated_sf_end=40;
+                        data_mcs=20;
                         mch_scheduling_period = 0; #rf8(0)
                         mbms_session_list = (
                         {
@@ -288,7 +289,7 @@ MCEs = (
                                     mnc_length = 2;
                                 }
                                 service_id=0;
-                                lcid=5; #this must be properly defined lcid:8+service:0 -> rab_id:5
+                                lcid=5; #this must be properly defined lcid:8+service:0 -> rab_id:5 //with new RLC set lcid either 4 or 5
                         }
                         );
                    }
@@ -296,10 +297,10 @@ MCEs = (
 
                    mbms_sf_config_list = (
                    {
-                        radioframe_allocation_period=1; #n1(0) n2(1) n4(2) n8(3) n16(4) n32(5)
+                        radioframe_allocation_period=0; #n1(0) n2(1) n4(2) n8(3) n16(4) n32(5)
                         radioframe_alloocation_offset=0;
                         num_frame="oneFrame";
-                        subframe_allocation=57; #xx100000
+                        subframe_allocation=59; #xx111011 #57; #xx111001
                         //num_frame="fourFrame";
                         //subframe_allocation=14548987; #
                    }
diff --git a/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf
new file mode 100755
index 0000000000000000000000000000000000000000..5b2c90a714d773e456215098095edfd569a428fd
--- /dev/null
+++ b/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf
@@ -0,0 +1,284 @@
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+    # real_time choice in {hard, rt-preempt, no}
+    real_time       =  "no";
+    ////////// Identification parameters:
+    eNB_ID    =  0xe01;
+    cell_type =  "CELL_MACRO_ENB";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
+    
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  1;
+    plmn_list = (
+      { mcc = 222; mnc = 01; mnc_length = 2; }
+    );
+    
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+  
+    component_carriers = (
+      {
+        node_function                    = "eNodeB_3GPP";
+        node_timing                      = "synch_to_ext_device";
+        node_synch_ref                   = 0;
+        nb_antenna_ports                 = 1;
+        ue_TransmissionMode              = 1;
+        frame_type                       = "FDD"; 
+        tdd_config                       = 3;
+        tdd_config_s                     = 0;
+        prefix_type                      = "NORMAL";
+        eutra_band                       = 7;
+        downlink_frequency               = 2680000000L;
+        uplink_frequency_offset          = -120000000;
+  
+        Nid_cell                         = 0;
+        N_RB_DL                          = 25;
+        Nid_cell_mbsfn                   = 0;
+        nb_antennas_tx                   = 1;
+        nb_antennas_rx                   = 1; 
+        prach_root                       = 0;
+        tx_gain                          = 90;
+        rx_gain                          = 115;
+        pbch_repetition                  = "FALSE";
+
+        prach_config_index               = 0;
+        prach_high_speed                 = "DISABLE";
+        prach_zero_correlation           = 1;
+        prach_freq_offset                = 2;
+
+        pucch_delta_shift                = 1;
+        pucch_nRB_CQI                    = 0;
+        pucch_nCS_AN                     = 0;
+        pucch_n1_AN                      = 0;
+        pdsch_referenceSignalPower       = -29;
+        pdsch_p_b                        = 0;
+        pusch_n_SB                       = 1; 
+        pusch_enable64QAM                = "DISABLE";
+        pusch_hoppingMode                = "interSubFrame";
+        pusch_hoppingOffset              = 0;
+        pusch_groupHoppingEnabled        = "ENABLE";
+        pusch_groupAssignment            = 0;
+        pusch_sequenceHoppingEnabled     = "DISABLE";
+        pusch_nDMRS1                     = 1;
+        phich_duration                   = "NORMAL";
+        phich_resource                   = "ONESIXTH";
+        srs_enable                       = "DISABLE";
+/*
+        srs_BandwidthConfig              =;
+        srs_SubframeConfig               =;
+        srs_ackNackST                    =;
+        srs_MaxUpPts                     =;
+*/
+
+        pusch_p0_Nominal                 = -96;
+        pusch_alpha                      = "AL1";
+        pucch_p0_Nominal                 = -96;
+        msg3_delta_Preamble              = 6;
+        pucch_deltaF_Format1             = "deltaF2";
+        pucch_deltaF_Format1b            = "deltaF3";
+        pucch_deltaF_Format2             = "deltaF0";
+        pucch_deltaF_Format2a            = "deltaF0";
+        pucch_deltaF_Format2b            = "deltaF0";
+ 
+        rach_numberOfRA_Preambles        = 64;
+        rach_preamblesGroupAConfig       = "DISABLE";
+/*
+        rach_sizeOfRA_PreamblesGroupA    = ;
+        rach_messageSizeGroupA           = ;
+        rach_messagePowerOffsetGroupB    = ; 
+*/
+        rach_powerRampingStep                   = 4;
+        rach_preambleInitialReceivedTargetPower = -108;
+        rach_preambleTransMax                   = 10;
+        rach_raResponseWindowSize               = 10;
+        rach_macContentionResolutionTimer       = 48;
+        rach_maxHARQ_Msg3Tx                     = 4;
+
+      pcch_default_PagingCycle           = 128;
+      pcch_nB                            = "oneT";
+      bcch_modificationPeriodCoeff       = 2;
+      ue_TimersAndConstants_t300         = 1000;
+      ue_TimersAndConstants_t301         = 1000;
+      ue_TimersAndConstants_t310         = 1000;
+      ue_TimersAndConstants_t311         = 10000;
+      ue_TimersAndConstants_n310         = 20;
+      ue_TimersAndConstants_n311         = 1;
+
+      //Parameters for SIB18
+      rxPool_sc_CP_Len                                       = "normal"; 
+      rxPool_sc_Period                                       = "sf40";  
+      rxPool_data_CP_Len                                     = "normal";  
+      rxPool_ResourceConfig_prb_Num                          = 20;
+      rxPool_ResourceConfig_prb_Start                        = 5;
+      rxPool_ResourceConfig_prb_End                          = 44;
+      rxPool_ResourceConfig_offsetIndicator_present          = "prSmall";
+      rxPool_ResourceConfig_offsetIndicator_choice           = 0;      
+      rxPool_ResourceConfig_subframeBitmap_present           = "prBs40";
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_buf              = "00000000000000000000";
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_size             = 5;
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused      = 0;
+/*
+      rxPool_dataHoppingConfig_hoppingParameter                       = 0;
+      rxPool_dataHoppingConfig_numSubbands                            = "ns1";
+      rxPool_dataHoppingConfig_rbOffset                               = 0;
+      rxPool_commTxResourceUC-ReqAllowed                              = "TRUE";
+*/    
+      // Parameters for SIB19
+      discRxPool_cp_Len                                               = "normal"
+      discRxPool_discPeriod                                           = "rf32"
+      discRxPool_numRetx                                              = 1;   
+      discRxPool_numRepetition                                        = 2;
+      discRxPool_ResourceConfig_prb_Num                               = 5;  
+      discRxPool_ResourceConfig_prb_Start                             = 3;
+      discRxPool_ResourceConfig_prb_End                               = 21;
+      discRxPool_ResourceConfig_offsetIndicator_present               = "prSmall";
+      discRxPool_ResourceConfig_offsetIndicator_choice                = 0;      
+      discRxPool_ResourceConfig_subframeBitmap_present                = "prBs40";
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf          = "f0ffffffff";
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_size         = 5;
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused  = 0;
+
+    }
+  );
+
+    srb1_parameters :
+    {
+        # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
+        timer_poll_retransmit    = 80;
+
+        # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
+        timer_reordering         = 35;
+
+        # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
+        timer_status_prohibit    = 0;
+
+        # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
+        poll_pdu                 =  4;
+
+        # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
+        poll_byte                =  99999;
+
+        # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
+        max_retx_threshold       =  4;
+    }
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+    enable_measurement_reports = "yes";
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "CI_MME_IP_ADDR";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    ///X2
+    enable_x2 = "yes";
+    t_reloc_prep      = 1000;      /* unit: millisecond */
+    tx2_reloc_overall = 2000;      /* unit: millisecond */
+
+    NETWORK_INTERFACES : 
+    {
+        ENB_INTERFACE_NAME_FOR_S1_MME            = "eth1";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "CI_ENB_IP_ADDR";
+
+        ENB_INTERFACE_NAME_FOR_S1U               = "eth1";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "CI_ENB_IP_ADDR";
+        ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
+
+        ENB_IPV4_ADDRESS_FOR_X2C                 = "CI_ENB_IP_ADDR";
+        ENB_PORT_FOR_X2C                         = 36422; # Spec 36422
+    };
+    
+    log_config : 
+    {
+     global_log_level                      ="info"; 
+     global_log_verbosity                  ="high";
+     hw_log_level                          ="info"; 
+     hw_log_verbosity                      ="medium";
+     phy_log_level                         ="info"; 
+     phy_log_verbosity                     ="medium";
+     mac_log_level                         ="info"; 
+     mac_log_verbosity                     ="high";
+     rlc_log_level                         ="debug"; 
+     rlc_log_verbosity                     ="high";
+     pdcp_log_level                        ="info"; 
+     pdcp_log_verbosity                    ="high";
+     rrc_log_level                         ="info"; 
+     rrc_log_verbosity                     ="medium";
+   }; 
+   
+  }
+);
+
+MACRLCs = (
+  {
+    num_cc          = 1;
+    tr_s_preference = "local_L1";
+    tr_n_preference = "local_RRC";
+    phy_test_mode   = 0;
+    puSch10xSnr     =  160;
+    puCch10xSnr     =  160;
+  }  
+);
+
+THREAD_STRUCT = (
+  {
+    parallel_config = "PARALLEL_RU_L1_TRX_SPLIT";
+    worker_config   = "ENABLE";
+  }
+);
+
+L1s = (
+  {
+    num_cc          = 1;
+    tr_n_preference = "local_mac";
+  }  
+);
+
+RUs = (
+  {             
+    local_rf       = "yes"
+    nb_tx          = 1
+    nb_rx          = 1
+    att_tx         = 0
+    att_rx         = 0;
+    bands          = [7];
+    max_pdschReferenceSignalPower = -27;
+    max_rxgain                    = 118;
+    eNB_instances  = [0];
+    clock_src      = "external";
+  }
+);  
+
+log_config : 
+  {
+     global_log_level                      ="info"; 
+     global_log_verbosity                  ="high";
+     hw_log_level                          ="info"; 
+     hw_log_verbosity                      ="medium";
+     phy_log_level                         ="info"; 
+     phy_log_verbosity                     ="medium";
+     mac_log_level                         ="info"; 
+     mac_log_verbosity                     ="high";
+     rlc_log_level                         ="info"; 
+     rlc_log_verbosity                     ="high";
+     pdcp_log_level                        ="info"; 
+     pdcp_log_verbosity                    ="high";
+     rrc_log_level                         ="info"; 
+     rrc_log_verbosity                     ="medium";
+  }; 
diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf
new file mode 100755
index 0000000000000000000000000000000000000000..92af74c300248c020bc8ebedca4b5fc9e62c1f5e
--- /dev/null
+++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf
@@ -0,0 +1,291 @@
+Active_gNBs = ( "gNB-Eurecom-5GNRBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+    ////////// Identification parameters:
+    gNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_GNB";
+    gNB_name  =  "gNB-Eurecom-5GNRBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  1;
+    plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;});   
+
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+
+    ssb_SubcarrierOffset                                      = 31; //0;
+    pdsch_AntennaPorts                                        = 1;
+  
+    servingCellConfigCommon = (
+    {
+ #spCellConfigCommon
+
+      physCellId                                                    = 0;
+
+#  downlinkConfigCommon
+    #frequencyInfoDL
+      # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP)
+      absoluteFrequencySSB                                          = 641272; //641032;      #641968; 641968=start of ssb at 3600MHz + 82 RBs    641032=center of SSB at center of cell
+      dl_frequencyBand                                                 = 78;
+      # this is 3600 MHz
+      dl_absoluteFrequencyPointA                                       = 640000;
+      #scs-SpecificCarrierList
+        dl_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        dl_subcarrierSpacing                                           = 1;
+        dl_carrierBandwidth                                            = 106;
+     #initialDownlinkBWP
+      #genericParameters
+        # this is RBstart=84,L=13 (275*(L-1))+RBstart
+        initialDLBWPlocationAndBandwidth                                        = 6366; //28875; //6366; #6407; #3384;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialDLBWPsubcarrierSpacing                                           = 1;
+      #pdcch-ConfigCommon
+        initialDLBWPcontrolResourceSetZero                                      = 0;
+        initialDLBWPsearchSpaceZero                                             = 0;
+      #pdsch-ConfigCommon
+        #pdschTimeDomainAllocationList (up to 16 entries)
+             initialDLBWPk0_0                    = 0;
+             #initialULBWPmappingType
+       #0=typeA,1=typeB
+             initialDLBWPmappingType_0           = 0;
+             #this is SS=1,L=13
+             initialDLBWPstartSymbolAndLength_0  = 40;
+
+             initialDLBWPk0_1                    = 0;
+             initialDLBWPmappingType_1           = 0;
+             #this is SS=2,L=12 
+             initialDLBWPstartSymbolAndLength_1  = 53;
+
+             initialDLBWPk0_2                    = 0;
+             initialDLBWPmappingType_2           = 0;
+             #this is SS=1,L=12 
+             initialDLBWPstartSymbolAndLength_2  = 54;
+
+             initialDLBWPk0_3                    = 0;
+             initialDLBWPmappingType_3           = 0;
+             #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57)
+             initialDLBWPstartSymbolAndLength_3  = 57; //43; //57;
+  #uplinkConfigCommon 
+     #frequencyInfoUL
+      ul_frequencyBand                                                 = 78;
+      #scs-SpecificCarrierList
+      ul_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      ul_subcarrierSpacing                                           = 1;
+      ul_carrierBandwidth                                            = 106;
+      pMax                                                          = 20;
+     #initialUplinkBWP
+      #genericParameters
+        initialULBWPlocationAndBandwidth                                        = 6366; //28875; //6366; #6407; #3384;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialULBWPsubcarrierSpacing                                           = 1;
+      #rach-ConfigCommon
+        #rach-ConfigGeneric
+          prach_ConfigurationIndex                                  = 98;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+          prach_msg1_FDM                                            = 0;
+          prach_msg1_FrequencyStart                                 = 0;
+          zeroCorrelationZoneConfig                                 = 13;
+          preambleReceivedTargetPower                               = -100;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+          preambleTransMax                                          = 6;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+        powerRampingStep                                            = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+        ra_ResponseWindow                                           = 5;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR                = 4;
+#oneHalf (0..15) 4,8,12,16,...60,64
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB                   = 14; //15;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+        ra_ContentionResolutionTimer                                = 7;
+        rsrp_ThresholdSSB                                           = 19;
+#prach-RootSequenceIndex_PR
+#1 = 839, 2 = 139
+        prach_RootSequenceIndex_PR                                  = 2;
+        prach_RootSequenceIndex                                     = 1;
+        # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+        #  
+        msg1_SubcarrierSpacing                                      = 1,
+
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+        restrictedSetConfig                                         = 0,
+      # pusch-ConfigCommon (up to 16 elements)
+        initialULBWPk2_0                      = 2;
+        initialULBWPmappingType_0             = 1
+        # this is SS=0 L=11
+        initialULBWPstartSymbolAndLength_0    = 55;
+   
+  initialULBWPk2_1                      = 2;
+        initialULBWPmappingType_1             = 1;
+        # this is SS=0 L=12
+        initialULBWPstartSymbolAndLength_1    = 69;
+
+        initialULBWPk2_2                      = 7;
+        initialULBWPmappingType_2             = 1;
+        # this is SS=10 L=4
+        initialULBWPstartSymbolAndLength_2    = 52;
+
+        msg3_DeltaPreamble                                          = 1;
+        p0_NominalWithGrant                                         =-90;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+        pucchGroupHopping                                           = 0;
+        hoppingId                                                   = 40;
+        p0_nominal                                                  = -90;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+      ssb_PositionsInBurst_PR                                       = 2;
+      ssb_PositionsInBurst_Bitmap                                   = 1; #0x80;
+
+# ssb_periodicityServingCell
+# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 
+      ssb_periodicityServingCell                                    = 2;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+      dmrs_TypeA_Position                                           = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      subcarrierSpacing                                             = 1;
+
+
+  #tdd-UL-DL-ConfigurationCommon
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      referenceSubcarrierSpacing                                    = 1;
+      # pattern1 
+      # dl_UL_TransmissionPeriodicity
+      # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
+      dl_UL_TransmissionPeriodicity                                 = 6;
+      nrofDownlinkSlots                                             = 7; //8; //7;
+      nrofDownlinkSymbols                                           = 6; //0; //6;
+      nrofUplinkSlots                                               = 2;
+      nrofUplinkSymbols                                             = 4; //0; //4;
+
+  ssPBCH_BlockPower                                             = -25;
+  }
+
+  );
+
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "CI_MME_IP_ADDR";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    ///X2
+    enable_x2 = "yes";
+    t_reloc_prep      = 1000;      /* unit: millisecond */
+    tx2_reloc_overall = 2000;      /* unit: millisecond */
+    target_enb_x2_ip_address      = (
+                                     { ipv4       = "CI_FR1_CTL_ENB_IP_ADDR";
+                                       ipv6       = "192:168:30::17";
+                                       preference = "ipv4";
+                                     }
+                                    );
+
+    NETWORK_INTERFACES :
+    {
+
+        GNB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1_MME              = "CI_GNB_IP_ADDR";
+        GNB_INTERFACE_NAME_FOR_S1U               = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1U                 = "CI_GNB_IP_ADDR";
+        GNB_PORT_FOR_S1U                         = 2152; # Spec 2152
+        GNB_IPV4_ADDRESS_FOR_X2C                 = "CI_GNB_IP_ADDR";
+        GNB_PORT_FOR_X2C                         = 36422; # Spec 36422
+    };
+  }
+);
+
+MACRLCs = (
+  {
+  num_cc = 1;
+  tr_s_preference = "local_L1";
+  tr_n_preference = "local_RRC";
+        }  
+);
+
+L1s = (
+      {
+  num_cc = 1;
+  tr_n_preference = "local_mac";
+        }  
+);
+
+RUs = (
+    {      
+       local_rf       = "yes"
+         nb_tx          = 1
+         nb_rx          = 1
+         att_tx         = 0
+         att_rx         = 0;
+         bands          = [7];
+         max_pdschReferenceSignalPower = -27;
+         max_rxgain                    = 114;
+         eNB_instances  = [0];
+         clock_src = "external";
+    }
+);  
+
+THREAD_STRUCT = (
+  {
+    #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    //parallel_config    = "PARALLEL_SINGLE_THREAD";
+    #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+    worker_config      = "WORKER_ENABLE";
+  }
+);
+
+     log_config :
+     {
+       global_log_level                      ="info";
+       global_log_verbosity                  ="medium";
+       hw_log_level                          ="info";
+       hw_log_verbosity                      ="medium";
+       phy_log_level                         ="info";
+       phy_log_verbosity                     ="medium";
+       mac_log_level                         ="info";
+       mac_log_verbosity                     ="high";
+       rlc_log_level                         ="info";
+       rlc_log_verbosity                     ="medium";
+       pdcp_log_level                        ="info";
+       pdcp_log_verbosity                    ="medium";
+       rrc_log_level                         ="info";
+       rrc_log_verbosity                     ="medium";
+    };
+
diff --git a/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf
new file mode 100644
index 0000000000000000000000000000000000000000..e3adedbf4a86a6fef55814ec838c8967c94c7472
--- /dev/null
+++ b/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf
@@ -0,0 +1,426 @@
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+    ////////// Identification parameters:
+    eNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_ENB";
+
+    eNB_name  =  "eNB-Eurecom-LTEBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code = 1;
+    plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } );
+
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+
+    component_carriers = (
+      {
+      node_function             = "3GPP_eNODEB";
+      node_timing               = "synch_to_ext_device";
+      node_synch_ref            = 0;
+      frame_type					      = "FDD";
+      tdd_config 					      = 3;
+      tdd_config_s            			      = 0;
+      prefix_type             			      = "NORMAL";
+      eutra_band              			      = 7;
+      downlink_frequency      			      = 2680000000L;
+      uplink_frequency_offset 			      = -120000000;
+      Nid_cell					      = 0;
+      N_RB_DL                 			      = 25;
+      Nid_cell_mbsfn          			      = 0;
+      nb_antenna_ports                                = 1;
+      nb_antennas_tx          			      = 1;
+      nb_antennas_rx          			      = 1;
+      tx_gain                                            = 90;
+      rx_gain                                            = 125;
+      pbch_repetition                                 = "FALSE";
+      prach_root              			      = 0;
+      prach_config_index      			      = 0;
+      prach_high_speed        			      = "DISABLE";
+      prach_zero_correlation  			      = 1;
+      prach_freq_offset       			      = 2;
+      pucch_delta_shift       			      = 1;
+      pucch_nRB_CQI           			      = 0;
+      pucch_nCS_AN            			      = 0;
+      pucch_n1_AN             			      = 0;
+      pdsch_referenceSignalPower 			      = -27;
+      pdsch_p_b                  			      = 0;
+      pusch_n_SB                 			      = 1;
+      pusch_enable64QAM          			      = "DISABLE";
+      pusch_hoppingMode                                  = "interSubFrame";
+      pusch_hoppingOffset                                = 0;
+      pusch_groupHoppingEnabled  			      = "ENABLE";
+      pusch_groupAssignment      			      = 0;
+      pusch_sequenceHoppingEnabled		   	      = "DISABLE";
+      pusch_nDMRS1                                       = 1;
+      phich_duration                                     = "NORMAL";
+      phich_resource                                     = "ONESIXTH";
+      srs_enable                                         = "DISABLE";
+      /*  srs_BandwidthConfig                                =;
+      srs_SubframeConfig                                 =;
+      srs_ackNackST                                      =;
+      srs_MaxUpPts                                       =;*/
+
+      pusch_p0_Nominal                                   = -96;
+      pusch_alpha                                        = "AL1";
+      pucch_p0_Nominal                                   = -104;
+      msg3_delta_Preamble                                = 6;
+      pucch_deltaF_Format1                               = "deltaF2";
+      pucch_deltaF_Format1b                              = "deltaF3";
+      pucch_deltaF_Format2                               = "deltaF0";
+      pucch_deltaF_Format2a                              = "deltaF0";
+      pucch_deltaF_Format2b		    	      = "deltaF0";
+
+      rach_numberOfRA_Preambles                          = 64;
+      rach_preamblesGroupAConfig                         = "DISABLE";
+      /*
+      rach_sizeOfRA_PreamblesGroupA                      = ;
+      rach_messageSizeGroupA                             = ;
+      rach_messagePowerOffsetGroupB                      = ;
+      */
+      rach_powerRampingStep                              = 4;
+      rach_preambleInitialReceivedTargetPower            = -108;
+      rach_preambleTransMax                              = 10;
+      rach_raResponseWindowSize                          = 10;
+      rach_macContentionResolutionTimer                  = 48;
+      rach_maxHARQ_Msg3Tx                                = 4;
+
+      pcch_default_PagingCycle                           = 128;
+      pcch_nB                                            = "oneT";
+      bcch_modificationPeriodCoeff			      = 2;
+      ue_TimersAndConstants_t300			      = 1000;
+      ue_TimersAndConstants_t301			      = 1000;
+      ue_TimersAndConstants_t310			      = 1000;
+      ue_TimersAndConstants_t311			      = 10000;
+      ue_TimersAndConstants_n310			      = 20;
+      ue_TimersAndConstants_n311			      = 1;
+      ue_TransmissionMode                                    = 1;
+      mbms_dedicated_serving_cell                       = "ENABLE"
+
+      //Parameters for SIB18
+      rxPool_sc_CP_Len                                       = "normal";
+      rxPool_sc_Period                                       = "sf40";
+      rxPool_data_CP_Len                                     = "normal";
+      rxPool_ResourceConfig_prb_Num                          = 20;
+      rxPool_ResourceConfig_prb_Start                        = 5;
+      rxPool_ResourceConfig_prb_End                          = 44;
+      rxPool_ResourceConfig_offsetIndicator_present          = "prSmall";
+      rxPool_ResourceConfig_offsetIndicator_choice           = 0;
+      rxPool_ResourceConfig_subframeBitmap_present           = "prBs40";
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_buf              = "00000000000000000000";
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_size             = 5;
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused      = 0;
+/*    rxPool_dataHoppingConfig_hoppingParameter                       = 0;
+      rxPool_dataHoppingConfig_numSubbands                            = "ns1";
+      rxPool_dataHoppingConfig_rbOffset                               = 0;
+      rxPool_commTxResourceUC-ReqAllowed                              = "TRUE";
+*/
+      // Parameters for SIB19
+      discRxPool_cp_Len                                               = "normal"
+      discRxPool_discPeriod                                           = "rf32"
+      discRxPool_numRetx                                              = 1;
+      discRxPool_numRepetition                                        = 2;
+      discRxPool_ResourceConfig_prb_Num                               = 5;
+      discRxPool_ResourceConfig_prb_Start                             = 3;
+      discRxPool_ResourceConfig_prb_End                               = 21;
+      discRxPool_ResourceConfig_offsetIndicator_present               = "prSmall";
+      discRxPool_ResourceConfig_offsetIndicator_choice                = 0;
+      discRxPool_ResourceConfig_subframeBitmap_present                = "prBs40";
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf          = "f0ffffffff";
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_size         = 5;
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused  = 0;
+
+      }
+    );
+
+
+    srb1_parameters :
+    {
+        # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
+        timer_poll_retransmit    = 80;
+
+        # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
+        timer_reordering         = 35;
+
+        # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
+        timer_status_prohibit    = 0;
+
+        # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
+        poll_pdu                 =  4;
+
+        # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
+        poll_byte                =  99999;
+
+        # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
+        max_retx_threshold       =  4;
+    }
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "CI_MME_IP_ADDR";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    enable_measurement_reports = "no";
+
+    ///X2
+    enable_x2 = "no";
+    t_reloc_prep      = 1000;      /* unit: millisecond */
+    tx2_reloc_overall = 2000;      /* unit: millisecond */
+
+ ////////// MCE parameters:
+    target_mce_m2_ip_address      = ( { ipv4       = "127.0.0.7";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    ///M2
+    enable_enb_m2 = "yes";
+   
+
+    mbms_configuration_data_list = (
+                {
+                        mbsfn_sync_area = 0x0001;
+                        mbms_service_area_list=(
+                                {
+                                        mbms_service_area=0x0001;
+                                }
+                        );
+                }
+
+    );
+
+
+
+    NETWORK_INTERFACES :
+    {
+
+        ENB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "CI_ENB_IP_ADDR";
+        ENB_INTERFACE_NAME_FOR_S1U               = "eth0";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "CI_ENB_IP_ADDR";
+        ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
+        ENB_IPV4_ADDRESS_FOR_X2C                 = "CI_ENB_IP_ADDR";
+        ENB_PORT_FOR_X2C                         = 36422; # Spec 36422
+
+        ENB_IPV4_ADDRESS_FOR_M2C                 = "127.0.0.2/24";
+        ENB_PORT_FOR_M2C                         = 36443; # Spec 36443
+    };
+  }
+);
+
+MACRLCs = (
+	{
+	num_cc = 1;
+	tr_s_preference = "local_L1";
+	tr_n_preference = "local_RRC";
+	phy_test_mode = 0;
+        puSch10xSnr     =  200;
+        puCch10xSnr     =  200;
+        }
+);
+
+L1s = (
+      {
+	num_cc = 1;
+	tr_n_preference = "local_mac";
+      }
+);
+
+MCEs = (
+        {
+            MCE_ID    =  0xe00;
+
+            MCE_name  =  "MCE-Vicomtech-LTEBox";
+
+            //M2
+            enable_mce_m2 = "yes";
+
+            //M3
+            enable_mce_m3 = "yes";
+
+            target_mme_m3_ip_address      = ( { ipv4       = "127.0.0.18";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+
+
+            NETWORK_INTERFACES :
+            {
+                MCE_INTERFACE_NAME_FOR_M2_ENB            = "lo";
+                MCE_IPV4_ADDRESS_FOR_M2C                 = "127.0.0.7/24";
+                MCE_PORT_FOR_M2C                         = 36443; # Spec 36443
+
+                MCE_INTERFACE_NAME_FOR_M3_MME            = "lo";
+                MCE_IPV4_ADDRESS_FOR_M3C                 = "127.0.0.3/24";
+                MCE_PORT_FOR_M3C                         = 36444; # Spec 36444
+            };
+
+            plnm:
+            {
+                mcc = 208;
+                mnc = 93;
+                mnc_length = 2;
+            };
+
+            mbms_sched_info :
+            {
+                mcch_update_time = 10;
+                mbms_area_config_list = (
+                {
+                   common_sf_allocation_period = 1; #rf4(0) rf8(1) rf16(2) rf32(3) rf64(4) rf128(5) rf256(6)
+                   mbms_area_id = 0;
+                   pmch_config_list = (
+                   {
+                        allocated_sf_end=512;
+                        data_mcs=15;
+                        mch_scheduling_period = 0; #rf8(0) rf16(1) rf32(2) rf64(3) rf128(4) rf256(5) rf512(6) rf1024(7)
+                        mbms_session_list = (
+                        {
+                                #plnm + service_id ->tmgi
+                               plnm:
+                                {
+                                    mcc = 208;
+                                    mnc = 93;
+                                    mnc_length = 2;
+                                }
+                                service_id=0; #keep this allways as 0 (workaround for TUN if)
+                                lcid=5; #this must be properly defined lcid:6+service:0 -> rab_id:5 //with new RLC set lcid either 4 or 5
+                        }
+                        );
+                   }
+                   );
+
+                   mbms_sf_config_list = (
+                   {
+                        radioframe_allocation_period=0; #n1(0) n2(1) n4(2) n8(3) n16(4) n32(5)
+                        radioframe_alloocation_offset=0;
+                        num_frame="oneFrame";
+                        subframe_allocation=57; #xx111001
+                        //num_frame="fourFrame";
+                        //subframe_allocation=14548987; #
+                   }
+                   );
+
+                }
+                );
+            };
+
+
+            mcch_config_per_mbsfn_area = (
+            {
+                mbsfn_area                = 0;
+                pdcch_length              = 1; #s1(0), s2(1)
+                repetition_period         = 0; #rf32(0), rf64(1), rf128(2), rf256(3)
+                offset                    = 0;
+                modification_period       = 0; #rf512(0; rf1024(1)
+                subframe_allocation_info = 32; #BITSTRING (6bits -> one frame) xx100000
+                mcs                       = 0; #n2(0), n7(1), n13(2), n19(3)
+            }
+            );
+
+                  #);  #end mbms_scheduling_info
+
+        }
+);
+
+MMEs = (
+        {
+            MME_ID    =  0xe00;
+
+            MME_name  =  "MME-MBMS-Vicomtech-LTEBox";
+
+            //M3
+            enable_mme_m3 = "yes";
+            NETWORK_INTERFACES :
+            {
+                MME_INTERFACE_NAME_FOR_M3_MCE            = "lo";
+                MME_IPV4_ADDRESS_FOR_M3C                 = "127.0.0.18/24";
+                MME_PORT_FOR_M3C                         = 36444; # Spec 36444
+
+            };
+        }
+);
+
+
+RUs = (
+    {
+       local_rf       = "yes"
+         nb_tx          = 1
+         nb_rx          = 1
+         att_tx         = 0
+         att_rx         = 0;
+         bands          = [7];
+         max_pdschReferenceSignalPower = -27;
+         max_rxgain                    = 125;
+         eNB_instances  = [0];
+
+    }
+);
+
+THREAD_STRUCT = (
+  {
+    #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+    parallel_config    = "PARALLEL_SINGLE_THREAD";
+    #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+    worker_config      = "WORKER_ENABLE";
+  }
+);
+
+NETWORK_CONTROLLER :
+{
+    FLEXRAN_ENABLED        = "no";
+    FLEXRAN_INTERFACE_NAME = "ens3";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
+    FLEXRAN_PORT           = 2210;
+    FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
+    FLEXRAN_AWAIT_RECONF   = "no";
+};
+
+     log_config :
+     {
+       global_log_level                      ="info";
+       global_log_verbosity                  ="medium";
+       hw_log_level                          ="info";
+       hw_log_verbosity                      ="medium";
+       phy_log_level                         ="info";
+       phy_log_verbosity                     ="medium";
+       mac_log_level                         ="info";
+       mac_log_verbosity                     ="high";
+       rlc_log_level                         ="info";
+       rlc_log_verbosity                     ="medium";
+       pdcp_log_level                        ="info";
+       pdcp_log_verbosity                    ="medium";
+       rrc_log_level                         ="info";
+       rrc_log_verbosity                     ="medium";
+    };
+
+//rfsimulator :
+//{
+   //options = ("chanmod");
+   //modelname = "AWGN";
+//};
+        
diff --git a/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf
index 53261ec32de1b7b5bed2316fd7bdc08445257f4e..3d5a859156310b023c611a26e04a76de2a349ad8 100644
--- a/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf
+++ b/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf
@@ -102,6 +102,7 @@ eNBs =
       ue_TimersAndConstants_n310			      = 20;
       ue_TimersAndConstants_n311			      = 1;
       ue_TransmissionMode                                    = 1;
+      mbms_dedicated_serving_cell                       = "DISABLE"
 
       //Parameters for SIB18
       rxPool_sc_CP_Len                                       = "normal";
@@ -295,8 +296,8 @@ MCEs = (
                    pmch_config_list = (
                    {
                         allocated_sf_end=32;
-                        data_mcs=14;
-                        mch_scheduling_period = 0; #rf8(0)
+                        data_mcs=15;
+                        mch_scheduling_period = 0; #rf8(0) rf16(1) rf32(2) rf64(3) rf128(4) rf256(5) rf512(6) rf1024(7)
                         mbms_session_list = (
                         {
                                 #plnm + service_id ->tmgi
@@ -337,7 +338,7 @@ MCEs = (
                 offset                    = 0;
                 modification_period       = 0; #rf512(0; rf1024(1)
                 subframe_allocation_info = 32; #BITSTRING (6bits -> one frame) xx100000
-                mcs                       = 1; #n2(0), n7(1), n13(2), n19(3)
+                mcs                       = 0; #n2(0), n7(1), n13(2), n19(3)
             }
             );
 
@@ -416,3 +417,10 @@ NETWORK_CONTROLLER :
        rrc_log_level                         ="info";
        rrc_log_verbosity                     ="medium";
     };
+
+//rfsimulator :
+//{
+   //options = ("chanmod");
+   //modelname = "AWGN";
+//};
+        
diff --git a/ci-scripts/epc.py b/ci-scripts/epc.py
index 09d500f203d185fc00fd0778721a1b5e542d4a38..25bbbba091b3ad6b65ed8e5b0a976e883de06a4b 100644
--- a/ci-scripts/epc.py
+++ b/ci-scripts/epc.py
@@ -66,38 +66,6 @@ class EPCManagement():
 		self.MmeIPAddress = ''
 		self.containerPrefix = 'prod'
 
-#-----------------------------------------------------------
-# Setter and Getters on Public Members
-#-----------------------------------------------------------
-
-	def SetIPAddress(self, ipaddress):
-		self.IPAddress = ipaddress
-	def GetIPAddress(self):
-		return self.IPAddress
-	def SetUserName(self, username):
-		self.UserName = username
-	def GetUserName(self):
-		return self.UserName
-	def SetPassword(self, password):
-		self.Password = password
-	def GetPassword(self):
-		return self.Password
-	def SetSourceCodePath(self, sourcecodepath):
-		self.SourceCodePath = sourcecodepath
-	def GetSourceCodePath(self):
-		return self.SourceCodePath
-	def SetType(self, kind):
-		self.Type = kind
-	def GetType(self):
-		return self.Type
-	def SetHtmlObj(self, obj):
-		self.htmlObj = obj
-	def SetTestCase_id(self, idx):
-		self.testCase_id = idx
-	def GetMmeIPAddress(self):
-		return self.MmeIPAddress
-	def SetContainerPrefix(self, prefix):
-		self.containerPrefix = prefix
 
 #-----------------------------------------------------------
 # EPC management functions
diff --git a/ci-scripts/html.py b/ci-scripts/html.py
index 8fa99fa61b0be9890c60dd06e46cfa690a7287c8..8f2d38cced95600c4ae587ba65aab2f871d3edc5 100644
--- a/ci-scripts/html.py
+++ b/ci-scripts/html.py
@@ -82,73 +82,14 @@ class HTMLManagement():
 #-----------------------------------------------------------
 # Setters and Getters
 #-----------------------------------------------------------
-	def SethtmlUEFailureMsg(self,huefa):
-		self.htmlUEFailureMsg = huefa
-	def GethtmlUEFailureMsg(self):
-		return self.htmlUEFailureMsg
-	def SetHmleNBFailureMsg(self, msg):
-		self.htmleNBFailureMsg = msg
-
-	def Setdesc(self, dsc):
-		self.desc = dsc
-
-	def SetstartTime(self, sttime):
-		self.startTime = sttime
-
-	def SettestCase_id(self, tcid):
-		self.testCase_id = tcid
-	def GettestCase_id(self):
-		return self.testCase_id
-
-	def SetranRepository(self, repository):
-		self.ranRepository = repository
-	def SetranAllowMerge(self, merge):
-		self.ranAllowMerge = merge
-	def SetranBranch(self, branch):
-		self.ranBranch = branch
-	def SetranCommitID(self, commitid):
-		self.ranCommitID = commitid
-	def SetranTargetBranch(self, tbranch):
-		self.ranTargetBranch = tbranch
-
+	
 	def SethtmlUEConnected(self, nbUEs):
 		if nbUEs > 0:
 			self.htmlUEConnected = nbUEs
 		else:
 			self.htmlUEConnected = 1
-	def SethtmlNb_Smartphones(self, nbUEs):
-		self.htmlNb_Smartphones = nbUEs
-	def SethtmlNb_CATM_Modules(self, nbUEs):
-		self.htmlNb_CATM_Modules = nbUEs
-
-	def SetnbTestXMLfiles(self, nb):
-		self.nbTestXMLfiles = nb
-	def GetnbTestXMLfiles(self):
-		return self.nbTestXMLfiles
-
-	def SettestXMLfiles(self, xmlFile):
-		self.testXMLfiles.append(xmlFile)
-	def SethtmlTabRefs(self, tabRef):
-		self.htmlTabRefs.append(tabRef)
-	def SethtmlTabNames(self, tabName):
-		self.htmlTabNames.append(tabName)
-	def SethtmlTabIcons(self, tabIcon):
-		self.htmlTabIcons.append(tabIcon)
+	
 
-	def SetOsVersion(self, version, idx):
-		self.OsVersion[idx] = version
-	def SetKernelVersion(self, version, idx):
-		self.KernelVersion[idx] = version
-	def SetUhdVersion(self, version, idx):
-		self.UhdVersion[idx] = version
-	def SetUsrpBoard(self, version, idx):
-		self.UsrpBoard[idx] = version
-	def SetCpuNb(self, nb, idx):
-		self.CpuNb[idx] = nb
-	def SetCpuModel(self, model, idx):
-		self.CpuModel[idx] = model
-	def SetCpuMHz(self, freq, idx):
-		self.CpuMHz[idx] = freq
 
 #-----------------------------------------------------------
 # HTML structure creation functions
diff --git a/ci-scripts/main.py b/ci-scripts/main.py
index 63358eca38a8f3c79d17db1037daa6702d06c780..d37f205f4e6a11cb72ebacb3455613b52b21d2f9 100644
--- a/ci-scripts/main.py
+++ b/ci-scripts/main.py
@@ -1,4 +1,4 @@
-
+#/*
 # * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
@@ -28,15 +28,30 @@
 #     pexpect
 #---------------------------------------------------------------------
 
+
+
+#-----------------------------------------------------------
+# Import Components
+#-----------------------------------------------------------
+
+import helpreadme as HELP
 import constants as CONST
 
+import cls_physim           #class PhySim for physical simulators build and test
+import cls_cots_ue			#class CotsUe for Airplane mode control
+
+import sshconnection 
+import epc
+import ran
+import html
+
 
 #-----------------------------------------------------------
-# Import
+# Import Libs
 #-----------------------------------------------------------
 import sys		# arg
 import re		# reg
-import pexpect		# pexpect
+import pexpect	# pexpect
 import time		# sleep
 import os
 import subprocess
@@ -51,8 +66,9 @@ logging.basicConfig(
 )
 
 
+
 #-----------------------------------------------------------
-# Class Declaration
+# OaiCiTest Class Definition
 #-----------------------------------------------------------
 class OaiCiTest():
 	
@@ -97,12 +113,13 @@ class OaiCiTest():
 		self.UEIPAddress = ''
 		self.UEUserName = ''
 		self.UEPassword = ''
-		self.UE_instance = ''
+		self.UE_instance = 0
 		self.UESourceCodePath = ''
 		self.UELogFile = ''
 		self.Build_OAI_UE_args = ''
 		self.Initialize_OAI_UE_args = ''
 		self.clean_repository = True
+		self.air_interface=''
 		self.expectedNbOfConnectedUEs = 0
 
 	def BuildOAIUE(self):
@@ -112,10 +129,10 @@ class OaiCiTest():
 		SSH.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
 		result = re.search('--nrUE', self.Build_OAI_UE_args)
 		if result is not None:
-			RAN.Setair_interface('nr')
+			self.air_interface='nr-uesoftmodem'
 			ue_prefix = 'NR '
 		else:
-			RAN.Setair_interface('lte')
+			self.air_interface='lte-uesoftmodem'
 			ue_prefix = ''
 		result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository)
 		if result is not None:
@@ -155,7 +172,7 @@ class OaiCiTest():
 						mismatch = True
 				if not mismatch:
 					SSH.close()
-					HTML.CreateHtmlTestRow(RAN.GetBuild_eNB_args(), 'OK', CONST.ALL_PROCESSES_OK)
+					HTML.CreateHtmlTestRow(self.Build_OAI_UE_args, 'OK', CONST.ALL_PROCESSES_OK)
 					return
 
 			SSH.command('echo ' + self.UEPassword + ' | sudo -S git clean -x -d -ff', '\$', 30)
@@ -181,7 +198,7 @@ class OaiCiTest():
 		SSH.command('ls ran_build/build', '\$', 3)
 		SSH.command('ls ran_build/build', '\$', 3)
 		buildStatus = True
-		result = re.search(RAN.Getair_interface() + '-uesoftmodem', SSH.getBefore())
+		result = re.search(self.air_interface, SSH.getBefore())
 		if result is None:
 			buildStatus = False
 		SSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5)
@@ -209,33 +226,33 @@ class OaiCiTest():
 			sys.exit(1)
 	
 	def CheckFlexranCtrlInstallation(self):
-		if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '':
+		if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '':
 			return
-		SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
+		SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
 		SSH.command('ls -ls /opt/flexran_rtc/*/rt_controller', '\$', 5)
 		result = re.search('/opt/flexran_rtc/build/rt_controller', SSH.getBefore())
 		if result is not None:
-			RAN.SetflexranCtrlInstalled(True)
+			RAN.flexranCtrlInstalled=True
 			logging.debug('Flexran Controller is installed')
 		SSH.close()
 
 	def InitializeFlexranCtrl(self):
-		if RAN.GetflexranCtrlInstalled() == False:
+		if RAN.flexranCtrlInstalled == False:
 			return
-		if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '':
+		if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '':
 			HELP.GenericHelp(CONST.Version)
 			sys.exit('Insufficient Parameter')
-		SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
+		SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
 		SSH.command('cd /opt/flexran_rtc', '\$', 5)
-		SSH.command('echo ' + EPC.GetPassword() + ' | sudo -S rm -f log/*.log', '\$', 5)
-		SSH.command('echo ' + EPC.GetPassword() + ' | sudo -S echo "build/rt_controller -c log_config/basic_log" > ./my-flexran-ctl.sh', '\$', 5)
-		SSH.command('echo ' + EPC.GetPassword() + ' | sudo -S chmod 755 ./my-flexran-ctl.sh', '\$', 5)
-		SSH.command('echo ' + EPC.GetPassword() + ' | sudo -S daemon --unsafe --name=flexran_rtc_daemon --chdir=/opt/flexran_rtc -o /opt/flexran_rtc/log/flexranctl_' + self.testCase_id + '.log ././my-flexran-ctl.sh', '\$', 5)
+		SSH.command('echo ' + EPC.Password + ' | sudo -S rm -f log/*.log', '\$', 5)
+		SSH.command('echo ' + EPC.Password + ' | sudo -S echo "build/rt_controller -c log_config/basic_log" > ./my-flexran-ctl.sh', '\$', 5)
+		SSH.command('echo ' + EPC.Password + ' | sudo -S chmod 755 ./my-flexran-ctl.sh', '\$', 5)
+		SSH.command('echo ' + EPC.Password + ' | sudo -S daemon --unsafe --name=flexran_rtc_daemon --chdir=/opt/flexran_rtc -o /opt/flexran_rtc/log/flexranctl_' + self.testCase_id + '.log ././my-flexran-ctl.sh', '\$', 5)
 		SSH.command('ps -aux | grep --color=never rt_controller', '\$', 5)
 		result = re.search('rt_controller -c ', SSH.getBefore())
 		if result is not None:
 			logging.debug('\u001B[1m Initialize FlexRan Controller Completed\u001B[0m')
-			RAN.SetflexranCtrlStarted(True)
+			RAN.flexranCtrlStarted=True
 		SSH.close()
 		HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
 	
@@ -306,14 +323,14 @@ class OaiCiTest():
 		if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '':
 			HELP.GenericHelp(CONST.Version)
 			sys.exit('Insufficient Parameter')
-		if RAN.Getair_interface() == 'lte':
+		if self.air_interface == 'lte-uesoftmodem':
 			result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args))
 			if result is None:
 				check_eNB = True
 				check_OAI_UE = False
 				pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
 				if (pStatus < 0):
-					HTML.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'KO', pStatus)
+					HTML.CreateHtmlTestRow(self.air_interface + ' ' + self.Initialize_OAI_UE_args, 'KO', pStatus)
 					HTML.CreateHtmlTabFooter(False)
 					sys.exit(1)
 			UE_prefix = ''
@@ -335,7 +352,7 @@ class OaiCiTest():
 		# Initialize_OAI_UE_args usually start with -C and followed by the location in repository
 		SSH.command('source oaienv', '\$', 5)
 		SSH.command('cd cmake_targets/ran_build/build', '\$', 5)
-		if RAN.Getair_interface() == 'lte':
+		if self.air_interface == 'lte-uesoftmodem':
 			result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args))
 			# We may have to regenerate the .u* files
 			if result is None:
@@ -351,13 +368,13 @@ class OaiCiTest():
 			SSH.command('if [ -e rbconfig.raw ]; then echo ' + self.UEPassword + ' | sudo -S rm rbconfig.raw; fi', '\$', 5)
 			SSH.command('if [ -e reconfig.raw ]; then echo ' + self.UEPassword + ' | sudo -S rm reconfig.raw; fi', '\$', 5)
 			# Copy the RAW files from gNB running directory (maybe on another machine)
-			copyin_res = SSH.copyin(RAN.GeteNBIPAddress(), RAN.GeteNBUserName(), RAN.GeteNBPassword(), RAN.GeteNBSourceCodePath() + '/cmake_targets/rbconfig.raw', '.')
+			copyin_res = SSH.copyin(RAN.eNBIPAddress, RAN.eNBUserName, RAN.eNBPassword, RAN.eNBSourceCodePath + '/cmake_targets/rbconfig.raw', '.')
 			if (copyin_res == 0):
 				SSH.copyout(self.UEIPAddress, self.UEUserName, self.UEPassword, './rbconfig.raw', self.UESourceCodePath + '/cmake_targets/ran_build/build')
-			copyin_res = SSH.copyin(RAN.GeteNBIPAddress(), RAN.GeteNBUserName(), RAN.GeteNBPassword(), RAN.GeteNBSourceCodePath() + '/cmake_targets/reconfig.raw', '.')
+			copyin_res = SSH.copyin(RAN.eNBIPAddress, RAN.eNBUserName, RAN.eNBPassword, RAN.eNBSourceCodePath + '/cmake_targets/reconfig.raw', '.')
 			if (copyin_res == 0):
 				SSH.copyout(self.UEIPAddress, self.UEUserName, self.UEPassword, './reconfig.raw', self.UESourceCodePath + '/cmake_targets/ran_build/build')
-		SSH.command('echo "ulimit -c unlimited && ./'+ RAN.Getair_interface() +'-uesoftmodem ' + self.Initialize_OAI_UE_args + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
+		SSH.command('echo "ulimit -c unlimited && ./'+ self.air_interface +' ' + self.Initialize_OAI_UE_args + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
 		SSH.command('chmod 775 ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
 		SSH.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log', '\$', 5)
 		self.UELogFile = 'ue_' + self.testCase_id + '.log'
@@ -370,9 +387,7 @@ class OaiCiTest():
 		while (doOutterLoop):
 			SSH.command('cd ' + self.UESourceCodePath + '/cmake_targets/ran_build/build', '\$', 5)
 			SSH.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log', '\$', 5)
-			#use nohup instead of daemon
-			#SSH.command('echo ' + self.UEPassword + ' | sudo -S -E daemon --inherit --unsafe --name=ue' + str(self.UE_instance) + '_daemon --chdir=' + self.UESourceCodePath + '/cmake_targets/ran_build/build -o ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
-			SSH.command('echo $USER; nohup sudo ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh' + ' > ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log ' + ' 2>&1 &', self.UEUserName, 5)
+			SSH.command('echo $USER; nohup sudo -E ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh' + ' > ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log ' + ' 2>&1 &', self.UEUserName, 5)
 			time.sleep(6)
 			SSH.command('cd ../..', '\$', 5)
 			doLoop = True
@@ -388,7 +403,7 @@ class OaiCiTest():
 					doLoop = False
 					continue
 				SSH.command('stdbuf -o0 cat ue_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4)
-				if RAN.Getair_interface() == 'nr':
+				if self.air_interface == 'nr-uesoftmodem':
 					result = re.search('Starting sync detection', SSH.getBefore())
 				else:
 					result = re.search('got sync', SSH.getBefore())
@@ -413,7 +428,7 @@ class OaiCiTest():
 			# That is the case for LTE
 			# In NR case, it's a positive message that will show if synchronization occurs
 			doLoop = True
-			if RAN.Getair_interface() == 'nr':
+			if self.air_interface == 'nr-uesoftmodem':
 				loopCounter = 10
 			else:
 				# We are now checking if sync w/ eNB DOES NOT OCCUR
@@ -422,7 +437,7 @@ class OaiCiTest():
 			while (doLoop):
 				loopCounter = loopCounter - 1
 				if (loopCounter == 0):
-					if RAN.Getair_interface() == 'nr':
+					if self.air_interface == 'nr-uesoftmodem':
 						# Here we do have great chances that UE did NOT cell-sync w/ gNB
 						doLoop = False
 						fullSyncStatus = False
@@ -441,7 +456,7 @@ class OaiCiTest():
 						fullSyncStatus = True
 						continue
 				SSH.command('stdbuf -o0 cat ue_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync|Frequency"', '\$', 4)
-				if RAN.Getair_interface() == 'nr':
+				if self.air_interface == 'nr-uesoftmodem':
 					# Positive messaging -->
 					result = re.search('Measured Carrier Frequency', SSH.getBefore())
 					if result is not None:
@@ -470,12 +485,12 @@ class OaiCiTest():
 
 		if fullSyncStatus and gotSyncStatus:
 			doInterfaceCheck = False
-			if RAN.Getair_interface() == 'lte':
+			if self.air_interface == 'lte-uesoftmodem':
 				result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args))
 				if result is None:
 					doInterfaceCheck = True
 			# For the moment, only in explicit noS1 without kernel module (ie w/ tunnel interface)
-			if RAN.Getair_interface() == 'nr':
+			if self.air_interface == 'nr-uesoftmodem':
 				result = re.search('--noS1 --nokrnmod 1', str(self.Initialize_OAI_UE_args))
 				if result is not None:
 					doInterfaceCheck = True
@@ -491,7 +506,7 @@ class OaiCiTest():
 					logging.debug(SSH.getBefore())
 					logging.error('\u001B[1m oaitun_ue1 interface is either NOT mounted or NOT configured\u001B[0m')
 					tunnelInterfaceStatus = False
-				if RAN.GeteNBmbmsEnable(0):
+				if RAN.eNBmbmsEnables[0]:
 					SSH.command('ifconfig oaitun_uem1', '\$', 4)
 					result = re.search('inet addr', SSH.getBefore())
 					if result is not None:
@@ -507,7 +522,7 @@ class OaiCiTest():
 
 		SSH.close()
 		if fullSyncStatus and gotSyncStatus and tunnelInterfaceStatus:
-			HTML.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'OK', CONST.ALL_PROCESSES_OK, 'OAI UE')
+			HTML.CreateHtmlTestRow(self.air_interface + ' ' + self.Initialize_OAI_UE_args, 'OK', CONST.ALL_PROCESSES_OK, 'OAI UE')
 			logging.debug('\u001B[1m Initialize OAI UE Completed\u001B[0m')
 			if (self.ADBIPAddress != 'none'):
 				self.UEDevices = []
@@ -515,15 +530,15 @@ class OaiCiTest():
 				self.UEDevicesStatus = []
 				self.UEDevicesStatus.append(CONST.UE_STATUS_DETACHED)
 		else:
-			if RAN.Getair_interface() == 'lte':
-				if RAN.GeteNBmbmsEnable(0):
-					HTML.SethtmlUEFailureMsg('oaitun_ue1/oaitun_uem1 interfaces are either NOT mounted or NOT configured')
+			if self.air_interface == 'lte-uesoftmodem':
+				if RAN.eNBmbmsEnables[0]:
+					HTML.htmlUEFailureMsg='oaitun_ue1/oaitun_uem1 interfaces are either NOT mounted or NOT configured'
 				else:
-					HTML.SethtmlUEFailureMsg('oaitun_ue1 interface is either NOT mounted or NOT configured')
-				HTML.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'KO', CONST.OAI_UE_PROCESS_NO_TUNNEL_INTERFACE, 'OAI UE')
+					HTML.htmlUEFailureMsg='oaitun_ue1 interface is either NOT mounted or NOT configured'
+				HTML.CreateHtmlTestRow(self.air_interface + ' ' + self.Initialize_OAI_UE_args, 'KO', CONST.OAI_UE_PROCESS_NO_TUNNEL_INTERFACE, 'OAI UE')
 			else:
-				HTML.SethtmlUEFailureMsg('nr-uesoftmodem did NOT synced')
-				HTML.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'KO', CONST.OAI_UE_PROCESS_COULD_NOT_SYNC, 'OAI UE')
+				HTML.htmlUEFailureMsg='nr-uesoftmodem did NOT synced'
+				HTML.CreateHtmlTestRow(self.air_interface + ' ' +  self.Initialize_OAI_UE_args, 'KO', CONST.OAI_UE_PROCESS_COULD_NOT_SYNC, 'OAI UE')
 			logging.error('\033[91mInitialize OAI UE Failed! \033[0m')
 			self.AutoTerminateUEandeNB()
 
@@ -675,7 +690,7 @@ class OaiCiTest():
 			self.AutoTerminateUEandeNB()
 
 	def PingCatM(self):
-		if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetSourceCodePath() == '':
+		if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.SourceCodePath == '':
 			HELP.GenericHelp(CONST.Version)
 			sys.exit('Insufficient Parameter')
 		check_eNB = True
@@ -688,10 +703,10 @@ class OaiCiTest():
 		try:
 			statusQueue = SimpleQueue()
 			lock = Lock()
-			SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
-			SSH.command('cd ' + EPC.GetSourceCodePath(), '\$', 5)
+			SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
+			SSH.command('cd ' + EPC.SourceCodePath, '\$', 5)
 			SSH.command('cd scripts', '\$', 5)
-			if re.match('OAI', EPC.GetType(), re.IGNORECASE):
+			if re.match('OAI', EPC.Type, re.IGNORECASE):
 				logging.debug('Using the OAI EPC HSS: not implemented yet')
 				HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
 				HTML.CreateHtmlTabFooter(False)
@@ -891,7 +906,7 @@ class OaiCiTest():
 						self.UEDevicesStatus[cnt] = CONST.UE_STATUS_ATTACHED
 					cnt += 1
 				HTML.CreateHtmlTestRowQueue('N/A', 'OK', len(self.UEDevices), html_queue)
-				result = re.search('T_stdout', str(RAN.GetInitialize_eNB_args()))
+				result = re.search('T_stdout', str(RAN.Initialize_eNB_args))
 				if result is not None:
 					logging.debug('Waiting 5 seconds to fill up record file')
 					time.sleep(5)
@@ -937,7 +952,7 @@ class OaiCiTest():
 		for job in multi_jobs:
 			job.join()
 		HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
-		result = re.search('T_stdout', str(RAN.GetInitialize_eNB_args()))
+		result = re.search('T_stdout', str(RAN.Initialize_eNB_args))
 		if result is not None:
 			logging.debug('Waiting 5 seconds to fill up record file')
 			time.sleep(5)
@@ -1071,7 +1086,6 @@ class OaiCiTest():
 		SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
 		if self.ADBCentralized:
 			SSH.command('adb devices', '\$', 15)
-			#self.UEDevices = re.findall("\\\\r\\\\n([A-Za-z0-9]+)\\\\tdevice",SSH.getBefore())
 			self.UEDevices = re.findall("\\\\r\\\\n([A-Za-z0-9]+)\\\\tdevice",SSH.getBefore())
 			SSH.close()
 		else:
@@ -1203,8 +1217,8 @@ class OaiCiTest():
 			i += 1
 		for job in multi_jobs:
 			job.join()
-		if RAN.GetflexranCtrlInstalled() and RAN.GetflexranCtrlStarted():
-			SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
+		if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted:
+			SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
 			SSH.command('cd /opt/flexran_rtc', '\$', 5)
 			SSH.command('curl http://localhost:9999/stats | jq \'.\' > log/check_status_' + self.testCase_id + '.log 2>&1', '\$', 5)
 			SSH.command('cat log/check_status_' + self.testCase_id + '.log | jq \'.eNB_config[0].UE\' | grep -c rnti | sed -e "s#^#Nb Connected UE = #"', '\$', 5)
@@ -1316,13 +1330,13 @@ class OaiCiTest():
 			# Launch ping on the EPC side (true for ltebox and old open-air-cn)
 			# But for OAI-Rel14-CUPS, we launch from python executor
 			launchFromEpc = True
-			if re.match('OAI-Rel14-CUPS', EPC.GetType(), re.IGNORECASE):
+			if re.match('OAI-Rel14-CUPS', EPC.Type, re.IGNORECASE):
 				launchFromEpc = False
 			ping_time = re.findall("-c (\d+)",str(self.ping_args))
 
 			if launchFromEpc:
-				SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
-				SSH.command('cd ' + EPC.GetSourceCodePath(), '\$', 5)
+				SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
+				SSH.command('cd ' + EPC.SourceCodePath, '\$', 5)
 				SSH.command('cd scripts', '\$', 5)
 				ping_status = SSH.command('stdbuf -o0 ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 | stdbuf -o0 tee ping_' + self.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5)
 			else:
@@ -1331,9 +1345,9 @@ class OaiCiTest():
 				logging.debug(cmd)
 				ret = subprocess.run(cmd, shell=True)
 				ping_status = ret.returncode
-				SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), 'ping_' + self.testCase_id + '_' + device_id + '.log', EPC.GetSourceCodePath() + '/scripts')
-				SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
-				SSH.command('cat ' + EPC.GetSourceCodePath() + '/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
+				SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'ping_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts')
+				SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
+				SSH.command('cat ' + EPC.SourceCodePath + '/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
 			# TIMEOUT CASE
 			if ping_status < 0:
 				message = 'Ping with UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT!'
@@ -1413,7 +1427,7 @@ class OaiCiTest():
 			return
 		ping_from_eNB = re.search('oaitun_enb1', str(self.ping_args))
 		if ping_from_eNB is not None:
-			if RAN.GeteNBIPAddress() == '' or RAN.GeteNBUserName() == '' or RAN.GeteNBPassword() == '':
+			if RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '':
 				HELP.GenericHelp(CONST.Version)
 				sys.exit('Insufficient Parameter')
 		else:
@@ -1422,8 +1436,8 @@ class OaiCiTest():
 				sys.exit('Insufficient Parameter')
 		try:
 			if ping_from_eNB is not None:
-				SSH.open(RAN.GeteNBIPAddress(), RAN.GeteNBUserName(), RAN.GeteNBPassword())
-				SSH.command('cd ' + RAN.GeteNBSourceCodePath() + '/cmake_targets/', '\$', 5)
+				SSH.open(RAN.eNBIPAddress, RAN.eNBUserName, RAN.eNBPassword)
+				SSH.command('cd ' + RAN.eNBSourceCodePath + '/cmake_targets/', '\$', 5)
 			else:
 				SSH.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
 				SSH.command('cd ' + self.UESourceCodePath + '/cmake_targets/', '\$', 5)
@@ -1487,20 +1501,20 @@ class OaiCiTest():
 
 			# copying on the EPC server for logCollection
 			if ping_from_eNB is not None:
-				copyin_res = SSH.copyin(RAN.GeteNBIPAddress(), RAN.GeteNBUserName(), RAN.GeteNBPassword(), RAN.GeteNBSourceCodePath() + '/cmake_targets/ping_' + self.testCase_id + '.log', '.')
+				copyin_res = SSH.copyin(RAN.eNBIPAddress, RAN.eNBUserName, RAN.eNBPassword, RAN.eNBSourceCodePath + '/cmake_targets/ping_' + self.testCase_id + '.log', '.')
 			else:
 				copyin_res = SSH.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/ping_' + self.testCase_id + '.log', '.')
 			if (copyin_res == 0):
-				SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), 'ping_' + self.testCase_id + '.log', EPC.GetSourceCodePath() + '/scripts')
+				SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'ping_' + self.testCase_id + '.log', EPC.SourceCodePath + '/scripts')
 		except:
 			os.kill(os.getppid(),signal.SIGUSR1)
 
 	def Ping(self):
-		result = re.search('noS1', str(RAN.GetInitialize_eNB_args()))
+		result = re.search('noS1', str(RAN.Initialize_eNB_args))
 		if result is not None:
 			self.PingNoS1()
 			return
-		if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetSourceCodePath() == '':
+		if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.SourceCodePath == '':
 			HELP.GenericHelp(CONST.Version)
 			sys.exit('Insufficient Parameter')
 		check_eNB = True
@@ -1586,7 +1600,7 @@ class OaiCiTest():
 		return result
 
 	def Iperf_analyzeV2TCPOutput(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options):
-		SSH.command('awk -f /tmp/tcp_iperf_stats.awk /tmp/CI-eNB/scripts/iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
+		SSH.command('awk -f /tmp/tcp_iperf_stats.awk ' + EPC.SourceCodePath + '/scripts/iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
 		result = re.search('Avg Bitrate : (?P<average>[0-9\.]+ Mbits\/sec) Max Bitrate : (?P<maximum>[0-9\.]+ Mbits\/sec) Min Bitrate : (?P<minimum>[0-9\.]+ Mbits\/sec)', SSH.getBefore())
 		if result is not None:
 			avgbitrate = result.group('average')
@@ -1844,7 +1858,7 @@ class OaiCiTest():
 		# Launch iperf server on EPC side (true for ltebox and old open-air-cn0
 		# But for OAI-Rel14-CUPS, we launch from python executor and we are using its IP address as iperf client address
 		launchFromEpc = True
-		if re.match('OAI-Rel14-CUPS', EPC.GetType(), re.IGNORECASE):
+		if re.match('OAI-Rel14-CUPS', EPC.Type, re.IGNORECASE):
 			launchFromEpc = False
 			cmd = 'hostname -I'
 			ret = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8')
@@ -1852,13 +1866,13 @@ class OaiCiTest():
 				EPC_Iperf_UE_IPAddress = ret.stdout.strip()
 		port = 5001 + idx
 		if launchFromEpc:
-			SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
-			SSH.command('cd ' + EPC.GetSourceCodePath() + '/scripts', '\$', 5)
+			SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
+			SSH.command('cd ' + EPC.SourceCodePath + '/scripts', '\$', 5)
 			SSH.command('rm -f iperf_server_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
 			if udpIperf:
-				SSH.command('echo $USER; nohup iperf -u -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', EPC.GetUserName(), 5)
+				SSH.command('echo $USER; nohup iperf -u -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', EPC.UserName, 5)
 			else:
-				SSH.command('echo $USER; nohup iperf -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', EPC.GetUserName(), 5)
+				SSH.command('echo $USER; nohup iperf -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', EPC.UserName, 5)
 			SSH.close()
 		else:
 			if self.ueIperfVersion == self.dummyIperfVersion:
@@ -1881,7 +1895,7 @@ class OaiCiTest():
 			SSH.command('cd ' + self.UESourceCodePath + '/cmake_targets', '\$', 5)
 		else:
 			SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
-			SSH.command('cd ' + EPC.GetSourceCodePath() + '/scripts', '\$', 5)
+			SSH.command('cd ' + EPC.SourceCodePath+ '/scripts', '\$', 5)
 		iperf_time = self.Iperf_ComputeTime()
 		time.sleep(0.5)
 
@@ -1915,27 +1929,27 @@ class OaiCiTest():
 
 		# Kill iperf server on EPC side
 		if launchFromEpc:
-			SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
-			SSH.command('killall --signal SIGKILL iperf', EPC.GetUserName(), 5)
+			SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
+			SSH.command('killall --signal SIGKILL iperf', EPC.UserName, 5)
 			SSH.close()
 		else:
 			cmd = 'killall --signal SIGKILL iperf'
 			logging.debug(cmd)
 			subprocess.run(cmd, shell=True)
 			time.sleep(1)
-			SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), 'iperf_server_' + self.testCase_id + '_' + device_id + '.log', EPC.GetSourceCodePath() + '/scripts')
+			SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_server_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts')
 		# in case of failure, retrieve server log
 		if (clientStatus == -1) or (clientStatus == -2):
 			if launchFromEpc:
 				time.sleep(1)
 				if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')):
 					os.remove('iperf_server_' + self.testCase_id + '_' + device_id + '.log')
-				SSH.copyin(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), EPC.GetSourceCodePath() + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
+				SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath+ '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
 			self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options)
 		# in case of OAI-UE 
 		if (device_id == 'OAI-UE'):
 			SSH.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/iperf_' + self.testCase_id + '_' + device_id + '.log', '.')
-			SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), 'iperf_' + self.testCase_id + '_' + device_id + '.log', EPC.GetSourceCodePath() + '/scripts')
+			SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts')
 
 	def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue):
 		try:
@@ -1949,8 +1963,8 @@ class OaiCiTest():
 			if (device_id != 'OAI-UE'):
 				SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
 				# if by chance ADB server and EPC are on the same remote host, at least log collection will take care of it
-				SSH.command('if [ ! -d ' + EPC.GetSourceCodePath() + '/scripts ]; then mkdir -p ' + EPC.GetSourceCodePath() + '/scripts ; fi', '\$', 5)
-				SSH.command('cd ' + EPC.GetSourceCodePath() + '/scripts', '\$', 5)
+				SSH.command('if [ ! -d ' + EPC.SourceCodePath + '/scripts ]; then mkdir -p ' + EPC.SourceCodePath + '/scripts ; fi', '\$', 5)
+				SSH.command('cd ' + EPC.SourceCodePath + '/scripts', '\$', 5)
 				# Checking if iperf / iperf3 are installed
 				if self.ADBCentralized:
 					SSH.command('adb -s ' + device_id + ' shell "ls /data/local/tmp"', '\$', 5)
@@ -2009,7 +2023,7 @@ class OaiCiTest():
 					SSH.command('echo $USER; nohup iperf -B ' + UE_IPAddress + ' -u -s -i 1 > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.UEUserName, 5)
 			else:
 				SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
-				SSH.command('cd ' + EPC.GetSourceCodePath() + '/scripts', '\$', 5)
+				SSH.command('cd ' + EPC.SourceCodePath + '/scripts', '\$', 5)
 				if self.ADBCentralized:
 					if (useIperf3):
 						SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/iperf3 -s &', '\$', 5)
@@ -2031,11 +2045,11 @@ class OaiCiTest():
 			# Launch the IPERF client on the EPC side for DL (true for ltebox and old open-air-cn
 			# But for OAI-Rel14-CUPS, we launch from python executor
 			launchFromEpc = True
-			if re.match('OAI-Rel14-CUPS', EPC.GetType(), re.IGNORECASE):
+			if re.match('OAI-Rel14-CUPS', EPC.Type, re.IGNORECASE):
 				launchFromEpc = False
 			if launchFromEpc:
-				SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
-				SSH.command('cd ' + EPC.GetSourceCodePath() + '/scripts', '\$', 5)
+				SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
+				SSH.command('cd ' + EPC.SourceCodePath + '/scripts', '\$', 5)
 			iperf_time = self.Iperf_ComputeTime()
 			time.sleep(0.5)
 
@@ -2070,9 +2084,9 @@ class OaiCiTest():
 					logging.debug(cmd)
 					ret = subprocess.run(cmd, shell=True)
 					iperf_status = ret.returncode
-					SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), 'iperf_' + self.testCase_id + '_' + device_id + '.log', EPC.GetSourceCodePath() + '/scripts')
-					SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
-					SSH.command('cat ' + EPC.GetSourceCodePath() + '/scripts/iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
+					SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts')
+					SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
+					SSH.command('cat ' + EPC.SourceCodePath + '/scripts/iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
 				if iperf_status < 0:
 					if launchFromEpc:
 						SSH.close()
@@ -2109,7 +2123,7 @@ class OaiCiTest():
 				if (device_id == 'OAI-UE'):
 					SSH.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
 				else:
-					SSH.copyin(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, EPC.GetSourceCodePath() + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
+					SSH.copyin(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, EPC.SourceCodePath + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
 				# fromdos has to be called on the python executor not on ADB server
 				cmd = 'fromdos -o iperf_server_' + self.testCase_id + '_' + device_id + '.log'
 				subprocess.run(cmd, shell=True)
@@ -2119,15 +2133,15 @@ class OaiCiTest():
 			if (device_id == 'OAI-UE'):
 				if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')):
 					if not launchFromEpc:
-						SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), 'iperf_server_' + self.testCase_id + '_' + device_id + '.log', EPC.GetSourceCodePath() + '/scripts')
+						SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_server_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts')
 				else:
 					SSH.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
-					SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), 'iperf_server_' + self.testCase_id + '_' + device_id + '.log', EPC.GetSourceCodePath() + '/scripts')
+					SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_server_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts')
 		except:
 			os.kill(os.getppid(),signal.SIGUSR1)
 
 	def IperfNoS1(self):
-		if RAN.GeteNBIPAddress() == '' or RAN.GeteNBUserName() == '' or RAN.GeteNBPassword() == '' or self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '':
+		if RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '' or self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '':
 			HELP.GenericHelp(CONST.Version)
 			sys.exit('Insufficient Parameter')
 		check_eNB = True
@@ -2139,9 +2153,9 @@ class OaiCiTest():
 			return
 		server_on_enb = re.search('-R', str(self.iperf_args))
 		if server_on_enb is not None:
-			iServerIPAddr = RAN.GeteNBIPAddress()
-			iServerUser = RAN.GeteNBUserName()
-			iServerPasswd = RAN.GeteNBPassword()
+			iServerIPAddr = RAN.eNBIPAddress
+			iServerUser = RAN.eNBUserName
+			iServerPasswd = RAN.eNBPassword
 			iClientIPAddr = self.UEIPAddress
 			iClientUser = self.UEUserName
 			iClientPasswd = self.UEPassword
@@ -2149,9 +2163,9 @@ class OaiCiTest():
 			iServerIPAddr = self.UEIPAddress
 			iServerUser = self.UEUserName
 			iServerPasswd = self.UEPassword
-			iClientIPAddr = RAN.GeteNBIPAddress()
-			iClientUser = RAN.GeteNBUserName()
-			iClientPasswd = RAN.GeteNBPassword()
+			iClientIPAddr = RAN.eNBIPAddress
+			iClientUser = RAN.eNBUserName
+			iClientPasswd = RAN.eNBPassword
 		if self.iperf_options != 'sink':
 			# Starting the iperf server
 			SSH.open(iServerIPAddr, iServerUser, iServerPasswd)
@@ -2206,10 +2220,10 @@ class OaiCiTest():
 		if (clientStatus == -1):
 			copyin_res = SSH.copyin(iServerIPAddr, iServerUser, iServerPasswd, '/tmp/tmp_iperf_server_' + self.testCase_id + '.log', 'iperf_server_' + self.testCase_id + '_OAI-UE.log')
 			if (copyin_res == 0):
-				SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), 'iperf_server_' + self.testCase_id + '_OAI-UE.log', EPC.GetSourceCodePath() + '/scripts')
+				SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_server_' + self.testCase_id + '_OAI-UE.log', EPC.SourceCodePath + '/scripts')
 		copyin_res = SSH.copyin(iClientIPAddr, iClientUser, iClientPasswd, '/tmp/tmp_iperf_' + self.testCase_id + '.log', 'iperf_' + self.testCase_id + '_OAI-UE.log')
 		if (copyin_res == 0):
-			SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), 'iperf_' + self.testCase_id + '_OAI-UE.log', EPC.GetSourceCodePath() + '/scripts')
+			SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_' + self.testCase_id + '_OAI-UE.log', EPC.SourceCodePath + '/scripts')
 		iperf_noperf = False
 		if status_queue.empty():
 			iperf_status = False
@@ -2236,11 +2250,11 @@ class OaiCiTest():
 			self.AutoTerminateUEandeNB()
 
 	def Iperf(self):
-		result = re.search('noS1', str(RAN.GetInitialize_eNB_args()))
+		result = re.search('noS1', str(RAN.Initialize_eNB_args))
 		if result is not None:
 			self.IperfNoS1()
 			return
-		if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetSourceCodePath() == '' or self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
+		if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.SourceCodePath == '' or self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
 			HELP.GenericHelp(CONST.Version)
 			sys.exit('Insufficient Parameter')
 		check_eNB = True
@@ -2317,7 +2331,7 @@ class OaiCiTest():
 		status_queue = SimpleQueue()
 		# in noS1 config, no need to check status from EPC
 		# in gNB also currently no need to check
-		result = re.search('noS1|band78', str(RAN.GetInitialize_eNB_args()))
+		result = re.search('noS1|band78', str(RAN.Initialize_eNB_args))
 		if result is None:
 			p = Process(target = EPC.CheckHSSProcess, args = (status_queue,))
 			p.daemon = True
@@ -2356,14 +2370,14 @@ class OaiCiTest():
 				if (status < 0):
 					result = status
 			if result == CONST.ENB_PROCESS_FAILED:
-				fileCheck = re.search('enb_', str(RAN.GeteNBLogFile(0)))
+				fileCheck = re.search('enb_', str(RAN.eNBLogFiles[0]))
 				if fileCheck is not None:
-					SSH.copyin(RAN.GeteNBIPAddress(), RAN.GeteNBUserName(), RAN.GeteNBPassword(), RAN.GeteNBSourceCodePath() + '/cmake_targets/' + RAN.GeteNBLogFile(0), '.')
-					logStatus = RAN.AnalyzeLogFile_eNB(RAN.GeteNBLogFile[0])
+					SSH.copyin(RAN.eNBIPAddress, RAN.eNBUserName, RAN.eNBPassword, RAN.eNBSourceCodePath + '/cmake_targets/' + RAN.eNBLogFiles[0], '.')
+					logStatus = RAN.AnalyzeLogFile_eNB(RAN.eNBLogFiles[0])
 					if logStatus < 0:
 						result = logStatus
-					RAN.SeteNBLogFile('', 0)
-				if RAN.GetflexranCtrlInstalled() and RAN.GetflexranCtrlStarted():
+					RAN.eNBLogFiles[0]=''
+				if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted:
 					self.TerminateFlexranCtrl()
 			return result
 
@@ -2398,8 +2412,8 @@ class OaiCiTest():
 	def CheckOAIUEProcess(self, status_queue):
 		try:
 			SSH.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
-			SSH.command('stdbuf -o0 ps -aux | grep --color=never ' + RAN.Getair_interface() + '-uesoftmodem | grep -v grep', '\$', 5)
-			result = re.search(RAN.Getair_interface() + '-uesoftmodem', SSH.getBefore())
+			SSH.command('stdbuf -o0 ps -aux | grep --color=never ' + self.air_interface + ' | grep -v grep', '\$', 5)
+			result = re.search(self.air_interface, SSH.getBefore())
 			if result is None:
 				logging.debug('\u001B[1;37;41m OAI UE Process Not Found! \u001B[0m')
 				status_queue.put(CONST.OAI_UE_PROCESS_FAILED)
@@ -2436,7 +2450,7 @@ class OaiCiTest():
 		nrFoundDCI = 0
 		nrCRCOK = 0
 		mbms_messages = 0
-		HTML.SethtmlUEFailureMsg('')
+		HTML.htmlUEFailureMsg=''
 		global_status = CONST.ALL_PROCESSES_OK
 		for line in ue_log_file.readlines():
 			result = re.search('nr_synchro_time', str(line))
@@ -2498,7 +2512,7 @@ class OaiCiTest():
 			result = re.search('No cell synchronization found, abandoning', str(line))
 			if result is not None:
 				no_cell_sync_found = True
-			if RAN.GeteNBmbmsEnable(0):
+			if RAN.eNBmbmsEnables[0]:
 				result = re.search('TRIED TO PUSH MBMS DATA', str(line))
 				if result is not None:
 					mbms_messages += 1
@@ -2506,22 +2520,22 @@ class OaiCiTest():
 			if result is not None and (not mib_found):
 				try:
 					mibMsg = "MIB Information: " + result.group(1) + ', ' + result.group(2)
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + mibMsg + '\n')
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + mibMsg + '\n'
 					logging.debug('\033[94m' + mibMsg + '\033[0m')
 					mibMsg = "    nidcell = " + result.group('nidcell')
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + mibMsg)
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + mibMsg
 					logging.debug('\033[94m' + mibMsg + '\033[0m')
 					mibMsg = "    n_rb_dl = " + result.group('n_rb_dl')
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + mibMsg + '\n')
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + mibMsg + '\n'
 					logging.debug('\033[94m' + mibMsg + '\033[0m')
 					mibMsg = "    phich_duration = " + result.group('phich_duration')
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + mibMsg)
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + mibMsg
 					logging.debug('\033[94m' + mibMsg + '\033[0m')
 					mibMsg = "    phich_resource = " + result.group('phich_resource')
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + mibMsg + '\n')
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + mibMsg + '\n'
 					logging.debug('\033[94m' + mibMsg + '\033[0m')
 					mibMsg = "    tx_ant = " + result.group('tx_ant')
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + mibMsg + '\n')
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + mibMsg + '\n'
 					logging.debug('\033[94m' + mibMsg + '\033[0m')
 					mib_found = True
 				except Exception as e:
@@ -2530,7 +2544,7 @@ class OaiCiTest():
 			if result is not None and (not frequency_found):
 				try:
 					mibMsg = "Measured Carrier Frequency = " + result.group('measured_carrier_frequency') + ' Hz'
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + mibMsg + '\n')
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + mibMsg + '\n'
 					logging.debug('\033[94m' + mibMsg + '\033[0m')
 					frequency_found = True
 				except Exception as e:
@@ -2539,7 +2553,7 @@ class OaiCiTest():
 			if result is not None and (not plmn_found):
 				try:
 					mibMsg = 'PLMN MCC = ' + result.group('mcc') + ' MNC = ' + result.group('mnc')
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + mibMsg + '\n')
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + mibMsg + '\n'
 					logging.debug('\033[94m' + mibMsg + '\033[0m')
 					plmn_found = True
 				except Exception as e:
@@ -2548,7 +2562,7 @@ class OaiCiTest():
 			if result is not None:
 				try:
 					mibMsg = "The operator is: " + result.group('operator')
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + mibMsg + '\n')
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + mibMsg + '\n'
 					logging.debug('\033[94m' + mibMsg + '\033[0m')
 				except Exception as e:
 					logging.error('\033[91m' + "Operator name not found" + '\033[0m')
@@ -2556,7 +2570,7 @@ class OaiCiTest():
 			if result is not None:
 				try:
 					mibMsg = "SIB5 InterFreqCarrierFreq element " + result.group(1) + '/' + result.group(2)
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + mibMsg + ' -> ')
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + mibMsg + ' -> '
 					logging.debug('\033[94m' + mibMsg + '\033[0m')
 				except Exception as e:
 					logging.error('\033[91m' + "SIB5 InterFreqCarrierFreq element not found" + '\033[0m')
@@ -2566,7 +2580,7 @@ class OaiCiTest():
 					freq = result.group('carrier_frequency')
 					new_freq = re.sub('/[0-9]+','',freq)
 					float_freq = float(new_freq) / 1000000
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + 'DL Freq: ' + ('%.1f' % float_freq) + ' MHz')
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + 'DL Freq: ' + ('%.1f' % float_freq) + ' MHz'
 					logging.debug('\033[94m' + "    DL Carrier Frequency is: " + str(freq) + '\033[0m')
 				except Exception as e:
 					logging.error('\033[91m' + "    DL Carrier Frequency not found" + '\033[0m')
@@ -2574,7 +2588,7 @@ class OaiCiTest():
 			if result is not None:
 				try:
 					prb = result.group('allowed_bandwidth')
-					HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + ' -- PRB: ' + prb + '\n')
+					HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + ' -- PRB: ' + prb + '\n'
 					logging.debug('\033[94m' + "    AllowedMeasBandwidth: " + prb + '\033[0m')
 				except Exception as e:
 					logging.error('\033[91m' + "    AllowedMeasBandwidth not found" + '\033[0m')
@@ -2582,57 +2596,57 @@ class OaiCiTest():
 		if rrcConnectionRecfgComplete > 0:
 			statMsg = 'UE connected to eNB (' + str(rrcConnectionRecfgComplete) + ' RRCConnectionReconfigurationComplete message(s) generated)'
 			logging.debug('\033[94m' + statMsg + '\033[0m')
-			HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+			HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 		if nrUEFlag:
 			if nrDecodeMib > 0:
 				statMsg = 'UE showed ' + str(nrDecodeMib) + ' MIB decode message(s)'
 				logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
-				HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+				HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 			if nrFoundDCI > 0:
 				statMsg = 'UE showed ' + str(nrFoundDCI) + ' DCI found message(s)'
 				logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
-				HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+				HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 			if nrCRCOK > 0:
 				statMsg = 'UE showed ' + str(nrCRCOK) + ' PDSCH decoding message(s)'
 				logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
-				HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+				HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 			if not frequency_found:
 				statMsg = 'NR-UE could NOT synch!'
 				logging.error('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
-				HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+				HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 		if uciStatMsgCount > 0:
 			statMsg = 'UE showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)'
 			logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
-			HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+			HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 		if pdcpDataReqFailedCount > 0:
 			statMsg = 'UE showed ' + str(pdcpDataReqFailedCount) + ' "PDCP data request failed" message(s)'
 			logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
-			HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+			HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 		if badDciCount > 0:
 			statMsg = 'UE showed ' + str(badDciCount) + ' "bad DCI 1(A)" message(s)'
 			logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
-			HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+			HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 		if f1aRetransmissionCount > 0:
 			statMsg = 'UE showed ' + str(f1aRetransmissionCount) + ' "Format1A Retransmission but TBS are different" message(s)'
 			logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
-			HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+			HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 		if fatalErrorCount > 0:
 			statMsg = 'UE showed ' + str(fatalErrorCount) + ' "FATAL ERROR:" message(s)'
 			logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
-			HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+			HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 		if macBsrTimerExpiredCount > 0:
 			statMsg = 'UE showed ' + str(fatalErrorCount) + ' "MAC BSR Triggered ReTxBSR Timer expiry" message(s)'
 			logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
-			HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
-		if RAN.GeteNBmbmsEnable(0):
+			HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
+		if RAN.eNBmbmsEnables[0]:
 			if mbms_messages > 0:
 				statMsg = 'UE showed ' + str(mbms_messages) + ' "TRIED TO PUSH MBMS DATA" message(s)'
 				logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
 			else:
 				statMsg = 'UE did NOT SHOW "TRIED TO PUSH MBMS DATA" message(s)'
 				logging.debug('\u001B[1;30;41m ' + statMsg + ' \u001B[0m')
-				global_status = OAI_UE_PROCESS_NO_MBMS_MSGS
-			HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n')
+				global_status = CONST.OAI_UE_PROCESS_NO_MBMS_MSGS
+			HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + statMsg + '\n'
 		if foundSegFault:
 			logging.debug('\u001B[1;37;41m UE ended with a Segmentation Fault! \u001B[0m')
 			if not nrUEFlag:
@@ -2642,7 +2656,7 @@ class OaiCiTest():
 					global_status = CONST.OAI_UE_PROCESS_SEG_FAULT
 		if foundAssertion:
 			logging.debug('\u001B[1;30;43m UE showed an assertion! \u001B[0m')
-			HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + 'UE showed an assertion!\n')
+			HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + 'UE showed an assertion!\n'
 			if not nrUEFlag:
 				if not mib_found or not frequency_found:
 					global_status = CONST.OAI_UE_PROCESS_ASSERTION
@@ -2651,31 +2665,31 @@ class OaiCiTest():
 					global_status = CONST.OAI_UE_PROCESS_ASSERTION
 		if foundRealTimeIssue:
 			logging.debug('\u001B[1;37;41m UE faced real time issues! \u001B[0m')
-			HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + 'UE faced real time issues!\n')
+			HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + 'UE faced real time issues!\n'
 		if nrUEFlag:
 			if not frequency_found:
 				global_status = CONST.OAI_UE_PROCESS_COULD_NOT_SYNC
 		else:
 			if no_cell_sync_found and not mib_found:
 				logging.debug('\u001B[1;37;41m UE could not synchronize ! \u001B[0m')
-				HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + 'UE could not synchronize!\n')
+				HTML.htmlUEFailureMsg=HTML.htmlUEFailureMsg + 'UE could not synchronize!\n'
 				global_status = CONST.OAI_UE_PROCESS_COULD_NOT_SYNC
 		return global_status
 
 
 	def TerminateFlexranCtrl(self):
-		if RAN.GetflexranCtrlInstalled() == False or RAN.GetflexranCtrlStarted() == False:
+		if RAN.flexranCtrlInstalled == False or RAN.flexranCtrlStarted == False:
 			return
-		if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '':
+		if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '':
 			HELP.GenericHelp(CONST.Version)
 			sys.exit('Insufficient Parameter')
-		SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
-		SSH.command('echo ' + EPC.GetPassword() + ' | sudo -S daemon --name=flexran_rtc_daemon --stop', '\$', 5)
+		SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
+		SSH.command('echo ' + EPC.Password + ' | sudo -S daemon --name=flexran_rtc_daemon --stop', '\$', 5)
 		time.sleep(1)
-		SSH.command('echo ' + EPC.GetPassword() + ' | sudo -S killall --signal SIGKILL rt_controller', '\$', 5)
+		SSH.command('echo ' + EPC.Password + ' | sudo -S killall --signal SIGKILL rt_controller', '\$', 5)
 		time.sleep(1)
 		SSH.close()
-		RAN.SetflexranCtrlStarted(False)
+		RAN.flexranCtrlStarted=False
 		HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
 
 	def TerminateUE_common(self, device_id, idx):
@@ -2741,7 +2755,7 @@ class OaiCiTest():
 			copyin_res = SSH.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/' + self.UELogFile, '.')
 			if (copyin_res == -1):
 				logging.debug('\u001B[1;37;41m Could not copy UE logfile to analyze it! \u001B[0m')
-				HTML.SethtmlUEFailureMsg('Could not copy UE logfile to analyze it!')
+				HTML.htmlUEFailureMsg='Could not copy UE logfile to analyze it!'
 				HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OAI_UE_PROCESS_NOLOGFILE_TO_ANALYZE, 'UE')
 				self.UELogFile = ''
 				return
@@ -2754,9 +2768,9 @@ class OaiCiTest():
 				ueAction = 'Connection'
 			if (logStatus < 0):
 				logging.debug('\u001B[1m' + ueAction + ' Failed \u001B[0m')
-				HTML.SethtmlUEFailureMsg('<b>' + ueAction + ' Failed</b>\n' + HTML.GethtmlUEFailureMsg())
+				HTML.htmlUEFailureMsg='<b>' + ueAction + ' Failed</b>\n' + HTML.htmlUEFailureMsg
 				HTML.CreateHtmlTestRow('N/A', 'KO', logStatus, 'UE')
-				if RAN.Getair_interface() == 'lte':
+				if self.air_interface == 'lte-uesoftmodem':
 					# In case of sniffing on commercial eNBs we have random results
 					# Not an error then
 					if (logStatus != CONST.OAI_UE_PROCESS_COULD_NOT_SYNC) or (ueAction != 'Sniffing'):
@@ -2768,7 +2782,7 @@ class OaiCiTest():
 						self.AutoTerminateUEandeNB()
 			else:
 				logging.debug('\u001B[1m' + ueAction + ' Completed \u001B[0m')
-				HTML.SethtmlUEFailureMsg('<b>' + ueAction + ' Completed</b>\n' + HTML.GethtmlUEFailureMsg())
+				HTML.htmlUEFailureMsg='<b>' + ueAction + ' Completed</b>\n' + HTML.htmlUEFailureMsg
 				HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
 			self.UELogFile = ''
 		else:
@@ -2777,41 +2791,41 @@ class OaiCiTest():
 	def AutoTerminateUEandeNB(self):
 		if (self.ADBIPAddress != 'none'):
 			self.testCase_id = 'AUTO-KILL-UE'
-			HTML.SettestCase_id(self.testCase_id)
+			HTML.testCase_id=self.testCase_id
 			self.desc = 'Automatic Termination of UE'
-			HTML.Setdesc('Automatic Termination of UE')
+			HTML.desc='Automatic Termination of UE'
 			self.ShowTestID()
 			self.TerminateUE()
 		if (self.Initialize_OAI_UE_args != ''):
 			self.testCase_id = 'AUTO-KILL-OAI-UE'
-			HTML.SettestCase_id(self.testCase_id)
+			HTML.testCase_id=self.testCase_id
 			self.desc = 'Automatic Termination of OAI-UE'
-			HTML.Setdesc('Automatic Termination of OAI-UE')
+			HTML.desc='Automatic Termination of OAI-UE'
 			self.ShowTestID()
 			self.TerminateOAIUE()
-		if (RAN.GetInitialize_eNB_args() != ''):
+		if (RAN.Initialize_eNB_args != ''):
 			self.testCase_id = 'AUTO-KILL-eNB'
-			HTML.SettestCase_id(self.testCase_id)
+			HTML.testCase_id=self.testCase_id
 			self.desc = 'Automatic Termination of eNB'
-			HTML.Setdesc('Automatic Termination of eNB')
+			HTML.desc='Automatic Termination of eNB'
 			self.ShowTestID()
-			RAN.SeteNB_instance('0')
+			RAN.eNB_instance=0
 			RAN.TerminateeNB()
-		if RAN.GetflexranCtrlInstalled() and RAN.GetflexranCtrlStarted():
+		if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted:
 			self.testCase_id = 'AUTO-KILL-flexran-ctl'
-			HTML.SettestCase_id(self.testCase_id)
+			HTML.testCase_id=self.testCase_id
 			self.desc = 'Automatic Termination of FlexRan CTL'
-			HTML.Setdesc('Automatic Termination of FlexRan CTL')
+			HTML.desc='Automatic Termination of FlexRan CTL'
 			self.ShowTestID()
 			self.TerminateFlexranCtrl()
-		RAN.SetprematureExit(True)
+		RAN.prematureExit=True
 
 	def IdleSleep(self):
 		time.sleep(self.idle_sleep_time)
 		HTML.CreateHtmlTestRow(str(self.idle_sleep_time) + ' sec', 'OK', CONST.ALL_PROCESSES_OK)
 
 	def X2_Status(self, idx, fileName):
-		cmd = "curl --silent http://" + EPC.GetIPAddress() + ":9999/stats | jq '.' > " + fileName
+		cmd = "curl --silent http://" + EPC.IPAddress + ":9999/stats | jq '.' > " + fileName
 		message = cmd + '\n'
 		logging.debug(cmd)
 		subprocess.run(cmd, shell=True)
@@ -2860,7 +2874,7 @@ class OaiCiTest():
 		logging.debug(msg)
 		fullMessage += msg + '\n'
 		if self.x2_ho_options == 'network':
-			if RAN.GetflexranCtrlInstalled() and RAN.GetflexranCtrlStarted():
+			if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted:
 				self.x2ENBBsIds = []
 				self.x2ENBConnectedUEs = []
 				self.x2ENBBsIds.append([])
@@ -2875,7 +2889,7 @@ class OaiCiTest():
 				eNB_cnt = self.x2NbENBs
 				cnt = 0
 				while cnt < eNB_cnt:
-					cmd = "curl -XPOST http://" + EPC.GetIPAddress() + ":9999/rrc/x2_ho_net_control/enb/" + str(self.x2ENBBsIds[0][cnt]) + "/1"
+					cmd = "curl -XPOST http://" + EPC.IPAddress + ":9999/rrc/x2_ho_net_control/enb/" + str(self.x2ENBBsIds[0][cnt]) + "/1"
 					logging.debug(cmd)
 					fullMessage += cmd + '\n'
 					subprocess.run(cmd, shell=True)
@@ -2889,7 +2903,7 @@ class OaiCiTest():
 				while cnt < eNB_cnt:
 					ueIdx = 0
 					while ueIdx < len(self.x2ENBConnectedUEs[0][cnt]):
-						cmd = "curl -XPOST http://" + EPC.GetIPAddress() + ":9999/rrc/ho/senb/" + str(self.x2ENBBsIds[0][cnt]) + "/ue/" + str(self.x2ENBConnectedUEs[0][cnt][ueIdx]) + "/tenb/" + str(self.x2ENBBsIds[0][eNB_cnt - cnt - 1])
+						cmd = "curl -XPOST http://" + EPC.IPAddress() + ":9999/rrc/ho/senb/" + str(self.x2ENBBsIds[0][cnt]) + "/ue/" + str(self.x2ENBConnectedUEs[0][cnt][ueIdx]) + "/tenb/" + str(self.x2ENBBsIds[0][eNB_cnt - cnt - 1])
 						logging.debug(cmd)
 						fullMessage += cmd + '\n'
 						subprocess.run(cmd, shell=True)
@@ -2921,11 +2935,11 @@ class OaiCiTest():
 				HTML.CreateHtmlTestRow('Cannot perform requested X2 Handover', 'KO', CONST.ALL_PROCESSES_OK)
 
 	def LogCollectBuild(self):
-		if (RAN.GeteNBIPAddress() != '' and RAN.GeteNBUserName() != '' and RAN.GeteNBPassword() != ''):
-			IPAddress = RAN.GeteNBIPAddress()
-			UserName = RAN.GeteNBUserName()
-			Password = RAN.GeteNBPassword()
-			SourceCodePath = RAN.GeteNBSourceCodePath()
+		if (RAN.eNBIPAddress != '' and RAN.eNBUserName != '' and RAN.eNBPassword != ''):
+			IPAddress = RAN.eNBIPAddress
+			UserName = RAN.eNBUserName
+			Password = RAN.eNBPassword
+			SourceCodePath = RAN.eNBSourceCodePath
 		elif (self.UEIPAddress != '' and self.UEUserName != '' and self.UEPassword != ''):
 			IPAddress = self.UEIPAddress
 			UserName = self.UEUserName
@@ -2940,8 +2954,8 @@ class OaiCiTest():
 		SSH.command('zip build.log.zip build_log_*/*', '\$', 60)
 		SSH.close()
 	def LogCollectPing(self):
-		SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
-		SSH.command('cd ' + EPC.GetSourceCodePath(), '\$', 5)
+		SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
+		SSH.command('cd ' + EPC.SourceCodePath, '\$', 5)
 		SSH.command('cd scripts', '\$', 5)
 		SSH.command('rm -f ping.log.zip', '\$', 5)
 		SSH.command('zip ping.log.zip ping*.log', '\$', 60)
@@ -2949,8 +2963,8 @@ class OaiCiTest():
 		SSH.close()
 
 	def LogCollectIperf(self):
-		SSH.open(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword())
-		SSH.command('cd ' + EPC.GetSourceCodePath(), '\$', 5)
+		SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
+		SSH.command('cd ' + EPC.SourceCodePath, '\$', 5)
 		SSH.command('cd scripts', '\$', 5)
 		SSH.command('rm -f iperf.log.zip', '\$', 5)
 		SSH.command('zip iperf.log.zip iperf*.log', '\$', 60)
@@ -2967,20 +2981,20 @@ class OaiCiTest():
 		SSH.close()
 
 	def RetrieveSystemVersion(self, machine):
-		if RAN.GeteNBIPAddress() == 'none' or self.UEIPAddress == 'none':
-			HTML.SetOsVersion('Ubuntu 16.04.5 LTS', 0)
-			HTML.SetKernelVersion('4.15.0-45-generic', 0)
-			HTML.SetUhdVersion('3.13.0.1-0', 0)
-			HTML.SetUsrpBoard('B210', 0)
-			HTML.SetCpuNb('4', 0)
-			HTML.SetCpuModel('Intel(R) Core(TM) i5-6200U', 0)
-			HTML.SetCpuMHz('2399.996 MHz', 0)
+		if RAN.eNBIPAddress == 'none' or self.UEIPAddress == 'none':
+			HTML.OsVersion[0]='Ubuntu 16.04.5 LTS'
+			HTML.KernelVersion[0]='4.15.0-45-generic'
+			HTML.UhdVersion[0]='3.13.0.1-0'
+			HTML.UsrpBoard[0]='B210'
+			HTML.CpuNb[0]='4'
+			HTML.CpuModel[0]='Intel(R) Core(TM) i5-6200U'
+			HTML.CpuMHz[0]='2399.996 MHz'
 			return 0
 		if machine == 'eNB':
-			if RAN.GeteNBIPAddress() != '' and RAN.GeteNBUserName() != '' and RAN.GeteNBPassword() != '':
-				IPAddress = RAN.GeteNBIPAddress()
-				UserName = RAN.GeteNBUserName()
-				Password = RAN.GeteNBPassword()
+			if RAN.eNBIPAddress != '' and RAN.eNBUserName != '' and RAN.eNBPassword != '':
+				IPAddress = RAN.eNBIPAddress
+				UserName = RAN.eNBUserName
+				Password = RAN.eNBPassword
 				idx = 0
 			else:
 				return -1
@@ -2999,7 +3013,7 @@ class OaiCiTest():
 		if result is not None:
 			OsVersion = result.group('os_type')
 			logging.debug('OS is: ' + OsVersion)
-			HTML.SetOsVersion(OsVersion, idx)
+			HTML.OsVersion[idx]=OsVersion
 		else:
 			SSH.command('hostnamectl', '\$', 5)
 			result = re.search('Operating System: (?P<os_type>[a-zA-Z0-9\-\_\.\ ]+)', SSH.getBefore())
@@ -3011,26 +3025,26 @@ class OaiCiTest():
 					if result is not None:
 						OsVersion = OsVersion.replace('7 ', result.group('os_version'))
 				logging.debug('OS is: ' + OsVersion)
-				HTML.SetOsVersion(OsVersion, idx)
+				HTML.OsVersion[idx]=OsVersion
 		SSH.command('uname -r', '\$', 5)
 		result = re.search('uname -r\\\\r\\\\n(?P<kernel_version>[a-zA-Z0-9\-\_\.]+)', SSH.getBefore())
 		if result is not None:
 			KernelVersion = result.group('kernel_version')
 			logging.debug('Kernel Version is: ' + KernelVersion)
-			HTML.SetKernelVersion(KernelVersion, idx)
+			HTML.KernelVersion[idx]=KernelVersion
 		SSH.command('dpkg --list | egrep --color=never libuhd003', '\$', 5)
 		result = re.search('libuhd003:amd64 *(?P<uhd_version>[0-9\.]+)', SSH.getBefore())
 		if result is not None:
 			UhdVersion = result.group('uhd_version')
 			logging.debug('UHD Version is: ' + UhdVersion)
-			HTML.SetUhdVersion(UhdVersion, idx)
+			HTML.UhdVersion[idx]=UhdVersion
 		else:
 			SSH.command('uhd_config_info --version', '\$', 5)
 			result = re.search('UHD (?P<uhd_version>[a-zA-Z0-9\.\-]+)', SSH.getBefore())
 			if result is not None:
 				UhdVersion = result.group('uhd_version')
 				logging.debug('UHD Version is: ' + UhdVersion)
-				HTML.SetUhdVersion(UhdVersion, idx)
+				HTML.UhdVersion[idx]=UhdVersion
 		SSH.command('echo ' + Password + ' | sudo -S uhd_find_devices', '\$', 60)
 		usrp_boards = re.findall('product: ([0-9A-Za-z]+)\\\\r\\\\n', SSH.getBefore())
 		count = 0
@@ -3042,99 +3056,132 @@ class OaiCiTest():
 			count += 1
 		if count > 0:
 			logging.debug('USRP Board(s) : ' + UsrpBoard)
-			HTML.SetUsrpBoard(UsrpBoard, idx)
+			HTML.UsrpBoard[idx]=UsrpBoard
 		SSH.command('lscpu', '\$', 5)
 		result = re.search('CPU\(s\): *(?P<nb_cpus>[0-9]+).*Model name: *(?P<model>[a-zA-Z0-9\-\_\.\ \(\)]+).*CPU MHz: *(?P<cpu_mhz>[0-9\.]+)', SSH.getBefore())
 		if result is not None:
 			CpuNb = result.group('nb_cpus')
 			logging.debug('nb_cpus: ' + CpuNb)
-			HTML.SetCpuNb(CpuNb, idx)
+			HTML.CpuNb[idx]=CpuNb
 			CpuModel = result.group('model')
 			logging.debug('model: ' + CpuModel)
-			HTML.SetCpuModel(CpuModel, idx)
+			HTML.CpuModel[idx]=CpuModel
 			CpuMHz = result.group('cpu_mhz') + ' MHz'
 			logging.debug('cpu_mhz: ' + CpuMHz)
-			HTML.SetCpuMHz(CpuMHz, idx)
+			HTML.CpuMHz[idx]=CpuMHz
 		SSH.close()
 
-#-----------------------------------------------------------
-# ShowTestID()
-#-----------------------------------------------------------
 	def ShowTestID(self):
 		logging.debug('\u001B[1m----------------------------------------\u001B[0m')
 		logging.debug('\u001B[1mTest ID:' + self.testCase_id + '\u001B[0m')
 		logging.debug('\u001B[1m' + self.desc + '\u001B[0m')
 		logging.debug('\u001B[1m----------------------------------------\u001B[0m')
 
-def CheckClassValidity(action,id):
-	if action!='Build_PhySim' and action!='Run_PhySim' and  action != 'Build_eNB' and action != 'WaitEndBuild_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Build_OAI_UE' and action != 'Initialize_OAI_UE' and action != 'Terminate_OAI_UE' and action != 'DataDisable_UE' and action != 'DataEnable_UE' and action != 'CheckStatusUE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_FlexranCtrl' and action != 'Terminate_FlexranCtrl' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'Ping_CatM_module' and action != 'IdleSleep' and action != 'Perform_X2_Handover':
-		logging.debug('ERROR: test-case ' + id + ' has wrong class ' + action)
-		return False
-	return True
+
+
+#-----------------------------------------------------------
+# General Functions
+#-----------------------------------------------------------
+
+
+
+def CheckClassValidity(xml_class_list,action,id):
+	if action not in xml_class_list:
+		logging.debug('ERROR: test-case ' + id + ' has unlisted class ' + action + ' ##CHECK xml_class_list.yml')
+		resp=False
+	else:
+		resp=True
+	return resp
+
+
+#assigning parameters to object instance attributes (even if the attributes do not exist !!)
+def AssignParams(params_dict):
+
+	for key,value in params_dict.items():
+		setattr(CiTestObj, key, value)
+		setattr(RAN, key, value)
+		setattr(HTML, key, value)
+		setattr(ldpc, key, value)
+
+
 
 def GetParametersFromXML(action):
 	if action == 'Build_eNB':
-		RAN.SetBuild_eNB_args(test.findtext('Build_eNB_args'))
+		RAN.Build_eNB_args=test.findtext('Build_eNB_args')
 		forced_workspace_cleanup = test.findtext('forced_workspace_cleanup')
 		if (forced_workspace_cleanup is None):
-			RAN.SetBuild_eNB_forced_workspace_cleanup(False)
+			RAN.Build_eNB_forced_workspace_cleanup=False
 		else:
 			if re.match('true', forced_workspace_cleanup, re.IGNORECASE):
-				RAN.SetBuild_eNB_forced_workspace_cleanup(True)
+				RAN.Build_eNB_forced_workspace_cleanup=True
 			else:
-				RAN.SetBuild_eNB_forced_workspace_cleanup(False)
-		RAN.SeteNB_instance(test.findtext('eNB_instance'))
-		if (RAN.GeteNB_instance() is None):
-			RAN.SeteNB_instance('0')
-		RAN.SeteNB_serverId(test.findtext('eNB_serverId'))
-		if (RAN.GeteNB_serverId() is None):
-			RAN.SeteNB_serverId('0')
+				RAN.Build_eNB_forced_workspace_cleanup=False
+		eNB_instance=test.findtext('eNB_instance')
+		if (eNB_instance is None):
+			RAN.eNB_instance=0
+		else:
+			RAN.eNB_instance=int(eNB_instance)
+		RAN.eNB_serverId=test.findtext('eNB_serverId')
+		if (RAN.eNB_serverId is None):
+			RAN.eNB_serverId='0'
 		xmlBgBuildField = test.findtext('backgroundBuild')
 		if (xmlBgBuildField is None):
-			RAN.SetbackgroundBuild(False)
+			RAN.backgroundBuild=False
 		else:
 			if re.match('true', xmlBgBuildField, re.IGNORECASE):
-				RAN.SetbackgroundBuild(True)
+				RAN.backgroundBuild=True
 			else:
-				RAN.SetbackgroundBuild(False)
+				RAN.backgroundBuild=False
 
 	if action == 'WaitEndBuild_eNB':
-		RAN.SetBuild_eNB_args(test.findtext('Build_eNB_args'))
-		RAN.SeteNB_instance(test.findtext('eNB_instance'))
-		if (RAN.GeteNB_instance() is None):
-			RAN.SeteNB_instance('0')
-		RAN.SeteNB_serverId(test.findtext('eNB_serverId'))
-		if (RAN.GeteNB_serverId() is None):
-			RAN.SeteNB_serverId('0')
+		RAN.Build_eNB_args=test.findtext('Build_eNB_args')
+		eNB_instance=test.findtext('eNB_instance')
+		if (eNB_instance is None):
+			RAN.eNB_instance=0
+		else:
+			RAN.eNB_instance=int(eNB_instance)
+		RAN.eNB_serverId=test.findtext('eNB_serverId')
+		if (RAN.eNB_serverId is None):
+			RAN.eNB_serverId='0'
 
 	if action == 'Initialize_eNB':
-		RAN.SetInitialize_eNB_args(test.findtext('Initialize_eNB_args'))
-		RAN.SeteNB_instance(test.findtext('eNB_instance'))
-		if (RAN.GeteNB_instance() is None):
-			RAN.SeteNB_instance('0')
-		RAN.SeteNB_serverId(test.findtext('eNB_serverId'))
-		if (RAN.GeteNB_serverId() is None):
-			RAN.SeteNB_serverId('0')
-		CiTestObj.air_interface = test.findtext('air_interface')
-		if (CiTestObj.air_interface is None):
-			CiTestObj.air_interface = 'lte'
+		RAN.Initialize_eNB_args=test.findtext('Initialize_eNB_args')
+		eNB_instance=test.findtext('eNB_instance')
+		if (eNB_instance is None):
+			RAN.eNB_instance=0
 		else:
-			CiTestObj.air_interface = CiTestObj.air_interface.lower()
-		RAN.Setair_interface(CiTestObj.air_interface)
+			RAN.eNB_instance=int(eNB_instance)
+		RAN.eNB_serverId=test.findtext('eNB_serverId')
+		if (RAN.eNB_serverId is None):
+			RAN.eNB_serverId='0'
+			
+		#local variable air_interface
+		air_interface = test.findtext('air_interface')		
+		if (air_interface is None) or (air_interface.lower() not in ['nr','lte','ocp']):
+			RAN.air_interface[RAN.eNB_instance] = 'lte-softmodem'
+		elif (air_interface.lower() in ['nr','lte']):
+			RAN.air_interface[RAN.eNB_instance] = air_interface.lower() +'-softmodem'
+		else :
+			RAN.air_interface[RAN.eNB_instance] = 'ocp-enb'
 
 	if action == 'Terminate_eNB':
-		RAN.SeteNB_instance(test.findtext('eNB_instance'))
-		if (RAN.GeteNB_instance() is None):
-			RAN.SeteNB_instance('0')
-		RAN.SeteNB_serverId(test.findtext('eNB_serverId'))
-		if (RAN.GeteNB_serverId() is None):
-			RAN.SeteNB_serverId('0')
-		CiTestObj.air_interface = test.findtext('air_interface')
-		if (CiTestObj.air_interface is None):
-			CiTestObj.air_interface = 'lte'
+		eNB_instance=test.findtext('eNB_instance')
+		if (eNB_instance is None):
+			RAN.eNB_instance=0
 		else:
-			CiTestObj.air_interface = CiTestObj.air_interface.lower()
-		RAN.Setair_interface(CiTestObj.air_interface)
+			RAN.eNB_instance=int(eNB_instance)
+		RAN.eNB_serverId=test.findtext('eNB_serverId')
+		if (RAN.eNB_serverId is None):
+			RAN.eNB_serverId='0'
+			
+		#local variable air_interface
+		air_interface = test.findtext('air_interface')		
+		if (air_interface is None) or (air_interface.lower() not in ['nr','lte','ocp']):
+			RAN.air_interface[RAN.eNB_instance] = 'lte-softmodem'
+		elif (air_interface.lower() in ['nr','lte']):
+			RAN.air_interface[RAN.eNB_instance] = air_interface.lower() +'-softmodem'
+		else :
+			RAN.air_interface[RAN.eNB_instance] = 'ocp-enb'
 
 	if action == 'Attach_UE':
 		nbMaxUEtoAttach = test.findtext('nbMaxUEtoAttach')
@@ -3160,19 +3207,38 @@ def GetParametersFromXML(action):
 
 	if action == 'Initialize_OAI_UE':
 		CiTestObj.Initialize_OAI_UE_args = test.findtext('Initialize_OAI_UE_args')
-		CiTestObj.UE_instance = test.findtext('UE_instance')
-		if (CiTestObj.UE_instance is None):
-			CiTestObj.UE_instance = '0'
-		CiTestObj.air_interface = test.findtext('air_interface')
-		if (CiTestObj.air_interface is None):
-			CiTestObj.air_interface = 'lte'
+		UE_instance = test.findtext('UE_instance')
+		if (UE_instance is None):
+			CiTestObj.UE_instance = 0
 		else:
-			CiTestObj.air_interface = CiTestObj.air_interface.lower()
+			CiTestObj.UE_instance = UE_instance
+			
+		#local variable air_interface
+		air_interface = test.findtext('air_interface')		
+		if (air_interface is None) or (air_interface.lower() not in ['nr','lte','ocp']):
+			CiTestObj.air_interface = 'lte-uesoftmodem'
+		elif (air_interface.lower() in ['nr','lte']):
+			CiTestObj.air_interface = air_interface.lower() +'-uesoftmodem'
+		else :
+			#CiTestObj.air_interface = 'ocp-enb'
+			logging.error('OCP UE -- NOT SUPPORTED')
 
 	if action == 'Terminate_OAI_UE':
-		RAN.SeteNB_instance(test.findtext('UE_instance'))
-		if (CiTestObj.UE_instance is None):
+		UE_instance=test.findtext('UE_instance')
+		if (UE_instance is None):
 			CiTestObj.UE_instance = '0'
+		else:
+			CiTestObj.UE_instance = int(UE_instance)
+		
+		#local variable air_interface
+		air_interface = test.findtext('air_interface')		
+		if (air_interface is None) or (air_interface.lower() not in ['nr','lte','ocp']):
+			CiTestObj.air_interface = 'lte-uesoftmodem'
+		elif (air_interface.lower() in ['nr','lte']):
+			CiTestObj.air_interface = air_interface.lower() +'-uesoftmodem'
+		else :
+			#CiTestObj.air_interface = 'ocp-enb'
+			logging.error('OCP UE -- NOT SUPPORTED')
 
 	if action == 'Ping' or action == 'Ping_CatM_module':
 		CiTestObj.ping_args = test.findtext('ping_args')
@@ -3227,6 +3293,9 @@ def GetParametersFromXML(action):
 
 	if action == 'Run_PhySim':
 		ldpc.runargs = test.findtext('physim_run_args')
+		
+	if action == 'COTS_UE_Airplane':
+		COTS_UE.runargs = test.findtext('cots_ue_airplane_args')
 
 #check if given test is in list
 #it is in list if one of the strings in 'list' is at the beginning of 'test'
@@ -3240,207 +3309,88 @@ def test_in_list(test, list):
 def receive_signal(signum, frame):
 	sys.exit(1)
 
+
+
+
+
+
 #-----------------------------------------------------------
-# Parameter Check
+# MAIN PART
 #-----------------------------------------------------------
+
+#loading xml action list from yaml
+import yaml
+xml_class_list_file=''
+if (os.path.isfile('xml_class_list.yml')):
+	xml_class_list_file='xml_class_list.yml'
+if (os.path.isfile('ci-scripts/xml_class_list.yml')):
+	xml_class_list_file='ci-scripts/xml_class_list.yml'
+with open(xml_class_list_file,'r') as file:
+    # The FullLoader parameter handles the conversion from YAML
+    # scalar values to Python the dictionary format
+    xml_class_list = yaml.load(file,Loader=yaml.FullLoader)
+
 mode = ''
-CiTestObj = OaiCiTest()
 
-import sshconnection 
-import epc
-import helpreadme as HELP
-import ran
-import html
-import constants
+CiTestObj = OaiCiTest()
  
 SSH = sshconnection.SSHConnection()
 EPC = epc.EPCManagement()
 RAN = ran.RANManagement()
 HTML = html.HTMLManagement()
 
-EPC.SetHtmlObj(HTML)
-RAN.SetHtmlObj(HTML)
-RAN.SetEpcObj(EPC)
+EPC.htmlObj=HTML
+RAN.htmlObj=HTML
+RAN.epcObj=EPC
+
 
-import cls_physim           #class PhySim for physical simulators build and test
 ldpc=cls_physim.PhySim()    #create an instance for LDPC test using GPU or CPU build
 
-argvs = sys.argv
-argc = len(argvs)
-cwd = os.getcwd()
 
-while len(argvs) > 1:
-	myArgv = argvs.pop(1)	# 0th is this file's name
 
-	if re.match('^\-\-help$', myArgv, re.IGNORECASE):
-		HELP.GenericHelp(CONST.Version)
-		sys.exit(0)
-	elif re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE)
-		mode = matchReg.group(1)
-	elif re.match('^\-\-eNBRepository=(.+)$|^\-\-ranRepository(.+)$', myArgv, re.IGNORECASE):
-		if re.match('^\-\-eNBRepository=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNBRepository=(.+)$', myArgv, re.IGNORECASE)
-		else:
-			matchReg = re.match('^\-\-ranRepository=(.+)$', myArgv, re.IGNORECASE)
-		CiTestObj.ranRepository = matchReg.group(1)
-		RAN.SetranRepository(matchReg.group(1))
-		HTML.SetranRepository(matchReg.group(1))
-		ldpc.ranRepository=matchReg.group(1)
-	elif re.match('^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE):
-		if re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE)
-		else:
-			matchReg = re.match('^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE)
-		doMerge = matchReg.group(1)
-		ldpc.ranAllowMerge=matchReg.group(1)
-		if ((doMerge == 'true') or (doMerge == 'True')):
-			CiTestObj.ranAllowMerge = True
-			RAN.SetranAllowMerge(True)
-			HTML.SetranAllowMerge(True)
-	elif re.match('^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE):
-		if re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE)
-		else:
-			matchReg = re.match('^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE)
-		CiTestObj.ranBranch = matchReg.group(1)
-		RAN.SetranBranch(matchReg.group(1))
-		HTML.SetranBranch(matchReg.group(1))
-		ldpc.ranBranch=matchReg.group(1)
-	elif re.match('^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE):
-		if re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE)
-		else:
-			matchReg = re.match('^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE)
-		CiTestObj.ranCommitID = matchReg.group(1)
-		RAN.SetranCommitID(matchReg.group(1))
-		HTML.SetranCommitID(matchReg.group(1))
-		ldpc.ranCommitID=matchReg.group(1)
-	elif re.match('^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE):
-		if re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE)
-		else:
-			matchReg = re.match('^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE)
-		CiTestObj.ranTargetBranch = matchReg.group(1)
-		RAN.SetranTargetBranch(matchReg.group(1))
-		HTML.SetranTargetBranch(matchReg.group(1))
-		ldpc.ranTargetBranch=matchReg.group(1)
-	elif re.match('^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$', myArgv, re.IGNORECASE):
-		if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNBIPAddress(matchReg.group(1))
-			ldpc.eNBIpAddr=matchReg.group(1)
-		elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNB1IPAddress(matchReg.group(1))
-		elif re.match('^\-\-eNB2IPAddress=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNB2IPAddress=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNB2IPAddress(matchReg.group(1))
-	elif re.match('^\-\-eNBUserName=(.+)$|^\-\-eNB[1-2]UserName=(.+)$', myArgv, re.IGNORECASE):
-		if re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNBUserName(matchReg.group(1))
-			ldpc.eNBUserName=matchReg.group(1)
-		elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNB1UserName(matchReg.group(1))
-		elif re.match('^\-\-eNB2UserName=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNB2UserName=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNB2UserName(matchReg.group(1))
-	elif re.match('^\-\-eNBPassword=(.+)$|^\-\-eNB[1-2]Password=(.+)$', myArgv, re.IGNORECASE):
-		if re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNBPassword(matchReg.group(1))
-			ldpc.eNBPassWord=matchReg.group(1)
-		elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNB1Password(matchReg.group(1))
-		elif re.match('^\-\-eNB2Password=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNB2Password=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNB2Password(matchReg.group(1))
-	elif re.match('^\-\-eNBSourceCodePath=(.+)$|^\-\-eNB[1-2]SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
-		if re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNBSourceCodePath(matchReg.group(1))
-			ldpc.eNBSourceCodePath=matchReg.group(1)
-		elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNB1SourceCodePath(matchReg.group(1))
-		elif re.match('^\-\-eNB2SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
-			matchReg = re.match('^\-\-eNB2SourceCodePath=(.+)$', myArgv, re.IGNORECASE)
-			RAN.SeteNB2SourceCodePath(matchReg.group(1))
-	elif re.match('^\-\-EPCIPAddress=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-EPCIPAddress=(.+)$', myArgv, re.IGNORECASE)
-		EPC.SetIPAddress(matchReg.group(1))
-	elif re.match('^\-\-EPCUserName=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-EPCUserName=(.+)$', myArgv, re.IGNORECASE)
-		EPC.SetUserName(matchReg.group(1))
-	elif re.match('^\-\-EPCPassword=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-EPCPassword=(.+)$', myArgv, re.IGNORECASE)
-		EPC.SetPassword(matchReg.group(1))
-	elif re.match('^\-\-EPCSourceCodePath=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-EPCSourceCodePath=(.+)$', myArgv, re.IGNORECASE)
-		EPC.SetSourceCodePath(matchReg.group(1))
-	elif re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE)
-		if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-Docker', matchReg.group(1), re.IGNORECASE):
-			EPC.SetType(matchReg.group(1))
-		else:
-			sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS or OAI-Rel14-Docker)')
-	elif re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE)
-		EPC.SetContainerPrefix(matchReg.group(1))
-	elif re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE)
-		CiTestObj.ADBIPAddress = matchReg.group(1)
-	elif re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE)
-		CiTestObj.ADBUserName = matchReg.group(1)
-	elif re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE)
-		if re.match('centralized', matchReg.group(1), re.IGNORECASE) or re.match('distributed', matchReg.group(1), re.IGNORECASE):
-			if re.match('distributed', matchReg.group(1), re.IGNORECASE):
-				CiTestObj.ADBCentralized = False
-			else:
-				CiTestObj.ADBCentralized = True
-		else:
-			sys.exit('Invalid ADB Type: ' + matchReg.group(1) + ' -- (should be centralized or distributed)')
-	elif re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE)
-		CiTestObj.ADBPassword = matchReg.group(1)
-	elif re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE)
-		CiTestObj.testXMLfiles.append(matchReg.group(1))
-		HTML.SettestXMLfiles(matchReg.group(1))
-		HTML.SetnbTestXMLfiles(HTML.GetnbTestXMLfiles()+1)
-	elif re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE)
-		CiTestObj.UEIPAddress = matchReg.group(1)
-	elif re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE)
-		CiTestObj.UEUserName = matchReg.group(1)
-	elif re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE)
-		CiTestObj.UEPassword = matchReg.group(1)
-	elif re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE)
-		CiTestObj.UESourceCodePath = matchReg.group(1)
-	elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE):
-		matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE)
-		finalStatus = matchReg.group(1)
-		if ((finalStatus == 'true') or (finalStatus == 'True')):
-			CiTestObj.finalStatus = True
-	else:
-		HELP.GenericHelp(CONST.Version)
-		sys.exit('Invalid Parameter: ' + myArgv)
+#-----------------------------------------------------------
+# Parsing Command Line Arguments
+#-----------------------------------------------------------
+
+import args_parse
+py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,HELP)
+
+
+
+#-----------------------------------------------------------
+# TEMPORARY params management
+#-----------------------------------------------------------
+#temporary solution for testing:
+if py_param_file_present == True:
+	AssignParams(py_params)
+
+#for debug
+#print(RAN.__dict__) 
+#print(CiTestObj.__dict__) 
+#print(HTML.__dict__) 
+#print(ldpc.__dict__) 
+#for debug
+
+
+#-----------------------------------------------------------
+# COTS UE instanciation
+#-----------------------------------------------------------
+#COTS_UE instanciation can only be done here for the moment, due to code architecture
+COTS_UE=cls_cots_ue.CotsUe('oppo', CiTestObj.UEIPAddress, CiTestObj.UEUserName,CiTestObj.UEPassword)
+
+
+#-----------------------------------------------------------
+# XML class (action) analysis
+#-----------------------------------------------------------
+cwd = os.getcwd()
 
 if re.match('^TerminateeNB$', mode, re.IGNORECASE):
-	if RAN.GeteNBIPAddress() == '' or RAN.GeteNBUserName() == '' or RAN.GeteNBPassword() == '':
+	if RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '':
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
-	RAN.SeteNB_serverId('0')
-	RAN.SeteNB_instance('0')
-	RAN.SeteNBSourceCodePath('/tmp/')
+	RAN.eNB_serverId='0'
+	RAN.eNB_instance=0
+	RAN.eNBSourceCodePath='/tmp/'
 	RAN.TerminateeNB()
 elif re.match('^TerminateUE$', mode, re.IGNORECASE):
 	if (CiTestObj.ADBIPAddress == '' or CiTestObj.ADBUserName == '' or CiTestObj.ADBPassword == ''):
@@ -3455,52 +3405,52 @@ elif re.match('^TerminateOAIUE$', mode, re.IGNORECASE):
 	signal.signal(signal.SIGUSR1, receive_signal)
 	CiTestObj.TerminateOAIUE()
 elif re.match('^TerminateHSS$', mode, re.IGNORECASE):
-	if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetType() == '' or EPC.GetSourceCodePath() == '':
+	if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.Type == '' or EPC.SourceCodePath == '':
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
 	EPC.TerminateHSS()
 elif re.match('^TerminateMME$', mode, re.IGNORECASE):
-	if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetType() == '' or EPC.GetSourceCodePath() == '':
+	if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.Type == '' or EPC.SourceCodePath == '':
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
 	EPC.TerminateMME()
 elif re.match('^TerminateSPGW$', mode, re.IGNORECASE):
-	if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetType() == '' or EPC.GetSourceCodePath() == '':
+	if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.Type == '' or EPC.SourceCodePath== '':
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
 	EPC.TerminateSPGW()
 elif re.match('^LogCollectBuild$', mode, re.IGNORECASE):
-	if (RAN.GeteNBIPAddress() == '' or RAN.GeteNBUserName() == '' or RAN.GeteNBPassword() == '' or RAN.GeteNBSourceCodePath() == '') and (CiTestObj.UEIPAddress == '' or CiTestObj.UEUserName == '' or CiTestObj.UEPassword == '' or CiTestObj.UESourceCodePath == ''):
+	if (RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '' or RAN.eNBSourceCodePath == '') and (CiTestObj.UEIPAddress == '' or CiTestObj.UEUserName == '' or CiTestObj.UEPassword == '' or CiTestObj.UESourceCodePath == ''):
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
 	CiTestObj.LogCollectBuild()
 elif re.match('^LogCollecteNB$', mode, re.IGNORECASE):
-	if RAN.GeteNBIPAddress() == '' or RAN.GeteNBUserName() == '' or RAN.GeteNBPassword() == '' or RAN.GeteNBSourceCodePath() == '':
+	if RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '' or RAN.eNBSourceCodePath == '':
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
 	RAN.LogCollecteNB()
 elif re.match('^LogCollectHSS$', mode, re.IGNORECASE):
-	if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetType() == '' or EPC.GetSourceCodePath() == '':
+	if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.Type == '' or EPC.SourceCodePath == '':
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
 	EPC.LogCollectHSS()
 elif re.match('^LogCollectMME$', mode, re.IGNORECASE):
-	if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetType() == '' or EPC.GetSourceCodePath() == '':
+	if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.Type == '' or EPC.SourceCodePath == '':
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
 	EPC.LogCollectMME()
 elif re.match('^LogCollectSPGW$', mode, re.IGNORECASE):
-	if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetType() == '' or EPC.GetSourceCodePath() == '':
+	if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.Type == '' or EPC.SourceCodePath == '':
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
 	EPC.LogCollectSPGW()
 elif re.match('^LogCollectPing$', mode, re.IGNORECASE):
-	if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetSourceCodePath() == '':
+	if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.SourceCodePath == '':
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
 	CiTestObj.LogCollectPing()
 elif re.match('^LogCollectIperf$', mode, re.IGNORECASE):
-	if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetSourceCodePath() == '':
+	if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.SourceCodePath == '':
 		HELP.GenericHelp(CONST.Version)
 		sys.exit('Insufficient Parameter')
 	CiTestObj.LogCollectIperf()
@@ -3515,7 +3465,7 @@ elif re.match('^InitiateHtml$', mode, re.IGNORECASE):
 		sys.exit('Insufficient Parameter')
 	count = 0
 	foundCount = 0
-	while (count < HTML.GetnbTestXMLfiles()):
+	while (count < HTML.nbTestXMLfiles):
 		#xml_test_file = cwd + "/" + CiTestObj.testXMLfiles[count]
 		xml_test_file = sys.path[0] + "/" + CiTestObj.testXMLfiles[count]
 		if (os.path.isfile(xml_test_file)):
@@ -3524,21 +3474,21 @@ elif re.match('^InitiateHtml$', mode, re.IGNORECASE):
 			except:
 				print("Error while parsing file: " + xml_test_file)
 			xmlRoot = xmlTree.getroot()
-			HTML.SethtmlTabRefs(xmlRoot.findtext('htmlTabRef',default='test-tab-' + str(count)))
-			HTML.SethtmlTabNames(xmlRoot.findtext('htmlTabName',default='test-tab-' + str(count)))
-			HTML.SethtmlTabIcons(xmlRoot.findtext('htmlTabIcon',default='info-sign'))
+			HTML.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-' + str(count)))
+			HTML.htmlTabNames.append(xmlRoot.findtext('htmlTabName',default='test-tab-' + str(count)))
+			HTML.htmlTabIcons.append(xmlRoot.findtext('htmlTabIcon',default='info-sign'))
 			foundCount += 1
 		count += 1
-	if foundCount != HTML.GetnbTestXMLfiles():
-		HTML.SetnbTestXMLfiles(foundCount)
+	if foundCount != HTML.nbTestXMLfiles:
+		HTML.nbTestXMLfiles=foundCount
 	
 	if (CiTestObj.ADBIPAddress != 'none'):
 		terminate_ue_flag = False
 		CiTestObj.GetAllUEDevices(terminate_ue_flag)
 		CiTestObj.GetAllCatMDevices(terminate_ue_flag)
 		HTML.SethtmlUEConnected(len(CiTestObj.UEDevices) + len(CiTestObj.CatMDevices))
-		HTML.SethtmlNb_Smartphones(len(CiTestObj.UEDevices))
-		HTML.SethtmlNb_CATM_Modules(len(CiTestObj.CatMDevices))
+		HTML.htmlNb_Smartphones=len(CiTestObj.UEDevices)
+		HTML.htmlNb_CATM_Modules=len(CiTestObj.CatMDevices)
 	HTML.CreateHtmlHeader(CiTestObj.ADBIPAddress)
 elif re.match('^FinalizeHtml$', mode, re.IGNORECASE):
 	logging.debug('\u001B[1m----------------------------------------\u001B[0m')
@@ -3550,19 +3500,19 @@ elif re.match('^FinalizeHtml$', mode, re.IGNORECASE):
 	HTML.CreateHtmlFooter(CiTestObj.finalStatus)
 elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re.IGNORECASE):
 	if re.match('^TesteNB$', mode, re.IGNORECASE):
-		if RAN.GeteNBIPAddress() == '' or RAN.GetranRepository() == '' or RAN.GetranBranch() == '' or RAN.GeteNBUserName() == '' or RAN.GeteNBPassword() == '' or RAN.GeteNBSourceCodePath() == '' or EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetType() == '' or EPC.GetSourceCodePath() == '' or CiTestObj.ADBIPAddress == '' or CiTestObj.ADBUserName == '' or CiTestObj.ADBPassword == '':
+		if RAN.eNBIPAddress == '' or RAN.ranRepository == '' or RAN.ranBranch == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '' or RAN.eNBSourceCodePath == '' or EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.Type == '' or EPC.SourceCodePath == '' or CiTestObj.ADBIPAddress == '' or CiTestObj.ADBUserName == '' or CiTestObj.ADBPassword == '':
 			HELP.GenericHelp(CONST.Version)
-			if EPC.GetIPAddress() == '' or EPC.GetUserName() == '' or EPC.GetPassword() == '' or EPC.GetSourceCodePath() == '' or EPC.GetType() == '':
-				HELP.EPCSrvHelp(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), EPC.GetSourceCodePath(), EPC.GetType())
-			if RAN.GetranRepository() == '':
-				HELP.GitSrvHelp(RAN.GetranRepository(), RAN.GetranBranch(), RAN.GetranCommitID(), RAN.GetranAllowMerge(), RAN.GetranTargetBranch())
-			if RAN.GeteNBIPAddress() == ''  or RAN.GeteNBUserName() == '' or RAN.GeteNBPassword() == '' or RAN.GeteNBSourceCodePath() == '':
-				HELP.eNBSrvHelp(RAN.GeteNBIPAddress(), RAN.GeteNBUserName(), RAN.GeteNBPassword(), RAN.GeteNBSourceCodePath())
+			if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.SourceCodePath == '' or EPC.Type == '':
+				HELP.EPCSrvHelp(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath, EPC.Type)
+			if RAN.ranRepository == '':
+				HELP.GitSrvHelp(RAN.ranRepository, RAN.ranBranch, RAN.ranCommitID, RAN.ranAllowMerge, RAN.ranTargetBranch)
+			if RAN.eNBIPAddress == ''  or RAN.eNBUserName == '' or RAN.eNBPassword == '' or RAN.eNBSourceCodePath == '':
+				HELP.eNBSrvHelp(RAN.eNBIPAddress, RAN.eNBUserName, RAN.eNBPassword, RAN.eNBSourceCodePath)
 			sys.exit('Insufficient Parameter')
 
-		if (EPC.GetIPAddress() != '') and (EPC.GetIPAddress() != 'none'):
-			SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), cwd + "/tcp_iperf_stats.awk", "/tmp")
-			SSH.copyout(EPC.GetIPAddress(), EPC.GetUserName(), EPC.GetPassword(), cwd + "/active_net_interfaces.awk", "/tmp")
+		if (EPC.IPAddress!= '') and (EPC.IPAddress != 'none'):
+			SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, cwd + "/tcp_iperf_stats.awk", "/tmp")
+			SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, cwd + "/active_net_interfaces.awk", "/tmp")
 	else:
 		if CiTestObj.UEIPAddress == '' or CiTestObj.ranRepository == '' or CiTestObj.ranBranch == '' or CiTestObj.UEUserName == '' or CiTestObj.UEPassword == '' or CiTestObj.UESourceCodePath == '':
 			HELP.GenericHelp(CONST.Version)
@@ -3570,7 +3520,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
 
 	#read test_case_list.xml file
 	# if no parameters for XML file, use default value
-	if (HTML.GetnbTestXMLfiles() != 1):
+	if (HTML.nbTestXMLfiles != 1):
 		xml_test_file = cwd + "/test_case_list.xml"
 	else:
 		xml_test_file = cwd + "/" + CiTestObj.testXMLfiles[0]
@@ -3580,9 +3530,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
 
 	exclusion_tests=xmlRoot.findtext('TestCaseExclusionList',default='')
 	requested_tests=xmlRoot.findtext('TestCaseRequestedList',default='')
-	if (HTML.GetnbTestXMLfiles() == 1):
-		HTML.SethtmlTabRefs(xmlRoot.findtext('htmlTabRef',default='test-tab-0'))
-		HTML.SethtmlTabNames(xmlRoot.findtext('htmlTabName',default='Test-0'))
+	if (HTML.nbTestXMLfiles == 1):
+		HTML.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-0'))
+		HTML.htmlTabNames.append(xmlRoot.findtext('htmlTabName',default='Test-0'))
 		repeatCount = xmlRoot.findtext('repeatCount',default='1')
 		CiTestObj.repeatCounts.append(int(repeatCount))
 	all_tests=xmlRoot.findall('testCase')
@@ -3610,7 +3560,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
 		else:
 			logging.debug('ERROR: requested test is invalidly formatted: ' + test)
 			sys.exit(1)
-	if (EPC.GetIPAddress() != '') and (EPC.GetIPAddress() != 'none'):
+	if (EPC.IPAddress != '') and (EPC.IPAddress != 'none'):
 		CiTestObj.CheckFlexranCtrlInstallation()
 		EPC.SetMmeIPAddress()
 
@@ -3635,29 +3585,29 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
 	HTML.CreateHtmlTabHeader()
 
 	CiTestObj.FailReportCnt = 0
-	RAN.SetprematureExit(True)
-	HTML.SetstartTime(int(round(time.time() * 1000)))
-	while CiTestObj.FailReportCnt < CiTestObj.repeatCounts[0] and RAN.GetprematureExit():
-		RAN.SetprematureExit(False)
+	RAN.prematureExit=True
+	HTML.startTime=int(round(time.time() * 1000))
+	while CiTestObj.FailReportCnt < CiTestObj.repeatCounts[0] and RAN.prematureExit:
+		RAN.prematureExit=False
 		# At every iteratin of the retry loop, a separator will be added
 		# pass CiTestObj.FailReportCnt as parameter of HTML.CreateHtmlRetrySeparator
 		HTML.CreateHtmlRetrySeparator(CiTestObj.FailReportCnt)
 		for test_case_id in todo_tests:
-			if RAN.GetprematureExit():
+			if RAN.prematureExit:
 				break
 			for test in all_tests:
-				if RAN.GetprematureExit():
+				if RAN.prematureExit:
 					break
 				id = test.get('id')
 				if test_case_id != id:
 					continue
 				CiTestObj.testCase_id = id
-				HTML.SettestCase_id(CiTestObj.testCase_id)
-				EPC.SetTestCase_id(CiTestObj.testCase_id)
+				HTML.testCase_id=CiTestObj.testCase_id
+				EPC.testCase_id=CiTestObj.testCase_id
 				CiTestObj.desc = test.findtext('desc')
-				HTML.Setdesc(CiTestObj.desc)
+				HTML.desc=CiTestObj.desc
 				action = test.findtext('class')
-				if (CheckClassValidity(action, id) == False):
+				if (CheckClassValidity(xml_class_list, action, id) == False):
 					continue
 				CiTestObj.ShowTestID()
 				GetParametersFromXML(action)
@@ -3672,7 +3622,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
 				elif action == 'Initialize_eNB':
 					check_eNB = False
 					check_OAI_UE = False
-					RAN.SetpStatus(CiTestObj.CheckProcessExist(check_eNB, check_OAI_UE))
+					RAN.pStatus=CiTestObj.CheckProcessExist(check_eNB, check_OAI_UE)
 
 					RAN.InitializeeNB()
 				elif action == 'Terminate_eNB':
@@ -3738,16 +3688,20 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
 					if ldpc.exitStatus==1:sys.exit()
 				elif action == 'Run_PhySim':
 					HTML=ldpc.Run_PhySim(HTML,CONST,id)
+				elif action == 'COTS_UE_Airplane':
+					COTS_UE.Set_Airplane(COTS_UE.runargs)
 				else:
-					sys.exit('Invalid action')
+					sys.exit('Invalid class (action) from xml')
 		CiTestObj.FailReportCnt += 1
-	if CiTestObj.FailReportCnt == CiTestObj.repeatCounts[0] and RAN.GetprematureExit():
+	if CiTestObj.FailReportCnt == CiTestObj.repeatCounts[0] and RAN.prematureExit:
 		logging.debug('Testsuite failed ' + str(CiTestObj.FailReportCnt) + ' time(s)')
 		HTML.CreateHtmlTabFooter(False)
 		sys.exit('Failed Scenario')
 	else:
 		logging.info('Testsuite passed after ' + str(CiTestObj.FailReportCnt) + ' time(s)')
 		HTML.CreateHtmlTabFooter(True)
+elif re.match('^LoadParams$', mode, re.IGNORECASE):
+	pass
 else:
 	HELP.GenericHelp(CONST.Version)
 	sys.exit('Invalid mode')
diff --git a/ci-scripts/py_params.yaml b/ci-scripts/py_params.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..303d5d100660b8d2608a67f58e4950690882ffb8
--- /dev/null
+++ b/ci-scripts/py_params.yaml
@@ -0,0 +1,53 @@
+eNBRepository : b
+ranRepository : c
+eNB_AllowMerge : 
+ranAllowMerge : 
+eNBBranch : f
+ranBranch : g
+eNBCommitID :  
+ranCommitID : i
+eNBTargetBranch : j
+ranTargetBranch : k
+
+nodes : 
+  - type : eNB
+    IPAddress : 001.1.1
+    UserName : toto
+    Password : qwe
+    SourceCodePath : l
+  - type : gNB
+    IPAddress : 002.2.2
+    UserName : tata
+    Password : asd
+    SourceCodePath : m  
+  - type : eNB
+    IPAddress : 003.3.3
+    UserName : titi
+    Password : zxc
+    SourceCodePath : n
+  - type : gNB
+    IPAddress : 004.4.4
+    UserName : caca
+    Password : pepe
+    SourceCodePath :  o   
+
+EPCIPAddress : p
+EPCUserName : q
+EPCPassword : r
+EPCSourceCodePath : s
+EPCType : t
+EPCContainerPrefix : u
+
+ADBIPAddress : v
+ADBUserName : w
+ADBType : x
+ADBPassword : y
+
+XMLTestFile : z
+
+UEIPAddress : qqq
+UEUserName : www
+UEPassword : eee
+UESourceCodePath : yyy
+
+finalStatus : bbb
\ No newline at end of file
diff --git a/ci-scripts/py_params_template.yaml b/ci-scripts/py_params_template.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..aaf31c1576527dc08985a37dfe1dd2b97eca8d64
--- /dev/null
+++ b/ci-scripts/py_params_template.yaml
@@ -0,0 +1,97 @@
+eNBRepository : b
+ranRepository : c
+eNB_AllowMerge : 
+ranAllowMerge : 
+eNBBranch : f
+ranBranch : g
+eNBCommitID :  
+ranCommitID : i
+eNBTargetBranch : j
+ranTargetBranch : k
+
+
+RAN:
+  RAN_inst_0:
+    name : RAN_1
+    nodes : 
+    - type : eNB
+      IPAddress : 001.1.1
+      UserName : toto
+      Password : qwe
+      SourceCodePath : l
+    - type : gNB
+      IPAddress : 002.2.2
+      UserName : tata
+      Password : asd
+      SourceCodePath : m  
+    - type : eNB
+      IPAddress : 003.3.3
+      UserName : titi
+      Password : zxc
+      SourceCodePath : n
+    - type : gNB
+      IPAddress : 004.4.4
+      UserName : caca
+      Password : pepe
+      SourceCodePath :  o        
+  RAN_inst_1:
+    name : RAN_2
+    nodes : 
+    - type : eNB
+      IPAddress : 101.1.1
+      UserName : toto
+      Password : qwe
+      SourceCodePath : l
+    - type : gNB
+      IPAddress : 102.2.2
+      UserName : zaza
+      Password : asd
+      SourceCodePath : m  
+    - type : eNB
+      IPAddress : 103.3.3
+      UserName : zizi
+      Password : zxc
+      SourceCodePath : n
+    - type : gNB
+      IPAddress : 104.4.4
+      UserName : aaaa
+      Password : pepe
+      SourceCodePath :  o   
+
+
+
+EPC:
+  EPC_inst_0:
+    EPCIPAddress : p
+    EPCUserName : q
+    EPCPassword : r
+    EPCSourceCodePath : s
+    EPCType : t
+    EPCContainerPrefix : u
+
+ADB:
+  ADBIPAddress : v
+  ADBUserName : w
+  ADBType : x
+  ADBPassword : y
+
+
+UE:
+  UE_inst_0:
+    name : UE_1 
+    type :
+    UEIPAddress : qqq  
+    UEUserName : www
+    UEPassword : eee
+    UESourceCodePath : yyy
+  UE_inst_1:
+    name : UE_2
+    type :
+    UEIPAddress : bloblob  
+    UEUserName : gwou
+    UEPassword : zebu
+    UESourceCodePath : pop
+
+
+XMLTestFile : z
+finalStatus : bbb
\ No newline at end of file
diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py
index 287c18021e2cf2cabbeafe55a81a6b965e73612e..96f28e21fe3f58e19d56510c3fcac22645a2df05 100644
--- a/ci-scripts/ran.py
+++ b/ci-scripts/ran.py
@@ -77,8 +77,8 @@ class RANManagement():
 		self.backgroundBuildTestId = ['', '', '']
 		self.Build_eNB_forced_workspace_cleanup = False
 		self.Initialize_eNB_args = ''
-		self.air_interface = 'lte'
-		self.eNB_instance = ''
+		self.air_interface = ['', '', ''] #changed from 'lte' to '' may lead to side effects in main
+		self.eNB_instance = 0
 		self.eNB_serverId = ''
 		self.eNBLogFiles = ['', '', '']
 		self.eNBOptions = ['', '', '']
@@ -91,140 +91,7 @@ class RANManagement():
 		self.htmlObj = None
 		self.epcObj = None
 
-#-----------------------------------------------------------
-# Setters and Getters on Public members
-#-----------------------------------------------------------
-
-	def SetHtmlObj(self, obj):
-		self.htmlObj = obj
-	def SetEpcObj(self, obj):
-		self.epcObj = obj
-
-	def SetflexranCtrlInstalled(self,fxrctin):
-		self.flexranCtrlInstalled = fxrctin
-	def GetflexranCtrlInstalled(self):
-		return self.flexranCtrlInstalled
-	def SetflexranCtrlStarted(self,fxrctst):
-		self.flexranCtrlStarted = fxrctst
-	def GetflexranCtrlStarted(self):
-		return self.flexranCtrlStarted
-	def SetpStatus(self, pSt):
-		self.pStatus = pSt
-	def SetranRepository(self, repository):
-		self.ranRepository = repository
-	def GetranRepository(self):
-		return self.ranRepository
-	def SetranBranch(self, branch):
-		self.ranBranch = branch
-	def GetranBranch(self):
-		return self.ranBranch
-	def SetranCommitID(self, commitid):
-		self.ranCommitID = commitid
-	def GetranCommitID(self):
-		return self.ranCommitID
-	def SeteNB_serverId(self, enbsrvid):
-		self.eNB_serverId = enbsrvid
-	def GeteNB_serverId(self):
-		return self.eNB_serverId
-	def SeteNBIPAddress(self, enbip):
-		self.eNBIPAddress = enbip
-	def GeteNBIPAddress(self):
-		return self.eNBIPAddress
-	def SeteNBUserName(self, enbusr):
-		self.eNBUserName = enbusr
-	def GeteNBUserName(self):
-		return self.eNBUserName
-	def SeteNBPassword(self, enbpw):
-		self.eNBPassword = enbpw
-	def GeteNBPassword(self):
-		return self.eNBPassword
-	def SeteNBSourceCodePath(self, enbcodepath):
-		self.eNBSourceCodePath = enbcodepath
-	def GeteNBSourceCodePath(self):
-		return self.eNBSourceCodePath
-	def SetranAllowMerge(self, merge):
-		self.ranAllowMerge = merge
-	def GetranAllowMerge(self):
-		return self.ranAllowMerge
-	def SetranTargetBranch(self, tbranch):
-		self.ranTargetBranch = tbranch
-	def GetranTargetBranch(self):
-		return self.ranTargetBranch
-	def SetBuild_eNB_args(self, enbbuildarg):
-		self.Build_eNB_args = enbbuildarg
-	def GetBuild_eNB_args(self):
-		return self.Build_eNB_args
-	def SetInitialize_eNB_args(self, initenbarg):
-		self.Initialize_eNB_args = initenbarg
-	def GetInitialize_eNB_args(self):
-		return self.Initialize_eNB_args
-	def SetbackgroundBuild(self, bkbuild):
-		self.backgroundBuild = bkbuild
-	def GetbackgroundBuild(self):
-		return self.backgroundBuild
-	def SetbackgroundBuildTestId(self, bkbuildid):
-		self.backgroundBuildTestId = bkbuildid
-	def GetbackgroundBuildTestId(self):
-		return self.backgroundBuildTestId
-	def SetBuild_eNB_forced_workspace_cleanup(self, fcdwspclean):
-		self.Build_eNB_forced_workspace_cleanup = fcdwspclean
-	def GetBuild_eNB_forced_workspace_cleanup(self):
-		return self.Build_eNB_forced_workspace_cleanup
-	def Setair_interface(self, airif):
-		self.air_interface = airif
-	def Getair_interface(self):
-		return self.air_interface
-	def SeteNB_instance(self, enbinst):
-		self.eNB_instance = enbinst
-	def GeteNB_instance(self):
-		return self.eNB_instance
-
-	def SeteNBLogFile(self, enblog, idx):
-		self.eNBLogFiles[idx] = enblog
-	def GeteNBLogFile(self, idx):
-		return self.eNBLogFiles[idx]
-
-	def GeteNBmbmsEnable(self, idx):
-		return self.eNBmbmsEnables[idx]
-
-	def SeteNB1IPAddress(self,enb1ip):
-		self.eNB1IPAddress = enb1ip
-	def GeteNB1IPAddress(self):
-		return self.eNB1IPAddress
-	def SeteNB1UserName(self, enb1usr):
-		self.eNB1UserName = enb1usr
-	def GeteNB1UserName(self):
-		return self.eNB1UserName
-	def SeteNB1Password(self, enb1pw):
-		self.eNB1Password = enb1pw
-	def GeteNB1Password(self):
-		return self.eNB1Password
-	def SeteNB1SourceCodePath(self, enb1codepath):
-		self.eNB1SourceCodePath = enb1codepath
-	def GeteNB1SourceCodePath(self):
-		return self.eNB1SourceCodePath
 
-	def SeteNB2IPAddress(self, enb2ip):
-		self.eNB2IPAddress = enb2ip
-	def GeteNB2IPAddress(self):
-		return self.eNB2IPAddress
-	def SeteNB2UserName(self, enb2usr):
-		self.eNB2UserName = enb2usr
-	def GeteNB2UserName(self):
-		return self.eNB2UserName
-	def SeteNB2Password(self, enb2pw):
-		self.eNB2Password = enb2pw
-	def GeteNB2Password(self):
-		return self.eNB2Password
-	def SeteNB2SourceCodePath(self, enb2codepath):
-		self.eNB2SourceCodePath = enb2codepath
-	def GeteNB2SourceCodePath(self):
-		return self.eNB2SourceCodePath
-
-	def SetprematureExit(self, premex):
-		self.prematureExit = premex
-	def GetprematureExit(self):
-		return self.prematureExit
 
 #-----------------------------------------------------------
 # RAN management functions
@@ -254,17 +121,23 @@ class RANManagement():
 			sys.exit('Insufficient Parameter')
 		mySSH = SSH.SSHConnection()
 		mySSH.open(lIpAddr, lUserName, lPassWord)
-		# Check if we build an 5G-NR gNB or an LTE eNB
-		result = re.search('--gNB', self.Build_eNB_args)
+		
+		# Check if we build an 5G-NR gNB or an LTE eNB or an OCP eNB
+		result = re.search('--eNBocp', self.Build_eNB_args)
 		if result is not None:
-			self.air_interface = 'nr'
-		else:
-			self.air_interface = 'lte'
+			self.air_interface[self.eNB_instance] = 'ocp-enb'
+		else:	
+			result = re.search('--gNB', self.Build_eNB_args)
+			if result is not None:
+				self.air_interface[self.eNB_instance] = 'nr-softmodem'
+			else:
+				self.air_interface[self.eNB_instance] = 'lte-softmodem'
+				
 		# Worakround for some servers, we need to erase completely the workspace
 		if self.Build_eNB_forced_workspace_cleanup:
 			mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf ' + lSourcePath, '\$', 15)
 		if self.htmlObj is not None:
-			self.testCase_id = self.htmlObj.GettestCase_id()
+			self.testCase_id = self.htmlObj.testCase_id
 		else:
 			self.testCase_id = '000000'
 		# on RedHat/CentOS .git extension is mandatory
@@ -332,7 +205,8 @@ class RANManagement():
 		if self.backgroundBuild:
 			mySSH.command('echo "./build_oai ' + self.Build_eNB_args + '" > ./my-lte-softmodem-build.sh', '\$', 5)
 			mySSH.command('chmod 775 ./my-lte-softmodem-build.sh', '\$', 5)
-			mySSH.command('echo ' + lPassWord + ' | sudo -S -E daemon --inherit --unsafe --name=build_enb_daemon --chdir=' + lSourcePath + '/cmake_targets -o ' + lSourcePath + '/cmake_targets/compile_oai_enb.log ./my-lte-softmodem-build.sh', '\$', 5)
+			mySSH.command('echo ' + lPassWord + ' | sudo -S ls', '\$', 5)
+			mySSH.command('echo $USER; nohup sudo -E ./my-lte-softmodem-build.sh' + ' > ' + lSourcePath + '/cmake_targets/compile_oai_enb.log ' + ' 2>&1 &', lUserName, 5)
 			mySSH.close()
 			if self.htmlObj is not None:
 				self.htmlObj.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
@@ -378,21 +252,21 @@ class RANManagement():
 
 	def checkBuildeNB(self, lIpAddr, lUserName, lPassWord, lSourcePath, testcaseId):
 		if self.htmlObj is not None:
-			self.htmlObj.SettestCase_id(testcaseId)
+			self.htmlObj.testCase_id=testcaseId
+
 		mySSH = SSH.SSHConnection()
 		mySSH.open(lIpAddr, lUserName, lPassWord)
 		mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 3)
 		mySSH.command('ls ran_build/build', '\$', 3)
 		mySSH.command('ls ran_build/build', '\$', 3)
-		if self.air_interface == 'nr':
-			nodeB_prefix = 'g'
-		else:
-			nodeB_prefix = 'e'
-		buildStatus = True
-		result = re.search(self.air_interface + '-softmodem', mySSH.getBefore())
+
+		#check if we have the build corresponding to the air interface keywords (nr-softmode, lte-softmodem, ocp-enb)
+		logging.info('CHECK Build with IP='+lIpAddr+' SourcePath='+lSourcePath)
+		result = re.search(self.air_interface[self.eNB_instance], mySSH.getBefore())
 		if result is None:
-			buildStatus = False
+			buildStatus = False #if not, build failed
 		else:
+			buildStatus = True 
 			# Generating a BUILD INFO file
 			mySSH.command('echo "SRC_BRANCH: ' + self.ranBranch + '" > ../LAST_BUILD_INFO.txt', '\$', 2)
 			mySSH.command('echo "SRC_COMMIT: ' + self.ranCommitID + '" >> ../LAST_BUILD_INFO.txt', '\$', 2)
@@ -404,6 +278,8 @@ class RANManagement():
 					mySSH.command('echo "TGT_BRANCH: ' + self.ranTargetBranch + '" >> ../LAST_BUILD_INFO.txt', '\$', 2)
 			else:
 				mySSH.command('echo "MERGED_W_TGT_BRANCH: NO" >> ../LAST_BUILD_INFO.txt', '\$', 2)
+				
+				
 		mySSH.command('mkdir -p build_log_' + testcaseId, '\$', 5)
 		mySSH.command('mv log/* ' + 'build_log_' + testcaseId, '\$', 5)
 		mySSH.command('mv compile_oai_enb.log ' + 'build_log_' + testcaseId, '\$', 5)
@@ -420,18 +296,20 @@ class RANManagement():
 				os.remove('./tmp_build' + testcaseId + '.zip')
 				mySSH.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
 				mySSH.command('cd ' + self.eNBSourceCodePath + '/cmake_targets', '\$', 5)
-				mySSH.command('unzip -qq -DD tmp_build' + testcaseId + '.zip', '\$', 5)
+				#-qq quiet / -u update orcreate files
+				mySSH.command('unzip -u -qq -DD tmp_build' + testcaseId + '.zip', '\$', 5)
 				mySSH.command('rm -f tmp_build' + testcaseId + '.zip', '\$', 5)
 				mySSH.close()
 		else:
 			mySSH.close()
 
+		#generate logging info depending on buildStatus and air interface
 		if buildStatus:
-			logging.info('\u001B[1m Building OAI ' + nodeB_prefix + 'NB Pass\u001B[0m')
+			logging.info('\u001B[1m Building OAI ' + self.air_interface[self.eNB_instance] + ' Pass\u001B[0m')
 			if self.htmlObj is not None:
-				self.htmlObj.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
+				self.htmlObj.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)		
 		else:
-			logging.error('\u001B[1m Building OAI ' + nodeB_prefix + 'NB Failed\u001B[0m')
+			logging.error('\u001B[1m Building OAI ' + self.air_interface[self.eNB_instance] + ' Failed\u001B[0m')
 			if self.htmlObj is not None:
 				self.htmlObj.CreateHtmlTestRow(self.Build_eNB_args, 'KO', CONST.ALL_PROCESSES_OK)
 				self.htmlObj.CreateHtmlTabFooter(False)
@@ -458,22 +336,22 @@ class RANManagement():
 			sys.exit('Insufficient Parameter')
 
 		if self.htmlObj is not None:
-			self.testCase_id = self.htmlObj.GettestCase_id()
+			self.testCase_id = self.htmlObj.testCase_id
 		else:
 			self.testCase_id = '000000'
 		mySSH = SSH.SSHConnection()
 		
 		if (self.pStatus < 0):
 			if self.htmlObj is not None:
-				self.htmlObj.CreateHtmlTestRow(self.Initialize_eNB_args, 'KO', self.pStatus)
+				self.htmlObj.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' ' + self.Initialize_eNB_args, 'KO', self.pStatus)
 				self.htmlObj.CreateHtmlTabFooter(False)
 			sys.exit(1)
 		# If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB
 		result = re.search('T_stdout', str(self.Initialize_eNB_args))
 		if (result is not None) and (self.epcObj is not None):
-			localEpcIpAddr = self.epcObj.GetIPAddress()
-			localEpcUserName = self.epcObj.GetUserName()
-			localEpcPassword = self.epcObj.GetPassword()
+			localEpcIpAddr = self.epcObj.IPAddress
+			localEpcUserName = self.epcObj.UserName
+			localEpcPassword = self.epcObj.Password
 			mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword)
 			mySSH.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5)
 			result = re.search('interfaceToUse=(?P<eth_interface>[a-zA-Z0-9\-\_]+)done', mySSH.getBefore())
@@ -522,12 +400,14 @@ class RANManagement():
 		# Make a copy and adapt to EPC / eNB IP addresses
 		mySSH.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5)
 		if self.epcObj is not None:
-			localMmeIpAddr = self.epcObj.GetMmeIPAddress()
+			localMmeIpAddr = self.epcObj.MmeIPAddress
 			mySSH.command('sed -i -e \'s/CI_MME_IP_ADDR/' + localMmeIpAddr + '/\' ' + ci_full_config_file, '\$', 2);
 		mySSH.command('sed -i -e \'s/CI_ENB_IP_ADDR/' + lIpAddr + '/\' ' + ci_full_config_file, '\$', 2);
+		mySSH.command('sed -i -e \'s/CI_GNB_IP_ADDR/' + lIpAddr + '/\' ' + ci_full_config_file, '\$', 2);
 		mySSH.command('sed -i -e \'s/CI_RCC_IP_ADDR/' + self.eNBIPAddress + '/\' ' + ci_full_config_file, '\$', 2);
 		mySSH.command('sed -i -e \'s/CI_RRU1_IP_ADDR/' + self.eNB1IPAddress + '/\' ' + ci_full_config_file, '\$', 2);
 		mySSH.command('sed -i -e \'s/CI_RRU2_IP_ADDR/' + self.eNB2IPAddress + '/\' ' + ci_full_config_file, '\$', 2);
+		mySSH.command('sed -i -e \'s/CI_FR1_CTL_ENB_IP_ADDR/' + self.eNBIPAddress + '/\' ' + ci_full_config_file, '\$', 2);
 		if self.flexranCtrlInstalled and self.flexranCtrlStarted:
 			mySSH.command('sed -i -e \'s/FLEXRAN_ENABLED.*;/FLEXRAN_ENABLED        = "yes";/\' ' + ci_full_config_file, '\$', 2);
 		else:
@@ -549,15 +429,11 @@ class RANManagement():
 		if self.air_interface == 'nr':
 			mySSH.command('if [ -e rbconfig.raw ]; then echo ' + lPassWord + ' | sudo -S rm rbconfig.raw; fi', '\$', 5)
 			mySSH.command('if [ -e reconfig.raw ]; then echo ' + lPassWord + ' | sudo -S rm reconfig.raw; fi', '\$', 5)
-		mySSH.command('echo "ulimit -c unlimited && ./ran_build/build/' + self.air_interface + '-softmodem -O ' + lSourcePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
+		# NOTE: WE SHALL do a check if the executable is present (in case build went wrong)
+		mySSH.command('echo "ulimit -c unlimited && ./ran_build/build/' + self.air_interface[self.eNB_instance] + ' -O ' + lSourcePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
 		mySSH.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
 		mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5)
-		mySSH.command('hostnamectl','\$', 5)
-		result = re.search('CentOS Linux 7', mySSH.getBefore())
-		if result is not None:
-			mySSH.command('echo $USER; nohup sudo ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh > ' + lSourcePath + '/cmake_targets/enb_' + self.testCase_id + '.log 2>&1 &', lUserName, 10)
-		else:
-			mySSH.command('echo ' + lPassWord + ' | sudo -S -E daemon --inherit --unsafe --name=enb' + str(self.eNB_instance) + '_daemon --chdir=' + lSourcePath + '/cmake_targets -o ' + lSourcePath + '/cmake_targets/enb_' + self.testCase_id + '.log ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
+		mySSH.command('echo $USER; nohup sudo -E ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh > ' + lSourcePath + '/cmake_targets/enb_' + self.testCase_id + '.log 2>&1 &', lUserName, 10)
 		self.eNBLogFiles[int(self.eNB_instance)] = 'enb_' + self.testCase_id + '.log'
 		if extra_options != '':
 			self.eNBOptions[int(self.eNB_instance)] = extra_options
@@ -574,15 +450,15 @@ class RANManagement():
 					mySSH.command('killall --signal SIGKILL record', '\$', 5)
 				mySSH.close()
 				doLoop = False
-				logging.error('\u001B[1;37;41m eNB logging system did not show got sync! \u001B[0m')
+				logging.error('\u001B[1;37;41m eNB/gNB/ocp-eNB logging system did not show got sync! \u001B[0m')
 				if self.htmlObj is not None:
-					self.htmlObj.CreateHtmlTestRow('-O ' + config_file + extra_options, 'KO', CONST.ALL_PROCESSES_OK)
+					self.htmlObj.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' -O ' + config_file + extra_options, 'KO', CONST.ALL_PROCESSES_OK)
 				# In case of T tracer recording, we need to kill tshark on EPC side
 				result = re.search('T_stdout', str(self.Initialize_eNB_args))
 				if (result is not None) and (self.epcObj is not None):
-					localEpcIpAddr = self.epcObj.GetIPAddress()
-					localEpcUserName = self.epcObj.GetUserName()
-					localEpcPassword = self.epcObj.GetPassword()
+					localEpcIpAddr = self.epcObj.IPAddress
+					localEpcUserName = self.epcObj.UserName
+					localEpcPassword = self.epcObj.Password
 					mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword)
 					logging.debug('\u001B[1m Stopping tshark \u001B[0m')
 					mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
@@ -634,8 +510,8 @@ class RANManagement():
 
 		mySSH.close()
 		if self.htmlObj is not None:
-			self.htmlObj.CreateHtmlTestRow('-O ' + config_file + extra_options, 'OK', CONST.ALL_PROCESSES_OK)
-		logging.debug('\u001B[1m Initialize eNB Completed\u001B[0m')
+			self.htmlObj.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' -O ' + config_file + extra_options, 'OK', CONST.ALL_PROCESSES_OK)
+		logging.debug('\u001B[1m Initialize eNB/gNB/ocp-eNB Completed\u001B[0m')
 
 	def CheckeNBProcess(self, status_queue):
 		try:
@@ -658,8 +534,8 @@ class RANManagement():
 				lPassWord = self.eNBPassword
 			mySSH = SSH.SSHConnection()
 			mySSH.open(lIpAddr, lUserName, lPassWord)
-			mySSH.command('stdbuf -o0 ps -aux | grep --color=never ' + self.air_interface + '-softmodem | grep -v grep', '\$', 5)
-			result = re.search(self.air_interface + '-softmodem', mySSH.getBefore())
+			mySSH.command('stdbuf -o0 ps -aux | grep --color=never ' + self.air_interface[self.eNB_instance] + ' | grep -v grep', '\$', 5)
+			result = re.search(self.air_interface[self.eNB_instance], mySSH.getBefore())
 			if result is None:
 				logging.debug('\u001B[1;37;41m eNB Process Not Found! \u001B[0m')
 				status_queue.put(CONST.ENB_PROCESS_FAILED)
@@ -691,29 +567,28 @@ class RANManagement():
 		mySSH = SSH.SSHConnection()
 		mySSH.open(lIpAddr, lUserName, lPassWord)
 		mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5)
-		if self.air_interface == 'lte':
+		if (self.air_interface[self.eNB_instance] == 'lte-softmodem') or (self.air_interface[self.eNB_instance] == 'ocp-enb'):
 			nodeB_prefix = 'e'
 		else:
 			nodeB_prefix = 'g'
-		mySSH.command('stdbuf -o0  ps -aux | grep --color=never softmodem | grep -v grep', '\$', 5)
-		result = re.search('-softmodem', mySSH.getBefore())
+		mySSH.command('stdbuf -o0  ps -aux | grep --color=never -e softmodem -e ocp-enb | grep -v grep', '\$', 5)
+		result = re.search('(-softmodem|ocp)', mySSH.getBefore())
 		if result is not None:
-			mySSH.command('echo ' + lPassWord + ' | sudo -S daemon --name=enb' + str(self.eNB_instance) + '_daemon --stop', '\$', 5)
-			mySSH.command('echo ' + lPassWord + ' | sudo -S killall --signal SIGINT -r .*-softmodem || true', '\$', 5)
+			mySSH.command('echo ' + lPassWord + ' | sudo -S killall --signal SIGINT -r .*-softmodem ocp-enb || true', '\$', 5)
 			time.sleep(10)
-			mySSH.command('stdbuf -o0  ps -aux | grep --color=never softmodem | grep -v grep', '\$', 5)
-			result = re.search('-softmodem', mySSH.getBefore())
+			mySSH.command('stdbuf -o0  ps -aux | grep --color=never -e softmodem -e ocp-enb | grep -v grep', '\$', 5)
+			result = re.search('(-softmodem|ocp)', mySSH.getBefore())
 			if result is not None:
-				mySSH.command('echo ' + lPassWord + ' | sudo -S killall --signal SIGKILL -r .*-softmodem || true', '\$', 5)
+				mySSH.command('echo ' + lPassWord + ' | sudo -S killall --signal SIGKILL -r .*-softmodem ocp-enb || true', '\$', 5)
 				time.sleep(5)
 		mySSH.command('rm -f my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
 		mySSH.close()
 		# If tracer options is on, stopping tshark on EPC side
 		result = re.search('T_stdout', str(self.Initialize_eNB_args))
 		if (result is not None) and (self.epcObj is not None):
-			localEpcIpAddr = self.epcObj.GetIPAddress()
-			localEpcUserName = self.epcObj.GetUserName()
-			localEpcPassword = self.epcObj.GetPassword()
+			localEpcIpAddr = self.epcObj.IPAddress
+			localEpcUserName = self.epcObj.UserName
+			localEpcPassword = self.epcObj.Password
 			mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword)
 			logging.debug('\u001B[1m Stopping tshark \u001B[0m')
 			mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
@@ -752,7 +627,7 @@ class RANManagement():
 				if (copyin_res == -1):
 					logging.debug('\u001B[1;37;41m Could not copy ' + nodeB_prefix + 'NB logfile to analyze it! \u001B[0m')
 					if self.htmlObj is not None:
-						self.htmlObj.SetHmleNBFailureMsg('Could not copy ' + nodeB_prefix + 'NB logfile to analyze it!')
+						self.htmlObj.htmleNBFailureMsg='Could not copy ' + nodeB_prefix + 'NB logfile to analyze it!'
 						self.htmlObj.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
 					self.eNBmbmsEnables[int(self.eNB_instance)] = False
 					return
@@ -823,7 +698,30 @@ class RANManagement():
 		X2HO_inNbProcedures = 0
 		X2HO_outNbProcedures = 0
 		global_status = CONST.ALL_PROCESSES_OK
+		# Runtime statistics
+		runTime = ''
+		userTime = ''
+		systemTime = ''
+		maxPhyMemUsage = ''
+		nbContextSwitches = ''
 		for line in enb_log_file.readlines():
+			# Runtime statistics
+			result = re.search('Run time:' ,str(line))
+			if result is not None:
+				runTime = str(line).strip()
+			if runTime != '':
+				result = re.search('Time executing user inst', str(line))
+				if result is not None:
+					userTime = 'to be decoded - 1'
+				result = re.search('Time executing system inst', str(line))
+				if result is not None:
+					systemTime = 'to be decoded - 2'
+				result = re.search('Max. Phy. memory usage:', str(line))
+				if result is not None:
+					maxPhyMemUsage = 'to be decoded - 3'
+				result = re.search('Number of context switch.*process origin', str(line))
+				if result is not None:
+					nbContextSwitches = 'to be decoded - 4'
 			if X2HO_state == CONST.X2_HO_REQ_STATE__IDLE:
 				result = re.search('target eNB Receives X2 HO Req X2AP_HANDOVER_REQ', str(line))
 				if result is not None:
@@ -896,8 +794,7 @@ class RANManagement():
 			if result is not None:
 				rrcSetupComplete += 1
 			result = re.search('Generate LTE_RRCConnectionRelease|Generate RRCConnectionRelease', str(line))
-			if result is not None:
-				rrcReleaseRequest += 1
+			if result is not None:				rrcReleaseRequest += 1
 			result = re.search('Generate LTE_RRCConnectionReconfiguration', str(line))
 			if result is not None:
 				rrcReconfigRequest += 1
@@ -955,11 +852,11 @@ class RANManagement():
 					mbmsRequestMsg += 1
 		enb_log_file.close()
 		logging.debug('   File analysis completed')
-		if self.air_interface == 'lte':
+		if (self.air_interface[self.eNB_instance] == 'lte-softmodem') or (self.air_interface[self.eNB_instance] == 'ocp-enb'):
 			nodeB_prefix = 'e'
 		else:
 			nodeB_prefix = 'g'
-		if self.air_interface == 'nr':
+		if self.air_interface[self.eNB_instance] == 'nr-softmodem':
 			if ulschReceiveOK > 0:
 				statMsg = nodeB_prefix + 'NB showed ' + str(ulschReceiveOK) + ' "ULSCH received ok" message(s)'
 				logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
@@ -1080,5 +977,12 @@ class RANManagement():
 			htmleNBFailureMsg += rlcMsg + '\n'
 			global_status = CONST.ENB_PROCESS_REALTIME_ISSUE
 		if self.htmlObj is not None:
-			self.htmlObj.SetHmleNBFailureMsg(htmleNBFailureMsg)
+			self.htmlObj.htmleNBFailureMsg=htmleNBFailureMsg
+		# Runtime statistics
+		if runTime != '':
+			logging.debug(runTime)
+			logging.debug('Time executing user inst   : ' + userTime)
+			logging.debug('Time executing system inst : ' + systemTime)
+			logging.debug('Max Physical Memory Usage  : ' + maxPhyMemUsage)
+			logging.debug('Nb Context Switches        : ' + nbContextSwitches)
 		return global_status
diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh
index 897f9285e94ce017b91a7c9626ae7d590c5773ca..b05ccf39db43a1d8d19c44662b3acb3a3b528690 100755
--- a/ci-scripts/reportTestLocally.sh
+++ b/ci-scripts/reportTestLocally.sh
@@ -620,6 +620,101 @@ function report_test {
             #IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_ul*client*txt | grep -v mbms 2> /dev/null`
             #analyzeIperfFiles
         done
+
+        # FeMBMS Case
+        CN_CONFIG="noS1"
+        TMODE="fdd"
+        BW_CASES=(05)
+        for BW in ${BW_CASES[@]}
+        do
+            echo "      <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html
+            echo "          <td align = \"center\" colspan = 4 >Test FeMBMS without EPC (aka noS1): ${TMODE} -- ${BW}MHz </td>" >> ./test_simulator_results.html
+            echo "      </tr>" >> ./test_simulator_results.html
+            ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_enb_fembms.log
+            UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
+            if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
+            then
+                NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
+                NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
+                echo "      <tr>" >> ./test_simulator_results.html
+                echo "        <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
+                echo "        <td>N/A</td>" >> ./test_simulator_results.html
+                #NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
+                NB_ENB_TUNNEL_UP=`egrep -c "Interface oaitun_enb1 successfully configured" $ENB_LOG`
+                NB_ENB_MTUNNEL_UP=`egrep -c "Interface oaitun_enm1 successfully configured" $ENB_LOG`
+                #NB_UE_GOT_SYNC=`egrep -c "rfsimulator: Success" $UE_LOG`
+                #NB_ENB_SYNCED_WITH_UE=`egrep -c "Generating RRCConnectionReconfigurationComplete" $UE_LOG`
+                NB_UE_TUNNEL_UP=`egrep -c "Interface oaitun_ue1 successfully configured" $UE_LOG`
+                NB_UE_MTUNNEL_UP=`egrep -c "Interface oaitun_uem1 successfully configured" $UE_LOG`
+                NB_UE_MBMS_PUSH_MSG=`egrep -c "TRIED TO PUSH MBMS DATA TO" $UE_LOG`
+                #if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 0 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ] && [ $NB_UE_MBMS_PUSH_MSG -gt 0 ]
+                if  [ $NB_UE_MBMS_PUSH_MSG -gt 0 ]
+                then
+                    echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
+                else
+                    echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
+                fi
+                echo "        <td><pre>" >> ./test_simulator_results.html
+                #if [ $NB_ENB_GOT_SYNC -gt 0 ]
+                #then
+                #    echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html
+                #else
+                #    echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html
+                #fi
+                if [ $NB_ENB_TUNNEL_UP -gt 0 ]
+                then
+                    echo "<font color = \"blue\">- eNB mounted oaitun_enb1 interface</font>" >> ./test_simulator_results.html
+                else
+                    echo "<font color = \"red\"><b>- eNB NEVER mounted oaitun_enb1 interface</b></font>" >> ./test_simulator_results.html
+                fi
+                if [ $NB_ENB_MTUNNEL_UP -gt 0 ]
+                then
+                    echo "<font color = \"blue\">- eNB mounted oaitun_enm1 interface</font>" >> ./test_simulator_results.html
+                else
+                    echo "<font color = \"red\"><b>- eNB NEVER mounted oaitun_enm1 interface</b></font>" >> ./test_simulator_results.html
+                fi
+                #if [ $NB_UE_GOT_SYNC -gt 0 ]
+                #then
+                #    echo "<font color = \"blue\">- LTE UE --> got sync</font>" >> ./test_simulator_results.html
+                #else
+                #    echo "<font color = \"red\"><b>- LTE UE NEVER got sync</b></font>" >> ./test_simulator_results.html
+                #fi
+                #if [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
+                #then
+                #    echo "<font color = \"blue\">- LTE UE attached to eNB</font>" >> ./test_simulator_results.html
+                #else
+                #    echo "<font color = \"red\"><b>- LTE UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
+                #fi
+                if [ $NB_UE_TUNNEL_UP -gt 0 ]
+                then
+                    echo "<font color = \"blue\">- LTE UE mounted oaitun_ue1 interface</font>" >> ./test_simulator_results.html
+                else
+                    echo "<font color = \"red\"><b>- LTE UE NEVER mounted oaitun_ue1 interface</b></font>" >> ./test_simulator_results.html
+                fi
+                if [ $NB_UE_MTUNNEL_UP -gt 0 ]
+                then
+                    echo "<font color = \"blue\">- LTE UE mounted oaitun_uem1 interface</font>" >> ./test_simulator_results.html
+                else
+                    echo "<font color = \"red\"><b>- LTE UE NEVER mounted oaitun_uem1 interface</b></font>" >> ./test_simulator_results.html
+                fi
+                if [ $NB_UE_MBMS_PUSH_MSG -gt 0 ]
+                then
+                    echo "<font color = \"blue\">- LTE UE tried to push ${NB_UE_MBMS_PUSH_MSG} MBMS DATA</font>" >> ./test_simulator_results.html
+                else
+                    echo "<font color = \"red\"><b>- LTE UE NEVER pushed MBMS DATA</b></font>" >> ./test_simulator_results.html
+                fi
+                echo "        </pre></td>" >> ./test_simulator_results.html
+                echo "      </tr>" >> ./test_simulator_results.html
+            fi
+            #PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_ping*.log 2> /dev/null`
+            #analyzePingFiles
+
+            #IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl*client*txt | grep -v mbms 2> /dev/null`
+            #analyzeIperfFiles
+
+            #IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_ul*client*txt | grep -v mbms 2> /dev/null`
+            #analyzeIperfFiles
+        done
         echo "   </table>" >> ./test_simulator_results.html
         echo "   </div>" >> ./test_simulator_results.html
 
diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh
index 0db2264c766d0a4e1bab2cb442aa77cabae44d4a..b9b9a2bafab5d722aa7dc33be32e1777dd5ec76c 100755
--- a/ci-scripts/runTestOnVM.sh
+++ b/ci-scripts/runTestOnVM.sh
@@ -2050,6 +2050,95 @@ function run_test_on_vm {
             echo "LTE RFSIM seems to FAIL"
             echo "LTE: TEST_KO" > $ARCHIVES_LOC/test_final_status.log
         fi
+
+        ####################
+        ## FeMBMS CASE noS1 ##
+        ####################
+        CONF_FILE=lte-fdd-fembms-basic-sim.conf
+        CN_CONFIG="noS1"
+        S1_NOS1_CFG=0
+        LTEBOX=0
+        TMODE="fdd"
+        FREQUENCY=2680
+        BW_CASES=(05)
+        FeMBMS_STATUS=0
+
+        for BW in ${BW_CASES[@]}
+        do
+            if [[ $BW =~ .*05.* ]]; then PRB=25; fi
+            if [[ $BW =~ .*10.* ]]; then PRB=50; fi
+            if [[ $BW =~ .*20.* ]]; then PRB=100; fi
+
+            echo "############################################################"
+            echo "${CN_CONFIG} : Starting the eNB with MSMS in ${TMODE}-${BW}MHz mode"
+            echo "############################################################"
+            CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_enb_fembms.log
+            start_rf_sim_enb $ENB_VM_CMDS "$ENB_VM_IP_ADDR" "$EPC_VM_IP_ADDR" $CURRENT_ENB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG
+
+            echo "############################################################"
+            echo "${CN_CONFIG} : Starting the UE"
+            echo "############################################################"
+            CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ue_fembms.log
+            start_rf_sim_ue $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_VM_IP_ADDR $CURRENT_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 1
+            if [ $UE_SYNC -eq 0 ]
+            then
+                echo "Problem w/ eNB and UE not syncing"
+                terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1
+                terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2
+                scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+                scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+                STATUS=-1
+                break
+            fi
+
+            echo "############################################################"
+            echo "${CN_CONFIG} : iperf DL -- UE is server and eNB is client"
+            echo "############################################################"
+            get_enb_mbms_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
+            IPERF_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl_fembms
+            get_ue_mbms_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
+            THROUGHPUT=2
+            generic_iperf $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE 1 0
+            scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+            scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+            #check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+
+            echo "############################################################"
+            echo "${CN_CONFIG} : Terminate enb/ue simulators"
+            echo "############################################################"
+            terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1
+            terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2
+            scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+            scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+            NB_UE_FeMBMS_MESSAGES=`egrep -c "TRIED TO PUSH MBMS DATA TO" $ARCHIVES_LOC/$CURRENT_UE_LOG_FILE`
+            if [ $NB_UE_FeMBMS_MESSAGES -eq 0 ]; then FeMBMS_STATUS=-1; fi
+
+        done
+
+        full_l2_sim_destroy
+
+        echo "############################################################"
+        echo "Checking run status"
+        echo "############################################################"
+
+        if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi
+        if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi
+        if [ $FeMBMS_STATUS -eq 0 ]
+        then
+            echo "LTE FeMBMS RFSIM seems OK"
+        else
+            echo "LTE FeMBMS RFSIM seems to FAIL"
+            STATUS=-1
+        fi
+        if [ $STATUS -eq 0 ]
+        then
+            echo "LTE RFSIM seems OK"
+            echo "LTE: TEST_OK" > $ARCHIVES_LOC/test_final_status.log
+        else
+            echo "LTE RFSIM seems to FAIL"
+            echo "LTE: TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+        fi
+
     fi
 
     if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]]
diff --git a/ci-scripts/sshconnection.py b/ci-scripts/sshconnection.py
index ba0f900f2940482589e3e9711c942031af88cd9a..ed0cf5379a18aa121e0a2cd373a9faf26518366e 100644
--- a/ci-scripts/sshconnection.py
+++ b/ci-scripts/sshconnection.py
@@ -101,6 +101,18 @@ class SSHConnection():
 		else:
 			sys.exit('SSH Connection Failed')
 
+
+
+
+	def cde_check_value(self, commandline, expected, timeout):
+		logging.debug(commandline)
+		self.ssh.timeout = timeout
+		self.ssh.sendline(commandline)
+		expected.append(pexpect.EOF)
+		expected.append(pexpect.TIMEOUT)
+		self.sshresponse = self.ssh.expect(expected)
+		return self.sshresponse
+
 	def command(self, commandline, expectedline, timeout):
 		logging.debug(commandline)
 		self.ssh.timeout = timeout
diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml
new file mode 100755
index 0000000000000000000000000000000000000000..e80063a120ad9e163a7ef549f296da0f677241fc
--- /dev/null
+++ b/ci-scripts/xml_class_list.yml
@@ -0,0 +1,35 @@
+  - COTS_UE_Airplane
+  - Build_PhySim
+  - Run_PhySim
+  - Build_eNB
+  - WaitEndBuild_eNB
+  - Initialize_eNB
+  - Terminate_eNB
+  - Initialize_UE
+  - Terminate_UE
+  - Attach_UE
+  - Detach_UE
+  - Build_OAI_UE
+  - Initialize_OAI_UE
+  - Terminate_OAI_UE
+  - DataDisable_UE
+  - DataEnable_UE
+  - CheckStatusUE
+  - Ping
+  - Iperf
+  - Reboot_UE
+  - Initialize_FlexranCtrl
+  - Terminate_FlexranCtrl
+  - Initialize_HSS
+  - Terminate_HSS
+  - Initialize_MME
+  - Terminate_MME
+  - Initialize_SPGW
+  - Terminate_SPGW
+  - Initialize_CatM_module
+  - Terminate_CatM_module
+  - Attach_CatM_module
+  - Detach_CatM_module
+  - Ping_CatM_module
+  - IdleSleep
+  - Perform_X2_Handover
diff --git a/ci-scripts/xml_files/enb_ocp_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_ocp_usrp210_band7_test_05mhz_tm1.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a4caa77075979939cdbe7530caa1f8a399129e57
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ocp_usrp210_band7_test_05mhz_tm1.xml
@@ -0,0 +1,147 @@
+<!--
+
+ Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The OpenAirInterface Software Alliance licenses this file to You under
+ the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.openairinterface.org/?page_id=698
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ For more information about the OpenAirInterface (OAI) Software Alliance:
+      contact@openairinterface.org
+
+-->
+<testCaseList>
+	<htmlTabRef>test-05-tm1</htmlTabRef>
+	<htmlTabName>Test-05MHz-TM1</htmlTabName>
+	<htmlTabIcon>tasks</htmlTabIcon>
+	<repeatCount>4</repeatCount>
+	<TestCaseRequestedList>
+ 030201
+ 040101
+ 030101 040301 040501 040603 040604 040605 040606 040607 040641 040642 040643 040644 040401 040201 030201
+	</TestCaseRequestedList>
+	<TestCaseExclusionList></TestCaseExclusionList>
+
+	<testCase id="030101">
+		<class>Initialize_eNB</class>
+		<desc>Initialize OCP-eNB (FDD/Band7/5MHz)</desc>
+		<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf</Initialize_eNB_args>
+		<air_interface>ocp</air_interface>
+	</testCase>
+
+	<testCase id="030201">
+		<class>Terminate_eNB</class>
+		<desc>Terminate OCP-eNB</desc>
+		<air_interface>ocp</air_interface>
+	</testCase>
+
+	<testCase id="040101">
+		<class>Initialize_UE</class>
+		<desc>Initialize UE</desc>
+	</testCase>
+
+	<testCase id="040201">
+		<class>Terminate_UE</class>
+		<desc>Terminate UE</desc>
+	</testCase>
+
+	<testCase id="040301">
+		<class>Attach_UE</class>
+		<desc>Attach UE</desc>
+	</testCase>
+
+	<testCase id="040401">
+		<class>Detach_UE</class>
+		<desc>Detach UE</desc>
+	</testCase>
+
+	<testCase id="040501">
+		<class>Ping</class>
+		<desc>ping (5MHz - 20 sec)</desc>
+		<ping_args>-c 20</ping_args>
+		<ping_packetloss_threshold>5</ping_packetloss_threshold>
+	</testCase>
+
+	<testCase id="040603">
+		<class>Iperf</class>
+		<desc>iperf (5MHz - DL/15Mbps/UDP)(30 sec)(balanced profile)</desc>
+		<iperf_args>-u -b 15M -t 30 -i 1</iperf_args>
+		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<iperf_profile>balanced</iperf_profile>
+	</testCase>
+
+	<testCase id="040604">
+		<class>Iperf</class>
+		<desc>iperf (5MHz - DL/15Mbps/UDP)(30 sec)(single-ue profile)</desc>
+		<iperf_args>-u -b 15M -t 30 -i 1</iperf_args>
+		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<iperf_profile>single-ue</iperf_profile>
+	</testCase>
+
+	<testCase id="040605">
+		<class>Iperf</class>
+		<desc>iperf (5MHz - DL/15Mbps/UDP)(30 sec)(unbalanced profile)</desc>
+		<iperf_args>-u -b 15M -t 30 -i 1</iperf_args>
+		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<iperf_profile>unbalanced</iperf_profile>
+	</testCase>
+
+	<testCase id="040606">
+		<class>Iperf</class>
+		<desc>iperf (5MHz - DL/TCP)(30 sec)(single-ue profile)</desc>
+		<iperf_args>-t 30 -i 1 -fm</iperf_args>
+		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<iperf_profile>single-ue</iperf_profile>
+	</testCase>
+
+	<testCase id="040607">
+		<class>Iperf</class>
+		<desc>iperf (5MHz - DL/TCP)(30 sec)(balanced profile)</desc>
+		<iperf_args>-t 30 -i 1 -fm</iperf_args>
+		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<iperf_profile>balanced</iperf_profile>
+	</testCase>
+
+	<testCase id="040641">
+		<class>Iperf</class>
+		<desc>iperf (5MHz - UL/9Mbps/UDP)(30 sec)(balanced profile)</desc>
+		<iperf_args>-u -b 9M -t 30 -i 1 -R</iperf_args>
+		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<iperf_profile>balanced</iperf_profile>
+	</testCase>
+
+	<testCase id="040642">
+		<class>Iperf</class>
+		<desc>iperf (5MHz - UL/9Mbps/UDP)(30 sec)(single-ue profile)</desc>
+		<iperf_args>-u -b 9M -t 30 -i 1 -R</iperf_args>
+		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<iperf_profile>single-ue</iperf_profile>
+	</testCase>
+
+	<testCase id="040643">
+		<class>Iperf</class>
+		<desc>iperf (5MHz - UL/TCP)(30 sec)(single-ue profile)</desc>
+		<iperf_args>-t 30 -i 1 -fm -R</iperf_args>
+		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<iperf_profile>single-ue</iperf_profile>
+	</testCase>
+
+	<testCase id="040644">
+		<class>Iperf</class>
+		<desc>iperf (5MHz - UL/TCP)(30 sec)(balanced profile)</desc>
+		<iperf_args>-t 30 -i 1 -fm -R</iperf_args>
+		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<iperf_profile>balanced</iperf_profile>
+	</testCase>
+
+</testCaseList>
diff --git a/ci-scripts/xml_files/enb_ocp_usrp210_build.xml b/ci-scripts/xml_files/enb_ocp_usrp210_build.xml
new file mode 100644
index 0000000000000000000000000000000000000000..33a0fc205e0855de99602abc4f7394e89ad98963
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ocp_usrp210_build.xml
@@ -0,0 +1,38 @@
+<!--
+
+ Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The OpenAirInterface Software Alliance licenses this file to You under
+ the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.openairinterface.org/?page_id=698
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ For more information about the OpenAirInterface (OAI) Software Alliance:
+      contact@openairinterface.org
+
+-->
+<testCaseList>
+	<htmlTabRef>build-tab</htmlTabRef>
+	<htmlTabName>Build</htmlTabName>
+	<htmlTabIcon>wrench</htmlTabIcon>
+	<TestCaseRequestedList>
+ 010101
+	</TestCaseRequestedList>
+	<TestCaseExclusionList></TestCaseExclusionList>
+
+	<testCase id="010101">
+		<class>Build_eNB</class>
+		<desc>Build eNB OCP (USRP)</desc>
+		<Build_eNB_args>-w USRP -c --eNBocp --ninja</Build_eNB_args>
+	</testCase>
+
+</testCaseList>
diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_fembms_no_s1.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_fembms_no_s1.xml
new file mode 100644
index 0000000000000000000000000000000000000000..775ef2e023257733c55b1cf5a822773caa3f808d
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_fembms_no_s1.xml
@@ -0,0 +1,82 @@
+<!--
+
+ Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The OpenAirInterface Software Alliance licenses this file to You under
+ the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.openairinterface.org/?page_id=698
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ For more information about the OpenAirInterface (OAI) Software Alliance:
+      contact@openairinterface.org
+
+-->
+<testCaseList>
+	<htmlTabRef>test-05-tm1-fembms-nos1-tunnel</htmlTabRef>
+	<htmlTabName>Test-05MHz-FEMBMS-TM1-noS1-tunnel</htmlTabName>
+	<htmlTabIcon>tasks</htmlTabIcon>
+	<repeatCount>2</repeatCount>
+	<TestCaseRequestedList>
+ 030201 090109
+ 030104 000001 090104 000002 040605 000001 090109 030201
+	</TestCaseRequestedList>
+	<TestCaseExclusionList></TestCaseExclusionList>
+
+	<testCase id="000001">
+		<class>IdleSleep</class>
+		<desc>Sleep</desc>
+		<idle_sleep_time_in_sec>10</idle_sleep_time_in_sec>
+	</testCase>
+
+	<testCase id="000002">
+		<class>IdleSleep</class>
+		<desc>Sleep</desc>
+		<idle_sleep_time_in_sec>15</idle_sleep_time_in_sec>
+	</testCase>
+
+	<testCase id="000003">
+		<class>IdleSleep</class>
+		<desc>Sleep</desc>
+		<idle_sleep_time_in_sec>60</idle_sleep_time_in_sec>
+	</testCase>
+
+	<testCase id="030104">
+		<class>Initialize_eNB</class>
+		<desc>Initialize eNB (FDD/Band7/5MHz/MBMS)</desc>
+		<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf --noS1 --eNBs.[0].rrc_inactivity_threshold 0 --nokrnmod 1 --eNBs.[0].component_carriers.[0].eutra_band 7 --eNBs.[0].component_carriers.[0].downlink_frequency 2680000000 --eNBs.[0].component_carriers.[0].uplink_frequency_offset -120000000 --eNBs.[0].component_carriers.[0].mbms_dedicated_serving_cell ENABLE --MCEs.[0].mbms_sched_info.mbms_area_config_list.[0].pmch_config_list.[0].allocated_sf_end 512</Initialize_eNB_args>
+	</testCase>
+
+	<testCase id="030201">
+		<class>Terminate_eNB</class>
+		<desc>Terminate eNB</desc>
+	</testCase>
+
+	<testCase id="090104">
+		<class>Initialize_OAI_UE</class>
+		<desc>Initialize OAI UE (FDD/Band7/5MHz/MBMS)</desc>
+		<Initialize_OAI_UE_args>-C 2680000000 -r 25 --ue-rxgain 120 --ue-txgain 0 --ue-max-power 0 --ue-scan-carrier --nokrnmod 1 --noS1</Initialize_OAI_UE_args>
+	</testCase>
+
+	<testCase id="090109">
+		<class>Terminate_OAI_UE</class>
+		<desc>Terminate OAI UE</desc>
+	</testCase>
+
+	<testCase id="040605">
+		<class>Iperf</class>
+		<desc>iperf (5MHz - DL/1.5Mbps/UDP/MBMS-sink)(20 sec)</desc>
+		<iperf_args>-c 10.0.2.2 -u -b 1.5M -t 20 -i 1 -fm -B 10.0.2.1</iperf_args>
+		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<iperf_options>sink</iperf_options>
+	</testCase>
+
+</testCaseList>
diff --git a/ci-scripts/xml_files/fr1_multi_node_build.xml b/ci-scripts/xml_files/fr1_multi_node_build.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7b4eacef3a3d091e7397bfc89a7f8422c459998c
--- /dev/null
+++ b/ci-scripts/xml_files/fr1_multi_node_build.xml
@@ -0,0 +1,66 @@
+<!--
+
+ Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The OpenAirInterface Software Alliance licenses this file to You under
+ the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.openairinterface.org/?page_id=698
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ For more information about the OpenAirInterface (OAI) Software Alliance:
+      contact@openairinterface.org
+
+-->
+<testCaseList>
+	<htmlTabRef>build-tab</htmlTabRef>
+	<htmlTabName>Build</htmlTabName>
+	<htmlTabIcon>wrench</htmlTabIcon>
+	<TestCaseRequestedList>
+ 000001 000002
+ 000003 000004
+	</TestCaseRequestedList>
+	<TestCaseExclusionList></TestCaseExclusionList>
+
+	<testCase id="000001">
+		<class>Build_eNB</class>
+		<desc>Build eNB</desc>
+		<Build_eNB_args>-w USRP -c --eNB --ninja</Build_eNB_args>
+		<eNB_instance>0</eNB_instance>
+		<eNB_serverId>0</eNB_serverId>
+		<backgroundBuild>True</backgroundBuild>
+	</testCase>
+
+	<testCase id="000004">
+		<class>WaitEndBuild_eNB</class>
+		<desc>Wait for end of Build eNB</desc>
+		<eNB_instance>0</eNB_instance>
+		<eNB_serverId>0</eNB_serverId>
+	</testCase>
+
+	<testCase id="000002">
+		<class>Build_eNB</class>
+		<desc>Build gNB</desc>
+		<Build_eNB_args>-w USRP -c --gNB --ninja</Build_eNB_args>
+		<eNB_instance>1</eNB_instance>
+		<eNB_serverId>1</eNB_serverId>
+		<backgroundBuild>True</backgroundBuild>
+	</testCase>
+
+	<testCase id="000003">
+		<class>WaitEndBuild_eNB</class>
+		<desc>Wait for end of Build gNB</desc>
+		<eNB_instance>1</eNB_instance>
+		<eNB_serverId>1</eNB_serverId>
+	</testCase>
+
+
+</testCaseList>
diff --git a/ci-scripts/xml_files/fr1_multi_node_terminate.xml b/ci-scripts/xml_files/fr1_multi_node_terminate.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cbaaf8ba9975a8e464424e0ff258e64a5b3aabac
--- /dev/null
+++ b/ci-scripts/xml_files/fr1_multi_node_terminate.xml
@@ -0,0 +1,50 @@
+<!--
+
+ Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The OpenAirInterface Software Alliance licenses this file to You under
+ the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.openairinterface.org/?page_id=698
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ For more information about the OpenAirInterface (OAI) Software Alliance:
+      contact@openairinterface.org
+
+-->
+<testCaseList>
+	<htmlTabRef>test-fr1-tm1</htmlTabRef>
+	<htmlTabName>Test-FR1-TM1</htmlTabName>
+	<htmlTabIcon>tasks</htmlTabIcon>
+	<repeatCount>1</repeatCount>
+	<TestCaseRequestedList>
+ 070001
+ 070000
+	</TestCaseRequestedList>
+	<TestCaseExclusionList>
+	</TestCaseExclusionList>
+
+	<testCase id="070000">
+		<class>Terminate_eNB</class>
+		<desc>Terminate eNB</desc>
+		<eNB_instance>0</eNB_instance>
+		<eNB_serverId>0</eNB_serverId>
+	</testCase>
+
+	<testCase id="070001">
+		<class>Terminate_eNB</class>
+		<desc>Terminate gNB</desc>
+		<eNB_instance>1</eNB_instance>
+		<eNB_serverId>1</eNB_serverId>
+	</testCase>
+
+</testCaseList>
+
diff --git a/ci-scripts/xml_files/fr1_multi_node_test.xml b/ci-scripts/xml_files/fr1_multi_node_test.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8c56f0bcec9354394dc622d86675e30ff1281dff
--- /dev/null
+++ b/ci-scripts/xml_files/fr1_multi_node_test.xml
@@ -0,0 +1,77 @@
+<!--
+
+ Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The OpenAirInterface Software Alliance licenses this file to You under
+ the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.openairinterface.org/?page_id=698
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ For more information about the OpenAirInterface (OAI) Software Alliance:
+      contact@openairinterface.org
+
+-->
+<testCaseList>
+	<htmlTabRef>test-fr1-tm1</htmlTabRef>
+	<htmlTabName>Test-FR1-TM1</htmlTabName>
+	<htmlTabIcon>tasks</htmlTabIcon>
+	<repeatCount>1</repeatCount>
+	<TestCaseRequestedList>
+ 030000
+ 040000
+ 000001
+ 070001
+ 070000
+	</TestCaseRequestedList>
+	<TestCaseExclusionList>
+	</TestCaseExclusionList>
+
+	<testCase id="030000">
+		<class>Initialize_eNB</class>
+		<desc>Initialize eNB</desc>
+		<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf</Initialize_eNB_args>
+		<eNB_instance>0</eNB_instance>
+		<eNB_serverId>0</eNB_serverId>
+		<air_interface>lte</air_interface>
+	</testCase>
+
+	<testCase id="040000">
+		<class>Initialize_eNB</class>
+		<desc>Initialize gNB (3/4 sampling rate)</desc>
+		<Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E</Initialize_eNB_args>
+		<eNB_instance>1</eNB_instance>
+		<eNB_serverId>1</eNB_serverId>
+		<air_interface>nr</air_interface>
+	</testCase>
+
+	<testCase id="000001">
+		<class>IdleSleep</class>
+		<desc>Sleep</desc>
+		<idle_sleep_time_in_sec>30</idle_sleep_time_in_sec>
+	</testCase>
+
+	<testCase id="070000">
+		<class>Terminate_eNB</class>
+		<desc>Terminate eNB</desc>
+		<eNB_instance>0</eNB_instance>
+		<eNB_serverId>0</eNB_serverId>
+	</testCase>
+
+	<testCase id="070001">
+		<class>Terminate_eNB</class>
+		<desc>Terminate gNB</desc>
+		<eNB_instance>1</eNB_instance>
+		<eNB_serverId>1</eNB_serverId>
+	</testCase>
+
+</testCaseList>
+
diff --git a/ci-scripts/xml_files/fr1_toggle_cots_ue.xml b/ci-scripts/xml_files/fr1_toggle_cots_ue.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b2267efc77dcc514bcf07eda0c2223be3ed5b46a
--- /dev/null
+++ b/ci-scripts/xml_files/fr1_toggle_cots_ue.xml
@@ -0,0 +1,39 @@
+<!--
+
+ Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The OpenAirInterface Software Alliance licenses this file to You under
+ the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.openairinterface.org/?page_id=698
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ For more information about the OpenAirInterface (OAI) Software Alliance:
+      contact@openairinterface.org
+
+-->
+<testCaseList>
+	<htmlTabRef>test-airplane-mode</htmlTabRef>
+	<htmlTabName>AirplaneToggle</htmlTabName>
+	<htmlTabIcon>tasks</htmlTabIcon>
+	<TestCaseRequestedList>
+ 010000
+	</TestCaseRequestedList>
+	<TestCaseExclusionList></TestCaseExclusionList>
+
+	<testCase id="010000">
+		<class>COTS_UE_Airplane</class>
+		<desc>Toggle COTS Airplane mode ON</desc>
+		<cots_ue_airplane_args>ON</cots_ue_airplane_args>
+	</testCase>
+
+
+</testCaseList>
diff --git a/ci-scripts/xml_files/gnb_usrp_build.xml b/ci-scripts/xml_files/gnb_usrp_build.xml
index 97d6ef06f6221875c6b25809d19af7fddb345bf6..e2662180c5b8fee0c2974e703328a30673eb5193 100644
--- a/ci-scripts/xml_files/gnb_usrp_build.xml
+++ b/ci-scripts/xml_files/gnb_usrp_build.xml
@@ -34,7 +34,7 @@
 		<mode>TesteNB</mode>	
 		<class>Build_eNB</class>
 		<desc>Build gNB (USRP)</desc>
-		<Build_eNB_args>--gNB -w USRP</Build_eNB_args>
+		<Build_eNB_args>--gNB -w USRP --ninja</Build_eNB_args>
 		<forced_workspace_cleanup>True</forced_workspace_cleanup>
 	</testCase>
 
diff --git a/ci-scripts/xml_files/nr_ue_usrp_build.xml b/ci-scripts/xml_files/nr_ue_usrp_build.xml
index c3c842b85a9bb2974890cd9757de8ecb3a1172a4..bc04efdb4b8cd50ffd7905196f2f14b941db14ab 100644
--- a/ci-scripts/xml_files/nr_ue_usrp_build.xml
+++ b/ci-scripts/xml_files/nr_ue_usrp_build.xml
@@ -34,7 +34,7 @@
 		<mode>TestUE</mode>
 		<class>Build_OAI_UE</class>
 		<desc>Build NR UE (USRP)</desc>
-		<Build_OAI_UE_args>--nrUE -w USRP</Build_OAI_UE_args>
+		<Build_OAI_UE_args>--nrUE -w USRP --ninja</Build_OAI_UE_args>
 		<clean_repository>false</clean_repository>
 	</testCase>
 
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 8ff3663eab50ad1d399951df14589f6c2962519f..a1e9cebc89889a015cdfe9676ea9383f5fa5af4a 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -27,6 +27,10 @@ cmake_minimum_required (VERSION 3.0)
 # Base directories, compatible with legacy OAI building #
 #########################################################
 set (OPENAIR_DIR     $ENV{OPENAIR_DIR})
+if("${OPENAIR_DIR}" STREQUAL "")
+  string(REGEX REPLACE "/cmake_targets.*$" "" OPENAIR_DIR ${CMAKE_CURRENT_BINARY_DIR})
+endif()
+
 set (NFAPI_DIR       ${OPENAIR_DIR}/nfapi/open-nFAPI)
 set (NFAPI_USER_DIR  ${OPENAIR_DIR}/nfapi/oai_integration)
 set (OPENAIR1_DIR    ${OPENAIR_DIR}/openair1)
@@ -1252,7 +1256,7 @@ set(SCHED_SRC_NR_UE
   ${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_ue.c
   ${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c
   ${OPENAIR1_DIR}/SCHED_NR_UE/fapi_nr_ue_l1.c 
-  ${OPENAIR1_DIR}/SCHED_NR/phy_frame_config_nr.c
+  ${OPENAIR1_DIR}/SCHED_NR_UE/phy_frame_config_nr_ue.c
   ${OPENAIR1_DIR}/SCHED_NR_UE/harq_nr.c
   ${OPENAIR1_DIR}/SCHED_NR_UE/pucch_uci_ue_nr.c
   ${OPENAIR1_DIR}/SCHED_NR_UE/pucch_power_control_ue_nr.c 
@@ -1543,6 +1547,7 @@ set(PHY_SRC_UE
   ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c
   ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c
   ${OPENAIR1_DIR}/PHY/NR_REFSIG/scrambling_luts.c
+  ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gen_mod_table.c
   ${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c
   ${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c
   ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
@@ -1595,6 +1600,7 @@ set(PHY_SRC_UE
   ${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c
   ${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c
   ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold_ue.c
+  ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gen_mod_table.c
   ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
   ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
   ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
@@ -2475,8 +2481,8 @@ add_library(uescope MODULE ${XFORMS_SOURCE} ${XFORMS_SOURCE_SOFTMODEM} ${XFORMS_
 target_link_libraries(enbscope ${XFORMS_LIBRARIES})
 target_link_libraries(uescope ${XFORMS_LIBRARIES})
 
-add_library(gnbscope MODULE ${XFORMS_SOURCE_NR})
-target_link_libraries(gnbscope ${XFORMS_LIBRARIES})
+add_library(nrscope MODULE ${XFORMS_SOURCE_NR})
+target_link_libraries(nrscope ${XFORMS_LIBRARIES})
 
 
 add_library(rfsimulator MODULE 
@@ -2625,7 +2631,7 @@ add_executable(ocp-enb
   ${CONFIG_SOURCES}
   ${SHLIB_LOADER_SOURCES}
   )
-add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer)
+add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_libconfig rfsimulator)
 
 target_link_libraries (ocp-enb
   -Wl,--start-group
@@ -2732,7 +2738,7 @@ add_executable(nr-softmodem
   ${OPENAIR_DIR}/common/utils/system.c
   ${OPENAIR_DIR}/common/utils/nr/nr_common.c
   ${GTPU_need_ITTI}
-  ${XFORMS_SOURCE_NR}
+  ${XFORMSINTERFACE_SOURCE}
   ${T_SOURCE}
   ${CONFIG_SOURCES}
   ${SHLIB_LOADER_SOURCES}
@@ -2774,7 +2780,7 @@ add_executable(nr-uesoftmodem
   ${OPENAIR_DIR}/common/utils/utils.c
   ${OPENAIR_DIR}/common/utils/system.c
   ${OPENAIR_DIR}/common/utils/nr/nr_common.c
-  ${XFORMS_SOURCE_NR}
+  ${XFORMSINTERFACE_SOURCE}
   ${T_SOURCE}
   ${UTIL_SRC}
   ${CONFIG_SOURCES}
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 89f945a6949a3b22f226886da294a7ffa903e2e5..f301908495e1e1f6e74b5dd0743ba26d7de990b7 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -67,7 +67,7 @@ UE_TIMING_TRACE="False"
 USRP_REC_PLAY="False"
 BUILD_ECLIPSE=0
 NR="False"
-OPTIONAL_LIBRARIES="telnetsrv enbscope uescope msc"
+OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc"
 trap handle_ctrl_c INT
 
 function print_help() {
@@ -96,7 +96,9 @@ Options
    enable cmake debugging messages
 --eNB
   Makes the LTE softmodem
---gNB
+--eNBocp
+  Makes the OCP LTE softmodem
+-gNB
   Makes the NR softmodem
 --nrUE
   Makes the NR UE softmodem
@@ -237,7 +239,11 @@ function main() {
             eNB=1
             echo_info "Will compile eNB"
             shift;;
-       --gNB)
+       --eNBocp)
+            eNBocp=1
+            echo_info "Will compile OCP eNB"
+            shift;;
+      --gNB)
             gNB=1
             NR="True"
             echo_info "Will compile gNB"
@@ -443,7 +449,7 @@ function main() {
   ########################################################
   # to be discussed
   
-  if [ "$eNB" = "1" -o "$gNB" = "1" ] ; then
+  if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$gNB" = "1" ] ; then
       if [ "$HW" = "None" -a  "$TP" = "None" ] ; then
 	      echo_info "No local radio head and no transport protocol selected"
       fi
@@ -574,12 +580,13 @@ function main() {
   config_libconfig_shlib=params_libconfig
   
   # first generate the CMakefile in the right directory
-  if [ "$eNB" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" ] ; then
+  if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" ] ; then
 
     # softmodem compilation
 
     cmake_file=$DIR/$build_dir/CMakeLists.txt
     echo "cmake_minimum_required(VERSION 2.8)"                             >  $cmake_file
+    echo "project (OpenAirInterface)"                                    >> $cmake_file
     echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )"                     >> $cmake_file
     echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )"       >> $cmake_file
     echo "set ( UE_EXPANSION $UE_EXPANSION )"                             >> $cmake_file
@@ -606,6 +613,9 @@ function main() {
     if [ "$eNB" = "1" ] ; then
       execlist="$execlist lte-softmodem"
     fi
+    if [ "$eNBocp" = "1" ] ; then
+      execlist="$execlist ocp-enb"
+    fi
     if [ "$gNB" = "1" ] ; then
       execlist="$execlist nr-softmodem"
     fi
@@ -821,7 +831,7 @@ function main() {
   ####################################################
   # Build RF device and transport protocol libraries #
   ####################################################
-  if [ "$eNB" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
+  if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
 
       # build RF device libraries
       if [ "$HW" != "None" ] ; then
diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp
index 22933fdd5be749b45f207f68272d9f8958be5cb2..1680410ebb5294041eab45b1191922dda0feecc7 100644
--- a/common/utils/ocp_itti/intertask_interface.cpp
+++ b/common/utils/ocp_itti/intertask_interface.cpp
@@ -80,7 +80,7 @@ task_list_t tasks[TASK_MAX];
 
   void *itti_malloc(task_id_t origin_task_id, task_id_t destination_task_id, ssize_t size) {
     void *ptr = NULL;
-    AssertFatal ((ptr=malloc (size)) != NULL, "Memory allocation of %zu bytes failed (%d -> %d)!\n",
+    AssertFatal ((ptr=calloc (size, 1)) != NULL, "Memory allocation of %zu bytes failed (%d -> %d)!\n",
                  size, origin_task_id, destination_task_id);
     return ptr;
   }
diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c
index 06a5d350c75a452ef18e325813de53453912d66d..03f7af99bc2ca9cc8d81c7f834f7ad8dd2a2c7ce 100644
--- a/common/utils/telnetsrv/telnetsrv.c
+++ b/common/utils/telnetsrv/telnetsrv.c
@@ -53,6 +53,7 @@
 #include <sys/resource.h>
 #include "common/utils/load_module_shlib.h"
 #include "common/config/config_userapi.h"
+#include "common/utils/threadPool/thread-pool.h"
 #include "executables/softmodem-common.h"
 #include <readline/history.h>
 
@@ -507,12 +508,22 @@ int process_command(char *buf) {
         }
 
         rt= CMDSTATUS_FOUND;
-      } else if (strncasecmp(cmd,"get",3) == 0 || strncasecmp(cmd,"set",3) == 0) {
+      } else if (strcasecmp(cmd,"get") == 0 || strcasecmp(cmd,"set") == 0) {
         rt= setgetvar(i,cmd[0],cmdb);
       } else {
         for (k=0 ; telnetparams.CmdParsers[i].cmd[k].cmdfunc != NULL ; k++) {
           if (strncasecmp(cmd, telnetparams.CmdParsers[i].cmd[k].cmdname,sizeof(telnetparams.CmdParsers[i].cmd[k].cmdname)) == 0) {
-            telnetparams.CmdParsers[i].cmd[k].cmdfunc(cmdb, telnetparams.telnetdbg, client_printf);
+          	if (telnetparams.CmdParsers[i].cmd[k].qptr != NULL) {
+          		notifiedFIFO_elt_t *msg =newNotifiedFIFO_elt(sizeof(telnetsrv_qmsg_t),0,NULL,NULL);
+          		telnetsrv_qmsg_t *cmddata=NotifiedFifoData(msg);
+          		cmddata->cmdfunc=(qcmdfunc_t)telnetparams.CmdParsers[i].cmd[k].cmdfunc;
+          	    cmddata->prnt=client_printf;
+          	    cmddata->debug=telnetparams.telnetdbg;
+          		cmddata->cmdbuff=strdup(cmdb);
+          		pushNotifiedFIFO(telnetparams.CmdParsers[i].cmd[k].qptr, msg);
+          	} else {
+              telnetparams.CmdParsers[i].cmd[k].cmdfunc(cmdb, telnetparams.telnetdbg, client_printf);
+            }
             rt= CMDSTATUS_FOUND;
           }
         } /* for k */
@@ -673,6 +684,16 @@ void run_telnetsrv(void) {
   return;
 }
 
+void poll_telnetcmdq(void *qid, void *arg) {
+	notifiedFIFO_elt_t *msg = pollNotifiedFIFO((notifiedFIFO_t *)qid);
+	
+	if (msg != NULL) {
+	  telnetsrv_qmsg_t *msgdata=NotifiedFifoData(msg);
+	  msgdata->cmdfunc(msgdata->cmdbuff,msgdata->debug,msgdata->prnt,arg);
+	  free(msgdata->cmdbuff);
+	  delNotifiedFIFO_elt(msg);
+	}
+}
 /*------------------------------------------------------------------------------------------------*/
 /* load the commands delivered with the telnet server
  *
@@ -758,6 +779,7 @@ int telnetsrv_autoinit(void) {
 */
 int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd) {
   int i;
+  notifiedFIFO_t *afifo=NULL;
 
   if( modulename == NULL || var == NULL || cmd == NULL) {
     fprintf(stderr,"[TELNETSRV] Telnet server, add_telnetcmd: invalid parameters\n");
@@ -769,6 +791,13 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde
       strncpy(telnetparams.CmdParsers[i].module,modulename,sizeof(telnetparams.CmdParsers[i].module)-1);
       telnetparams.CmdParsers[i].cmd = cmd;
       telnetparams.CmdParsers[i].var = var;
+      if (cmd->cmdflags & TELNETSRV_CMDFLAG_PUSHINTPOOLQ) {
+      	  if (afifo == NULL) {
+      	  	  afifo = malloc(sizeof(notifiedFIFO_t));
+      	  	  initNotifiedFIFO(afifo);
+      	  }
+      	  cmd->qptr = afifo;
+      }
       printf("[TELNETSRV] Telnet server: module %i = %s added to shell\n",
              i,telnetparams.CmdParsers[i].module);
       break;
@@ -797,8 +826,10 @@ int  telnetsrv_checkbuildver(char *mainexec_buildversion, char **shlib_buildvers
 }
 
 int telnetsrv_getfarray(loader_shlibfunc_t  **farray) {
-  *farray=malloc(sizeof(loader_shlibfunc_t));
+  *farray=malloc(sizeof(loader_shlibfunc_t)*2);
   (*farray)[0].fname=TELNET_ADDCMD_FNAME;
   (*farray)[0].fptr=(int (*)(void) )add_telnetcmd;
-  return 1;
+  (*farray)[1].fname=TELNET_POLLCMDQ_FNAME;
+  (*farray)[1].fptr=(int (*)(void) )poll_telnetcmdq; 
+  return ( 2);
 }
diff --git a/common/utils/telnetsrv/telnetsrv.h b/common/utils/telnetsrv/telnetsrv.h
index debb9f02ec962c63e798273bb19c481eff38f5c7..b66641d5c8b9588b8699c93b31326b5a418f5252 100644
--- a/common/utils/telnetsrv/telnetsrv.h
+++ b/common/utils/telnetsrv/telnetsrv.h
@@ -53,13 +53,26 @@
 /* to add a set of new command to the telnet server shell */
 typedef void(*telnet_printfunc_t)(const char* format, ...);
 typedef int(*cmdfunc_t)(char*, int, telnet_printfunc_t prnt);
+typedef int(*qcmdfunc_t)(char*, int, telnet_printfunc_t prnt,void *arg);
 
+#define TELNETSRV_CMDFLAG_PUSHINTPOOLQ   (1<<0)    // ask the telnet server to push the command in a thread pool queue
 typedef struct cmddef {
     char cmdname[TELNET_CMD_MAXSIZE];
     char helpstr[TELNET_HELPSTR_SIZE];
     cmdfunc_t cmdfunc; 
+    unsigned int cmdflags;
+    void *qptr;
 } telnetshell_cmddef_t;
 
+/*----------------------------------------------------------------------------*/
+/* structure used to send a command via a message queue to enable */
+/* executing a command in a thread different from the telnet server thread */
+typedef struct telnetsrv_qmsg {
+  qcmdfunc_t cmdfunc;
+  telnet_printfunc_t prnt;
+  int debug;
+  char *cmdbuff;
+} telnetsrv_qmsg_t;
 /*----------------------------------------------------------------------------*/
 /*structure to be used when adding a module to the telnet server */
 /* This is the first parameter of the add_telnetcmd function, which can be used   */
@@ -111,9 +124,6 @@ typedef struct {
 } telnetsrv_params_t;
 
 
-
-typedef int(*addcmdfunc_t)(char*, telnetshell_vardef_t*, telnetshell_cmddef_t*);
-
 typedef void(*settelnetmodule_t)(char *name, void *ptr); 
 
 /*-------------------------------------------------------------------------------------------*/
@@ -133,7 +143,9 @@ VT escape sequence definition, for smarter display....
 
 /*---------------------------------------------------------------------------------------------*/
 #define TELNET_ADDCMD_FNAME "add_telnetcmd"
+#define TELNET_POLLCMDQ_FNAME "poll_telnetcmdq"
 typedef int(*add_telnetcmd_func_t)(char *, telnetshell_vardef_t *, telnetshell_cmddef_t *);
+typedef void(*poll_telnetcmdq_func_t)(void *qid,void *arg);
 #ifdef TELNETSERVERCODE
 int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd);
 void set_sched(pthread_t tid, int pid,int priority);
diff --git a/common/utils/threadPool/thread-pool.c b/common/utils/threadPool/thread-pool.c
index cbb2dbe3d91742afc2375ff3fd48f90b20c48404..e1446f15d71a70d374851ba9cfa5f4707590c58b 100644
--- a/common/utils/threadPool/thread-pool.c
+++ b/common/utils/threadPool/thread-pool.c
@@ -111,9 +111,10 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
   pool->activated=true;
   initNotifiedFIFO(&pool->incomingFifo);
   char *saveptr, * curptr;
+  char *parms_cpy=strdup(params);
   pool->nbThreads=0;
   pool->restrictRNTI=false;
-  curptr=strtok_r(params,",",&saveptr);
+  curptr=strtok_r(parms_cpy,",",&saveptr);
   struct one_thread * ptr;
   while ( curptr!=NULL ) {
     int c=toupper(curptr[0]);
@@ -145,7 +146,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
 
     curptr=strtok_r(NULL,",",&saveptr);
   }
-
+  free(parms_cpy);
   if (pool->activated && pool->nbThreads==0) {
     printf("No servers created in the thread pool, exit\n");
     exit(1);
diff --git a/doc/TESTING_GNB_W_COTS_UE.md b/doc/TESTING_GNB_W_COTS_UE.md
index e507050239767f9d1b602486b8214d5dcc676b20..a16b4dbe136034d7f7cc4ae33555016a4b448e0a 100644
--- a/doc/TESTING_GNB_W_COTS_UE.md
+++ b/doc/TESTING_GNB_W_COTS_UE.md
@@ -1,4 +1,5 @@
-STATUS 2020/06/26 : information is up to date, but under continuous improvement
+STATUS 2020/07/30 : under continuous improvement ; updated the configuration files links with CI approved reference files
+
 
 ## Table of Contents ##
 
@@ -78,16 +79,16 @@ https://github.com/OPENAIRINTERFACE/openair-epc-fed/blob/master-documentation/do
 Each component (EPC, eNB, gNB) has its own configuration file.  
 These config files are passed as arguments of the run command line, using the option -O \<conf file\>
 
-Some config examples can be found in the following folder:  
-https://gitlab.eurecom.fr/oai/openairinterface5g/-/tree/develop/targets/PROJECTS/GENERIC-LTE-EPC/CONF
+The **REFERENCE** files for eNB and gNB, **used by the CI**, can be found here:  
+[enb conf file](../ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf)
+[gnb conf file](../ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf)
 
-Also base config files can be found here:  
-[enb conf file](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/rh_doc_update_3/doc/testing_gnb_w_cots_ue_resources/enb.conf)  
-[gnb conf file](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/rh_doc_update_3/doc/testing_gnb_w_cots_ue_resources/gnb.conf)
+These files have to be updated manually to set the IP addresses and frequency.  
 
-TO DO : attach base confif files
 
-These files have to be updated manually to set the IP addresses and frequency.  
+**ATTENTION** : an **EXTERNAL** clock is used to sync the eNB and gNB,  
+whether the clock is internal or external is defined in the configuration files (!! details needed !!)   
+
 
 1- In the **eNB configuration file** :
 - look for MME IP address, and update the **ipv4 field** with the IP address of the **EPC** server
@@ -128,7 +129,7 @@ These files have to be updated manually to set the IP addresses and frequency.
                             }
                           );
 ```
-- look for X2 IP address, and update the **4 fields** with the IP address of the **eNB** server (notice : even if -in principle- S1 MME is not required for gNB setting)
+- look for X2 IP address, and update the **4 fields** with the IP address of the **eNB** server / **gNB** server as below  (notice : even if -in principle- S1 MME is not required for gNB setting)
 ```
 
     ///X2
@@ -146,11 +147,11 @@ These files have to be updated manually to set the IP addresses and frequency.
     {
 
         GNB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
-        GNB_IPV4_ADDRESS_FOR_S1_MME              = "**YOUR_ENB_IP_ADDR**";
+        GNB_IPV4_ADDRESS_FOR_S1_MME              = "**YOUR_GNB_IP_ADDR**";
         GNB_INTERFACE_NAME_FOR_S1U               = "eth0";
-        GNB_IPV4_ADDRESS_FOR_S1U                 = "**YOUR_ENB_IP_ADDR**";
+        GNB_IPV4_ADDRESS_FOR_S1U                 = "**YOUR_GNB_IP_ADDR**";
         GNB_PORT_FOR_S1U                         = 2152; # Spec 2152
-        GNB_IPV4_ADDRESS_FOR_X2C                 = "**YOUR_ENB_IP_ADDR**";
+        GNB_IPV4_ADDRESS_FOR_X2C                 = "**YOUR_GNB_IP_ADDR**";
         GNB_PORT_FOR_X2C                         = 36422; # Spec 36422
     };
 
@@ -215,26 +216,20 @@ Execute:
 
 ```
 
-For example:
-```
-~/openairinterface5g/cmake_targets/ran_build/build$ sudo ./lte-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf | tee mylogfile.log
-```
-
-
 
 - **gNB** (on the gNB host)
 
 
 Execute: 
 ```
-~/openairinterface5g/cmake_targets/ran_build/build$ sudo ./nr-softmodem -O **YOUR_GNB_CONF_FILE** | tee **YOUR_LOG_FILE**
+~/openairinterface5g/cmake_targets/ran_build/build$ sudo ./nr-softmodem -O **YOUR_GNB_CONF_FILE** -E | tee **YOUR_LOG_FILE**
 
 ```
 
-For example:
-```
-~/openairinterface5g/cmake_targets/ran_build/build$ sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf | tee mylogfile.log
-```
+**ATTENTION** : for the gNB execution,    
+The -E option is required to enable the tri-quarter sampling rate when using a B2xx serie USRP  
+The -E opton is not needed when using a a N300 USRP  
+
 
 
 ## Test Case
diff --git a/executables/main-fs6.c b/executables/main-fs6.c
index ffa44bd978758cc13923499970ff8743e938543f..c4a0d85b347f17d8754f262adf39f1f4359961e2 100644
--- a/executables/main-fs6.c
+++ b/executables/main-fs6.c
@@ -401,7 +401,7 @@ void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_
   hULUE(newUDPheader)->O_ACK=eNB->ulsch[UE_id]->harq_processes[harq_pid]->O_ACK;
   memcpy(hULUE(newUDPheader)->o_ACK, eNB->ulsch[UE_id]->harq_processes[harq_pid]->o_ACK,
          sizeof(eNB->ulsch[UE_id]->harq_processes[harq_pid]->o_ACK));
-  hULUE(newUDPheader)->ta=lte_est_timing_advance_pusch(eNB, UE_id);
+  hULUE(newUDPheader)->ta=lte_est_timing_advance_pusch(&eNB->frame_parms, eNB->pusch_vars[UE_id]->drs_ch_estimates_time);
   hULUE(newUDPheader)->segment=segmentID;
   memcpy(hULUE(newUDPheader)->o, eNB->ulsch[UE_id]->harq_processes[harq_pid]->o,
          sizeof(eNB->ulsch[UE_id]->harq_processes[harq_pid]->o));
@@ -917,7 +917,7 @@ void phy_procedures_eNB_TX_fromsplit(uint8_t *bufferZone, int nbBlocks, PHY_VARS
 
   if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) {
     if (is_pmch_subframe(frame,subframe,fp)) {
-      pmch_procedures(eNB,proc);
+      pmch_procedures(eNB,proc,0);
     } else {
       // this is not a pmch subframe, so generate PSS/SSS/PBCH
       common_signal_procedures(eNB,frame, subframe);
diff --git a/executables/main-ocp.c b/executables/main-ocp.c
index e4e42b4f23b069c053be31d02d5c4d6f289534e9..cd221b155a29fe904cbfe35d7f21872cd6756c91 100644
--- a/executables/main-ocp.c
+++ b/executables/main-ocp.c
@@ -1123,9 +1123,6 @@ int restart_L1L2(module_id_t enb_id) {
   sync_var = -1;
   pthread_mutex_unlock(&sync_mutex);
   RC.ru_mask |= (1 << ru->idx);
-  /* copy the changed frame parameters to the RU */
-  /* TODO this should be done for all RUs associated to this eNB */
-  memcpy(&ru->frame_parms, &RC.eNB[enb_id][0]->frame_parms, sizeof(LTE_DL_FRAME_PARMS));
   /* reset the list of connected UEs in the MAC, since in this process with
    * loose all UEs (have to reconnect) */
   init_UE_info(&RC.mac[enb_id]->UE_info);
@@ -1167,6 +1164,7 @@ int main ( int argc, char **argv ) {
   T_Config_Init();
 #endif
   configure_linux();
+  set_softmodem_sighandler();
   cpuf=get_cpu_freq_GHz();
   set_taus_seed (0);
 
@@ -1347,7 +1345,7 @@ int main ( int argc, char **argv ) {
   // end of CI modifications
   //getchar();
   if(IS_SOFTMODEM_DOFORMS)
-    load_softscope("enb");
+    load_softscope("enb", NULL);
 
   itti_wait_tasks_end();
   oai_exit=1;
diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index bf77125975cf992b42b1b86bf37847c126dd815b..a3d0b325d67211d38d0bd1054857d7ac06648635 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -75,7 +75,7 @@ unsigned short config_frames[4] = {2,9,11,13};
 
 #include "system.h"
 #include <openair2/GNB_APP/gnb_app.h>
-
+#include "PHY/TOOLS/phy_scope_interface.h"
 #include "PHY/TOOLS/nr_phy_scope.h"
 #include "stats.h"
 #include "nr-softmodem.h"
@@ -84,9 +84,6 @@ unsigned short config_frames[4] = {2,9,11,13};
 #include "NB_IoT_interface.h"
 #include "x2ap_eNB.h"
 
-short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,7327,7327,7327,21981,21981,7327,21981,21981,7327,-7327,7327,-21981,21981,-7327,21981,-21981,-7327,7327,-7327,21981,-21981,7327,-21981,21981,-7327,-7327,-7327,-21981,-21981,-7327,-21981,-21981,10726,10726,10726,3576,3576,10726,3576,3576,10726,17876,10726,25027,3576,17876,3576,25027,17876,10726,17876,3576,25027,10726,25027,3576,17876,17876,17876,25027,25027,17876,25027,25027,10726,-10726,10726,-3576,3576,-10726,3576,-3576,10726,-17876,10726,-25027,3576,-17876,3576,-25027,17876,-10726,17876,-3576,25027,-10726,25027,-3576,17876,-17876,17876,-25027,25027,-17876,25027,-25027,-10726,10726,-10726,3576,-3576,10726,-3576,3576,-10726,17876,-10726,25027,-3576,17876,-3576,25027,-17876,10726,-17876,3576,-25027,10726,-25027,3576,-17876,17876,-17876,25027,-25027,17876,-25027,25027,-10726,-10726,-10726,-3576,-3576,-10726,-3576,-3576,-10726,-17876,-10726,-25027,-3576,-17876,-3576,-25027,-17876,-10726,-17876,-3576,-25027,-10726,-25027,-3576,-17876,-17876,-17876,-25027,-25027,-17876,-25027,-25027,8886,8886,8886,12439,12439,8886,12439,12439,8886,5332,8886,1778,12439,5332,12439,1778,5332,8886,5332,12439,1778,8886,1778,12439,5332,5332,5332,1778,1778,5332,1778,1778,8886,19547,8886,15993,12439,19547,12439,15993,8886,23101,8886,26655,12439,23101,12439,26655,5332,19547,5332,15993,1778,19547,1778,15993,5332,23101,5332,26655,1778,23101,1778,26655,19547,8886,19547,12439,15993,8886,15993,12439,19547,5332,19547,1778,15993,5332,15993,1778,23101,8886,23101,12439,26655,8886,26655,12439,23101,5332,23101,1778,26655,5332,26655,1778,19547,19547,19547,15993,15993,19547,15993,15993,19547,23101,19547,26655,15993,23101,15993,26655,23101,19547,23101,15993,26655,19547,26655,15993,23101,23101,23101,26655,26655,23101,26655,26655,8886,-8886,8886,-12439,12439,-8886,12439,-12439,8886,-5332,8886,-1778,12439,-5332,12439,-1778,5332,-8886,5332,-12439,1778,-8886,1778,-12439,5332,-5332,5332,-1778,1778,-5332,1778,-1778,8886,-19547,8886,-15993,12439,-19547,12439,-15993,8886,-23101,8886,-26655,12439,-23101,12439,-26655,5332,-19547,5332,-15993,1778,-19547,1778,-15993,5332,-23101,5332,-26655,1778,-23101,1778,-26655,19547,-8886,19547,-12439,15993,-8886,15993,-12439,19547,-5332,19547,-1778,15993,-5332,15993,-1778,23101,-8886,23101,-12439,26655,-8886,26655,-12439,23101,-5332,23101,-1778,26655,-5332,26655,-1778,19547,-19547,19547,-15993,15993,-19547,15993,-15993,19547,-23101,19547,-26655,15993,-23101,15993,-26655,23101,-19547,23101,-15993,26655,-19547,26655,-15993,23101,-23101,23101,-26655,26655,-23101,26655,-26655,-8886,8886,-8886,12439,-12439,8886,-12439,12439,-8886,5332,-8886,1778,-12439,5332,-12439,1778,-5332,8886,-5332,12439,-1778,8886,-1778,12439,-5332,5332,-5332,1778,-1778,5332,-1778,1778,-8886,19547,-8886,15993,-12439,19547,-12439,15993,-8886,23101,-8886,26655,-12439,23101,-12439,26655,-5332,19547,-5332,15993,-1778,19547,-1778,15993,-5332,23101,-5332,26655,-1778,23101,-1778,26655,-19547,8886,-19547,12439,-15993,8886,-15993,12439,-19547,5332,-19547,1778,-15993,5332,-15993,1778,-23101,8886,-23101,12439,-26655,8886,-26655,12439,-23101,5332,-23101,1778,-26655,5332,-26655,1778,-19547,19547,-19547,15993,-15993,19547,-15993,15993,-19547,23101,-19547,26655,-15993,23101,-15993,26655,-23101,19547,-23101,15993,-26655,19547,-26655,15993,-23101,23101,-23101,26655,-26655,23101,-26655,26655,-8886,-8886,-8886,-12439,-12439,-8886,-12439,-12439,-8886,-5332,-8886,-1778,-12439,-5332,-12439,-1778,-5332,-8886,-5332,-12439,-1778,-8886,-1778,-12439,-5332,-5332,-5332,-1778,-1778,-5332,-1778,-1778,-8886,-19547,-8886,-15993,-12439,-19547,-12439,-15993,-8886,-23101,-8886,-26655,-12439,-23101,-12439,-26655,-5332,-19547,-5332,-15993,-1778,-19547,-1778,-15993,-5332,-23101,-5332,-26655,-1778,-23101,-1778,-26655,-19547,-8886,-19547,-12439,-15993,-8886,-15993,-12439,-19547,-5332,-19547,-1778,-15993,-5332,-15993,-1778,-23101,-8886,-23101,-12439,-26655,-8886,-26655,-12439,-23101,-5332,-23101,-1778,-26655,-5332,-26655,-1778,-19547,-19547,-19547,-15993,-15993,-19547,-15993,-15993,-19547,-23101,-19547,-26655,-15993,-23101,-15993,-26655,-23101,-19547,-23101,-15993,-26655,-19547,-26655,-15993,-23101,-23101,-23101,-26655,-26655,-23101,-26655,-26655};
-
-
 pthread_cond_t nfapi_sync_cond;
 pthread_mutex_t nfapi_sync_mutex;
 int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
@@ -156,7 +153,6 @@ char channels[128] = "0";
 
 int rx_input_level_dBm;
 
-uint32_t do_forms=0;
 int otg_enabled;
 
 //int number_of_cards = 1;
@@ -454,7 +450,11 @@ static void get_options(void) {
 
   paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ;
 
+  CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
+  get_common_options(SOFTMODEM_GNB_BIT );
   config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
+  CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
+
 
 
 
@@ -723,9 +723,6 @@ int restart_L1L2(module_id_t gnb_id) {
   
 
   RC.ru_mask |= (1 << ru->idx);
-  /* copy the changed frame parameters to the RU */
-  /* TODO this should be done for all RUs associated to this gNB */
-  memcpy(&ru->nr_frame_parms, &RC.gNB[gnb_id]->frame_parms, sizeof(NR_DL_FRAME_PARMS));
   set_function_spec_param(RC.ru[gnb_id]);
   LOG_I(GNB_APP, "attempting to create ITTI tasks\n");
   // No more rrc thread, as many race conditions are hidden behind
@@ -817,7 +814,6 @@ int main( int argc, char **argv )
   configure_linux();
   printf("Reading in command-line options\n");
   get_options ();
-  get_common_options(SOFTMODEM_GNB_BIT );
 
   if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
     fprintf(stderr,"Getting configuration failed\n");
@@ -959,14 +955,14 @@ if(!IS_SOFTMODEM_NOS1)
   printf("RC.nb_RU:%d\n", RC.nb_RU);
   // once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration)
   printf("ALL RUs ready - init gNBs\n");
-
-  if (do_forms==1) {
+  if(IS_SOFTMODEM_DOFORMS) {
+  	
     scopeParms_t p;
     p.argc=&argc;
     p.argv=argv;
     p.gNB=RC.gNB[0];
     p.ru=RC.ru[0];
-    gNBinitScope(&p);
+    load_softscope("nr",&p);
   }
 
   if (nfapi_mode != 1 && nfapi_mode != 2) {
diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h
index d113ae45aacc331fb96e6dfe739830d4326891f2..d6cfe6b906acef4026dcf08d7b03433b32fd1986 100644
--- a/executables/nr-softmodem.h
+++ b/executables/nr-softmodem.h
@@ -19,21 +19,12 @@
 /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 #define CMDLINE_PARAMS_DESC_GNB {  \
     {"mmapped-dma",           CONFIG_HLP_DMAMAP,      PARAMFLAG_BOOL,   uptr:&mmapped_dma,                  defintval:0,                   TYPE_INT,    0},        \
-    {"wait-for-sync",         NULL,                   PARAMFLAG_BOOL,   iptr:&wait_for_sync,                defintval:0,                   TYPE_INT,    0},        \
     {"single-thread-disable", CONFIG_HLP_NOSNGLT,     PARAMFLAG_BOOL,   iptr:&single_thread_flag,           defintval:1,                   TYPE_INT,    0},        \
     {"A" ,                    CONFIG_HLP_TADV,        0,                uptr:&timing_advance,               defintval:0,                   TYPE_UINT,   0},        \
-    {"C" ,                    CONFIG_HLP_DLF,         0,                u64ptr:&(downlink_frequency[0][0]), defuintval:DEFAULT_DLF,        TYPE_UINT64, 0},        \
-    {"a" ,                    CONFIG_HLP_CHOFF,       0,                iptr:&chain_offset,                 defintval:0,                   TYPE_INT,    0},        \
-    {"d" ,                    CONFIG_HLP_SOFTS,       PARAMFLAG_BOOL,   uptr:(uint32_t *)&do_forms,         defintval:0,                   TYPE_INT8,   0},        \
     {"E" ,                    CONFIG_HLP_TQFS,        PARAMFLAG_BOOL,   i8ptr:&threequarter_fs,             defintval:0,                   TYPE_INT8,   0},        \
     {"K" ,                    CONFIG_HLP_ITTIL,       PARAMFLAG_NOFREE, strptr:&itti_dump_file,             defstrval:"/tmp/itti.dump",    TYPE_STRING, 0},        \
     {"m" ,                    CONFIG_HLP_DLMCS,       0,                uptr:&target_dl_mcs,                defintval:0,                   TYPE_UINT,   0},        \
     {"t" ,                    CONFIG_HLP_ULMCS,       0,                uptr:&target_ul_mcs,                defintval:0,                   TYPE_UINT,   0},        \
-    {"q" ,                    CONFIG_HLP_STMON,       PARAMFLAG_BOOL,   iptr:&opp_enabled,                  defintval:0,                   TYPE_INT,    0},        \
-    {"numerology" ,           CONFIG_HLP_NUMEROLOGY,  PARAMFLAG_BOOL,   iptr:&numerology,                   defintval:0,                   TYPE_INT,    0},        \
-    {"emulate-rf" ,           CONFIG_HLP_EMULATE_RF,  PARAMFLAG_BOOL,   iptr:&emulate_rf,                   defintval:0,                   TYPE_INT,    0},        \
-    {"parallel-config",       CONFIG_HLP_PARALLEL_CMD,0,                strptr:(char **)&parallel_config,   defstrval:NULL,                TYPE_STRING, 0},        \
-    {"worker-config",         CONFIG_HLP_WORKER_CMD,  0,                strptr:(char **)&worker_config,     defstrval:NULL,                TYPE_STRING, 0},        \
     {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0,                iptr:&usrp_tx_thread,               defstrval:0,                   TYPE_INT,    0},        \
     {"s" ,                    CONFIG_HLP_SNR,         0,                dblptr:&snr_dB,                     defdblval:25,                  TYPE_DOUBLE, 0},        \
   }
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index 2f99027b759aa63d3e1cef7a4e819b054bd6492a..4b7ff204613081ceda45f7738eac6c58ead36751 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -35,9 +35,7 @@
 #include "NR_MAC_UE/mac_proto.h"
 #include "RRC/NR_UE/rrc_proto.h"
 
-//#ifndef NO_RAT_NR
-#include "SCHED_NR/phy_frame_config_nr.h"
-//#endif
+#include "SCHED_NR_UE/phy_frame_config_nr.h"
 #include "SCHED_NR_UE/defs.h"
 
 #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
@@ -123,7 +121,7 @@ extern double cpuf;
 #ifndef NO_RAT_NR
   #define DURATION_RX_TO_TX           (NR_UE_CAPABILITY_SLOT_RX_TO_TX)  /* for NR this will certainly depends to such UE capability which is not yet defined */
 #else
-  #define DURATION_RX_TO_TX           (4)   /* For LTE, this duration is fixed to 4 and it is linked to LTE standard for both modes FDD/TDD */
+  #define DURATION_RX_TO_TX           (6)   /* For LTE, this duration is fixed to 4 and it is linked to LTE standard for both modes FDD/TDD */
 #endif
 
 #define FRAME_PERIOD    100000000ULL
@@ -577,12 +575,6 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
 
 int computeSamplesShift(PHY_VARS_NR_UE *UE) {
 
-  if (IS_SOFTMODEM_RFSIM) {
-    LOG_D(PHY,"SET rx_offset %d \n",UE->rx_offset);
-    //UE->rx_offset_diff=0;
-    return 0;
-  }
-
   // compute TO compensation that should be applied for this frame
   if ( UE->rx_offset < UE->frame_parms.samples_per_frame/2  &&
        UE->rx_offset > 0 ) {
@@ -736,7 +728,7 @@ void *UE_thread(void *arg) {
 
     for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
       txp[i] = (void *)&UE->common_vars.txdata[i][UE->frame_parms.get_samples_slot_timestamp(
-               ((curMsg->proc.nr_tti_rx + DURATION_RX_TO_TX)%nb_slot_frame),&UE->frame_parms,0)];
+               ((curMsg->proc.nr_tti_rx + DURATION_RX_TO_TX -2)%nb_slot_frame),&UE->frame_parms,0)];
 
     int readBlockSize, writeBlockSize;
 
@@ -762,7 +754,7 @@ void *UE_thread(void *arg) {
                  UE->rfdevice.trx_write_func(&UE->rfdevice,
                      timestamp+
                      UE->frame_parms.get_samples_slot_timestamp(slot_nr,
-                     &UE->frame_parms,DURATION_RX_TO_TX) - firstSymSamp -
+                     &UE->frame_parms,DURATION_RX_TO_TX -2) - firstSymSamp -
                      openair0_cfg[0].tx_sample_advance,
                      txp,
                      writeBlockSize,
@@ -829,6 +821,7 @@ void *UE_thread(void *arg) {
 
       pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
     }
+
   } // while !oai_exit
 
   return NULL;
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index 6d3bbc903859b653c2d895273db5fb8e45b27a91..2fbea2bbfb40a1376f1a26cb1aa9e4d431859bf0 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -44,7 +44,6 @@
 #include "SCHED/sched_common_vars.h"
 #include "PHY/MODULATION/modulation_vars.h"
 //#include "../../SIMU/USER/init_lte.h"
-#include "PHY/NR_REFSIG/nr_mod_table.h"
 
 #include "LAYER2/MAC/mac_vars.h"
 #include "RRC/LTE/rrc_vars.h"
@@ -76,12 +75,12 @@ unsigned short config_frames[4] = {2,9,11,13};
 #include <openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h>
 #include <openair1/SCHED_NR_UE/fapi_nr_ue_l1.h>
 
+/* Callbacks, globals and object handlers */
+
 //#include "stats.h"
 // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
+#include "PHY/TOOLS/phy_scope_interface.h"
 #include "PHY/TOOLS/nr_phy_scope.h"
-// at eNB 0, an UL scope for every UE
-//FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-
 #include <executables/nr-uesoftmodem.h>
 #include "executables/softmodem-common.h"
 #include "executables/thread-common.h"
@@ -151,14 +150,11 @@ char ref[128] = "internal";
 char channels[128] = "0";
 
 
-static char *parallel_config = NULL;
-static char *worker_config = NULL;
-
 int rx_input_level_dBm;
 
 //static int online_log_messages=0;
 
-uint32_t do_forms=0;
+
 int otg_enabled;
 //int number_of_cards = 1;
 
@@ -761,8 +757,10 @@ int main( int argc, char **argv ) {
   memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs);
   configure_linux();
   mlockall(MCL_CURRENT | MCL_FUTURE);
-  if (do_forms)
-     nrUEinitScope(PHY_vars_UE_g[0][0]);
+ 
+  if(IS_SOFTMODEM_DOFORMS) { 
+    load_softscope("nr",PHY_vars_UE_g[0][0]);
+  }     
   number_of_cards = 1;
 
   for(int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h
index 43b921001afd4aff210083f96e5a547da5033f90..418ed54fc6871fc7358c417dfc53bd8457836fae 100644
--- a/executables/nr-uesoftmodem.h
+++ b/executables/nr-uesoftmodem.h
@@ -61,19 +61,11 @@
   {"single-thread-disable", CONFIG_HLP_NOSNGLT,     PARAMFLAG_BOOL, iptr:&single_thread_flag,              defintval:1,           TYPE_INT,    0}, \
   {"nr-dlsch-demod-shift",  CONFIG_HLP_DLSHIFT,     0,              iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0,           TYPE_INT,    0}, \
   {"A" ,                    CONFIG_HLP_TADV,        0,              uptr:&timing_advance,                  defintval:0,           TYPE_UINT,   0}, \
-  {"C" ,                    CONFIG_HLP_DLF,         0,              u64ptr:&(downlink_frequency[0][0]),    defuintval:0,TYPE_UINT64, 0}, \
-  {"a" ,                    CONFIG_HLP_CHOFF,       0,              iptr:&chain_offset,                    defintval:0,           TYPE_INT,    0}, \
-  {"d" ,                    CONFIG_HLP_SOFTS,       PARAMFLAG_BOOL, uptr:&do_forms,                        defintval:0,           TYPE_INT,    0}, \
   {"E" ,                    CONFIG_HLP_TQFS,        PARAMFLAG_BOOL, iptr:&threequarter_fs,                 defintval:0,           TYPE_INT,    0}, \
   {"m" ,                    CONFIG_HLP_DLMCS,       0,              uptr:&target_dl_mcs,                   defintval:0,           TYPE_UINT,   0}, \
   {"t" ,                    CONFIG_HLP_ULMCS,       0,              uptr:&target_ul_mcs,                   defintval:0,           TYPE_UINT,   0}, \
-  {"q" ,                    CONFIG_HLP_STMON,       PARAMFLAG_BOOL, iptr:&opp_enabled,                     defintval:0,           TYPE_INT,    0}, \
   {"T" ,                    CONFIG_HLP_TDD,         PARAMFLAG_BOOL, iptr:&tddflag,                         defintval:0,           TYPE_INT,    0}, \
   {"V" ,                    CONFIG_HLP_VCD,         PARAMFLAG_BOOL, iptr:&vcdflag,                         defintval:0,           TYPE_INT,    0}, \
-  {"numerology" ,           CONFIG_HLP_NUMEROLOGY,  0,              iptr:&numerology,                      defintval:0,           TYPE_INT,    0}, \
-  {"emulate-rf" ,           CONFIG_HLP_EMULATE_RF,  PARAMFLAG_BOOL, iptr:&emulate_rf,                      defintval:0,           TYPE_INT,    0}, \
-  {"parallel-config",       CONFIG_HLP_PARALLEL_CMD,0,              strptr:(char **)&parallel_config,      defstrval:NULL,        TYPE_STRING, 0}, \
-  {"worker-config",         CONFIG_HLP_WORKER_CMD,  0,              strptr:(char **)&worker_config,        defstrval:NULL,        TYPE_STRING, 0}, \
   {"s" ,                    CONFIG_HLP_SNR,         0,              dblptr:&snr_dB,                        defdblval:25,          TYPE_DOUBLE, 0}, \
   {"nbiot-disable",         CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag,                     defintval:0,           TYPE_INT,    0}, \
   {"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&UE_no_timing_correction, defintval:0,        TYPE_INT,    0}, \
diff --git a/executables/split_headers.h b/executables/split_headers.h
index 4e328f74c418c7f902014b99630dd4fbe2130e7a..dc451773c5bf887030ded0c2a691f4473b0d7032 100644
--- a/executables/split_headers.h
+++ b/executables/split_headers.h
@@ -28,6 +28,7 @@
 #include <stdint.h>
 #include <stdbool.h>
 #include <openair1/PHY/defs_eNB.h>
+#include <common/utils/telnetsrv/telnetsrv_proccmd.h>
 
 #define CU_PORT "7878"
 #define DU_PORT "8787"
@@ -279,7 +280,7 @@ int init_rf(RU_t *ru);
 void rx_rf(RU_t *ru, L1_rxtx_proc_t *proc);
 void tx_rf(RU_t *ru, L1_rxtx_proc_t *proc);
 void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe);
-void pmch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc);
+void pmch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, int fembms_flag);
 bool dlsch_procedures(PHY_VARS_eNB *eNB,
                       L1_rxtx_proc_t *proc,
                       int harq_pid,
@@ -325,5 +326,6 @@ void fep_full(RU_t *ru, int subframe);
 void feptx_prec(RU_t *ru,int frame,int subframe);
 void feptx_ofdm(RU_t *ru, int frame, int subframe);
 void oai_subframe_ind(uint16_t sfn, uint16_t sf);
+void softmodem_printresources(int sig, telnet_printfunc_t pf);
 extern uint16_t sf_ahead;
 #endif
diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h
index e342ab0b6775bbd1bd4e485b1ae8538260379029..f84917f12e4bc8bc4057e39762bb0c3d98f90a31 100644
--- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h
@@ -364,7 +364,7 @@ typedef struct
 //table 3-22
 typedef struct 
 {
-  nfapi_uint8_tlv_t phy_cell_id;//Physical Cell ID, 𝑁_{𝐼𝐷}^{𝑐𝑒𝑙𝑙} [38.211, sec 7.4.2.1] Value: 0 ->1007
+  nfapi_uint16_tlv_t phy_cell_id;//Physical Cell ID, 𝑁_{𝐼𝐷}^{𝑐𝑒𝑙𝑙} [38.211, sec 7.4.2.1] Value: 0 ->1007
   nfapi_uint8_tlv_t frame_duplex_type;//Frame duplex type Value: 0 = FDD 1 = TDD
 
 } nfapi_nr_cell_config_t;
diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
index 345122ca1d940bf2c1d45653d1da059850ae4704..b42ac6e4c8fe21f93cb76f1c2ed396283c6bb368 100644
--- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c
+++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
@@ -396,17 +396,17 @@ int test_ldpc(short No_iteration,
       decParams.numMaxIter=No_iteration;
       decParams.outMode = nrLDPC_outMode_BIT;
       //decParams.outMode =nrLDPC_outMode_LLRINT8;
-
-
-      for(j=0;j<n_segments;j++) {
+#ifdef CUDA_FLAG
+	  set_compact_BG(Zc,BG);
+	  init_LLR_DMA_for_CUDA(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j], block_length);
+#endif
+	  for(j=0;j<n_segments;j++) {
     	  start_meas(time_decoder);
 #ifdef CUDA_FLAG
         if(run_cuda){
-          printf("***********run ldpc by cuda\n");
           n_iter = nrLDPC_decoder_LYC(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j], block_length, time_decoder);
         }  
         else{ 
-          printf("**************run ldpc by cpu\n");  
         // decode the sequence
         // decoder supports BG2, Z=128 & 256
         //esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, (double)((float)nom_rate/(float)denom_rate));
@@ -516,6 +516,9 @@ int test_ldpc(short No_iteration,
 
 int main(int argc, char *argv[])
 {
+#ifdef CUDA_FLAG	
+  warmup_for_GPU();
+#endif
   unsigned int errors, errors_bit, crc_misses;
   double errors_bit_uncoded;
   short block_length=8448; // decoder supports length: 1201 -> 1280, 2401 -> 2560
diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_compact_in_C.h b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_compact_in_C.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a6086998e0d6e8d54425f3ad99aa6b24e3fe025
--- /dev/null
+++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_compact_in_C.h
@@ -0,0 +1,478 @@
+
+h_element host_h_compact1_I0 [46*19] =
+{{0 ,0,250},{1 ,0,2},{2 ,0,106},{3 ,0,121},{4 ,0,157},{5 ,0,205},{6 ,0,183},{7 ,0,220},{8 ,0,112},{9 ,0,103},{10 ,1,98},{11 ,0,77},{12 ,0,160},{13 ,0,177},{14 ,0,206},{15 ,0,40},{16 ,1,64},{17 ,0,7},{18 ,1,42},{19 ,0,60},{20 ,0,151},{21 ,1,249},{22 ,0,64},{23 ,1,156},{24 ,0,112},{25 ,1,23},{26 ,0,195},{27 ,1,25},{28 ,0,128},{29 ,1,86},{30 ,0,216},{31 ,1,95},{32 ,0,221},{33 ,1,2},{34 ,0,127},{35 ,1,161},{36 ,0,37},{37 ,1,198},{38 ,0,167},{39 ,1,173},{40 ,0,157},{41 ,1,167},{42 ,0,149},{43 ,1,151},{44 ,0,139},{45 ,1,149},
+{0 ,1,69},{1 ,2,239},{2 ,1,111},{3 ,1,89},{4 ,1,102},{5 ,1,236},{6 ,6,22},{7 ,1,44},{8 ,1,4},{9 ,1,182},{10 ,2,149},{11 ,1,41},{12 ,1,42},{13 ,3,248},{14 ,12,55},{15 ,1,96},{16 ,3,49},{17 ,14,164},{18 ,12,233},{19 ,1,73},{20 ,3,186},{21 ,5,121},{22 ,12,142},{23 ,2,147},{24 ,3,86},{25 ,6,136},{26 ,2,243},{27 ,6,104},{28 ,4,165},{29 ,14,236},{30 ,10,73},{31 ,7,177},{32 ,12,112},{33 ,2,187},{34 ,7,167},{35 ,6,197},{36 ,14,105},{37 ,13,220},{38 ,9,151},{39 ,3,139},{40 ,8,137},{41 ,3,173},{42 ,4,157},{43 ,16,163},{44 ,7,157},{45 ,6,151},
+{0 ,2,226},{1 ,3,117},{2 ,2,185},{3 ,3,84},{4 ,26,0},{5 ,3,194},{6 ,10,28},{7 ,4,159},{8 ,3,7},{9 ,10,109},{10 ,4,167},{11 ,12,83},{12 ,10,21},{13 ,7,151},{14 ,15,206},{15 ,10,65},{16 ,11,49},{17 ,16,59},{18 ,13,8},{19 ,7,72},{20 ,9,217},{21 ,16,109},{22 ,13,188},{23 ,10,170},{24 ,4,236},{25 ,7,116},{26 ,4,215},{27 ,8,194},{28 ,19,181},{29 ,18,84},{30 ,13,120},{31 ,22,172},{32 ,14,199},{33 ,11,41},{34 ,15,164},{35 ,12,207},{36 ,15,51},{37 ,23,122},{38 ,10,157},{39 ,7,149},{40 ,17,149},{41 ,9,139},{42 ,24,137},{43 ,18,173},{44 ,9,163},{45 ,10,167},
+{0 ,3,159},{1 ,4,124},{2 ,4,63},{3 ,4,20},{0 ,0,-1},{5 ,12,231},{6 ,11,67},{7 ,7,31},{8 ,12,211},{9 ,11,21},{10 ,7,160},{11 ,16,182},{12 ,11,32},{13 ,20,185},{14 ,16,127},{15 ,13,63},{16 ,20,51},{17 ,17,1},{18 ,18,155},{19 ,8,127},{20 ,11,47},{21 ,20,131},{22 ,17,158},{23 ,18,152},{24 ,11,116},{25 ,14,182},{26 ,15,61},{27 ,49,0},{28 ,21,63},{29 ,25,6},{30 ,24,9},{31 ,25,61},{32 ,24,121},{33 ,21,211},{34 ,17,159},{35 ,22,103},{36 ,18,120},{37 ,59,0},{38 ,12,163},{39 ,19,0},{40 ,62,0},{41 ,18,151},{42 ,64,0},{43 ,25,139},{44 ,22,173},{45 ,67,0},
+{0 ,5,100},{1 ,5,71},{2 ,5,117},{3 ,6,150},{0 ,0,-1},{5 ,16,28},{6 ,13,244},{7 ,8,167},{8 ,16,102},{9 ,13,142},{10 ,8,49},{11 ,21,78},{12 ,13,234},{13 ,23,62},{14 ,17,16},{15 ,18,75},{16 ,22,154},{17 ,21,144},{18 ,19,147},{19 ,10,224},{20 ,22,160},{21 ,21,171},{22 ,44,0},{23 ,45,0},{24 ,22,222},{25 ,47,0},{26 ,48,0},{0 ,0,-1},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{0 ,0,-1},{38 ,60,0},{39 ,61,0},{0 ,0,-1},{41 ,63,0},{0 ,0,-1},{43 ,65,0},{44 ,66,0},{0 ,0,-1},
+{0 ,6,10},{1 ,7,222},{2 ,6,93},{3 ,7,131},{0 ,0,-1},{5 ,21,123},{6 ,17,11},{7 ,14,104},{8 ,19,164},{9 ,17,14},{10 ,14,58},{11 ,22,252},{12 ,18,7},{13 ,35,0},{14 ,21,229},{15 ,25,179},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{0 ,0,-1},{0 ,0,-1},{24 ,46,0},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{0 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 ,20,239},{0 ,21,31},{0 ,22,1},{0 ,23,0},{1 ,24,0},{2 ,25,0},{4 ,26,0},{5 ,27,0},{6 ,28,0},{7 ,29,0},{8 ,30,0},{9 ,31,0},{10 ,32,0},{11 ,33,0},{12 ,34,0},{13 ,35,0},{14 ,36,0},{15 ,37,0},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{22 ,44,0},{23 ,45,0},{24 ,46,0},{25 ,47,0},{26 ,48,0},{27 ,49,0},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{37 ,59,0},{38 ,60,0},{39 ,61,0},{40 ,62,0},{41 ,63,0},{42 ,64,0},{43 ,65,0},{44 ,66,0},{45 ,67,0},
+{1 ,0,2},{2 ,1,111},{1 ,2,239},{1 ,3,117},{2 ,4,63},{1 ,5,71},{2 ,6,93},{2 ,7,229},{2 ,8,177},{1 ,9,173},{2 ,10,39},{1 ,11,220},{1 ,12,102},{2 ,13,142},{2 ,14,225},{1 ,15,132},{1 ,16,142},{2 ,17,245},{2 ,18,205},{1 ,19,255},{2 ,20,117},{1 ,21,28},{1 ,22,0},{1 ,23,0},{2 ,24,0},{3 ,25,0},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{2 ,0,106},{3 ,1,89},{2 ,2,185},{3 ,3,84},{3 ,4,20},{2 ,5,117},{3 ,6,150},{3 ,7,131},{3 ,8,243},{2 ,9,95},{3 ,10,136},{3 ,11,86},{3 ,12,246},{3 ,13,219},{3 ,14,211},{2 ,15,225},{3 ,16,240},{3 ,17,76},{3 ,18,244},{2 ,19,251},{3 ,20,144},{3 ,21,12},{3 ,22,1},{11 ,23,22},{8 ,24,90},{15 ,25,179},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{3 ,0,121},{4 ,1,102},{10 ,2,149},{5 ,3,194},{7 ,4,159},{21 ,5,121},{6 ,6,22},{7 ,7,31},{7 ,8,167},{20 ,9,217},{6 ,10,28},{6 ,11,67},{5 ,12,231},{6 ,13,244},{7 ,14,104},{14 ,15,206},{5 ,16,28},{6 ,17,11},{6 ,18,157},{8 ,19,164},{6 ,20,211},{5 ,21,123},{5 ,22,115},{13 ,23,62},{30 ,24,9},{29 ,25,6},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},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,44},{26 ,2,243},{13 ,3,248},{24 ,4,236},{0 ,0,-1},{27 ,6,104},{13 ,7,151},{19 ,8,127},{41 ,9,139},{12 ,10,21},{12 ,11,32},{11 ,12,83},{12 ,13,234},{17 ,14,164},{34 ,15,164},{11 ,16,182},{14 ,17,16},{12 ,18,7},{28 ,19,181},{13 ,20,185},{11 ,21,78},{11 ,22,252},{0 ,0,-1},{42 ,24,137},{43 ,25,139},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{6 ,0,183},{8 ,1,4},{33 ,2,187},{16 ,3,49},{26 ,4,215},{0 ,0,-1},{35 ,6,197},{19 ,7,72},{27 ,8,194},{44 ,9,163},{15 ,10,65},{16 ,11,49},{14 ,12,55},{15 ,13,63},{25 ,14,182},{36 ,15,51},{14 ,16,127},{17 ,17,1},{15 ,18,75},{39 ,19,0},{16 ,20,51},{14 ,21,229},{16 ,22,154},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 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,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1}
+};
+
+//--------------------------------------------------BG1_I0-----------------------------------------------------------------
+
+
+//--------------------------------------------------BG1_I1-----------------------------------------------------------------
+
+h_element host_h_compact1_I1 [46*19] = 
+{{0 ,0,307},{1 ,0,76},{2 ,0,205},{3 ,0,276},{4 ,0,332},{5 ,0,195},{6 ,0,278},{7 ,0,9},{8 ,0,307},{9 ,0,366},{10 ,1,101},{11 ,0,48},{12 ,0,77},{13 ,0,313},{14 ,0,142},{15 ,0,241},{16 ,1,13},{17 ,0,260},{18 ,1,130},{19 ,0,145},{20 ,0,187},{21 ,1,205},{22 ,0,30},{23 ,1,24},{24 ,0,298},{25 ,1,72},{26 ,0,71},{27 ,1,194},{28 ,0,222},{29 ,1,252},{30 ,0,159},{31 ,1,100},{32 ,0,102},{33 ,1,323},{34 ,0,230},{35 ,1,320},{36 ,0,210},{37 ,1,269},{38 ,0,185},{39 ,1,258},{40 ,0,175},{41 ,1,52},{42 ,0,113},{43 ,1,113},{44 ,0,80},{45 ,1,135},
+{0 ,1,19},{1 ,2,76},{2 ,1,250},{3 ,1,87},{4 ,1,181},{5 ,1,14},{6 ,6,257},{7 ,1,62},{8 ,1,179},{9 ,1,232},{10 ,2,339},{11 ,1,102},{12 ,1,186},{13 ,3,177},{14 ,12,248},{15 ,1,2},{16 ,3,338},{17 ,14,303},{18 ,12,163},{19 ,1,213},{20 ,3,206},{21 ,5,102},{22 ,12,11},{23 ,2,89},{24 ,3,158},{25 ,6,17},{26 ,2,81},{27 ,6,194},{28 ,4,19},{29 ,14,5},{30 ,10,229},{31 ,7,215},{32 ,12,201},{33 ,2,8},{34 ,7,148},{35 ,6,335},{36 ,14,313},{37 ,13,82},{38 ,9,177},{39 ,3,93},{40 ,8,37},{41 ,3,314},{42 ,4,14},{43 ,16,132},{44 ,7,78},{45 ,6,149},
+{0 ,2,50},{1 ,3,73},{2 ,2,328},{3 ,3,0},{4 ,26,0},{5 ,3,115},{6 ,10,1},{7 ,4,316},{8 ,3,165},{9 ,10,321},{10 ,4,274},{11 ,12,8},{12 ,10,174},{13 ,7,266},{14 ,15,137},{15 ,10,210},{16 ,11,57},{17 ,16,81},{18 ,13,280},{19 ,7,344},{20 ,9,264},{21 ,16,328},{22 ,13,233},{23 ,10,61},{24 ,4,235},{25 ,7,383},{26 ,4,76},{27 ,8,101},{28 ,19,244},{29 ,18,147},{30 ,13,260},{31 ,22,258},{32 ,14,175},{33 ,11,361},{34 ,15,202},{35 ,12,2},{36 ,15,297},{37 ,23,115},{38 ,10,289},{39 ,7,346},{40 ,17,312},{41 ,9,139},{42 ,24,218},{43 ,18,114},{44 ,9,163},{45 ,10,15},
+{0 ,3,369},{1 ,4,288},{2 ,4,332},{3 ,4,275},{0 ,0,-1},{5 ,12,166},{6 ,11,351},{7 ,7,333},{8 ,12,18},{9 ,11,133},{10 ,7,111},{11 ,16,47},{12 ,11,232},{13 ,20,115},{14 ,16,89},{15 ,13,318},{16 ,20,289},{17 ,17,358},{18 ,18,132},{19 ,8,242},{20 ,11,341},{21 ,20,213},{22 ,17,22},{23 ,18,27},{24 ,11,339},{25 ,14,312},{26 ,15,136},{27 ,49,0},{28 ,21,274},{29 ,25,78},{30 ,24,90},{31 ,25,256},{32 ,24,287},{33 ,21,105},{34 ,17,312},{35 ,22,266},{36 ,18,21},{37 ,59,0},{38 ,12,214},{39 ,19,297},{40 ,62,0},{41 ,18,288},{42 ,64,0},{43 ,25,168},{44 ,22,274},{45 ,67,0},
+{0 ,5,181},{1 ,5,144},{2 ,5,256},{3 ,6,199},{0 ,0,-1},{5 ,16,241},{6 ,13,92},{7 ,8,290},{8 ,16,39},{9 ,13,57},{10 ,8,383},{11 ,21,188},{12 ,13,50},{13 ,23,370},{14 ,17,347},{15 ,18,55},{16 ,22,57},{17 ,21,375},{18 ,19,4},{19 ,10,197},{20 ,22,59},{21 ,21,97},{22 ,44,0},{23 ,45,0},{24 ,22,234},{25 ,47,0},{26 ,48,0},{0 ,0,-1},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{0 ,0,-1},{38 ,60,0},{39 ,61,0},{0 ,0,-1},{41 ,63,0},{0 ,0,-1},{43 ,65,0},{44 ,66,0},{0 ,0,-1},
+{0 ,6,216},{1 ,7,331},{2 ,6,161},{3 ,7,153},{0 ,0,-1},{5 ,21,51},{6 ,17,253},{7 ,14,114},{8 ,19,224},{9 ,17,303},{10 ,14,354},{11 ,22,334},{12 ,18,74},{13 ,35,0},{14 ,21,12},{15 ,25,269},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{0 ,0,-1},{0 ,0,-1},{24 ,46,0},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0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,357},{1 ,14,217},{0 ,15,215},{0 ,16,106},{1 ,17,114},{0 ,18,242},{0 ,19,180},{0 ,20,330},{0 ,21,346},{0 ,22,1},{0 ,23,0},{1 ,24,0},{2 ,25,0},{4 ,26,0},{5 ,27,0},{6 ,28,0},{7 ,29,0},{8 ,30,0},{9 ,31,0},{10 ,32,0},{11 ,33,0},{12 ,34,0},{13 ,35,0},{14 ,36,0},{15 ,37,0},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{22 ,44,0},{23 ,45,0},{24 ,46,0},{25 ,47,0},{26 ,48,0},{27 ,49,0},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{37 ,59,0},{38 ,60,0},{39 ,61,0},{40 ,62,0},{41 ,63,0},{42 ,64,0},{43 ,65,0},{44 ,66,0},{45 ,67,0},
+{1 ,0,76},{2 ,1,250},{1 ,2,76},{1 ,3,73},{2 ,4,332},{1 ,5,144},{2 ,6,161},{2 ,7,267},{2 ,8,160},{1 ,9,178},{2 ,10,129},{1 ,11,295},{1 ,12,342},{2 ,13,200},{2 ,14,88},{1 ,15,99},{1 ,16,354},{2 ,17,131},{2 ,18,240},{1 ,19,331},{2 ,20,13},{1 ,21,112},{1 ,22,0},{1 ,23,0},{2 ,24,0},{3 ,25,0},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{2 ,0,205},{3 ,1,87},{2 ,2,328},{3 ,3,0},{3 ,4,275},{2 ,5,256},{3 ,6,199},{3 ,7,153},{3 ,8,56},{2 ,9,63},{3 ,10,132},{3 ,11,305},{3 ,12,231},{3 ,13,341},{3 ,14,212},{2 ,15,53},{3 ,16,304},{3 ,17,300},{3 ,18,271},{2 ,19,205},{3 ,20,39},{3 ,21,357},{3 ,22,1},{11 ,23,115},{8 ,24,170},{15 ,25,269},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{3 ,0,276},{4 ,1,181},{10 ,2,339},{5 ,3,115},{7 ,4,316},{21 ,5,102},{6 ,6,257},{7 ,7,333},{7 ,8,290},{20 ,9,264},{6 ,10,1},{6 ,11,351},{5 ,12,166},{6 ,13,92},{7 ,14,114},{14 ,15,137},{5 ,16,241},{6 ,17,253},{6 ,18,18},{8 ,19,224},{6 ,20,225},{5 ,21,51},{5 ,22,157},{13 ,23,370},{30 ,24,90},{29 ,25,78},{0 ,0,-1},{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1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{5 ,0,195},{7 ,1,62},{26 ,2,81},{13 ,3,177},{24 ,4,235},{0 ,0,-1},{27 ,6,194},{13 ,7,266},{19 ,8,242},{41 ,9,139},{12 ,10,174},{12 ,11,232},{11 ,12,8},{12 ,13,50},{17 ,14,303},{34 ,15,202},{11 ,16,47},{14 ,17,347},{12 ,18,74},{28 ,19,244},{13 ,20,115},{11 ,21,188},{11 ,22,334},{0 ,0,-1},{42 ,24,218},{43 ,25,168},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{6 ,0,278},{8 ,1,179},{33 ,2,8},{16 ,3,338},{26 ,4,76},{0 ,0,-1},{35 ,6,335},{19 ,7,344},{27 ,8,101},{44 ,9,163},{15 ,10,210},{16 ,11,57},{14 ,12,248},{15 ,13,318},{25 ,14,312},{36 ,15,297},{14 ,16,89},{17 ,17,358},{15 ,18,55},{39 ,19,297},{16 ,20,289},{14 ,21,12},{16 ,22,57},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 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-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1}
+};
+
+//--------------------------------------------------BG1_I1-----------------------------------------------------------------
+
+//--------------------------------------------------BG1_I2-----------------------------------------------------------------
+
+h_element host_h_compact1_I2 [46*19] = 
+{{0 ,0,73},{1 ,0,303},{2 ,0,68},{3 ,0,220},{4 ,0,233},{5 ,0,83},{6 ,0,289},{7 ,0,12},{8 ,0,295},{9 ,0,189},{10 ,1,14},{11 ,0,16},{12 ,0,229},{13 ,0,39},{14 ,0,78},{15 ,0,229},{16 ,1,69},{17 ,0,257},{18 ,1,260},{19 ,0,64},{20 ,0,301},{21 ,1,79},{22 ,0,177},{23 ,1,249},{24 ,0,289},{25 ,1,172},{26 ,0,270},{27 ,1,210},{28 ,0,11},{29 ,1,27},{30 ,0,91},{31 ,1,222},{32 ,0,210},{33 ,1,170},{34 ,0,187},{35 ,1,207},{36 ,0,259},{37 ,1,298},{38 ,0,151},{39 ,1,102},{40 ,0,32},{41 ,1,154},{42 ,0,226},{43 ,1,228},{44 ,0,234},{45 ,1,101},
+{0 ,1,15},{1 ,2,294},{2 ,1,7},{3 ,1,208},{4 ,1,205},{5 ,1,292},{6 ,6,21},{7 ,1,88},{8 ,1,133},{9 ,1,244},{10 ,2,80},{11 ,1,147},{12 ,1,235},{13 ,3,302},{14 ,12,299},{15 ,1,290},{16 ,3,140},{17 ,14,147},{18 ,12,294},{19 ,1,181},{20 ,3,162},{21 ,5,175},{22 ,12,20},{23 ,2,50},{24 ,3,280},{25 ,6,295},{26 ,2,110},{27 ,6,29},{28 ,4,293},{29 ,14,308},{30 ,10,23},{31 ,7,308},{32 ,12,22},{33 ,2,20},{34 ,7,296},{35 ,6,158},{36 ,14,179},{37 ,13,15},{38 ,9,179},{39 ,3,77},{40 ,8,80},{41 ,3,47},{42 ,4,65},{43 ,16,69},{44 ,7,227},{45 ,6,228},
+{0 ,2,103},{1 ,3,27},{2 ,2,80},{3 ,3,30},{4 ,26,0},{5 ,3,50},{6 ,10,293},{7 ,4,207},{8 ,3,130},{9 ,10,36},{10 ,4,211},{11 ,12,290},{12 ,10,169},{13 ,7,303},{14 ,15,54},{15 ,10,60},{16 ,11,45},{17 ,16,128},{18 ,13,291},{19 ,7,101},{20 ,9,40},{21 ,16,132},{22 ,13,55},{23 ,10,133},{24 ,4,110},{25 ,7,96},{26 ,4,318},{27 ,8,304},{28 ,19,50},{29 ,18,117},{30 ,13,105},{31 ,22,66},{32 ,14,271},{33 ,11,140},{34 ,15,5},{35 ,12,55},{36 ,15,178},{37 ,23,115},{38 ,10,64},{39 ,7,192},{40 ,17,197},{41 ,9,124},{42 ,24,126},{43 ,18,176},{44 ,9,259},{45 ,10,126},
+{0 ,3,49},{1 ,4,261},{2 ,4,280},{3 ,4,197},{0 ,0,-1},{5 ,12,318},{6 ,11,13},{7 ,7,50},{8 ,12,231},{9 ,11,286},{10 ,7,75},{11 ,16,289},{12 ,11,48},{13 ,20,160},{14 ,16,61},{15 ,13,130},{16 ,20,115},{17 ,17,51},{18 ,18,141},{19 ,8,270},{20 ,11,130},{21 ,20,283},{22 ,17,316},{23 ,18,105},{24 ,11,187},{25 ,14,46},{26 ,15,67},{27 ,49,0},{28 ,21,234},{29 ,25,29},{30 ,24,135},{31 ,25,162},{32 ,24,217},{33 ,21,33},{34 ,17,44},{35 ,22,285},{36 ,18,160},{37 ,59,0},{38 ,12,181},{39 ,19,208},{40 ,62,0},{41 ,18,207},{42 ,64,0},{43 ,25,102},{44 ,22,260},{45 ,67,0},
+{0 ,5,240},{1 ,5,161},{2 ,5,38},{3 ,6,61},{0 ,0,-1},{5 ,16,201},{6 ,13,232},{7 ,8,25},{8 ,16,296},{9 ,13,151},{10 ,8,161},{11 ,21,177},{12 ,13,105},{13 ,23,37},{14 ,17,179},{15 ,18,184},{16 ,22,300},{17 ,21,228},{18 ,19,295},{19 ,10,41},{20 ,22,10},{21 ,21,103},{22 ,44,0},{23 ,45,0},{24 ,22,281},{25 ,47,0},{26 ,48,0},{0 ,0,-1},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{0 ,0,-1},{38 ,60,0},{39 ,61,0},{0 ,0,-1},{41 ,63,0},{0 ,0,-1},{43 ,65,0},{44 ,66,0},{0 ,0,-1},
+{0 ,6,39},{1 ,7,133},{2 ,6,227},{3 ,7,175},{0 ,0,-1},{5 ,21,267},{6 ,17,302},{7 ,14,76},{8 ,19,110},{9 ,17,267},{10 ,14,311},{11 ,22,43},{12 ,18,52},{13 ,35,0},{14 ,21,258},{15 ,25,51},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{0 ,0,-1},{0 ,0,-1},{24 ,46,0},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1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,7,133},{1 ,8,4},{0 ,9,15},{0 ,10,162},{0 ,11,215},{0 ,12,164},{0 ,13,133},{1 ,14,76},{0 ,15,298},{0 ,16,110},{1 ,17,83},{0 ,18,113},{0 ,19,16},{0 ,20,189},{0 ,21,32},{0 ,22,1},{0 ,23,0},{1 ,24,0},{2 ,25,0},{4 ,26,0},{5 ,27,0},{6 ,28,0},{7 ,29,0},{8 ,30,0},{9 ,31,0},{10 ,32,0},{11 ,33,0},{12 ,34,0},{13 ,35,0},{14 ,36,0},{15 ,37,0},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{22 ,44,0},{23 ,45,0},{24 ,46,0},{25 ,47,0},{26 ,48,0},{27 ,49,0},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{37 ,59,0},{38 ,60,0},{39 ,61,0},{40 ,62,0},{41 ,63,0},{42 ,64,0},{43 ,65,0},{44 ,66,0},{45 ,67,0},
+{1 ,0,303},{2 ,1,7},{1 ,2,294},{1 ,3,27},{2 ,4,280},{1 ,5,161},{2 ,6,227},{2 ,7,202},{2 ,8,200},{1 ,9,80},{2 ,10,106},{1 ,11,129},{1 ,12,300},{2 ,13,295},{2 ,14,283},{1 ,15,266},{1 ,16,72},{2 ,17,184},{2 ,18,246},{1 ,19,260},{2 ,20,276},{1 ,21,301},{1 ,22,0},{1 ,23,0},{2 ,24,0},{3 ,25,0},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0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0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{5 ,0,83},{7 ,1,88},{26 ,2,110},{13 ,3,302},{24 ,4,110},{0 ,0,-1},{27 ,6,29},{13 ,7,303},{19 ,8,270},{41 ,9,124},{12 ,10,169},{12 ,11,48},{11 ,12,290},{12 ,13,105},{17 ,14,147},{34 ,15,5},{11 ,16,289},{14 ,17,179},{12 ,18,52},{28 ,19,50},{13 ,20,160},{11 ,21,177},{11 ,22,43},{0 ,0,-1},{42 ,24,126},{43 ,25,102},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{6 ,0,289},{8 ,1,133},{33 ,2,20},{16 ,3,140},{26 ,4,318},{0 ,0,-1},{35 ,6,158},{19 ,7,101},{27 ,8,304},{44 ,9,259},{15 ,10,60},{16 ,11,45},{14 ,12,299},{15 ,13,130},{25 ,14,46},{36 ,15,178},{14 ,16,61},{17 ,17,51},{15 ,18,184},{39 ,19,208},{16 ,20,115},{14 ,21,258},{16 ,22,300},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,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{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1}
+};
+
+//--------------------------------------------------BG1_I2-----------------------------------------------------------------
+
+
+//--------------------------------------------------BG1_I3-----------------------------------------------------------------
+
+h_element host_h_compact1_I3 [46*19] = 
+{{0 ,0,223},{1 ,0,141},{2 ,0,207},{3 ,0,201},{4 ,0,170},{5 ,0,164},{6 ,0,158},{7 ,0,17},{8 ,0,33},{9 ,0,9},{10 ,1,82},{11 ,0,52},{12 ,0,142},{13 ,0,81},{14 ,0,14},{15 ,0,90},{16 ,1,154},{17 ,0,56},{18 ,1,199},{19 ,0,8},{20 ,0,105},{21 ,1,192},{22 ,0,53},{23 ,1,88},{24 ,0,49},{25 ,1,1},{26 ,0,107},{27 ,1,208},{28 ,0,146},{29 ,1,150},{30 ,0,34},{31 ,1,175},{32 ,0,192},{33 ,1,114},{34 ,0,82},{35 ,1,192},{36 ,0,222},{37 ,1,81},{38 ,0,123},{39 ,1,12},{40 ,0,67},{41 ,1,23},{42 ,0,114},{43 ,1,206},{44 ,0,84},{45 ,1,184},
+{0 ,1,16},{1 ,2,45},{2 ,1,203},{3 ,1,18},{4 ,1,10},{5 ,1,59},{6 ,6,119},{7 ,1,76},{8 ,1,95},{9 ,1,37},{10 ,2,165},{11 ,1,11},{12 ,1,175},{13 ,3,56},{14 ,12,175},{15 ,1,120},{16 ,3,164},{17 ,14,110},{18 ,12,110},{19 ,1,6},{20 ,3,210},{21 ,5,131},{22 ,12,0},{23 ,2,203},{24 ,3,157},{25 ,6,166},{26 ,2,176},{27 ,6,141},{28 ,4,153},{29 ,14,11},{30 ,10,130},{31 ,7,49},{32 ,12,209},{33 ,2,49},{34 ,7,186},{35 ,6,173},{36 ,14,157},{37 ,13,195},{38 ,9,90},{39 ,3,77},{40 ,8,45},{41 ,3,215},{42 ,4,91},{43 ,16,22},{44 ,7,4},{45 ,6,121},
+{0 ,2,94},{1 ,3,151},{2 ,2,31},{3 ,3,165},{4 ,26,0},{5 ,3,86},{6 ,10,113},{7 ,4,104},{8 ,3,4},{9 ,10,213},{10 ,4,174},{11 ,12,2},{12 ,10,136},{13 ,7,72},{14 ,15,211},{15 ,10,131},{16 ,11,43},{17 ,16,200},{18 ,13,200},{19 ,7,103},{20 ,9,121},{21 ,16,220},{22 ,13,3},{23 ,10,168},{24 ,4,64},{25 ,7,65},{26 ,4,212},{27 ,8,174},{28 ,19,217},{29 ,18,53},{30 ,13,210},{31 ,22,177},{32 ,14,58},{33 ,11,161},{34 ,15,68},{35 ,12,26},{36 ,15,0},{37 ,23,138},{38 ,10,73},{39 ,7,49},{40 ,17,96},{41 ,9,60},{42 ,24,78},{43 ,18,134},{44 ,9,9},{45 ,10,29},
+{0 ,3,91},{1 ,4,46},{2 ,4,176},{3 ,4,5},{0 ,0,-1},{5 ,12,80},{6 ,11,21},{7 ,7,100},{8 ,12,217},{9 ,11,105},{10 ,7,19},{11 ,16,35},{12 ,11,3},{13 ,20,217},{14 ,16,191},{15 ,13,209},{16 ,20,189},{17 ,17,63},{18 ,18,143},{19 ,8,198},{20 ,11,214},{21 ,20,50},{22 ,17,148},{23 ,18,122},{24 ,11,193},{25 ,14,81},{26 ,15,127},{27 ,49,0},{28 ,21,114},{29 ,25,68},{30 ,24,123},{31 ,25,128},{32 ,24,30},{33 ,21,137},{34 ,17,150},{35 ,22,187},{36 ,18,6},{37 ,59,0},{38 ,12,10},{39 ,19,114},{40 ,62,0},{41 ,18,167},{42 ,64,0},{43 ,25,161},{44 ,22,12},{45 ,67,0},
+{0 ,5,74},{1 ,5,119},{2 ,5,180},{3 ,6,45},{0 ,0,-1},{5 ,16,182},{6 ,13,63},{7 ,8,150},{8 ,16,204},{9 ,13,89},{10 ,8,194},{11 ,21,32},{12 ,13,28},{13 ,23,78},{14 ,17,51},{15 ,18,209},{16 ,22,101},{17 ,21,4},{18 ,19,186},{19 ,10,8},{20 ,22,183},{21 ,21,106},{22 ,44,0},{23 ,45,0},{24 ,22,124},{25 ,47,0},{26 ,48,0},{0 ,0,-1},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{0 ,0,-1},{38 ,60,0},{39 ,61,0},{0 ,0,-1},{41 ,63,0},{0 ,0,-1},{43 ,65,0},{44 ,66,0},{0 ,0,-1},
+{0 ,6,10},{1 ,7,157},{2 ,6,186},{3 ,7,142},{0 ,0,-1},{5 ,21,130},{6 ,17,51},{7 ,14,158},{8 ,19,39},{9 ,17,185},{10 ,14,103},{11 ,22,84},{12 ,18,182},{13 ,35,0},{14 ,21,43},{15 ,25,81},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{0 ,0,-1},{0 ,0,-1},{24 ,46,0},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},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{0 ,1,16},{0 ,2,94},{0 ,3,91},{1 ,4,46},{0 ,5,74},{0 ,6,10},{1 ,7,157},{1 ,8,133},{0 ,9,0},{0 ,10,205},{0 ,11,216},{0 ,12,21},{0 ,13,215},{1 ,14,79},{0 ,15,14},{0 ,16,70},{1 ,17,194},{0 ,18,141},{0 ,19,198},{0 ,20,104},{0 ,21,81},{0 ,22,1},{0 ,23,0},{1 ,24,0},{2 ,25,0},{4 ,26,0},{5 ,27,0},{6 ,28,0},{7 ,29,0},{8 ,30,0},{9 ,31,0},{10 ,32,0},{11 ,33,0},{12 ,34,0},{13 ,35,0},{14 ,36,0},{15 ,37,0},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{22 ,44,0},{23 ,45,0},{24 ,46,0},{25 ,47,0},{26 ,48,0},{27 ,49,0},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{37 ,59,0},{38 ,60,0},{39 ,61,0},{40 ,62,0},{41 ,63,0},{42 ,64,0},{43 ,65,0},{44 ,66,0},{45 ,67,0},
+{1 ,0,141},{2 ,1,203},{1 ,2,45},{1 ,3,151},{2 ,4,176},{1 ,5,119},{2 ,6,186},{2 ,7,95},{2 ,8,153},{1 ,9,87},{2 ,10,70},{1 ,11,206},{1 ,12,93},{2 ,13,77},{2 ,14,214},{1 ,15,9},{1 ,16,118},{2 ,17,198},{2 ,18,117},{1 ,19,31},{2 ,20,90},{1 ,21,187},{1 ,22,0},{1 ,23,0},{2 ,24,0},{3 ,25,0},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,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14,158},{14 ,15,211},{5 ,16,182},{6 ,17,51},{6 ,18,136},{8 ,19,39},{6 ,20,116},{5 ,21,130},{5 ,22,153},{13 ,23,78},{30 ,24,123},{29 ,25,68},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{4 ,0,170},{5 ,1,59},{23 ,2,203},{8 ,3,4},{10 ,4,174},{0 ,0,-1},{25 ,6,166},{10 ,7,19},{10 ,8,194},{38 ,9,90},{9 ,10,213},{9 ,11,105},{8 ,12,217},{9 ,13,89},{10 ,14,103},{26 ,15,127},{8 ,16,204},{9 ,17,185},{9 ,18,109},{18 ,19,186},{9 ,20,218},{8 ,21,58},{8 ,22,44},{37 ,23,138},{32 ,24,30},{31 ,25,128},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{5 ,0,164},{7 ,1,76},{26 ,2,176},{13 ,3,56},{24 ,4,64},{0 ,0,-1},{27 ,6,141},{13 ,7,72},{19 ,8,198},{41 ,9,60},{12 ,10,136},{12 ,11,3},{11 ,12,2},{12 ,13,28},{17 ,14,110},{34 ,15,68},{11 ,16,35},{14 ,17,51},{12 ,18,182},{28 ,19,217},{13 ,20,217},{11 ,21,32},{11 ,22,84},{0 ,0,-1},{42 ,24,78},{43 ,25,161},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{6 ,0,158},{8 ,1,95},{33 ,2,49},{16 ,3,164},{26 ,4,212},{0 ,0,-1},{35 ,6,173},{19 ,7,103},{27 ,8,174},{44 ,9,9},{15 ,10,131},{16 ,11,43},{14 ,12,175},{15 ,13,209},{25 ,14,81},{36 ,15,0},{14 ,16,191},{17 ,17,63},{15 ,18,209},{39 ,19,114},{16 ,20,189},{14 ,21,43},{16 ,22,101},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 ,0,84},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1}
+};
+
+
+//--------------------------------------------------BG1_I3-----------------------------------------------------------------
+
+
+//--------------------------------------------------BG1_I4-----------------------------------------------------------------
+h_element host_h_compact1_I4 [46*19] =
+{{0 ,0,211},{1 ,0,179},{2 ,0,258},{3 ,0,187},{4 ,0,246},{5 ,0,261},{6 ,0,80},{7 ,0,169},{8 ,0,54},{9 ,0,162},{10 ,1,178},{11 ,0,55},{12 ,0,225},{13 ,0,231},{14 ,0,0},{15 ,0,170},{16 ,1,270},{17 ,0,153},{18 ,1,161},{19 ,0,0},{20 ,0,265},{21 ,1,64},{22 ,0,72},{23 ,1,180},{24 ,0,236},{25 ,1,205},{26 ,0,0},{27 ,1,45},{28 ,0,275},{29 ,1,0},{30 ,0,0},{31 ,1,144},{32 ,0,0},{33 ,1,0},{34 ,0,197},{35 ,1,199},{36 ,0,216},{37 ,1,72},{38 ,0,190},{39 ,1,153},{40 ,0,216},{41 ,1,0},{42 ,0,27},{43 ,1,52},{44 ,0,18},{45 ,1,168},
+{0 ,1,198},{1 ,2,162},{2 ,1,167},{3 ,1,145},{4 ,1,235},{5 ,1,181},{6 ,6,144},{7 ,1,189},{8 ,1,0},{9 ,1,159},{10 ,2,1},{11 ,1,23},{12 ,1,162},{13 ,3,0},{14 ,12,186},{15 ,1,0},{16 ,3,13},{17 ,14,137},{18 ,12,151},{19 ,1,0},{20 ,3,81},{21 ,5,46},{22 ,12,189},{23 ,2,0},{24 ,3,199},{25 ,6,0},{26 ,2,0},{27 ,6,36},{28 ,4,0},{29 ,14,180},{30 ,10,90},{31 ,7,144},{32 ,12,211},{33 ,2,0},{34 ,7,0},{35 ,6,278},{36 ,14,16},{37 ,13,144},{38 ,9,0},{39 ,3,0},{40 ,8,144},{41 ,3,0},{42 ,4,0},{43 ,16,243},{44 ,7,0},{45 ,6,0},
+{0 ,2,188},{1 ,3,223},{2 ,2,220},{3 ,3,166},{4 ,26,0},{5 ,3,72},{6 ,10,169},{7 ,4,154},{8 ,3,252},{9 ,10,93},{10 ,4,28},{11 ,12,274},{12 ,10,244},{13 ,7,216},{14 ,15,253},{15 ,10,183},{16 ,11,99},{17 ,16,0},{18 ,13,0},{19 ,7,118},{20 ,9,90},{21 ,16,266},{22 ,13,72},{23 ,10,0},{24 ,4,0},{25 ,7,0},{26 ,4,0},{27 ,8,72},{28 ,19,155},{29 ,18,0},{30 ,13,252},{31 ,22,166},{32 ,14,36},{33 ,11,76},{34 ,15,108},{35 ,12,0},{36 ,15,0},{37 ,23,0},{38 ,10,0},{39 ,7,165},{40 ,17,2},{41 ,9,0},{42 ,24,35},{43 ,18,0},{44 ,9,0},{45 ,10,144},
+{0 ,3,186},{1 ,4,256},{2 ,4,133},{3 ,4,108},{0 ,0,-1},{5 ,12,283},{6 ,11,90},{7 ,7,184},{8 ,12,41},{9 ,11,134},{10 ,7,267},{11 ,16,181},{12 ,11,151},{13 ,20,47},{14 ,16,16},{15 ,13,108},{16 ,20,54},{17 ,17,0},{18 ,18,241},{19 ,8,144},{20 ,11,144},{21 ,20,9},{22 ,17,257},{23 ,18,165},{24 ,11,266},{25 ,14,183},{26 ,15,277},{27 ,49,0},{28 ,21,62},{29 ,25,42},{30 ,24,173},{31 ,25,19},{32 ,24,162},{33 ,21,18},{34 ,17,0},{35 ,22,205},{36 ,18,0},{37 ,59,0},{38 ,12,0},{39 ,19,117},{40 ,62,0},{41 ,18,183},{42 ,64,0},{43 ,25,270},{44 ,22,57},{45 ,67,0},
+{0 ,5,219},{1 ,5,160},{2 ,5,243},{3 ,6,82},{0 ,0,-1},{5 ,16,254},{6 ,13,59},{7 ,8,104},{8 ,16,98},{9 ,13,45},{10 ,8,234},{11 ,21,273},{12 ,13,238},{13 ,23,36},{14 ,17,0},{15 ,18,68},{16 ,22,0},{17 ,21,162},{18 ,19,144},{19 ,10,0},{20 ,22,228},{21 ,21,18},{22 ,44,0},{23 ,45,0},{24 ,22,0},{25 ,47,0},{26 ,48,0},{0 ,0,-1},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{0 ,0,-1},{38 ,60,0},{39 ,61,0},{0 ,0,-1},{41 ,63,0},{0 ,0,-1},{43 ,65,0},{44 ,66,0},{0 ,0,-1},
+{0 ,6,4},{1 ,7,76},{2 ,6,202},{3 ,7,132},{0 ,0,-1},{5 ,21,79},{6 ,17,177},{7 ,14,164},{8 ,19,46},{9 ,17,132},{10 ,14,201},{11 ,22,39},{12 ,18,243},{13 ,35,0},{14 ,21,79},{15 ,25,64},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{0 ,0,-1},{0 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,0,-1},{0 ,0,-1},
+};
+
+
+h_element host_h_compact2_I4 [68*30] =
+{{0 ,0,211},{0 ,1,198},{0 ,2,188},{0 ,3,186},{1 ,4,256},{0 ,5,219},{0 ,6,4},{1 ,7,76},{1 ,8,202},{0 ,9,29},{0 ,10,144},{0 ,11,116},{0 ,12,216},{0 ,13,115},{1 ,14,72},{0 ,15,233},{0 ,16,144},{1 ,17,147},{0 ,18,95},{0 ,19,216},{0 ,20,73},{0 ,21,261},{0 ,22,1},{0 ,23,0},{1 ,24,0},{2 ,25,0},{4 ,26,0},{5 ,27,0},{6 ,28,0},{7 ,29,0},{8 ,30,0},{9 ,31,0},{10 ,32,0},{11 ,33,0},{12 ,34,0},{13 ,35,0},{14 ,36,0},{15 ,37,0},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{22 ,44,0},{23 ,45,0},{24 ,46,0},{25 ,47,0},{26 ,48,0},{27 ,49,0},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{37 ,59,0},{38 ,60,0},{39 ,61,0},{40 ,62,0},{41 ,63,0},{42 ,64,0},{43 ,65,0},{44 ,66,0},{45 ,67,0},
+{1 ,0,179},{2 ,1,167},{1 ,2,162},{1 ,3,223},{2 ,4,133},{1 ,5,160},{2 ,6,202},{2 ,7,218},{2 ,8,63},{1 ,9,117},{2 ,10,3},{1 ,11,109},{1 ,12,15},{2 ,13,74},{2 ,14,229},{1 ,15,152},{1 ,16,158},{2 ,17,216},{2 ,18,269},{1 ,19,156},{2 ,20,234},{1 ,21,119},{1 ,22,0},{1 ,23,0},{2 ,24,0},{3 ,25,0},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,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7 ,8,104},{20 ,9,90},{6 ,10,169},{6 ,11,90},{5 ,12,283},{6 ,13,59},{7 ,14,164},{14 ,15,253},{5 ,16,254},{6 ,17,177},{6 ,18,151},{8 ,19,46},{6 ,20,108},{5 ,21,79},{5 ,22,144},{13 ,23,36},{30 ,24,173},{29 ,25,42},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{4 ,0,246},{5 ,1,181},{23 ,2,0},{8 ,3,252},{10 ,4,28},{0 ,0,-1},{25 ,6,0},{10 ,7,267},{10 ,8,234},{38 ,9,0},{9 ,10,93},{9 ,11,134},{8 ,12,41},{9 ,13,45},{10 ,14,201},{26 ,15,277},{8 ,16,98},{9 ,17,132},{9 ,18,76},{18 ,19,144},{9 ,20,209},{8 ,21,15},{8 ,22,230},{37 ,23,0},{32 ,24,162},{31 ,25,19},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{5 ,0,261},{7 ,1,189},{26 ,2,0},{13 ,3,0},{24 ,4,0},{0 ,0,-1},{27 ,6,36},{13 ,7,216},{19 ,8,144},{41 ,9,0},{12 ,10,244},{12 ,11,151},{11 ,12,274},{12 ,13,238},{17 ,14,137},{34 ,15,108},{11 ,16,181},{14 ,17,0},{12 ,18,243},{28 ,19,155},{13 ,20,47},{11 ,21,273},{11 ,22,39},{0 ,0,-1},{42 ,24,35},{43 ,25,270},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{6 ,0,80},{8 ,1,0},{33 ,2,0},{16 ,3,13},{26 ,4,0},{0 ,0,-1},{35 ,6,278},{19 ,7,118},{27 ,8,72},{44 ,9,0},{15 ,10,183},{16 ,11,99},{14 ,12,186},{15 ,13,108},{25 ,14,183},{36 ,15,0},{14 ,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,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{44 ,0,18},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1}
+};
+
+
+//--------------------------------------------------BG1_I4-----------------------------------------------------------------
+
+
+//--------------------------------------------------BG1_I5-----------------------------------------------------------------
+h_element host_h_compact1_I5 [46*19] =
+{{0 ,0,294},{1 ,0,77},{2 ,0,226},{3 ,0,97},{4 ,0,42},{5 ,0,219},{6 ,0,294},{7 ,0,3},{8 ,0,348},{9 ,0,156},{10 ,1,175},{11 ,0,25},{12 ,0,123},{13 ,0,311},{14 ,0,22},{15 ,0,176},{16 ,1,190},{17 ,0,110},{18 ,1,47},{19 ,0,87},{20 ,0,89},{21 ,1,162},{22 ,0,280},{23 ,1,18},{24 ,0,38},{25 ,1,279},{26 ,0,325},{27 ,1,91},{28 ,0,102},{29 ,1,273},{30 ,0,171},{31 ,1,101},{32 ,0,351},{33 ,1,56},{34 ,0,60},{35 ,1,100},{36 ,0,135},{37 ,1,319},{38 ,0,164},{39 ,1,236},{40 ,0,304},{41 ,1,123},{42 ,0,288},{43 ,1,210},{44 ,0,79},{45 ,1,82},
+{0 ,1,118},{1 ,2,225},{2 ,1,35},{3 ,1,94},{4 ,1,256},{5 ,1,130},{6 ,6,73},{7 ,1,103},{8 ,1,75},{9 ,1,88},{10 ,2,253},{11 ,1,322},{12 ,1,217},{13 ,3,251},{14 ,12,322},{15 ,1,348},{16 ,3,293},{17 ,14,228},{18 ,12,286},{19 ,1,110},{20 ,3,65},{21 ,5,264},{22 ,12,157},{23 ,2,6},{24 ,3,170},{25 ,6,255},{26 ,2,326},{27 ,6,326},{28 ,4,1},{29 ,14,104},{30 ,10,16},{31 ,7,297},{32 ,12,265},{33 ,2,304},{34 ,7,320},{35 ,6,210},{36 ,14,15},{37 ,13,236},{38 ,9,196},{39 ,3,264},{40 ,8,237},{41 ,3,77},{42 ,4,83},{43 ,16,3},{44 ,7,244},{45 ,6,67},
+{0 ,2,167},{1 ,3,96},{2 ,2,213},{3 ,3,49},{4 ,26,0},{5 ,3,251},{6 ,10,330},{7 ,4,224},{8 ,3,22},{9 ,10,293},{10 ,4,27},{11 ,12,200},{12 ,10,142},{13 ,7,265},{14 ,15,277},{15 ,10,15},{16 ,11,332},{17 ,16,247},{18 ,13,246},{19 ,7,147},{20 ,9,155},{21 ,16,346},{22 ,13,236},{23 ,10,181},{24 ,4,249},{25 ,7,111},{26 ,4,226},{27 ,8,268},{28 ,19,40},{29 ,18,243},{30 ,13,95},{31 ,22,279},{32 ,14,338},{33 ,11,141},{34 ,15,112},{35 ,12,195},{36 ,15,35},{37 ,23,85},{38 ,10,209},{39 ,7,37},{40 ,17,135},{41 ,9,25},{42 ,24,17},{43 ,18,53},{44 ,9,293},{45 ,10,235},
+{0 ,3,330},{1 ,4,338},{2 ,4,302},{3 ,4,279},{0 ,0,-1},{5 ,12,322},{6 ,11,99},{7 ,7,297},{8 ,12,312},{9 ,11,111},{10 ,7,231},{11 ,16,351},{12 ,11,110},{13 ,20,94},{14 ,16,156},{15 ,13,81},{16 ,20,331},{17 ,17,116},{18 ,18,181},{19 ,8,258},{20 ,11,244},{21 ,20,143},{22 ,17,113},{23 ,18,304},{24 ,11,288},{25 ,14,54},{26 ,15,99},{27 ,49,0},{28 ,21,167},{29 ,25,107},{30 ,24,212},{31 ,25,222},{32 ,24,83},{33 ,21,101},{34 ,17,54},{35 ,22,268},{36 ,18,188},{37 ,59,0},{38 ,12,246},{39 ,19,272},{40 ,62,0},{41 ,18,272},{42 ,64,0},{43 ,25,167},{44 ,22,272},{45 ,67,0},
+{0 ,5,207},{1 ,5,268},{2 ,5,111},{3 ,6,139},{0 ,0,-1},{5 ,16,295},{6 ,13,172},{7 ,8,215},{8 ,16,224},{9 ,13,92},{10 ,8,49},{11 ,21,166},{12 ,13,176},{13 ,23,81},{14 ,17,66},{15 ,18,176},{16 ,22,114},{17 ,21,190},{18 ,19,73},{19 ,10,204},{20 ,22,30},{21 ,21,109},{22 ,44,0},{23 ,45,0},{24 ,22,194},{25 ,47,0},{26 ,48,0},{0 ,0,-1},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{0 ,0,-1},{38 ,60,0},{39 ,61,0},{0 ,0,-1},{41 ,63,0},{0 ,0,-1},{43 ,65,0},{44 ,66,0},{0 ,0,-1},
+{0 ,6,165},{1 ,7,112},{2 ,6,265},{3 ,7,166},{0 ,0,-1},{5 ,21,258},{6 ,17,150},{7 ,14,39},{8 ,19,17},{9 ,17,152},{10 ,14,267},{11 ,22,338},{12 ,18,76},{13 ,35,0},{14 ,21,78},{15 ,25,113},{16 ,38,0},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0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+};
+
+
+h_element host_h_compact2_I5 [68*30] =
+{{0 ,0,294},{0 ,1,118},{0 ,2,167},{0 ,3,330},{1 ,4,338},{0 ,5,207},{0 ,6,165},{1 ,7,112},{1 ,8,302},{0 ,9,243},{0 ,10,250},{0 ,11,1},{0 ,12,339},{0 ,13,201},{1 ,14,334},{0 ,15,53},{0 ,16,347},{1 ,17,133},{0 ,18,304},{0 ,19,167},{0 ,20,47},{0 ,21,188},{0 ,22,1},{0 ,23,0},{1 ,24,0},{2 ,25,0},{4 ,26,0},{5 ,27,0},{6 ,28,0},{7 ,29,0},{8 ,30,0},{9 ,31,0},{10 ,32,0},{11 ,33,0},{12 ,34,0},{13 ,35,0},{14 ,36,0},{15 ,37,0},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{22 ,44,0},{23 ,45,0},{24 ,46,0},{25 ,47,0},{26 ,48,0},{27 ,49,0},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{37 ,59,0},{38 ,60,0},{39 ,61,0},{40 ,62,0},{41 ,63,0},{42 ,64,0},{43 ,65,0},{44 ,66,0},{45 ,67,0},
+{1 ,0,77},{2 ,1,35},{1 ,2,225},{1 ,3,96},{2 ,4,302},{1 ,5,268},{2 ,6,265},{2 ,7,128},{2 ,8,237},{1 ,9,50},{2 ,10,127},{1 ,11,167},{1 ,12,253},{2 ,13,110},{2 ,14,286},{1 ,15,242},{1 ,16,257},{2 ,17,131},{2 ,18,163},{1 ,19,9},{2 ,20,7},{1 ,21,302},{1 ,22,0},{1 ,23,0},{2 ,24,0},{3 ,25,0},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1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,256},{10 ,2,253},{5 ,3,251},{7 ,4,224},{21 ,5,264},{6 ,6,73},{7 ,7,297},{7 ,8,215},{20 ,9,155},{6 ,10,330},{6 ,11,99},{5 ,12,322},{6 ,13,172},{7 ,14,39},{14 ,15,277},{5 ,16,295},{6 ,17,150},{6 ,18,284},{8 ,19,17},{6 ,20,305},{5 ,21,258},{5 ,22,283},{13 ,23,81},{30 ,24,212},{29 ,25,107},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{4 ,0,42},{5 ,1,130},{23 ,2,6},{8 ,3,22},{10 ,4,27},{0 ,0,-1},{25 ,6,255},{10 ,7,231},{10 ,8,49},{38 ,9,196},{9 ,10,293},{9 ,11,111},{8 ,12,312},{9 ,13,92},{10 ,14,267},{26 ,15,99},{8 ,16,224},{9 ,17,152},{9 ,18,23},{18 ,19,73},{9 ,20,337},{8 ,21,59},{8 ,22,314},{37 ,23,85},{32 ,24,83},{31 ,25,222},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{5 ,0,219},{7 ,1,103},{26 ,2,326},{13 ,3,251},{24 ,4,249},{0 ,0,-1},{27 ,6,326},{13 ,7,265},{19 ,8,258},{41 ,9,25},{12 ,10,142},{12 ,11,110},{11 ,12,200},{12 ,13,176},{17 ,14,228},{34 ,15,112},{11 ,16,351},{14 ,17,66},{12 ,18,76},{28 ,19,40},{13 ,20,94},{11 ,21,166},{11 ,22,338},{0 ,0,-1},{42 ,24,17},{43 ,25,167},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{6 ,0,294},{8 ,1,75},{33 ,2,304},{16 ,3,293},{26 ,4,226},{0 ,0,-1},{35 ,6,210},{19 ,7,147},{27 ,8,268},{44 ,9,293},{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1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{44 ,0,79},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1}
+};
+//--------------------------------------------------BG1_I5-----------------------------------------------------------------
+
+
+//--------------------------------------------------BG1_I6-----------------------------------------------------------------
+h_element host_h_compact1_I6 [46*19] =
+{{0 ,0,0},{1 ,0,22},{2 ,0,132},{3 ,0,4},{4 ,0,24},{5 ,0,185},{6 ,0,6},{7 ,0,145},{8 ,0,172},{9 ,0,6},{10 ,1,126},{11 ,0,184},{12 ,0,6},{13 ,0,52},{14 ,0,1},{15 ,0,173},{16 ,1,88},{17 ,0,91},{18 ,1,1},{19 ,0,12},{20 ,0,6},{21 ,1,6},{22 ,0,44},{23 ,1,45},{24 ,0,9},{25 ,1,4},{26 ,0,21},{27 ,1,98},{28 ,0,4},{29 ,1,92},{30 ,0,2},{31 ,1,4},{32 ,0,6},{33 ,1,10},{34 ,0,4},{35 ,1,4},{36 ,0,6},{37 ,1,82},{38 ,0,91},{39 ,1,4},{40 ,0,10},{41 ,1,2},{42 ,0,163},{43 ,1,1},{44 ,0,4},{45 ,1,181},
+{0 ,1,0},{1 ,2,11},{2 ,1,37},{3 ,1,6},{4 ,1,204},{5 ,1,100},{6 ,6,27},{7 ,1,88},{8 ,1,2},{9 ,1,10},{10 ,2,77},{11 ,1,194},{12 ,1,20},{13 ,3,147},{14 ,12,202},{15 ,1,6},{16 ,3,198},{17 ,14,184},{18 ,12,41},{19 ,1,6},{20 ,3,12},{21 ,5,86},{22 ,12,58},{23 ,2,18},{24 ,3,125},{25 ,6,74},{26 ,2,142},{27 ,6,140},{28 ,4,1},{29 ,14,136},{30 ,10,88},{31 ,7,49},{32 ,12,126},{33 ,2,30},{34 ,7,153},{35 ,6,45},{36 ,14,200},{37 ,13,2},{38 ,9,64},{39 ,3,28},{40 ,8,84},{41 ,3,75},{42 ,4,10},{43 ,16,163},{44 ,7,6},{45 ,6,45},
+{0 ,2,0},{1 ,3,124},{2 ,2,21},{3 ,3,33},{4 ,26,0},{5 ,3,24},{6 ,10,163},{7 ,4,112},{8 ,3,131},{9 ,10,145},{10 ,4,156},{11 ,12,123},{12 ,10,203},{13 ,7,1},{14 ,15,118},{15 ,10,81},{16 ,11,160},{17 ,16,30},{18 ,13,167},{19 ,7,166},{20 ,9,15},{21 ,16,96},{22 ,13,130},{23 ,10,132},{24 ,4,191},{25 ,7,16},{26 ,4,192},{27 ,8,22},{28 ,19,40},{29 ,18,106},{30 ,13,112},{31 ,22,125},{32 ,14,63},{33 ,11,6},{34 ,15,197},{35 ,12,168},{36 ,15,177},{37 ,23,135},{38 ,10,198},{39 ,7,109},{40 ,17,12},{41 ,9,142},{42 ,24,162},{43 ,18,99},{44 ,9,142},{45 ,10,153},
+{0 ,3,0},{1 ,4,0},{2 ,4,180},{3 ,4,113},{0 ,0,-1},{5 ,12,65},{6 ,11,50},{7 ,7,153},{8 ,12,141},{9 ,11,53},{10 ,7,16},{11 ,16,16},{12 ,11,153},{13 ,20,16},{14 ,16,130},{15 ,13,182},{16 ,20,122},{17 ,17,3},{18 ,18,68},{19 ,8,184},{20 ,11,5},{21 ,20,42},{22 ,17,131},{23 ,18,100},{24 ,11,28},{25 ,14,28},{26 ,15,197},{27 ,49,0},{28 ,21,93},{29 ,25,6},{30 ,24,20},{31 ,25,194},{32 ,24,20},{33 ,21,92},{34 ,17,155},{35 ,22,185},{36 ,18,43},{37 ,59,0},{38 ,12,100},{39 ,19,188},{40 ,62,0},{41 ,18,128},{42 ,64,0},{43 ,25,98},{44 ,22,3},{45 ,67,0},
+{0 ,5,0},{1 ,5,10},{2 ,5,4},{3 ,6,49},{0 ,0,-1},{5 ,16,207},{6 ,13,48},{7 ,8,159},{8 ,16,96},{9 ,13,201},{10 ,8,12},{11 ,21,104},{12 ,13,104},{13 ,23,46},{14 ,17,1},{15 ,18,53},{16 ,22,182},{17 ,21,155},{18 ,19,148},{19 ,10,191},{20 ,22,30},{21 ,21,199},{22 ,44,0},{23 ,45,0},{24 ,22,6},{25 ,47,0},{26 ,48,0},{0 ,0,-1},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{0 ,0,-1},{38 ,60,0},{39 ,61,0},{0 ,0,-1},{41 ,63,0},{0 ,0,-1},{43 ,65,0},{44 ,66,0},{0 ,0,-1},
+{0 ,6,0},{1 ,7,0},{2 ,6,149},{3 ,7,21},{0 ,0,-1},{5 ,21,161},{6 ,17,24},{7 ,14,76},{8 ,19,99},{9 ,17,4},{10 ,14,70},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0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+};
+
+
+h_element host_h_compact2_I6 [68*30] =
+{{0 ,0,0},{0 ,1,0},{0 ,2,0},{0 ,3,0},{1 ,4,0},{0 ,5,0},{0 ,6,0},{1 ,7,0},{1 ,8,0},{0 ,9,0},{0 ,10,0},{0 ,11,0},{0 ,12,0},{0 ,13,0},{1 ,14,0},{0 ,15,0},{0 ,16,0},{1 ,17,0},{0 ,18,0},{0 ,19,0},{0 ,20,0},{0 ,21,0},{0 ,22,0},{0 ,23,0},{1 ,24,0},{2 ,25,0},{4 ,26,0},{5 ,27,0},{6 ,28,0},{7 ,29,0},{8 ,30,0},{9 ,31,0},{10 ,32,0},{11 ,33,0},{12 ,34,0},{13 ,35,0},{14 ,36,0},{15 ,37,0},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{22 ,44,0},{23 ,45,0},{24 ,46,0},{25 ,47,0},{26 ,48,0},{27 ,49,0},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{37 ,59,0},{38 ,60,0},{39 ,61,0},{40 ,62,0},{41 ,63,0},{42 ,64,0},{43 ,65,0},{44 ,66,0},{45 ,67,0},
+{1 ,0,22},{2 ,1,37},{1 ,2,11},{1 ,3,124},{2 ,4,180},{1 ,5,10},{2 ,6,149},{2 ,7,48},{2 ,8,38},{1 ,9,2},{2 ,10,195},{1 ,11,16},{1 ,12,60},{2 ,13,155},{2 ,14,28},{1 ,15,6},{1 ,16,30},{2 ,17,47},{2 ,18,179},{1 ,19,168},{2 ,20,66},{1 ,21,31},{1 ,22,105},{1 ,23,0},{2 ,24,0},{3 ,25,0},{0 ,0,-1},{0 ,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,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{3 ,0,4},{4 ,1,204},{10 ,2,77},{5 ,3,24},{7 ,4,112},{21 ,5,86},{6 ,6,27},{7 ,7,153},{7 ,8,159},{20 ,9,15},{6 ,10,163},{6 ,11,50},{5 ,12,65},{6 ,13,48},{7 ,14,76},{14 ,15,118},{5 ,16,207},{6 ,17,24},{6 ,18,38},{8 ,19,99},{6 ,20,91},{5 ,21,161},{5 ,22,72},{13 ,23,46},{30 ,24,20},{29 ,25,6},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{4 ,0,24},{5 ,1,100},{23 ,2,18},{8 ,3,131},{10 ,4,156},{0 ,0,-1},{25 ,6,74},{10 ,7,16},{10 ,8,12},{38 ,9,64},{9 ,10,145},{9 ,11,53},{8 ,12,141},{9 ,13,201},{10 ,14,70},{26 ,15,197},{8 ,16,96},{9 ,17,4},{9 ,18,164},{18 ,19,148},{9 ,20,173},{8 ,21,101},{8 ,22,35},{37 ,23,135},{32 ,24,20},{31 ,25,194},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 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 ,4,192},{0 ,0,-1},{35 ,6,45},{19 ,7,166},{27 ,8,22},{44 ,9,142},{15 ,10,81},{16 ,11,160},{14 ,12,202},{15 ,13,182},{25 ,14,28},{36 ,15,177},{14 ,16,130},{17 ,17,3},{15 ,18,53},{39 ,19,188},{16 ,20,122},{14 ,21,2},{16 ,22,182},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{7 ,0,145},{9 ,1,10},{0 ,0,-1},{20 ,3,12},{28 ,4,1},{0 ,0,-1},{45 ,6,45},{25 ,7,16},{40 ,8,84},{0 ,0,-1},{19 ,10,191},{20 ,11,5},{18 ,12,41},{18 ,13,167},{29 ,14,136},{0 ,0,-1},{17 ,16,30},{22 ,17,131},{18 ,18,68},{0 ,0,-1},{21 ,20,42},{17 ,21,155},{20 ,22,30},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},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,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{44 ,0,4},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1}
+};
+
+//--------------------------------------------------BG1_I6-----------------------------------------------------------------
+
+
+//--------------------------------------------------BG1_I7-----------------------------------------------------------------
+h_element host_h_compact1_I7 [46*19] =
+{{0 ,0,135},{1 ,0,96},{2 ,0,189},{3 ,0,128},{4 ,0,64},{5 ,0,2},{6 ,0,199},{7 ,0,77},{8 ,0,181},{9 ,0,169},{10 ,1,116},{11 ,0,45},{12 ,0,186},{13 ,0,220},{14 ,0,124},{15 ,0,39},{16 ,1,78},{17 ,0,183},{18 ,1,183},{19 ,0,179},{20 ,0,77},{21 ,1,197},{22 ,0,25},{23 ,1,185},{24 ,0,32},{25 ,1,27},{26 ,0,163},{27 ,1,165},{28 ,0,32},{29 ,1,232},{30 ,0,170},{31 ,1,73},{32 ,0,103},{33 ,1,199},{34 ,0,161},{35 ,1,231},{36 ,0,11},{37 ,1,59},{38 ,0,121},{39 ,1,115},{40 ,0,4},{41 ,1,53},{42 ,0,222},{43 ,1,22},{44 ,0,191},{45 ,1,177},
+{0 ,1,227},{1 ,2,236},{2 ,1,4},{3 ,1,23},{4 ,1,211},{5 ,1,171},{6 ,6,22},{7 ,1,146},{8 ,1,105},{9 ,1,12},{10 ,2,151},{11 ,1,115},{12 ,1,215},{13 ,3,185},{14 ,12,144},{15 ,1,138},{16 ,3,152},{17 ,14,112},{18 ,12,215},{19 ,1,108},{20 ,3,187},{21 ,5,122},{22 ,12,47},{23 ,2,127},{24 ,3,178},{25 ,6,141},{26 ,2,131},{27 ,6,232},{28 ,4,43},{29 ,14,32},{30 ,10,199},{31 ,7,149},{32 ,12,110},{33 ,2,132},{34 ,7,237},{35 ,6,174},{36 ,14,207},{37 ,13,204},{38 ,9,90},{39 ,3,188},{40 ,8,103},{41 ,3,189},{42 ,4,170},{43 ,16,127},{44 ,7,211},{45 ,6,114},
+{0 ,2,126},{1 ,3,136},{2 ,2,225},{3 ,3,162},{4 ,26,0},{5 ,3,47},{6 ,10,23},{7 ,4,209},{8 ,3,141},{9 ,10,206},{10 ,4,70},{11 ,12,134},{12 ,10,124},{13 ,7,154},{14 ,15,182},{15 ,10,220},{16 ,11,84},{17 ,16,106},{18 ,13,180},{19 ,7,159},{20 ,9,203},{21 ,16,215},{22 ,13,126},{23 ,10,117},{24 ,4,2},{25 ,7,11},{26 ,4,169},{27 ,8,9},{28 ,19,200},{29 ,18,118},{30 ,13,26},{31 ,22,175},{32 ,14,151},{33 ,11,172},{34 ,15,142},{35 ,12,145},{36 ,15,42},{37 ,23,161},{38 ,10,26},{39 ,7,168},{40 ,17,30},{41 ,9,215},{42 ,24,71},{43 ,18,49},{44 ,9,187},{45 ,10,93},
+{0 ,3,134},{1 ,4,221},{2 ,4,151},{3 ,4,220},{0 ,0,-1},{5 ,12,143},{6 ,11,100},{7 ,7,32},{8 ,12,223},{9 ,11,221},{10 ,7,230},{11 ,16,1},{12 ,11,180},{13 ,20,178},{14 ,16,95},{15 ,13,173},{16 ,20,5},{17 ,17,219},{18 ,18,143},{19 ,8,138},{20 ,11,167},{21 ,20,65},{22 ,17,178},{23 ,18,199},{24 ,11,156},{25 ,14,181},{26 ,15,98},{27 ,49,0},{28 ,21,205},{29 ,25,103},{30 ,24,105},{31 ,25,108},{32 ,24,211},{33 ,21,65},{34 ,17,180},{35 ,22,100},{36 ,18,100},{37 ,59,0},{38 ,12,140},{39 ,19,52},{40 ,62,0},{41 ,18,24},{42 ,64,0},{43 ,25,125},{44 ,22,148},{45 ,67,0},
+{0 ,5,84},{1 ,5,128},{2 ,5,236},{3 ,6,43},{0 ,0,-1},{5 ,16,210},{6 ,13,92},{7 ,8,166},{8 ,16,177},{9 ,13,17},{10 ,8,115},{11 ,21,152},{12 ,13,98},{13 ,23,150},{14 ,17,72},{15 ,18,142},{16 ,22,205},{17 ,21,129},{18 ,19,14},{19 ,10,196},{20 ,22,130},{21 ,21,216},{22 ,44,0},{23 ,45,0},{24 ,22,58},{25 ,47,0},{26 ,48,0},{0 ,0,-1},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{0 ,0,-1},{38 ,60,0},{39 ,61,0},{0 ,0,-1},{41 ,63,0},{0 ,0,-1},{43 ,65,0},{44 ,66,0},{0 ,0,-1},
+{0 ,6,83},{1 ,7,92},{2 ,6,117},{3 ,7,186},{0 ,0,-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0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+};
+
+
+h_element host_h_compact2_I7 [68*30] =
+{{0 ,0,135},{0 ,1,227},{0 ,2,126},{0 ,3,134},{1 ,4,221},{0 ,5,84},{0 ,6,83},{1 ,7,92},{1 ,8,172},{0 ,9,53},{0 ,10,225},{0 ,11,205},{0 ,12,128},{0 ,13,75},{1 ,14,95},{0 ,15,135},{0 ,16,217},{1 ,17,87},{0 ,18,220},{0 ,19,90},{0 ,20,105},{0 ,21,137},{0 ,22,1},{0 ,23,0},{1 ,24,0},{2 ,25,0},{4 ,26,0},{5 ,27,0},{6 ,28,0},{7 ,29,0},{8 ,30,0},{9 ,31,0},{10 ,32,0},{11 ,33,0},{12 ,34,0},{13 ,35,0},{14 ,36,0},{15 ,37,0},{16 ,38,0},{17 ,39,0},{18 ,40,0},{19 ,41,0},{20 ,42,0},{21 ,43,0},{22 ,44,0},{23 ,45,0},{24 ,46,0},{25 ,47,0},{26 ,48,0},{27 ,49,0},{28 ,50,0},{29 ,51,0},{30 ,52,0},{31 ,53,0},{32 ,54,0},{33 ,55,0},{34 ,56,0},{35 ,57,0},{36 ,58,0},{37 ,59,0},{38 ,60,0},{39 ,61,0},{40 ,62,0},{41 ,63,0},{42 ,64,0},{43 ,65,0},{44 ,66,0},{45 ,67,0},
+{1 ,0,96},{2 ,1,4},{1 ,2,236},{1 ,3,136},{2 ,4,151},{1 ,5,128},{2 ,6,117},{2 ,7,179},{2 ,8,92},{1 ,9,56},{2 ,10,68},{1 ,11,11},{1 ,12,189},{2 ,13,6},{2 ,14,101},{1 ,15,85},{1 ,16,153},{2 ,17,96},{2 ,18,125},{1 ,19,163},{2 ,20,230},{1 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-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{3 ,0,128},{4 ,1,211},{10 ,2,151},{5 ,3,47},{7 ,4,209},{21 ,5,122},{6 ,6,22},{7 ,7,32},{7 ,8,166},{20 ,9,203},{6 ,10,23},{6 ,11,100},{5 ,12,143},{6 ,13,92},{7 ,14,18},{14 ,15,182},{5 ,16,210},{6 ,17,207},{6 ,18,52},{8 ,19,145},{6 ,20,13},{5 ,21,180},{5 ,22,180},{13 ,23,150},{30 ,24,105},{29 ,25,103},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{4 ,0,64},{5 ,1,171},{23 ,2,127},{8 ,3,141},{10 ,4,70},{0 ,0,-1},{25 ,6,141},{10 ,7,230},{10 ,8,115},{38 ,9,90},{9 ,10,206},{9 ,11,221},{8 ,12,223},{9 ,13,17},{10 ,14,84},{26 ,15,98},{8 ,16,177},{9 ,17,212},{9 ,18,92},{18 ,19,14},{9 ,20,205},{8 ,21,199},{8 ,22,153},{37 ,23,161},{32 ,24,211},{31 ,25,108},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-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,0,-1},{0 ,0,-1},
+{6 ,0,199},{8 ,1,105},{33 ,2,132},{16 ,3,152},{26 ,4,169},{0 ,0,-1},{35 ,6,174},{19 ,7,159},{27 ,8,9},{44 ,9,187},{15 ,10,220},{16 ,11,84},{14 ,12,144},{15 ,13,173},{25 ,14,181},{36 ,15,42},{14 ,16,95},{17 ,17,219},{15 ,18,142},{39 ,19,52},{16 ,20,5},{14 ,21,76},{16 ,22,205},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},
+{7 ,0,77},{9 ,1,12},{0 ,0,-1},{20 ,3,187},{28 ,4,43},{0 ,0,-1},{45 ,6,114},{25 ,7,11},{40 ,8,103},{0 ,0,-1},{19 ,10,196},{20 ,11,167},{18 ,12,215},{18 ,13,180},{29 ,14,32},{0 ,0,-1},{17 ,16,106},{22 ,17,178},{18 ,18,143},{0 ,0,-1},{21 ,20,65},{17 ,21,129},{20 ,22,130},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 ,0,-1},{0 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e178f1047b4f6255b9cdadca7b..931d5003385af8b4144fdbef244ed2176272a90e 100644
--- a/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.cu
+++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.cu
@@ -32,7 +32,7 @@
 #include "bgs/BG2_I6"
 #include "bgs/BG2_I7"
 
-#define MAX_ITERATION 5
+#define MAX_ITERATION 2
 #define MC	1
 
 #define cudaCheck(ans) { cudaAssert((ans), __FILE__, __LINE__); }
@@ -49,13 +49,21 @@ typedef struct{
   char y;
   short value;
 } h_element;
+#include "bgs/BG1_compact_in_C.h"
 
+__device__ char dev_const_llr[68*384];
+__device__ char dev_dt [46*68*384];
+__device__ char dev_llr[68*384];
+__device__ unsigned char dev_tmp[68*384];
 
 h_element h_compact1 [46*19] = {};
 h_element h_compact2 [68*30] = {};
 
-__device__ __constant__ h_element dev_h_compact1[46*19];  // used in kernel 1
-__device__ __constant__ h_element dev_h_compact2[68*30];  // used in kernel 2
+__device__  h_element dev_h_compact1[46*19];  // used in kernel 1
+__device__  h_element dev_h_compact2[68*30];  // used in kernel 2
+
+// __device__ __constant__ h_element dev_h_compact1[46*19];  // used in kernel 1
+// __device__ __constant__ h_element dev_h_compact2[68*30];  // used in kernel 2
 
 // row and col element count
 __device__ __constant__ char h_ele_row_bg1_count[46] = {
@@ -92,9 +100,93 @@ __global__ void warmup()
 	// warm up gpu for time measurement
 }
 
+extern "C"
+void warmup_for_GPU(){
+	
+	warmup<<<20,1024 >>>();
+
+}
+
+extern "C"
+void set_compact_BG(int Zc,short BG){
+	
+	int row,col;
+	if(BG == 1){
+		row = 46;
+		col = 68;
+	}
+	else{
+		row = 42;
+		col = 52;
+	}
+	int compact_row = 30; 
+	int compact_col = 19;
+	if(BG==2){compact_row = 10, compact_col = 23;}
+	int memorySize_h_compact1 = row * compact_col * sizeof(h_element);
+	int memorySize_h_compact2 = compact_row * col * sizeof(h_element);
+	int lift_index = 0;
+	short lift_set[][9] = {
+		{2,4,8,16,32,64,128,256},
+		{3,6,12,24,48,96,192,384},
+		{5,10,20,40,80,160,320},
+		{7,14,28,56,112,224},
+		{9,18,36,72,144,288},
+		{11,22,44,88,176,352},
+		{13,26,52,104,208},
+		{15,30,60,120,240},
+		{0}
+	};
+	
+	for(int i = 0; lift_set[i][0] != 0; i++){
+		for(int j = 0; lift_set[i][j] != 0; j++){
+			if(Zc == lift_set[i][j]){
+				lift_index = i;
+				break;
+			}
+		}
+	}
+	printf("\nZc = %d BG = %d\n",Zc,BG);
+	switch(lift_index){
+			case 0:
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact1, host_h_compact1_I0, memorySize_h_compact1) );
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact2, host_h_compact2_I0, memorySize_h_compact2) );
+				break;
+			case 1:
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact1, host_h_compact1_I1, memorySize_h_compact1) );
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact2, host_h_compact2_I1, memorySize_h_compact2) );
+				break;
+			case 2:
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact1, host_h_compact1_I2, memorySize_h_compact1) );
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact2, host_h_compact2_I2, memorySize_h_compact2) );
+				break;
+			case 3:
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact1, host_h_compact1_I3, memorySize_h_compact1) );
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact2, host_h_compact2_I3, memorySize_h_compact2) );
+				break;
+			case 4:
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact1, host_h_compact1_I4, memorySize_h_compact1) );
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact2, host_h_compact2_I4, memorySize_h_compact2) );
+				break;
+			case 5:
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact1, host_h_compact1_I5, memorySize_h_compact1) );
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact2, host_h_compact2_I5, memorySize_h_compact2) );
+				break;
+			case 6:
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact1, host_h_compact1_I6, memorySize_h_compact1) );
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact2, host_h_compact2_I6, memorySize_h_compact2) );
+				break;
+			case 7:
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact1, host_h_compact1_I7, memorySize_h_compact1) );
+				cudaCheck( cudaMemcpyToSymbol(dev_h_compact2, host_h_compact2_I7, memorySize_h_compact2) );
+				break;
+		}
+	
+	// return 0;
+}
+
 
 // Kernel 1
-__global__ void ldpc_cnp_kernel_1st_iter(char * dev_llr, char * dev_dt, int BG, int row, int col, int Zc)
+__global__ void ldpc_cnp_kernel_1st_iter(/*char * dev_llr,*/ int BG, int row, int col, int Zc)
 {
 //	if(blockIdx.x == 0 && threadIdx.x == 1) printf("cnp %d\n", threadIdx.x);
 	int iMCW = blockIdx.y;		// codeword id
@@ -153,7 +245,7 @@ __global__ void ldpc_cnp_kernel_1st_iter(char * dev_llr, char * dev_dt, int BG,
 	for(int i = 0; i < s; i++){
 		// v0: Best performance so far. 0.75f is the value of alpha.
 		sq = 1 - 2 * ((Q_sign >> i) & 0x01);
-		R_temp = 0.8 * sign * sq * (i != idx_min ? rmin1 : rmin2);
+		R_temp = 0.75f * sign * sq * (i != idx_min ? rmin1 : rmin2);
 		// write results to global memory
 		h_element_t = dev_h_compact1[i*row+iBlkRow];
 		int addr_temp = offsetR + h_element_t.y * row * Zc;
@@ -163,7 +255,7 @@ __global__ void ldpc_cnp_kernel_1st_iter(char * dev_llr, char * dev_dt, int BG,
 }
 
 // Kernel_1
-__global__ void ldpc_cnp_kernel(char * dev_llr, char * dev_dt, int BG, int row, int col, int Zc)
+__global__ void ldpc_cnp_kernel(/*char * dev_llr, char * dev_dt,*/ int BG, int row, int col, int Zc)
 {
 //	if(blockIdx.x == 0 && threadIdx.x == 1) printf("cnp\n");
 	int iMCW = blockIdx.y;
@@ -223,7 +315,7 @@ __global__ void ldpc_cnp_kernel(char * dev_llr, char * dev_dt, int BG, int row,
 //	The 2nd recursion
 	for(int i = 0; i < s; i ++){
 		sq = 1 - 2 * ((Q_sign >> i) & 0x01);
-		R_temp = 0.8 * sign * sq * (i != idx_min ? rmin1 : rmin2);
+		R_temp = 0.75f * sign * sq * (i != idx_min ? rmin1 : rmin2);
 		
 
 		// write results to global memory
@@ -236,7 +328,7 @@ __global__ void ldpc_cnp_kernel(char * dev_llr, char * dev_dt, int BG, int row,
 
 // Kernel 2: VNP processing
 __global__ void
-ldpc_vnp_kernel_normal(char * dev_llr, char * dev_dt, char * dev_const_llr, int BG, int row, int col, int Zc)
+ldpc_vnp_kernel_normal(/*char * dev_llr, char * dev_dt, char * dev_const_llr,*/ int BG, int row, int col, int Zc)
 {	
 	int iMCW = blockIdx.y;
 	int iBlkCol = blockIdx.x;
@@ -276,7 +368,7 @@ ldpc_vnp_kernel_normal(char * dev_llr, char * dev_dt, char * dev_const_llr, int
 }
 
 
-__global__ void pack_decoded_bit(char *dev, unsigned char *host, int col, int Zc)
+__global__ void pack_decoded_bit(/*char *dev, unsigned char *host,*/ int col, int Zc)
 {
 	__shared__ unsigned char tmp[128];
 	int iMCW = blockIdx.y;
@@ -284,15 +376,15 @@ __global__ void pack_decoded_bit(char *dev, unsigned char *host, int col, int Zc
 	int btid = threadIdx.x;
 	tmp[btid] = 0;
 	
-	if(dev[tid] < 0){
+	if(dev_llr[tid] < 0){
 		tmp[btid] = 1 << (7-(btid&7));
 	}
 	__syncthreads();
 	
 	if(threadIdx.x < 16){
-		host[iMCW * col*Zc + blockIdx.x*16+threadIdx.x] = 0;
+		dev_tmp[iMCW * col*Zc + blockIdx.x*16+threadIdx.x] = 0;
 		for(int i = 0; i < 8; i++){
-			host[iMCW * col*Zc + blockIdx.x*16+threadIdx.x] += tmp[threadIdx.x*8+i];
+			dev_tmp[iMCW * col*Zc + blockIdx.x*16+threadIdx.x] += tmp[threadIdx.x*8+i];
 		}
 	}
 }
@@ -369,18 +461,38 @@ void read_BG(int BG, int *h, int row, int col)
 	*/
 }
 
+extern "C"
+void init_LLR_DMA_for_CUDA(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, int block_length){
+	
+	uint16_t Zc          = p_decParams->Z;
+    uint8_t  BG         = p_decParams->BG;
+	uint8_t row,col;
+	if(BG == 1){
+		row = 46;
+		col = 68;
+	}
+	else{
+		row = 42;
+		col = 52;
+	}
+	unsigned char *hard_decision = (unsigned char*)p_out;
+	int memorySize_llr_cuda = col * Zc * sizeof(char) * MC;
+	cudaCheck( cudaMemcpyToSymbol(dev_const_llr, p_llr, memorySize_llr_cuda) );
+	cudaCheck( cudaMemcpyToSymbol(dev_llr, p_llr, memorySize_llr_cuda) );
+	cudaDeviceSynchronize();
+	
+}
 
 extern "C"
 int32_t nrLDPC_decoder_LYC(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, int block_length, time_stats_t *time_decoder)
 {
-	// alloc mem
-	//unsigned char *decision = (unsigned char*)p_out;
+
 
     uint16_t Zc          = p_decParams->Z;
     uint8_t  BG         = p_decParams->BG;
     uint8_t  numMaxIter = p_decParams->numMaxIter;
     e_nrLDPC_outMode outMode = p_decParams->outMode;
-	
+	cudaError_t cudaStatus;
 	uint8_t row,col;
 	if(BG == 1){
 		row = 46;
@@ -390,96 +502,14 @@ int32_t nrLDPC_decoder_LYC(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8
 		row = 42;
 		col = 52;
 	}
-	int compact_row = 30, compact_col = 19, lift_index=0;;
-	if(BG==2){compact_row = 10, compact_col = 23;}
-	
-	short lift_set[][9] = {
-		{2,4,8,16,32,64,128,256},
-		{3,6,12,24,48,96,192,384},
-		{5,10,20,40,80,160,320},
-		{7,14,28,56,112,224},
-		{9,18,36,72,144,288},
-		{11,22,44,88,176,352},
-		{13,26,52,104,208},
-		{15,30,60,120,240},
-		{0}
-	};
-	
-	for(int i = 0; lift_set[i][0] != 0; i++){
-		for(int j = 0; lift_set[i][j] != 0; j++){
-			if(Zc == lift_set[i][j]){
-				lift_index = i;
-				break;
-			}
-		}
-	}
-	
-	int *h = NULL;
-	switch(lift_index){
-		case 0:
-			h = (BG == 1)? h_base_0:h_base_8;
-			break;
-		case 1:
-			h = (BG == 1)? h_base_1:h_base_9;
-			break;
-		case 2:
-			h = (BG == 1)? h_base_2:h_base_10;
-			break;
-		case 3:
-			h = (BG == 1)? h_base_3:h_base_11;
-			break;
-		case 4:
-			h = (BG == 1)? h_base_4:h_base_12;
-			break;
-		case 5:
-			h = (BG == 1)? h_base_5:h_base_13;
-			break;
-		case 6:
-			h = (BG == 1)? h_base_6:h_base_14;
-			break;
-		case 7:
-			h = (BG == 1)? h_base_7:h_base_15;
-			break;
-	}
-	/* pack BG in compact graph */
-	read_BG(BG, h, row, col);
-	
-	
-	int memorySize_h_compact1 = row * compact_col * sizeof(h_element);
-	int memorySize_h_compact2 = compact_row * col * sizeof(h_element);
 
-//	cpu
-	int memorySize_hard_decision = col * Zc * sizeof(unsigned char) * MC;
-	
-	
 //	alloc memory
 	unsigned char *hard_decision = (unsigned char*)p_out;
-	
 //	gpu
 	int memorySize_llr_cuda = col * Zc * sizeof(char) * MC;
-	int memorySize_dt_cuda = row * Zc * col * sizeof(char) * MC;
-
-
-//	alloc memory
-	char *dev_llr;
-	char *dev_dt;
-	char *dev_const_llr;
-	unsigned char *dev_tmp;
+	cudaCheck( cudaMemcpyToSymbol(dev_const_llr, p_llr, memorySize_llr_cuda) );
+	cudaCheck( cudaMemcpyToSymbol(dev_llr, p_llr, memorySize_llr_cuda) );
 	
-	cudaCheck( cudaMalloc((void **)&dev_tmp, memorySize_hard_decision) );
-	cudaCheck( cudaMalloc((void **)&dev_llr, memorySize_llr_cuda) );
-	cudaCheck( cudaMalloc((void **)&dev_const_llr, memorySize_llr_cuda) );
-	cudaCheck( cudaMalloc((void **)&dev_dt, memorySize_dt_cuda) );
-	
-//	memcpy host to device	
-
-	cudaCheck( cudaMemcpyToSymbol(dev_h_compact1, h_compact1, memorySize_h_compact1) );
-	cudaCheck( cudaMemcpyToSymbol(dev_h_compact2, h_compact2, memorySize_h_compact2) );
-	cudaCheck( cudaMemcpy((void*)dev_const_llr, p_llr, memorySize_llr_cuda, cudaMemcpyHostToDevice) );
-start_meas(time_decoder);
-	cudaCheck( cudaMemcpy((void*)dev_llr, p_llr, memorySize_llr_cuda, cudaMemcpyHostToDevice) );
-	
-
 // Define CUDA kernel dimension
 	int blockSizeX = Zc;
 	dim3 dimGridKernel1(row, MC, 1); 	// dim of the thread blocks
@@ -488,61 +518,35 @@ start_meas(time_decoder);
     dim3 dimGridKernel2(col, MC, 1);
     dim3 dimBlockKernel2(blockSizeX, 1, 1);	
 	cudaDeviceSynchronize();
-	
-	cudaEvent_t start, end;
-	float time;
-
-	warmup<<<dimGridKernel1, dimBlockKernel1>>>();
-	warmup<<<dimGridKernel2, dimBlockKernel2>>>();
 
-
-	cudaEventCreate(&start);
-	cudaEventCreate(&end);
-	cudaEventRecord(start, 0);
-	
-//	cudaProfilerStart();
-	
 // lauch kernel 
+
 	for(int ii = 0; ii < MAX_ITERATION; ii++){
 		// first kernel	
 		if(ii == 0){
 			ldpc_cnp_kernel_1st_iter 
 			<<<dimGridKernel1, dimBlockKernel1>>>
-			(dev_llr, dev_dt, BG, row, col, Zc);
+			(/*dev_llr,*/ BG, row, col, Zc);
 		}else{
 			ldpc_cnp_kernel
 			<<<dimGridKernel1, dimBlockKernel1>>>
-			(dev_llr, dev_dt, BG, row, col, Zc);
+			(/*dev_llr,*/ BG, row, col, Zc);
 		}
-		
 		// second kernel
-		
-			ldpc_vnp_kernel_normal
-			<<<dimGridKernel2, dimBlockKernel2>>>
-			(dev_llr, dev_dt, dev_const_llr, BG, row, col, Zc);
-		
+		ldpc_vnp_kernel_normal
+		<<<dimGridKernel2, dimBlockKernel2>>>
+		// (dev_llr, dev_const_llr,BG, row, col, Zc);
+		(BG, row, col, Zc);
 	}
+	
 	int pack = (block_length/128)+1;
 	dim3 pack_block(pack, MC, 1);
-	pack_decoded_bit<<<pack_block,128>>>(dev_llr, dev_tmp, col, Zc);
-
-
-	cudaEventRecord(end, 0);
-	cudaEventSynchronize(end);
-	cudaEventElapsedTime(&time, start, end);
+	pack_decoded_bit<<<pack_block,128>>>(/*dev_llr,*/ /*dev_tmp,*/ col, Zc);
 	
-
-	//cudaCheck( cudaMemcpy((*)hard_decision, (const void*)dev_tmp, memorySize_hard_decision, cudaMemcpyDeviceToHost) );
-	cudaCheck( cudaMemcpy((void*)hard_decision, (const void*)dev_tmp, (block_length/8)*sizeof(unsigned char), cudaMemcpyDeviceToHost) );
+	cudaCheck( cudaMemcpyFromSymbol((void*)hard_decision, (const void*)dev_tmp, (block_length/8)*sizeof(unsigned char)) );
 	cudaDeviceSynchronize();
-stop_meas(time_decoder);
-	
-	cudaCheck( cudaFree(dev_llr) );
-	cudaCheck( cudaFree(dev_dt) );
-	cudaCheck( cudaFree(dev_const_llr) );
-	cudaCheck( cudaFree(dev_tmp) );
 	
-	//free(hard_decision);
+
 	return MAX_ITERATION;
 	
 }
diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h b/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h
index 0e78f988ba899cb457b9302bae9af0e8c9232d85..c290cedf7d101be98bdb31ac8e5d55d7d0eacc3d 100644
--- a/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h
+++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h
@@ -23,4 +23,12 @@
 
 int32_t nrLDPC_decoder_LYC(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, int block_length, time_stats_t *time_decoder);
 
+
+void init_LLR_DMA_for_CUDA(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, int block_length);
+
+void warmup_for_GPU(void);
+
+void set_compact_BG(int Zc, short BG);
+
+
 #endif
diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c
index 2d65521ab39cc381c0fa32cb313030f445402234..2c7e3e88eb5b06cc8c9a03f7e8713266687b06f0 100644
--- a/openair1/PHY/INIT/lte_init.c
+++ b/openair1/PHY/INIT/lte_init.c
@@ -275,6 +275,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
   fp->soundingrs_ul_config_common.srs_MaxUpPts = cfg->srs_config.max_up_pts.value;
   fp->num_MBSFN_config = 0;
   fp->NonMBSFN_config_flag =cfg->fembms_config.non_mbsfn_config_flag.value;
+  fp->FeMBMS_active = fp->NonMBSFN_config_flag;
   fp->NonMBSFN_config.non_mbsfn_SubframeConfig = cfg->fembms_config.non_mbsfn_subframeconfig.value;
   fp->NonMBSFN_config.radioframeAllocationPeriod = cfg->fembms_config.radioframe_allocation_period.value;
   fp->NonMBSFN_config.radioframeAllocationOffset = cfg->fembms_config.radioframe_allocation_offset.value;
diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c
index dddd6b1bd50b134456e540dca75a574ee09ed2cf..baea52083f0cb035262b4517af29b5df970dc8d9 100644
--- a/openair1/PHY/INIT/lte_init_ru.c
+++ b/openair1/PHY/INIT/lte_init_ru.c
@@ -186,7 +186,6 @@ void phy_free_RU(RU_t *ru) {
   int i,j,p;
   RU_CALIBRATION *calibration = &ru->calibration;
   LOG_I(PHY, "Feeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx);
-  free_and_zero(ru->frame_parms);
 
   if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals
     for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdata[i]);
diff --git a/openair1/PHY/INIT/lte_init_ue.c b/openair1/PHY/INIT/lte_init_ue.c
index 082db61da94f53302e9a7a94588060f3fa0ed059..64a5992a64345b80a0550bc90a581e96d75d2bc2 100644
--- a/openair1/PHY/INIT/lte_init_ue.c
+++ b/openair1/PHY/INIT/lte_init_ue.c
@@ -137,7 +137,7 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
       if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
         fp->MBSFN_config[i].fourFrames_flag = 0;
         fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration
-        LOG_I(PHY, "[CONFIG] LTE_MBSFN_SubframeConfig[%d] pattern is  %d\n", i,
+        LOG_I(PHY, "[CONFIG] LTE_MBSFN_SubframeConfig[%d] oneFrame pattern is  %d\n", i,
               fp->MBSFN_config[i].mbsfn_SubframeConfig);
       } else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
         fp->MBSFN_config[i].fourFrames_flag = 1;
@@ -145,7 +145,7 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
           mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]|
           (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
           (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]<<16);
-        LOG_I(PHY, "[CONFIG]  LTE_MBSFN_SubframeConfig[%d] pattern is  %x\n", i,
+        LOG_I(PHY, "[CONFIG]  LTE_MBSFN_SubframeConfig[%d] fourFrame pattern is  %x\n", i,
               fp->MBSFN_config[i].mbsfn_SubframeConfig);
       }
     }
@@ -212,7 +212,7 @@ void phy_config_sib1_fembms_ue(module_id_t Mod_id,int CC_id,
   LTE_DL_FRAME_PARMS *fp = &ue->frame_parms;
 
   if (nonMBSFN_SubframeConfig != NULL) {
-    fp->NonMBSFN_config_flag = 0;
+    fp->NonMBSFN_config_flag = 1;
     fp->NonMBSFN_config.radioframeAllocationPeriod=nonMBSFN_SubframeConfig->radioFrameAllocationPeriod_r14;
     fp->NonMBSFN_config.radioframeAllocationOffset=nonMBSFN_SubframeConfig->radioFrameAllocationOffset_r14;
     fp->NonMBSFN_config.non_mbsfn_SubframeConfig=(nonMBSFN_SubframeConfig->subframeAllocation_r14.buf[0]<<1 | nonMBSFN_SubframeConfig->subframeAllocation_r14.buf[0]>>7);
diff --git a/openair1/PHY/INIT/lte_parms.c b/openair1/PHY/INIT/lte_parms.c
index 12a5646df652e7237195d80f57ef75d05a33abce..f5b7a6c7e86022f5a2e8e389e78957a8830de204 100644
--- a/openair1/PHY/INIT/lte_parms.c
+++ b/openair1/PHY/INIT/lte_parms.c
@@ -93,6 +93,11 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,
 
       frame_parms->N_RBGS = 4;
       frame_parms->N_RBG = 25;
+      frame_parms->ofdm_symbol_size_khz_1dot25     = 2*2*6144*osf;
+      frame_parms->first_carrier_offset_khz_1dot25 = frame_parms->ofdm_symbol_size_khz_1dot25 - 1800*2*2;
+      frame_parms->nb_prefix_samples_khz_1dot25>>=(2-log2_osf);
+      frame_parms->nb_prefix_samples0_khz_1dot25>>=(2-log2_osf);
+
       break;
 
     case 75:
@@ -104,6 +109,12 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,
       frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
       frame_parms->N_RBGS = 4;
       frame_parms->N_RBG = 25;
+
+      frame_parms->ofdm_symbol_size_khz_1dot25     = 2*6144*osf;
+      frame_parms->first_carrier_offset_khz_1dot25 = frame_parms->ofdm_symbol_size_khz_1dot25 - 1800*2; 
+      frame_parms->nb_prefix_samples_khz_1dot25>>=(2-log2_osf);
+      frame_parms->nb_prefix_samples0_khz_1dot25>>=(2-log2_osf);
+
       break;
 
     case 50:
@@ -115,6 +126,10 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,
       frame_parms->nb_prefix_samples0>>=(1-log2_osf);
       frame_parms->N_RBGS = 3;
       frame_parms->N_RBG = 17;
+      frame_parms->ofdm_symbol_size_khz_1dot25     = 2*6144*osf;
+      frame_parms->first_carrier_offset_khz_1dot25 = frame_parms->ofdm_symbol_size_khz_1dot25 - 1800*2; 
+      frame_parms->nb_prefix_samples_khz_1dot25>>=(2-log2_osf);
+      frame_parms->nb_prefix_samples0_khz_1dot25>>=(2-log2_osf);
       break;
 
     case 25:
diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c
index c1509d6c657fd6a3a2939c7596f37430e5ecd9b0..ad648f12be767a122f915832c5046f622edd66f6 100644
--- a/openair1/PHY/INIT/nr_init.c
+++ b/openair1/PHY/INIT/nr_init.c
@@ -132,6 +132,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
     }
   }
 
+  nr_generate_modulation_table();
   nr_init_pdcch_dmrs(gNB, cfg->cell_config.phy_cell_id.value);
   nr_init_pbch_interleaver(gNB->nr_pbch_interleaver);
   //PDSCH DMRS init
diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c
index 8b70b523a50b8ed45e1cd529a9294cc1cf367e36..28b13112ce608d246f49a6f09a4d1258ba9ebec4 100644
--- a/openair1/PHY/INIT/nr_init_ru.c
+++ b/openair1/PHY/INIT/nr_init_ru.c
@@ -121,9 +121,9 @@ int nr_phy_init_RU(RU_t *ru) {
     LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst);
     
     int beam_count = 0;
-    if (ru->nb_log_antennas>1) {
+    if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1
       for (p=0;p<ru->nb_log_antennas;p++) {
-        if ((fp->L_ssb >> p) & 0x01)
+        if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0
           beam_count++;
       }
       AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx));
@@ -131,7 +131,7 @@ int nr_phy_init_RU(RU_t *ru) {
       int l_ind = 0;
       for (i=0; i<RC.nb_nr_L1_inst; i++) {
         for (p=0;p<ru->nb_log_antennas;p++) {
-          if ((fp->L_ssb >> p) & 0x01)  {
+          if ((fp->L_ssb >> (63-p)) & 0x01)  {
 	    ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
 	    for (j=0; j<ru->nb_tx; j++) {
 	      ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index 1729ac0d9e3eee312da2f4e9233fe52625243a67..fed58dea12ddbbe5da86228ab7caecfbef8dfa40 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -39,6 +39,7 @@
 #include "PHY/NR_REFSIG/pss_nr.h"
 #include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
 #include "PHY/NR_REFSIG/refsig_defs_ue.h"
+#include "PHY/NR_REFSIG/nr_refsig.h"
 
 //uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
 
@@ -681,6 +682,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
     ue->bitrate[eNB_id] = 0;
     ue->total_received_bits[eNB_id] = 0;
   }
+  // init NR modulation lookup tables
+  nr_generate_modulation_table();
 
   /////////////////////////PUSCH init/////////////////////////
   ///////////
diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c
index c3fe9c54b1b065a1776d5691807caf45e7e00562..6045930b17e3f2b7d1c2cd11abc3ec83b07d4124 100644
--- a/openair1/PHY/INIT/nr_parms.c
+++ b/openair1/PHY/INIT/nr_parms.c
@@ -308,7 +308,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
   int num_tx_ant = (cfg == NULL) ? fp->Lmax : cfg->carrier_config.num_tx_ant.value;
 
   for (int p=0; p<num_tx_ant; p++)
-    fp->N_ssb += ((fp->L_ssb >> p) & 0x01);
+    fp->N_ssb += ((fp->L_ssb >> (63-p)) & 0x01);
 
   return 0;
 
@@ -389,7 +389,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
   
   fp->N_ssb = 0;
   for (int p=0; p<fp->Lmax; p++)
-    fp->N_ssb += ((fp->L_ssb >> p) & 0x01);
+    fp->N_ssb += ((fp->L_ssb >> (63-p)) & 0x01);
 
   return 0;
 }
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
index 333a6f08665ef8a34dd6c0a4ad480f931264aba8..4ad050ccea24e42c8b9bfbbe143086707dc588a6 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
@@ -22,7 +22,7 @@
 /*! \file config_ue.c
  * \brief This includes FeMBMS UE Channel Estimation Procedures for FeMBMS 1.25KHz Carrier Spacing
  * \author Javier Morgade
- * \date 2019
+ * \date 2020
  * \version 0.1
  * \email: javier.morgade@ieee.org
  * @ingroup _phy
@@ -768,8 +768,8 @@ int lte_dl_mbsfn_khz_1dot25_channel_estimation(PHY_VARS_UE *ue,
     module_id_t eNB_id,
     uint8_t eNB_offset,
     int subframe) {
-  int pilot_khz_1dot25[600] __attribute__((aligned(16)));
-  unsigned char aarx/*,aa*/;
+  int pilot_khz_1dot25[2*2*600] __attribute__((aligned(16)));
+  unsigned char aarx,aa;
   //unsigned int rb;
   int16_t ch[2];
   short *pil,*rxF,*dl_ch/*,*ch0,*ch1,*ch11,*chp,*ch_prev*/;
@@ -783,7 +783,7 @@ int lte_dl_mbsfn_khz_1dot25_channel_estimation(PHY_VARS_UE *ue,
   int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF;
   ch_offset     = 0;//(l*(ue->frame_parms.ofdm_symbol_size));
   symbol_offset = 0;//ch_offset;//phy_vars_ue->lte_frame_parms.ofdm_symbol_size*l;
-  AssertFatal( ue->frame_parms.N_RB_DL==25,"OFDM symbol size %d not yet supported for FeMBMS\n",ue->frame_parms.N_RB_DL);
+  //AssertFatal( ue->frame_parms.N_RB_DL==25,"OFDM symbol size %d not yet supported for FeMBMS\n",ue->frame_parms.N_RB_DL);
 
   if( (subframe&0x1) == 0) {
     f=filt24_0_khz_1dot25;
@@ -823,7 +823,7 @@ int lte_dl_mbsfn_khz_1dot25_channel_estimation(PHY_VARS_UE *ue,
       k=3;
     }
 
-    if(ue->frame_parms.N_RB_DL==25) {
+    if(1/*ue->frame_parms.N_RB_DL==25*/) {
       ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
       ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
       multadd_real_vector_complex_scalar(fl,
@@ -843,7 +843,7 @@ int lte_dl_mbsfn_khz_1dot25_channel_estimation(PHY_VARS_UE *ue,
       rxF+=12;
       dl_ch+=16;
 
-      for(pilot_cnt=2; pilot_cnt<299; pilot_cnt+=2) {
+      for(pilot_cnt=2; pilot_cnt<ue->frame_parms.N_RB_DL*12-1/*299*/; pilot_cnt+=2) {
         ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
         ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
         multadd_real_vector_complex_scalar(f,
@@ -866,7 +866,7 @@ int lte_dl_mbsfn_khz_1dot25_channel_estimation(PHY_VARS_UE *ue,
 
       rxF   = (int16_t *)&rxdataF[aarx][((symbol_offset+1+k))]; //Skip DC offset
 
-      for(pilot_cnt=0; pilot_cnt<297; pilot_cnt+=2) {
+      for(pilot_cnt=0; pilot_cnt<ue->frame_parms.N_RB_DL*12-3/*297*/; pilot_cnt+=2) {
         ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
         ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
         multadd_real_vector_complex_scalar(f,
@@ -905,6 +905,32 @@ int lte_dl_mbsfn_khz_1dot25_channel_estimation(PHY_VARS_UE *ue,
     }
   }
 
+ // do ifft of channel estimate
+  for (aa=0; aa<ue->frame_parms.nb_antennas_rx*ue->frame_parms.nb_antennas_tx; aa++) {
+    if (ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[0][aa]) {
+      switch (ue->frame_parms.N_RB_DL) {
+      case 25:
+        idft(IDFT_6144,(int16_t*) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[0][aa][8],
+                (int16_t*) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[0][aa],
+                1);
+        break;
+      case 50:
+        idft(IDFT_12288,(int16_t*) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[0][aa][8],
+                (int16_t*) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[0][aa],
+                1);
+        break;
+     case 100:
+        idft(IDFT_24576,(int16_t*) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[0][aa][8],
+                (int16_t*) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[0][aa],
+                1);
+        break;
+      default:
+        break;
+      }
+    }
+  }
+
+
   return(0);
 }
 
diff --git a/openair1/PHY/LTE_REFSIG/lte_refsig.h b/openair1/PHY/LTE_REFSIG/lte_refsig.h
index 45402436f70abbc6756682b999fe1532f5c74c6e..84a2676082fe151c208e31709cd4d0078b2fb012 100644
--- a/openair1/PHY/LTE_REFSIG/lte_refsig.h
+++ b/openair1/PHY/LTE_REFSIG/lte_refsig.h
@@ -106,6 +106,16 @@ int lte_dl_mbsfn(PHY_VARS_eNB *phy_vars_eNB, int32_t *output,
                  short amp,
                  int subframe,
                  unsigned char l);
+/*! \brief This function generates the 1.25KHz MBSFN reference signal sequence (36-211, Sec 6.10.1.2)
+@param phy_vars_eNB Pointer to eNB variables
+@param output Output vector for OFDM symbol (Frequency Domain)
+@param amp Q15 amplitude
+*/
+
+int lte_dl_mbsfn_khz_1dot25(PHY_VARS_eNB *phy_vars_eNB, int32_t *output,
+                 short amp,
+                 int subframe);
+
 
 
 /*!\brief This function generates the cell-specific reference signal sequence (36-211, Sec 6.10.1.1) for channel estimation upon reception
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
index 14036ad43a284eb5f9628dda696d4aa4e3a06c7d..3eb44d98fa69abb1935cd7d24e4ea7d0a95ada5f 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
@@ -20,12 +20,12 @@
  */
 
 /*! \file PHY/LTE_TRANSPORT/dlsch_coding.c
- * \brief Top-level routines for implementing Turbo-coded (DLSCH) transport channels from 36-212, V8.6 2009-03
- * \author R. Knopp
+ * \brief Top-level routines for implementing Turbo-coded (DLSCH) transport channels from 36-212, V8.6 2009-03, V14.1 2017 (includes FeMBMS support)
+ * \author R. Knopp, J. Morgade
  * \date 2011
  * \version 0.1
  * \company Eurecom
- * \email: knopp@eurecom.fr
+ * \email: knopp@eurecom.fr, jaiver.morgade@ieee.org
  * \note
  * \warning
  */
@@ -425,3 +425,108 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
   return(0);
 }
+
+int dlsch_encoding_fembms_pmch(PHY_VARS_eNB *eNB,
+                   L1_rxtx_proc_t *proc,
+                   unsigned char *a,
+                   uint8_t num_pdcch_symbols,
+                   LTE_eNB_DLSCH_t *dlsch,
+                   int frame,
+                   uint8_t subframe,
+                   time_stats_t *rm_stats,
+                   time_stats_t *te_stats,
+                   time_stats_t *i_stats) {
+  LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
+  unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
+  if((harq_pid < 0) || (harq_pid >= dlsch->Mdlharq)) {
+    LOG_E(PHY,"dlsch_encoding illegal harq_pid %d %s:%d\n", harq_pid, __FILE__, __LINE__);
+    return(-1);
+  }
+
+  LTE_DL_eNB_HARQ_t *hadlsch=dlsch->harq_processes[harq_pid];
+  uint8_t beamforming_mode=0;
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
+
+  if(hadlsch->mimo_mode == TM7)
+    beamforming_mode = 7;
+  else if(hadlsch->mimo_mode == TM8)
+    beamforming_mode = 8;
+  else if(hadlsch->mimo_mode == TM9_10)
+    beamforming_mode = 9;
+
+  unsigned int G = get_G_khz_1dot25(frame_parms,hadlsch->nb_rb,
+	    hadlsch->rb_alloc,
+	    hadlsch->Qm, // mod order
+	    hadlsch->Nl,
+	    num_pdcch_symbols,
+	    frame,subframe,beamforming_mode);
+
+  proc->nbEncode=0;
+
+  //  if (hadlsch->Ndi == 1) {  // this is a new packet
+  if (hadlsch->round == 0) {  // this is a new packet
+    // Add 24-bit crc (polynomial A) to payload
+    unsigned int A=hadlsch->TBS; //6228;
+    unsigned int crc = crc24a(a,
+                 A)>>8;
+    a[A>>3] = ((uint8_t *)&crc)[2];
+    a[1+(A>>3)] = ((uint8_t *)&crc)[1];
+    a[2+(A>>3)] = ((uint8_t *)&crc)[0];
+    //    printf("CRC %x (A %d)\n",crc,A);
+    hadlsch->B = A+24;
+    //    hadlsch->b = a;
+    memcpy(hadlsch->b,a,(A/8)+4);
+    
+    if (lte_segmentation(hadlsch->b,
+                         hadlsch->c,
+                         hadlsch->B,
+                         &hadlsch->C,
+                         &hadlsch->Cplus,
+                         &hadlsch->Cminus,
+                         &hadlsch->Kplus,
+                         &hadlsch->Kminus,
+                         &hadlsch->F)<0)
+      return(-1);
+  }
+ 
+  for (int r=0, r_offset=0; r<hadlsch->C; r++) {
+    
+    union turboReqUnion id= {.s={dlsch->rnti,frame,subframe,r,0}};
+    notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(turboEncode_t), id.p, proc->respEncode, TPencode);
+    turboEncode_t * rdata=(turboEncode_t *) NotifiedFifoData(req);
+    rdata->input=hadlsch->c[r];
+    rdata->Kr_bytes= ( r<hadlsch->Cminus ? hadlsch->Kminus : hadlsch->Kplus) >>3;
+    rdata->filler=(r==0) ? hadlsch->F : 0;
+    rdata->r=r;
+    rdata->harq_pid=harq_pid;
+    rdata->dlsch=dlsch;
+    rdata->rm_stats=rm_stats;
+    rdata->te_stats=te_stats;
+    rdata->i_stats=i_stats;
+    rdata->round=hadlsch->round;
+    rdata->r_offset=r_offset;
+    rdata->G=G;
+    
+    if (  proc->threadPool->activated ) {
+      pushTpool(proc->threadPool,req);
+      proc->nbEncode++;
+    } else {
+      TPencode(rdata);
+      delNotifiedFIFO_elt(req);
+    }
+    
+    int Qm=hadlsch->Qm;
+    int C=hadlsch->C;
+    int Nl=hadlsch->Nl;
+    int Gp = G/Nl/Qm;
+    int GpmodC = Gp%C;
+    if (r < (C-(GpmodC)))
+      r_offset += Nl*Qm * (Gp/C);
+    else
+      r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
+  }
+
+  return(0);
+}
+
+
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
index 475c8bd521d8ea8b777d3bf04a40e799497858cd..8c07421b7e2bd017e0c0e270167f49a939680440 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
@@ -20,12 +20,12 @@
  */
 
 /*! \file PHY/LTE_TRANSPORT/dlsch_modulation.c
- * \brief Top-level routines for generating the PDSCH physical channel from 36-211, V8.6 2009-03
- * \author R. Knopp, F. Kaltenberger
+ * \brief Top-level routines for generating the PDSCH physical channel from 36-211, V8.6 2009-03, V14.1 2017 (FeMBMS)
+ * \author R. Knopp, F. Kaltenberger, J. Morgade
  * \date 2011
  * \version 0.1
  * \company Eurecom
- * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+ * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, javier.morgade@ieee.irg
  * \note
  * \warning
  */
@@ -2910,3 +2910,260 @@ int mch_modulation(int32_t **txdataF,
 
   return (re_allocated);
 }
+
+int allocate_REs_in_RB_MCH_khz_1dot25(int32_t **txdataF,
+                           uint32_t *jj,
+                            uint16_t re_offset,
+                            uint32_t symbol_offset,
+                            uint8_t *x0,
+                            uint8_t subframe,
+                            uint8_t mod_order,
+                            int16_t amp,
+                            int16_t *qam_table_s,
+                            uint32_t *re_allocated,
+                            uint8_t skip_dc,
+                            LTE_DL_FRAME_PARMS *frame_parms)
+{
+ uint32_t tti_offset;
+  uint8_t re,offset;
+  uint8_t qam64_table_offset_re = 0;
+  uint8_t qam64_table_offset_im = 0;
+  uint8_t qam16_table_offset_re = 0;
+  uint8_t qam16_table_offset_im = 0;
+  int16_t gain_lin_QPSK;//,gain_lin_16QAM1,gain_lin_16QAM2;
+  int16_t re_off=re_offset;
+  gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15);
+  uint8_t first_re,last_re;
+  int inc;
+#ifdef DEBUG_DLSCH_MODULATION
+  LOG_I(PHY,"allocate_re_MCH khz_1dot25 (mod %d): symbol_offset %d re_offset %d (%d), jj %d -> %d,%d, gain_lin_QPSK %d,txdataF %p\n",mod_order,symbol_offset,re_offset,skip_dc,*jj, x0[*jj], x0[1+*jj],gain_lin_QPSK,&txdataF[0][symbol_offset]);
+#endif
+
+  /*last_re=12;
+  first_re=0;
+  inc=1;
+
+  if ((l==2)||(l==10)) {
+    inc=2;
+    first_re=1;
+  } else if (l==6) {
+    inc=2;
+  }*/
+  last_re=144; //12*12
+  if ((subframe&0x1)==0){ // n_sf mod 2 == 0: even
+        first_re=1;
+        offset=0;
+  }else{
+        first_re=0;
+        offset=3;
+  }
+  inc=1;
+
+  for (re=first_re; re<last_re; re+=inc) {
+    if( ((re-offset)%6) == 0  )
+                continue; //pilot
+    //if ((subframe&0x1)==0) // n_sf mod 2 == 0: even
+        //k = 6*m;
+    //else
+        //k = 6*m + 3;
+    //if ((skip_dc == 1) && (re==(6+first_re)))
+    if ((skip_dc == 1) && (re==(72+first_re))){
+      re_off=re_off - frame_parms->ofdm_symbol_size_khz_1dot25+1;
+    }
+
+        tti_offset = symbol_offset + re_off + re;
+
+    //LOG_I(PHY,"re %d (jj %d)\n",re,*jj);
+    *re_allocated = *re_allocated + 1;
+
+
+    switch (mod_order) {
+
+      case 2:  //QPSK
+
+                  LOG_D(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+      ((int16_t*)&txdataF[0][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
+
+      *jj = *jj + 1;
+
+      ((int16_t*)&txdataF[0][tti_offset])[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
+
+      *jj = *jj + 1;
+
+      LOG_D(PHY,"subframe%d alloc[%d][%d][%d](%d,%d)\n",subframe,tti_offset,symbol_offset,tti_offset-symbol_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+      break;
+
+
+      case 4:  //16QAM
+
+    qam16_table_offset_re = 0;
+    qam16_table_offset_im = 0;
+
+    if (x0[*jj] == 1)
+      qam16_table_offset_re+=2;
+
+    *jj=*jj+1;
+
+    if (x0[*jj] == 1)
+      qam16_table_offset_im+=2;
+
+    *jj=*jj+1;
+
+
+    if (x0[*jj] == 1)
+      qam16_table_offset_re+=1;
+
+    *jj=*jj+1;
+
+    if (x0[*jj] == 1)
+      qam16_table_offset_im+=1;
+
+    *jj=*jj+1;
+
+
+    ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s[qam16_table_offset_re];//(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
+    ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s[qam16_table_offset_im];//(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
+
+    break;
+
+      case 6:  //64QAM
+
+        qam64_table_offset_re = 0;
+    qam64_table_offset_im = 0;
+
+    if (x0[*jj] == 1)
+      qam64_table_offset_re+=4;
+
+    *jj=*jj+1;
+
+    if (x0[*jj] == 1)
+      qam64_table_offset_im+=4;
+
+    *jj=*jj+1;
+
+    if (x0[*jj] == 1)
+      qam64_table_offset_re+=2;
+
+    *jj=*jj+1;
+
+    if (x0[*jj] == 1)
+      qam64_table_offset_im+=2;
+
+    *jj=*jj+1;
+
+    if (x0[*jj] == 1)
+      qam64_table_offset_re+=1;
+
+    *jj=*jj+1;
+
+    if (x0[*jj] == 1)
+      qam64_table_offset_im+=1;
+
+    *jj=*jj+1;
+
+    ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
+    ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
+
+    break;
+
+    }
+  }
+  return(0);
+}
+
+int mch_modulation_khz_1dot25(int32_t **txdataF,
+                   int16_t amp,
+                   uint32_t subframe_offset,
+                   LTE_DL_FRAME_PARMS *frame_parms,
+                   LTE_eNB_DLSCH_t *dlsch)
+{
+  uint8_t nsymb,nsymb_pmch;
+  uint32_t i,jj,re_allocated,symbol_offset;
+  uint16_t l,rb,re_offset;
+  uint8_t skip_dc=0;
+  uint8_t mod_order = dlsch->harq_processes[0]->Qm;
+  int16_t qam16_table_a[4],qam64_table_a[8];//,qam16_table_b[4],qam64_table_b[8];
+  int16_t *qam_table_s;
+
+  nsymb_pmch = 1;
+  nsymb = (frame_parms->Ncp == NORMAL) ? 14 : 12;
+
+  if (mod_order == 4)
+    for (i=0; i<4; i++) {
+      qam16_table_a[i] = (int16_t)(((int32_t)qam16_table[i]*amp)>>15);
+    }
+  else if (mod_order == 6)
+    for (i=0; i<8; i++) {
+      qam64_table_a[i] = (int16_t)(((int32_t)qam64_table[i]*amp)>>15);
+    }
+
+  jj=0;
+  re_allocated=0;
+
+
+
+
+
+  //  LOG_I(PHY,"num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
+  for (l=0; l<nsymb_pmch; l++) {
+
+#ifdef DEBUG_DLSCH_MODULATION
+    LOG_I(PHY,"Generating khz_1dot25 MCH (mod %d) in subframe %d for symbol %d\n",mod_order, subframe_offset,l);
+#endif
+
+    re_offset = frame_parms->first_carrier_offset_khz_1dot25;
+    symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb));
+
+    for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
+
+
+      if ((frame_parms->N_RB_DL&1) == 1) { // ODD N_RB_DL
+
+        if (rb==(frame_parms->N_RB_DL>>1))
+          skip_dc = 1;
+        else
+          skip_dc = 0;
+
+      }
+
+      if (mod_order == 4)
+        qam_table_s = qam16_table_a;
+      else if (mod_order == 6)
+        qam_table_s = qam64_table_a;
+      else
+        qam_table_s = NULL;
+
+      //LOG_I(PHY,"Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
+      allocate_REs_in_RB_MCH_khz_1dot25(txdataF,
+                             &jj,
+                             re_offset,
+                             symbol_offset,
+                             dlsch->harq_processes[0]->eDL,
+                             subframe_offset,
+                             mod_order,
+                             amp,
+                             qam_table_s,
+                             &re_allocated,
+                             skip_dc,
+                             frame_parms);
+
+      re_offset+=144; // go to next RB 12*12
+
+      // check if we crossed the symbol boundary and skip DC
+      if (re_offset >= frame_parms->ofdm_symbol_size_khz_1dot25) {
+        if (skip_dc == 0)  //even number of RBs (doesn't straddle DC)
+          re_offset=1;
+        else
+          re_offset=73;  // odd number of RBs
+      }
+    }
+  }
+
+#ifdef DEBUG_DLSCH_MODULATION
+  LOG_I(PHY,"generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset,1/*transmission mode*/));
+  LOG_I(PHY,"generate_dlsch(MCH) : jj = %d,re_allocated = %d\n",jj,re_allocated);
+#endif
+
+  return (re_allocated);
+}
+
diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c
index 37997c94b49e97b8acd53c83673e75dc0caac716..dfa990269ec864293d57ebf0eac259cd4d483b91 100644
--- a/openair1/PHY/LTE_TRANSPORT/pbch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pbch.c
@@ -20,12 +20,12 @@
  */
 
 /*! \file PHY/LTE_TRANSPORT/pbch.c
-* \brief Top-level routines for generating and decoding  the PBCH/BCH physical/transport channel V8.6 2009-03
-* \author R. Knopp, F. Kaltenberger
+* \brief Top-level routines for generating and decoding  the PBCH/BCH physical/transport channel V8.6 2009-03, V14.1 (FeMBMS)
+* \author R. Knopp, F. Kaltenberger, J. Morgade
 * \date 2011
 * \version 0.1
 * \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger.fr
+* \email: knopp@eurecom.fr,florian.kaltenberger.fr, javier.morgade@ieee.org
 * \note
 * \warning
 */
@@ -139,6 +139,285 @@ int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
   return(0);
 }
 
+void pbch_scrambling_fembms(LTE_DL_FRAME_PARMS *frame_parms,
+                     uint8_t *pbch_e,
+                     uint32_t length)
+{
+  int i;
+  uint8_t reset;
+  uint32_t x1, x2, s=0;
+
+  reset = 1;
+  // x1 is set in lte_gold_generic
+  x2 = frame_parms->Nid_cell + (1<<9); //this is c_init for FeMBMS in 36.211 Sec 6.6.1
+  //  msg("pbch_scrambling: Nid_cell = %d\n",x2);
+
+  for (i=0; i<length; i++) {
+    if ((i&0x1f)==0) {
+      s = lte_gold_generic(&x1, &x2, reset);
+      //      printf("lte_gold[%d]=%x\n",i,s);
+      reset = 0;
+    }
+
+    pbch_e[i] = (pbch_e[i]&1) ^ ((s>>(i&0x1f))&1);
+
+  }
+}
+
+int generate_pbch_fembms(LTE_eNB_PBCH *eNB_pbch,
+                  int32_t **txdataF,
+                  int amp,
+                  LTE_DL_FRAME_PARMS *frame_parms,
+                  uint8_t *pbch_pdu,
+                  uint8_t frame_mod4)
+{
+
+  int i, l;
+
+  uint32_t  pbch_D,pbch_E;//,pbch_coded_bytes;
+  uint8_t pbch_a[PBCH_A>>3];
+  uint8_t RCC;
+
+  uint32_t nsymb = (frame_parms->Ncp==NORMAL) ? 14:12;
+  uint32_t pilots;
+#ifdef INTERFERENCE_MITIGATION
+  uint32_t pilots_2;
+#endif
+  uint32_t second_pilot = (frame_parms->Ncp==NORMAL) ? 4 : 3;
+  uint32_t jj=0;
+  uint32_t re_allocated=0;
+  uint32_t rb, re_offset, symbol_offset;
+  uint16_t amask=0;
+
+  pbch_D    = 16+PBCH_A;
+
+  pbch_E  = (frame_parms->Ncp==NORMAL) ? 1920 : 1728; //RE/RB * #RB * bits/RB (QPSK)
+  //  pbch_E_bytes = pbch_coded_bits>>3;
+
+  LOG_D(PHY,"%s(eNB_pbch:%p txdataF:%p amp:%d frame_parms:%p pbch_pdu:%p frame_mod4:%d)\n", __FUNCTION__, eNB_pbch, txdataF, amp, frame_parms, pbch_pdu, frame_mod4==0);
+
+  if (frame_mod4==0) {
+    bzero(pbch_a,PBCH_A>>3);
+    bzero(eNB_pbch->pbch_e,pbch_E);
+    memset(eNB_pbch->pbch_d,LTE_NULL,96);
+    // Encode data
+
+    // CRC attachment
+    //  crc = (uint16_t) (crc16(pbch_pdu, pbch_crc_bits-16) >> 16);
+
+    /*
+    // scramble crc with PBCH CRC mask (Table 5.3.1.1-1 of 3GPP 36.212-860)
+    switch (frame_parms->nb_antenna_ports_eNB) {
+    case 1:
+    crc = crc ^ (uint16_t) 0;
+    break;
+    case 2:
+    crc = crc ^ (uint16_t) 0xFFFF;
+    break;
+    case 4:
+    crc = crc ^ (uint16_t) 0xAAAA;
+    break;
+    default:
+    msg("[PBCH] Unknown number of TX antennas!\n");
+    break;
+    }
+    */
+
+    // Fix byte endian of PBCH (bit 23 goes in first)
+    for (i=0; i<(PBCH_A>>3); i++)
+      pbch_a[(PBCH_A>>3)-i-1] = pbch_pdu[i];
+
+    //  pbch_data[i] = ((char*) &crc)[0];
+    //  pbch_data[i+1] = ((char*) &crc)[1];
+    //#ifdef DEBUG_PBCH
+
+    for (i=0; i<(PBCH_A>>3); i++)
+      LOG_D(PHY,"[PBCH] pbch_data[%d] = %x\n",i,pbch_a[i]);
+
+    //#endif
+
+    if (frame_parms->nb_antenna_ports_eNB == 1)
+      amask = 0x0000;
+    else {
+      switch (frame_parms->nb_antenna_ports_eNB) {
+      case 1:
+        amask = 0x0000;
+        break;
+
+      case 2:
+        amask = 0xffff;
+        break;
+
+      case 4:
+        amask = 0x5555;
+      }
+    }
+
+    ccodelte_encode(PBCH_A,2,pbch_a,eNB_pbch->pbch_d+96,amask);
+
+
+#ifdef DEBUG_PBCH_ENCODING
+
+    for (i=0; i<16+PBCH_A; i++)
+      LOG_D(PHY,"%d : (%d,%d,%d)\n",i,*(eNB_pbch->pbch_d+96+(3*i)),*(eNB_pbch->pbch_d+97+(3*i)),*(eNB_pbch->pbch_d+98+(3*i)));
+
+#endif //DEBUG_PBCH_ENCODING
+
+    // Bit collection
+    /*
+      j2=0;
+      for (j=0;j<pbch_crc_bits*3+12;j++) {
+      if ((pbch_coded_data[j]&0x80) > 0) { // bit is to be transmitted
+      pbch_coded_data2[j2++] = pbch_coded_data[j]&1;
+      //Bit is repeated
+      if ((pbch_coded_data[j]&0x40)>0)
+      pbch_coded_data2[j2++] = pbch_coded_data[j]&1;
+      }
+      }
+
+      #ifdef DEBUG_PBCH
+      msg("[PBCH] rate matched bits=%d, pbch_coded_bits=%d, pbch_crc_bits=%d\n",j2,pbch_coded_bits,pbch_crc_bits);
+      #endif
+
+      #ifdef DEBUG_PBCH
+      LOG_M"pbch_encoded_output2.m","pbch_encoded_out2",
+      pbch_coded_data2,
+      pbch_coded_bits,
+      1,
+      4);
+      #endif //DEBUG_PBCH
+    */
+#ifdef DEBUG_PBCH_ENCODING
+    LOG_D(PHY,"Doing PBCH interleaving for %d coded bits, e %p\n",pbch_D,eNB_pbch->pbch_e);
+#endif
+    RCC = sub_block_interleaving_cc(pbch_D,eNB_pbch->pbch_d+96,eNB_pbch->pbch_w);
+
+    lte_rate_matching_cc(RCC,pbch_E,eNB_pbch->pbch_w,eNB_pbch->pbch_e);
+
+#ifdef DEBUG_PBCH_ENCODING
+    LOG_D(PHY,"PBCH_e:\n");
+
+    for (i=0; i<pbch_E; i++)
+      LOG_D(PHY,"%d %d\n",i,*(eNB_pbch->pbch_e+i));
+
+    LOG_D(PHY,"\n");
+#endif
+
+
+
+#ifdef DEBUG_PBCH
+    if (frame_mod4==0) {
+      LOG_M("pbch_e.m","pbch_e",
+                   eNB_pbch->pbch_e,
+                   pbch_E,
+                   1,
+                   4);
+
+      for (i=0; i<16; i++)
+        printf("e[%d] %d\n",i,eNB_pbch->pbch_e[i]);
+    }
+#endif //DEBUG_PBCH
+    // scrambling
+
+    pbch_scrambling_fembms(frame_parms,
+                    eNB_pbch->pbch_e,
+                    pbch_E);
+#ifdef DEBUG_PBCH
+    if (frame_mod4==0) {
+      LOG_M("pbch_e_s.m","pbch_e_s",
+                   eNB_pbch->pbch_e,
+                   pbch_E,
+                   1,
+                   4);
+
+      for (i=0; i<16; i++)
+        printf("e_s[%d] %d\n",i,eNB_pbch->pbch_e[i]);
+    }
+#endif //DEBUG_PBCH 
+  } // frame_mod4==0
+
+  // modulation and mapping (slot 1, symbols 0..3)
+  for (l=(nsymb>>1); l<(nsymb>>1)+4; l++) {
+
+    pilots=0;
+#ifdef INTERFERENCE_MITIGATION
+    pilots_2 = 0;
+#endif
+
+    if ((l==0) || (l==(nsymb>>1))) {
+      pilots=1;
+#ifdef INTERFERENCE_MITIGATION
+      pilots_2=1;
+#endif
+    }
+
+    if ((l==1) || (l==(nsymb>>1)+1)) {
+      pilots=1;
+    }
+
+    if ((l==second_pilot)||(l==(second_pilot+(nsymb>>1)))) {
+      pilots=1;
+    }
+
+#ifdef DEBUG_PBCH
+    LOG_D(PHY,"[PBCH] l=%d, pilots=%d\n",l,pilots);
+#endif
+
+
+    re_offset = frame_parms->ofdm_symbol_size-3*12;
+    symbol_offset = frame_parms->ofdm_symbol_size*l;
+
+    for (rb=0; rb<6; rb++) {
+
+#ifdef DEBUG_PBCH
+      LOG_D(PHY,"RB %d, jj %d, re_offset %d, symbol_offset %d, pilots %d, nushift %d\n",rb,jj,re_offset, symbol_offset, pilots,frame_parms->nushift);
+#endif
+      allocate_pbch_REs_in_RB(frame_parms,
+                              txdataF,
+                              &jj,
+                              re_offset,
+                              symbol_offset,
+                              &eNB_pbch->pbch_e[frame_mod4*(pbch_E>>2)],
+                              pilots,
+#ifdef INTERFERENCE_MITIGATION
+                              (pilots_2==1)?(amp/3):amp,
+#else
+                              amp,
+#endif
+                              &re_allocated);
+
+      re_offset+=12; // go to next RB
+
+      // check if we crossed the symbol boundary and skip DC
+
+      if (re_offset >= frame_parms->ofdm_symbol_size)
+        re_offset=1;
+    }
+
+    //    }
+  }
+
+#ifdef DEBUG_PBCH
+  printf("[PBCH] txdataF=\n");
+
+  for (i=0; i<frame_parms->ofdm_symbol_size; i++) {
+    printf("%d=>(%d,%d)",i,((short*)&txdataF[0][frame_parms->ofdm_symbol_size*(nsymb>>1)+i])[0],
+           ((short*)&txdataF[0][frame_parms->ofdm_symbol_size*(nsymb>>1)+i])[1]);
+
+    if (frame_parms->nb_antenna_ports_eNB!=1) {
+      printf("(%d,%d)\n",((short*)&txdataF[1][frame_parms->ofdm_symbol_size*(nsymb>>1)+i])[0],
+             ((short*)&txdataF[1][frame_parms->ofdm_symbol_size*(nsymb>>1)+i])[1]);
+    } else {
+      printf("\n");
+    }
+  }
+
+#endif
+
+
+  return(0);
+}
+
 void pbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
                      uint8_t *pbch_e,
                      uint32_t length)
diff --git a/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c b/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c
index 475102b57c908cb66ee401139fe29e04998683c3..47ef6428cbdddef09f274b2f93e33b20ecec1096 100644
--- a/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c
+++ b/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c
@@ -20,12 +20,12 @@
  */
 
 /*! \file PHY/LTE_TRANSPORT/pilots_mbsfn.c
-* \brief Top-level routines for generating DL mbsfn reference signals
-* \authors S. Paranche, R. Knopp
+* \brief Top-level routines for generating DL mbsfn reference signals / DL mbsfn reference signals for FeMBMS
+* \authors S. Paranche, R. Knopp, J. Morgade
 * \date 2012
 * \version 0.1
 * \company Eurecom
-* \email: knopp@eurecom.fr
+* \email: knopp@eurecom.fr, javier.morgade@ieee.org
 * \note
 * \warning
 */
@@ -85,3 +85,31 @@ int generate_mbsfn_pilot(PHY_VARS_eNB *eNB,
 }
 
 
+int generate_mbsfn_pilot_khz_1dot25(PHY_VARS_eNB *eNB,
+                         L1_rxtx_proc_t *proc,
+                         int32_t **txdataF,
+                         int16_t amp)
+
+{
+
+  LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
+  uint32_t subframe_offset,Nsymb;
+  int subframe = proc->subframe_tx;
+
+
+  if (subframe<0 || subframe>= 10) {
+    LOG_E(PHY,"generate_mbsfn_pilots_subframe: subframe not in range (%d)\n",subframe);
+    return(-1);
+  }
+
+  Nsymb = (frame_parms->Ncp==NORMAL) ? 7 : 6;
+
+  subframe_offset = subframe*frame_parms->ofdm_symbol_size*Nsymb<<1;
+
+  lte_dl_mbsfn_khz_1dot25(eNB,
+                &txdataF[0][subframe_offset+0],
+                amp,subframe);
+
+  return(0);
+}
+
diff --git a/openair1/PHY/LTE_TRANSPORT/pmch.c b/openair1/PHY/LTE_TRANSPORT/pmch.c
index 90e2836b1e729dc09d18bdf87a09952a73714ed3..7b508239a9fa6090fadad3da69ef733a2cbcfece 100644
--- a/openair1/PHY/LTE_TRANSPORT/pmch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pmch.c
@@ -128,3 +128,53 @@ void generate_mch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,uint8_t *a)
 
 }
 
+void generate_mch_khz_1dot25(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,uint8_t *a)
+{
+
+  int G;
+  int subframe = proc->subframe_tx;
+  int frame    = proc->frame_tx;
+  //int bits;
+
+  G = get_G_khz_1dot25(&eNB->frame_parms,
+            eNB->frame_parms.N_RB_DL,
+            eNB->dlsch_MCH->harq_processes[0]->rb_alloc,
+            get_Qm(eNB->dlsch_MCH->harq_processes[0]->mcs),1,
+            2,proc->frame_tx,subframe,0);
+
+  //FeMBMS
+  eNB->dlsch_MCH->harq_processes[0]->Qm = get_Qm(eNB->dlsch_MCH->harq_processes[0]->mcs);
+
+
+  generate_mbsfn_pilot_khz_1dot25(eNB,proc,
+                       eNB->common_vars.txdataF,
+                       AMP);
+
+
+  AssertFatal(dlsch_encoding_fembms_pmch(eNB,
+			    proc,
+                            // a,
+			     eNB->dlsch_MCH->harq_processes[0]->pdu,
+                             1,
+                             eNB->dlsch_MCH,
+                             proc->frame_tx,
+                             subframe,
+                             &eNB->dlsch_rate_matching_stats,
+                             &eNB->dlsch_turbo_encoding_stats,
+                             &eNB->dlsch_interleaving_stats)==0,
+              "problem in dlsch_encoding");
+
+
+  /*for(bits=0;bits<G;bits++)
+        printf("%d",eNB->dlsch_MCH->harq_processes[0]->e[bits]);
+  printf("\n");*/
+
+  dlsch_scrambling(&eNB->frame_parms,1,eNB->dlsch_MCH,0,G,0,frame,subframe<<1);
+
+  mch_modulation_khz_1dot25(eNB->common_vars.txdataF,
+                 AMP,
+                 subframe,
+                 &eNB->frame_parms,
+                 eNB->dlsch_MCH);
+}
+
diff --git a/openair1/PHY/LTE_TRANSPORT/pmch_common.c b/openair1/PHY/LTE_TRANSPORT/pmch_common.c
index 03bf5a378b2c5ed1872dab3fa409624c3b406526..8d65dd2744d336769dc7e284b370f48d6d76d587 100644
--- a/openair1/PHY/LTE_TRANSPORT/pmch_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/pmch_common.c
@@ -37,23 +37,84 @@
 
 
 int is_fembms_cas_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms) {
-  uint32_t period;
-
-  if(frame_parms->NonMBSFN_config_flag ) {
-    period = 4<<frame_parms->NonMBSFN_config.radioframeAllocationPeriod;
-
-    if ((frame % period) == frame_parms->NonMBSFN_config.radioframeAllocationOffset) {
+  //uint32_t period;
+
+  //if(frame_parms->NonMBSFN_config_flag ) {
+  //  period = 4<<frame_parms->NonMBSFN_config.radioframeAllocationPeriod;
+
+  //  if ((frame % period) == frame_parms->NonMBSFN_config.radioframeAllocationOffset) {
+  //    switch (subframe) {
+  //      case 0:
+  //        return(1); //This should be CAS
+  //        break;
+  //    }
+  //  }
+  //}
+  if(frame_parms->NonMBSFN_config_flag || frame_parms->FeMBMS_active){
+   if ((frame&3)==0) {
       switch (subframe) {
         case 0:
-          return(1); //This should be CAS
-          break;
+                return(1); //This should be CAS 
+           break;
       }
-    }
+   }
+	
   }
 
   return (0);
 }
 
+int is_fembms_nonMBSFN_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms){
+   uint32_t period;
+   if(frame_parms->NonMBSFN_config_flag ) {
+      period = 4<<frame_parms->NonMBSFN_config.radioframeAllocationPeriod;
+      if ((frame % period) == frame_parms->NonMBSFN_config.radioframeAllocationOffset) {
+        switch (subframe) {
+        case 0:
+                return(1); //This should be CAS
+           break;
+        case 1:
+           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x100) > 0)
+                return(1);
+           break;
+        case 2:
+           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x80) > 0)
+                return(1);
+           break;
+        case 3:
+           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x40) > 0)
+                return(1);
+           break;
+        case 4:
+           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x20) > 0)
+                return(1);
+           break;
+        case 5:
+           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x10) > 0)
+                return(1);
+           break;
+        case 6:
+           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x8) > 0)
+                return(1);
+           break;
+        case 7:
+           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x4) > 0)
+                return(1);
+           break;
+        case 8:
+           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x2) > 0)
+                return(1);
+           break;
+        case 9:
+           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x1) > 0)
+                return(1);
+           break;
+        }
+      }
+  }
+    return (0);
+}
+
 int is_fembms_pmch_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms) {
   uint32_t period;
 
@@ -62,63 +123,67 @@ int is_fembms_pmch_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *fr
 
     if ((frame % period) == frame_parms->NonMBSFN_config.radioframeAllocationOffset) {
       switch (subframe) {
+ 	case 0:
+            return(0);
+  	  break;
         case 1:
           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x100) > 0)
-            return(1);
+            return(0);
 
           break;
 
         case 2:
           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x80) > 0)
-            return(1);
+            return(0);
 
           break;
 
         case 3:
           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x40) > 0)
-            return(1);
+            return(0);
 
           break;
 
         case 4:
           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x20) > 0)
-            return(1);
+            return(0);
 
           break;
 
         case 5:
           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x10) > 0)
-            return(1);
+            return(0);
 
           break;
 
         case 6:
           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x8) > 0)
-            return(1);
+            return(0);
 
           break;
 
         case 7:
           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x4) > 0)
-            return(1);
+            return(0);
 
           break;
 
         case 8:
           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x2) > 0)
-            return(1);
+            return(0);
 
           break;
 
         case 9:
           if ((frame_parms->NonMBSFN_config.non_mbsfn_SubframeConfig & 0x1) > 0)
-            return(1);
+            return(0);
 
           break;
       }
-    } else { //Then regular MBSFN FeMBMS subframe
+    } else if((frame_parms->FeMBMS_active == 1 || frame_parms->NonMBSFN_config_flag == 1 ) && !is_fembms_cas_subframe(frame,subframe,frame_parms) ) { //Then regular MBSFN FeMBMS subframe
       return(1);
     }
+    return(1);
   }
 
   return(0);
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common.h b/openair1/PHY/LTE_TRANSPORT/transport_common.h
index 321789d54b380a95c221c38e497e85de12925092..ab2921c2b9405a65ae5ef8bce9d5b21840b73b39 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_common.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_common.h
@@ -67,6 +67,7 @@
 
 #if !defined(SI_RNTI)
   #define SI_RNTI  (rnti_t)0xffff
+  #define SI_RNTI_MBMS  (rnti_t)0xfff9
 #endif
 #if !defined(M_RNTI)
   #define M_RNTI   (rnti_t)0xfffd
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
index e4f5d9a17f10b3d3090a53df586229751a568267..1944f06fab7a410dc21ee3a9130dba4f4c1bf311 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
@@ -270,6 +270,9 @@ int is_pmch_subframe(frame_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parm
 */
 int is_fembms_cas_subframe(frame_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms);
 
+int is_fembms_nonMBSFN_subframe (frame_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms);
+
+
 /*!
   \brief Return the status of MBSFN in this frame/subframe
   @param frame Frame index
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
index 3988923bb98cdd77b93996ebb7fac009aee0ac12..4ce113f78ee5d590de3e15048de9f86c68534ac4 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
@@ -123,6 +123,42 @@ int32_t dlsch_encoding(PHY_VARS_eNB *eNB,
                        time_stats_t *te_stats,
                        time_stats_t *i_stats);
 
+/** \fn dlsch_encoding(PHY_VARS_eNB *eNB,
+    uint8_t *input_buffer,
+    LTE_DL_FRAME_PARMS *frame_parms,
+    uint8_t num_pdcch_symbols,
+    LTE_eNB_DLSCH_t *dlsch,
+    int frame,
+    uint8_t subframe)
+    \brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). The implemented functions are:
+    - CRC computation and addition
+    - Code block segmentation and sub-block CRC addition
+    - Channel coding (Turbo coding)
+    - Rate matching (sub-block interleaving, bit collection, selection and transmission
+    - Code block concatenation
+    @param eNB Pointer to eNB PHY context
+    @param input_buffer Pointer to input buffer for sub-frame
+    @param frame_parms Pointer to frame descriptor structure
+    @param num_pdcch_symbols Number of PDCCH symbols in this subframe
+    @param dlsch Pointer to dlsch to be encoded
+    @param frame Frame number
+    @param subframe Subframe number
+    @param rm_stats Time statistics for rate-matching
+    @param te_stats Time statistics for turbo-encoding
+    @param i_stats Time statistics for interleaving
+    @returns status
+*/
+int32_t dlsch_encoding_fembms_pmch(PHY_VARS_eNB *eNB,
+                       L1_rxtx_proc_t *proc,
+                       uint8_t *a,
+                       uint8_t num_pdcch_symbols,
+                       LTE_eNB_DLSCH_t *dlsch,
+                       int frame,
+                       uint8_t subframe,
+                       time_stats_t *rm_stats,
+                       time_stats_t *te_stats,
+                       time_stats_t *i_stats);
+
 
 
 
@@ -269,6 +305,30 @@ int mch_modulation(int32_t **txdataF,
                    LTE_DL_FRAME_PARMS *frame_parms,
                    LTE_eNB_DLSCH_t *dlsch);
 
+/*
+  \brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for MCH.
+  @param txdataF Table of pointers for frequency-domain TX signals
+  @param amp Amplitude of signal
+  @param subframe_offset Offset of this subframe in units of subframes (usually 0)
+  @param frame_parms Pointer to frame descriptor
+  @param dlsch Pointer to DLSCH descriptor for this allocation
+*/
+int mch_modulation_khz_1dot25(int32_t **txdataF,
+                   int16_t amp,
+                   uint32_t subframe_offset,
+                   LTE_DL_FRAME_PARMS *frame_parms,
+                   LTE_eNB_DLSCH_t *dlsch);
+
+
+/** \brief Top-level generation function for eNB TX of MBSFN
+    @param phy_vars_eNB Pointer to eNB variables
+    @param a Pointer to transport block
+    @param abstraction_flag
+
+*/
+void generate_mch_khz_1dot25(PHY_VARS_eNB *phy_vars_eNB,L1_rxtx_proc_t *proc,uint8_t *a);
+
+
 /** \brief Top-level generation function for eNB TX of MBSFN
     @param phy_vars_eNB Pointer to eNB variables
     @param a Pointer to transport block
@@ -318,6 +378,12 @@ int32_t generate_pilots_slot(PHY_VARS_eNB *phy_vars_eNB,
                              uint16_t slot,
                              int first_pilot_only);
 
+int32_t generate_mbsfn_pilot_khz_1dot25(PHY_VARS_eNB *phy_vars_eNB,
+                             L1_rxtx_proc_t *proc,
+                             int32_t **txdataF,
+                             int16_t amp);
+
+
 int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB,
                              L1_rxtx_proc_t *proc,
                              int32_t **txdataF,
@@ -350,6 +416,13 @@ int32_t generate_pbch(LTE_eNB_PBCH *eNB_pbch,
                       uint8_t *pbch_pdu,
                       uint8_t frame_mod4);
 
+int32_t generate_pbch_fembms(LTE_eNB_PBCH *eNB_pbch,
+                      int32_t **txdataF,
+                      int32_t amp,
+                      LTE_DL_FRAME_PARMS *frame_parms,
+                      uint8_t *pbch_pdu,
+                      uint8_t frame_mod16);
+
 
 
 
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
index e4083863f0da352bfd5c74998414cbd768526601..ab7c2b90910d4df9eff3fe17d0139843bd73038c 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
@@ -55,7 +55,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
   uint8_t preamble_index     = ue->prach_resources[eNB_id]->ra_PreambleIndex;
   uint8_t tdd_mapindex       = ue->prach_resources[eNB_id]->ra_TDD_map_index;
   int16_t *prachF           = ue->prach_vars[eNB_id]->prachF;
-  static int16_t prach_tmp[45600*2] __attribute__((aligned(32)));
+  static int16_t prach_tmp[45600*4] __attribute__((aligned(32)));
   int16_t *prach            = prach_tmp;
   int16_t *prach2;
   int16_t amp               = ue->prach_vars[eNB_id]->amp;
diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c
index 79e220ac37d2ecb8a7ef8873b4355e87c54da666..b1f419b1724b8462489ba9d25789685265ddf52b 100644
--- a/openair1/PHY/MODULATION/beamforming.c
+++ b/openair1/PHY/MODULATION/beamforming.c
@@ -155,7 +155,7 @@ int nr_beam_precoding(int32_t **txdataF,
   memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size));
 
   for (p=0; p<nb_antenna_ports; p++) {
-    if ((frame_parms->L_ssb >> p) & 0x01)  {
+    if ((frame_parms->L_ssb >> (63-p)) & 0x01)  {
       multadd_cpx_vector((int16_t*)&txdataF[p][symbol*frame_parms->ofdm_symbol_size],
 			 (int16_t*)beam_weights[p][aa], 
 			 (int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], 
diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c
index dbfe93adee0837becc7d7948f77ef2848c99e091..764b02065f70de8421e65cb1609a114a68ba59d5 100644
--- a/openair1/PHY/MODULATION/nr_modulation.c
+++ b/openair1/PHY/MODULATION/nr_modulation.c
@@ -20,36 +20,138 @@
  */
 
 #include "nr_modulation.h"
-
-extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
+#include "PHY/NR_REFSIG/nr_mod_table.h"
 
 void nr_modulation(uint32_t *in,
                    uint32_t length,
                    uint16_t mod_order,
                    int16_t *out)
 {
-  uint16_t offset;
-  uint8_t idx, b_idx;
-
-  offset = (mod_order==2)? NR_MOD_TABLE_QPSK_OFFSET : (mod_order==4)? NR_MOD_TABLE_QAM16_OFFSET : \
-                    (mod_order==6)? NR_MOD_TABLE_QAM64_OFFSET: (mod_order==8)? NR_MOD_TABLE_QAM256_OFFSET : 0;
+  uint16_t mask = ((1<<mod_order)-1);
+  int32_t* nr_mod_table32;
+  int32_t* out32 = (int32_t*) out;
+  uint8_t* in_bytes = (uint8_t*) in;
+  uint64_t* in64 = (uint64_t*) in;
+  int64_t* out64 = (int64_t*) out;
+  uint8_t idx;
+  uint32_t i,j;
+  uint32_t bit_cnt;
+  uint64_t x,x1,x2;
+    
+#if defined(__SSE2__)
+  __m128i *nr_mod_table128;
+  __m128i *out128;
+#endif
 
   LOG_D(PHY,"nr_modulation: length %d, mod_order %d\n",length,mod_order);
 
-  for (int i=0; i<length/mod_order; i++)
-  {
-    idx = 0;
-    for (int j=0; j<mod_order; j++)
-    {
-      b_idx = (i*mod_order+j)&0x1f;
-      if (i && (!b_idx))
-        in++;
-      idx ^= (((*in)>>b_idx)&1)<<(mod_order-j-1);
+  switch (mod_order) {
+
+#if defined(__SSE2__)
+  case 2:
+    nr_mod_table128 = (__m128i*) nr_qpsk_byte_mod_table;
+    out128 = (__m128i*) out;
+    for (i=0; i<length/8; i++)
+      out128[i] = nr_mod_table128[in_bytes[i]];
+    // the bits that are left out
+    i = i*8/2;
+    nr_mod_table32 = (int32_t*) nr_qpsk_mod_table;
+    while (i<length/2){
+      idx = ((in_bytes[(i*2)/8]>>((i*2)&0x7)) & mask);
+      out32[i] = nr_mod_table32[idx];
+      i++;
+    }
+    return;
+#else
+  case 2:
+    nr_mod_table32 = (int32_t*) nr_qpsk_mod_table;
+    for (i=0; i<length/mod_order; i++) {
+      idx = ((in[i*2/32]>>((i*2)&0x1f)) & mask);
+      out32[i] = nr_mod_table32[idx];
+    }
+    return;
+#endif
+
+  case 4:
+    out64 = (int64_t*) out;
+    for (i=0; i<length/8; i++)
+      out64[i] = nr_16qam_byte_mod_table[in_bytes[i]];
+    // the bits that are left out
+    i = i*8/4;
+    while (i<length/4){
+      idx = ((in_bytes[(i*4)/8]>>((i*4)&0x7)) & mask);
+      out32[i] = nr_16qam_mod_table[idx];
+      i++;
+    }
+    return;
+
+  case 6:
+    j = 0;
+    for (i=0; i<length/192; i++) {
+      x = in64[i*3]; 
+      x1 = x&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x>>12)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x>>24)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x>>36)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x>>48)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x2 = (x>>60);
+      x = in64[i*3+1];
+      x2 |= x<<4;
+      x1 = x2&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x2>>12)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x2>>24)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x2>>36)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x2>>48)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x2 = ((x>>56)&0xf0) | (x2>>60);
+      x = in64[i*3+2];
+      x2 |= x<<8;
+      x1 = x2&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x2>>12)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x2>>24)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x2>>36)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x2>>48)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x2 = ((x>>52)&0xff0) | (x2>>60);
+      out64[j++] = nr_64qam_mod_table[x2];
+    }
+    i *= 24;
+    bit_cnt = i * 8;
+    while (bit_cnt < length) {
+      x = *((uint32_t*)(in_bytes+i));
+      x1 = x&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      x1 = (x>>12)&4095;
+      out64[j++] = nr_64qam_mod_table[x1];
+      i += 3;
+      bit_cnt += 24;
     }
+    return;
+      
+  case 8:
+    nr_mod_table32 = (int32_t*) nr_256qam_mod_table;
+    for (i=0; i<length/8; i++)
+      out32[i] = nr_mod_table32[in_bytes[i]];
+    return;
 
-    out[i<<1] = nr_mod_table[(offset+idx)<<1];
-    out[(i<<1)+1] = nr_mod_table[((offset+idx)<<1)+1];
+  default:
+    break;
   }
+  AssertFatal(false,"Invalid or unsupported modulation order %d\n",mod_order);
+
 }
 
 void nr_layer_mapping(int16_t **mod_symbs,
diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c
index 855e649cc5e629a128ba9ffcc680f07c6525956d..e1d21af9b9fb14de87f2cb1f1d6bbec055af400e 100644
--- a/openair1/PHY/MODULATION/ofdm_mod.c
+++ b/openair1/PHY/MODULATION/ofdm_mod.c
@@ -88,7 +88,7 @@ void PHY_ofdm_mod(int *input,                       /// pointer to complex input
 
   if(nb_symbols == 0) return;
 
-  short temp[4096*4] __attribute__((aligned(32)));
+  short temp[2*2*6144*4] __attribute__((aligned(32)));
   unsigned short i,j;
   short k;
 
@@ -125,9 +125,23 @@ void PHY_ofdm_mod(int *input,                       /// pointer to complex input
   case 3072:
     idftsize = IDFT_3072;
     break;
+
   case 4096:
     idftsize = IDFT_4096;
     break;
+
+  case 6144:
+    idftsize= IDFT_6144;
+    break;
+
+ case 12288:
+    idftsize= IDFT_12288;
+    break;
+
+ case 24576:
+    idftsize= IDFT_24576;
+    break;
+
   default:
     idftsize = IDFT_512;
     break;
diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c
new file mode 100644
index 0000000000000000000000000000000000000000..b0f9e6d03c55562555bfb1048b86e5c132758fa4
--- /dev/null
+++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+#include "nr_refsig.h"
+#include "nr_mod_table.h"
+
+void nr_generate_modulation_table() {
+  float sqrt2 = 0.70711;
+  float sqrt10 = 0.31623;
+  float sqrt42 = 0.15430;
+  float sqrt170 = 0.076696;
+  float val = 32768.0;
+  uint32_t i,j;
+  short* table;
+
+  // QPSK
+  for (i=0; i<4; i++) {
+    nr_qpsk_mod_table[i*2]   = (short)(1-2*(i&1))*val*sqrt2*sqrt2;
+    nr_qpsk_mod_table[i*2+1] = (short)(1-2*((i>>1)&1))*val*sqrt2*sqrt2;
+    //printf("%d j%d\n",nr_qpsk_mod_table[i*2],nr_qpsk_mod_table[i*2+1]);
+  }
+
+#if defined(__SSE2__)
+  //QPSK m128
+  table = (short*) nr_qpsk_byte_mod_table;
+  for (i=0; i<256; i++) {
+    for (j=0; j<4; j++) {
+      table[i*8+(j*2)]   = (short)(1-2*((i>>(j*2))&1))*val*sqrt2*sqrt2;
+      table[i*8+(j*2)+1] = (short)(1-2*((i>>(j*2+1))&1))*val*sqrt2*sqrt2;
+      //printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]);
+    }
+  }
+#endif
+
+  //16QAM
+  table = (short*) nr_16qam_byte_mod_table;
+  for (i=0; i<256; i++) {
+    for (j=0; j<2; j++) {
+      table[i*4+(j*2)]   = (short)((1-2*((i>>(j*4))&1))*(2-(1-2*((i>>(j*4+2))&1))))*val*sqrt10*sqrt2;
+      table[i*4+(j*2)+1] = (short)((1-2*((i>>(j*4+1))&1))*(2-(1-2*((i>>(j*4+3))&1))))*val*sqrt10*sqrt2;
+     //printf("%d j%d\n",nr_16qam_byte_mod_table[i*4+(j*2)],nr_16qam_byte_mod_table[i*4+(j*2)+1]);
+    }
+  }
+
+  table = (short*) nr_16qam_mod_table;
+  for (i=0; i<16; i++) {
+    table[i*2]   = (short)((1-2*(i&1))*(2-(1-2*((i>>2)&1))))*val*sqrt10*sqrt2;
+    table[i*2+1] = (short)((1-2*((i>>1)&1))*(2-(1-2*((i>>3)&1))))*val*sqrt10*sqrt2;
+    //printf("%d j%d\n",table[i*2],table[i*2+1]);
+  }
+
+  //64QAM
+  table = (short*) nr_64qam_mod_table;
+  for (i=0; i<4096; i++) {
+    for (j=0; j<2; j++) {
+      table[i*4+(j*2)]   = (short)((1-2*((i>>(j*6))&1))*(4-(1-2*((i>>(j*6+2))&1))*(2-(1-2*((i>>(j*6+4))&1)))))*val*sqrt42*sqrt2;
+      table[i*4+(j*2)+1] = (short)((1-2*((i>>(j*6+1))&1))*(4-(1-2*((i>>(j*6+3))&1))*(2-(1-2*((i>>(j*6+5))&1)))))*val*sqrt42*sqrt2;
+      //printf("%d j%d\n",table[i*4+(j*2)],table[i*4+(j*2)+1]);
+    }
+  }
+
+  //256QAM
+  table = (short*) nr_256qam_mod_table;
+  for (i=0; i<256; i++) {
+    table[i*2]   = (short)((1-2*(i&1))*(8-(1-2*((i>>2)&1))*(4-(1-2*((i>>4)&1))*(2-(1-2*((i>>6)&1))))))*val*sqrt170*sqrt2;
+    table[i*2+1] = (short)((1-2*((i>>1)&1))*(8-(1-2*((i>>3)&1))*(4-(1-2*((i>>5)&1))*(2-(1-2*((i>>7)&1))))))*val*sqrt170*sqrt2;
+  }
+}
+
diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m
index 13a8d4ad09c38741bca610bccb6bd15e79204b89..6e1415bf2843d23f5d7fc29fad7608c5d12f6258 100644
--- a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m
+++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m
@@ -45,7 +45,7 @@ for r=0:1 %0 -- 1 LS
 for j=0:1 %0 -- 1 MS
   %% Formula is dispalayed
 
-qpsk_table(2*r+j+1) = ((1-r*2)*QPSK +  1j*(1-2*j)*QPSK);
+qpsk_table(2*j+r+1) = ((1-r*2)*QPSK +  1j*(1-2*j)*QPSK);
 end
 end
 
@@ -61,7 +61,7 @@ for b0=0:1
 for b1=0:1
 for b2=0:1
 for b3=0:1
-qam16_table2(b0*8+b1*4+b2*2+b3*1+1) = qam16_table(b0*2+b2*1+1) + 1j*qam16_table(b1*2+b3*1+1);
+qam16_table2(b3*8+b2*4+b1*2+b0*1+1) = qam16_table(b0*2+b2*1+1) + 1j*qam16_table(b1*2+b3*1+1);
 end
 end
 end
@@ -84,7 +84,7 @@ for b2=0:1
 for b3=0:1
 for b4=0:1
 for b5=0:1
-qam64_table2(b0*32+b1*16+b2*8+b3*4+b4*2+b5*1+1) = qam64_table(b0*4+b2*2+b4*1+1) + 1j*qam64_table(b1*4+b3*2+b5*1+1);
+qam64_table2(b5*32+b4*16+b3*8+b2*4+b1*2+b0*1+1) = qam64_table(b0*4+b2*2+b4*1+1) + 1j*qam64_table(b1*4+b3*2+b5*1+1);
 end
 end
 end
@@ -116,7 +116,50 @@ for b6=0:1
 for b7=0:1
 
 %%qam64_table2(b0*32+b1*16+b2*8+b3*4+b4*2+b5*1+1) = qam64_table(b0*4+b2*2+b4*1+1) + 1j*qam64_table(b1*4+b3*2+b5*1+1);
-qam256_table2(b0*128+b1*64+b2*32+b3*16+b4*8+b5*4+b6*2+b7*1+1) = qam256_table(b0*8+b2*4+b4*2+b6*1+1) + 1j*qam256_table(b1*8+b3*4+b5*2+b7*1+1);
+qam256_table2(b7*128+b6*64+b5*32+b4*16+b3*8+b2*4+b1*2+b0*1+1) = qam256_table(b0*8+b2*4+b4*2+b6*1+1) + 1j*qam256_table(b1*8+b3*4+b5*2+b7*1+1);
+end
+end
+end
+end
+end
+end
+end
+end
+
+%%QPSK byte
+for b0=0:1
+for b1=0:1
+for b2=0:1
+for b3=0:1
+for b4=0:1
+for b5=0:1
+for b6=0:1
+for b7=0:1
+qpsk_byte_table2(b7*128+b6*64+b5*32+b4*16+b3*8+b2*4+b1*2+b0*1+1,:)=[(1-b0*2)*QPSK (1-2*b1)*QPSK (1-b2*2)*QPSK (1-2*b3)*QPSK ...
+    (1-b4*2)*QPSK (1-2*b5)*QPSK (1-b6*2)*QPSK (1-2*b7)*QPSK];
+
+end
+end
+end
+end
+end
+end
+end
+end
+
+%%16QAM byte
+qam16_byte_table2=[];
+for b0=0:1
+for b1=0:1
+for b2=0:1
+for b3=0:1
+for b4=0:1
+for b5=0:1
+for b6=0:1
+for b7=0:1
+qam16_byte_table2(b7*128+b6*64+b5*32+b4*16+b3*8+b2*4+b1*2+b0*1+1,:)=[qam16_table(b0*2+b2*1+1) qam16_table(b1*2+b3*1+1) ...
+    qam16_table(b4*2+b6*1+1) qam16_table(b5*2+b7*1+1) ];
+
 end
 end
 end
@@ -133,6 +176,8 @@ save mod_table.mat table
 table2 = zeros(1,length(table)*2);
 table2(1:2:end) = real(table);
 table2(2:2:end) = imag(table);
+qpsk_byte_table2=round(K * qpsk_byte_table2'(:));
+qam16_byte_table2=round(K * qam16_byte_table2'(:));
 
 fd = fopen("nr_mod_table.h","w");
 fprintf(fd,"#define NR_MOD_TABLE_SIZE_SHORT %d\n", length(table)*2);
@@ -144,4 +189,10 @@ fprintf(fd,"#define NR_MOD_TABLE_QAM256_OFFSET %d\n", 87);
 fprintf(fd,"short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {");
 fprintf(fd,"%d,",table2(1:end-1));
 fprintf(fd,"%d};\n",table2(end));
+fprintf(fd,"short nr_qpsk_mod_table[2048] = {");
+fprintf(fd,"%d,",qpsk_byte_table2(1:end-1));
+fprintf(fd,"%d};\n",qpsk_byte_table2(end));
+fprintf(fd,"short nr_qam16_mod_table[1024] = {");
+fprintf(fd,"%d,",qam16_byte_table2(1:end-1));
+fprintf(fd,"%d};\n",qam16_byte_table2(end));
 fclose(fd);
diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h
index c34dadb663e8faf88efcb1851f38028c6b113b1d..aa8b99f584b6d2554c1fbbd6563c1a64db5b9470 100644
--- a/openair1/PHY/NR_REFSIG/nr_mod_table.h
+++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h
@@ -28,6 +28,17 @@
 #define NR_MOD_TABLE_QAM16_OFFSET 7
 #define NR_MOD_TABLE_QAM64_OFFSET 23
 #define NR_MOD_TABLE_QAM256_OFFSET 87
-short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,7327,7327,7327,21981,21981,7327,21981,21981,7327,-7327,7327,-21981,21981,-7327,21981,-21981,-7327,7327,-7327,21981,-21981,7327,-21981,21981,-7327,-7327,-7327,-21981,-21981,-7327,-21981,-21981,10726,10726,10726,3576,3576,10726,3576,3576,10726,17876,10726,25027,3576,17876,3576,25027,17876,10726,17876,3576,25027,10726,25027,3576,17876,17876,17876,25027,25027,17876,25027,25027,10726,-10726,10726,-3576,3576,-10726,3576,-3576,10726,-17876,10726,-25027,3576,-17876,3576,-25027,17876,-10726,17876,-3576,25027,-10726,25027,-3576,17876,-17876,17876,-25027,25027,-17876,25027,-25027,-10726,10726,-10726,3576,-3576,10726,-3576,3576,-10726,17876,-10726,25027,-3576,17876,-3576,25027,-17876,10726,-17876,3576,-25027,10726,-25027,3576,-17876,17876,-17876,25027,-25027,17876,-25027,25027,-10726,-10726,-10726,-3576,-3576,-10726,-3576,-3576,-10726,-17876,-10726,-25027,-3576,-17876,-3576,-25027,-17876,-10726,-17876,-3576,-25027,-10726,-25027,-3576,-17876,-17876,-17876,-25027,-25027,-17876,-25027,-25027,8886,8886,8886,12439,12439,8886,12439,12439,8886,5332,8886,1778,12439,5332,12439,1778,5332,8886,5332,12439,1778,8886,1778,12439,5332,5332,5332,1778,1778,5332,1778,1778,8886,19547,8886,15993,12439,19547,12439,15993,8886,23101,8886,26655,12439,23101,12439,26655,5332,19547,5332,15993,1778,19547,1778,15993,5332,23101,5332,26655,1778,23101,1778,26655,19547,8886,19547,12439,15993,8886,15993,12439,19547,5332,19547,1778,15993,5332,15993,1778,23101,8886,23101,12439,26655,8886,26655,12439,23101,5332,23101,1778,26655,5332,26655,1778,19547,19547,19547,15993,15993,19547,15993,15993,19547,23101,19547,26655,15993,23101,15993,26655,23101,19547,23101,15993,26655,19547,26655,15993,23101,23101,23101,26655,26655,23101,26655,26655,8886,-8886,8886,-12439,12439,-8886,12439,-12439,8886,-5332,8886,-1778,12439,-5332,12439,-1778,5332,-8886,5332,-12439,1778,-8886,1778,-12439,5332,-5332,5332,-1778,1778,-5332,1778,-1778,8886,-19547,8886,-15993,12439,-19547,12439,-15993,8886,-23101,8886,-26655,12439,-23101,12439,-26655,5332,-19547,5332,-15993,1778,-19547,1778,-15993,5332,-23101,5332,-26655,1778,-23101,1778,-26655,19547,-8886,19547,-12439,15993,-8886,15993,-12439,19547,-5332,19547,-1778,15993,-5332,15993,-1778,23101,-8886,23101,-12439,26655,-8886,26655,-12439,23101,-5332,23101,-1778,26655,-5332,26655,-1778,19547,-19547,19547,-15993,15993,-19547,15993,-15993,19547,-23101,19547,-26655,15993,-23101,15993,-26655,23101,-19547,23101,-15993,26655,-19547,26655,-15993,23101,-23101,23101,-26655,26655,-23101,26655,-26655,-8886,8886,-8886,12439,-12439,8886,-12439,12439,-8886,5332,-8886,1778,-12439,5332,-12439,1778,-5332,8886,-5332,12439,-1778,8886,-1778,12439,-5332,5332,-5332,1778,-1778,5332,-1778,1778,-8886,19547,-8886,15993,-12439,19547,-12439,15993,-8886,23101,-8886,26655,-12439,23101,-12439,26655,-5332,19547,-5332,15993,-1778,19547,-1778,15993,-5332,23101,-5332,26655,-1778,23101,-1778,26655,-19547,8886,-19547,12439,-15993,8886,-15993,12439,-19547,5332,-19547,1778,-15993,5332,-15993,1778,-23101,8886,-23101,12439,-26655,8886,-26655,12439,-23101,5332,-23101,1778,-26655,5332,-26655,1778,-19547,19547,-19547,15993,-15993,19547,-15993,15993,-19547,23101,-19547,26655,-15993,23101,-15993,26655,-23101,19547,-23101,15993,-26655,19547,-26655,15993,-23101,23101,-23101,26655,-26655,23101,-26655,26655,-8886,-8886,-8886,-12439,-12439,-8886,-12439,-12439,-8886,-5332,-8886,-1778,-12439,-5332,-12439,-1778,-5332,-8886,-5332,-12439,-1778,-8886,-1778,-12439,-5332,-5332,-5332,-1778,-1778,-5332,-1778,-1778,-8886,-19547,-8886,-15993,-12439,-19547,-12439,-15993,-8886,-23101,-8886,-26655,-12439,-23101,-12439,-26655,-5332,-19547,-5332,-15993,-1778,-19547,-1778,-15993,-5332,-23101,-5332,-26655,-1778,-23101,-1778,-26655,-19547,-8886,-19547,-12439,-15993,-8886,-15993,-12439,-19547,-5332,-19547,-1778,-15993,-5332,-15993,-1778,-23101,-8886,-23101,-12439,-26655,-8886,-26655,-12439,-23101,-5332,-23101,-1778,-26655,-5332,-26655,-1778,-19547,-19547,-19547,-15993,-15993,-19547,-15993,-15993,-19547,-23101,-19547,-26655,-15993,-23101,-15993,-26655,-23101,-19547,-23101,-15993,-26655,-19547,-26655,-15993,-23101,-23101,-23101,-26655,-26655,-23101,-26655,-26655};
 
+short nr_qpsk_mod_table[8];
+
+int32_t nr_16qam_mod_table[16];
+#if defined(__SSE2__)
+__m128i nr_qpsk_byte_mod_table[2048];
+#endif
+
+int64_t nr_16qam_byte_mod_table[1024];
+
+int64_t nr_64qam_mod_table[4096];
+
+int32_t nr_256qam_mod_table[512];
 #endif
diff --git a/openair1/PHY/NR_REFSIG/nr_refsig.h b/openair1/PHY/NR_REFSIG/nr_refsig.h
index 2d606e4be5267f37c9cb375b1535b6c7c106bb0e..de0befd7dff8ef2bd2f92152c7de34a7dafb4e29 100644
--- a/openair1/PHY/NR_REFSIG/nr_refsig.h
+++ b/openair1/PHY/NR_REFSIG/nr_refsig.h
@@ -56,6 +56,8 @@ void nr_gen_ref_conj_symbols(uint32_t *in, uint32_t length, int16_t *output, uin
 uint8_t get_next_dmrs_symbol_in_slot(uint16_t  ul_dmrs_symb_pos, uint8_t counter, uint8_t end_symbol);
 uint8_t get_dmrs_symbols_in_slot(uint16_t l_prime_mask,  uint16_t nb_symb);
 
+void nr_generate_modulation_table(void);
+
 extern __m64 byte2m64_re[256];
 extern __m64 byte2m64_im[256];
 
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c
index a29211b55b5dfcaff7892fa43dba513db9d00afb..3a44ebc49a0c589ef13d1c45b3ea95c7b6bca970 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dci.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c
@@ -161,7 +161,7 @@ uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu,
                             int16_t amp,
                             NR_DL_FRAME_PARMS frame_parms) {
 
-  int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1]; // 3 for the max coreset duration
+  int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1] __attribute__((aligned(16))); // 3 for the max coreset duration
   uint16_t cset_start_sc;
   uint8_t cset_start_symb, cset_nsymb;
   int k,l,k_prime,dci_idx, dmrs_idx;
@@ -260,7 +260,7 @@ uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu,
 	   scrambled_output[6], scrambled_output[7], scrambled_output[8], scrambled_output[9], scrambled_output[10],scrambled_output[11] );
 #endif
     /// QPSK modulation
-    int16_t mod_dci[NR_MAX_DCI_SIZE>>1];
+    int16_t mod_dci[NR_MAX_DCI_SIZE>>1] __attribute__((aligned(16)));
     nr_modulation(scrambled_output, encoded_length, DMRS_MOD_ORDER, mod_dci); //Qm = 2 as DMRS is QPSK modulated
 #ifdef DEBUG_DCI
     
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c
index 23466132d6a1c89abf0f36ba0850c93136f61969..2849986833b2311bbc7ffe7d21e45dc145597120 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c
@@ -150,7 +150,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
   nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs-xOverhead)*rel15->rbSize*rel15->NrOfCodewords;
   uint8_t Qm = rel15->qamModOrder[0];
   uint32_t encoded_length = nb_re*Qm;
-  int16_t mod_dmrs[n_dmrs<<1];
+  int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16)));
 
   /// CRC, coding, interleaving and rate matching
   AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
index 2f55bde3210ac51d0c8986e9f0dcd3c1fca8a18b..52377ac9453292efb508403bcceb2169117a915e 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
@@ -150,7 +150,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
 
   if (N_RB != 273) {
     a_segments = a_segments*N_RB;
-    a_segments = a_segments/273;
+    a_segments = (a_segments + 272) / 273;
   }  
 
   uint16_t dlsch_bytes = a_segments*1056;  // allocated bytes per segment
diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c
index bc33d938115f935a31ce2f51cd375db0e804091b..bd1278b2eb192e82bba8f817e17716effaed7101 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c
@@ -40,7 +40,7 @@
 //#define DEBUG_PBCH_ENCODING
 //#define DEBUG_PBCH_DMRS
 
-extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
+extern short nr_qpsk_mod_table[8];
 
 uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4,
                                                     9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31
@@ -61,9 +61,9 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
 
   /// QPSK modulation
   for (int m=0; m<NR_PBCH_DMRS_LENGTH; m++) {
-    idx = ((((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&1)<<1) ^ (((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1);
-    mod_dmrs[m<<1] = nr_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1];
-    mod_dmrs[(m<<1)+1] = nr_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1];
+    idx = (((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&3);
+    mod_dmrs[m<<1] = nr_qpsk_mod_table[idx<<1];
+    mod_dmrs[(m<<1)+1] = nr_qpsk_mod_table[(idx<<1) + 1];
 #ifdef DEBUG_PBCH_DMRS
     printf("m %d idx %d gold seq %d b0-b1 %d-%d mod_dmrs %d %d\n", m, idx, gold_pbch_dmrs[(m<<1)>>5], (((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&1),
            (((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1), mod_dmrs[(m<<1)], mod_dmrs[(m<<1)+1]);
@@ -323,9 +323,9 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
 
   /// QPSK modulation
   for (int i=0; i<NR_POLAR_PBCH_E>>1; i++) {
-    idx = (((pbch->pbch_e[(i<<1)>>5]>>((i<<1)&0x1f))&1)<<1) ^ ((pbch->pbch_e[((i<<1)+1)>>5]>>(((i<<1)+1)&0x1f))&1);
-    mod_pbch_e[i<<1] = nr_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1];
-    mod_pbch_e[(i<<1)+1] = nr_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1)+1];
+    idx = ((pbch->pbch_e[(i<<1)>>5]>>((i<<1)&0x1f))&3);
+    mod_pbch_e[i<<1] = nr_qpsk_mod_table[idx<<1];
+    mod_pbch_e[(i<<1)+1] = nr_qpsk_mod_table[(idx<<1)+1];
 #ifdef DEBUG_PBCH
     printf("i %d idx %d  mod_pbch %d %d\n", i, idx, mod_pbch_e[2*i], mod_pbch_e[2*i+1]);
 #endif
diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c
index 2640a86240bba7abe906e54dc91530b75ff26e92..e263c2c2ccea2dfa297659a822320751c0dbfca7 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_prach.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c
@@ -37,7 +37,6 @@
 extern uint16_t prach_root_sequence_map_0_3[838];
 extern uint16_t prach_root_sequence_map_abc[138];
 extern uint16_t nr_du[838];
-extern int16_t nr_ru[2*839];
 extern const char *prachfmt[9];
 
 void init_prach_list(PHY_VARS_gNB *gNB) {
@@ -540,7 +539,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
   uint16_t           rootSequenceIndex;  
   int                numrootSequenceIndex;
   uint8_t            restricted_set;      
-  uint8_t            n_ra_prb;
+  uint8_t            n_ra_prb=0xFF;
   int16_t            *prachF=NULL;
   int                nb_rx;
 
diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
index 0e10f2b6786c8eede1ad3924b54e836d8357f077..e33532fa657f25792cf84c75342c38941ff29011 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
+++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
@@ -343,8 +343,9 @@ void nr_decode_pucch1(int32_t **rxdataF,
                       uint8_t nr_bit);
 
 void nr_decode_pucch0(PHY_VARS_gNB *gNB,
-              int slot,
+                      int slot,
                       nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu,
                       nfapi_nr_pucch_pdu_t* pucch_pdu);
 
+
 #endif /*__NR_TRANSPORT__H__*/
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
index e00975eee12fd1af42a2555efb7bd83bf5735f9f..8ca3071e061d4ba36e9028a21876edebf3be474a 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
@@ -714,11 +714,11 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
   }
 
 #ifdef DEBUG_ULSCH_DECODING
-  LOG_I(PHY, "Decoder output (payload): \n");
+  LOG_I(PHY, "Decoder output (payload) at SFN/SF: %d/%d \n", frame, nr_tti_rx);
   for (i = 0; i < harq_process->TBS ; i++) {
 	  //harq_process_ul_ue->a[i] = (unsigned char) rand();
 	  //printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
-	  printf("%02x",harq_process->b[i]);
+	  printf("%02x ",harq_process->b[i]);
   }
 #endif
 
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
index 1a6006c3ba99fb952bc5eac6026258b9d09d9e17..3a2cb3f4361c257252168c4fafbda56f91cbe6ee 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
@@ -266,8 +266,14 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
   double Coderate;// = 0.0;
 
   uint8_t dmrs_Type = harq_process->dmrsConfigType;
-  AssertFatal(dmrs_Type == 1 || dmrs_Type == 2,"Illegal dmrs_type %d\n",dmrs_Type);
-  uint8_t nb_re_dmrs = (dmrs_Type==1)?6:4; // should be changed based on MAC parameters
+  AssertFatal(dmrs_Type == 0 || dmrs_Type == 1, "Illegal dmrs_type %d\n", dmrs_Type);
+  uint8_t nb_re_dmrs;
+  if (dmrs_Type==NFAPI_NR_DMRS_TYPE1) {
+    nb_re_dmrs = 6*harq_process->n_dmrs_cdm_groups;
+  }
+  else {
+    nb_re_dmrs = 4*harq_process->n_dmrs_cdm_groups;
+  }
   uint16_t dmrs_length = get_num_dmrs(harq_process->dlDmrsSymbPos);
   AssertFatal(dmrs_length == 1 || dmrs_length == 2,"Illegal dmrs_length %d\n",dmrs_length);
 
@@ -409,7 +415,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
 
   if (nb_rb != 273) {
     a_segments = a_segments*nb_rb;
-    a_segments = a_segments/273;
+    a_segments = (a_segments + 272) / 273;
   }  
 
   if (harq_process->C > a_segments) {
@@ -805,7 +811,12 @@ uint32_t  nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
   //nfapi_nr_config_request_t *cfg = &phy_vars_ue->nrUE_config;
   //uint8_t dmrs_type = cfg->pdsch_config.dmrs_type.value;
 
-  uint8_t nb_re_dmrs = 12;//(dmrs_type==1)?6:4;
+  uint8_t nb_re_dmrs;
+  if (dmrs_Type == NFAPI_NR_DMRS_TYPE1)
+    nb_re_dmrs = 6*harq_process->n_dmrs_cdm_groups;
+  else
+    nb_re_dmrs = 4*harq_process->n_dmrs_cdm_groups;
+
   uint16_t length_dmrs = get_num_dmrs(dl_config_pdu->dlDmrsSymbPos); 
 
   uint32_t i,j;
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
index a8827b4e92c7cb386fdb483168aab5bb0f0b3067..ab3cf4ae90f7cdfe12b75baf484167e3460e27ee 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
@@ -134,7 +134,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
   int avgs = 0;// rb;
   NR_DL_UE_HARQ_t *dlsch0_harq, *dlsch1_harq = NULL;
 
-  uint8_t beamforming_mode;
+  uint8_t beamforming_mode = 0;
 
   int32_t **rxdataF_comp_ptr;
   int32_t **dl_ch_mag_ptr;
@@ -162,24 +162,34 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
     pdsch_vars = ue->pdsch_vars_SI;
     dlsch = &ue->dlsch_SI[eNB_id];
     dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
-    beamforming_mode = 0;
+
     break;
 
   case RA_PDSCH:
     pdsch_vars = ue->pdsch_vars_ra;
     dlsch = &ue->dlsch_ra[eNB_id];
     dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
-    beamforming_mode = 0;
+
+    // WIP TBR Hotfix
+    memcpy((void*)&pdsch_vars[eNB_id]->dl_ch_estimates[0][ue->frame_parms.ofdm_symbol_size*2], (void*)&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][0]->dl_ch_estimates[0][ue->frame_parms.ofdm_symbol_size*2], ue->frame_parms.ofdm_symbol_size*sizeof(int32_t));
 
     break;
 
   case PDSCH:
     pdsch_vars = ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]];
     dlsch = ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id];
-    beamforming_mode = ue->transmission_mode[eNB_id] < 7 ? 0 :ue->transmission_mode[eNB_id];
-
     dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
     dlsch1_harq = dlsch[1]->harq_processes[harq_pid];
+    beamforming_mode = ue->transmission_mode[eNB_id] < 7 ? 0 :ue->transmission_mode[eNB_id];
+    break;
+
+  default:
+    LOG_E(PHY, "[UE][FATAL] nr_tti_rx %d: Unknown PDSCH format %d\n", nr_tti_rx, type);
+    return -1;
+    break;
+  }
+
+  if (dlsch1_harq){
 
     //printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status);
     LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d \n", frame, nr_tti_rx, symbol, harq_pid, dlsch0_harq->status, dlsch1_harq->status);
@@ -191,27 +201,25 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
       dlsch1_harq = dlsch[codeword_TB1]->harq_processes[harq_pid];
 
       #ifdef DEBUG_HARQ
-        printf("[DEMOD] I am assuming both TBs are active\n");
+        printf("[DEMOD] I am assuming both TBs are active, in cw0 %d and cw1 %d \n", codeword_TB0, codeword_TB1);
       #endif
 
     } else if ((dlsch0_harq->status == ACTIVE) && (dlsch1_harq->status != ACTIVE) ) {
       codeword_TB0 = dlsch0_harq->codeword;
-      codeword_TB1 = -1;
-      dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
+      dlsch0_harq = dlsch[codeword_TB0]->harq_processes[harq_pid];
       dlsch1_harq = NULL;
 
       #ifdef DEBUG_HARQ
-        printf("[DEMOD] I am assuming only TB0 is active\n");
+        printf("[DEMOD] I am assuming only TB0 is active, in cw %d \n", codeword_TB0);
       #endif
 
     } else if ((dlsch0_harq->status != ACTIVE) && (dlsch1_harq->status == ACTIVE)){
-      codeword_TB0 = -1;
       codeword_TB1 = dlsch1_harq->codeword;
       dlsch0_harq  = NULL;
-      dlsch1_harq  = dlsch[1]->harq_processes[codeword_TB1];
+      dlsch1_harq  = dlsch[codeword_TB1]->harq_processes[harq_pid];
 
       #ifdef DEBUG_HARQ
-        printf("[DEMOD] I am assuming only TB1 is active, it is in cw %d\n", dlsch1_harq->codeword);
+        printf("[DEMOD] I am assuming only TB1 is active, it is in cw %d\n", codeword_TB1);
       #endif
 
       LOG_E(PHY, "[UE][FATAL] DLSCH: TB0 not active and TB1 active case is not supported\n");
@@ -221,14 +229,17 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
       LOG_E(PHY,"[UE][FATAL] nr_tti_rx %d: no active DLSCH\n", nr_tti_rx);
       return(-1);
     }
+  } else if (dlsch0_harq) {
+    if (dlsch0_harq->status == ACTIVE)
+      codeword_TB0 = dlsch0_harq->codeword;
+      dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
 
-      break;
-
-    default:
-      LOG_E(PHY, "[UE][FATAL] nr_tti_rx %d: Unknown PDSCH format %d\n", nr_tti_rx, type);
-      return(-1);
-      break;
-
+      #ifdef DEBUG_HARQ
+        printf("[DEMOD] I am assuming only TB0 is active\n");
+      #endif
+  } else {
+    LOG_E(PHY,"[UE][FATAL] nr_tti_rx %d: no active DLSCH\n", nr_tti_rx);
+    return (-1);
   }
 
   if (dlsch0_harq == NULL) {
@@ -2380,7 +2391,7 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
 
   for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
 
-    k = frame_parms->first_carrier_offset + 12*start_rb; 
+    k = frame_parms->first_carrier_offset + NR_NB_SC_PER_RB*start_rb;
 
     if (high_speed_flag == 1)
       dl_ch0     = &dl_ch_estimates[aarx][(2*(frame_parms->ofdm_symbol_size))];
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c
index 79c542cd61ba27d5f6ca4cd1af1aa9141e6c4bc5..e4cab0b9a660245ba882d11079ae88763223e059 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c
@@ -44,18 +44,8 @@
 
 //#define NR_PRACH_DEBUG 1
 
-extern uint16_t NCS_unrestricted_delta_f_RA_125[16];
-extern uint16_t NCS_restricted_TypeA_delta_f_RA_125[15];
-extern uint16_t NCS_restricted_TypeB_delta_f_RA_125[13];
-extern uint16_t NCS_unrestricted_delta_f_RA_5[16];
-extern uint16_t NCS_restricted_TypeA_delta_f_RA_5[16];
-extern uint16_t NCS_restricted_TypeB_delta_f_RA_5[14];
-extern uint16_t NCS_unrestricted_delta_f_RA_15[16];
 extern uint16_t prach_root_sequence_map_0_3[838];
 extern uint16_t prach_root_sequence_map_abc[138];
-extern int64_t table_6_3_3_2_2_prachConfig_Index [256][9];
-extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9];
-extern int64_t table_6_3_3_2_4_prachConfig_Index [256][10];
 extern uint16_t nr_du[838];
 extern int16_t nr_ru[2*839];
 extern const char *prachfmt[9];
@@ -118,7 +108,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
   else
     samp_count = (slot%(fp->slots_per_subframe/2)) ? fp->samples_per_slotN0 : fp->samples_per_slot0;
 
-  #if defined (OAI_USRP)
+  #ifdef OAI_USRP
     prach_start = (ue->rx_offset + slot*samp_count - ue->hw_timing_advance - ue->N_TA_offset);
   #else //normal case (simulation)
     prach_start = slot*samp_count - ue->N_TA_offset;
@@ -208,14 +198,17 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
   // now generate PRACH signal
   #ifdef NR_PRACH_DEBUG
     if (NCS>0)
-      LOG_I(PHY, "PRACH [UE %d] generate PRACH for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %d\n", Mod_id,
-    rootSequenceIndex,
-    preamble_index,
-    prach_sequence_length == 0 ? prachfmt03[prach_fmt_id]  : prachfmt[prach_fmt_id],
+      LOG_I(PHY, "PRACH [UE %d] generate PRACH in slot %d for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %d msg1 frequency start %d\n",
+        Mod_id,
+        slot,
+        rootSequenceIndex,
+        preamble_index,
+        prach_sequence_length == 0 ? prachfmt03[prach_fmt_id]  : prachfmt[prach_fmt_id],
         NCS,
         N_ZC,
         preamble_offset,
-        preamble_shift);
+        preamble_shift,
+        n_ra_prb);
   #endif
 
   //  nsymb = (frame_parms->Ncp==0) ? 14:12;
@@ -383,8 +376,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
 
   } else {
 
-    //LOG_D(PHY, "PRACH [UE %d] in slot %d, format %d, msg1 frequency start %d startSymbol %d \n", Mod_id, slot, prachfmt[prach_fmt_id], n_ra_prb, prachStartSymbol);
-
     switch (prach_fmt_id) {
     case 0: //A1
       Ncp = 288/(1<<mu);
@@ -419,7 +410,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
     }
   }
 
-  LOG_D(PHY, "PRACH [UE %d] Ncp %d, dftlen %d \n", Mod_id, Ncp, dftlen);
+  #ifdef NR_PRACH_DEBUG
+    LOG_D(PHY, "PRACH [UE %d] Ncp %d, dftlen %d \n", Mod_id, Ncp, dftlen);
+  #endif
 
   if (fp->N_RB_UL <= 100)
     AssertFatal(1==0,"N_RB_UL %d not supported for NR PRACH yet\n",fp->N_RB_UL);
@@ -844,7 +837,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
   //}
   //printf(" \n");
 
-  #if defined(PRACH_WRITE_OUTPUT_DEBUG)
+  #ifdef PRACH_WRITE_OUTPUT_DEBUG
     LOG_M("prach_tx0.m", "prachtx0", prach+(Ncp<<1), prach_len-Ncp, 1, 1);
     LOG_M("Prach_txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][prach_start]), 2*(prach_start+prach_len), 1, 1)
   #endif
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
index bde9ae03f15bd35249d62c17df5dd13bc6950b04..ee957965cdb814a066a9ac1d1a8d7426d869d992 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
@@ -1064,7 +1064,7 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
 
 void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
                                unsigned char harq_pid,
-                               uint8_t frame,
+                               uint32_t frame,
                                uint8_t slot,
                                uint8_t thread_id,
                                int gNB_id);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
index 6b2d5e7255095e3faedd71cb72735811f885abaa..d1dd0f785b9c20378a35c1e9ecd7aec09eebc0da 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
@@ -177,7 +177,7 @@ typedef struct {
   /// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14)
   uint8_t b_tilde[MAX_NUM_NR_CHANNEL_BITS];
   /// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14)
-  uint32_t d_mod[MAX_NUM_NR_RE];
+  uint32_t d_mod[MAX_NUM_NR_RE] __attribute__ ((aligned(16)));
   /// Transform-coded "y"-sequences (for definition see 38-211 V15.3.0 2018-09, subsection 6.3.1.4)
   uint32_t y[MAX_NUM_NR_RE] __attribute__ ((aligned(16)));
   /*
@@ -292,6 +292,8 @@ typedef struct {
   uint16_t dlDmrsSymbPos;
   /// DMRS Configuration Type
   uint8_t dmrsConfigType;
+  // Number of DMRS CDM groups with no data
+  uint8_t n_dmrs_cdm_groups;
   /// Starting Symbol number
   uint16_t start_symbol;
   /// Current subband PMI allocation
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
index 3b0fabdb7067a5374d0bf5258f68f6a02ce200e9..9d611fbcba8337783153311a8457b66c13e5ca21 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
@@ -93,14 +93,14 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
 
 void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
                                unsigned char harq_pid,
-                               uint8_t frame,
+                               uint32_t frame,
                                uint8_t slot,
                                uint8_t thread_id,
                                int gNB_id) {
 
   LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
 
-  uint32_t available_bits, TBS;
+  uint32_t available_bits;
   uint8_t mod_order, cwd_index, num_of_codewords, l;
   uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
   uint32_t ***pusch_dmrs;
@@ -113,7 +113,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
   int ap, start_symbol, Nid_cell, i;
   int sample_offsetF, N_RE_prime, N_PRB_oh;
   uint16_t ul_dmrs_symb_pos;
-  uint8_t data_existing =0;
   uint8_t L_ptrs, K_ptrs; // PTRS parameters
   uint16_t beta_ptrs; // PTRS parameter related to power control
 
@@ -121,7 +120,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
   NR_UL_UE_HARQ_t *harq_process_ul_ue=NULL;
   NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms;
   NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
-  uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
   // ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
 
   num_of_codewords = 1; // tmp assumption
@@ -171,54 +169,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
                                              0,
                                              harq_process_ul_ue->pusch_pdu.nrOfLayers);
 
-    uint8_t access_mode = SCHEDULED_ACCESS;
-
-    //-----------------------------------------------------//
-    // to be removed later when MAC is ready
-
-    if (harq_process_ul_ue != NULL){
-      TBS = harq_process_ul_ue->pusch_pdu.pusch_data.tb_size;
-      data_existing = 0;
-
-      if (IS_SOFTMODEM_NOS1){
-        data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame,
-                                      slot, 0, ulsch_input_buffer, TBS/8, &access_mode);
-        //IP traffic to be transmitted
-        if(data_existing){
-          //harq_process_ul_ue->a = (unsigned char*)calloc(harq_process_ul_ue->TBS/8, sizeof(unsigned char));
-          memcpy(harq_process_ul_ue->a, ulsch_input_buffer, TBS/8);
-        }
-      }
-      //Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity
-      if (!IS_SOFTMODEM_NOS1 || !data_existing) {
-        //Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid
-        //and block this traffic from being forwarded to the upper layers at the gNB
-        LOG_D(PHY, "Random data to be tranmsitted: \n");
-
-        //Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2)
-        //in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should
-        //have a valid LCID (nr_process_mac_pdu function)
-        harq_process_ul_ue->a[0] = 0x31;
-
-        for (i = 1; i < TBS / 8; i++) {
-          harq_process_ul_ue->a[i] = (unsigned char) rand();
-          //printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
-        }
-      }
-#ifdef DEBUG_MAC_PDU
-      LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", TBS/8);
-      for (i = 0; i < TBS / 8; i++) {
-        printf("%02x",harq_process_ul_ue->a[i]);
-      }
-      printf("\n");
-#endif
-    } else {
-      LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n");
-      return;
-    }
-
-    //-----------------------------------------------------//
-
     /////////////////////////ULSCH coding/////////////////////////
     ///////////
 
@@ -268,7 +218,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
   ///////////
   pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
   n_dmrs = (nb_rb*((dmrs_type == pusch_dmrs_type1) ? 6:4)*number_dmrs_symbols);
-  int16_t mod_dmrs[n_dmrs<<1];
+  int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16)));
   ///////////
   ////////////////////////////////////////////////////////////////////////
 
@@ -471,7 +421,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
   ///////////
   ////////////////////////////////////////////////////////////////////////
 
-  LOG_D(PHY, "Is data existing ?: %d \n", data_existing);
 }
 
 
diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
index d2a8e64749852cca94a30c6355d4995df85291f8..65bb2edaca82b274ac12949df3531980e2df0176 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
@@ -963,7 +963,7 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue,
   uint64_t b[16]; // limit to 1024-bit encoded length
   // M_bit is the number of bits of block b (payload after encoding)
   uint16_t M_bit;
-  nr_uci_encoding(payload,nr_bit,pucch_format2_nr,0,nrofSymbols,nrofPRB,1,0,0,(void*)b,&M_bit);
+  nr_uci_encoding(payload,nr_bit,pucch_format2_nr,0,nrofSymbols,nrofPRB,1,0,0,&b[0],&M_bit);
   /*
    * Implementing TS 38.211
    * Subclauses 6.3.2.5.1 Scrambling (PUCCH format 2)
@@ -985,7 +985,7 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue,
   /*
    * Implementing TS 38.211 Subclause 6.3.2.5.1 scrambling format 2
    */
-  nr_pucch2_3_4_scrambling(M_bit,rnti,data_scrambling_id,b,btilde);
+  nr_pucch2_3_4_scrambling(M_bit,rnti,data_scrambling_id,&b[0],btilde);
   /*
    * Implementing TS 38.211 Subclause 6.3.2.5.2 modulation format 2
    * btilde shall be modulated as described in subclause 5.1 using QPSK
@@ -1154,7 +1154,7 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue,
   //nrofPRB = 2; // only for test purposes
   if (fmt == pucch_format4_nr) nrofPRB = 1;
 
-  nr_uci_encoding(payload,nr_bit,fmt,is_pi_over_2_bpsk_enabled,nrofSymbols,nrofPRB,n_SF_PUCCH_s,intraSlotFrequencyHopping,add_dmrs,(void*)b,&M_bit);
+  nr_uci_encoding(payload,nr_bit,fmt,is_pi_over_2_bpsk_enabled,nrofSymbols,nrofPRB,n_SF_PUCCH_s,intraSlotFrequencyHopping,add_dmrs,&b[0],&M_bit);
   /*
    * Implementing TS 38.211
    * Subclauses 6.3.2.6.1 Scrambling (PUCCH formats 3 and 4)
@@ -1176,7 +1176,7 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue,
   /*
    * Implementing TS 38.211 Subclause 6.3.2.6.1 scrambling formats 3 and 4
    */
-  nr_pucch2_3_4_scrambling(M_bit,rnti,n_id,b,btilde);
+  nr_pucch2_3_4_scrambling(M_bit,rnti,n_id,&b[0],btilde);
   /*
    * Implementing TS 38.211 Subclause 6.3.2.6.2 modulation formats 3 and 4
    *
diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c
index dfb148d34e84c3c61e7c17ecc6679414c1931aae..44d7b93ae209ae8a27e26207355097b9268dbe29 100644
--- a/openair1/PHY/TOOLS/nr_phy_scope.c
+++ b/openair1/PHY/TOOLS/nr_phy_scope.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include "nr_phy_scope.h"
 #include "executables/nr-softmodem-common.h"
+#include "executables/softmodem-common.h"
 #include <forms.h>
 
 #define TPUT_WINDOW_LENGTH 100
@@ -400,7 +401,8 @@ static void *scope_thread_gNB(void *arg) {
   //  FILE *gNB_stats = fopen("gNB_stats.txt", "w");
   //#endif
   size_t stksize=0;
-  pthread_attr_t atr= {0};
+  pthread_attr_t atr;
+  pthread_attr_init(&atr);
   pthread_attr_getstacksize(&atr, &stksize);
   pthread_attr_setstacksize(&atr,32*1024*1024 );
   sleep(3); // no clean interthread barriers
@@ -768,6 +770,15 @@ void nrUEinitScope(PHY_VARS_NR_UE *ue) {
   threadCreate(&forms_thread, nrUEscopeThread, ue, "scope", -1, OAI_PRIORITY_RT_LOW);
 }
 
+
+void nrscope_autoinit(void *dataptr) {
+  AssertFatal( (IS_SOFTMODEM_GNB_BIT||IS_SOFTMODEM_5GUE_BIT),"Scope cannot find NRUE or GNB context");
+  
+  if (IS_SOFTMODEM_GNB_BIT)
+  	 gNBinitScope(dataptr);
+  else
+     nrUEinitScope(dataptr);
+}
 // Kept to put back the functionality soon
 #if 0
 //FD_stats_form                  *form_stats=NULL,*form_stats_l2=NULL;
@@ -795,6 +806,8 @@ static void reset_stats_gNB(FL_OBJECT *button,
   }
 }
 
+
+
 static FD_stats_form *create_form_stats_form(int ID) {
   FL_OBJECT *obj;
   FD_stats_form *fdui = calloc(( sizeof *fdui ),1);
diff --git a/openair1/PHY/TOOLS/nr_phy_scope.h b/openair1/PHY/TOOLS/nr_phy_scope.h
index 429537141a60f0cfba9753faf820348792062abc..84b9e66908bec48d048e3cee9f345ae5726cc1fd 100644
--- a/openair1/PHY/TOOLS/nr_phy_scope.h
+++ b/openair1/PHY/TOOLS/nr_phy_scope.h
@@ -40,8 +40,6 @@ typedef struct {
   PHY_VARS_gNB *gNB;
 } scopeParms_t;
 
-void gNBinitScope(scopeParms_t *p);
-void nrUEinitScope(PHY_VARS_NR_UE *ue);
 
 extern RAN_CONTEXT_t RC;
 #endif
diff --git a/openair1/PHY/TOOLS/phy_scope_interface.c b/openair1/PHY/TOOLS/phy_scope_interface.c
index 835fb4ea7b2a028f4ddfb378c3c877b699b6bc27..af237b2325e8a3f2fc035478cff4df4f39974901 100644
--- a/openair1/PHY/TOOLS/phy_scope_interface.c
+++ b/openair1/PHY/TOOLS/phy_scope_interface.c
@@ -37,10 +37,10 @@
 #define SOFTSCOPE_ENDFUNC_IDX 0
 static  loader_shlibfunc_t scope_fdesc[]= {{"end_forms",NULL}};
 
-int load_softscope(char *exectype) {
+int load_softscope(char *exectype, void *initarg) {
   char libname[64];
   sprintf(libname,"%.10sscope",exectype);
-  return load_module_shlib(libname,scope_fdesc,1,NULL);
+  return load_module_shlib(libname,scope_fdesc,1,initarg);
 }
 
 int end_forms(void) {
diff --git a/openair1/PHY/TOOLS/phy_scope_interface.h b/openair1/PHY/TOOLS/phy_scope_interface.h
index 779a57a7202450327cc8d515066191f48e373613..adf04d5ea4a6a7f664e23eab35c8bff82d46121e 100644
--- a/openair1/PHY/TOOLS/phy_scope_interface.h
+++ b/openair1/PHY/TOOLS/phy_scope_interface.h
@@ -31,5 +31,5 @@
  */
 
 
-int load_softscope(char *exectype);
+int load_softscope(char *exectype, void *initarg);
 int end_forms(void) ;
diff --git a/openair1/PHY/TOOLS/readme.md b/openair1/PHY/TOOLS/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..f6671acc6df14e006c428e6b603d01eced07daa3
--- /dev/null
+++ b/openair1/PHY/TOOLS/readme.md
@@ -0,0 +1,12 @@
+
+To use the scope, run the xNB or the UE with option "-d"  
+
+Usage in gdb
+In gdb, when you break, you can refresh immediatly the scope view by calling the display function.
+The first paramter is the graph context, nevertheless we keep the last value for a dirty call in gdb (so you can use '0')  
+
+Example with no variable known
+phy_scope_nrUE(0, PHY_vars_UE_g[0][0], 0, 0, 0)
+
+or
+phy_scope_gNB(0, phy_vars_gnb, phy_vars_ru, UE_id)
diff --git a/openair1/PHY/impl_defs_top.h b/openair1/PHY/impl_defs_top.h
index a4607d31067ab92725c3b15cc0ce887aff2f9821..6c3d97838d7b9337021b801143c0462de235462a 100644
--- a/openair1/PHY/impl_defs_top.h
+++ b/openair1/PHY/impl_defs_top.h
@@ -265,7 +265,7 @@
 #define NB_NUMEROLOGIES_NR                       (5)
 #define TDD_CONFIG_NB_FRAMES                     (2)
 #define NR_MAX_SLOTS_PER_FRAME                   (160)                    /* number of slots per frame */
-#define NR_UE_CAPABILITY_SLOT_RX_TO_TX           (4)                      /* FFS_NR_TODO it defines ue capability which is the number of slots */
+#define NR_UE_CAPABILITY_SLOT_RX_TO_TX           (6)                      /* FFS_NR_TODO it defines ue capability which is the number of slots */
                                                                           /* - between reception of pdsch and tarnsmission of its acknowlegment */
                                                                           /* - between reception of un uplink grant and its related transmission */
 
diff --git a/openair1/PHY/phy_vars.h b/openair1/PHY/phy_vars.h
index a74d148479d2158aa668416f36f97309272b8bb6..5e2be8bd8f76181ff7f660da8902ab2d1bf88415 100644
--- a/openair1/PHY/phy_vars.h
+++ b/openair1/PHY/phy_vars.h
@@ -59,10 +59,10 @@ const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
 unsigned char NB_RU=0;
 
 #ifndef OPENAIR2
-unsigned char NB_eNB_INST=0;
-uint16_t NB_UE_INST=0;
-unsigned char NB_RN_INST=0;
-unsigned char NB_INST=0;
+//unsigned char NB_eNB_INST=0;
+//uint16_t NB_UE_INST=0;
+//unsigned char NB_RN_INST=0;
+//unsigned char NB_INST=0;
 #endif
 
 int number_of_cards;
diff --git a/openair1/PHY/phy_vars_nr_ue.h b/openair1/PHY/phy_vars_nr_ue.h
index 1843d8d5bcd75a8b2ccdf4a4abc9facf50100490..baa64561f0e4bc5fc8b3dd0f2bc67788e3a10b78 100644
--- a/openair1/PHY/phy_vars_nr_ue.h
+++ b/openair1/PHY/phy_vars_nr_ue.h
@@ -138,4 +138,4 @@ uint8_t scrambling_lut[65536*16] __attribute__((aligned(32)));
 uint8_t max_ldpc_iterations=4;
 uint8_t max_turbo_iterations=4;
 
-#endif /*__PHY_VARS_H__ */
+#endif
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index 558fa8d4eb471ef9b3fc1e6920f525adc9065825..b3e3ab8c4e969f14422bce4c831adddc80692f24 100644
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -20,12 +20,12 @@
  */
 
 /*! \file phy_procedures_lte_eNB.c
- * \brief Implementation of eNB procedures from 36.213 LTE specifications
- * \author R. Knopp, F. Kaltenberger, N. Nikaein, X. Foukas
+ * \brief Implementation of eNB procedures from 36.213 LTE specifications / FeMBMS 36.231 LTE procedures v14.2
+ * \author R. Knopp, F. Kaltenberger, N. Nikaein, X. Foukas, J. Morgade
  * \date 2011
  * \version 0.1
  * \company Eurecom
- * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,navid.nikaein@eurecom.fr, x.foukas@sms.ed.ac.uk
+ * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,navid.nikaein@eurecom.fr, x.foukas@sms.ed.ac.uk, javier.morgade@ieee.org
  * \note
  * \warning
  */
@@ -122,12 +122,32 @@ lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subfr
 }
 
 #ifdef MBMS_NFAPI_SCHEDULER
-void pmch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
+void pmch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, int fembms_flag) {
   int subframe = proc->subframe_tx;
   // This is DL-Cell spec pilots in Control region
-  generate_pilots_slot (eNB, eNB->common_vars.txdataF, AMP, subframe << 1, 1);
-  if(eNB->dlsch_MCH->active==1)
-  	generate_mch (eNB, proc,NULL/*, eNB->dlsch_MCH->harq_processes[0]->pdu*/);
+  if(!fembms_flag){
+  	generate_pilots_slot (eNB, eNB->common_vars.txdataF, AMP, subframe << 1, 1);
+ 	generate_mbsfn_pilot(eNB,proc,
+                       eNB->common_vars.txdataF,
+                       AMP);
+  }else
+	generate_mbsfn_pilot_khz_1dot25(eNB,proc,
+                       eNB->common_vars.txdataF,
+                       AMP);
+
+  if(eNB->dlsch_MCH->active==1){
+	if(!fembms_flag){
+  	  generate_mch (eNB, proc,NULL/*, eNB->dlsch_MCH->harq_processes[0]->pdu*/);
+        }
+        else{
+ 	  generate_mch_khz_1dot25 (eNB, proc,NULL/*, eNB->dlsch_MCH->harq_processes[0]->pdu*/);
+        }
+
+    	  LOG_D(PHY,"[eNB%"PRIu8"] Frame %d subframe %d : Got MCH pdu for MBSFN (TBS %d) fembms %d \n",
+          eNB->Mod_id,proc->frame_tx,subframe,
+          eNB->dlsch_MCH->harq_processes[0]->TBS>>3,fembms_flag);
+
+  }
   eNB->dlsch_MCH->active = 0;
 }
 #else
@@ -171,6 +191,80 @@ void pmch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
 }
 #endif
 
+void common_signal_procedures_fembms (PHY_VARS_eNB *eNB,int frame, int subframe) {
+  LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
+  int **txdataF = eNB->common_vars.txdataF;
+  uint8_t *pbch_pdu=&eNB->pbch_pdu[0];
+
+  if((frame&3)!=0 /*&& subframe != 0*/)
+	  return;
+
+  LOG_I(PHY,"common_signal_procedures: frame %d, subframe %d fdd:%s dir:%s index:%d\n",frame,subframe,fp->frame_type == FDD?"FDD":"TDD", subframe_select(fp,subframe) == SF_DL?"DL":"UL?",(frame&15)/4);
+  // generate Cell-Specific Reference Signals for both slots
+  //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1);
+
+
+  if(subframe_select(fp,subframe) == SF_S)
+    generate_pilots_slot(eNB,
+                         txdataF,
+                         AMP,
+                         subframe<<1,1);
+  else
+    generate_pilots_slot(eNB,
+                         txdataF,
+                         AMP,
+                         subframe<<1,0);
+
+  // check that 2nd slot is for DL
+  if (subframe_select (fp, subframe) == SF_DL)
+    generate_pilots_slot (eNB, txdataF, AMP, (subframe << 1) + 1, 0);
+
+  //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME (VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX, 0);
+
+  // First half of PSS/SSS (FDD, slot 0)
+  if (subframe == 0) {
+    //if (fp->frame_type == FDD) {
+      generate_pss (txdataF, AMP, fp, (fp->Ncp == NORMAL) ? 6 : 5, 0);
+      generate_sss (txdataF, AMP, fp, (fp->Ncp == NORMAL) ? 5 : 4, 0);
+    //}
+
+    /// First half of SSS (TDD, slot 1)
+
+    //if (fp->frame_type == TDD) {
+      generate_sss (txdataF, AMP, fp, (fp->Ncp == NORMAL) ? 6 : 5, 1);
+    //}
+
+    // generate PBCH (Physical Broadcast CHannel) info
+
+    /// generate PBCH
+    if ((frame&15)==0) {
+      //AssertFatal(eNB->pbch_configured==1,"PBCH was not configured by MAC\n");
+      if (eNB->pbch_configured!=1) return;
+
+      eNB->pbch_configured=0;
+    }
+
+    T(T_ENB_PHY_MIB, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
+      T_BUFFER(pbch_pdu, 3));
+    generate_pbch_fembms (&eNB->pbch, txdataF, AMP, fp, pbch_pdu, (frame & 15)/4);
+  } //else if ((subframe == 1) && (fp->frame_type == TDD)) {
+    //generate_pss (txdataF, AMP, fp, 2, 2);
+ // }
+  // Second half of PSS/SSS (FDD, slot 10)
+  else if ((subframe == 5) && (fp->frame_type == FDD) && is_fembms_nonMBSFN_subframe(frame,subframe,fp)) {
+     generate_pss (txdataF, AMP, &eNB->frame_parms, (fp->Ncp == NORMAL) ? 6 : 5, 10);
+     generate_sss (txdataF, AMP, &eNB->frame_parms, (fp->Ncp == NORMAL) ? 5 : 4, 10);
+  }
+  //  Second-half of SSS (TDD, slot 11)
+ // else if ((subframe == 5) && (fp->frame_type == TDD)) {
+ //   generate_sss (txdataF, AMP, fp, (fp->Ncp == NORMAL) ? 6 : 5, 11);
+ // }
+  // Second half of PSS (TDD, slot 12)
+ // else if ((subframe == 6) && (fp->frame_type == TDD)) {
+ //   generate_pss (txdataF, AMP, fp, 2, 12);
+ // }
+}
+
 void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) {
   LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
   int **txdataF = eNB->common_vars.txdataF;
@@ -417,12 +511,30 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
   }
 
   if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) {
+    if (is_fembms_pmch_subframe(frame,subframe,fp)) {
+#ifdef MBMS_NFAPI_SCHEDULER	    
+      pmch_procedures(eNB,proc,1);
+      LOG_D(MAC,"frame %d, subframe %d -> PMCH\n",frame,subframe);
+      return;
+#endif
+    }else if(is_fembms_cas_subframe(frame,subframe,fp) || is_fembms_nonMBSFN_subframe(frame,subframe,fp)){
+         LOG_D(MAC,"frame %d, subframe %d -> CAS\n",frame,subframe);
+	common_signal_procedures_fembms(eNB,proc->frame_tx, proc->subframe_tx);
+	//return;
+    }
+
+  if((!is_fembms_cas_subframe(frame,subframe,fp)) && (!is_fembms_nonMBSFN_subframe(frame,subframe,fp))){
     if (is_pmch_subframe(frame,subframe,fp)) {
+#ifdef MBMS_NFAPI_SCHEDULER	    
+      pmch_procedures(eNB,proc,0);
+#else
       pmch_procedures(eNB,proc);
+#endif
     } else {
       // this is not a pmch subframe, so generate PSS/SSS/PBCH
       common_signal_procedures(eNB,proc->frame_tx, proc->subframe_tx);
     }
+   }
   }
 
   // clear existing ulsch dci allocations before applying info from MAC  (this is table
@@ -508,6 +620,18 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
 
   if (do_meas==1) start_meas(&eNB->dlsch_ue_specific);
 
+  if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) {
+    if (is_fembms_pmch_subframe(frame,subframe,fp)) {
+#ifdef MBMS_NFAPI_SCHEDULER	    
+      pmch_procedures(eNB,proc,1);
+      return;
+#endif
+    }else if(is_fembms_cas_subframe(frame,subframe,fp)){
+	common_signal_procedures_fembms(eNB,proc->frame_tx, proc->subframe_tx);
+    }
+  }
+
+
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0);
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
   // Now scan UE specific DLSCH
diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c
index cb0382138812f010d54efd9ff5e7d41c686344e9..e472d64db44c4b8fc7ea5234bb95ecff4125f5a9 100644
--- a/openair1/SCHED/ru_procedures.c
+++ b/openair1/SCHED/ru_procedures.c
@@ -41,6 +41,17 @@
  * \warning
  */
 
+/*! \function feptx0
+ * \brief Implementation of ofdm encoding for FeMBMS profile in one eNB
+ * \author J. Morgade
+ * \date 2020
+ * \version 0.1
+ * \email: javier.morgade@ieee.org
+ * \note
+ * \warning
+ */
+
+
 
 #include "PHY/defs_eNB.h"
 #include "PHY/phy_extern.h"
@@ -76,7 +87,7 @@ void feptx0(RU_t *ru,
   int slot_sizeF = (fp->ofdm_symbol_size) * ((fp->Ncp==1) ? 6 : 7);
   int subframe = ru->proc.tti_tx;
 
-  //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+slot , 1 );
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(slot&1) , 1 );
 
   slot_offset = slot*(fp->samples_per_tti>>1); //slot_offset = subframe*fp->samples_per_tti + (slot*(fp->samples_per_tti>>1));
 
@@ -91,7 +102,17 @@ void feptx0(RU_t *ru,
                    fp->nb_prefix_samples,
                    CYCLIC_PREFIX);
     } else {
-      if(is_pmch_subframe(ru->proc.frame_tx,subframe,fp)){
+      if(is_fembms_pmch_subframe(ru->proc.frame_tx,subframe,fp)){
+        if((slot&1)==0){//just use one slot chance
+               PHY_ofdm_mod(&ru->common.txdataF_BF[aa][(slot&1)*slot_sizeF],
+                       (int*)&ru->common.txdata[aa][slot_offset],
+                       fp->ofdm_symbol_size_khz_1dot25,
+                       1,
+                       fp->ofdm_symbol_size_khz_1dot25>>2,
+                       CYCLIC_PREFIX);
+               LOG_D(HW,"Generating PMCH FeMBMS TX subframe %d %d\n",subframe,fp->ofdm_symbol_size_khz_1dot25);
+      	}
+      } else if(is_pmch_subframe(ru->proc.frame_tx,subframe,fp)){
         if ((slot&1) == 0) {//just use one slot chance
           normal_prefix_mod(&ru->common.txdataF_BF[aa][(slot&1)*slot_sizeF],
                             (int*)&ru->common.txdata[aa][slot_offset],
diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c
index 0ccb13fc7ccf125230a94f56de979cd8066c0818..9d34f496b3fcd6e454ed5520ac9a2a065bee562f 100644
--- a/openair1/SCHED_NR/phy_frame_config_nr.c
+++ b/openair1/SCHED_NR/phy_frame_config_nr.c
@@ -29,11 +29,9 @@
 *
 ************************************************************************/
 
-#include "SCHED_NR_UE/defs.h"
+#include "PHY/defs_nr_common.h"
 #include "PHY/defs_nr_UE.h"
-#include "SCHED_NR_UE/phy_frame_config_nr.h"
-#include "PHY/impl_defs_nr.h"
-#include "PHY/impl_defs_top.h"
+#include "SCHED_NR/phy_frame_config_nr.h"
 
 /*******************************************************************
 *
@@ -369,73 +367,6 @@ int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti)
   }
 }
 
-/*******************************************************************
-*
-* NAME :         nr_ue_slot_select
-*
-* DESCRIPTION :  function for the UE equivalent to nr_slot_select
-*
-*********************************************************************/
-
-int nr_ue_slot_select(fapi_nr_config_request_t *cfg, int nr_frame, int nr_tti) {
-  /* for FFD all slot can be considered as an uplink */
-  int mu = cfg->ssb_config.scs_common, check_slot = 0;
-
-  if (cfg->cell_config.frame_duplex_type == FDD) {
-    return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT);
-  }
-
-  if (nr_frame%2 == 0) {
-    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
-      if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config == 1) {
-        check_slot++;
-      }
-    }
-
-    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
-      return (NR_UPLINK_SLOT);
-    }
-
-    check_slot = 0;
-
-    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
-      if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config == 0) {
-        check_slot++;
-      }
-    }
-
-    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
-      return (NR_DOWNLINK_SLOT);
-    } else {
-      return (NR_MIXED_SLOT);
-    }
-  } else {
-    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
-      if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config == 1) {
-        check_slot++;
-      }
-    }
-
-    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
-      return (NR_UPLINK_SLOT);
-    }
-
-    check_slot = 0;
-
-    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
-      if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config == 0) {
-        check_slot++;
-      }
-    }
-
-    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
-      return (NR_DOWNLINK_SLOT);
-    } else {
-      return (NR_MIXED_SLOT);
-    }
-  }
-}
-
 /*******************************************************************
 *
 * NAME :         free_tdd_configuration_nr
diff --git a/openair1/SCHED_NR/phy_frame_config_nr.h b/openair1/SCHED_NR/phy_frame_config_nr.h
index e17638f7f30d98b3eca9bb265182c6d8fdf96d91..ee4b500280a92b8470c61c52cf6853d3f44edf5f 100644
--- a/openair1/SCHED_NR/phy_frame_config_nr.h
+++ b/openair1/SCHED_NR/phy_frame_config_nr.h
@@ -32,7 +32,6 @@
 #ifndef PHY_FRAME_CONFIG_NR_H
 #define PHY_FRAME_CONFIG_NR_H
 
-#include <nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h>
 /************** DEFINE ********************************************/
 
 #define TDD_CONFIG_NB_FRAMES           (2)
@@ -77,10 +76,9 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms);
  *  @param frame_parms NR DL Frame parameters
  *  @param nr_frame : frame number
  *  @param nr_tti   : slot number
-    @returns nr_slot_t : downlink or uplink */
+    @returns int : downlink, uplink or mixed slot type*/
 
-nr_slot_t nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti);
-int nr_ue_slot_select(fapi_nr_config_request_t *cfg, int nr_frame, int nr_tti);
+int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti);
 
 /** \brief This function frees tdd configuration for nr
  *  @param frame_parms NR DL Frame parameters
diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
index 992c908c5d2e4572f61ccdc80c9ca7b9839c6d75..94e356951aa916e105fe39f04a291a134d2425dc 100644
--- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c
+++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
@@ -424,7 +424,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
   for (int ULSCH_id=0;ULSCH_id<NUMBER_OF_NR_ULSCH_MAX;ULSCH_id++) {
     NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
     int harq_pid;
-    int no_sig;
+    //int no_sig;
     NR_UL_gNB_HARQ_t *ulsch_harq;
 
     if ((ulsch) &&
diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
index f852ae4ae18d6be1ced80a05b5868dadd74eb169..ea73f2feccdc486bc33311d9a0a67a400af0c37c 100644
--- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
+++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
@@ -106,6 +106,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
             dlsch0_harq->start_symbol = dlsch_config_pdu->start_symbol;
             dlsch0_harq->dlDmrsSymbPos = dlsch_config_pdu->dlDmrsSymbPos;
             dlsch0_harq->dmrsConfigType = dlsch_config_pdu->dmrsConfigType;
+            dlsch0_harq->n_dmrs_cdm_groups = dlsch_config_pdu->n_dmrs_cdm_groups;
             dlsch0_harq->mcs = dlsch_config_pdu->mcs;
             dlsch0_harq->rvidx = dlsch_config_pdu->rv;
             dlsch0->g_pucch = dlsch_config_pdu->accumulated_delta_PUCCH;
@@ -147,12 +148,32 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
           // pusch config pdu
           pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu;
           current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id;
-          nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch0->harq_processes[current_harq_pid]->pusch_pdu;
+          NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch0->harq_processes[current_harq_pid];
 
-          memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t));
+          if (harq_process_ul_ue){
+
+            nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu;
+
+            memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t));
+
+            ulsch0->f_pusch = pusch_config_pdu->absolute_delta_PUSCH;
+
+            if (scheduled_response->tx_request){
+              fapi_nr_tx_request_body_t *tx_req_body = scheduled_response->tx_request->tx_request_body;
+
+              //harq_process_ul_ue->a = (unsigned char*)calloc(TBS/8, sizeof(unsigned char));
+              memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length);
+
+              harq_process_ul_ue->status = ACTIVE;
+            }
+
+          } else {
+
+            LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n");
+            return -1;
+
+          }
 
-          ulsch0->f_pusch = pusch_config_pdu->absolute_delta_PUSCH;
-          ulsch0->harq_processes[current_harq_pid]->status = ACTIVE;
         break;
 
         case (FAPI_NR_UL_CONFIG_TYPE_PUCCH):
@@ -214,9 +235,6 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
     } else {
     }
 
-    if (scheduled_response->tx_request != NULL){
-    } else {
-    }
   }
 
   return 0;
diff --git a/openair1/SCHED_NR_UE/phy_frame_config_nr.h b/openair1/SCHED_NR_UE/phy_frame_config_nr.h
index a7e78397fe1be156bc75ab1977b7367a629762d5..36692395787099c63d31b87eec604557e14467b0 100644
--- a/openair1/SCHED_NR_UE/phy_frame_config_nr.h
+++ b/openair1/SCHED_NR_UE/phy_frame_config_nr.h
@@ -62,10 +62,18 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms);
  *  @param frame_parms NR DL Frame parameters
  *  @param nr_frame : frame number
  *  @param nr_tti   : slot number
-    @returns nr_slot_t : downlink or uplink */
+    @returns int : downlink or uplink */
 
 int slot_select_nr(NR_DL_FRAME_PARMS *frame_parms, int nr_frame, int nr_tti);
 
+/** \brief This function checks nr UE slot direction : downlink or uplink
+ *  @param cfg      : FAPI Config Request
+ *  @param nr_frame : frame number
+ *  @param nr_tti   : slot number
+    @returns int : downlink, uplink or mixed slot type */
+
+int nr_ue_slot_select(fapi_nr_config_request_t *cfg, int nr_frame, int nr_tti);
+
 /** \brief This function frees tdd configuration for nr
  *  @param frame_parms NR DL Frame parameters
     @returns none */
diff --git a/openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c b/openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c
new file mode 100644
index 0000000000000000000000000000000000000000..640ffb4ac361c572cf1275ca701bb51612e3ba28
--- /dev/null
+++ b/openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/***********************************************************************
+*
+* FILENAME    :  phy_frame_configuration_nr_ue.c
+*
+* DESCRIPTION :  functions related to FDD/TDD configuration for NR
+*                see TS 38.213 11.1 Slot configuration
+*                and TS 38.331 for RRC configuration
+*
+************************************************************************/
+
+#include "PHY/defs_nr_UE.h"
+
+/*******************************************************************
+*
+* NAME :         nr_ue_slot_select
+*
+* DESCRIPTION :  function for the UE equivalent to nr_slot_select
+*
+*********************************************************************/
+
+int nr_ue_slot_select(fapi_nr_config_request_t *cfg, int nr_frame, int nr_tti) {
+  /* for FFD all slot can be considered as an uplink */
+  int mu = cfg->ssb_config.scs_common, check_slot = 0;
+
+  if (cfg->cell_config.frame_duplex_type == FDD) {
+    return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT);
+  }
+
+  if (nr_frame%2 == 0) {
+    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
+      if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config == 1) {
+        check_slot++;
+      }
+    }
+
+    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
+      return (NR_UPLINK_SLOT);
+    }
+
+    check_slot = 0;
+
+    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
+      if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config == 0) {
+        check_slot++;
+      }
+    }
+
+    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
+      return (NR_DOWNLINK_SLOT);
+    } else {
+      return (NR_MIXED_SLOT);
+    }
+  } else {
+    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
+      if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config == 1) {
+        check_slot++;
+      }
+    }
+
+    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
+      return (NR_UPLINK_SLOT);
+    }
+
+    check_slot = 0;
+
+    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
+      if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config == 0) {
+        check_slot++;
+      }
+    }
+
+    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
+      return (NR_DOWNLINK_SLOT);
+    } else {
+      return (NR_MIXED_SLOT);
+    }
+  }
+}
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index e902977721748554960775008223805e2ab33d54..68715e27a80babd3dc52455bfcd1b7fc1bf25801 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -2269,7 +2269,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
 
   /* RACH */
   if (get_softmodem_params()->do_ra==1) {
-    if ((ue->UE_mode[gNB_id] == PRACH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) {
+    if ((ue->UE_mode[gNB_id] < PUSCH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) {
       nr_ue_prach_procedures(ue, proc, gNB_id, mode);
     }
   }
@@ -3289,9 +3289,8 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
   NR_UE_PDSCH *pdsch_vars;
   uint8_t is_cw0_active = 0;
   uint8_t is_cw1_active = 0;
-  uint8_t dmrs_type = dlsch0->harq_processes[harq_pid]->dmrsConfigType;
-  uint8_t nb_re_dmrs = (dmrs_type==NFAPI_NR_DMRS_TYPE1)?6:4; // TODO: should changed my mac
-  uint16_t length_dmrs = 1; //cfg->pdsch_config.dmrs_max_length.value;
+  uint8_t dmrs_type, nb_re_dmrs;
+  uint16_t length_dmrs = 1; 
   uint16_t nb_symb_sch = 9;
   nr_downlink_indication_t dl_indication;
   fapi_nr_rx_indication_t rx_ind;
@@ -3316,6 +3315,13 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
   is_cw0_active = dlsch0->harq_processes[harq_pid]->status;
   nb_symb_sch = dlsch0->harq_processes[harq_pid]->nb_symbols;
   start_symbol = dlsch0->harq_processes[harq_pid]->start_symbol;
+  dmrs_type = dlsch0->harq_processes[harq_pid]->dmrsConfigType;
+  if (dmrs_type==NFAPI_NR_DMRS_TYPE1) {
+    nb_re_dmrs = 6*dlsch0->harq_processes[harq_pid]->n_dmrs_cdm_groups;
+  }
+  else {
+    nb_re_dmrs = 4*dlsch0->harq_processes[harq_pid]->n_dmrs_cdm_groups;
+  }
 
   if(dlsch1)
     is_cw1_active = dlsch1->harq_processes[harq_pid]->status;
@@ -4603,6 +4609,8 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
 
     if (ue->prach_cnt == 3)
       ue->prach_cnt = 0;
+  } else if (nr_prach == 2) {
+    nr_ra_succeeded(mod_id, ue->CC_id, gNB_id);
   }
 
   // if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue
diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c
index e0ea4ef2b28dc0144ac6c19e0ad7f336d36d0be2..3215718f8ec4805c5c9d4371e90c09a5086ad662 100644
--- a/openair1/SCHED_UE/phy_procedures_lte_ue.c
+++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c
@@ -2383,10 +2383,12 @@ void ue_pbch_procedures(uint8_t eNB_id,
   if (pbch_phase>=4)
     pbch_phase=0;
 
+if((ue->frame_parms.FeMBMS_active == 0)|| is_fembms_cas_subframe(frame_rx,subframe_rx,&ue->frame_parms) || first_run) {
+
   for (pbch_trials=0; pbch_trials<4; pbch_trials++) {
     //for (pbch_phase=0;pbch_phase<4;pbch_phase++) {
     //LOG_I(PHY,"[UE  %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,eNB_id);
-    if(is_fembms_cas_subframe(frame_rx,subframe_rx,&ue->frame_parms)) {
+    if(is_fembms_cas_subframe(frame_rx,subframe_rx,&ue->frame_parms) || ue->frame_parms.FeMBMS_active) {
       pbch_tx_ant = rx_pbch_fembms(&ue->common_vars,
                                    ue->pbch_vars[eNB_id],
                                    &ue->frame_parms,
@@ -2431,9 +2433,10 @@ void ue_pbch_procedures(uint8_t eNB_id,
 
     ue->pbch_vars[eNB_id]->pdu_errors_conseq = 0;
 
-    if(is_fembms_cas_subframe(frame_rx,subframe_rx,&ue->frame_parms)) {
+    if(is_fembms_cas_subframe(frame_rx,subframe_rx,&ue->frame_parms) || ue->frame_parms.FeMBMS_active) {
       frame_tx  = (int)((ue->pbch_vars[eNB_id]->decoded_output[2]&31)<<1);
       frame_tx += ue->pbch_vars[eNB_id]->decoded_output[1]>>7;
+      frame_tx = frame_tx<<4;
       frame_tx +=4*pbch_phase;
     } else {
       frame_tx = (((int)(ue->pbch_vars[eNB_id]->decoded_output[2]&0x03))<<8);
@@ -2490,7 +2493,7 @@ void ue_pbch_procedures(uint8_t eNB_id,
     }
 
     if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) {
-      LOG_UI(PHY,"[UE %d] frame %d, subframe %d, Received PBCH (MIB): nb_antenna_ports_eNB %d, tx_ant %d, frame_tx %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6!\n",
+      LOG_D(PHY,"[UE %d] frame %d, subframe %d, Received PBCH (MIB): nb_antenna_ports_eNB %d, tx_ant %d, frame_tx %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6!\n",
              ue->Mod_id,
              frame_rx,
              subframe_rx,
@@ -2501,6 +2504,17 @@ void ue_pbch_procedures(uint8_t eNB_id,
              ue->frame_parms.phich_config_common.phich_duration,
              ue->frame_parms.phich_config_common.phich_resource);
     }
+    LOG_D(PHY,"[UE %d] frame %d, subframe %d, Received PBCH (MIB): nb_antenna_ports_eNB %d, tx_ant %d, frame_tx %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6!\n",
+             ue->Mod_id,
+             frame_rx,
+             subframe_rx,
+             ue->frame_parms.nb_antenna_ports_eNB,
+             pbch_tx_ant,
+             frame_tx,
+             ue->frame_parms.N_RB_DL,
+             ue->frame_parms.phich_config_common.phich_duration,
+             ue->frame_parms.phich_config_common.phich_resource);
+
   } else {
     if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) {
       LOG_E(PHY,"[UE %d] frame %d, subframe %d, Error decoding PBCH!\n",
@@ -2533,6 +2547,8 @@ void ue_pbch_procedures(uint8_t eNB_id,
            ue->pbch_vars[eNB_id]->pdu_errors_conseq);
   }
 
+} //if((ue->frame_parms.FeMBMS_active == 0)|| is_fembms_cas_subframe(frame_rx,subframe_rx,&ue->frame_parms) || first_run)
+
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_OUT);
 }
 
@@ -2877,10 +2893,19 @@ void ue_pmch_procedures(PHY_VARS_UE *ue,
   int l;
   int ret=0;
 
-  if (is_pmch_subframe(frame_rx,subframe_rx,&ue->frame_parms)) {
+  if (is_pmch_subframe(frame_rx,subframe_rx,&ue->frame_parms) || fembms_flag) {
     // LOG_D(PHY,"ue calling pmch subframe ..\n ");
     LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Querying for PMCH demodulation\n",
           ue->Mod_id,frame_rx,subframe_rx);
+    if(fembms_flag)
+    pmch_mcs = ue_query_mch_fembms(ue->Mod_id,
+                            CC_id,
+                            frame_rx,
+                            subframe_rx,
+                            eNB_id,
+                            &sync_area,
+                            &mcch_active);
+    else
     pmch_mcs = ue_query_mch(ue->Mod_id,
                             CC_id,
                             frame_rx,
@@ -2960,6 +2985,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue,
       LOG_D(PHY,"start turbo decode for MCH %d.%d --> Nl %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->harq_processes[0]->Nl);
       LOG_D(PHY,"start turbo decode for MCH %d.%d --> G  %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->harq_processes[0]->G);
       LOG_D(PHY,"start turbo decode for MCH %d.%d --> Kmimo  %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->Kmimo);
+
       ret = dlsch_decoding(ue,
                            ue->pdsch_vars_MCH[ue->current_thread_id[subframe_rx]][0]->llr[0],
                            &ue->frame_parms,
@@ -3007,14 +3033,14 @@ void ue_pmch_procedures(PHY_VARS_UE *ue,
         //  if (subframe_rx==9)
         //  mac_xface->macphy_exit("Why are we exiting here?");
       } else { // decoding successful
-        LOG_D(PHY,"[UE %d] Frame %d, subframe %d: PMCH OK (%d,%d), passing to L2 (TBS %d, iter %d,G %d)\n",
+        LOG_D(PHY,"[UE %d] Frame %d, subframe %d: PMCH OK (%d,%d), passing to L2 (TBS %d, iter %d,G %d) ret %d\n",
               ue->Mod_id,
               frame_rx,subframe_rx,
               ue->dlsch_mcch_errors[sync_area][0],
               ue->dlsch_mtch_errors[sync_area][0],
               ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3,
               ue->dlsch_MCH[0]->max_turbo_iterations,
-              ue->dlsch_MCH[0]->harq_processes[0]->G);
+              ue->dlsch_MCH[0]->harq_processes[0]->G,ret);
         ue_send_mch_sdu(ue->Mod_id,
                         CC_id,
                         frame_rx,
@@ -3022,6 +3048,8 @@ void ue_pmch_procedures(PHY_VARS_UE *ue,
                         ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3,
                         eNB_id,// not relevant in eMBMS context
                         sync_area);
+        //dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx);
+        //exit_fun("nothing to add");
 
         if (mcch_active == 1)
           ue->dlsch_mcch_received[sync_area][0]++;
@@ -4429,6 +4457,15 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,
     ue_pmch_procedures(ue,proc,eNB_id,abstraction_flag,1);
     return 0;
   } else { // this gets closed at end
+    if (is_fembms_cas_subframe(frame_rx,subframe_rx,&ue->frame_parms) || is_fembms_nonMBSFN_subframe(frame_rx,subframe_rx,&ue->frame_parms) ) {
+      l=0;
+      slot_fep(ue,
+       l,
+       subframe_rx<<1,
+       0,
+       0,
+       0);
+    }
     pmch_flag = is_pmch_subframe(frame_rx,subframe_rx,&ue->frame_parms) ? 1 : 0;
 
     if (do_pdcch_flag) {
diff --git a/openair1/SIMULATION/LTE_PHY/dummy_functions.c b/openair1/SIMULATION/LTE_PHY/dummy_functions.c
index 5ec0f6e6967cc2ae27bfe8b9b3b5d3d199b9525c..120e4845d92608ccc11c9f30080030fc70f8e103 100644
--- a/openair1/SIMULATION/LTE_PHY/dummy_functions.c
+++ b/openair1/SIMULATION/LTE_PHY/dummy_functions.c
@@ -67,6 +67,11 @@ int ue_query_mch(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
 		 sub_frame_t subframe, uint8_t eNB_index,
 		 uint8_t * sync_area, uint8_t * mcch_active){ return(0);}
 
+
+int ue_query_mch_fembms(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
+		 sub_frame_t subframe, uint8_t eNB_index,
+		 uint8_t * sync_area, uint8_t * mcch_active){ return(0);}
+
 void dl_phy_sync_success(module_id_t module_idP,
 			 frame_t frameP,
 			 unsigned char eNB_index, uint8_t first_sync){}
diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c
index 65415e7c68b97633eff7557dfe51ffba935f70f5..5073be24f5f3f73d8fc1667eb53342bcf7e13cba 100644
--- a/openair1/SIMULATION/LTE_PHY/mbmssim.c
+++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c
@@ -19,204 +19,1048 @@
  *      contact@openairinterface.org
  */
 
+/*! \file mbmssim.c
+ \brief Top-level MBMS DL simulator
+ \authors R. Knopp, J. Morgade
+ \date 2011 - 2014 (Knopp) / 2020 (Morgade)
+ \version 0.1
+ \company Eurecom
+ \email: knopp@eurecom.fr, javier.morgade@ieee.org
+ \note
+ \warning
+*/
+
 #include <string.h>
 #include <math.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
+#include <execinfo.h>
+#include <signal.h>
 
-#include "SIMULATION/TOOLS/defs.h"
-#include "SIMULATION/RF/defs.h"
+#include "SIMULATION/TOOLS/sim.h"
 #include "PHY/types.h"
-#include "PHY/defs.h"
-#include "PHY/vars.h"
-#include "SCHED/defs.h"
-#include "SCHED/vars.h"
-#include "LAYER2/MAC/vars.h"
-
-#ifdef XFORMS
-  #include "PHY/TOOLS/lte_phy_scope.h"
-#endif //XFORMS
+#include "PHY/defs_eNB.h"
+#include "PHY/defs_UE.h"
+#include "PHY/phy_vars.h"
 
+#include "SCHED/sched_eNB.h"
+#include "SCHED/sched_common_vars.h"
+#include "LAYER2/MAC/mac_vars.h"
 
 #include "OCG_vars.h"
+#include "common/utils/LOG/log.h"
+#include "UTIL/LISTS/list.h"
+
 #include "unitary_defs.h"
 
 
-PHY_VARS_eNB *eNB;
-PHY_VARS_UE *UE;
+#include "PHY/TOOLS/lte_phy_scope.h"
+
+#include "dummy_functions.c"
+
+#include "PHY/MODULATION/modulation_common.h"
+#include "PHY/MODULATION/modulation_eNB.h"
+#include "PHY/MODULATION/modulation_UE.h"
+#include "PHY/LTE_TRANSPORT/transport_proto.h"
+#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
+#include "SCHED/sched_eNB.h"
+#include "SCHED_UE/sched_UE.h"
+#include "common/config/config_load_configmodule.h"
+#include "PHY/INIT/phy_init.h"
+#include "nfapi/oai_integration/vendor_ext.h"
+
+#define ENABLE_MBMS_SIM
+
+int enable_fembms=1;
+
+void feptx_ofdm(RU_t *ru);
+void feptx_prec(RU_t *ru);
 
 double cpuf;
+#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
+//#define MCS_COUNT 23//added for PHY abstraction
+#include <openair1/SIMULATION/LTE_PHY/common_sim.h>
+
+int otg_enabled=0;
+/*the following parameters are used to control the processing times calculations*/
+double t_tx_max = -1000000000; /*!< \brief initial max process time for tx */
+double t_rx_max = -1000000000; /*!< \brief initial max process time for rx */
+double t_tx_min = 1000000000; /*!< \brief initial min process time for tx */
+double t_rx_min = 1000000000; /*!< \brief initial min process time for rx */
+int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
+int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
+
+THREAD_STRUCT thread_struct;
+
+int emulate_rf = 0;
+
+void handler(int sig) {
+  void *array[10];
+  size_t size;
+  // get void*'s for all entries on the stack
+  size = backtrace(array, 10);
+  // print out all the frames to stderr
+  fprintf(stderr, "Error: signal %d:\n", sig);
+  backtrace_symbols_fd(array, size, 2);
+  exit(1);
+}
+
+
+
+//DCI2_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2_2A[2];
 
 DCI1E_5MHz_2A_M10PRB_TDD_t  DLSCH_alloc_pdu2_1E[2];
+uint64_t DLSCH_alloc_pdu_1[2];
+
 #define UL_RB_ALLOC 0x1ff;
 #define CCCH_RB_ALLOC computeRIV(eNB->frame_parms.N_RB_UL,0,2)
+//#define DLSCH_RB_ALLOC 0x1fbf // igore DC component,RB13
+//#define DLSCH_RB_ALLOC 0x0001
+void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, 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++) {
+    //    printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc());
+    if (frame_parms->Ncp == 1)
+      PHY_ofdm_mod(&txdataF[aa][slot_offset_F],        // input
+                   &txdata[aa][slot_offset],         // output
+                   frame_parms->ofdm_symbol_size,
+                   6,                 // number of symbols
+                   frame_parms->nb_prefix_samples,               // number of prefix samples
+                   CYCLIC_PREFIX);
+    else {
+      normal_prefix_mod(&txdataF[aa][slot_offset_F],
+                        &txdata[aa][slot_offset],
+                        7,
+                        frame_parms);
+    }
+  }
+}
+
+void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR, int tx_lev,int hold_channel,int abstx, int num_rounds, int trials, int round, channel_desc_t *eNB2UE[4],
+                double *s_re[2],double *s_im[2],double *r_re[2],double *r_im[2],FILE *csv_fd) {
+  int i,u;
+  int aa,aarx,aatx;
+  double channelx,channely;
+  double sigma2_dB,sigma2;
+  double iqim=0.0;
+
+  //    printf("Copying tx ..., nsymb %d (n_tx %d), awgn %d\n",nsymb,eNB->frame_parms.nb_antennas_tx,awgn_flag);
+  for (i=0; i<2*UE->frame_parms.samples_per_tti; i++) {
+    for (aa=0; aa<ru->frame_parms.nb_antennas_tx; aa++) {
+      if (awgn_flag == 0) {
+        s_re[aa][i] = ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) + (i<<1)]);
+        s_im[aa][i] = ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)+1]);
+      } else {
+        for (aarx=0; aarx<UE->frame_parms.nb_antennas_rx; aarx++) {
+          if (aa==0) {
+            r_re[aarx][i] = ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)]);
+            r_im[aarx][i] = ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)+1]);
+          } else {
+            r_re[aarx][i] += ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)]);
+            r_im[aarx][i] += ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)+1]);
+          }
+        }
+      }
+    }
+  }
+
+  // Multipath channel
+  if (awgn_flag == 0) {
+    multipath_channel(eNB2UE[round],s_re,s_im,r_re,r_im,
+                      2*UE->frame_parms.samples_per_tti,hold_channel);
+
+    //      printf("amc: ****************** eNB2UE[%d]->n_rx = %d,dd %d\n",round,eNB2UE[round]->nb_rx,eNB2UE[round]->channel_offset);
+    if(abstx==1 && num_rounds>1)
+      if(round==0 && hold_channel==0) {
+        random_channel(eNB2UE[1],0);
+        random_channel(eNB2UE[2],0);
+        random_channel(eNB2UE[3],0);
+      }
+
+    if (UE->perfect_ce==1) {
+      // fill in perfect channel estimates
+      freq_channel(eNB2UE[round],UE->frame_parms.N_RB_DL,12*UE->frame_parms.N_RB_DL + 1);
+      /*
+      LOG_M("channel.m","ch",eNB2UE[round]->ch[0],eNB2UE[round]->channel_length,1,8);
+      LOG_M("channelF.m","chF",eNB2UE[round]->chF[0],12*UE->frame_parms.N_RB_DL + 1,1,8);
+      */
+    }
+  }
+
+  if(abstx) {
+    if (trials==0 && round==0) {
+      // calculate freq domain representation to compute SINR
+      freq_channel(eNB2UE[0], ru->frame_parms.N_RB_DL,2*ru->frame_parms.N_RB_DL + 1);
+      // snr=pow(10.0,.1*SNR);
+      fprintf(csv_fd,"%f,",SNR);
+
+      for (u=0; u<2*ru->frame_parms.N_RB_DL; u++) {
+        for (aarx=0; aarx<eNB2UE[0]->nb_rx; aarx++) {
+          for (aatx=0; aatx<eNB2UE[0]->nb_tx; aatx++) {
+            channelx = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].x;
+            channely = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].y;
+            fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
+          }
+        }
+      }
+
+      if(num_rounds>1) {
+        freq_channel(eNB2UE[1], ru->frame_parms.N_RB_DL,2*ru->frame_parms.N_RB_DL + 1);
+
+        for (u=0; u<2*ru->frame_parms.N_RB_DL; u++) {
+          for (aarx=0; aarx<eNB2UE[1]->nb_rx; aarx++) {
+            for (aatx=0; aatx<eNB2UE[1]->nb_tx; aatx++) {
+              channelx = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].x;
+              channely = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].y;
+              fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
+            }
+          }
+        }
+
+        freq_channel(eNB2UE[2], ru->frame_parms.N_RB_DL,2*ru->frame_parms.N_RB_DL + 1);
+
+        for (u=0; u<2*ru->frame_parms.N_RB_DL; u++) {
+          for (aarx=0; aarx<eNB2UE[2]->nb_rx; aarx++) {
+            for (aatx=0; aatx<eNB2UE[2]->nb_tx; aatx++) {
+              channelx = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].x;
+              channely = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].y;
+              fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
+            }
+          }
+        }
+
+        freq_channel(eNB2UE[3], ru->frame_parms.N_RB_DL,2*ru->frame_parms.N_RB_DL + 1);
+
+        for (u=0; u<2*ru->frame_parms.N_RB_DL; u++) {
+          for (aarx=0; aarx<eNB2UE[3]->nb_rx; aarx++) {
+            for (aatx=0; aatx<eNB2UE[3]->nb_tx; aatx++) {
+              channelx = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].x;
+              channely = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].y;
+              fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
+            }
+          }
+        }
+      }
+    }
+  }
+
+  //AWGN
+  // tx_lev is the average energy over the whole subframe
+  // but SNR should be better defined wrt the energy in the reference symbols
+  sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)ru->frame_parms.ofdm_symbol_size/(double)(ru->frame_parms.N_RB_DL*12)) - SNR;
+  sigma2 = pow(10,sigma2_dB/10);
+
+  for (i=0; i<2*UE->frame_parms.samples_per_tti; i++) {
+    for (aa=0; aa<UE->frame_parms.nb_antennas_rx; aa++) {
+      //printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]);
+      ((short *) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i] =
+        (short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
+      ((short *) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i+1] =
+        (short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
+    }
+  }
+}
+
+uint16_t
+fill_tx_req(nfapi_tx_request_body_t *tx_req_body,
+            uint16_t                absSF,
+            uint16_t                pdu_length,
+            uint16_t                pdu_index,
+            uint8_t                 *pdu) {
+  nfapi_tx_request_pdu_t *TX_req = &tx_req_body->tx_pdu_list[tx_req_body->number_of_pdus];
+  LOG_D(MAC, "Filling TX_req %d for pdu length %d\n",
+        tx_req_body->number_of_pdus, pdu_length);
+  TX_req->pdu_length                 = pdu_length;
+  TX_req->pdu_index                  = pdu_index;
+  TX_req->num_segments               = 1;
+  TX_req->segments[0].segment_length = pdu_length;
+  TX_req->segments[0].segment_data   = pdu;
+  tx_req_body->tl.tag                = NFAPI_TX_REQUEST_BODY_TAG;
+  tx_req_body->number_of_pdus++;
+  return (((absSF / 10) << 4) + (absSF % 10));
+}
+
+void
+fill_mch_config(nfapi_dl_config_request_body_t *dl_req,
+                  uint16_t length,
+                  uint16_t pdu_index,
+                  uint16_t rnti,
+                  uint8_t resource_allocation_type,
+                  uint16_t resource_block_coding,
+                  uint8_t modulation,
+                  uint16_t transmission_power,
+		  uint8_t mbsfn_area_id){
+  nfapi_dl_config_request_pdu_t *dl_config_pdu =
+    &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+  memset((void *) dl_config_pdu, 0,
+         sizeof(nfapi_dl_config_request_pdu_t));
+  dl_config_pdu->pdu_type                          		             = NFAPI_DL_CONFIG_MCH_PDU_TYPE;
+  dl_config_pdu->pdu_size                                                    = (uint8_t) (2 + sizeof(nfapi_dl_config_mch_pdu));
+  dl_config_pdu->mch_pdu.mch_pdu_rel8.tl.tag                                 = NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG;
+  dl_config_pdu->mch_pdu.mch_pdu_rel8.length                                 = length;
+  dl_config_pdu->mch_pdu.mch_pdu_rel8.pdu_index                              = pdu_index;
+  dl_config_pdu->mch_pdu.mch_pdu_rel8.rnti                                   = rnti;
+  dl_config_pdu->mch_pdu.mch_pdu_rel8.resource_allocation_type               = resource_allocation_type;
+  dl_config_pdu->mch_pdu.mch_pdu_rel8.resource_block_coding                  = resource_block_coding;
+  dl_config_pdu->mch_pdu.mch_pdu_rel8.modulation                             = modulation;
+  dl_config_pdu->mch_pdu.mch_pdu_rel8.transmission_power                     = transmission_power;
+  dl_config_pdu->mch_pdu.mch_pdu_rel8.mbsfn_area_id 		             = mbsfn_area_id;
+  dl_req->number_pdu++;
+}
+
+void
+fill_dlsch_config(nfapi_dl_config_request_body_t *dl_req,
+                  uint16_t length,
+                  uint16_t pdu_index,
+                  uint16_t rnti,
+                  uint8_t resource_allocation_type,
+                  uint8_t virtual_resource_block_assignment_flag,
+                  uint16_t resource_block_coding,
+                  uint8_t modulation,
+                  uint8_t redundancy_version,
+                  uint8_t transport_blocks,
+                  uint8_t transport_block_to_codeword_swap_flag,
+                  uint8_t transmission_scheme,
+                  uint8_t number_of_layers,
+                  uint8_t number_of_subbands,
+                  //                             uint8_t codebook_index,
+                  uint8_t ue_category_capacity,
+                  uint8_t pa,
+                  uint8_t delta_power_offset_index,
+                  uint8_t ngap,
+                  uint8_t nprb,
+                  uint8_t transmission_mode,
+                  uint8_t num_bf_prb_per_subband,
+                  uint8_t num_bf_vector) {
+  nfapi_dl_config_request_pdu_t *dl_config_pdu =
+    &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+  memset((void *) dl_config_pdu, 0,
+         sizeof(nfapi_dl_config_request_pdu_t));
+  dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+  dl_config_pdu->pdu_size                                                        = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag                                 = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length                                 = length;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = pdu_index;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = rnti;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = resource_allocation_type;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = virtual_resource_block_assignment_flag;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = resource_block_coding;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = modulation;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = redundancy_version;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = transport_blocks;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = transport_block_to_codeword_swap_flag;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = transmission_scheme;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = number_of_layers;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = number_of_subbands;
+  //  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = codebook_index;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = ue_category_capacity;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = pa;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = delta_power_offset_index;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = ngap;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = nprb;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = transmission_mode;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = num_bf_prb_per_subband;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = num_bf_vector;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io            = 0xFFFF;
+  dl_req->number_pdu++;
+}
+
+void fill_MCH(PHY_VARS_eNB *eNB,
+              int frame,
+              int subframe,
+              Sched_Rsp_t *sched_resp,
+              uint8_t input_buffer[NUMBER_OF_UE_MAX][20000],
+              int n_rnti,
+	      int common_flag,
+	      int NB_RB,
+              int TPC,
+              int mcs1){
+
+  nfapi_dl_config_request_body_t *dl_req=&sched_resp->DL_req->dl_config_request_body;
+  nfapi_dl_config_request_pdu_t  *dl_config_pdu;
+  nfapi_tx_request_body_t        *TX_req=&sched_resp->TX_req->tx_request_body;
+  int NB_RB4TBS = common_flag == 0 ? NB_RB : (2+TPC);
+  dl_req->number_dci=0;
+  dl_req->number_pdu=0;
+  TX_req->number_of_pdus=0;
+  dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+  fill_mch_config(
+                        dl_req,
+            		get_TBS_DL(mcs1,NB_RB4TBS),
+                        0,
+                        0xfffd,
+                        0,
+                        get_Qm(mcs1),
+                        mcs1,
+                        6000, //equal to RS power
+                        0 //mbsfn_area_id
+                        );
+
+  fill_tx_req(TX_req,
+           (frame * 10) + subframe,
+            get_TBS_DL(mcs1,NB_RB4TBS),
+            0,
+            input_buffer[0]);
+}
+
+void fill_DCI(PHY_VARS_eNB *eNB,
+              int frame,
+              int subframe,
+              Sched_Rsp_t *sched_resp,
+              uint8_t input_buffer[NUMBER_OF_UE_MAX][20000],
+              int n_rnti,
+              int n_users,
+              int transmission_mode,
+              int retrans,
+              int common_flag,
+              int NB_RB,
+              int DLSCH_RB_ALLOC,
+              int TPC,
+              int mcs1,
+              int mcs2,
+              int ndi,
+              int rv,
+              int pa,
+              int *num_common_dci,
+              int *num_ue_spec_dci,
+              int *num_dci) {
+  int k;
+  nfapi_dl_config_request_body_t *dl_req=&sched_resp->DL_req->dl_config_request_body;
+  nfapi_dl_config_request_pdu_t  *dl_config_pdu;
+  nfapi_tx_request_body_t        *TX_req=&sched_resp->TX_req->tx_request_body;
+  int NB_RB4TBS = common_flag == 0 ? NB_RB : (2+TPC);
+  dl_req->number_dci=0;
+  dl_req->number_pdu=0;
+  TX_req->number_of_pdus=0;
+
+  for(k=0; k<n_users; k++) {
+    switch(transmission_mode) {
+      case 1:
+      case 2:
+      case 7:
+        dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+        memset((void *) dl_config_pdu, 0,
+               sizeof(nfapi_dl_config_request_pdu_t));
+        dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
+        dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = (common_flag == 0) ? NFAPI_DL_DCI_FORMAT_1 : NFAPI_DL_DCI_FORMAT_1A;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = 4;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = (common_flag == 0) ? n_rnti+k : SI_RNTI;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = (common_flag ==0 ) ? 1: 2;  // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000;  // equal to RS power
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = TPC;  // dont adjust power when retransmitting
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = (common_flag == 0) ? ndi : 0;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs1;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = rv;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = (common_flag == 0) ? DLSCH_RB_ALLOC : computeRIV(eNB->frame_parms.N_RB_DL,0,NB_RB);
+        //deactivate second codeword
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = 0;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = 1;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = 0;
+        dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = 0;
+        dl_req->number_dci++;
+        dl_req->number_pdu++;
+        dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+        AssertFatal(TPC>=0 && TPC<2, "TPC should be 0 or 1\n");
+	if(1){
+	  fill_mch_config(
+                        dl_req,
+            		get_TBS_DL(mcs1,NB_RB4TBS),
+                        0,
+                        0xfffd,
+                        0,
+                        get_Qm(mcs1),
+                        mcs1,
+                        6000, //equal to RS power
+                        0 //mbsfn_area_id
+                        );
+
+  	fill_tx_req(TX_req,
+           (frame * 10) + subframe,
+            get_TBS_DL(mcs1,NB_RB4TBS),
+            0,
+            input_buffer[0]);
+
+	}else{
+        fill_dlsch_config(dl_req,
+                          get_TBS_DL(mcs1,NB_RB4TBS),
+                          (retrans > 0) ? -1 : 0, /* retransmission, no pdu_index */
+                          (common_flag == 0) ? n_rnti : SI_RNTI,
+                          0,  // type 0 allocation from 7.1.6 in 36.213
+                          0,  // virtual_resource_block_assignment_flag, unused here
+                          DLSCH_RB_ALLOC, // resource_block_coding,
+                          get_Qm(mcs1),
+                          rv, // redundancy version
+                          1,  // transport blocks
+                          0,  // transport block to codeword swap flag
+                          transmission_mode == 1 ? 0 : 1, // transmission_scheme
+                          1,  // number of layers
+                          1,  // number of subbands
+                          //                      uint8_t codebook_index,
+                          4,  // UE category capacity
+                          pa,    // pa
+                          0,  // delta_power_offset for TM5
+                          0,  // ngap
+                          0,  // nprb
+                          transmission_mode,
+                          0,  //number of PRBs treated as one subband, not used here
+                          0 // number of beamforming vectors, not used here
+                         );
+        fill_tx_req(TX_req,
+                    (frame * 10) + subframe,
+                    get_TBS_DL(mcs1,NB_RB4TBS),
+                    0,
+                    input_buffer[k]);
+	}
+        break;
+
+      case 3:
+        if (common_flag == 0) {
+          if (eNB->frame_parms.nb_antennas_tx == 2) {
+            if (eNB->frame_parms.frame_type == TDD) {
+            } else {
+            }
+          }
+        }
+
+        break;
+
+      case 4:
+        if (common_flag == 0) {
+          if (eNB->frame_parms.nb_antennas_tx == 2) {
+            if (eNB->frame_parms.frame_type == TDD) {
+            } else {
+            }
+          } else if (eNB->frame_parms.nb_antennas_tx == 4) {
+          }
+        } else {
+        }
+
+        break;
+
+      case 5:
+      case 6:
+        break;
+
+      default:
+        printf("Unsupported Transmission Mode %d!!!\n",transmission_mode);
+        exit(-1);
+        break;
+    }
+  }
+
+  *num_dci         = dl_req->number_dci;
+  *num_ue_spec_dci = dl_req->number_dci;
+  *num_common_dci  = 0;
+}
+
+int n_users = 1;
+int subframe=7;
+int num_common_dci=0,num_ue_spec_dci=0,num_dci=0,num_pdcch_symbols=1;
+uint16_t n_rnti=0x1234;
+
+int abstx=0;
+int Nid_cell=0;
+int N_RB_DL=25;
+int tdd_config=3;
+int dci_flag=0;
+int threequarter_fs=0;
+double snr_step=1,input_snr_step=1, snr_int=30;
+double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel
+int test_perf=0;
+int n_frames;
+int n_ch_rlz = 1;
+int rx_sample_offset = 0;
+int xforms=0;
+int dump_table=0;
+int loglvl=OAILOG_WARNING;
+int mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0;
+int two_thread_flag=0;
+int num_rounds = 4;//,fix_rounds=0;
+int perfect_ce = 0;
+int extended_prefix_flag=0;
+int verbose=0, help=0;
+double SNR,snr0=-2.0,snr1,rate = 0;
+int print_perf=0;
+
 int main(int argc, char **argv) {
-  char c;
-  int i,l,l2,aa,aarx,k;
-  double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1=0.0;
-  uint8_t snr1set=0;
-  double snr_step=1,input_snr_step=1;
-  int **txdata;
-  double s_re0[2*30720],s_im0[2*30720],s_re1[2*30720],s_im1[2*30720];
-  double r_re0[2*30720],r_im0[2*30720],r_re1[2*30720],r_im1[2*30720];
-  double *s_re[2]= {s_re0,s_re1},*s_im[2]= {s_im0,s_im1},*r_re[2]= {r_re0,r_re1},*r_im[2]= {r_im0,r_im1};
-  double iqim = 0.0;
-  int subframe=1;
-  char fname[40];//, vname[40];
-  uint8_t transmission_mode = 1,n_tx=1,n_rx=2;
-  uint16_t Nid_cell=0;
-  FILE *fd;
-  int eNB_id = 0;
-  unsigned char mcs=0,awgn_flag=0,round;
-  int n_frames=1;
-  channel_desc_t *eNB2UE;
-  uint32_t nsymb,tx_lev,tx_lev_dB;
-  uint8_t extended_prefix_flag=1;
+  int k,i,j,aa;
+  int re;
+  int s,Kr,Kr_bytes;
   LTE_DL_FRAME_PARMS *frame_parms;
+  double s_re0[30720*2],s_im0[30720*2],r_re0[30720*2],r_im0[30720*2];
+  double s_re1[30720*2],s_im1[30720*2],r_re1[30720*2],r_im1[30720*2];
+  double *s_re[2]= {s_re0,s_re1};
+  double *s_im[2]= {s_im0,s_im1};
+  double *r_re[2]= {r_re0,r_re1};
+  double *r_im[2]= {r_im0,r_im1};
+  uint8_t transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=2;
+  int eNB_id = 0;
+  unsigned char round;
+  unsigned char i_mod = 2;
+  int NB_RB;
+  SCM_t channel_model=Rayleigh1;
+  //  unsigned char *input_data,*decoded_output;
+  DCI_ALLOC_t da;
+  DCI_ALLOC_t *dci_alloc = &da;
+  unsigned int coded_bits_per_codeword=0,nsymb; //,tbs=0;
+  unsigned int tx_lev=0,tx_lev_dB=0,trials;
+  unsigned int errs[4],errs2[4],round_trials[4],dci_errors[4];//,num_layers;
+  memset(errs,0,4*sizeof(unsigned int));
+  memset(errs2,0,4*sizeof(unsigned int));
+  memset(round_trials,0,4*sizeof(unsigned int));
+  memset(dci_errors,0,4*sizeof(unsigned int));
+  //int re_allocated;
+  char fname[32],vname[32];
+  FILE *bler_fd;
+  char bler_fname[256];
+  FILE *time_meas_fd;
+  char time_meas_fname[256];
+  //  FILE *tikz_fd;
+  //  char tikz_fname[256];
+  FILE *input_trch_fd=NULL;
+  unsigned char input_trch_file=0;
+  FILE *input_fd=NULL;
+  unsigned char input_file=0;
+  channel_desc_t *eNB2UE[4];
+  //uint8_t num_pdcch_symbols_2=0;
+  //char stats_buffer[4096];
+  //int len;
+  //int u;
+  int n=0;
+  //int iii;
+  int ch_realization;
+  //int pmi_feedback=0;
   int hold_channel=0;
-  uint16_t NB_RB=25;
-  int tdd_config=3;
-  SCM_t channel_model=MBSFN;
-  unsigned char *input_buffer;
-  unsigned short input_buffer_length;
-  unsigned int ret;
-  unsigned int trials,errs[4]= {0,0,0,0}; //,round_trials[4]={0,0,0,0};
-  uint8_t N_RB_DL=25,osf=1;
-  uint32_t perfect_ce = 0;
-  lte_frame_type_t frame_type = FDD;
-  uint32_t Nsoft = 1827072;
-  /*
-  #ifdef XFORMS
-  FD_lte_phy_scope_ue *form_ue;
+  // void *data;
+  // int ii;
+  //  int bler;
+  double blerr[4];
+  short *uncoded_ber_bit=NULL;
+  int osf=1;
+  frame_t frame_type = FDD;
+  FD_lte_phy_scope_ue *form_ue = NULL;
   char title[255];
+  int numCCE=0;
+  //int dci_length_bytes=0,dci_length=0;
+  //double channel_bandwidth = 5.0, sampling_rate=7.68;
+  int common_flag=0,TPC=0;
+  double cpu_freq_GHz;
+  //  time_stats_t ts;//,sts,usts;
+  int avg_iter,iter_trials;
+  int rballocset=0;
+  int test_passed=0;
+  double effective_rate=0.0;
+  char channel_model_input[10]="I";
+  int TB0_active = 1;
+  //  LTE_DL_UE_HARQ_t *dlsch0_ue_harq;
+  //  LTE_DL_eNB_HARQ_t *dlsch0_eNB_harq;
+  uint8_t Kmimo;
+  uint8_t ue_category=4;
+  uint32_t Nsoft;
+  int sf;
+  int CCE_table[800];
+  opp_enabled=1; // to enable the time meas
+  FILE *csv_fd=NULL;
+  char csv_fname[FILENAME_MAX];
+  int DLSCH_RB_ALLOC = 0;
+  int dci_received;
+  PHY_VARS_eNB *eNB;
+  RU_t *ru;
+  PHY_VARS_UE *UE=NULL;
+  nfapi_dl_config_request_t DL_req;
+  nfapi_ul_config_request_t UL_req;
+  nfapi_hi_dci0_request_t HI_DCI0_req;
+  nfapi_dl_config_request_pdu_t dl_config_pdu_list[MAX_NUM_DL_PDU];
+  nfapi_tx_request_pdu_t tx_pdu_list[MAX_NUM_TX_REQUEST_PDU];
+  nfapi_tx_request_t TX_req;
+  Sched_Rsp_t sched_resp;
+  int pa=dB0;
+#if defined(__arm__)
+  FILE    *proc_fd = NULL;
+  char buf[64];
+  memset(buf,0,sizeof(buf));
+  proc_fd = fopen("/sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_cur_freq", "r");
+
+  if(!proc_fd)
+    printf("cannot open /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_cur_freq");
+  else {
+    while(fgets(buf, 63, proc_fd))
+      printf("%s", buf);
+  }
 
-  fl_initialize (&argc, argv, NULL, 0, 0);
-  form_ue = create_lte_phy_scope_ue();
-  sprintf (title, "LTE DL SCOPE UE");
-  fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-  #endif
-  */
-  cpuf = get_cpu_freq_GHz();
-  logInit();
-  number_of_cards = 1;
+  fclose(proc_fd);
+  cpu_freq_GHz = ((double)atof(buf))/1e6;
+#else
+  cpu_freq_GHz = get_cpu_freq_GHz();
+#endif
+  printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
+  memset((void *)&sched_resp,0,sizeof(sched_resp));
+  sched_resp.DL_req = &DL_req;
+  sched_resp.UL_req = &UL_req;
+  sched_resp.HI_DCI0_req = &HI_DCI0_req;
+  sched_resp.TX_req = &TX_req;
+  memset((void *)&DL_req,0,sizeof(DL_req));
+  memset((void *)&UL_req,0,sizeof(UL_req));
+  memset((void *)&HI_DCI0_req,0,sizeof(HI_DCI0_req));
+  memset((void *)&TX_req,0,sizeof(TX_req));
+  DL_req.dl_config_request_body.dl_config_pdu_list = dl_config_pdu_list;
+  TX_req.tx_request_body.tx_pdu_list = tx_pdu_list;
+  set_parallel_conf("PARALLEL_SINGLE_THREAD");
+  cpuf = cpu_freq_GHz;
+  //signal(SIGSEGV, handler);
+  //signal(SIGABRT, handler);
+  // default parameters
+  n_frames = 1000;
+  snr0 = 0;
+  //  num_layers = 1;
+  perfect_ce = 0;
+  static paramdef_t options[] = {
+    { "awgn", "Use AWGN channel and not multipath", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL },
+    { "Abstx", "Turns on calibration mode for abstraction.", PARAMFLAG_BOOL, iptr:&abstx,  defintval:0, TYPE_INT, 0 },
+    { "bTDD", "Set the tdd configuration mode",0, iptr:&tdd_config,  defintval:3, TYPE_INT, 0 },
+    { "BnbRBs", "The LTE bandwith in RBs (100 is 20MHz)",0, iptr:&N_RB_DL,  defintval:25, TYPE_INT, 0 },
+    { "cPdcch", "Number of PDCCH symbols",0, iptr:&num_pdcch_symbols,  defintval:1, TYPE_INT, 0 },
+    { "CnidCell", "The cell id ",0, iptr:&Nid_cell,  defintval:0, TYPE_INT, 0 },
+    { "dciFlag", "Transmit the DCI and compute its error statistics", PARAMFLAG_BOOL, iptr:&dci_flag,  defintval:0, TYPE_INT, 0 },
+    { "Dtdd", "Enable tdd", PARAMFLAG_BOOL,  strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL },
+    { "eRounds", "Number of rounds",0, iptr:NULL,  defintval:25, TYPE_INT, 0 },
+    { "EsubSampling","three quarters sub-sampling",PARAMFLAG_BOOL, iptr:&threequarter_fs, defintval:0, TYPE_INT, 0 },
+    { "f_snr_step", "step size of SNR, default value is 1.",0, dblptr:&input_snr_step,  defdblval:1, TYPE_DOUBLE, 0 },
+    { "Forgetting", "forgetting factor (0 new channel every trial, 1 channel constant)",0, dblptr:&forgetting_factor,  defdblval:0.0, TYPE_DOUBLE, 0 },
+    { "input_file", "input IQ data file",0, iptr:NULL,  defintval:0, TYPE_INT, 0 },
+    { "Input_file_trch", " Input filename for TrCH data (binary)",0, iptr:NULL,  defintval:0, TYPE_INT, 0 },
+    { "WtwoThreads", "two_thread_flag", PARAMFLAG_BOOL, iptr:&two_thread_flag,  defintval:0, TYPE_INT, 0 },
+    { "lMuMimo", "offset_mumimo_llr_drange_fix",0, u8ptr:&offset_mumimo_llr_drange_fix,  defintval:0, TYPE_UINT8, 0 },
+    { "mcs1", "The MCS for TB 1", 0, iptr:&mcs1,  defintval:0, TYPE_INT, 0 },
+    { "Mcs2", "The MCS for TB 2", 0, iptr:&mcs2,  defintval:0, TYPE_INT, 0 },
+    { "Operf", "Set the percenatge of effective rate to testbench the modem performance (typically 30 and 70, range 1-100)",0, iptr:&test_perf,  defintval:0, TYPE_INT, 0 },
+    { "tmcs_i", "MCS of interfering UE",0, iptr:NULL,  defintval:0, TYPE_INT, 0 },
+    { "nb_frame", "number of frame in a test",0, iptr:&n_frames,  defintval:1, TYPE_INT, 0 },
+    { "offsetRxSample", "Sample offset for receiver", 0, iptr:&rx_sample_offset,  defintval:0, TYPE_INT, 0 },
+    { "rballocset", "ressource block allocation (see  section 7.1.6.3 in 36.213)",0, iptr:NULL,  defintval:0, TYPE_INT, 0 },
+    { "snr", "Starting SNR, runs from SNR to SNR+%.1fdB in steps of %.1fdB. If n_frames is 1 then just SNR is simulated and MATLAB/OCTAVE output is generated", dblptr:&snr0,  defdblval:-2.0, TYPE_DOUBLE, 0 },
+    { "wsnrInterrupt", "snr int ?", 0, dblptr:&snr_int,  defdblval:30, TYPE_DOUBLE, 0 },
+    { "N_ch_rlzN0", "Determines the number of Channel Realizations in Abstraction mode. Default value is 1",0, iptr:&n_ch_rlz,  defintval:1, TYPE_INT, 0 },
+    { "prefix_extended","Enable extended prefix", PARAMFLAG_BOOL, iptr:&extended_prefix_flag,  defintval:0, TYPE_INT, 0 },
+    { "RNumRound", "Number of HARQ rounds (fixed)",0, iptr:&num_rounds,  defintval:4, TYPE_INT, 0 },
+    { "Subframe", "subframe ",0, iptr:&subframe,  defintval:7, TYPE_INT, 0 },
+    { "Trnti", "rnti",0, u16ptr:&n_rnti,  defuintval:0x1234, TYPE_UINT16, 0 },
+    { "vi_mod", "i_mod",0, iptr:NULL,  defintval:0, TYPE_INT, 0 },
+    { "Qparallel", "Enable parallel execution",0, strptr:NULL,  defstrval:NULL, TYPE_STRING,  0 },
+    { "Performance", "Display CPU perfomance of each L1 piece", PARAMFLAG_BOOL,  iptr:&print_perf,  defintval:0, TYPE_INT, 0 },
+    { "q_tx_port", "Number of TX antennas ports used in eNB",0, iptr:NULL,  defintval:0, TYPE_INT, 0 },
+    { "uEdual", "Enables the Interference Aware Receiver for TM5 (default is normal receiver)",0, iptr:NULL,  defintval:0, TYPE_INT, 0 },
+    { "xTransmission","Transmission mode (1,2,6,7 for the moment)",0, iptr:NULL,  defintval:25, TYPE_INT, 0 },
+    { "yn_tx_phy","Number of TX antennas used in eNB",0, iptr:NULL,  defintval:25, TYPE_INT, 0 },
+    { "XForms", "Display the soft scope", PARAMFLAG_BOOL, iptr:&xforms,  defintval:0, TYPE_INT, 0 },
+    { "Yperfect_ce","Perfect CE", PARAMFLAG_BOOL, iptr:&perfect_ce,  defintval:0, TYPE_INT, 0 },
+    { "Zdump", "dump table",PARAMFLAG_BOOL,  iptr:&dump_table, defintval:0, TYPE_INT, 0 },
+    { "Loglvl", "log level",0, iptr:&loglvl,  defintval:OAILOG_DEBUG, TYPE_INT, 0 },
+    { "zn_rx", "Number of RX antennas used in UE",0, iptr:NULL,  defintval:2, TYPE_INT, 0 },
+    { "gchannel", "[A:M] Use 3GPP 25.814 SCM-A/B/C/D('A','B','C','D') or 36-101 EPA('E'), EVA ('F'),ETU('G') models (ignores delay spread and Ricean factor), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr ('K'),  Rice8('L'), Rice1('M')",0, strptr:NULL,  defstrval:NULL, TYPE_STRING, 0 },
+    { "verbose", "display debug text", PARAMFLAG_BOOL,  iptr:&verbose, defintval:0, TYPE_INT, 0 },
+    { "mmse", "Use MMSE whitening", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL },
+    { "help", "display help and exit", PARAMFLAG_BOOL,  iptr:&help, defintval:0, TYPE_INT, 0 },
+    { "", "",0,  iptr:NULL, defintval:0, TYPE_INT, 0 },
+  };
+  struct option *long_options = parse_oai_options(options);
+  int option_index;
+  int res;
+
+  while ((res=getopt_long_only(argc, argv, "", long_options, &option_index)) == 0) {
+    if (options[option_index].voidptr != NULL ) {
+      if (long_options[option_index].has_arg==no_argument)
+        *(bool *)options[option_index].iptr=1;
+      else switch (options[option_index].type) {
+          case TYPE_INT:
+            *(int *)options[option_index].iptr=atoi(optarg);
+            break;
+
+          case TYPE_DOUBLE:
+            *(double *)options[option_index].dblptr=atof(optarg);
+            break;
+
+          case TYPE_UINT8:
+            *(uint8_t *)options[option_index].dblptr=atoi(optarg);
+            break;
+
+          case TYPE_UINT16:
+            *(uint16_t *)options[option_index].dblptr=atoi(optarg);
+            break;
+
+          default:
+            printf("not decoded type.\n");
+            exit(1);
+        }
+
+      continue;
+    }
 
-  while ((c = getopt (argc, argv, "ahA:Cp:n:s:S:t:x:y:z:N:F:R:O:dm:i:Y")) != -1) {
-    switch (c) {
+    switch (long_options[option_index].name[0]) {
       case 'a':
-        awgn_flag=1;
+        awgn_flag = 1;
+        channel_model = AWGN;
         break;
 
-      case 'd':
-        frame_type = 0;
+      case 'D':
+        frame_type=TDD;
         break;
 
-      case 'n':
-        n_frames = atoi(optarg);
+      case 'e':
+        num_rounds=1;
+        common_flag = 1;
+        TPC = atoi(optarg);
         break;
 
-      case 'm':
-        mcs=atoi(optarg);
+      case 'i':
+        input_fd = fopen(optarg,"r");
+        input_file=1;
+        dci_flag = 1;
         break;
 
-      case 's':
-        snr0 = atof(optarg);
-        msg("Setting SNR0 to %f\n",snr0);
+      case 'I':
+        input_trch_fd = fopen(optarg,"r");
+        input_trch_file=1;
         break;
 
-      case 'i':
-        input_snr_step = atof(optarg);
+      case 't':
+        mcs_i = atoi(optarg);
+        i_mod = get_Qm(mcs_i);
         break;
 
-      case 'S':
-        snr1 = atof(optarg);
-        snr1set=1;
-        msg("Setting SNR1 to %f\n",snr1);
+      case 'r':
+        DLSCH_RB_ALLOC = atoi(optarg);
+        rballocset = 1;
         break;
 
-      case 'p': // subframe no;
-        subframe=atoi(optarg);
+      case 'g':
+        strncpy(channel_model_input,optarg,9);
+        struct tmp {
+          char opt;
+          int m;
+          int M;
+        }
+        tmp[]= {
+          {'A',SCM_A,2},
+          {'B',SCM_B,3},
+          {'C',SCM_C,4},
+          {'D',SCM_D,5},
+          {'E',EPA,6},
+          {'F',EVA,6},
+          {'G',ETU,8},
+          {'H',Rayleigh8,9},
+          {'I',Rayleigh1,10},
+          {'J',Rayleigh1_corr,11},
+          {'K',Rayleigh1_anticorr,12},
+          {'L',Rice8,13},
+          {'M',Rice1,14},
+          {'N',AWGN,1},
+          {0,0,0}
+        };
+        struct tmp *ptr;
+
+        for (ptr=tmp; ptr->opt!=0; ptr++)
+          if ( ptr->opt == optarg[0] ) {
+            channel_model=ptr->m;
+            break;
+          }
+
+        AssertFatal(ptr->opt != 0, "Unsupported channel model: %s !\n", optarg );
         break;
 
-      case 'z':
-        n_rx=atoi(optarg);
+      case 'u':
+        dual_stream_UE=1;
 
-        if ((n_rx==0) || (n_rx>2)) {
-          msg("Unsupported number of rx antennas %d\n",n_rx);
+        if (UE != NULL)
+          UE->use_ia_receiver = 1;
+        else {
+          printf("UE  is NULL\n");
+          exit(-1);
+        }
+
+        if ((n_tx_port!=2) || (transmission_mode!=5)) {
+          printf("IA receiver only supported for TM5!");
           exit(-1);
         }
 
         break;
 
-      case 'N':
-        Nid_cell = atoi(optarg);
+      case 'v':
+        i_mod = atoi(optarg);
+
+        if (i_mod!=2 && i_mod!=4 && i_mod!=6) {
+          printf("Wrong i_mod %d, should be 2,4 or 6\n",i_mod);
+          exit(-1);
+        }
+
         break;
 
-      case 'R':
-        N_RB_DL = atoi(optarg);
+      case 'q':
+        n_tx_port=atoi(optarg);
 
-        if ((N_RB_DL!=6) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=100))  {
-          printf("Unsupported Bandwidth %d\n",N_RB_DL);
+        if ((n_tx_port==0) || ((n_tx_port>2))) {
+          printf("Unsupported number of cell specific antennas ports %d\n",n_tx_port);
           exit(-1);
         }
 
         break;
 
-      case 'O':
-        osf = atoi(optarg);
+      case 'x':
+        transmission_mode=atoi(optarg);
+
+        if ((transmission_mode!=1) &&
+            (transmission_mode!=2) &&
+            (transmission_mode!=3) &&
+            (transmission_mode!=4) &&
+            (transmission_mode!=5) &&
+            (transmission_mode!=6) &&
+            (transmission_mode!=7)) {
+          printf("Unsupported transmission mode %d\n",transmission_mode);
+          exit(-1);
+        }
+
+        if (transmission_mode>1 && transmission_mode<7) {
+          n_tx_port = 2;
+        }
+
         break;
 
-      case 'Y':
-        perfect_ce = 1;
+      case 'y':
+        n_tx_phy=atoi(optarg);
+
+        if (n_tx_phy < n_tx_port) {
+          printf("n_tx_phy mush not be smaller than n_tx_port");
+          exit(-1);
+        }
+
+        if ((transmission_mode>1 && transmission_mode<7) && n_tx_port<2) {
+          printf("n_tx_port must be >1 for transmission_mode %d\n",transmission_mode);
+          exit(-1);
+        }
+
+        if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64 && n_tx_phy!=128)) {
+          printf("Physical number of antennas not supported for TM7.\n");
+          exit(-1);
+        }
+
+        break;
+
+      case 'z':
+        n_rx=atoi(optarg);
+
+        if ((n_rx==0) || (n_rx>2)) {
+          printf("Unsupported number of rx antennas %d\n",n_rx);
+          exit(-1);
+        }
+
+        break;
+
+      case 'Q':
+        set_parallel_conf(optarg);
         break;
 
       default:
-      case 'h':
-        printf("%s -h(elp) -p(subframe) -N cell_id -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -i snr increment -z RXant \n",argv[0]);
-        printf("-h This message\n");
-        printf("-a Use AWGN Channel\n");
-        printf("-p Use extended prefix mode\n");
-        printf("-d Use TDD\n");
-        printf("-n Number of frames to simulate\n");
-        printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB.  If n_frames is 1 then just SNR is simulated\n");
-        printf("-S Ending SNR, runs from SNR0 to SNR1\n");
-        printf("-t Delay spread for multipath channel\n");
-        printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
-        printf("-x Transmission mode (1,2,6 for the moment)\n");
-        printf("-y Number of TX antennas used in eNB\n");
-        printf("-z Number of RX antennas used in UE\n");
-        printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
-        printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
-        printf("-N Nid_cell\n");
-        printf("-R N_RB_DL\n");
-        printf("-O oversampling factor (1,2,4,8,16)\n");
-        printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
-        printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
-        printf("-f Output filename (.txt format) for Pe/SNR results\n");
-        printf("-F Input filename (.txt format) for RX conformance testing\n");
-        exit (-1);
+        printf("Wrong option: %s\n",long_options[option_index].name);
+        exit(1);
         break;
     }
   }
 
-  if (awgn_flag == 1)
-    channel_model = AWGN;
+  if ( res != -1 ) {
+    printf("A wrong option has been found\n");
+    exit(1);
+  }
 
-  // check that subframe is legal for eMBMS
+  if (help || verbose )
+    display_options_values(options, true);
 
-  if ((subframe == 0) || (subframe == 5) ||    // TDD and FDD SFn 0,5;
-      ((frame_type == FDD) && ((subframe == 4) || (subframe == 9))) || // FDD SFn 4,9;
-      ((frame_type == TDD ) && ((subframe<3) || (subframe==6))))    {  // TDD SFn 1,2,6;
-    printf("Illegal subframe %d for eMBMS transmission (frame_type %d)\n",subframe,frame_type);
-    exit(-1);
+  if (help)
+    exit(0);
+  if (thread_struct.parallel_conf != PARALLEL_SINGLE_THREAD)
+    set_worker_conf("WORKER_ENABLE");
+
+  if (transmission_mode>1) pa=dBm3;
+
+  printf("dlsim: tmode %d, pa %d\n",transmission_mode,pa);
+  AssertFatal(load_configmodule(argc,argv, CONFIG_ENABLECMDLINEONLY) != NULL,
+              "cannot load configuration module, exiting\n");
+  logInit();
+  set_glog_onlinelog(true);
+  // enable these lines if you need debug info
+  set_glog(loglvl);
+  SET_LOG_DEBUG(UE_TIMING);
+  // moreover you need to init itti with the following line
+  // however itti will catch all signals, so ctrl-c won't work anymore
+  // alternatively you can disable ITTI completely in CMakeLists.txt
+  //itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL);
+
+  if (common_flag == 0) {
+    switch (N_RB_DL) {
+      case 6:
+        if (rballocset==0) DLSCH_RB_ALLOC = 0x3f;
+
+        num_pdcch_symbols = 3;
+        break;
+
+      case 25:
+        if (rballocset==0) DLSCH_RB_ALLOC = 0x1fff;
+
+        break;
+
+      case 50:
+        if (rballocset==0) DLSCH_RB_ALLOC = 0x1ffff;
+
+        break;
+
+      case 100:
+        if (rballocset==0) DLSCH_RB_ALLOC = 0x1ffffff;
+
+        break;
+    }
+
+    NB_RB = conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL);
+  } else {
+    if (rballocset==0) NB_RB = 8;
+    else               NB_RB = DLSCH_RB_ALLOC;
+
+    AssertFatal(NB_RB <= N_RB_DL,"illegal NB_RB %d\n",NB_RB);
   }
 
-  if (transmission_mode==2)
-    n_tx=2;
+  if (xforms==1) {
+    fl_initialize (&argc, argv, NULL, 0, 0);
+    form_ue = create_lte_phy_scope_ue();
+    sprintf (title, "LTE PHY SCOPE eNB");
+    fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
+
+    if (!dual_stream_UE==0) {
+      if (UE) {
+        UE->use_ia_receiver = 1;
+        fl_set_button(form_ue->button_0,1);
+        fl_set_object_label(form_ue->button_0, "IA Receiver ON");
+        fl_set_object_color(form_ue->button_0, FL_GREEN, FL_GREEN);
+      } else {
+        printf("UE  is NULL\n");
+        exit(-1);
+      }
+    }
+  }
+
+  if (transmission_mode==5) {
+    n_users = 2;
+    printf("dual_stream_UE=%d\n", dual_stream_UE);
+  }
 
-  lte_param_init(n_tx,
-                 n_tx,
+  RC.nb_L1_inst = 1;
+  RC.nb_RU = 1;
+  lte_param_init(&eNB,&UE,&ru,
+                 n_tx_port,
+                 n_tx_phy,
+                 1,
                  n_rx,
                  transmission_mode,
                  extended_prefix_flag,
@@ -224,281 +1068,1251 @@ int main(int argc, char **argv) {
                  Nid_cell,
                  tdd_config,
                  N_RB_DL,
-                 0,
+                 pa,
+                 threequarter_fs,
                  osf,
                  perfect_ce);
+  RC.eNB = (PHY_VARS_eNB ** *)malloc(sizeof(PHY_VARS_eNB **));
+  RC.eNB[0] = (PHY_VARS_eNB **)malloc(sizeof(PHY_VARS_eNB *));
+  RC.ru = (RU_t **)malloc(sizeof(RC.ru));
+  RC.eNB[0][0] = eNB;
+  RC.ru[0] = ru;
+  printf("lte_param_init done\n");
+
+  if ((transmission_mode==1) || (transmission_mode==7)) {
+    for (aa=0; aa<ru->nb_tx; aa++)
+      for (re=0; re<ru->frame_parms.ofdm_symbol_size; re++)
+        ru->beam_weights[0][0][aa][re] = 0x00007fff/eNB->frame_parms.nb_antennas_tx;
+  }
+
+  if (transmission_mode<7)
+    ru->do_precoding=0;
+  else
+    ru->do_precoding=1;
 
-  if (snr1set==0) {
-    if (n_frames==1)
-      snr1 = snr0+.1;
-    else
-      snr1 = snr0+5.0;
+  eNB->mac_enabled=1;
+
+
+#ifdef ENABLE_MBMS_SIM
+  //eNB->pbch_configured=1;
+  eNB_MAC_INST ** mac;
+  mac = malloc16(1 * sizeof(eNB_MAC_INST *));
+  for (int ii = 0;ii < 1; ii++) {
+	  mac[ii] = malloc16(sizeof(eNB_MAC_INST));
+	  bzero(mac[ii], sizeof(eNB_MAC_INST));
+  }
+  RC.mac = mac;
+  COMMON_channels_t *cc = &RC.mac[0]->common_channels[0];
+  cc->MCH_pdu.mcs = 9;
+  cc->MCH_pdu.Pdu_size = get_TBS_DL(cc->MCH_pdu.mcs,N_RB_DL);
+  printf("MCH_pdu.Pdu_size %d\n",cc->MCH_pdu.Pdu_size);
+  cc->MCH_pdu.sync_area =0;
+  for(int ii=0; ii <  cc->MCH_pdu.Pdu_size; ii++)
+	  cc->MCH_pdu.payload[ii] = (char)(taus() & 0xff);
+  eNB->frame_parms.Nid_cell_mbsfn=0;
+#endif
+
+
+  if(get_thread_worker_conf() == WORKER_ENABLE) {
+    extern void init_td_thread(PHY_VARS_eNB *);
+    extern void init_te_thread(PHY_VARS_eNB *);
+    init_td_thread(eNB);
+    init_te_thread(eNB);
   }
 
+  // callback functions required for phy_procedures_tx
+  //  eNB_id_i = UE->n_connected_eNB;
+  printf("Setting mcs1 = %d\n",mcs1);
+  printf("Setting mcs2 = %d\n",mcs2);
+  printf("NPRB = %d\n",NB_RB);
+  printf("n_frames = %d\n",n_frames);
+  printf("Transmission mode %d with %dx%d antenna configuration, Extended Prefix %d\n",transmission_mode,n_tx_phy,n_rx,extended_prefix_flag);
+  snr1 = snr0+snr_int;
   printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
+  uint8_t input_buffer[NUMBER_OF_UE_MAX][20000];
+
+  for (i=0; i<n_users; i++)
+    for (j=0; j<20000; j++) input_buffer[i][j] = (uint8_t)((taus())&255);
+
   frame_parms = &eNB->frame_parms;
+  nsymb = (eNB->frame_parms.Ncp == 0) ? 14 : 12;
+  printf("Channel Model= (%s,%d)\n",channel_model_input, channel_model);
+  printf("SCM-A=%d, SCM-B=%d, SCM-C=%d, SCM-D=%d, EPA=%d, EVA=%d, ETU=%d, Rayleigh8=%d, Rayleigh1=%d, Rayleigh1_corr=%d, Rayleigh1_anticorr=%d, Rice1=%d, Rice8=%d\n",
+         SCM_A, SCM_B, SCM_C, SCM_D, EPA, EVA, ETU, Rayleigh8, Rayleigh1, Rayleigh1_corr, Rayleigh1_anticorr, Rice1, Rice8);
 
-  if (awgn_flag == 0)
-    sprintf(fname,"embms_%d_%d.m",mcs,N_RB_DL);
+  if(transmission_mode==5)
+    sprintf(bler_fname,"bler_tx%d_chan%d_nrx%d_mcs%d_mcsi%d_u%d_imod%d.csv",transmission_mode,channel_model,n_rx,mcs1,mcs_i,dual_stream_UE,i_mod);
   else
-    sprintf(fname,"embms_awgn_%d_%d.m",mcs,N_RB_DL);
+    sprintf(bler_fname,"bler_tx%d_chan%d_nrx%d_mcs%d.csv",transmission_mode,channel_model,n_rx,mcs1);
+
+  bler_fd = fopen(bler_fname,"w");
 
-  if (!(fd = fopen(fname,"w"))) {
-    printf("Cannot open %s, check permissions\n",fname);
+  if (bler_fd==NULL) {
+    fprintf(stderr,"Cannot create file %s!\n",bler_fname);
     exit(-1);
   }
 
-  if (awgn_flag==0)
-    fprintf(fd,"SNR_%d_%d=[];errs_mch_%d_%d=[];mch_trials_%d_%d=[];\n",
-            mcs,N_RB_DL,
-            mcs,N_RB_DL,
-            mcs,N_RB_DL);
-  else
-    fprintf(fd,"SNR_awgn_%d_%d=[];errs_mch_awgn_%d_%d=[];mch_trials_awgn_%d_%d=[];\n",
-            mcs,N_RB_DL,
-            mcs,N_RB_DL,
-            mcs,N_RB_DL);
-
-  fflush(fd);
-  txdata = eNB->common_vars.txdata[0];
-  nsymb = 12;
-  printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d, AWGN %d\n",NUMBER_OF_OFDM_CARRIERS,
-         frame_parms->Ncp,frame_parms->samples_per_tti,nsymb,awgn_flag);
-  eNB2UE = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
-                                UE->frame_parms.nb_antennas_rx,
-                                channel_model,
-                                N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
-                                N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
-                                0,
-                                0,
-                                0);
-  // Create transport channel structures for 2 transport blocks (MIMO)
-  eNB->dlsch_MCH = new_eNB_dlsch(1,8,Nsoft,N_RB_DL,0,&eNB->frame_parms);
-
-  if (!eNB->dlsch_MCH) {
-    printf("Can't get eNB dlsch structures\n");
-    exit(-1);
+  fprintf(bler_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err\n");
+
+  if (test_perf != 0) {
+    char hostname[1024];
+    hostname[1023] = '\0';
+    gethostname(hostname, 1023);
+    printf("Hostname: %s\n", hostname);
+    //char dirname[FILENAME_MAX];
+    //sprintf(dirname, "%s/SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname );
+    sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv",
+            N_RB_DL,mcs1,n_tx_phy,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode);
+    //mkdir(dirname,0777);
+    time_meas_fd = fopen(time_meas_fname,"w");
+
+    if (time_meas_fd==NULL) {
+      fprintf(stderr,"Cannot create file %s!\n",time_meas_fname);
+      exit(-1);
+    }
   }
 
-  UE->dlsch_MCH[0]  = new_ue_dlsch(1,8,Nsoft,MAX_TURBO_ITERATIONS_MBSFN,N_RB_DL,0);
-  eNB->frame_parms.num_MBSFN_config = 1;
-  eNB->frame_parms.MBSFN_config[0].radioframeAllocationPeriod = 0;
-  eNB->frame_parms.MBSFN_config[0].radioframeAllocationOffset = 0;
-  eNB->frame_parms.MBSFN_config[0].fourFrames_flag = 0;
-  eNB->frame_parms.MBSFN_config[0].mbsfn_SubframeConfig=0xff; // activate all possible subframes
-  UE->frame_parms.num_MBSFN_config = 1;
-  UE->frame_parms.MBSFN_config[0].radioframeAllocationPeriod = 0;
-  UE->frame_parms.MBSFN_config[0].radioframeAllocationOffset = 0;
-  UE->frame_parms.MBSFN_config[0].fourFrames_flag = 0;
-  UE->frame_parms.MBSFN_config[0].mbsfn_SubframeConfig=0xff; // activate all possible subframes
-  fill_eNB_dlsch_MCH(eNB,mcs,1,0);
-  fill_UE_dlsch_MCH(UE,mcs,1,0,0);
-
-  if (is_pmch_subframe(0,subframe,&eNB->frame_parms)==0) {
-    printf("eNB is not configured for MBSFN in subframe %d\n",subframe);
-    exit(-1);
-  } else if (is_pmch_subframe(0,subframe,&UE->frame_parms)==0) {
-    printf("UE is not configured for MBSFN in subframe %d\n",subframe);
-    exit(-1);
+  if(abstx) {
+    // CSV file
+    sprintf(csv_fname,"dataout_tx%d_u2%d_mcs%d_chan%d_nsimus%d_R%d.m",transmission_mode,dual_stream_UE,mcs1,channel_model,n_frames,num_rounds);
+    csv_fd = fopen(csv_fname,"w");
+
+    if (csv_fd==NULL) {
+      fprintf(stderr,"Cannot create file %s!\n",csv_fname);
+      exit(-1);
+    }
+
+    fprintf(csv_fd,"data_all%d=[",mcs1);
   }
 
-  input_buffer_length = eNB->dlsch_MCH->harq_processes[0]->TBS/8;
-  input_buffer = (unsigned char *)malloc(input_buffer_length+4);
-  memset(input_buffer,0,input_buffer_length+4);
+  /*
+  //sprintf(tikz_fname, "second_bler_tx%d_u2=%d_mcs%d_chan%d_nsimus%d.tex",transmission_mode,dual_stream_UE,mcs,channel_model,n_frames);
+  sprintf(tikz_fname, "second_bler_tx%d_u2%d_mcs%d_chan%d_nsimus%d",transmission_mode,dual_stream_UE,mcs,channel_model,n_frames);
+  tikz_fd = fopen(tikz_fname,"w");
+  //fprintf(tikz_fd,"\\addplot[color=red, mark=o] plot coordinates {");
+  switch (mcs)
+    {
+    case 0:
+      fprintf(tikz_fd,"\\addplot[color=blue, mark=star] plot coordinates {");
+      break;
+    case 1:
+      fprintf(tikz_fd,"\\addplot[color=red, mark=star] plot coordinates {");
+      break;
+    case 2:
+      fprintf(tikz_fd,"\\addplot[color=green, mark=star] plot coordinates {");
+      break;
+    case 3:
+      fprintf(tikz_fd,"\\addplot[color=yellow, mark=star] plot coordinates {");
+      break;
+    case 4:
+      fprintf(tikz_fd,"\\addplot[color=black, mark=star] plot coordinates {");
+      break;
+    case 5:
+      fprintf(tikz_fd,"\\addplot[color=blue, mark=o] plot coordinates {");
+      break;
+    case 6:
+      fprintf(tikz_fd,"\\addplot[color=red, mark=o] plot coordinates {");
+      break;
+    case 7:
+      fprintf(tikz_fd,"\\addplot[color=green, mark=o] plot coordinates {");
+      break;
+    case 8:
+      fprintf(tikz_fd,"\\addplot[color=yellow, mark=o] plot coordinates {");
+      break;
+    case 9:
+      fprintf(tikz_fd,"\\addplot[color=black, mark=o] plot coordinates {");
+      break;
+    case 10:
+      fprintf(tikz_fd,"\\addplot[color=blue, mark=square] plot coordinates {");
+      break;
+    case 11:
+      fprintf(tikz_fd,"\\addplot[color=red, mark=square] plot coordinates {");
+      break;
+    case 12:
+      fprintf(tikz_fd,"\\addplot[color=green, mark=square] plot coordinates {");
+      break;
+    case 13:
+      fprintf(tikz_fd,"\\addplot[color=yellow, mark=square] plot coordinates {");
+      break;
+    case 14:
+      fprintf(tikz_fd,"\\addplot[color=black, mark=square] plot coordinates {");
+      break;
+    case 15:
+      fprintf(tikz_fd,"\\addplot[color=blue, mark=diamond] plot coordinates {");
+      break;
+    case 16:
+      fprintf(tikz_fd,"\\addplot[color=red, mark=diamond] plot coordinates {");
+      break;
+    case 17:
+      fprintf(tikz_fd,"\\addplot[color=green, mark=diamond] plot coordinates {");
+      break;
+    case 18:
+      fprintf(tikz_fd,"\\addplot[color=yellow, mark=diamond] plot coordinates {");
+      break;
+    case 19:
+      fprintf(tikz_fd,"\\addplot[color=black, mark=diamond] plot coordinates {");
+      break;
+    case 20:
+      fprintf(tikz_fd,"\\addplot[color=blue, mark=x] plot coordinates {");
+      break;
+    case 21:
+      fprintf(tikz_fd,"\\addplot[color=red, mark=x] plot coordinates {");
+      break;
+    case 22:
+      fprintf(tikz_fd,"\\addplot[color=green, mark=x] plot coordinates {");
+      break;
+    case 23:
+      fprintf(tikz_fd,"\\addplot[color=yellow, mark=x] plot coordinates {");
+      break;
+    case 24:
+      fprintf(tikz_fd,"\\addplot[color=black, mark=x] plot coordinates {");
+      break;
+    case 25:
+      fprintf(tikz_fd,"\\addplot[color=blue, mark=x] plot coordinates {");
+      break;
+    case 26:
+      fprintf(tikz_fd,"\\addplot[color=red, mark=+] plot coordinates {");
+      break;
+    case 27:
+      fprintf(tikz_fd,"\\addplot[color=green, mark=+] plot coordinates {");
+      break;
+    case 28:
+      fprintf(tikz_fd,"\\addplot[color=yellow, mark=+] plot coordinates {");
+      break;
+    }
+  */
+  UE->pdcch_vars[UE->current_thread_id[subframe]][0]->crnti = n_rnti;
+  UE->n_connected_eNB = 1;
+  printf("Allocating %dx%d eNB->UE channel descriptor\n",eNB->frame_parms.nb_antennas_tx,UE->frame_parms.nb_antennas_rx);
+  eNB2UE[0] = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
+                                   UE->frame_parms.nb_antennas_rx,
+                                   channel_model,
+                                   N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
+                                   N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
+                                   forgetting_factor,
+                                   rx_sample_offset,
+                                   0);
+  reset_meas(&eNB2UE[0]->random_channel);
+  reset_meas(&eNB2UE[0]->interp_time);
+
+  if(num_rounds>1) {
+    for(n=1; n<4; n++) {
+      eNB2UE[n] = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
+                                       UE->frame_parms.nb_antennas_rx,
+                                       channel_model,
+                                       N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
+                                       N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
+                                       forgetting_factor,
+                                       rx_sample_offset,
+                                       0);
+      reset_meas(&eNB2UE[n]->random_channel);
+      reset_meas(&eNB2UE[n]->interp_time);
+    }
+  }
 
-  for (i=0; i<input_buffer_length+4; i++) {
-    input_buffer[i]= (unsigned char)(taus()&0xff);
+  if (eNB2UE[0]==NULL) {
+    printf("Problem generating channel model. Exiting.\n");
+    exit(-1);
   }
 
-  snr_step = input_snr_step;
+  if ((transmission_mode == 3) || (transmission_mode==4))
+    Kmimo=2;
+  else
+    Kmimo=1;
 
-  for (SNR=snr0; SNR<snr1; SNR+=snr_step) {
-    UE->proc.proc_rxtx[0].frame_tx=0;
-    eNB->proc.proc_rxtx[0].frame_tx=0;
-    eNB->proc.proc_rxtx[0].subframe_tx=subframe;
-    errs[0]=0;
-    errs[1]=0;
-    errs[2]=0;
-    errs[3]=0;
-    /*
-    round_trials[0] = 0;
-    round_trials[1] = 0;
-    round_trials[2] = 0;
-    round_trials[3] = 0;*/
-    printf("********************** SNR %f (step %f)\n",SNR,snr_step);
-
-    for (trials = 0; trials<n_frames; trials++) {
-      //        printf("Trial %d\n",trials);
-      fflush(stdout);
-      round=0;
-      //if (trials%100==0)
-      //eNB2UE[0]->first_run = 1;
-      eNB2UE->first_run = 1;
-      memset(&eNB->common_vars.txdataF[0][0][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t));
-      generate_mch(eNB,&eNB->proc.proc_rxtx[0],input_buffer);
-      PHY_ofdm_mod(eNB->common_vars.txdataF[0][0],        // input,
-                   txdata[0],         // output
-                   frame_parms->ofdm_symbol_size,
-                   LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb,                 // number of symbols
-                   frame_parms->nb_prefix_samples,               // number of prefix samples
-                   CYCLIC_PREFIX);
+  switch (ue_category) {
+    case 1:
+      Nsoft = 250368;
+      break;
 
-      if (n_frames==1) {
-        LOG_M("txsigF0.m","txsF0", &eNB->common_vars.txdataF[0][0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],
-              nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
-        //if (eNB->frame_parms.nb_antennas_tx>1)
-        //LOG_M("txsigF1.m","txsF1", &eNB->lte_eNB_common_vars.txdataF[eNB_id][1][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
-      }
+    case 2:
+    case 3:
+      Nsoft = 1237248;
+      break;
 
-      tx_lev = 0;
+    case 4:
+      Nsoft = 1827072;
+      break;
 
-      for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
-        tx_lev += signal_energy(&eNB->common_vars.txdata[eNB_id][aa]
-                                [subframe*eNB->frame_parms.samples_per_tti],
-                                eNB->frame_parms.samples_per_tti);
-      }
+    default:
+      printf("Unsupported UE category %d\n",ue_category);
+      exit(-1);
+      break;
+  }
 
-      tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
+  for (k=0; k<NUMBER_OF_UE_MAX; k++) {
+    // Create transport channel structures for 2 transport blocks (MIMO)
+    for (i=0; i<2; i++) {
+      eNB->dlsch[k][i] = new_eNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0,&eNB->frame_parms);
 
-      if (n_frames==1) {
-        printf("tx_lev = %d (%d dB)\n",tx_lev,tx_lev_dB);
-        //    LOG_M("txsig0.m","txs0", &eNB->common_vars.txdata[0][0][subframe* eNB->frame_parms.samples_per_tti],
-        //     eNB->frame_parms.samples_per_tti,1,1);
+      if (!eNB->dlsch[k][i]) {
+        printf("Can't get eNB dlsch structures\n");
+        exit(-1);
       }
 
-      for (i=0; i<2*frame_parms->samples_per_tti; i++) {
-        for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
-          s_re[aa][i] = ((double)(((short *)eNB->common_vars.txdata[0][aa]))[(2*subframe*UE->frame_parms.samples_per_tti) + (i<<1)]);
-          s_im[aa][i] = ((double)(((short *)eNB->common_vars.txdata[0][aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)+1]);
-        }
+      eNB->dlsch[k][i]->rnti = n_rnti+k;
+    }
+  }
+
+#ifdef ENABLE_MBMS_SIM
+  eNB->dlsch_MCH = new_eNB_dlsch(1,8,Nsoft,N_RB_DL, 0, &eNB->frame_parms);
+#endif
+
+ 
+  /* allocate memory for both subframes (only one is really used
+   * but there is now "copy_harq_proc_struct" which needs both
+   * to be valid)
+   * TODO: refine this somehow (necessary?)
+   */
+  for (sf = 0; sf < 2; sf++) {
+    for (i=0; i<2; i++) {
+      UE->dlsch[sf][0][i]  = new_ue_dlsch(Kmimo,8,Nsoft,MAX_TURBO_ITERATIONS,N_RB_DL,0);
+
+      if (!UE->dlsch[sf][0][i]) {
+        printf("Can't get ue dlsch structures\n");
+        exit(-1);
       }
 
-      //Multipath channel
-      multipath_channel(eNB2UE,s_re,s_im,r_re,r_im,
-                        2*frame_parms->samples_per_tti,hold_channel);
-      //AWGN
-      sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)eNB->frame_parms.ofdm_symbol_size/(NB_RB*12)) - SNR;
-      sigma2 = pow(10,sigma2_dB/10);
-
-      if (n_frames==1)
-        printf("Sigma2 %f (sigma2_dB %f)\n",sigma2,sigma2_dB);
-
-      for (i=0; i<2*frame_parms->samples_per_tti; i++) {
-        for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
-          //printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]);
-          ((short *) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i] =
-            (short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
-          ((short *) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i+1] =
-            (short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
-        }
+      UE->dlsch[sf][0][i]->rnti   = n_rnti;
+    }
+  }
+
+#ifdef ENABLE_MBMS_SIM
+  UE->dlsch_MCH[0] = new_ue_dlsch(1,8,Nsoft,MAX_TURBO_ITERATIONS_MBSFN,N_RB_DL,0);
+  UE->dlsch_MCH[0]->active = 1;
+  UE->dlsch_MCH[0]->harq_processes[0]->mcs = mcs1;
+#endif
+
+  UE->dlsch_SI[0]  = new_ue_dlsch(1,1,Nsoft,MAX_TURBO_ITERATIONS,N_RB_DL,0);
+  UE->dlsch_ra[0]  = new_ue_dlsch(1,1,Nsoft,MAX_TURBO_ITERATIONS,N_RB_DL,0);
+  UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0);
+  // structure for SIC at UE
+  UE->dlsch_eNB[0] = new_eNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0,&eNB->frame_parms);
+
+  if (DLSCH_alloc_pdu2_1E[0].tpmi == 5) {
+    eNB->UE_stats[0].DL_pmi_single = (unsigned short)(taus()&0xffff);
+
+    if (n_users>1)
+      eNB->UE_stats[1].DL_pmi_single = (eNB->UE_stats[0].DL_pmi_single ^ 0x1555); //opposite PMI
+  } else {
+    eNB->UE_stats[0].DL_pmi_single = 0;
+
+    if (n_users>1)
+      eNB->UE_stats[1].DL_pmi_single = 0;
+  }
+
+  L1_rxtx_proc_t *proc_eNB = &eNB->proc.L1_proc;
+
+  if (input_fd==NULL) {
+    DL_req.dl_config_request_body.number_pdcch_ofdm_symbols = num_pdcch_symbols;
+    DL_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+    TX_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+    // UE specific DCI
+    fill_DCI(eNB,
+             proc_eNB->frame_tx,subframe,
+             &sched_resp,
+             input_buffer,
+             n_rnti,
+             n_users,
+             transmission_mode,
+             0,
+             common_flag,
+             NB_RB,
+             DLSCH_RB_ALLOC,
+             TPC,
+             mcs1,
+             mcs2,
+             1,
+             0,
+             pa,
+             &num_common_dci,
+             &num_ue_spec_dci,
+             &num_dci);
+    numCCE = get_nCCE(num_pdcch_symbols,&eNB->frame_parms,get_mi(&eNB->frame_parms,subframe));
+
+    if (n_frames==1) printf("num_pdcch_symbols %d, numCCE %d, num_dci %d/%d/%d\n",num_pdcch_symbols,numCCE, num_dci,num_ue_spec_dci,num_common_dci);
+  }
+
+  eNB->frame_parms.Nid_cell_mbsfn=0;
+  if(enable_fembms){
+	  lte_gold_mbsfn_khz_1dot25 (&eNB->frame_parms, eNB->lte_gold_mbsfn_khz_1dot25_table, eNB->frame_parms.Nid_cell_mbsfn);
+	  eNB->frame_parms.NonMBSFN_config_flag=1;
+  }else{	  
+	  lte_gold_mbsfn (&eNB->frame_parms, eNB->lte_gold_mbsfn_table, eNB->frame_parms.Nid_cell_mbsfn);
+	  eNB->frame_parms.num_MBSFN_config=1;
+	  eNB->frame_parms.MBSFN_config[0].radioframeAllocationPeriod=0;
+	  eNB->frame_parms.MBSFN_config[0].fourFrames_flag=0;
+	  eNB->frame_parms.MBSFN_config[0].radioframeAllocationOffset=0;
+	  //eNB->frame_parms.MBSFN_config[0].mbsfn_SubframeConfig=0xC0;
+	  eNB->frame_parms.MBSFN_config[0].mbsfn_SubframeConfig=0xFC;
+  }
+
+
+
+  snr_step = input_snr_step;
+  UE->high_speed_flag = 1;
+  UE->ch_est_alpha=0;
+
+  for (ch_realization=0; ch_realization<n_ch_rlz; ch_realization++) {
+    if(abstx) {
+      printf("**********************Channel Realization Index = %d **************************\n", ch_realization);
+    }
+
+    for (SNR=snr0; SNR<snr1; SNR+=snr_step) {
+      UE->proc.proc_rxtx[UE->current_thread_id[subframe]].frame_rx=0;
+      errs[0]=0;
+      errs[1]=0;
+      errs[2]=0;
+      errs[3]=0;
+      errs2[0]=0;
+      errs2[1]=0;
+      errs2[2]=0;
+      errs2[3]=0;
+      round_trials[0] = 0;
+      round_trials[1] = 0;
+      round_trials[2] = 0;
+      round_trials[3] = 0;
+      dci_errors[0]=0;
+      dci_errors[1]=0;
+      dci_errors[2]=0;
+      dci_errors[3]=0;
+      //      avg_ber = 0;
+      round=0;
+      avg_iter = 0;
+      iter_trials=0;
+      reset_meas(&eNB->phy_proc_tx); // total eNB tx
+      reset_meas(&eNB->dlsch_scrambling_stats);
+      reset_meas(&UE->dlsch_unscrambling_stats);
+      reset_meas(&eNB->ofdm_mod_stats);
+      reset_meas(&eNB->dlsch_modulation_stats);
+      reset_meas(&eNB->dlsch_encoding_stats);
+      reset_meas(&eNB->dlsch_interleaving_stats);
+      reset_meas(&eNB->dlsch_rate_matching_stats);
+      reset_meas(&eNB->dlsch_turbo_encoding_stats);
+      reset_meas(&eNB->dlsch_common_and_dci);
+      reset_meas(&eNB->dlsch_ue_specific);
+
+      for (int i=0; i<RX_NB_TH; i++) {
+        reset_meas(&UE->phy_proc_rx[i]); // total UE rx
+        reset_meas(&UE->ue_front_end_stat[i]);
+        reset_meas(&UE->pdsch_procedures_stat[i]);
+        reset_meas(&UE->dlsch_procedures_stat[i]);
+        reset_meas(&UE->dlsch_decoding_stats[i]);
+        reset_meas(&UE->dlsch_llr_stats_parallelization[i][0]);
+        reset_meas(&UE->dlsch_llr_stats_parallelization[i][1]);
       }
 
-      for (l=2; l<12; l++) {
-        slot_fep_mbsfn(UE,
-                       l,
-                       subframe%10,
-                       0,
-                       0);
-
-        if (UE->perfect_ce==1) {
-          // fill in perfect channel estimates
-          freq_channel(eNB2UE,UE->frame_parms.N_RB_DL,12*UE->frame_parms.N_RB_DL + 1);
-
-          for(k=0; k<NUMBER_OF_eNB_MAX; k++) {
-            for(aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
-              for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
-                for (i=0; i<frame_parms->N_RB_DL*12; i++) {
-                  ((int16_t *) UE->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[k][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+
-                      (aa*frame_parms->nb_antennas_rx)][i].x*AMP);
-                  ((int16_t *) UE->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[k][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+
-                      (aa*frame_parms->nb_antennas_rx)][i].y*AMP);
-                }
+      reset_meas(&UE->ofdm_demod_stats);
+      reset_meas(&UE->crnti_procedures_stats);
+      reset_meas(&UE->dlsch_channel_estimation_stats);
+      reset_meas(&UE->dlsch_freq_offset_estimation_stats);
+      reset_meas(&UE->rx_dft_stats);
+      reset_meas(&UE->dlsch_decoding_stats[0]);
+      reset_meas(&UE->dlsch_decoding_stats[1]);
+      reset_meas(&UE->dlsch_turbo_decoding_stats);
+      reset_meas(&UE->dlsch_deinterleaving_stats);
+      reset_meas(&UE->dlsch_rate_unmatching_stats);
+      reset_meas(&UE->dlsch_tc_init_stats);
+      reset_meas(&UE->dlsch_tc_alpha_stats);
+      reset_meas(&UE->dlsch_tc_beta_stats);
+      reset_meas(&UE->dlsch_tc_gamma_stats);
+      reset_meas(&UE->dlsch_tc_ext_stats);
+      reset_meas(&UE->dlsch_tc_intl1_stats);
+      reset_meas(&UE->dlsch_tc_intl2_stats);
+      // initialization
+      // initialization
+      varArray_t *table_tx=initVarArray(1000,sizeof(double));
+      varArray_t *table_tx_ifft=initVarArray(1000,sizeof(double));
+      varArray_t *table_tx_mod=initVarArray(1000,sizeof(double));
+      varArray_t *table_tx_enc=initVarArray(1000,sizeof(double));
+      varArray_t *table_rx=initVarArray(1000,sizeof(double));
+      time_stats_t phy_proc_rx_tot;
+      time_stats_t pdsch_procedures_tot;
+      time_stats_t dlsch_procedures_tot;
+      time_stats_t dlsch_decoding_tot;
+      time_stats_t dlsch_llr_tot;
+      time_stats_t ue_front_end_tot;
+      varArray_t *table_rx_fft=initVarArray(1000,sizeof(double));
+      varArray_t *table_rx_demod=initVarArray(1000,sizeof(double));
+      varArray_t *table_rx_dec=initVarArray(1000,sizeof(double));
+
+      for (trials = 0; trials<n_frames; trials++) {
+        //printf("Trial %d\n",trials);
+        fflush(stdout);
+        round=0;
+        //if (trials%100==0)
+        eNB2UE[0]->first_run = 1;
+        UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->harq_ack[subframe].ack = 0;
+        UE->dlsch[UE->current_thread_id[subframe]][eNB_id][1]->harq_ack[subframe].ack = 0;
+
+        while ((round < num_rounds) && (UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->harq_ack[subframe].ack == 0)) {
+          //    printf("Trial %d, round %d\n",trials,round);
+          round_trials[round]++;
+
+          //if(transmission_mode>=5)
+          //  pmi_feedback=1;
+          //else
+          //  pmi_feedback=0;
+
+          if (abstx) {
+            if (trials==0 && round==0 && SNR==snr0)  //generate a new channel
+              hold_channel = 0;
+            else
+              hold_channel = 1;
+          } else
+            hold_channel = 0;//(round==0) ? 0 : 1;
+
+          //PMI_FEEDBACK:
+
+          //  printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback);
+          for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
+            memset(&eNB->common_vars.txdataF[aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t));
+          }
+
+          if (input_fd==NULL) {
+            // Simulate HARQ procedures!!!
+            memset(CCE_table,0,800*sizeof(int));
+
+            if (/*common_flag == 0*/ 1) {
+              num_dci=0;
+              num_common_dci=0;
+              num_ue_spec_dci=0;
+
+              if (round == 0) {   // First round
+                TB0_active = 1;
+                eNB->dlsch[0][0]->harq_processes[0]->rvidx = round&3;
+                DL_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+                TX_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+                fill_DCI(eNB,proc_eNB->frame_tx,subframe,&sched_resp,input_buffer,n_rnti,n_users,transmission_mode,0,common_flag,NB_RB,DLSCH_RB_ALLOC,TPC,
+                         mcs1,mcs2,!(trials&1),round&3,pa,&num_common_dci,&num_ue_spec_dci,&num_dci);
+              } else {
+                DL_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+                TX_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+                fill_DCI(eNB,proc_eNB->frame_tx,subframe,&sched_resp,input_buffer,n_rnti,n_users,transmission_mode,1,common_flag,NB_RB,DLSCH_RB_ALLOC,TPC,
+                         (TB0_active==1)?mcs1:0,mcs2,!(trials&1),(TB0_active==1)?round&3:0,pa,&num_common_dci,&num_ue_spec_dci,&num_dci);
+              }
+            }
+
+//#ifdef ENABLE_MBMS_SIM
+//	    eNB->frame_parms.Nid_cell_mbsfn=0;
+//  	    lte_gold_mbsfn (&eNB->frame_parms, eNB->lte_gold_mbsfn_table, eNB->frame_parms.Nid_cell_mbsfn);
+//#endif	   
+
+	     UE->measurements.n0_power_tot_dB =  10*log10((double)tx_lev) +10*log10((double)ru->frame_parms.ofdm_symbol_size/(double)(ru->frame_parms.N_RB_DL*12)) - SNR;
+            UE->measurements.n0_power_tot = pow(10,( 10*log10((double)tx_lev) +10*log10((double)ru->frame_parms.ofdm_symbol_size/(double)(ru->frame_parms.N_RB_DL*12)) - SNR)/10);		
+ 
+            proc_eNB->subframe_tx = subframe;
+            sched_resp.subframe=subframe;
+            sched_resp.frame=proc_eNB->frame_tx;
+            eNB->abstraction_flag=0;
+            schedule_response(&sched_resp);
+            phy_procedures_eNB_TX(eNB,proc_eNB,1);
+
+            if (uncoded_ber_bit == NULL) {
+              // this is for user 0 only
+              printf("nb_rb %d, rb_alloc %x, mcs %d\n",
+                     eNB->dlsch[0][0]->harq_processes[0]->nb_rb,
+                     eNB->dlsch[0][0]->harq_processes[0]->rb_alloc[0],
+                     eNB->dlsch[0][0]->harq_processes[0]->mcs);
+              coded_bits_per_codeword = get_G(&eNB->frame_parms,
+                                              eNB->dlsch[0][0]->harq_processes[0]->nb_rb,
+                                              eNB->dlsch[0][0]->harq_processes[0]->rb_alloc,
+                                              get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs),
+                                              eNB->dlsch[0][0]->harq_processes[0]->Nl,
+                                              num_pdcch_symbols,
+                                              0,
+                                              subframe,
+                                              transmission_mode>=7?transmission_mode:0);
+              uncoded_ber_bit = (short *) malloc(sizeof(short)*coded_bits_per_codeword);
+              printf("uncoded_ber_bit=%p\n",uncoded_ber_bit);
+            }
+
+
+
+            start_meas(&eNB->ofdm_mod_stats);
+            ru->proc.subframe_tx=subframe;
+ 	    LOG_W(PHY,"eNB %d\n",eNB->frame_parms.num_MBSFN_config);
+ 	    LOG_W(PHY,"eNB %d\n",eNB->frame_parms.NonMBSFN_config_flag);
+            memcpy((void *)&ru->frame_parms,(void *)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
+ 	    LOG_W(PHY,"RU %d\n",ru->frame_parms.num_MBSFN_config);
+ 	    LOG_W(PHY,"RU %d\n",ru->frame_parms.NonMBSFN_config_flag);
+            feptx_prec(ru);
+            feptx_ofdm(ru);
+            stop_meas(&eNB->ofdm_mod_stats);
+            // generate next subframe for channel estimation
+            DL_req.dl_config_request_body.number_dci=0;
+            DL_req.dl_config_request_body.number_pdu=0;
+            TX_req.tx_request_body.number_of_pdus=0;
+            proc_eNB->subframe_tx = subframe+1;
+            sched_resp.subframe=subframe+1;
+            schedule_response(&sched_resp);
+
+            phy_procedures_eNB_TX(eNB,proc_eNB,0);
+            ru->proc.subframe_tx=(subframe+1)%10;
+            feptx_prec(ru);
+            feptx_ofdm(ru);
+            proc_eNB->frame_tx++;
+            tx_lev = 0;
+
+            for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
+              tx_lev += signal_energy(&ru->common.txdata[aa]
+                                      [subframe*eNB->frame_parms.samples_per_tti],
+                                      eNB->frame_parms.samples_per_tti);
+            }
+
+            tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
+
+            if (n_frames==1) {
+              printf("tx_lev = %u (%u dB)\n",tx_lev,tx_lev_dB);
+              LOG_M("txsig0.m","txs0", &ru->common.txdata[0][subframe* eNB->frame_parms.samples_per_tti], eNB->frame_parms.samples_per_tti,1,1);
+
+              if (transmission_mode<7) {
+                LOG_M("txsigF0.m","txsF0x", &ru->common.txdataF_BF[0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
+              } else if (transmission_mode == 7) {
+                LOG_M("txsigF0.m","txsF0", &ru->common.txdataF_BF[5][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
+                LOG_M("txsigF0_BF.m","txsF0_BF", &ru->common.txdataF_BF[0][0],eNB->frame_parms.ofdm_symbol_size,1,1);
               }
             }
           }
+
+          DL_channel(ru,UE,subframe,awgn_flag,SNR,tx_lev,hold_channel,abstx,num_rounds,trials,round,eNB2UE,s_re,s_im,r_re,r_im,csv_fd);
+          UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[UE->current_thread_id[subframe]];
+          proc->subframe_rx = subframe;
+          UE->UE_mode[0] = PUSCH;
+          // first symbol has to be done separately in one-shot mode
+          slot_fep(UE,
+                   0,
+                   (proc->subframe_rx<<1),
+                   UE->rx_offset,
+                   0,
+                   0);
+
+          if (n_frames==1) printf("Running phy_procedures_UE_RX\n");
+
+          if (dci_flag==0) {
+            memcpy(dci_alloc,eNB->pdcch_vars[subframe&1].dci_alloc,num_dci*sizeof(DCI_ALLOC_t));
+            UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id]->num_pdcch_symbols = num_pdcch_symbols;
+
+            if (n_frames==1)
+              printf("bypassing PDCCH/DCI detection\n");
+
+            if  (generate_ue_dlsch_params_from_dci(proc->frame_rx,
+                                                   proc->subframe_rx,
+                                                   (void *)&dci_alloc[0].dci_pdu,
+                                                   common_flag == 0 ? n_rnti : SI_RNTI,
+                                                   dci_alloc[0].format,
+                                                   UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id],
+                                                   UE->pdsch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id],
+                                                   UE->dlsch[UE->current_thread_id[proc->subframe_rx]][0],
+                                                   &UE->frame_parms,
+                                                   UE->pdsch_config_dedicated,
+                                                   SI_RNTI,
+                                                   0,
+                                                   P_RNTI,
+                                                   UE->transmission_mode[eNB_id]<7?0:UE->transmission_mode[eNB_id],
+                                                   0)==0) {
+              dump_dci(&UE->frame_parms, &dci_alloc[0]);
+              //UE->dlsch[UE->current_thread_id[proc->subframe_rx]][eNB_id][0]->active = 1;
+              //UE->dlsch[UE->current_thread_id[proc->subframe_rx]][eNB_id][1]->active = 1;
+              UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id]->num_pdcch_symbols = num_pdcch_symbols;
+              UE->dlsch_received[eNB_id]++;
+            } else {
+              LOG_E(PHY,"Problem in DCI!\n");
+            }
+          }
+
+
+  	UE->frame_parms.Nid_cell_mbsfn=0;
+	if(enable_fembms){
+	  	lte_gold_mbsfn_khz_1dot25 (&UE->frame_parms, UE->lte_gold_mbsfn_khz_1dot25_table, UE->frame_parms.Nid_cell_mbsfn);
+		UE->frame_parms.NonMBSFN_config_flag=1;
+	}else{
+		lte_gold_mbsfn (&UE->frame_parms, UE->lte_gold_mbsfn_table, UE->frame_parms.Nid_cell_mbsfn);
+		UE->frame_parms.num_MBSFN_config=1;
+		UE->frame_parms.MBSFN_config[0].radioframeAllocationPeriod=0;
+		UE->frame_parms.MBSFN_config[0].fourFrames_flag=0;
+		UE->frame_parms.MBSFN_config[0].radioframeAllocationOffset=0;
+		UE->frame_parms.MBSFN_config[0].mbsfn_SubframeConfig=0xC0;
+	}
+
+
+
+
+          dci_received = UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id]->dci_received;
+          phy_procedures_UE_RX(UE,proc,0,0,dci_flag,normal_txrx);
+          dci_received = dci_received - UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id]->dci_received;
+
+          if (dci_flag && (dci_received == 0)) {
+            printf("DCI not received\n");
+            dci_errors[round]++;
+            LOG_M("pdcchF0_ext.m","pdcchF_ext", UE->pdcch_vars[0][eNB_id]->rxdataF_ext[0],2*3*UE->frame_parms.ofdm_symbol_size,1,1);
+            LOG_M("pdcch00_ch0_ext.m","pdcch00_ch0_ext",UE->pdcch_vars[0][eNB_id]->dl_ch_estimates_ext[0],300*3,1,1);
+            LOG_M("pdcch_rxF_comp0.m","pdcch0_rxF_comp0",UE->pdcch_vars[0][eNB_id]->rxdataF_comp[0],4*300,1,1);
+            LOG_M("pdcch_rxF_llr.m","pdcch_llr",UE->pdcch_vars[0][eNB_id]->llr,2400,1,4);
+            LOG_M("rxsig0.m","rxs0", &UE->common_vars.rxdata[0][0],10*UE->frame_parms.samples_per_tti,1,1);
+            LOG_M("rxsigF0.m","rxsF0", &UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].rxdataF[0][0],UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+            exit(-1);
+          }
+
+          int bit_errors=0;
+
+          if ((test_perf ==0 ) && (n_frames==1)) {
+            dlsch_unscrambling(&eNB->frame_parms,
+                               0,
+                               UE->dlsch[UE->current_thread_id[subframe]][0][0],
+                               coded_bits_per_codeword,
+                               UE->pdsch_vars[UE->current_thread_id[subframe]][0]->llr[0],
+                               0,
+                               subframe<<1);
+
+            for (i=0; i<coded_bits_per_codeword; i++)
+              if ((eNB->dlsch[0][0]->harq_processes[0]->e[i]==1 && UE->pdsch_vars[UE->current_thread_id[subframe]][0]->llr[0][i] > 0)||
+                  (eNB->dlsch[0][0]->harq_processes[0]->e[i]==0 && UE->pdsch_vars[UE->current_thread_id[subframe]][0]->llr[0][i] < 0)) {
+                uncoded_ber_bit[bit_errors++] = 1;
+                printf("error in pos %d : %d => %d\n",i,
+                       eNB->dlsch[0][0]->harq_processes[0]->e[i],
+                       UE->pdsch_vars[UE->current_thread_id[subframe]][0]->llr[0][i]);
+              } else {
+                /*
+                printf("no error in pos %d : %d => %d\n",i,
+                       eNB->dlsch[0][0]->harq_processes[0]->e[i],
+                       UE->pdsch_vars[UE->current_thread_id[subframe]][0]->llr[0][i]);
+                */
+              }
+
+            LOG_M("dlsch_ber_bit.m","ber_bit",uncoded_ber_bit,coded_bits_per_codeword,1,0);
+            LOG_M("ch0.m","ch0",eNB2UE[0]->ch[0],eNB2UE[0]->channel_length,1,8);
+
+            if (eNB->frame_parms.nb_antennas_tx>1)
+              LOG_M("ch1.m","ch1",eNB2UE[0]->ch[eNB->frame_parms.nb_antennas_rx],eNB2UE[0]->channel_length,1,8);
+
+            //common vars
+            LOG_M("rxsig0.m","rxs0", &UE->common_vars.rxdata[0][0],10*UE->frame_parms.samples_per_tti,1,1);
+            LOG_M("rxsigF0.m","rxsF0", &UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].rxdataF[0][0],UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+
+            if (UE->frame_parms.nb_antennas_rx>1) {
+              LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1],UE->frame_parms.samples_per_tti,1,1);
+              LOG_M("rxsigF1.m","rxsF1", UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].rxdataF[1],UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+            }
+
+            LOG_M("dlsch00_r0.m","dl00_r0",
+                  &(UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0]),
+                  UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+
+            if (UE->frame_parms.nb_antennas_rx>1)
+              LOG_M("dlsch01_r0.m","dl01_r0",
+                    &(UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].dl_ch_estimates[eNB_id][1][0]),
+                    UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+
+            if (eNB->frame_parms.nb_antennas_tx>1)
+              LOG_M("dlsch10_r0.m","dl10_r0",
+                    &(UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2][0]),
+                    UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+
+            if ((UE->frame_parms.nb_antennas_rx>1) && (eNB->frame_parms.nb_antennas_tx>1))
+              LOG_M("dlsch11_r0.m","dl11_r0",
+                    &(UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].dl_ch_estimates[eNB_id][3][0]),
+                    UE->frame_parms.ofdm_symbol_size*nsymb/2,1,1);
+
+            //pdsch_vars
+            printf("coded_bits_per_codeword %u\n",coded_bits_per_codeword);
+            dump_dlsch2(UE,eNB_id,subframe,&coded_bits_per_codeword,round, UE->dlsch[UE->current_thread_id[subframe]][0][0]->current_harq_pid);
+            LOG_M("dlsch_e.m","e",eNB->dlsch[0][0]->harq_processes[0]->e,coded_bits_per_codeword,1,4);
+            //pdcch_vars
+            LOG_M("pdcchF0_ext.m","pdcchF_ext", UE->pdcch_vars[0][eNB_id]->rxdataF_ext[0],2*3*UE->frame_parms.ofdm_symbol_size,1,1);
+            LOG_M("pdcch00_ch0_ext.m","pdcch00_ch0_ext",UE->pdcch_vars[0][eNB_id]->dl_ch_estimates_ext[0],300*3,1,1);
+            LOG_M("pdcch_rxF_comp0.m","pdcch0_rxF_comp0",UE->pdcch_vars[0][eNB_id]->rxdataF_comp[0],4*300,1,1);
+            LOG_M("pdcch_rxF_llr.m","pdcch_llr",UE->pdcch_vars[0][eNB_id]->llr,2400,1,4);
+          }
+
+          if (UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->harq_ack[subframe].ack == 1) {
+            avg_iter += UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->last_iteration_cnt;
+            iter_trials++;
+
+            if (n_frames==1)
+              printf("No DLSCH errors found (round %d),uncoded ber %f\n",round,(double)bit_errors/coded_bits_per_codeword);
+
+            UE->total_TBS[eNB_id] =  UE->total_TBS[eNB_id] + UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->harq_processes[UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->current_harq_pid]->TBS;
+            TB0_active = 0;
+          } // DLSCH received ok
+          else {
+            errs[round]++;
+            avg_iter += UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->last_iteration_cnt-1;
+            iter_trials++;
+
+            if (n_frames==1) {
+              //if ((n_frames==1) || (SNR>=30)) {
+              printf("DLSCH errors found (round %d), uncoded ber %f\n",round,(double)bit_errors/coded_bits_per_codeword);
+
+              for (s=0; s<UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->C; s++) {
+                if (s<UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Cminus)
+                  Kr = UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Kminus;
+                else
+                  Kr = UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Kplus;
+
+                Kr_bytes = Kr>>3;
+                printf("Decoded_output (Segment %d):\n",s);
+
+                for (i=0; i<Kr_bytes; i++)
+                  printf("%d : %x (%x)\n",i,UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->c[s][i],
+                         UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->c[s][i]^eNB->dlsch[0][0]->harq_processes[0]->c[s][i]);
+              }
+
+              sprintf(fname,"rxsig0_r%d.m",round);
+              sprintf(vname,"rxs0_r%d",round);
+              LOG_M(fname,vname, &UE->common_vars.rxdata[0][0],10*UE->frame_parms.samples_per_tti,1,1);
+              sprintf(fname,"rxsigF0_r%d.m",round);
+              sprintf(vname,"rxs0F_r%d",round);
+              LOG_M(fname,vname, &UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].rxdataF[0][0],UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+
+              if (UE->frame_parms.nb_antennas_rx>1) {
+                sprintf(fname,"rxsig1_r%d.m",round);
+                sprintf(vname,"rxs1_r%d.m",round);
+                LOG_M(fname,vname, UE->common_vars.rxdata[1],UE->frame_parms.samples_per_tti,1,1);
+                sprintf(fname,"rxsigF1_r%d.m",round);
+                sprintf(vname,"rxs1F_r%d.m",round);
+                LOG_M(fname,vname, UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].rxdataF[1],UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+              }
+
+              sprintf(fname,"dlsch00_r%d.m",round);
+              sprintf(vname,"dl00_r%d",round);
+              LOG_M(fname,vname,
+                    &(UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0]),
+                    UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+
+              if (UE->frame_parms.nb_antennas_rx>1) {
+                sprintf(fname,"dlsch01_r%d.m",round);
+                sprintf(vname,"dl01_r%d",round);
+                LOG_M(fname,vname,
+                      &(UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].dl_ch_estimates[eNB_id][1][0]),
+                      UE->frame_parms.ofdm_symbol_size*nsymb/2,1,1);
+              }
+
+              if (eNB->frame_parms.nb_antennas_tx>1) {
+                sprintf(fname,"dlsch10_r%d.m",round);
+                sprintf(vname,"dl10_r%d",round);
+                LOG_M(fname,vname,
+                      &(UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2][0]),
+                      UE->frame_parms.ofdm_symbol_size*nsymb/2,1,1);
+              }
+
+              if ((UE->frame_parms.nb_antennas_rx>1) && (eNB->frame_parms.nb_antennas_tx>1)) {
+                sprintf(fname,"dlsch11_r%d.m",round);
+                sprintf(vname,"dl11_r%d",round);
+                LOG_M(fname,vname,
+                      &(UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].dl_ch_estimates[eNB_id][3][0]),
+                      UE->frame_parms.ofdm_symbol_size*nsymb/2,1,1);
+              }
+
+              //pdsch_vars
+              dump_dlsch2(UE,eNB_id,subframe,&coded_bits_per_codeword,round, UE->dlsch[UE->current_thread_id[subframe]][0][0]->current_harq_pid);
+              //LOG_M("dlsch_e.m","e",eNB->dlsch[0][0]->harq_processes[0]->e,coded_bits_per_codeword,1,4);
+              //LOG_M("dlsch_ber_bit.m","ber_bit",uncoded_ber_bit,coded_bits_per_codeword,1,0);
+              //LOG_M("dlsch_w.m","w",eNB->dlsch[0][0]->harq_processes[0]->w[0],3*(tbs+64),1,4);
+              //LOG_M("dlsch_w.m","w",UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->w[0],3*(tbs+64),1,0);
+              //pdcch_vars
+              LOG_M("pdcchF0_ext.m","pdcchF_ext", UE->pdcch_vars[0][eNB_id]->rxdataF_ext[0],2*3*UE->frame_parms.ofdm_symbol_size,1,1);
+              LOG_M("pdcch00_ch0_ext.m","pdcch00_ch0_ext",UE->pdcch_vars[0][eNB_id]->dl_ch_estimates_ext[0],300*3,1,1);
+              LOG_M("pdcch_rxF_comp0.m","pdcch0_rxF_comp0",UE->pdcch_vars[0][eNB_id]->rxdataF_comp[0],4*300,1,1);
+              LOG_M("pdcch_rxF_llr.m","pdcch_llr",UE->pdcch_vars[0][eNB_id]->llr,2400,1,4);
+
+              if (round == 3) exit(-1);
+            }
+
+            //      printf("round %d errors %d/%d\n",round,errs[round],trials);
+            round++;
+            //      UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->round++;
+          }
+
+          if (xforms==1) {
+            phy_scope_UE(form_ue,
+                         UE,
+                         eNB_id,
+                         0,// UE_id
+                         subframe);
+          }
+
+          UE->proc.proc_rxtx[UE->current_thread_id[subframe]].frame_rx++;
+        }  //round
+
+        //      printf("\n");
+
+        if ((errs[0]>=n_frames/10) && (trials>(n_frames/2)))
+          break;
+
+        //len = chbch_stats_read(stats_buffer,NULL,0,4096);
+        //printf("%s\n\n",stats_buffer);
+
+        if (UE->proc.proc_rxtx[UE->current_thread_id[subframe]].frame_rx % 10 == 0) {
+          UE->bitrate[eNB_id] = (UE->total_TBS[eNB_id] - UE->total_TBS_last[eNB_id])*10;
+          LOG_D(PHY,"[UE %d] Calculating bitrate: total_TBS = %d, total_TBS_last = %d, bitrate = %d kbits/s\n",UE->Mod_id,UE->total_TBS[eNB_id],UE->total_TBS_last[eNB_id],
+                UE->bitrate[eNB_id]/1000);
+          UE->total_TBS_last[eNB_id] = UE->total_TBS[eNB_id];
         }
 
-        if (l==6)
-          for (l2=2; l2<7; l2++)
-            rx_pmch(UE,
-                    0,
-                    subframe%10,
-                    l2);
+        /* calculate the total processing time for each packet,
+         * get the max, min, and number of packets that exceed t>2000us
+         */
+        double t_tx = inMicroS(eNB->phy_proc_tx.p_time);
+        double t_tx_ifft = inMicroS(eNB->ofdm_mod_stats.p_time);
+        double t_rx = inMicroS(UE->phy_proc_rx[UE->current_thread_id[subframe]].p_time);
+        sumUpStats(&phy_proc_rx_tot, UE->phy_proc_rx, UE->current_thread_id[subframe]);
+        sumUpStats(&ue_front_end_tot, UE->ue_front_end_stat, UE->current_thread_id[subframe]);
+        sumUpStats(&pdsch_procedures_tot, UE->pdsch_procedures_stat, UE->current_thread_id[subframe]);
+        sumUpStats(&dlsch_procedures_tot, UE->dlsch_procedures_stat, UE->current_thread_id[subframe]);
+        sumUpStats(&dlsch_decoding_tot, UE->dlsch_decoding_stats, UE->current_thread_id[subframe]);
+        sumUpStatsSlot(&dlsch_llr_tot, UE->dlsch_llr_stats_parallelization, UE->current_thread_id[subframe]);
+        double t_rx_fft = inMicroS(UE->ofdm_demod_stats.p_time);
+        double t_rx_demod = inMicroS(UE->dlsch_rx_pdcch_stats.p_time);
+        double t_rx_dec = inMicroS(UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].p_time);
+
+        if (t_tx > 2000 )// 2ms is too much time for a subframe
+          n_tx_dropped++;
+
+        if (t_rx > 2000 )
+          n_rx_dropped++;
+
+        appendVarArray(table_tx, &t_tx);
+        appendVarArray(table_tx_ifft, &t_tx_ifft);
+        appendVarArray(table_rx, &t_rx );
+        appendVarArray(table_rx_fft, &t_rx_fft );
+        appendVarArray(table_rx_demod, &t_rx_demod );
+        appendVarArray(table_rx_dec, &t_rx_dec );
+      }   //trials
+
+      // round_trials[0]: number of code word : goodput the protocol
+      // sort table
+      qsort (dataArray(table_tx), table_tx->size, table_tx->atomSize, &cmpdouble);
+      qsort (dataArray(table_tx_ifft), table_tx_ifft->size, table_tx_ifft->atomSize, &cmpdouble);
+      qsort (dataArray(table_tx_mod), table_tx_mod->size, table_tx_mod->atomSize, &cmpdouble);
+      qsort (dataArray(table_tx_enc), table_tx_enc->size, table_tx_enc->atomSize, &cmpdouble);
+      qsort (dataArray(table_rx), table_rx->size, table_rx->atomSize, &cmpdouble);
+      qsort (dataArray(table_rx_fft), table_rx_fft->size, table_rx_fft->atomSize, &cmpdouble);
+      qsort (dataArray(table_rx_demod), table_rx_demod->size, table_rx_demod->atomSize, &cmpdouble);
+      qsort (dataArray(table_rx_dec), table_rx_dec->size, table_rx_dec->atomSize, &cmpdouble);
+
+      if (dump_table == 1 ) {
+        set_component_filelog(SIM);  // file located in /tmp/usim.txt
+        LOG_UDUMPMSG(SIM,table_tx,table_tx->size,LOG_DUMP_DOUBLE,"The transmitter raw data: \n");
+        LOG_UDUMPMSG(SIM,table_rx,table_rx->size,LOG_DUMP_DOUBLE,"Thereceiver raw data: \n");
+      }
 
-        if (l==6)
-          for (l2=2; l2<7; l2++)
-            rx_pmch(UE,
-                    0,
-                    subframe%10,
-                    l2);
+      effective_rate = 1.0-((double)(errs[0]+errs[1]+errs[2]+errs[3])/((double)round_trials[0] + round_trials[1] + round_trials[2] + round_trials[3]));
+      printf("\n**********************SNR = %f dB (tx_lev %f)**************************\n",
+             SNR,
+             (double)tx_lev_dB+10*log10(UE->frame_parms.ofdm_symbol_size/(NB_RB*12)));
+      printf("Errors (%u(%u)/%u %u/%u %u/%u %u/%u), Pe = (%e,%e,%e,%e), dci_errors %u/%u, Pe = %e => effective rate %f, normalized delay %f (%f)\n",
+             errs[0],
+             errs2[0],
+             round_trials[0],
+             errs[1],
+             round_trials[1],
+             errs[2],
+             round_trials[2],
+             errs[3],
+             round_trials[3],
+             (double)errs[0]/(round_trials[0]),
+             (double)errs[1]/(round_trials[1]),
+             (double)errs[2]/(round_trials[2]),
+             (double)errs[3]/(round_trials[3]),
+             dci_errors[0]+dci_errors[1]+dci_errors[2]+dci_errors[3],
+             round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3],
+             (double)(dci_errors[0]+dci_errors[1]+dci_errors[2]+dci_errors[3])/(round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3]),
+             //rate*effective_rate,
+             100*effective_rate,
+             //rate,
+             //rate*get_Qm(UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[UE->dlsch[UE->current_thread_id[subframe]][0][0]->current_harq_pid]->mcs),
+             (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0])/
+             (double)eNB->dlsch[0][0]->harq_processes[0]->TBS,
+             (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0]));
+      double timeBase=1/(1000*cpu_freq_GHz);
+
+      if (print_perf==1) {
+        printf("\neNB TX function statistics (per 1ms subframe)\n");
+        printDistribution(&eNB->phy_proc_tx,table_tx,"PHY proc tx");
+        printStatIndent(&eNB->dlsch_common_and_dci,"DL common channels and dci time");
+        printStatIndent(&eNB->dlsch_ue_specific,"DL per ue part time");
+        printStatIndent2(&eNB->dlsch_encoding_stats,"DLSCH encoding time");
+        printStatIndent3(&eNB->dlsch_rate_matching_stats,"DLSCH rate matching time");
+        printStatIndent3(&eNB->dlsch_turbo_encoding_stats,"DLSCH turbo encoding time");
+        printStatIndent3(&eNB->dlsch_interleaving_stats,"DLSCH interleaving time");
+        printStatIndent2(&eNB->dlsch_scrambling_stats,  "DLSCH scrambling time");
+        printStatIndent2(&eNB->dlsch_modulation_stats, "DLSCH modulation time");
+        printDistribution(&eNB->ofdm_mod_stats,table_tx_ifft,"OFDM_mod (idft) time");
+        printf("\nUE RX function statistics (per 1ms subframe)\n");
+        printDistribution(&phy_proc_rx_tot, table_rx,"Total PHY proc rx");
+        printStatIndent(&ue_front_end_tot,"Front end processing");
+        printStatIndent(&dlsch_llr_tot,"rx_pdsch processing");
+        printStatIndent2(&pdsch_procedures_tot,"pdsch processing");
+        printStatIndent2(&dlsch_procedures_tot,"dlsch processing");
+        printStatIndent2(&UE->crnti_procedures_stats,"C-RNTI processing");
+        printStatIndent(&UE->ofdm_demod_stats,"ofdm demodulation");
+        printStatIndent(&UE->dlsch_channel_estimation_stats,"DLSCH channel estimation time");
+        printStatIndent(&UE->dlsch_freq_offset_estimation_stats,"DLSCH frequency offset estimation time");
+        printStatIndent(&dlsch_decoding_tot, "DLSCH Decoding time ");
+        printStatIndent(&UE->dlsch_unscrambling_stats,"DLSCH unscrambling time");
+        printStatIndent(&UE->dlsch_rate_unmatching_stats,"DLSCH Rate Unmatching");
+        printf("|__ DLSCH Turbo Decoding(%d bits), avg iterations: %.1f       %.2f us (%d cycles, %d trials)\n",
+               UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Cminus ?
+               UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Kminus :
+               UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Kplus,
+               UE->dlsch_tc_intl1_stats.trials/(double)UE->dlsch_tc_init_stats.trials,
+               (double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials*timeBase,
+               (int)((double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials),
+               UE->dlsch_turbo_decoding_stats.trials);
+        printStatIndent2(&UE->dlsch_tc_init_stats,"init");
+        printStatIndent2(&UE->dlsch_tc_alpha_stats,"alpha");
+        printStatIndent2(&UE->dlsch_tc_beta_stats,"beta");
+        printStatIndent2(&UE->dlsch_tc_gamma_stats,"gamma");
+        printStatIndent2(&UE->dlsch_tc_ext_stats,"ext");
+        printStatIndent2(&UE->dlsch_tc_intl1_stats,"turbo internal interleaver");
+        printStatIndent2(&UE->dlsch_tc_intl2_stats,"intl2+HardDecode+CRC");
+      }
 
-        if (l==11)
-          for (l2=7; l2<12; l2++)
-            rx_pmch(UE,
-                    0,
-                    subframe%10,
-                    l2);
+      if ((transmission_mode != 3) && (transmission_mode != 4)) {
+        fprintf(bler_fd,"%f;%d;%d;%f;%u;%u;%u;%u;%u;%u;%u;%u;%u\n",
+                SNR,
+                mcs1,
+                eNB->dlsch[0][0]->harq_processes[0]->TBS,
+                rate,
+                errs[0],
+                round_trials[0],
+                errs[1],
+                round_trials[1],
+                errs[2],
+                round_trials[2],
+                errs[3],
+                round_trials[3],
+                dci_errors[0]);
+      } else {
+        fprintf(bler_fd,"%f;%d;%d;%d;%d;%f;%u;%u;%u;%u;%u;%u;%u;%u;%u\n",
+                SNR,
+                mcs1,mcs2,
+                eNB->dlsch[0][0]->harq_processes[0]->TBS,
+                eNB->dlsch[0][1]->harq_processes[0]->TBS,
+                rate,
+                errs[0],
+                round_trials[0],
+                errs[1],
+                round_trials[1],
+                errs[2],
+                round_trials[2],
+                errs[3],
+                round_trials[3],
+                dci_errors[0]);
       }
 
-      UE->dlsch_MCH[0]->harq_processes[0]->G = get_G(&UE->frame_parms,
-          UE->dlsch_MCH[0]->harq_processes[0]->nb_rb,
-          UE->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even,
-          get_Qm(UE->dlsch_MCH[0]->harq_processes[0]->mcs),
-          1,2,
-          UE->proc.proc_rxtx[0].frame_tx,subframe,0);
-      UE->dlsch_MCH[0]->harq_processes[0]->Qm = get_Qm(UE->dlsch_MCH[0]->harq_processes[0]->mcs);
-      dlsch_unscrambling(&UE->frame_parms,1,UE->dlsch_MCH[0],
-                         UE->dlsch_MCH[0]->harq_processes[0]->G,
-                         UE->pdsch_vars_MCH[0]->llr[0],0,subframe<<1);
-      ret = dlsch_decoding(UE,
-                           UE->pdsch_vars_MCH[0]->llr[0],
-                           &UE->frame_parms,
-                           UE->dlsch_MCH[0],
-                           UE->dlsch_MCH[0]->harq_processes[0],
-                           trials,
-                           subframe,
-                           0,0,0);
-
-      if (n_frames==1)
-        printf("MCH decoding returns %u\n",ret);
-
-      if (ret == (1+UE->dlsch_MCH[0]->max_turbo_iterations))
-        errs[0]++;
-
-      UE->proc.proc_rxtx[0].frame_tx++;
-      eNB->proc.proc_rxtx[0].frame_tx++;
-    }
+      if(abstx) { //ABSTRACTION
+        blerr[0] = (double)errs[0]/(round_trials[0]);
+
+        if(num_rounds>1) {
+          blerr[1] = (double)errs[1]/(round_trials[1]);
+          blerr[2] = (double)errs[2]/(round_trials[2]);
+          blerr[3] = (double)errs[3]/(round_trials[3]);
+          fprintf(csv_fd,"%e,%e,%e,%e;\n",blerr[0],blerr[1],blerr[2],blerr[3]);
+        } else {
+          fprintf(csv_fd,"%e;\n",blerr[0]);
+        }
+      } //ABStraction
+
+      if ( (test_perf != 0) && (100 * effective_rate > test_perf )) {
+        //fprintf(time_meas_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err\n");
+        if ((transmission_mode != 3) && (transmission_mode != 4)) {
+          fprintf(time_meas_fd,"%f;%d;%d;%f;%u;%u;%u;%u;%u;%u;%u;%u;%u;",
+                  SNR,
+                  mcs1,
+                  eNB->dlsch[0][0]->harq_processes[0]->TBS,
+                  rate,
+                  errs[0],
+                  round_trials[0],
+                  errs[1],
+                  round_trials[1],
+                  errs[2],
+                  round_trials[2],
+                  errs[3],
+                  round_trials[3],
+                  dci_errors[0]);
+          //fprintf(time_meas_fd,"SNR; MCS; TBS; rate; DL_DECOD_ITER; err0; trials0; err1; trials1; err2; trials2; err3; trials3; PE; dci_err;PE;ND;\n");
+          fprintf(time_meas_fd,"%f;%d;%d;%f; %2.1f%%;%f;%f;%u;%u;%u;%u;%u;%u;%u;%u;%e;%e;%e;%e;%u;%u;%e;%f;%f;",
+                  SNR,
+                  mcs1,
+                  eNB->dlsch[0][0]->harq_processes[0]->TBS,
+                  rate*effective_rate,
+                  100*effective_rate,
+                  rate,
+                  (double)avg_iter/iter_trials,
+                  errs[0],
+                  round_trials[0],
+                  errs[1],
+                  round_trials[1],
+                  errs[2],
+                  round_trials[2],
+                  errs[3],
+                  round_trials[3],
+                  (double)errs[0]/(round_trials[0]),
+                  (double)errs[1]/(round_trials[0]),
+                  (double)errs[2]/(round_trials[0]),
+                  (double)errs[3]/(round_trials[0]),
+                  dci_errors[0],
+                  round_trials[0],
+                  (double)dci_errors[0]/(round_trials[0]),
+                  (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0])/
+                  (double)eNB->dlsch[0][0]->harq_processes[0]->TBS,
+                  (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0]));
+        } else {
+          fprintf(time_meas_fd,"%f;%d;%d;%d;%d;%f;%u;%u;%u;%u;%u;%u;%u;%u;%u;",
+                  SNR,
+                  mcs1,mcs2,
+                  eNB->dlsch[0][0]->harq_processes[0]->TBS,
+                  eNB->dlsch[0][1]->harq_processes[0]->TBS,
+                  rate,
+                  errs[0],
+                  round_trials[0],
+                  errs[1],
+                  round_trials[1],
+                  errs[2],
+                  round_trials[2],
+                  errs[3],
+                  round_trials[3],
+                  dci_errors[0]);
+          //fprintf(time_meas_fd,"SNR; MCS; TBS; rate; DL_DECOD_ITER; err0; trials0; err1; trials1; err2; trials2; err3; trials3; PE; dci_err;PE;ND;\n");
+          fprintf(time_meas_fd,"%f;%d;%d;%d;%d;%f;%2.1f;%f;%f;%u;%u;%u;%u;%u;%u;%u;%u;%e;%e;%e;%e;%u;%u;%e;%f;%f;",
+                  SNR,
+                  mcs1,mcs2,
+                  eNB->dlsch[0][0]->harq_processes[0]->TBS,
+                  eNB->dlsch[0][1]->harq_processes[0]->TBS,
+                  rate*effective_rate,
+                  100*effective_rate,
+                  rate,
+                  (double)avg_iter/iter_trials,
+                  errs[0],
+                  round_trials[0],
+                  errs[1],
+                  round_trials[1],
+                  errs[2],
+                  round_trials[2],
+                  errs[3],
+                  round_trials[3],
+                  (double)errs[0]/(round_trials[0]),
+                  (double)errs[1]/(round_trials[0]),
+                  (double)errs[2]/(round_trials[0]),
+                  (double)errs[3]/(round_trials[0]),
+                  dci_errors[0],
+                  round_trials[0],
+                  (double)dci_errors[0]/(round_trials[0]),
+                  (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0])/
+                  (double)eNB->dlsch[0][0]->harq_processes[0]->TBS,
+                  (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0]));
+        }
 
-    printf("errors %u/%u (Pe %e)\n",errs[round],trials,(double)errs[round]/trials);
+        //fprintf(time_meas_fd,"eNB_PROC_TX(%d); OFDM_MOD(%d); DL_MOD(%d); DL_SCR(%d); DL_ENC(%d); UE_PROC_RX(%d); OFDM_DEMOD_CH_EST(%d); RX_PDCCH(%d); CH_COMP_LLR(%d); DL_USCR(%d); DL_DECOD(%d);\n",
+        fprintf(time_meas_fd,"%d; %d; %d; %d; %d; %d; %d; %d; %d; %d; %d;",
+                eNB->phy_proc_tx.trials,
+                eNB->ofdm_mod_stats.trials,
+                eNB->dlsch_modulation_stats.trials,
+                eNB->dlsch_scrambling_stats.trials,
+                eNB->dlsch_encoding_stats.trials,
+                phy_proc_rx_tot.trials,
+                UE->ofdm_demod_stats.trials,
+                UE->dlsch_rx_pdcch_stats.trials,
+                UE->dlsch_llr_stats.trials,
+                UE->dlsch_unscrambling_stats.trials,
+                UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].trials
+               );
+        fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;",
+                get_time_meas_us(&eNB->phy_proc_tx),
+                get_time_meas_us(&eNB->ofdm_mod_stats),
+                get_time_meas_us(&eNB->dlsch_modulation_stats),
+                get_time_meas_us(&eNB->dlsch_scrambling_stats),
+                get_time_meas_us(&eNB->dlsch_encoding_stats),
+                get_time_meas_us(&phy_proc_rx_tot),
+                nsymb*get_time_meas_us(&UE->ofdm_demod_stats),
+                get_time_meas_us(&UE->dlsch_rx_pdcch_stats),
+                3*get_time_meas_us(&UE->dlsch_llr_stats),
+                get_time_meas_us(&UE->dlsch_unscrambling_stats),
+                get_time_meas_us(&UE->dlsch_decoding_stats[UE->current_thread_id[subframe]])
+               );
+        //fprintf(time_meas_fd,"eNB_PROC_TX_STD;eNB_PROC_TX_MAX;eNB_PROC_TX_MIN;eNB_PROC_TX_MED;eNB_PROC_TX_Q1;eNB_PROC_TX_Q3;eNB_PROC_TX_DROPPED;\n");
+        fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%d;",squareRoot(&UE->phy_proc_tx), t_tx_max, t_tx_min, median(table_tx), q1(table_tx), q3(table_tx), n_tx_dropped);
+        //fprintf(time_meas_fd,"IFFT;\n");
+        fprintf(time_meas_fd,"%f;%f;%f;%f;",
+                squareRoot(&eNB->ofdm_mod_stats),
+                median(table_tx_ifft),q1(table_tx_ifft),q3(table_tx_ifft));
+        //fprintf(time_meas_fd,"MOD;\n");
+        fprintf(time_meas_fd,"%f;%f;%f;%f;",
+                squareRoot(&eNB->dlsch_modulation_stats),
+                median(table_tx_mod), q1(table_tx_mod), q3(table_tx_mod));
+        //fprintf(time_meas_fd,"ENC;\n");
+        fprintf(time_meas_fd,"%f;%f;%f;%f;",
+                squareRoot(&eNB->dlsch_encoding_stats),
+                median(table_tx_enc),q1(table_tx_enc),q3(table_tx_enc));
+        //fprintf(time_meas_fd,"eNB_PROC_RX_STD;eNB_PROC_RX_MAX;eNB_PROC_RX_MIN;eNB_PROC_RX_MED;eNB_PROC_RX_Q1;eNB_PROC_RX_Q3;eNB_PROC_RX_DROPPED;\n");
+        fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%d;",
+                squareRoot(&phy_proc_rx_tot), t_rx_max, t_rx_min,
+                median(table_rx), q1(table_rx), q3(table_rx), n_rx_dropped);
+        //fprintf(time_meas_fd,"FFT;\n");
+        fprintf(time_meas_fd,"%f;%f;%f;%f;",
+                squareRoot(&UE->ofdm_demod_stats),
+                median(table_rx_fft), q1(table_rx_fft), q3(table_rx_fft));
+        //fprintf(time_meas_fd,"DEMOD;\n");
+        fprintf(time_meas_fd,"%f;%f;%f;%f;",
+                squareRoot(&UE->dlsch_demodulation_stats),
+                median(table_rx_demod), q1(table_rx_demod), q3(table_rx_demod));
+        //fprintf(time_meas_fd,"DEC;\n");
+        fprintf(time_meas_fd,"%f;%f;%f;%f\n",
+                squareRoot(&UE->dlsch_decoding_stats[subframe]),
+                median(table_rx_dec), q1(table_rx_dec), q3(table_rx_dec));
+        printf("[passed] effective rate : %f  (%2.1f%%,%f)): log and break \n",rate*effective_rate, 100*effective_rate, rate );
+        test_passed = 1;
+        break;
+      } else if (test_perf !=0 ) {
+        printf("[continue] effective rate : %f  (%2.1f%%,%f)): increase snr \n",rate*effective_rate, 100*effective_rate, rate);
+        test_passed = 0;
+      }
 
-    if (awgn_flag==0)
-      fprintf(fd,"SNR_%d_%d = [SNR_%d_%d %f]; errs_mch_%d_%d =[errs_mch_%d_%d  %u]; mch_trials_%d_%d =[mch_trials_%d_%d  %u];\n",
-              mcs,N_RB_DL,mcs,N_RB_DL,SNR,
-              mcs,N_RB_DL,mcs,N_RB_DL,errs[0],
-              mcs,N_RB_DL,mcs,N_RB_DL,trials);
-    else
-      fprintf(fd,"SNR_awgn_%d = [SNR_awgn_%d %f]; errs_mch_awgn_%d =[errs_mch_awgn_%d  %u]; mch_trials_awgn_%d =[mch_trials_awgn_%d %u];\n",
-              N_RB_DL,N_RB_DL,SNR,
-              N_RB_DL,N_RB_DL,errs[0],
-              N_RB_DL,N_RB_DL,trials);
+      if (((double)errs[0]/(round_trials[0]))<(10.0/n_frames))
+        break;
+    }// SNR
+  } //ch_realization
 
-    fflush(fd);
+  fclose(bler_fd);
 
-    if (errs[0] == 0)
-      break;
-  }
+  if (test_perf !=0)
+    fclose (time_meas_fd);
 
-  if (n_frames==1) {
-    printf("Dumping PMCH files ( G %d)\n",UE->dlsch_MCH[0]->harq_processes[0]->G);
-    dump_mch(UE,0,
-             UE->dlsch_MCH[0]->harq_processes[0]->G,
-             subframe);
+  //fprintf(tikz_fd,"};\n");
+  //fclose(tikz_fd);
+
+  if (input_trch_file==1)
+    fclose(input_trch_fd);
+
+  if (input_file==1)
+    fclose(input_fd);
+
+  if(abstx) { // ABSTRACTION
+    fprintf(csv_fd,"];");
+    fclose(csv_fd);
   }
 
+  if (uncoded_ber_bit)
+    free(uncoded_ber_bit);
+
+  uncoded_ber_bit = NULL;
   printf("Freeing dlsch structures\n");
-  free_eNB_dlsch(eNB->dlsch_MCH);
-  free_ue_dlsch(UE->dlsch_MCH[0]);
-  fclose(fd);
-  return(0);
-}
 
+  for (i=0; i<2; i++) {
+    printf("eNB %d\n",i);
+    free_eNB_dlsch(eNB->dlsch[0][i]);
+    printf("UE %d\n",i);
+    free_ue_dlsch(UE->dlsch[UE->current_thread_id[subframe]][0][i]);
+  }
+
+  if (test_perf && !test_passed)
+    return(-1);
+  else
+    return(0);
+}
+/* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */
+uint64_t get_softmodem_optmask(void) {
+  return 0;
+}
diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c
index 9374050e58f99fd2af2e063d333592a072414166..5e2d42a0f72ad569d56dbbeb841b1ac4e214995c 100644
--- a/openair1/SIMULATION/NR_PHY/dlschsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlschsim.c
@@ -37,7 +37,6 @@
 #include "PHY/INIT/phy_init.h"
 #include "PHY/MODULATION/modulation_eNB.h"
 #include "PHY/MODULATION/modulation_UE.h"
-#include "PHY/NR_REFSIG/nr_mod_table.h"
 #include "PHY/NR_REFSIG/refsig_defs_ue.h"
 #include "PHY/NR_TRANSPORT/nr_dlsch.h"
 #include "PHY/NR_TRANSPORT/nr_transport_proto.h"
@@ -478,8 +477,9 @@ int main(int argc, char **argv)
 	harq_process->Qm = mod_order;
 	harq_process->rvidx = rvidx;
 	harq_process->R = rate;
-        harq_process->dmrsConfigType = 1;
+	harq_process->dmrsConfigType = NFAPI_NR_DMRS_TYPE1;
 	harq_process->dlDmrsSymbPos = 4;
+	harq_process->n_dmrs_cdm_groups = 1;
 	printf("harq process ue mcs = %d Qm = %d, symb %d\n", harq_process->mcs, harq_process->Qm, nb_symb_sch);
 	unsigned char *test_input;
 	test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8);
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index 137c358d7f610aed1239022b179eb8acf402cf99..64ab482db894faef45b7637b5ae70e0277a970de 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -39,7 +39,6 @@
 #include "PHY/INIT/phy_init.h"
 #include "PHY/MODULATION/modulation_eNB.h"
 #include "PHY/MODULATION/modulation_UE.h"
-#include "PHY/NR_REFSIG/nr_mod_table.h"
 #include "PHY/NR_REFSIG/refsig_defs_ue.h"
 #include "PHY/NR_TRANSPORT/nr_transport_proto.h"
 #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
@@ -927,22 +926,6 @@ int main(int argc, char **argv)
     printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],(double)errors_scrambling/available_bits/n_trials,effRate,effRate/TBS*100,TBS);
     printf("\n");
 
-    if (n_trials == 1) {
-      
-      LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1);
-      if (UE->frame_parms.nb_antennas_rx>1)
-	LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1);
-      LOG_M("chestF0.m","chF0",UE->pdsch_vars[0][0]->dl_ch_estimates_ext,N_RB_DL*12*14,1,1);
-      write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1);
-      break;
-    }
-
-    //if ((float)n_errors/(float)n_trials <= target_error_rate) {
-    if (effRate >= (eff_tp_check*TBS)) {
-      printf("PDSCH test OK\n");
-      break;
-    }
-
     if (print_perf==1) {
       printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))\n",
 	     1000>>*scc->ssbSubcarrierSpacing,dlsch_config.rbSize,dlsch_config.mcsIndex[0],
@@ -993,6 +976,23 @@ int main(int argc, char **argv)
       printStatIndent2(&UE->dlsch_tc_intl2_stats,"intl2+HardDecode+CRC");
       */
     }
+
+    if (n_trials == 1) {
+      
+      LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1);
+      if (UE->frame_parms.nb_antennas_rx>1)
+	LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1);
+      LOG_M("chestF0.m","chF0",UE->pdsch_vars[0][0]->dl_ch_estimates_ext,N_RB_DL*12*14,1,1);
+      write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1);
+      break;
+    }
+
+    //if ((float)n_errors/(float)n_trials <= target_error_rate) {
+    if (effRate >= (eff_tp_check*TBS)) {
+      printf("PDSCH test OK\n");
+      break;
+    }
+
     snrRun++;
   } // NSR
 
diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c
index 2144652f8612ae3d5c34bcd578842ec8f93ba825..8c37024858408eac29cc897d662f3af267d5b436 100644
--- a/openair1/SIMULATION/NR_PHY/pbchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pbchsim.c
@@ -33,7 +33,6 @@
 #include "PHY/defs_nr_UE.h"
 #include "PHY/defs_gNB.h"
 #include "PHY/NR_REFSIG/refsig_defs_ue.h"
-#include "PHY/NR_REFSIG/nr_mod_table.h"
 #include "PHY/MODULATION/modulation_eNB.h"
 #include "PHY/MODULATION/modulation_UE.h"
 #include "PHY/INIT/phy_init.h"
diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c
index 2db5bc905c4b233406e21674bf40278ecacf16d9..950f9a67f665a0c548e56650af71889dea70dfd0 100644
--- a/openair1/SIMULATION/NR_PHY/prachsim.c
+++ b/openair1/SIMULATION/NR_PHY/prachsim.c
@@ -37,7 +37,6 @@
 #include "SCHED_NR_UE/phy_frame_config_nr.h"
 #include "PHY/phy_vars_nr_ue.h"
 #include "PHY/NR_REFSIG/refsig_defs_ue.h"
-#include "PHY/NR_REFSIG/nr_mod_table.h"
 #include "PHY/MODULATION/modulation_eNB.h"
 #include "PHY/MODULATION/modulation_UE.h"
 #include "PHY/INIT/phy_init.h"
diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c
index 004a7b8de8ae2868346b82576b6d34036ffb76ed..86f7d651e40129023245d2ca82e2719caca32a7a 100644
--- a/openair1/SIMULATION/NR_PHY/pucchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pucchsim.c
@@ -33,7 +33,6 @@
 #include "PHY/defs_nr_UE.h"
 #include "PHY/defs_gNB.h"
 #include "PHY/NR_REFSIG/refsig_defs_ue.h"
-#include "PHY/NR_REFSIG/nr_mod_table.h"
 #include "PHY/MODULATION/modulation_eNB.h"
 #include "PHY/MODULATION/modulation_UE.h"
 #include "PHY/INIT/phy_init.h"
diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c
index b0557ef1b417beeee6ef41f21489d11ebeb417d0..af49aa757b94f88d2082def48678bae547ac62a8 100644
--- a/openair1/SIMULATION/NR_PHY/ulschsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulschsim.c
@@ -34,7 +34,6 @@
 #include "PHY/defs_gNB.h"
 #include "PHY/INIT/phy_init.h"
 #include "PHY/NR_REFSIG/refsig_defs_ue.h"
-#include "PHY/NR_REFSIG/nr_mod_table.h"
 #include "PHY/MODULATION/modulation_eNB.h"
 #include "PHY/MODULATION/modulation_UE.h"
 #include "PHY/NR_TRANSPORT/nr_transport_proto.h"
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index 1016150171e4ca8b149d3748f9cc301c7a1deb9b..d161984f5d540d3b4cb389345ae27d36e14e29ad 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -37,7 +37,6 @@
 #include "PHY/MODULATION/modulation_UE.h"
 #include "PHY/MODULATION/nr_modulation.h"
 #include "PHY/NR_REFSIG/dmrs_nr.h"
-#include "PHY/NR_REFSIG/nr_mod_table.h"
 #include "PHY/NR_REFSIG/refsig_defs_ue.h"
 #include "PHY/NR_TRANSPORT/nr_dlsch.h"
 #include "PHY/NR_TRANSPORT/nr_sch_dmrs.h"
@@ -736,7 +735,8 @@ int main(int argc, char **argv)
       scheduled_response.slot = slot;
       scheduled_response.dl_config = NULL;
       scheduled_response.ul_config = &ul_config;
-      scheduled_response.dl_config = NULL;
+      scheduled_response.tx_request = (fapi_nr_tx_request_t *) malloc(sizeof(fapi_nr_tx_request_t));
+      scheduled_response.tx_request->tx_request_body = (fapi_nr_tx_request_body_t *) malloc(sizeof(fapi_nr_tx_request_body_t));
 
       ul_config.slot = slot;
       ul_config.number_pdus = 1;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c
index a93f0d48f3bd0e16c2258eebbfe5e8c136fe7918..cc8c62a36d96511290b28cb15e356b418209b86d 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c
@@ -115,6 +115,11 @@ int ue_query_mch(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
 		 sub_frame_t subframe, uint8_t eNB_index,
 		 uint8_t * sync_area, uint8_t * mcch_active){ return(0);}
 
+
+int ue_query_mch_fembms(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
+		 sub_frame_t subframe, uint8_t eNB_index,
+		 uint8_t * sync_area, uint8_t * mcch_active){ return(0);}
+
 void dl_phy_sync_success(module_id_t module_idP,
 			 frame_t frameP,
 			 unsigned char eNB_index, uint8_t first_sync){}
diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c
index 41d8551e75726427f356cc0a78226723ad8bd1ff..f97b9dfb78a1d7bdebd35c8324d1ecac635b3936 100644
--- a/openair1/SIMULATION/TOOLS/random_channel.c
+++ b/openair1/SIMULATION/TOOLS/random_channel.c
@@ -45,8 +45,12 @@ static mapping channelmod_names[] = {
 };
 
 static int channelmod_show_cmd(char *buff, int debug, telnet_printfunc_t prnt);
+static int channelmod_modify_cmd(char *buff, int debug, telnet_printfunc_t prnt);
+static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt);
 static telnetshell_cmddef_t channelmod_cmdarray[] = {
-  {"show","",channelmod_show_cmd},
+  {"help","",channelmod_print_help},
+  {"show","<predef,current>",channelmod_show_cmd},
+  {"modify","<channelid> <param> <value>",channelmod_modify_cmd},  
   {"","",NULL},
 };
 
@@ -56,14 +60,15 @@ static telnetshell_vardef_t channelmod_vardef[] = {
 
 static double snr_dB=25;
 static double sinr_dB=0;
-
+static unsigned int max_chan;
+static channel_desc_t**  defined_channels;
 void fill_channel_desc(channel_desc_t *chan_desc,
                        uint8_t nb_tx,
                        uint8_t nb_rx,
                        uint8_t nb_taps,
                        uint8_t channel_length,
                        double *amps,
-                       double *delays,
+                       double *delays,                         
                        struct complex **R_sqrt,
                        double Td,
                        double sampling_rate,
@@ -88,6 +93,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
 
   if (delays==NULL) {
     chan_desc->delays = (double *) malloc(nb_taps*sizeof(double));
+    chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_DELAY ;
     delta_tau = Td/nb_taps;
 
     for (i=0; i<nb_taps; i++)
@@ -129,10 +135,9 @@ void fill_channel_desc(channel_desc_t *chan_desc,
 
   if (R_sqrt == NULL) {
     chan_desc->R_sqrt         = (struct complex **) calloc(nb_taps,sizeof(struct complex *));
-
+    chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_NTAPS ;
     for (i = 0; i<nb_taps; i++) {
-      chan_desc->R_sqrt[i]    = (struct complex *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));
-
+      chan_desc->R_sqrt[i]    = (struct complex *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));      
       for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
         chan_desc->R_sqrt[i][j].x = 1.0;
         chan_desc->R_sqrt[i][j].y = 0.0;
@@ -140,7 +145,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
     }
   } else {
     chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *));
-
+     
     for (i = 0; i<nb_taps; i++) {
       //chan_desc->R_sqrt[i]    = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));
       //chan_desc->R_sqrt = (struct complex*)&R_sqrt[i][0];
@@ -170,7 +175,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
 double mbsfn_delays[] = {0,.03,.15,.31,.37,1.09,12.490,12.52,12.64,12.80,12.86,13.58,27.49,27.52,27.64,27.80,27.86,28.58};
 double mbsfn_amps_dB[] = {0,-1.5,-1.4,-3.6,-0.6,-7.0,-10,-11.5,-11.4,-13.6,-10.6,-17.0,-20,-21.5,-21.4,-23.6,-20.6,-27};
 
-double scm_c_delays[] = {0, 0.0125, 0.0250, 0.3625, 0.3750, 0.3875, 0.2500, 0.2625, 0.2750, 1.0375, 1.0500, 1.0625, 2.7250, 2.7375, 2.7500, 4.6000, 4.6125, 4.6250};
+double scm_c_delays[] = {0, 0.0125, 0.0250, 0.3625, 0.3750, 0.3875, 0.2500, 0.2625, 0.2750, 1.0375, 1.0500, 1.0625, 2.7250, 2.7375, 2.7500, 4.6000, 4.6125, 4.6250};                
 double scm_c_amps_dB[] = {0.00, -2.22, -3.98, -1.86, -4.08, -5.84, -1.08, -3.30, -5.06, -9.08, -11.30, -13.06, -15.14, -17.36, -19.12, -20.64, -22.85, -24.62};
 
 double epa_delays[] = { 0,.03,.07,.09,.11,.19,.41};
@@ -277,14 +282,26 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
                                      SCM_t channel_model,
                                      double sampling_rate,
                                      double channel_bandwidth,
-                                     double forgetting_factor,
+                                     double forgetting_factor,              
                                      int32_t channel_offset,
                                      double path_loss_dB) {
-  channel_desc_t *chan_desc = (channel_desc_t *)malloc(sizeof(channel_desc_t));
+  channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t));
+  for(int i=0; i<max_chan;i++) {
+  	  if (defined_channels[i] == NULL) {
+  	  	  defined_channels[i]=chan_desc;                             
+  	  	  chan_desc->chan_idx=i;
+  	      break;
+  	  }
+  	  else {
+  	  	 AssertFatal(i<(max_chan-1),
+              "No more channel descriptors available, increase channelmod.max_chan parameter above %u\n",max_chan);
+  	  }
+  }
   uint16_t i,j;
   double sum_amps;
   double aoa,ricean_factor,Td,maxDoppler;
   int channel_length,nb_taps;
+  chan_desc->modelid                   = channel_model;
   chan_desc->nb_tx                      = nb_tx;
   chan_desc->nb_rx                      = nb_rx;
   chan_desc->sampling_rate              = sampling_rate;
@@ -313,7 +330,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
       chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
       sum_amps = 0;
       chan_desc->amps           = (double *) malloc(chan_desc->nb_taps*sizeof(double));
-
+      chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ;         
       for (i = 0; i<chan_desc->nb_taps; i++) {
         chan_desc->amps[i]      = pow(10,.1*scm_c_amps_dB[i]);
         sum_amps += chan_desc->amps[i];
@@ -351,9 +368,10 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
         for (i = 0; i<6; i++)
           chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0];
       } else {
+      	chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; 
         for (i = 0; i<6; i++) {
           chan_desc->R_sqrt[i]    = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
-
+           
           for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
             chan_desc->R_sqrt[i][j].x = 1.0;
             chan_desc->R_sqrt[i][j].y = 0.0;
@@ -372,7 +390,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
       chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
       sum_amps = 0;
       chan_desc->amps           = (double *) malloc(chan_desc->nb_taps*sizeof(double));
-
+      chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ;
       for (i = 0; i<chan_desc->nb_taps; i++) {
         chan_desc->amps[i]      = pow(10,.1*scm_c_amps_dB[i]);
         sum_amps += chan_desc->amps[i];
@@ -410,6 +428,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
         for (i = 0; i<6; i++)
           chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0];
       } else {
+      	chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
         for (i = 0; i<6; i++) {
           chan_desc->R_sqrt[i]    = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
 
@@ -423,14 +442,14 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
       }
 
       break;
-
+                               
     case EPA:
       chan_desc->nb_taps        = 7;
       chan_desc->Td             = .410;
       chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
       sum_amps = 0;
       chan_desc->amps           = (double *) malloc(chan_desc->nb_taps*sizeof(double));
-
+      chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ;
       for (i = 0; i<chan_desc->nb_taps; i++) {
         chan_desc->amps[i]      = pow(10,.1*epa_amps_dB[i]);
         sum_amps += chan_desc->amps[i];
@@ -449,7 +468,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
 
       for (i = 0; i<nb_tx*nb_rx; i++)
         chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
-
+                                                                                          
       for (i = 0; i<nb_tx*nb_rx; i++)
         chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
 
@@ -463,7 +482,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
           chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
       } else {
         chan_desc->R_sqrt         = (struct complex **) malloc(6*sizeof(struct complex **));
-
+        chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
         for (i = 0; i<6; i++) {
           chan_desc->R_sqrt[i]    = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
 
@@ -484,7 +503,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
       chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
       sum_amps = 0;
       chan_desc->amps           = (double *) malloc(chan_desc->nb_taps*sizeof(double));
-
+      chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ;
       for (i = 0; i<chan_desc->nb_taps; i++) {
         chan_desc->amps[i]      = pow(10,.1*epa_amps_dB[i]);
         sum_amps += chan_desc->amps[i];
@@ -530,7 +549,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
           LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
         }
       }*/
-      break;
+      break;             
 
     case EPA_high:
       chan_desc->nb_taps        = 7;
@@ -538,7 +557,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
       chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
       sum_amps = 0;
       chan_desc->amps           = (double *) malloc(chan_desc->nb_taps*sizeof(double));
-
+      chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ;
       for (i = 0; i<chan_desc->nb_taps; i++) {
         chan_desc->amps[i]      = pow(10,.1*epa_amps_dB[i]);
         sum_amps += chan_desc->amps[i];
@@ -592,7 +611,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
       chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
       sum_amps = 0;
       chan_desc->amps           = (double *) malloc(chan_desc->nb_taps*sizeof(double));
-
+       chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ;
       for (i = 0; i<chan_desc->nb_taps; i++) {
         chan_desc->amps[i]      = pow(10,.1*epa_amps_dB[i]);
         sum_amps += chan_desc->amps[i];
@@ -646,7 +665,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
       chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
       sum_amps = 0;
       chan_desc->amps           = (double *) malloc(chan_desc->nb_taps*sizeof(double));
-
+      chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ;
       for (i = 0; i<chan_desc->nb_taps; i++) {
         chan_desc->amps[i]      = pow(10,.1*eva_amps_dB[i]);
         sum_amps += chan_desc->amps[i];
@@ -679,8 +698,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
           chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
       } else {
         chan_desc->R_sqrt         = (struct complex **) malloc(6*sizeof(struct complex **));
-
-        for (i = 0; i<6; i++) {
+        chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
+        for (i = 0; i<6; i++) { 
           chan_desc->R_sqrt[i]    = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
 
           for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
@@ -700,7 +719,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
       chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
       sum_amps = 0;
       chan_desc->amps           = (double *) malloc(chan_desc->nb_taps*sizeof(double));
-
+      chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ;
       for (i = 0; i<chan_desc->nb_taps; i++) {
         chan_desc->amps[i]      = pow(10,.1*etu_amps_dB[i]);
         sum_amps += chan_desc->amps[i];
@@ -733,7 +752,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
           chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
       } else {
         chan_desc->R_sqrt         = (struct complex **) malloc(6*sizeof(struct complex **));
-
+        chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
         for (i = 0; i<6; i++) {
           chan_desc->R_sqrt[i]    = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
 
@@ -754,7 +773,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
       chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
       sum_amps = 0;
       chan_desc->amps           = (double *) malloc(chan_desc->nb_taps*sizeof(double));
-
+      chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ;
       for (i = 0; i<chan_desc->nb_taps; i++) {
         chan_desc->amps[i]      = pow(10,.1*mbsfn_amps_dB[i]);
         sum_amps += chan_desc->amps[i];
@@ -781,7 +800,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
         chan_desc->a[i]         = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
 
       chan_desc->R_sqrt  = (struct complex **) malloc(6*sizeof(struct complex *));
-
+      chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6;
       for (i = 0; i<6; i++) {
         chan_desc->R_sqrt[i]    = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
 
@@ -1292,10 +1311,37 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
   chan_desc->nb_paths = 10;
   return(chan_desc);
 }
-
+     
 void free_channel_desc_scm(channel_desc_t *ch) {
   // Must be made cleanly, a lot of leaks...
-  free(ch);
+  defined_channels[ch->chan_idx]=NULL; 
+  if(ch->free_flags&CHANMODEL_FREE_AMPS)
+    free(ch->amps);
+  for (int i = 0; i<ch->nb_tx*ch->nb_rx; i++) { 
+    free(ch->ch[i]);
+    free(ch->chF[i]);
+  }
+            
+  for (int i = 0; i<ch->nb_taps; i++) {
+    free(ch->a[i]);              
+  }   
+  if(ch->free_flags&CHANMODEL_FREE_DELAY)
+    free(ch->delays);  
+  if(ch->free_flags&CHANMODEL_FREE_RSQRT_6)
+    for (int i = 0; i<6; i++)  
+      free(ch->R_sqrt[i]);             
+  if(ch->free_flags&CHANMODEL_FREE_RSQRT_NTAPS)
+    for (int i = 0; i<ch->nb_taps;i++)  
+      free(ch->R_sqrt[i]); 
+  free(ch->R_sqrt);        
+  free(ch->ch); 
+  free(ch->chF);
+  free(ch->a);  
+  free(ch);                                          
+}
+
+void set_channeldesc_owner(channel_desc_t *cdesc, uint32_t module_id) {
+	cdesc->module_id=module_id;
 }
 
 int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
@@ -1408,11 +1454,11 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
             desc->ch[aarx+(aatx*desc->nb_rx)][k].y = 0.0;
 
             for (l=0; l<desc->nb_taps; l++) {
-              if ((k - (desc->delays[l]*desc->sampling_rate) - NB_SAMPLES_CHANNEL_OFFSET) == 0)
+              if ((k - (desc->delays[l]*desc->sampling_rate) - desc->channel_offset) == 0)
                 s = 1.0;
               else
-                s = sin(M_PI*(k - (desc->delays[l]*desc->sampling_rate) - NB_SAMPLES_CHANNEL_OFFSET))/
-                    (M_PI*(k - (desc->delays[l]*desc->sampling_rate) - NB_SAMPLES_CHANNEL_OFFSET));
+                s = sin(M_PI*(k - (desc->delays[l]*desc->sampling_rate) - desc->channel_offset))/
+                    (M_PI*(k - (desc->delays[l]*desc->sampling_rate) - desc->channel_offset));
 
               desc->ch[aarx+(aatx*desc->nb_rx)][k].x += s*desc->a[l][aarx+(aatx*desc->nb_rx)].x;
               desc->ch[aarx+(aatx*desc->nb_rx)][k].y += s*desc->a[l][aarx+(aatx*desc->nb_rx)].y;
@@ -1436,7 +1482,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
 
   return (0);
 }
-
+   
 double N_RB2sampling_rate(uint16_t N_RB) {
   double sampling_rate;
 
@@ -1488,22 +1534,125 @@ double N_RB2channel_bandwidth(uint16_t N_RB) {
       LOG_E(PHY,"Unknown N_PRB\n");
       return(-1);
   }
-
   return(channel_bandwidth);
+}   
+
+     
+static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt ) {
+	prnt("channelmod commands can be used to display or modify channel models parameters\n");
+	prnt("channelmod show predef: display predefined model algorithms available in oai\n");
+	prnt("channelmod show current: display the currently used models in the running executable\n");
+	prnt("channelmod modify <model index> <param name> <param value>: set the specified parameters in a current model to the given value\n");
+	prnt("                  <model index> specifies the model, the show current model command can be used to list the current models indexes\n");
+	prnt("                  <param name> can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"offset\", \"forgetf\"\n");
+    return CMDSTATUS_FOUND;
 }
 
+
+static void display_channelmodel(channel_desc_t *cd,int debug, telnet_printfunc_t prnt) {
+	char *module_id_str[]=MODULEID_STR_INIT;
+	if (cd->module_id != 0) {
+		prnt("model owner: %s\n",module_id_str[cd->module_id]);
+	}
+	prnt("nb_tx: %i    nb_rx: %i    taps: %i bandwidth: %lf    sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate);
+	prnt("channel length: %i    Max path delay: %lf   ricean fact.: %lf    angle of arrival: %lf (randomized:%s)\n",
+		 cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No"));
+	prnt("max Doppler: %lf    path loss: %lf   rchannel offset: %i    forget factor; %lf\n",
+		 cd->max_Doppler, cd->path_loss_dB, cd->channel_offset, cd->forgetting_factor);	
+	prnt("Initial phase: %lf   nb_path: %i \n",
+		 cd->ip, cd->nb_paths);		
+	for (int i=0; i<cd->nb_taps ; i++) {
+		prnt("taps: %i   lin. ampli. : %lf    delay: %lf \n",i,cd->amps[i], cd->delays[i]);
+	}                         
+}
+   
+  
 static int channelmod_show_cmd(char *buff, int debug, telnet_printfunc_t prnt) {
-  for(int i=0; channelmod_names[i].name != NULL ; i++) {
-    prnt("  %i %s\n", i, map_int_to_str(channelmod_names,i ));
+  char *subcmd=NULL; 
+  int s = sscanf(buff,"%ms\n",&subcmd);
+
+  if (s>0) {
+    if ( strcmp(subcmd,"predef") == 0) {
+      for (int i=0; channelmod_names[i].name != NULL ; i++) {
+        prnt("  %i %s\n", i, map_int_to_str(channelmod_names,i ));
+    } 
+    } else if ( strcmp(subcmd,"current") == 0) {
+      for (int i=0; i < max_chan ; i++) {
+      	if (defined_channels[i] != NULL) {
+      	  prnt("model %i %s: \n----------------\n", i, map_int_to_str(channelmod_names,defined_channels[i]->modelid));
+          display_channelmodel(defined_channels[i],debug,prnt); 
+        }
+      }
+    } else {
+    	channelmod_print_help(buff, debug, prnt);
+    }
+  free(subcmd);
   }
-
-  return 0;
+  return CMDSTATUS_FOUND;
 }
 
-int modelid_fromname(char *modelname) {
-  int modelid=map_str_to_int(channelmod_names,modelname);
-  AssertFatal(modelid>0,
-              "random_channel.c: Error channel model %s unknown\n",modelname);
+      
+
+static int channelmod_modify_cmd(char *buff, int debug, telnet_printfunc_t prnt) {
+  char *param=NULL, *value=NULL; 
+  int cd_id= -1;
+  int s = sscanf(buff,"%i %ms %ms \n",&cd_id,&param, &value);
+  if (cd_id<0 || cd_id >= max_chan) {
+  	  prnt("ERROR, %i: Channel model id outof range (0-%i)\n",cd_id,max_chan-1);
+  	  return CMDSTATUS_FOUND;
+  }
+  if (defined_channels[cd_id]==NULL) {
+  	  prnt("ERROR, %i: Channel model has not been set\n",cd_id);
+  	  return CMDSTATUS_FOUND;
+  }  
+  
+  if (s==3) {
+    if ( strcmp(param,"riceanf") == 0) {
+        double dbl = atof(value);
+        if (dbl <0 || dbl > 1)
+        	prnt("ERROR: ricean factor range: 0 to 1, %lf is outof range\n",dbl);
+        else
+        	defined_channels[cd_id]->ricean_factor=dbl;
+    } else if ( strcmp(param,"aoa") == 0) {
+        double dbl = atof(value);
+        if (dbl <0 || dbl >6.28)
+        	prnt("ERROR: angle of arrival range: 0 to 2*Pi,  %lf is outof range\n",dbl);
+        else
+        	defined_channels[cd_id]->aoa=dbl;    
+    } else if ( strcmp(param,"randaoa") == 0) {
+        int i = atoi(value);
+        if (i!=0 && i!=1)
+        	prnt("ERROR: randaoa is a boolean, must be 0 or 1\n");
+        else
+        	defined_channels[cd_id]->random_aoa=i;
+    } else if ( strcmp(param,"ploss") == 0) {
+        double dbl = atof(value);
+        defined_channels[cd_id]->path_loss_dB=dbl;     
+    } else if ( strcmp(param,"offset") == 0) {
+        int i = atoi(value);
+        defined_channels[cd_id]->channel_offset=i;     
+    } else if ( strcmp(param,"forgetf") == 0) {
+        double dbl = atof(value);
+        if (dbl <0 || dbl > 1)
+        	prnt("ERROR: forgetting factor range: 0 to 1 (disable variation), %lf is outof range\n",dbl);
+        else
+        	defined_channels[cd_id]->forgetting_factor=dbl;     
+    } else {
+         prnt("ERROR: %s, unknown channel parameter\n",param);
+         return CMDSTATUS_FOUND;  
+    }
+  display_channelmodel(defined_channels[cd_id],debug,prnt);  
+  free(param);   
+  free(value);
+  random_channel(defined_channels[cd_id],false);                 
+  }
+  return CMDSTATUS_FOUND;           
+}
+   
+int modelid_fromname(char *modelname) {                                             
+  int modelid=map_str_to_int(channelmod_names,modelname);   
+  if (modelid < 0)   
+    LOG_E(OCM,"random_channel.c: Error channel model %s unknown\n",modelname);
   return modelid;
 }
 
@@ -1519,6 +1668,9 @@ void init_channelmod(void) {
   paramdef_t channelmod_params[] = CHANNELMOD_PARAMS_DESC;
   int ret = config_get( channelmod_params,sizeof(channelmod_params)/sizeof(paramdef_t),CHANNELMOD_SECTION);
   AssertFatal(ret >= 0, "configuration couldn't be performed");
+    defined_channels=calloc(max_chan,sizeof( channel_desc_t*));
+  AssertFatal(defined_channels!=NULL, "couldn't allocate %u channel descriptors\n",max_chan);
+  
   /* look for telnet server, if it is loaded, add the channel modeling commands to it */
   add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);
 
diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h
index 29f4234a382866eed4918772f2f091117c6ad730..e1ba52bfd52cc7dd509e6d81ebbf1440e4f5d739 100644
--- a/openair1/SIMULATION/TOOLS/sim.h
+++ b/openair1/SIMULATION/TOOLS/sim.h
@@ -40,6 +40,16 @@ The present clause specifies several numerical functions for testing of digital
 
 #define NB_SAMPLES_CHANNEL_OFFSET 4
 
+typedef enum {
+  UNSPECIFIED_MODID=0,
+  RFSIMU_MODULEID=1
+} channelmod_moduleid_t;
+#define MODULEID_STR_INIT {"","rfsimulator"}
+
+#define CHANMODEL_FREE_DELAY       1<<0
+#define CHANMODEL_FREE_RSQRT_6     1<<1
+#define CHANMODEL_FREE_RSQRT_NTAPS 1<<2
+#define CHANMODEL_FREE_AMPS        1<<3
 typedef struct {
   ///Number of tx antennas
   uint8_t nb_tx;
@@ -92,6 +102,14 @@ typedef struct {
   time_stats_t interp_time;
   time_stats_t interp_freq;
   time_stats_t convolution;
+  /// index in the channel descriptors array
+  unsigned int chan_idx;
+  /// id of the channel modeling algorithm
+  int modelid;
+  /// identifies channel descriptor owner (the module which created this descriptor)
+  channelmod_moduleid_t module_id;
+  /// flags to properly trigger memory free
+  unsigned int free_flags;
 } channel_desc_t;
 
 typedef struct {
@@ -214,8 +232,9 @@ typedef enum {
 #define CONFIG_HLP_SNR     "Set average SNR in dB (for --siml1 option)\n"
 #define CHANNELMOD_SECTION "channelmod"
 #define CHANNELMOD_PARAMS_DESC {  \
-    {"s"      , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB , defdblval:25, TYPE_DOUBLE, 0},\
-    {"sinr_dB", NULL          , 0                                , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
+    {"s"      , CONFIG_HLP_SNR,         PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB,    defdblval:25, TYPE_DOUBLE, 0},\
+    {"sinr_dB", NULL,                   0                                , dblptr:&sinr_dB,   defdblval:0 , TYPE_DOUBLE, 0},\
+    {"max_chan, CONFIG_HLP_MAX_CHAN",   0,                                 uptr:&max_chan,    defintval:10,  TYPE_UINT,   0},\
   }
 
 #include "platform_constants.h"
@@ -273,9 +292,18 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
                                      double forgetting_factor,
                                      int32_t channel_offset,
                                      double path_loss_dB);
+/**
+\brief free memory allocated for a model descriptor
+\param ch points to the model, which cannot be used after calling this fuction
+*/
+void free_channel_desc_scm(channel_desc_t *ch);
 
-
-
+/**
+\brief This set the ownerid of a model descriptor, can be later used to check what module created a channel model
+\param cdesc points to the model descriptor
+\param module_id identifies the channel model. should be define as a macro in simu.h
+*/
+void set_channeldesc_owner(channel_desc_t *cdesc, channelmod_moduleid_t module_id);
 /** \fn void random_channel(channel_desc_t *desc)
 \brief This routine generates a random channel response (time domain) according to a tapped delay line model.
 \param desc Pointer to the channel descriptor
diff --git a/openair2/COMMON/m2ap_messages_def.h b/openair2/COMMON/m2ap_messages_def.h
index adad70c9cc429458d297b827565b402f83ad6977..743ca126fbe257e4b5446804538a43513cae9327 100644
--- a/openair2/COMMON/m2ap_messages_def.h
+++ b/openair2/COMMON/m2ap_messages_def.h
@@ -50,6 +50,7 @@ MESSAGE_DEF(M2AP_DEREGISTERED_ENB_IND           , MESSAGE_PRIORITY_MED, m2ap_der
 /* M2AP -> SCTP */
 
 MESSAGE_DEF(M2AP_MCE_SCTP_REQ        , MESSAGE_PRIORITY_MED, m2ap_mce_sctp_req_t       , m2ap_mce_sctp_req)
+MESSAGE_DEF(M2AP_ENB_SCTP_REQ        , MESSAGE_PRIORITY_MED, m2ap_enb_sctp_req_t       , m2ap_enb_sctp_req)
 //MESSAGE_DEF(M2AP_ENB_SCTP_REQ        , MESSAGE_PRIORITY_MED, m2ap_enb_setup_req_t       , f1ap_enb_setup_req)
 
 /* eNB_DU application layer -> M2AP messages or CU M2AP -> RRC*/
diff --git a/openair2/COMMON/m2ap_messages_types.h b/openair2/COMMON/m2ap_messages_types.h
index 501414f296eaabe725f7aa26b77a475387731936..c70c50fc642517e5e7f7bf095d41f5c6a1256744 100644
--- a/openair2/COMMON/m2ap_messages_types.h
+++ b/openair2/COMMON/m2ap_messages_types.h
@@ -480,7 +480,7 @@ typedef struct m2ap_mbms_scheduling_information_s {
 		uint8_t common_sf_allocation_period;
 		uint8_t mbms_area_id;
 		struct{
-			uint8_t allocated_sf_end;
+			uint16_t allocated_sf_end;
                         uint8_t data_mcs;
                         uint8_t mch_scheduling_period;
 			struct{
@@ -533,6 +533,15 @@ typedef struct m2ap_mce_sctp_req_s {
   	uint32_t mce_port_for_M2C;
 }m2ap_mce_sctp_req_t;
 
+typedef struct m2ap_enb_sctp_req_s {
+  	/* The local MCE IP address to bind */
+	net_ip_address_t enb_m2_ip_address;
+
+  	/* eNB port for M2C*/
+  	uint32_t enb_port_for_M2C;
+}m2ap_enb_sctp_req_t;
+
+
 typedef struct m2ap_mbms_scheduling_information_resp_s {
 } m2ap_mbms_scheduling_information_resp_t;
 typedef struct m2ap_session_start_req_s {
diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c
index 7c91e57813d2b63734b17daf6cc116e46f7d8915..1d001022d21078f94f702327cb73fc5964c4b74f 100644
--- a/openair2/ENB_APP/enb_app.c
+++ b/openair2/ENB_APP/enb_app.c
@@ -214,7 +214,7 @@ void *eNB_app_task(void *args_p) {
   long                            x2_enb_register_retry_timer_id;
   uint32_t                        m2_register_enb_pending = 0;
   uint32_t                        m2_registered_enb = 0;
-  long                            m2_enb_register_retry_timer_id;
+  //long                            m2_enb_register_retry_timer_id;
   MessageDef                     *msg_p           = NULL;
   instance_t                      instance;
   int                             result;
@@ -236,16 +236,11 @@ void *eNB_app_task(void *args_p) {
   /* Try to register each eNB with MCE each other */
   if (is_m2ap_eNB_enabled() /*&& !NODE_IS_DU(RC.rrc[0]->node_type)*/) {
     //eNB_app_register_MBMS_STA(RC.rrc[0]->node_type, enb_id_start, enb_id_end);
-    //m2_register_enb_pending = eNB_app_register_m2 (enb_id_start, enb_id_end);
+    m2_register_enb_pending = eNB_app_register_m2 (enb_id_start, enb_id_end);
 
-    if (timer_setup (5, 0, TASK_ENB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,
-                               NULL, &m2_enb_register_retry_timer_id) < 0) {
-                //LOG_E(ENB_APP, " Can not start eNB register retry timer, use \"sleep\" instead!\n");
-                //sleep(ENB_REGISTER_RETRY_DELAY);
-                /* Restart the registration process */
-                //registered_enb = 0;
-                //register_enb_pending = eNB_app_register (RC.rrc[0]->node_type,enb_id_start, enb_id_end);
-    }
+    //if (timer_setup (5, 0, TASK_ENB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,
+    //                           NULL, &m2_enb_register_retry_timer_id) < 0) {
+    //}
 
   }
 
@@ -376,11 +371,11 @@ void *eNB_app_task(void *args_p) {
       }
         } /* if (EPC_MODE_ENABLED) */
 
-      if(TIMER_HAS_EXPIRED (msg_p).timer_id == m2_enb_register_retry_timer_id) {
-
-               LOG_I(ENB_APP, " Received %s: timer_id %ld M2 register\n", ITTI_MSG_NAME (msg_p), TIMER_HAS_EXPIRED(msg_p).timer_id);
-               m2_register_enb_pending = eNB_app_register_m2 (enb_id_start, enb_id_end);
-	}
+//      if(TIMER_HAS_EXPIRED (msg_p).timer_id == m2_enb_register_retry_timer_id) {
+//
+//               LOG_I(ENB_APP, " Received %s: timer_id %ld M2 register\n", ITTI_MSG_NAME (msg_p), TIMER_HAS_EXPIRED(msg_p).timer_id);
+//               m2_register_enb_pending = eNB_app_register_m2 (enb_id_start, enb_id_end);
+//	}
 
       break;
 
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index 1d189832b473f0314c2c3946ebfb48364de8b162..4c6a7885c3e1168a50a1f1a9aff119d1665d6461 100644
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -3052,7 +3052,8 @@ void configure_du_mac(int inst) {
                          (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                          (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                          (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                         (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                         (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+			 (LTE_MBSFNAreaConfiguration_r9_t*) NULL
                         );
 }
 
diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h
index 5f17cf4841e327c9e7355b28623cdf849458a8b8..2a5930e1a8b5dd9a18704c04d2df7e2ae777572b 100644
--- a/openair2/ENB_APP/flexran_agent_extern.h
+++ b/openair2/ENB_APP/flexran_agent_extern.h
@@ -44,8 +44,6 @@ AGENT_PHY_xface *flexran_agent_get_phy_xface(mid_t mod_id);
 
 extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
 #define flexran_agent_get_mac_xface(mod_id) (agent_mac_xface[mod_id])
-/* Control module interface for the communication of the RRC Control Module with the agent */
-
 /* Control module interface for the communication of the RRC Control Module with the agent */
 // AGENT_RRC_xface *flexran_agent_get_rrc_xface(mid_t mod_id);
 extern AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB];
diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c
index fb9450728b40dada6301df9be74b61c1d3289886..695358881822d8bc4fcfec411d296e248ace62a9 100644
--- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c
+++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c
@@ -306,7 +306,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t       instance,
                         (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                         (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                         (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                        (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                        (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+                        (LTE_MBSFNAreaConfiguration_r9_t*) NULL
           );
           break;
       } // case
@@ -480,7 +481,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t       instance,
                          (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                          (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                          (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                         (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                         (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+                         (LTE_MBSFNAreaConfiguration_r9_t*) NULL
                    );
                   }
 
diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c
index 49949bd771b119447a1694755a1a80455644d7b3..781347abaaea42610de39f573ff1a4385af2d5d3 100644
--- a/openair2/LAYER2/MAC/config.c
+++ b/openair2/LAYER2/MAC/config.c
@@ -660,7 +660,7 @@ config_sib2_mbsfn_part( int Mod_idP,
       if (mbsfn_SubframeConfigListP->list.array[i]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
         phycfg.cfg->embms_mbsfn_config.fourframes_flag[i] = 0;
         phycfg.cfg->embms_mbsfn_config.mbsfn_subframeconfig[i] = mbsfn_SubframeConfigListP->list.array[i]->subframeAllocation.choice.oneFrame.buf[0];  // 6-bit subframe configuration
-        LOG_I (MAC, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is  %d\n", i, phycfg.cfg->embms_mbsfn_config.mbsfn_subframeconfig[i]);
+        LOG_I (MAC, "[CONFIG] MBSFN_SubframeConfig[%d] oneFrame pattern is  %d\n", i, phycfg.cfg->embms_mbsfn_config.mbsfn_subframeconfig[i]);
       } else if (mbsfn_SubframeConfigListP->list.array[i]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) {       // 24-bit subframe configuration
         phycfg.cfg->embms_mbsfn_config.fourframes_flag[i]  = 1;
         phycfg.cfg->embms_mbsfn_config.mbsfn_subframeconfig[i] =
@@ -668,7 +668,7 @@ config_sib2_mbsfn_part( int Mod_idP,
           (mbsfn_SubframeConfigListP->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
           (mbsfn_SubframeConfigListP->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]<<16);
 
-        LOG_I(MAC, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is  %x\n", i,
+        LOG_I(MAC, "[CONFIG] MBSFN_SubframeConfig[%d] fourFrame pattern is  %x\n", i,
               phycfg.cfg->embms_mbsfn_config.mbsfn_subframeconfig[i]);
       }
     }
@@ -777,7 +777,8 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
                            LTE_SchedulingInfo_MBMS_r14_t *schedulingInfo_fembms,
                            struct LTE_NonMBSFN_SubframeConfig_r14 *nonMBSFN_SubframeConfig,
                            LTE_SystemInformationBlockType1_MBMS_r14_t   *sib1_mbms_r14_fembms,
-                           LTE_MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList_fembms
+                           LTE_MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList_fembms,
+   		           LTE_MBSFNAreaConfiguration_r9_t*mbms_AreaConfig
                           ) {
   int i;
   int UE_id = -1;
@@ -989,6 +990,7 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
     cfg->num_tlv++;
     //We need to reuse current MCH scheduler
     //TOCHECK whether we can simply reuse current mbsfn_SubframeConfig stuff
+    RC.mac[Mod_idP]->common_channels[0].FeMBMS_flag = FeMBMS_Flag;
   }
 
   if (mbsfn_AreaInfoList != NULL) {
@@ -1005,6 +1007,21 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
     }
   }
 
+  if(mbms_AreaConfig != NULL) {
+    RC.mac[Mod_idP]->common_channels[0].commonSF_AllocPeriod_r9 = mbms_AreaConfig->commonSF_AllocPeriod_r9; 
+    LOG_I(MAC, "[eNB %d][CONFIG]  LTE_MBSFNAreaConfiguration_r9_t(%p) commonSF_AllocPeriod_r9(%d)\n",Mod_idP,mbms_AreaConfig, RC.mac[Mod_idP]->common_channels[0].commonSF_AllocPeriod_r9);
+    for(i=0; i < mbms_AreaConfig->commonSF_Alloc_r9.list.count; i++){
+      RC.mac[Mod_idP]->common_channels[0].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] = mbms_AreaConfig->commonSF_Alloc_r9.list.array[i];
+     LOG_I(RRC,"[eNB %d][CONFIG] MBSFNArea[%d] commonSF_Alloc_r9: radioframeAllocationPeriod(%ldn),radioframeAllocationOffset(%ld), subframeAllocation(%x,%x,%x)\n"
+      ,Mod_idP,i
+      ,RC.mac[Mod_idP]->common_channels[0].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->radioframeAllocationPeriod
+      ,RC.mac[Mod_idP]->common_channels[0].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->radioframeAllocationOffset
+      ,RC.mac[Mod_idP]->common_channels[0].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]
+      ,RC.mac[Mod_idP]->common_channels[0].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[1]
+      ,RC.mac[Mod_idP]->common_channels[0].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[2]);
+    }
+  }
+
   if (pmch_InfoList != NULL) {
     //    LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9));
     LOG_I(MAC, "[CONFIG] Number of PMCH in this MBSFN Area %d\n",
diff --git a/openair2/LAYER2/MAC/config_ue.c b/openair2/LAYER2/MAC/config_ue.c
index 897afbf62bc960dc73070aaef2e94715de4971b9..1c5e70621803a3ad8dec8b80aead42b771b11ac3 100644
--- a/openair2/LAYER2/MAC/config_ue.c
+++ b/openair2/LAYER2/MAC/config_ue.c
@@ -530,6 +530,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
     LOG_I(MAC, "[UE %d] Configuring LTE_NonMBSFN \n",
           Mod_idP);
     phy_config_sib1_fembms_ue(Mod_idP, CC_idP, 0, nonMBSFN_SubframeConfig);
+    UE_mac_inst[Mod_idP].non_mbsfn_SubframeConfig = nonMBSFN_SubframeConfig;
   }
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index c46005ee2d5f28935f3dfe6a806e718718ef7fd1..8f5aab99a7706f1b858ac045f6e7ea5d33dcef34 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -547,7 +547,7 @@ copy_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
     ul_req_tmp->ul_config_request_body.number_of_pdus = 0;
 
     if (ul_req->ul_config_request_body.number_of_pdus>0) {
-      LOG_D(PHY, "%s() active NOW (frameP:%d subframeP:%d) pdus:%d\n", __FUNCTION__, frameP, subframeP, ul_req->ul_config_request_body.number_of_pdus);
+      LOG_D(MAC, "%s() active NOW (frameP:%d subframeP:%d) pdus:%d\n", __FUNCTION__, frameP, subframeP, ul_req->ul_config_request_body.number_of_pdus);
     }
 
     memcpy((void *)ul_req->ul_config_request_body.ul_config_pdu_list,
@@ -556,6 +556,11 @@ copy_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
   }
 }
 
+extern int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
+extern int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
+extern void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
+extern void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch);
+
 void
 eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
                           frame_t frameP,
@@ -843,6 +848,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
           }
 
           /* Note: This should not be done in the MAC! */
+	  /*
           for (int ii=0; ii<MAX_MOBILES_PER_ENB; ii++) {
             LTE_eNB_ULSCH_t *ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii];
 
@@ -862,6 +868,17 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
               clean_eNb_dlsch(dlsch);
             }
           }
+	  */
+
+	int id;
+
+	// clean ULSCH entries for rnti
+	id = find_ulsch(rnti,RC.eNB[module_idP][CC_id],SEARCH_EXIST);
+        if (id>=0) clean_eNb_ulsch(RC.eNB[module_idP][CC_id]->ulsch[id]);
+
+	// clean DLSCH entries for rnti
+	id = find_dlsch(rnti,RC.eNB[module_idP][CC_id],SEARCH_EXIST);
+        if (id>=0) clean_eNb_dlsch(RC.eNB[module_idP][CC_id]->dlsch[id][0]);
 
           for (int j = 0; j < 10; j++) {
             nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
@@ -904,6 +921,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
   }
 #endif
 
+  int do_fembms_si=0;
   for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
     if (cc[CC_id].MBMS_flag > 0) {
       start_meas(&RC.mac[module_idP]->schedule_mch);
@@ -914,6 +932,10 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
       }
       stop_meas(&RC.mac[module_idP]->schedule_mch);
     }
+    if (cc[CC_id].FeMBMS_flag > 0) {
+	do_fembms_si = 1;
+    }
+
   }
 
   static int debug_flag = 0;
@@ -935,12 +957,22 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
   }
 
   /* This schedules MIB */
-  if ((subframeP == 0) && (frameP & 3) == 0)
-    schedule_mib(module_idP, frameP, subframeP);
+  if(!do_fembms_si/*get_softmodem_params()->fembms*/){
+    if ((subframeP == 0) && (frameP & 3) == 0)
+      schedule_mib(module_idP, frameP, subframeP);
+  }else{
+    if ((subframeP == 0) && (frameP & 15) == 0 ){
+       schedule_fembms_mib(module_idP, frameP, subframeP);
+       //schedule_SI_MBMS(module_idP, frameP, subframeP);
+    }
+  }
 
   if (get_softmodem_params()->phy_test == 0) {
     /* This schedules SI for legacy LTE and eMTC starting in subframeP */
-    schedule_SI(module_idP, frameP, subframeP);
+    if(!do_fembms_si/*get_softmodem_params()->fembms*/)
+       schedule_SI(module_idP, frameP, subframeP);
+    else
+       schedule_SI_MBMS(module_idP, frameP, subframeP);
     /* This schedules Paging in subframeP */
     schedule_PCH(module_idP,frameP,subframeP);
     /* This schedules Random-Access for legacy LTE and eMTC starting in subframeP */
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
index 5b99578d57d340bd724f6d6b81c9f219d9b0994d..e4b9a7a65bf85781f3dc40b358f91f4c8c29b195 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
@@ -731,6 +731,7 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
   if (subframeP == 0) {
     for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
       cc = &eNB->common_channels[CC_id];
+      //printf("*cc->sib1_MBMS->si_WindowLength_r14 %d \n", *cc->sib1_MBMS->si_WindowLength_r14);
       vrb_map = (void *) &cc->vrb_map;
       N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
       dl_config_request = &eNB->DL_req[CC_id];
@@ -911,6 +912,64 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
   stop_meas(&eNB->schedule_si_mbms);
 }
 
+void
+schedule_fembms_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
+  eNB_MAC_INST *eNB = RC.mac[module_idP];
+  COMMON_channels_t *cc;
+  nfapi_dl_config_request_pdu_t *dl_config_pdu;
+  nfapi_tx_request_pdu_t *TX_req;
+  int mib_sdu_length;
+  int CC_id;
+  nfapi_dl_config_request_t *dl_config_request;
+  nfapi_dl_config_request_body_t *dl_req;
+  uint16_t sfn_sf = frameP << 4 | subframeP;
+  AssertFatal(subframeP == 0, "Subframe must be 0\n");
+  AssertFatal((frameP & 15) == 0, "Frame must be a multiple of 16\n");
+
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    dl_config_request = &eNB->DL_req[CC_id];
+    dl_req = &dl_config_request->dl_config_request_body;
+    cc = &eNB->common_channels[CC_id];
+    mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH_MBMS, 0xFFFF, 1, &cc->MIB_pdu.payload[0], 0); // not used in this case
+    LOG_D(MAC, "Frame %d, subframe %d: BCH PDU length %d\n", frameP, subframeP, mib_sdu_length);
+
+    if (mib_sdu_length > 0) {
+      LOG_D(MAC, "Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)\n", frameP, subframeP, dl_req->number_pdu, mib_sdu_length);
+
+      if ((frameP & 1023) < 40)
+        LOG_D(MAC,
+              "[eNB %d] Frame %d : MIB->BCH  CC_id %d, Received %d bytes (cc->mib->message.schedulingInfoSIB1_BR_r13 %d)\n",
+              module_idP, frameP, CC_id, mib_sdu_length,
+              (int) cc->mib->message.schedulingInfoSIB1_BR_r13);
+
+      dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+      memset((void *) dl_config_pdu, 0,
+             sizeof(nfapi_dl_config_request_pdu_t));
+      dl_config_pdu->pdu_type                                = NFAPI_DL_CONFIG_BCH_PDU_TYPE, dl_config_pdu->pdu_size =
+            2 + sizeof(nfapi_dl_config_bch_pdu);
+      dl_config_pdu->bch_pdu.bch_pdu_rel8.tl.tag             = NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG;
+      dl_config_pdu->bch_pdu.bch_pdu_rel8.length             = mib_sdu_length;
+      dl_config_pdu->bch_pdu.bch_pdu_rel8.pdu_index          = eNB->pdu_index[CC_id];
+      dl_config_pdu->bch_pdu.bch_pdu_rel8.transmission_power = 6000;
+      dl_req->tl.tag                                         = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+      dl_req->number_pdu++;
+      dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
+      dl_config_request->sfn_sf = sfn_sf;
+      LOG_D(MAC, "eNB->DL_req[0].number_pdu %d (%p)\n", dl_req->number_pdu, &dl_req->number_pdu);
+      // DL request
+      TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
+      TX_req->pdu_length = 3;
+      TX_req->pdu_index = eNB->pdu_index[CC_id]++;
+      TX_req->num_segments = 1;
+      TX_req->segments[0].segment_length = 3;
+      TX_req->segments[0].segment_data = cc[CC_id].MIB_pdu.payload;
+      eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
+      eNB->TX_req[CC_id].sfn_sf = sfn_sf;
+      eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+      eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
+    }
+  }
+}
 
 void
 schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
index 00fd40109db819a754e3bbf9ad79810df59b0641..f6220fa46de3d59b198a6a54ac89a340a307ada9 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
@@ -2240,7 +2240,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
   uint8_t first_ue_total[MAX_NUM_CCs][20];
   uint8_t first_ue_id[MAX_NUM_CCs][20];
   uint8_t ul_inactivity_num[MAX_NUM_CCs];
-  uint8_t ul_inactivity_id[MAX_NUM_CCs][20]={0};
+  uint8_t ul_inactivity_id[MAX_NUM_CCs][20]={{0}};
   //  LTE_DL_FRAME_PARMS *frame_parms;
   uint8_t ulsch_ue_max_num[MAX_NUM_CCs];
   uint16_t saved_ulsch_dci[MAX_NUM_CCs];
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
index eb5d78fd3f4b25d22c177d636a14cec72988b306..0c686a6475c57240fa31818fef6d6be699cb2656 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
@@ -66,7 +66,11 @@ get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id,
 	      "[eNB %d] CC_id %d MBSFN synchronization area %d out of range\n ",
 	      module_idP, CC_id, mbsfn_sync_area);
 	return -1;
-    } else if (RC.mac[module_idP]->
+    }else if (RC.mac[module_idP]->
+	       common_channels[CC_id].non_mbsfn_SubframeConfig
+	       != NULL) {
+	return mbsfn_sync_area;
+    }else if (RC.mac[module_idP]->
 	       common_channels[CC_id].mbsfn_SubframeConfig[mbsfn_sync_area]
 	       != NULL) {
 	return mbsfn_sync_area;
@@ -80,14 +84,30 @@ get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id,
 
 static uint32_t bytes_in_buffer=0;
 static uint32_t msi_pmch_stop=0;
-//static uint8_t msi_active=0;
-//static uint8_t msi_pmch_stop2=0;
-uint16_t mbms_rab_id = 2047;
+uint16_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047};
 static uint32_t msi_sfs=0;
 
 
 //MSI_ELEMENT * ptr =NULL;
 
+static int check_CAS_sf(frame_t frameP,sub_frame_t subframeP){
+   if( ((frameP&3)==0) && (subframeP == 0))
+	return 1;	
+   else 
+   	return 0;
+}
+static int check_nonMBSFN_sf(frame_t frameP,COMMON_channels_t *cc,int sf){
+   uint32_t non_mbsfn_SubframeConfig = (cc->non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]<<1 | cc->non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]>>7);	
+   if( frameP % (4<<cc->non_mbsfn_SubframeConfig->radioFrameAllocationPeriod_r14) == cc->non_mbsfn_SubframeConfig->radioFrameAllocationOffset_r14 ){
+	return (non_mbsfn_SubframeConfig & (0x200>>(sf)))==(0x200 >> (sf));
+   }
+   return 0;
+}
+
+
+static int x=0;
+static int mbms_mch_i=0;
+
 int
 schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
 	      sub_frame_t subframeP)
@@ -99,395 +119,571 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
     int mcch_flag = 0, mtch_flag = 0, msi_flag = 0;
     int mbsfn_period = 0;	// 1<<(RC.mac[module_idP]->mbsfn_SubframeConfig[0]->radioframeAllocationPeriod);
     int mcch_period = 0;	//32<<(RC.mac[module_idP]->mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
+    //TOCHECK mtch index here
     if(RC.mac[module_idP]->common_channels[CC_id].
               pmch_Config[0] == NULL )
-
 	return 0;
 
-   		
-
-
+    //TOCHECK mtch index here
     int mch_scheduling_period =
 	8 << (RC.mac[module_idP]->common_channels[CC_id].
 	      pmch_Config[0]->mch_SchedulingPeriod_r9);
-    unsigned char mcch_sdu_length;
-    unsigned char header_len_mcch = 0, header_len_msi =
-	0, header_len_mtch = 0, header_len_mtch_temp =
-	0, header_len_mcch_temp = 0, header_len_msi_temp = 0;
-    int ii = 0, msi_pos = 0;
-    int mcch_mcs = -1;
-    uint16_t TBS, j = -1, padding = 0, post_padding = 0;
-    mac_rlc_status_resp_t rlc_status;
-    //mac_rlc_status_resp_t rlc_status2;
-    int num_mtch;
-    int msi_length=0, i, k;
-    //uint8_t l =0;
-    unsigned char sdu_lcids[11], num_sdus = 0, offset = 0;
-    uint16_t sdu_lengths[11], sdu_length_total = 0;
-    unsigned char mch_buffer[MAX_DLSCH_PAYLOAD_BYTES];	// check the max value, this is for dlsch only
-
-    COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
-
-    cc->MCH_pdu.Pdu_size = 0;
-
-    for (i = 0; i < cc->num_active_mbsfn_area; i++) {
-	// assume, that there is always a mapping
-	if ((j = get_mbsfn_sf_alloction(module_idP, CC_id, i)) == -1) {
-	    return 0;
-	}
-
-	mbsfn_period =
-	    1 << (cc->mbsfn_SubframeConfig[j]->radioframeAllocationPeriod);
-	mcch_period =
-	    32 << (cc->mbsfn_AreaInfo[i]->
-		   mcch_Config_r9.mcch_RepetitionPeriod_r9);
-	msi_pos = 0;
-	ii = 0;
-	LOG_D(MAC,
-	      "[eNB %d] CC_id %d Frame %d subframeP %d : Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %d, mcch period %d)\n",
-	      module_idP, CC_id, frameP, subframeP, i,
-	      cc->num_active_mbsfn_area, j, cc->num_sf_allocation_pattern,
-	      mbsfn_period, mcch_period);
-
-
-	switch (cc->mbsfn_AreaInfo[i]->mcch_Config_r9.signallingMCS_r9) {
-	case 0:
-	    mcch_mcs = 2;
-	    break;
-
-	case 1:
-	    mcch_mcs = 7;
-	    break;
-
-	case 2:
-	    mcch_mcs = 13;
-	    break;
-
-	case 3:
-	    mcch_mcs = 19;
-	    break;
-	}
-
-	// 1st: Check the MBSFN subframes from SIB2 info (SF allocation pattern i, max 8 non-overlapping patterns exist)
-	if (frameP % mbsfn_period == cc->mbsfn_SubframeConfig[j]->radioframeAllocationOffset) {	// MBSFN frameP
-	    if (cc->mbsfn_SubframeConfig[j]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {	// one-frameP format
-
-		//  Find the first subframeP in this MCH to transmit MSI
-		if (frameP % mch_scheduling_period ==
-		    cc->mbsfn_SubframeConfig[j]->
-		    radioframeAllocationOffset) {
-		    while (ii == 0) {
-			ii = cc->
-			    mbsfn_SubframeConfig[j]->subframeAllocation.
-			    choice.oneFrame.buf[0] & (0x80 >> msi_pos);
-			msi_pos++;
-		    }
-
-		    LOG_D(MAC,
-			  "[eNB %d] CC_id %d Frame %d subframeP %d : sync area %d sf allocation pattern %d sf alloc %x msi pos is %d \n",
-			  module_idP, CC_id, frameP, subframeP, i, j,
-			  cc->mbsfn_SubframeConfig[j]->
-			  subframeAllocation.choice.oneFrame.buf[0],
-			  msi_pos);
-		}
-		// Check if the subframeP is for MSI, MCCH or MTCHs and Set the correspoding flag to 1
-		switch (subframeP) {
-		case 1:
-		    if (cc->tdd_Config == NULL) {
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_FDD_SF1) ==
-			    MBSFN_FDD_SF1) {
-			    if (msi_pos == 1) {
-				msi_flag = 1;
-			    }
-
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_FDD_SF1) ==
-				 MBSFN_FDD_SF1)) {
-				mcch_flag = 1;
-			    }
-
-			    mtch_flag = 1;
-			}
-		    }
-
-		    break;
-
-		case 2:
-		    if (cc->tdd_Config == NULL) {
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_FDD_SF2) ==
-			    MBSFN_FDD_SF2) {
-			    if (msi_pos == 2) {
-				msi_flag = 1;
-			    }
-
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_FDD_SF2) ==
-				 MBSFN_FDD_SF2)) {
-				mcch_flag = 1;
-			    }
-
-			    mtch_flag = 1;
-			}
-		    }
-
-		    break;
-
-		case 3:
-		    if (cc->tdd_Config != NULL) {	// TDD
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_TDD_SF3) ==
-			    MBSFN_TDD_SF3) {
-			    if (msi_pos == 1) {
-				msi_flag = 1;
-			    }
-
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_TDD_SF3) ==
-				 MBSFN_TDD_SF3)) {
-				mcch_flag = 1;
-			    }
-
-			    mtch_flag = 1;
-			}
-		    } else {	// FDD
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_FDD_SF3) ==
-			    MBSFN_FDD_SF3) {
-			    if (msi_pos == 3) {
-				msi_flag = 1;
-			    }
-
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_FDD_SF3) ==
-				 MBSFN_FDD_SF3)) {
-				mcch_flag = 1;
-			    }
-
-			    mtch_flag = 1;
-			}
-		    }
-
-		    break;
-
-		case 4:
-		    if (cc->tdd_Config != NULL) {
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_TDD_SF4) ==
-			    MBSFN_TDD_SF4) {
-			    if (msi_pos == 2) {
-				msi_flag = 1;
-			    }
-
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_TDD_SF4) ==
-				 MBSFN_TDD_SF4)) {
-				mcch_flag = 1;
-			    }
-
-			    mtch_flag = 1;
-			}
-		    }
-
-		    break;
-
-		case 6:
-		    if (cc->tdd_Config == NULL) {
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_FDD_SF6) ==
-			    MBSFN_FDD_SF6) {
-			    if (msi_pos == 4) {
-				msi_flag = 1;
-			    }
-
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_FDD_SF6) ==
-				 MBSFN_FDD_SF6)) {
-				mcch_flag = 1;
-			    }
-
-			    mtch_flag = 1;
-			}
-		    }
-
-		    break;
-
-		case 7:
-		    if (cc->tdd_Config != NULL) {	// TDD
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_TDD_SF7) ==
-			    MBSFN_TDD_SF7) {
-			    if (msi_pos == 3) {
-				msi_flag = 1;
-			    }
-
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_TDD_SF7) ==
-				 MBSFN_TDD_SF7)) {
-				mcch_flag = 1;
-			    }
-
-			    mtch_flag = 1;
-			}
-		    } else {	// FDD
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_FDD_SF7) ==
-			    MBSFN_FDD_SF7) {
-			    if (msi_pos == 5) {
-				msi_flag = 1;
-			    }
-
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_FDD_SF7) ==
-				 MBSFN_FDD_SF7)) {
-				mcch_flag = 1;
-			    }
-
-			    mtch_flag = 1;
-			}
-		    }
-
-		    break;
-
-		case 8:
-		    if (cc->tdd_Config != NULL) {	//TDD
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_TDD_SF8) ==
-			    MBSFN_TDD_SF8) {
-			    if (msi_pos == 4) {
-				msi_flag = 1;
-			    }
-
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_TDD_SF8) ==
-				 MBSFN_TDD_SF8)) {
-				mcch_flag = 1;
-			    }
-
-			    mtch_flag = 1;
-			}
-		    } else {	// FDD
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_FDD_SF8) ==
-			    MBSFN_FDD_SF8) {
-			    if (msi_pos == 6) {
-				msi_flag = 1;
-			    }
 
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_FDD_SF8) ==
-				 MBSFN_FDD_SF8)) {
-				mcch_flag = 1;
-			    }
+    unsigned char mcch_sdu_length;
+    unsigned char header_len_mcch = 0, header_len_msi =
+	0, header_len_mtch = 0, header_len_mtch_temp =
+	0, header_len_mcch_temp = 0, header_len_msi_temp = 0;
+    int ii = 0, msi_pos = -1;
+    int mcch_mcs = -1;
+    int shifted_sf = 0;
+    uint16_t TBS, j = -1, padding = 0, post_padding = 0;
+    mac_rlc_status_resp_t rlc_status;
+    int num_mtch=0;
+    int msi_length=0, i, k;
 
-			    mtch_flag = 1;
-			}
-		    }
+    unsigned char sdu_lcids[11], num_sdus = 0, offset = 0;
+    uint16_t sdu_lengths[11], sdu_length_total = 0;
+    unsigned char mch_buffer[MAX_DLSCH_PAYLOAD_BYTES];	// check the max value, this is for dlsch only
 
-		    break;
+    COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
 
-		case 9:
-		    if (cc->tdd_Config != NULL) {
-			if ((cc->
-			     mbsfn_SubframeConfig[j]->subframeAllocation.
-			     choice.oneFrame.buf[0] & MBSFN_TDD_SF9) ==
-			    MBSFN_TDD_SF9) {
-			    if (msi_pos == 5) {
-				msi_flag = 1;
-			    }
+    cc->MCH_pdu.Pdu_size = 0;
 
-			    if ((frameP % mcch_period ==
-				 cc->mbsfn_AreaInfo[i]->
-				 mcch_Config_r9.mcch_Offset_r9)
-				&&
-				((cc->mbsfn_AreaInfo[i]->
-				  mcch_Config_r9.sf_AllocInfo_r9.
-				  buf[0] & MBSFN_TDD_SF9) ==
-				 MBSFN_TDD_SF9)) {
-				mcch_flag = 1;
-			    }
+    for (i = 0; i < cc->num_active_mbsfn_area; i++) {
+	// assume, that there is always a mapping
+	if ((j = get_mbsfn_sf_alloction(module_idP, CC_id, i)) == -1) {
+	    return 0;
+	}
 
-			    mtch_flag = 1;
-			}
-		    }
+        if(cc->non_mbsfn_SubframeConfig){
+            int alloc_offset=0;
+            uint32_t period;
+
+            uint32_t non_mbsfn_SubframeConfig = (cc->non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]<<1 | cc->non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]>>7);	
+            long mcch_offset        = cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9;
+
+            period = 4<<cc->non_mbsfn_SubframeConfig->radioFrameAllocationPeriod_r14;
+            alloc_offset = cc->non_mbsfn_SubframeConfig->radioFrameAllocationOffset_r14;
+            mcch_period  = 32 << cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9;
+         
+            // get the real MCS value
+            switch (cc->mbsfn_AreaInfo[i]->mcch_Config_r9.signallingMCS_r9) {
+        	case 0:
+          	mcch_mcs = 2;
+          	break;
+
+        	case 1:
+          	mcch_mcs = 7;
+          	break;
+
+        	case 2:
+          	mcch_mcs = 13;
+          	break;
+
+        	case 3:
+          	mcch_mcs = 19;
+          	break;
+            }
+	   	  
+            if (cc->pmch_Config[0]) {
+        		mch_scheduling_period = 8 << cc->pmch_Config[0]->mch_SchedulingPeriod_r9;
+            }
+
+           LOG_D(MAC,"frameP %d subframe %d period %d alloc_offset %d mcch_mcs %d mcch_period %d mcch_offset %ld buf %x mch_scheduling_period %d\n",frameP, subframeP, period, alloc_offset,mcch_mcs, mcch_period, mcch_offset,(cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0]),mch_scheduling_period);
+	//if( (frameP % (4 << cc->commonSF_AllocPeriod_r9) ) == 0 ){
+	//	   if((subframeP==0)){
+	//	   	x=0;
+	//	   	mbms_mch_i=0;
+	//	   }
+	//}
+            //if (frameP % (4 << cc->commonSF_AllocPeriod_r9 ) == 0) {
+	    //       if((subframeP==0)){
+	    //       	x=0;
+	    //       	mbms_mch_i=0;
+	    //       }
+	    //}
+            if (cc->pmch_Config[0]) {
+              //  Find the first subframe in this MCH to transmit MSI
+              if (frameP % 1 == 0) {
+                if (frameP % mch_scheduling_period == 0) {
+		   msi_pos=0;
+		   if((frameP&3)==0)
+			msi_pos++;
+		   while((non_mbsfn_SubframeConfig & (0x100 >> msi_pos)) == (0x100>>msi_pos))
+			msi_pos++;
+		   	mbms_mch_i=0;
 
-		    break;
-		}		// end switch
+		   if((subframeP==0)){
+		   	x=0;
+		   	mbms_mch_i=0;
+		   }
+		 
+		}
+              }
+            }
 
-		// sf allocation is non-overlapping
-		if ((msi_flag == 1) || (mcch_flag == 1)
-		    || (mtch_flag == 1)) {
-		    LOG_D(MAC,
-			  "[eNB %d] CC_id %d Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
-			  module_idP, CC_id, frameP, subframeP, i, j,
-			  msi_flag, mcch_flag, mtch_flag);
-		    break;
+	    if(cc->pmch_Config[mbms_mch_i+1]!=NULL){
+		if( x == cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9+shifted_sf){
+
+			shifted_sf = check_nonMBSFN_sf(frameP,cc,subframeP)+check_CAS_sf(frameP,subframeP);
+			msi_pos=subframeP+shifted_sf;
+			if(shifted_sf==0)
+				mbms_mch_i++;
+			LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d shifted_sf %d\n",frameP, subframeP, msi_pos,mbms_mch_i,shifted_sf);
 		}
-	    } else {		// four-frameP format
 	    }
-	}
-    }				// end of for loop
+
+            // Check if the subframe is for MSI, MCCH or MTCHs and Set the correspoding flag to 1
+            switch (subframeP) {
+              case 0: 
+          	    if (msi_pos == 0) {
+            	      msi_flag = 1;
+          	    }
+                      mtch_flag = 1;
+                break;
+              case 1:
+                    if (msi_pos == 1) {
+                      msi_flag = 1;
+                    }
+                    if ((frameP % mcch_period == mcch_offset) && ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1)) {
+                      mcch_flag = 1;
+                    }
+                    mtch_flag = 1;
+                break;
+
+              case 2:
+                    if (msi_pos == 2) {
+                      msi_flag = 1;
+                    }
+                    if ((frameP % mcch_period == mcch_offset) && ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2)) {
+                      mcch_flag = 1;
+                    }
+                    mtch_flag = 1;
+
+                break;
+
+              case 3:
+                    if (msi_pos == 3) {
+                      msi_flag = 1;
+                    }
+                    if ((frameP % mcch_period == mcch_offset) && ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3)) {
+                      mcch_flag = 1;
+                    }
+                    mtch_flag = 1;
+                break;
+
+              case 4: 
+                    if (msi_pos == 4) {
+                      msi_flag = 1;
+                    }
+                      mtch_flag = 1;
+                break;
+
+              case 5: 
+                    if (msi_pos == 5) {
+                      msi_flag = 1;
+                    }
+                      mtch_flag = 1;
+                break;
+
+              case 6:
+                    if (msi_pos == 6) {
+                      msi_flag = 1;
+                    }
+                    if ((frameP % mcch_period == mcch_offset) && ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6)) {
+                      mcch_flag = 1;
+                    }
+                    mtch_flag = 1;
+                break;
+
+              case 7:
+                    if (msi_pos == 7) {
+                      msi_flag = 1;
+                    }
+                    if ((frameP % mcch_period == mcch_offset) && ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7)) {
+                      mcch_flag = 1;
+                    }
+                    mtch_flag = 1;
+                break;
+
+              case 8:
+                    if (msi_pos == 8) {
+                      msi_flag = 1;
+                    }
+                    if ((frameP % mcch_period == mcch_offset) && ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8)) {
+                      mcch_flag = 1;
+                    }
+                    mtch_flag = 1;
+                break;
+
+              case 9: 
+                    if (msi_pos == 9) {
+                      msi_flag = 1;
+                    }
+                      mtch_flag = 1;
+                break;
+            }// end switch
+
+            if ((msi_flag == 1) || (mcch_flag == 1) || (mtch_flag == 1)) {
+                        LOG_D(MAC,
+                              "[eNB %d] CC_id %d Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
+                              module_idP, CC_id, frameP, subframeP, i, j,
+                              msi_flag, mcch_flag, mtch_flag);
+            }
+
+	    //TODO quitar la subframe 0 del otro switch ... está mal interpretado ? 
+           // if((frameP&3) == 0){
+           //            mtch_flag=0;mcch_flag=0;msi_flag=0;
+           // }
+
+            if((frameP % period ) == alloc_offset){
+               LOG_D(MAC,"non_mbsfn_SubframeConfig %x\n",non_mbsfn_SubframeConfig);
+               switch(subframeP){
+                  case 0:{
+                       mtch_flag=0;mcch_flag=0;msi_flag=0;
+                    }
+                  break;
+                  case 1:{
+                  	if ((non_mbsfn_SubframeConfig & 0x100) > 0)
+                       {mtch_flag=0;mcch_flag=0;msi_flag=0;}
+                    }
+                  break;
+                  case 2:{
+                  	if ((non_mbsfn_SubframeConfig & 0x80) > 0)
+                  	   {mtch_flag=0;mcch_flag=0;msi_flag=0;}
+                    }
+                  break;
+                  case 3:{
+                  	if ((non_mbsfn_SubframeConfig & 0x40) > 0)
+                       {mtch_flag=0;mcch_flag=0;msi_flag=0;}
+                    }
+                  break;
+                  case 4:{
+                  	if ((non_mbsfn_SubframeConfig & 0x20) > 0)
+                       {mtch_flag=0;mcch_flag=0;msi_flag=0;}
+                    }
+                  break;
+                  case 5:{
+                  	if ((non_mbsfn_SubframeConfig & 0x10) > 0)
+                       {mtch_flag=0;mcch_flag=0;msi_flag=0;}
+                    }
+                  break;
+                  case 6:{
+                  	if ((non_mbsfn_SubframeConfig & 0x8) > 0)
+                       {mtch_flag=0;mcch_flag=0;msi_flag=0;}
+                    }
+                  break;
+                  case 7:{
+                  	if ((non_mbsfn_SubframeConfig & 0x4) > 0)
+                       {mtch_flag=0;mcch_flag=0;msi_flag=0;}
+                    }
+                  break;
+                  case 8:{
+                  	if ((non_mbsfn_SubframeConfig & 0x2) > 0)
+                       {mtch_flag=0;mcch_flag=0;msi_flag=0;}
+                    }
+                  break;
+                  case 9:{
+                  	if ((non_mbsfn_SubframeConfig & 0x1) > 0)
+                       {mtch_flag=0;mcch_flag=0;msi_flag=0;}
+                  }
+                  break;
+               }
+            }
+	    // sf allocation is non-overlapping
+            if ((msi_flag == 1) || (mcch_flag == 1) || (mtch_flag == 1)) {
+		  x++;
+		  //if( (msi_flag!=1 && mcch_flag!=1) || (msi_flag!=1 && mcch_flag!=1 && mtch_flag!=1)  ){
+		        	//x++;
+		  //}
+		 	
+		  if(msi_flag==1){
+		  	if ( (/*AJ*/ (/*V*/ ( /*U*/ (frameP %( 4 << cc->commonSF_AllocPeriod_r9)) ) / 8 ) % ((8 << cc->pmch_Config[mbms_mch_i]->mch_SchedulingPeriod_r9) / 8 ) ) != 0 ){
+				msi_flag=0;
+				LOG_D(MAC,"frameP %d subframeP %d reset(%d)\n",frameP, subframeP, mbms_mch_i);
+			}
+	        
+		  }
+
+	          LOG_D(MAC,"[eNB %d] CC_id %d Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d, x %d\n",
+                  module_idP, CC_id, frameP, subframeP, i, j,
+                   msi_flag, mcch_flag, mtch_flag,x);
+                  break;
+            }
+	   
+
+        }else if(cc->mbsfn_SubframeConfig[j]){
+
+            mbsfn_period =
+                1 << (cc->mbsfn_SubframeConfig[j]->radioframeAllocationPeriod);
+            mcch_period =
+                32 << (cc->mbsfn_AreaInfo[i]->
+            	   mcch_Config_r9.mcch_RepetitionPeriod_r9);
+            msi_pos = 0;
+            ii = 0;
+            LOG_D(MAC, "[eNB %d] CC_id %d Frame %d subframeP %d : Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %d, mcch period %d)\n",
+                  module_idP, CC_id, frameP, subframeP, i,
+                  cc->num_active_mbsfn_area, j, cc->num_sf_allocation_pattern,
+                  mbsfn_period, mcch_period);
+
+            switch (cc->mbsfn_AreaInfo[i]->mcch_Config_r9.signallingMCS_r9) {
+             case 0:
+                 mcch_mcs = 2;
+                 break;
+
+             case 1:
+                 mcch_mcs = 7;
+                 break;
+
+             case 2:
+                 mcch_mcs = 13;
+                 break;
+
+             case 3:
+                 mcch_mcs = 19;
+                 break;
+            }
+
+            // 1st: Check the MBSFN subframes from SIB2 info (SF allocation pattern i, max 8 non-overlapping patterns exist)
+            if (frameP % mbsfn_period == cc->mbsfn_SubframeConfig[j]->radioframeAllocationOffset) {	// MBSFN frameP
+                if (cc->mbsfn_SubframeConfig[j]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {	// one-frameP format
+            	     //  Find the first subframeP in this MCH to transmit MSI
+            	     if (frameP % mch_scheduling_period == cc->mbsfn_SubframeConfig[j]->radioframeAllocationOffset) {
+            	         while (ii == 0) {
+            	     	ii = cc->
+            	     	    mbsfn_SubframeConfig[j]->subframeAllocation.
+            	     	    choice.oneFrame.buf[0] & (0x80 >> msi_pos);
+            	     	msi_pos++;
+            	         }
+            	         LOG_D(MAC, "[eNB %d] CC_id %d Frame %d subframeP %d : sync area %d sf allocation pattern %d sf alloc %x msi pos is %d \n",
+            	     	  module_idP, CC_id, frameP, subframeP, i, j,
+            	     	  cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0],
+            	     	  msi_pos);
+	 	         if((subframeP==1)){
+		        	x=0;
+		        	mbms_mch_i=0;
+	      	     	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframeP, msi_pos,mbms_mch_i);
+		         }
+            	     }
+	       
+            	     // Check if the subframeP is for MSI, MCCH or MTCHs and Set the correspoding flag to 1
+            	     switch (subframeP) {
+            	     case 1:
+            	         if (cc->tdd_Config == NULL) {
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) {
+   		     	   if(cc->pmch_Config[mbms_mch_i+1]!=NULL){
+		     	      if( x == cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+		     	 	msi_pos=1;
+		     	 	mbms_mch_i++;
+		     	 	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframeP, msi_pos,mbms_mch_i);
+		     	      }
+		     	    }
+            	     	    if (msi_pos == 1) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&& ( (cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) ) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         }
+            	         break;
+            	     case 2:
+            	         if (cc->tdd_Config == NULL) {
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF2) ==  MBSFN_FDD_SF2) {
+   		     	   if(cc->pmch_Config[mbms_mch_i+1]!=NULL){
+		     	      if( x == cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+		     	 	msi_pos=2;
+		     	 	mbms_mch_i++;
+		     	 	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframeP, msi_pos,mbms_mch_i);
+		     	      }
+		     	    }
+
+            	     	    if (msi_pos == 2) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&& ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF2) ==  MBSFN_FDD_SF2)) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         }
+            	         break;
+            	     case 3:
+            	         if (cc->tdd_Config != NULL) {
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF3) ==  MBSFN_TDD_SF3) {
+            	     	    if (msi_pos == 1) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ((frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&&((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF3) ==  MBSFN_TDD_SF3)) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         } else {	// FDD
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF3) ==  MBSFN_FDD_SF3) {
+   		     	   if(cc->pmch_Config[mbms_mch_i+1]!=NULL){
+		     	      if( x == cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+		     	 	msi_pos=3;
+		     	 	mbms_mch_i++;
+		     	 	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframeP, msi_pos,mbms_mch_i);
+		     	      }
+		     	    }
+            	     	    if (msi_pos == 3) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ((frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&&((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3)) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         }
+            	         break;
+            	     case 4:
+            	         if (cc->tdd_Config != NULL) {
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) {
+            	     	    if (msi_pos == 2) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ((frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&&((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4)) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         }
+            	         break;
+            	     case 6:
+            	         if (cc->tdd_Config == NULL) {
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF6) ==  MBSFN_FDD_SF6) {
+   		     	   if(cc->pmch_Config[mbms_mch_i+1]!=NULL){
+		     	      if( x == cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+		     	 	msi_pos=4;
+		     	 	mbms_mch_i++;
+		     	 	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframeP, msi_pos,mbms_mch_i);
+		     	      }
+		     	    }
+            	     	    if (msi_pos == 4) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ((frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&&((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF6) ==  MBSFN_FDD_SF6)) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         }
+            	         break;
+            	     case 7:
+            	         if (cc->tdd_Config != NULL) {	// TDD
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) {
+            	     	    if (msi_pos == 3) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ((frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&&((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF7) ==  MBSFN_TDD_SF7)) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         } else {	// FDD
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) {
+   		     	   if(cc->pmch_Config[mbms_mch_i+1]!=NULL){
+		     	      if( x == cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+		     	 	msi_pos=5;
+		     	 	mbms_mch_i++;
+		     	 	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframeP, msi_pos,mbms_mch_i);
+		     	      }
+		     	    }
+
+            	     	    if (msi_pos == 5) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ((frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&&((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7)) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         }
+            	         break;
+            	     case 8:
+            	         if (cc->tdd_Config != NULL) {	//TDD
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) {
+            	     	    if (msi_pos == 4) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ((frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&&((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8)) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         } else {	// FDD
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF8) ==  MBSFN_FDD_SF8) {
+   		     	   if(cc->pmch_Config[mbms_mch_i+1]!=NULL){
+		     	      if( x == cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+		     	 	msi_pos=6;
+		     	 	mbms_mch_i++;
+		     	 	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframeP, msi_pos,mbms_mch_i);
+		     	      }
+		     	    }
+            	     	    if (msi_pos == 6) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ((frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&&((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8)) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         }
+            	         break;
+            	     case 9:
+            	         if (cc->tdd_Config != NULL) {
+            	     	if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF9) ==  MBSFN_TDD_SF9) {
+            	     	    if (msi_pos == 5) {
+            	     		msi_flag = 1;
+            	     	    }
+            	     	    if ((frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9)
+            	     		&&((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9)) {
+            	     		mcch_flag = 1;
+            	     	    }
+            	     	    mtch_flag = 1;
+            	     	}
+            	         }
+            	         break;
+            	     }	// end switch
+            	     // sf allocation is non-overlapping
+            	     if ((msi_flag == 1) || (mcch_flag == 1) || (mtch_flag == 1)) {
+		     	  x++;
+		         //if( (msi_flag!=1 && mcch_flag!=1) || (msi_flag!=1 && mcch_flag!=1 && mtch_flag!=1)  ){
+		     		//x++;
+		         //}
+			  if(msi_flag==1){
+			  	if ( (/*AJ*/ (/*V*/ ( /*U*/ (frameP %( 4 << cc->commonSF_AllocPeriod_r9)) ) / 8 ) % ((8 << cc->pmch_Config[mbms_mch_i]->mch_SchedulingPeriod_r9) / 8 ) ) != 0 ){
+					msi_flag=0;
+					LOG_D(MAC,"frameP %d subframeP %d reset(%d)\n",frameP, subframeP, mbms_mch_i);
+				}
+		        
+			  }
+
+            	         LOG_D(MAC,"[eNB %d] CC_id %d Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d x %d\n",
+            	     	  module_idP, CC_id, frameP, subframeP, i, j,
+            	     	  msi_flag, mcch_flag, mtch_flag,x);
+            	         break;
+            	     }
+                } else {// four-frameP format
+			 printf("Hola\n");
+			 AssertFatal(1==0,"four-frameP format: not implemented yet\n");
+                }
+            }
+        } // MBMS format
+    }// end of for loop
 
     cc->msi_active = 0;
     cc->mcch_active = 0;
@@ -497,7 +693,7 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
     if ((msi_flag == 1) || (mcch_flag == 1)) {
 	cc->MCH_pdu.mcs = mcch_mcs;
     } else if (mtch_flag == 1) {	// only MTCH in this subframeP
-	cc->MCH_pdu.mcs = cc->pmch_Config[0]->dataMCS_r9;
+	cc->MCH_pdu.mcs = cc->pmch_Config[mbms_mch_i]->dataMCS_r9;
     }
 
 
@@ -510,26 +706,14 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
 
     // there is MSI (MCH Scheduling Info)
     uint16_t msi_control_element[29], *msi_ptr;
+    // MSI buffer pointer
     char *buffer_pointer=NULL;
     if (msi_flag == 1) {
 	// Create MSI here
-	//uint16_t msi_control_element[29], *msi_ptr;
-
 	msi_ptr = &msi_control_element[0];
-	//((MSI_ELEMENT *) msi_ptr)->lcid = MCCH_LCHANID;	//MCCH
-
-	//if (mcch_flag == 1) {
-	//    ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0;
-	//    ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0;
-	//} else {		// no mcch for this MSP
-	//    ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x7;	// stop value is 2047
-	//    ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xff;
-	//}
-
-	//msi_ptr += sizeof(MSI_ELEMENT);
 
 	//Header for MTCHs
-	num_mtch = cc->mbms_SessionList[0]->list.count;
+	num_mtch = cc->mbms_SessionList[mbms_mch_i]->list.count;
 
     	TBS =
 	get_TBS_DL(cc->MCH_pdu.mcs, to_prb(cc->mib->message.dl_Bandwidth));
@@ -537,7 +721,7 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
 
 	for (k = 0; k < num_mtch; k++) {	// loop for all session in this MCH (MCH[0]) at this moment
 
-	    ((MSI_ELEMENT *) msi_ptr)->lcid = cc->mbms_SessionList[0]->list.array[k]->logicalChannelIdentity_r9;	//mtch_lcid;
+	    ((MSI_ELEMENT *) msi_ptr)->lcid = cc->mbms_SessionList[mbms_mch_i]->list.array[k]->logicalChannelIdentity_r9;	//mtch_lcid;
 
 	    if( msi_sfs != 0 )
 	    	msi_pmch_stop = msi_sfs-1;
@@ -546,22 +730,15 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
 	
     	    msi_pmch_stop = msi_sfs;
 
-	    //if( msi_pmch_stop > cc->pmch_Config[0]->sf_AllocEnd_r9)
-		   //LOG_W(MAC,"e-MBMS Buffer Overflow\n"); 
-
 	    if(msi_pmch_stop>=num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/)  {
-	        ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0;	// last subframeP of this mtch (only one mtch now) & stop_sf limited to 256
-	    	//((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = msi_pmch_stop;
-	    	((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = (msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[0]->sf_AllocEnd_r9);
-		msi_pmch_stop = (msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[0]->sf_AllocEnd_r9);
+	        ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = (((msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9) >> 8) & 0x7f);
+	    	((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = ((msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9) & 0xff);
+		msi_pmch_stop = (msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9);
 	    }else{
 	    	((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x7;	// last subframeP of this mtch (only one mtch now)
 	    	((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xFF; 
 		msi_pmch_stop=0;
 	    }
-
-	   
-	   
 	    msi_ptr += sizeof(MSI_ELEMENT);
 	}
 
@@ -573,15 +750,11 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
 	    header_len_msi = 3;
 	}
 
-	LOG_D(MAC,
-	      "[eNB %d] CC_id %d Frame %d : MSI->MCH, length of MSI is %d bytes TBS %d, bytes in buffer %d stop_sf_LSB %d msi_sfs %d cc->pmch_Config[0]->sf_AllocEnd_r9 %ld\n",
-	      module_idP, CC_id, frameP, msi_length,TBS, bytes_in_buffer,msi_pmch_stop,msi_sfs,cc->pmch_Config[0]->sf_AllocEnd_r9);
+	LOG_D(MAC, "[eNB %d] CC_id %d Frame %d : MSI->MCH, length of MSI is %d bytes TBS %d, bytes in buffer %d stop_sf_LSB %d msi_sfs %d cc->pmch_Config[0]->sf_AllocEnd_r9 %ld\n",
+	      module_idP, CC_id, frameP, msi_length,TBS, bytes_in_buffer,msi_pmch_stop,msi_sfs,cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9);
 	    
 	msi_sfs = 0;
 
-	//LOG_D(MAC,"Scheduler: MSI is transmitted in this subframeP \n" );
-
-	//   LOG_D(MAC,"Scheduler: MSI length is %d bytes\n",msi_length);
 	// Store MSI data to mch_buffer[0]
 	memcpy((char *) &mch_buffer[sdu_length_total],
 	       msi_control_element, msi_length);
@@ -598,75 +771,93 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
     }
     // there is MCCH
     if (mcch_flag == 1) {
-
-		//LOG_E(MAC,
-	      //"[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE COUNTING (mod %d)\n",module_idP, CC_id, frameP, subframeP,frameP%2==0);
-	if(1/*frameP%2==0*/){
-	LOG_D(MAC,
-	      "[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE (area %d, sfAlloc %d)\n",
-	      module_idP, CC_id, frameP, subframeP, i, j);
-
-		mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 0xFFFC, 1, &cc->MCCH_pdu.payload[0], 
-					   i);	// this is the mbsfn sync area index
-	}
-	else{
-		LOG_E(MAC,
-	      "[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE COUNTING (area %d, sfAlloc %d)\n",
-	      module_idP, CC_id, frameP, subframeP, i, j);
-
-//
-//		mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH_COUNTING, 0xFFFC, 1, &cc->MCCH_pdu.payload[0], 
-//					   i);	// this is the mbsfn sync area index
+	//MCCH scheduling if !FeMBMS
+	if(!cc->non_mbsfn_SubframeConfig){
+          mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH_COUNTING, 0xFFFC, 1, &cc->MCCH_pdu.payload[0], 
+					 i);	// this is the mbsfn sync area index
+	  if(mcch_sdu_length>0)
+		LOG_I(MAC, "[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE COUNTING (area %d, sfAlloc %d)\n",
+		  module_idP, CC_id, frameP, subframeP, i, j);
+
+	  if (mcch_sdu_length > 0) {
+              mcch_sdu_length+=1; //RLC ?
+	      LOG_D(MAC, "[eNB %d] CC_id %d Frame %d subframeP %d : MCCH->MCH, Received %d bytes from RRC \n",
+		    module_idP, CC_id, frameP, subframeP, mcch_sdu_length);
+
+	      header_len_mcch = 2;
+
+	      if (cc->tdd_Config != NULL) {
+		  LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d: Scheduling MCCH->MCH (TDD) for MCCH message %d bytes (mcs %d )\n",
+			module_idP, CC_id, frameP, subframeP,
+			mcch_sdu_length, mcch_mcs);
+	      } else {
+		  LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d: Scheduling MCCH->MCH (FDD) for MCCH message %d bytes (mcs %d)\n",
+			module_idP, CC_id, frameP, subframeP,
+			mcch_sdu_length, mcch_mcs);
+	      }
+
+	      cc->mcch_active = 1;
+
+	      memcpy((char *) &mch_buffer[sdu_length_total]+1,
+		     &cc->MCCH_pdu.payload[0], mcch_sdu_length);
+	      sdu_lcids[num_sdus] = MCCH_LCHANID;
+	      sdu_lengths[num_sdus] = mcch_sdu_length;
+
+	      if (sdu_lengths[num_sdus] > 128) {
+		  header_len_mcch = 3;
+	      }
+
+	      sdu_length_total += sdu_lengths[num_sdus];
+	      LOG_D(MAC,
+		    "[eNB %d] CC_id %d Got %d bytes for MCCH from RRC \n",
+		    module_idP, CC_id, sdu_lengths[num_sdus]);
+	      num_sdus++;
+	  }
 	}
 
-        mcch_sdu_length+=1; //RLC ?
-
-	if (mcch_sdu_length > 0) {
-	    LOG_D(MAC,
-		  "[eNB %d] CC_id %d Frame %d subframeP %d : MCCH->MCH, Received %d bytes from RRC \n",
-		  module_idP, CC_id, frameP, subframeP, mcch_sdu_length);
-
-	    header_len_mcch = 2;
-
-	    if (cc->tdd_Config != NULL) {
-		LOG_D(MAC,
-		      "[eNB %d] CC_id %d Frame %d subframeP %d: Scheduling MCCH->MCH (TDD) for MCCH message %d bytes (mcs %d )\n",
-		      module_idP, CC_id, frameP, subframeP,
-		      mcch_sdu_length, mcch_mcs);
-	    } else {
-		LOG_D(MAC,
-		      "[eNB %d] CC_id %d Frame %d subframeP %d: Scheduling MCCH->MCH (FDD) for MCCH message %d bytes (mcs %d)\n",
-		      module_idP, CC_id, frameP, subframeP,
-		      mcch_sdu_length, mcch_mcs);
-	    }
-
-	    cc->mcch_active = 1;
+	//MCCH scheduling ... do it anyway
+	{
+	    LOG_I(MAC, "[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE (area %d, sfAlloc %d)\n",
+	  	module_idP, CC_id, frameP, subframeP, i, j);
+
+	    mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 0xFFFC, 1, &cc->MCCH_pdu.payload[0], 
+				       i);	// this is the mbsfn sync area index
+
+	    if (mcch_sdu_length > 0) {
+		mcch_sdu_length+=1; //RLC ?
+		LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d : MCCH->MCH, Received %d bytes from RRC \n",
+		      module_idP, CC_id, frameP, subframeP, mcch_sdu_length);
+
+		header_len_mcch = 2;
+
+		if (cc->tdd_Config != NULL) {
+		    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d: Scheduling MCCH->MCH (TDD) for MCCH message %d bytes (mcs %d )\n",
+			  module_idP, CC_id, frameP, subframeP,
+			  mcch_sdu_length, mcch_mcs);
+		} else {
+		    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d: Scheduling MCCH->MCH (FDD) for MCCH message %d bytes (mcs %d)\n",
+			  module_idP, CC_id, frameP, subframeP,
+			  mcch_sdu_length, mcch_mcs);
+		}
 
-	    memcpy((char *) &mch_buffer[sdu_length_total]+1,
-		   &cc->MCCH_pdu.payload[0], mcch_sdu_length);
-	    sdu_lcids[num_sdus] = MCCH_LCHANID;
-	    sdu_lengths[num_sdus] = mcch_sdu_length;
+		cc->mcch_active = 1;
 
-	   // LOG_W(MAC,"MCCH RLC %x:",(unsigned char)mch_buffer[sdu_length_total]);
-	   // for (int kk = 7; kk >= 0; kk--)
-	   // {
-    	   //     printf("%d",(((unsigned char)mch_buffer[sdu_length_total]) >> kk) & 1 ? '1' : '0');
-	   // }
-	   // printf("\n");
-	    //mch_buffer[sdu_length_total] = (unsigned char)0;
+		memcpy((char *) &mch_buffer[sdu_length_total]+1,
+		       &cc->MCCH_pdu.payload[0], mcch_sdu_length);
+		sdu_lcids[num_sdus] = MCCH_LCHANID;
+		sdu_lengths[num_sdus] = mcch_sdu_length;
 
+		if (sdu_lengths[num_sdus] > 128) {
+		    header_len_mcch = 3;
+		}
 
-	    if (sdu_lengths[num_sdus] > 128) {
-		header_len_mcch = 3;
+		sdu_length_total += sdu_lengths[num_sdus];
+		LOG_D(MAC,"[eNB %d] CC_id %d Got %d bytes for MCCH from RRC \n",
+		      module_idP, CC_id, sdu_lengths[num_sdus]);
+		num_sdus++;
 	    }
-
-	    sdu_length_total += sdu_lengths[num_sdus];
-	    LOG_D(MAC,
-		  "[eNB %d] CC_id %d Got %d bytes for MCCH from RRC \n",
-		  module_idP, CC_id, sdu_lengths[num_sdus]);
-	    num_sdus++;
 	}
-    }
+    }// mcch_flag
 
 
     TBS =
@@ -678,154 +869,108 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
     // there is MTCHs, loop if there are more than 1
     if (mtch_flag == 1 ) {
 	// Calculate TBS
-	/* if ((msi_flag==1) || (mcch_flag==1)) {
-	   TBS = mac_xface->get_TBS(mcch_mcs, mac_xface->frame_parms->N_RB_DL);
-	   }
-	   else { // only MTCH in this subframeP
-	   TBS = mac_xface->get_TBS(RC.mac[module_idP]->pmch_Config[0]->dataMCS_r9, mac_xface->frame_parms->N_RB_DL);
-	   }
-
-	   // get MTCH data from RLC (like for DTCH)
-	   LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframe %d: Schedule MTCH (area %d, sfAlloc %d)\n",Mod_id,CC_id,frame,subframe,i,j);
-
-	   header_len_mtch = 3;
-	   LOG_D(MAC,"[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
-	   Mod_id,CC_id,frame,MTCH,TBS,
-	   TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch);
-
-	   rlc_status = mac_rlc_status_ind(Mod_id,frame,1,RLC_MBMS_YES,MTCH+ (maxDRB + 3) * MAX_MOBILES_PER_RG,
-	   TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch);
-	   printf("frame %d, subframe %d,  rlc_status.bytes_in_buffer is %d\n",frame,subframe, rlc_status.bytes_in_buffer);
-
-	 */
-
 	// get MTCH data from RLC (like for DTCH)
-	LOG_D(MAC,
-	      "[eNB %d] CC_id %d Frame %d subframeP %d: Schedule MTCH (area %d, sfAlloc %d)\n",
+	LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d: Schedule MTCH (area %d, sfAlloc %d)\n",
 	      module_idP, CC_id, frameP, subframeP, i, j);
 
 	header_len_mtch = 3;
-	LOG_D(MAC,
-	      "[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
+	LOG_D(MAC,"[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
 	      module_idP, CC_id, frameP, MTCH, TBS,
 	      TBS - header_len_mcch - header_len_msi - sdu_length_total -
 	      header_len_mtch);
 
-	mbms_rab_id = cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9;
+	//TODO
+	mbms_rab_id = cc->mbms_SessionList[0/*mbms_mch_i*/]->list.array[0]->logicalChannelIdentity_r9;
 
 	rlc_status =
 	    mac_rlc_status_ind(module_idP, 0xfffd, frameP, subframeP,
 			       module_idP, ENB_FLAG_YES, MBMS_FLAG_YES,
-				cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9,
+				cc->mbms_SessionList[mbms_mch_i]->list.array[0]->logicalChannelIdentity_r9,
 			       //MTCH,
                                      0, 0
                                     );
-	bytes_in_buffer = rlc_status.bytes_in_buffer;
 
+	bytes_in_buffer = rlc_status.bytes_in_buffer;
 
+	//TOCHECK is this really neede?
 	if( !(mcch_flag==1 || msi_flag==1) )
 		msi_sfs = rlc_status.bytes_in_buffer/(TBS- header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)+(rlc_status.bytes_in_buffer%(TBS- header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)?1:0);
-	//uint16_t msi_control_element[29], *msi_ptr;
-	//
-	//
-       uint16_t TBS_MTCH =
-	get_TBS_DL(cc->pmch_Config[0]->dataMCS_r9, to_prb(cc->mib->message.dl_Bandwidth));
-	if(msi_flag==1 && buffer_pointer!=NULL){
-		msi_ptr = &msi_control_element[0];
 
-	    //memcpy(buffer_pointer,
-	     //  msi_control_element, msi_length);
+        uint16_t TBS_MTCH =
+	get_TBS_DL(cc->pmch_Config[mbms_mch_i]->dataMCS_r9, to_prb(cc->mib->message.dl_Bandwidth));
+
+	if(msi_flag==1 && buffer_pointer!=NULL){
+	//	msi_ptr = &msi_control_element[0];
 
-	   // msi_pmch_stop = rlc_status.bytes_in_buffer/TBS+(rlc_status.bytes_in_buffer%TBS?1:0);
 	    msi_pmch_stop = (rlc_status.bytes_in_buffer - header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)/(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)+((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0);
 
-	    if( msi_pmch_stop > cc->pmch_Config[0]->sf_AllocEnd_r9)
-		   LOG_E(MAC,"e-MBMS Buffer Overflow\n"); 
-	    if(msi_pmch_stop>=num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/)  {
-	        ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0;	// last subframeP of this mtch (only one mtch now) & stop_sf limited to 256
-	    	//((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = msi_pmch_stop;
-	    	((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = (msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[0]->sf_AllocEnd_r9);
-	        msi_pmch_stop = (msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[0]->sf_AllocEnd_r9);
-	    }else{
-	    	((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x7;	// last subframeP of this mtch (only one mtch now)
-	    	((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xFF; 
-	        msi_pmch_stop=0;
-	    }
-	    LOG_I(MAC,"frameP %d, subframeP %d rlc_status.bytes_in_buffer %d stop_sf_LSB %d\n",frameP,subframeP,rlc_status.bytes_in_buffer,((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB);
-	    //LOG_W(MAC,"frameP %d, subframeP %d rlc_status.bytes_in_buffer %d stop_sf_LSB %d msi_calc:%d remainder %d\n",frameP,subframeP,rlc_status.bytes_in_buffer,((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB,rlc_status.bytes_in_buffer/(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)+((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0),((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0));
+	    for (k = 0; k < num_mtch; k++) {	// loop for all session in this MCH (MCH[0]) at this moment
+	      msi_ptr = &msi_control_element[k];
 
-	    memcpy(buffer_pointer,
-	       msi_control_element, msi_length);
+	      ((MSI_ELEMENT *) msi_ptr)->lcid = cc->mbms_SessionList[mbms_mch_i]->list.array[k]->logicalChannelIdentity_r9;	//mtch_lcid;
+
+	      if( msi_pmch_stop > cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9)
+	             LOG_E(MAC,"e-MBMS Buffer Overflow\n"); 
+
+	      if(msi_pmch_stop>=num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/)  {
+	          ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = (((msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9) >> 8) & 0x7f);
+	      	((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = ((msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9) & 0xff);
+	          msi_pmch_stop = (msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9);
+	      }else{
+	      	((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x7;	// last subframeP of this mtch (only one mtch now)
+	      	((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xFF; 
+	          msi_pmch_stop=0;
+	      }
+	      LOG_I(MAC,"frameP %d, subframeP %d LCID %d rlc_status.bytes_in_buffer %d stop_sf_LSB %d stop_sf_MSB %d msi_pmch_stop %d sf_AllocEnd_r9 %ld, msi_length %d\n",frameP,subframeP,((MSI_ELEMENT *) msi_ptr)->lcid,rlc_status.bytes_in_buffer,((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB,((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB, msi_pmch_stop,cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9, msi_length);
+	   }
 
+	    memcpy((char*)buffer_pointer,
+	       msi_control_element, msi_length);
 	}
 
-	LOG_D(MAC,
-	      "e-MBMS log channel %u frameP %d, subframeP %d,  rlc_status.bytes_in_buffer is %d TBS_MTCH %d pmch_stop %d msi_sfs %d\n",
+	LOG_D(MAC, "e-MBMS log channel %u frameP %d, subframeP %d,  rlc_status.bytes_in_buffer is %d TBS_MTCH %d pmch_stop %d msi_sfs %d\n",
 	      MTCH, frameP, subframeP, rlc_status.bytes_in_buffer,TBS_MTCH,msi_pmch_stop,msi_sfs);
 
-	if ((rlc_status.bytes_in_buffer > 0 &&  msi_pmch_stop > 0) && ((msi_flag!=1 || mcch_flag!=1)) /*|| (rlc_status.bytes_in_buffer > 0 && (msi_flag==1 || mcch_flag==1))*//*|| msi_sfs > cc->pmch_Config[0]->sf_AllocEnd_r9 */ /*msi_pmch_stop>=num_sf_alloc*/ ) {
-	    //if(rlc_status.bytes_in_buffer > 0){
-	    LOG_D(MAC,
-		  "[eNB %d][MBMS USER-PLANE], CC_id %d, Frame %d, MTCH->MCH, Requesting %d bytes from RLC (header len mtch %d) rlc_status.bytes_in_buffer %d\n",
-		  module_idP, CC_id, frameP,
+	//TODO not sure whether msi and mch MCH should be precluded ... keep in mind this konditions just in case if ((rlc_status.bytes_in_buffer > 0 &&  msi_pmch_stop > 0) && ((msi_flag!=1 || mcch_flag!=1))
+	if ((rlc_status.bytes_in_buffer > 0 &&  msi_pmch_stop > 0) /*&& ((msi_flag!=1 || mcch_flag!=1))*/ /*|| (rlc_status.bytes_in_buffer > 0 && (msi_flag==1 || mcch_flag==1))*//*|| msi_sfs > cc->pmch_Config[0]->sf_AllocEnd_r9 */ /*msi_pmch_stop>=num_sf_alloc*/ ) {
+	    LOG_I(MAC,"[eNB %d][MBMS USER-PLANE], CC_id %d, Frame %d, Subframe %d MTCH->MCH, Requesting %d bytes from RLC (header len mtch %d) rlc_status.bytes_in_buffer %d, LCID %ld\n",
+		  module_idP, CC_id, frameP, subframeP,
 		  TBS - header_len_mcch - header_len_msi -
-		  sdu_length_total - header_len_mtch, header_len_mtch, rlc_status.bytes_in_buffer);
+		  sdu_length_total - header_len_mtch, header_len_mtch, rlc_status.bytes_in_buffer,cc->mbms_SessionList[mbms_mch_i]->list.array[0]->logicalChannelIdentity_r9);
 
-      sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0xfffd, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9,
+      sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0xfffd, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[mbms_mch_i]->list.array[0]->logicalChannelIdentity_r9,
                                                TBS - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch,
 						     (char *)
 						     &mch_buffer[sdu_length_total]
                                 ,0,
                                  0
                                  );
-
-	   // LOG_I(MAC,"RLC %x:",(unsigned char)mch_buffer[sdu_length_total]);
-	   // for (int kk = 7; kk >= 0; kk--)
-	   // {
-    	   //     printf("%d",(((unsigned char)mch_buffer[sdu_length_total]) >> kk) & 1 ? '1' : '0');
-	   // }
-	   // printf("\n");
-	
-	    //sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, MBMS_FLAG_NO,  MTCH+(MAX_NUM_RB*(MAX_MOBILES_PER_ENB+1)), (char*)&mch_buffer[sdu_length_total]);
-	    LOG_D(MAC,
-		  "[eNB %d][MBMS USER-PLANE] CC_id %d Got %d bytes for MTCH %d msi_pmch_stop %d msi_sfs %d sdu_lengths[num_sdus] %d\n",
+	    LOG_D(MAC,"[eNB %d][MBMS USER-PLANE] CC_id %d Got %d bytes for MTCH %d msi_pmch_stop %d msi_sfs %d sdu_lengths[num_sdus] %d\n",
 		  module_idP, CC_id, sdu_lengths[num_sdus], MTCH,msi_pmch_stop,msi_sfs, sdu_lengths[num_sdus]);
+
 	    cc->mtch_active = 1;
-	    sdu_lcids[num_sdus] = cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9/*MTCH*/;
+
+	    sdu_lcids[num_sdus] = cc->mbms_SessionList[mbms_mch_i]->list.array[0]->logicalChannelIdentity_r9/*MTCH*/;
 	    sdu_length_total += sdu_lengths[num_sdus];
 
 	    if (msi_pmch_stop != 0 && msi_flag !=1)
 	    	msi_pmch_stop--;
 
-
 	    if (sdu_lengths[num_sdus] < 128) {
 		header_len_mtch = 2;
 	    }
 
 	    num_sdus++;
-	  //}
 	} 
 	else {
-	//    LOG_E(MAC,
-	//	  "[eNB %d][MBMS USER-PLANE] CC_id %d Got %d bytes for MTCH %d msi_pmch_stop %d msi_buffer %d msi_sfs %ld msi_buffer_act %ld  sdu_lengths[num_sdus] %d\n",
-	//	  module_idP, CC_id, sdu_lengths[num_sdus], MTCH,msi_pmch_stop,msi_sfs,msi_buffer_act, sdu_lengths[num_sdus]);
-
 	    header_len_mtch = 0;
 	}
     }
-    //  }
 
     // FINAL STEP: Prepare and multiplexe MSI, MCCH and MTCHs
-    if ((sdu_length_total + header_len_msi + header_len_mcch +
-	 header_len_mtch) > 0) {
+    if ((sdu_length_total + header_len_msi + header_len_mcch + header_len_mtch) > 0) {
+
 	// Adjust the last subheader
-	/*                                 if ((msi_flag==1) || (mcch_flag==1)) {
-	   RC.mac[module_idP]->MCH_pdu.mcs = mcch_mcs;
-	   }
-	   else if (mtch_flag == 1) { // only MTCH in this subframeP
-	   RC.mac[module_idP]->MCH_pdu.mcs = RC.mac[module_idP]->pmch_Config[0]->dataMCS_r9;
-	   }
-	 */
 	header_len_mtch_temp = header_len_mtch;
 	header_len_mcch_temp = header_len_mcch;
 	header_len_msi_temp = header_len_msi;
@@ -881,12 +1026,10 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
 	cc->MCH_pdu.msi_active = cc->msi_active;
 	cc->MCH_pdu.mcch_active = cc->mcch_active;
 	cc->MCH_pdu.mtch_active = cc->mtch_active;
-	LOG_D(MAC,
-	      " MCS for this sf is %d (mcch active %d, mtch active %d)\n",
+	LOG_D(MAC, " MCS for this sf is %d (mcch active %d, mtch active %d)\n",
 	      cc->MCH_pdu.mcs, cc->MCH_pdu.mcch_active,
 	      cc->MCH_pdu.mtch_active);
-	LOG_D(MAC,
-	      "[eNB %d][MBMS USER-PLANE ] CC_id %d Generate header : sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,padding %d,post_padding %d (mcs %d, TBS %d), header MTCH %d, header MCCH %d, header MSI %d\n",
+	LOG_D(MAC, "[eNB %d][MBMS USER-PLANE ] CC_id %d Generate header : sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,padding %d,post_padding %d (mcs %d, TBS %d), header MTCH %d, header MCCH %d, header MSI %d\n",
 	      module_idP, CC_id, sdu_length_total, num_sdus,
 	      sdu_lengths[0], sdu_lcids[0], offset, padding, post_padding,
 	      cc->MCH_pdu.mcs, TBS, header_len_mtch, header_len_mcch,
@@ -902,20 +1045,15 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
 
 	/* Tracing of PDU is done on UE side */
 	//if (opt_enabled == 1) {
-	    trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI , 0xfffd,	// M_RNTI = 6 in wirehsark
-		      RC.mac[module_idP]->frame,
-		      RC.mac[module_idP]->subframe, 0, 0);
-	    LOG_D(OPT,
-		  "[eNB %d][MCH] CC_id %d Frame %d : MAC PDU with size %d\n",
+	trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI , 0xfffd,	// M_RNTI = 6 in wirehsark
+	          RC.mac[module_idP]->frame,
+	          RC.mac[module_idP]->subframe, 0, 0);
+	LOG_D(OPT, "[eNB %d][MCH] CC_id %d Frame %d : MAC PDU with size %d\n",
 		  module_idP, CC_id, frameP, TBS);
 	//}
 
        	eNB_MAC_INST *eNB = RC.mac[module_idP];
     	dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
-    //	dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
-    //	memset((void *) dl_config_pdu,
-    //                 0,
-    //                 sizeof(nfapi_dl_config_request_pdu_t));
 	dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
     	fill_nfapi_mch_config(
 			dl_req,
@@ -934,12 +1072,6 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
                                         TBS,
                                         eNB->pdu_index[CC_id],
                                         (uint8_t*)cc->MCH_pdu.payload);
-	
-
-	/*
-	   for (j=0;j<sdu_length_total;j++)
-	   printf("%2x.",RC.mac[module_idP]->MCH_pdu.payload[j+offset]);
-	   printf(" \n"); */
 	return 1;
     } else {
 	cc->MCH_pdu.Pdu_size = 0;
@@ -947,21 +1079,8 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
 	cc->MCH_pdu.msi_active = 0;
 	cc->MCH_pdu.mcch_active = 0;
 	cc->MCH_pdu.mtch_active = 0;
-	// for testing purpose, fill with random data
-	//for (j=0;j<(TBS-sdu_length_total-offset);j++)
-	//  RC.mac[module_idP]->MCH_pdu.payload[offset+sdu_length_total+j] = (char)(taus()&0xff);
 	return 0;
     }
-
-    //this is for testing
-    /*
-       if (mtch_flag == 1) {
-       //  LOG_D(MAC,"DUY: mch_buffer length so far is : %ld\n", &mch_buffer[sdu_length_total]-&mch_buffer[0]);
-       return 1;
-       }
-       else
-       return 0;
-     */
 }
 int
 schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h
index faefc481f65b393e70763202a2d3845764c3216c..7eccc6222d42718e67dcce60f5bf9ee18ed36ff9 100644
--- a/openair2/LAYER2/MAC/mac.h
+++ b/openair2/LAYER2/MAC/mac.h
@@ -56,6 +56,7 @@
 #include "LTE_MobilityControlInfo.h"
 #include "LTE_MBSFN-AreaInfoList-r9.h"
 #include "LTE_MBSFN-SubframeConfigList.h"
+#include "LTE_MBSFNAreaConfiguration-r9.h"
 #include "LTE_PMCH-InfoList-r9.h"
 #include "LTE_SCellToAddMod-r10.h"
 #include "LTE_SystemInformationBlockType1-v1310-IEs.h"
@@ -409,9 +410,11 @@ typedef struct {
 /*!\brief Values of BCCH SIB_BR logical channel (fake) */
 #define BCCH_SI_BR 7    // SI-BR
 /*!\brief Values of BCCH SIB1_MBMS logical channel (fake) */
-#define BCCH_SIB1_MBMS 60              // SIB1_MBMS //TODO better armonize index
+#define MIBCH_MBMS 10              // SIB1_MBMS //TODO better armonize index
+#define BCCH_SIB1_MBMS 12              // SIB1_MBMS //TODO better armonize index
 /*!\brief Values of BCCH SI_MBMS logical channel (fake) */
-#define BCCH_SI_MBMS 61                // SIB_MBMS //TODO better armonize index
+#define BCCH_SI_MBMS 13                // SIB_MBMS //TODO better armonize index
+#define MCCH_COUNTING 14
 /*!\brief Value of CCCH / SRB0 logical channel */
 #define CCCH 0      // srb0
 /*!\brief DCCH / SRB1 logical channel */
@@ -1286,6 +1289,8 @@ typedef struct {
   /// MBSFN SubframeConfig
   struct LTE_MBSFN_SubframeConfig *mbsfn_SubframeConfig[8];
   struct LTE_NonMBSFN_SubframeConfig_r14 *non_mbsfn_SubframeConfig;
+  struct LTE_MBSFN_SubframeConfig *commonSF_Alloc_r9_mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA?
+  uint8_t commonSF_AllocPeriod_r9;
   /// number of subframe allocation pattern available for MBSFN sync area
   uint8_t num_sf_allocation_pattern;
   /// MBMS Flag
diff --git a/openair2/LAYER2/MAC/mac_proto.h b/openair2/LAYER2/MAC/mac_proto.h
index 9d49fdffd5d7e5cb451b7346b7a0128a3f9c2ee6..b92ce85608fa726952fad9574589ac1ef3dde6e1 100644
--- a/openair2/LAYER2/MAC/mac_proto.h
+++ b/openair2/LAYER2/MAC/mac_proto.h
@@ -33,6 +33,16 @@
 #include "PHY/defs_common.h" // for PRACH_RESOURCES_t and lte_subframe_t
 #include "openair2/COMMON/mac_messages_types.h"
 
+/** \fn void schedule_fembms_mib(module_id_t module_idP,frame_t frameP,sub_frame_t subframe);
+\brief MIB scheduling for PBCH. This function requests the MIB from RRC and provides it to L1.
+@param Mod_id Instance ID of eNB
+@param frame Frame index
+@param subframe Subframe number on which to act
+
+*/
+
+void schedule_fembms_mib(module_id_t module_idP,
+		  frame_t frameP, sub_frame_t subframeP);
 
 /** \addtogroup _mac
  *  @{
@@ -532,6 +542,10 @@ int ue_query_mch(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
                  sub_frame_t subframe, uint8_t eNB_index,
                  uint8_t *sync_area, uint8_t *mcch_active);
 
+int ue_query_mch_fembms(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
+		 sub_frame_t subframe, uint8_t eNB_index,
+		 uint8_t * sync_area, uint8_t * mcch_active);
+
 
 /* \brief Called by PHY to get sdu for PUSCH transmission.  It performs the following operations: Checks BSR for DCCH, DCCH1 and DTCH corresponding to previous values computed either in SR or BSR procedures.  It gets rlc status indications on DCCH,DCCH1 and DTCH and forms BSR elements and PHR in MAC header.  CRNTI element is not supported yet.  It computes transport block for up to 3 SDUs and generates header and forms the complete MAC SDU.
 @param Mod_id Instance id of UE in machine
@@ -899,6 +913,7 @@ int generate_dlsch_header(unsigned char *mac_header,
 @param non_MBSFN_SubframeConfig pointer to FeMBMS Non MBSFN Subframe Config
 @param sib1_mbms_r14_fembms pointer SI Scheduling infomration for SI-MBMS
 @param mbsfn_AreaInfoList_fembms pointer to FeMBMS MBSFN Area Info list from SIB1-MBMS
+@param mbms_AreaConfiguration pointer to eMBMS MBSFN Area Configuration
 */
 
 int rrc_mac_config_req_eNB(module_id_t module_idP,
@@ -935,7 +950,8 @@ int rrc_mac_config_req_eNB(module_id_t module_idP,
                            LTE_SchedulingInfo_MBMS_r14_t *schedulingInfo_fembms,
                            struct LTE_NonMBSFN_SubframeConfig_r14 *nonMBSFN_SubframeConfig,
                            LTE_SystemInformationBlockType1_MBMS_r14_t   *sib1_mbms_r14_fembms,
-                           LTE_MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList_fembms
+                           LTE_MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList_fembms,
+			   LTE_MBSFNAreaConfiguration_r9_t * mbms_AreaConfiguration
                           );
 
 /** \brief RRC eNB Configuration primitive for PHY/MAC.  Allows configuration of PHY/MAC resources based on System Information (SI), RRCConnectionSetup and RRCConnectionReconfiguration messages.
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index 24630c0fe2cc8e095198e9ae9bdfd0c2d385ab56..e97f1bebddab7afaf76d161666b8dc5b159e7338 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -72,7 +72,10 @@ extern UL_IND_t *UL_INFO;
 extern int next_ra_frame;
 extern module_id_t next_Mod_id;
 
-int mbms_rab_id = 2047;
+int mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047};
+static int mbms_mch_i=0;
+//static int num_msi_per_CSA[28];
+
 
 /*
  *
@@ -753,8 +756,9 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
         LOG_E(MAC,"MCH Scheduling Information MAC Control Element should have an even size\n");
       }
 
-      LOG_D(MAC,"MCH Scheduling Information, len(%d)\n",rx_lengths[i]);
 
+      LOG_D(MAC,"MCH Scheduling Information, len(%d)\n",rx_lengths[i]);
+     
       for (j=0; j<rx_lengths[i]/2; j++) {
         uint16_t stop_mtch_val = ((uint16_t)(payload_ptr[2*j] & 0x07) << 8) | (uint16_t)payload_ptr[2*j+1];
         UE_mac_inst[module_idP].pmch_lcids[j] = (payload_ptr[2*j] & 0xF8) >> 3;
@@ -768,7 +772,7 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
         UE_mac_inst[module_idP].msi_status_v[j] = 0;
 
         if (UE_mac_inst[module_idP].mcch_status==1) {
-          LOG_D(MAC,"[UE %d] Frame %d : MCH->MSI for sync area %d (eNB %d, %d bytes), i(%d)\n", module_idP, frameP, sync_area, eNB_index, rx_lengths[i], UE_mac_inst[module_idP].pmch_stop_mtch[j]);
+          LOG_D(MAC,"[UE %d] Frame %d : MCH->MSI for sync area %d (eNB %d, %d bytes), LCID(%d)(%d)\n", module_idP, frameP, sync_area, eNB_index, rx_lengths[i], UE_mac_inst[module_idP].pmch_lcids[j] , UE_mac_inst[module_idP].pmch_stop_mtch[j]);
 
           if (UE_mac_inst[module_idP].pmch_stop_mtch[j] < 2043) {
             UE_mac_inst[module_idP].pmch_stop_mtch[j] += UE_mac_inst[module_idP].msi_current_alloc;
@@ -794,7 +798,7 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
       }
 
       if (j<28 && UE_mac_inst[module_idP].msi_status_v[j]==1) {
-        LOG_D(MAC,"[UE %d] Frame %d : MCH->MTCH for sync area %d (eNB %d, %d bytes), j=%d\n", module_idP, frameP, sync_area, eNB_index, rx_lengths[i], j);
+        LOG_D(MAC,"[UE %d] Frame %d : MCH->MTCH for sync area %d (eNB %d, %d bytes), j=%d lcid %d\n", module_idP, frameP, sync_area, eNB_index, rx_lengths[i], j,rx_lcids[i]);
         //This sucks I know ... workaround !
        mbms_rab_id = rx_lcids[i];
         //end sucks  :-(
@@ -951,7 +955,9 @@ int ue_query_p_mch_info(module_id_t module_idP, uint32_t frameP, uint32_t subfra
         }
       } else { //more that one MCH ?? check better this condition
         //msi and mtch are mutally excluded then the break is safe
+	//TODO
         if ((num_sf_alloc ==  UE_mac_inst[module_idP].pmch_Config[i-1]->sf_AllocEnd_r9 + 1) && (sf_AllocEnd_r9 >= (num_sf_alloc+1))) {
+        //if ((num_sf_alloc ==  UE_mac_inst[module_idP].pmch_Config[i-1]->sf_AllocEnd_r9) && (sf_AllocEnd_r9 >= (num_sf_alloc))) {
           //msi should be just after
           msi_flag = 1;
           LOG_D(MAC,"msi(%d) should be allocated:frame(%d),submframe(%d),num_sf_alloc(%d),sf_AllocEnd_r9(%d),common_num_sf_alloc(%d)\n",i,frameP,subframe,num_sf_alloc,sf_AllocEnd_r9,
@@ -986,6 +992,458 @@ int ue_query_p_mch_info(module_id_t module_idP, uint32_t frameP, uint32_t subfra
   return mtch_mcs;
 }
 
+//static int common_num_sf_alloc=0;
+//static int x=0;
+int ue_query_mch_fembms(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_t subframe, uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active) {
+  int i = 0, j = 0,/* ii = 0,*/ msi_pos = -1, mcch_mcs = -1, mtch_mcs = -1, l=0/*,ii=0*/;
+  int mcch_flag = 0, mtch_flag = 0, msi_flag = 0;
+  int alloc_offset=0;
+  uint32_t period;
+  //uint16_t num_non_mbsfn_SubframeConfig=0;
+  long mch_scheduling_period = -1;
+  uint8_t mch_lcid = 0;
+  //int first_pos=0;
+
+  if(UE_mac_inst[module_idP].non_mbsfn_SubframeConfig == NULL ) 
+	return -1;
+
+  int non_mbsfn_SubframeConfig = (UE_mac_inst[module_idP].non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]<<1 | UE_mac_inst[module_idP].non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]>>7);
+
+  period = 4<<UE_mac_inst[module_idP].non_mbsfn_SubframeConfig->radioFrameAllocationPeriod_r14;
+  alloc_offset = UE_mac_inst[module_idP].non_mbsfn_SubframeConfig->radioFrameAllocationOffset_r14;
+
+  long mcch_period  = 32 << UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9;
+  long mcch_offset        = UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9;
+
+  if (UE_mac_inst[module_idP].pmch_Config[0]) {
+    mch_scheduling_period = 8 << UE_mac_inst[module_idP].pmch_Config[0]->mch_SchedulingPeriod_r9;
+  }
+
+ 
+//  for(l=0;l<8;l++){
+//     if(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]!=NULL){
+//             if(frameP%(4<<UE_mac_inst[module_idP].commonSF_AllocPeriod_r9)==0){
+//		    first_pos=0;
+//  		    if((frameP&3)==0)
+//			first_pos++;
+//  		    while((non_mbsfn_SubframeConfig & (0x100 >> msi_pos)) == (0x100>>msi_pos))
+//			first_pos++;
+//		    if(first_pos == subframe){
+//                        ii=0;
+//                        while(UE_mac_inst[module_idP].pmch_Config[ii]!=NULL){
+//                                num_msi_per_CSA[ii]= ( ( 4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9) / (8 << UE_mac_inst[module_idP].pmch_Config[ii]->mch_SchedulingPeriod_r9)  );
+//                                ii++;
+//                                LOG_D(MAC,"frameP %d subframe %d num_msi_per_CSA[%d] %d\n",frameP,subframe,ii,num_msi_per_CSA[ii]);
+//                        }
+//		    }
+//
+//             }
+//     }
+//  }
+//
+
+  // get the real MCS value
+  switch (UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.signallingMCS_r9) {
+    case 0:
+      mcch_mcs = 2;
+      break;
+
+    case 1:
+      mcch_mcs = 7;
+      break;
+
+    case 2:
+      mcch_mcs = 13;
+      break;
+
+    case 3:
+      mcch_mcs = 19;
+      break;
+  }
+  LOG_D(MAC,"frameP %d subframe %d period %d alloc_offset %d mcch_mcs %d mcch_period %ld mcch_offset %ld buf %x mch_scheduling_period %ld\n",frameP, subframe, period, alloc_offset,mcch_mcs, mcch_period, mcch_offset,(UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0]),mch_scheduling_period);
+
+  if((frameP % period ) == alloc_offset){
+	switch(subframe){
+	case 0:
+		return (-1);
+	   break;
+	case 1:
+           if ((non_mbsfn_SubframeConfig & 0x100) > 0)
+		return (-1);
+	   break;
+	case 2:
+           if ((non_mbsfn_SubframeConfig & 0x80) > 0)
+		return (-1);
+	   break;
+	case 3:
+           if ((non_mbsfn_SubframeConfig & 0x40) > 0)
+		return (-1);
+	   break;
+	case 4:
+           if ((non_mbsfn_SubframeConfig & 0x20) > 0)
+		return (-1);
+	   break;
+	case 5:
+           if ((non_mbsfn_SubframeConfig & 0x10) > 0)
+		return (-1);
+	   break;
+	case 6:
+           if ((non_mbsfn_SubframeConfig & 0x8) > 0)
+		return (-1);
+	   break;
+	case 7:
+           if ((non_mbsfn_SubframeConfig & 0x4) > 0)
+		return (-1);
+	   break;
+	case 8:
+           if ((non_mbsfn_SubframeConfig & 0x2) > 0)
+		return (-1);
+	   break;
+	case 9:
+           if ((non_mbsfn_SubframeConfig & 0x1) > 0)
+		return (-1);
+	   break;
+	}
+  }
+
+  if (UE_mac_inst[module_idP].pmch_Config[0]) {
+    //  Find the first subframe in this MCH to transmit MSI
+    if (frameP % 1 == 0) {
+      if (frameP % mch_scheduling_period == 0) {
+	msi_pos=0;
+	if((frameP&3)==0)
+		msi_pos++;
+	while((non_mbsfn_SubframeConfig & (0x100 >> msi_pos)) == (0x100>>msi_pos))
+		msi_pos++;
+	if(msi_pos == subframe){
+		UE_mac_inst[module_idP].common_num_sf_alloc=0;
+		mbms_mch_i=0;
+		//LOG_W(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframe, msi_pos,mbms_mch_i);
+	}
+      }
+    }
+  }
+
+  if(UE_mac_inst[module_idP].pmch_Config[mbms_mch_i+1]!=NULL){
+	if( UE_mac_inst[module_idP].common_num_sf_alloc == UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+		msi_pos=subframe;
+		mbms_mch_i++;
+	//	LOG_W(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframe, msi_pos,mbms_mch_i);
+	}
+  }
+
+
+        // Check if the subframe is for MSI, MCCH or MTCHs and Set the correspoding flag to 1
+  switch (subframe) {
+    case 0:
+          if (msi_pos == 0) {
+            msi_flag = 1;
+          }
+          mtch_flag = 1;
+      break;
+    case 1:
+          if (msi_pos == 1) {
+            msi_flag = 1;
+          }
+          if ((frameP % mcch_period == mcch_offset) &&
+              ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1)) {
+            mcch_flag = 1;
+          }
+
+          mtch_flag = 1;
+      break;
+
+    case 2:
+          if (msi_pos == 2) {
+            msi_flag = 1;
+          }
+          if ((frameP % mcch_period == mcch_offset) &&
+              ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2)) {
+            mcch_flag = 1;
+          }
+
+          mtch_flag = 1;
+
+      break;
+
+    case 3:
+          if (msi_pos == 3) {
+            msi_flag = 1;
+          }
+          if ((frameP % mcch_period == mcch_offset) &&
+              ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3)) {
+            mcch_flag = 1;
+          }
+
+          mtch_flag = 1;
+
+      break;
+    case 4:
+          if (msi_pos == 4) {
+            msi_flag = 1;
+          }
+          mtch_flag = 1;
+      break;
+    case 5:
+          if (msi_pos == 5) {
+            msi_flag = 1;
+          }
+          mtch_flag = 1;
+      break;
+
+    case 6:
+          if (msi_pos == 6) {
+            msi_flag = 1;
+          }
+          if ((frameP % mcch_period == mcch_offset) &&
+              ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6)) {
+            mcch_flag = 1;
+          }
+
+          mtch_flag = 1;
+
+      break;
+
+    case 7:
+          if (msi_pos == 7) {
+            msi_flag = 1;
+          }
+          if ((frameP % mcch_period == mcch_offset) &&
+              ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7)) {
+            mcch_flag = 1;
+          }
+
+          mtch_flag = 1;
+
+      break;
+
+    case 8:
+          if (msi_pos == 8) {
+            msi_flag = 1;
+          }
+          if ((frameP % mcch_period == mcch_offset) &&
+              ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8)) {
+            mcch_flag = 1;
+          }
+
+          mtch_flag = 1;
+      break;
+
+    case 9:
+          if (msi_pos == 9) {
+            msi_flag = 1;
+          }
+          mtch_flag = 1;
+      break;
+  }// end switch
+
+  if( (msi_flag == 1) || (mcch_flag == 1) || (mtch_flag == 1) ){
+	UE_mac_inst[module_idP].common_num_sf_alloc++;
+	//if( (msi_flag!=1 && mcch_flag!=1) || (msi_flag!=1 && mcch_flag!=1 && mtch_flag!=1)  ){
+		//UE_mac_inst[module_idP].common_num_sf_alloc++;
+                //if(msi_flag == 1)
+                //   if((num_msi_per_CSA[mbms_mch_i]--)==0){
+                //           LOG_E(MAC,"Both MSI and MTCH Should be reset?\n");
+                //           msi_flag=0;
+                //}
+	//}
+ 
+  }
+
+
+
+  
+#ifdef OLD
+          // Acount for sf_allocable in CSA
+        int num_sf_alloc = 0;
+
+        for (l = 0; l < 8; l++) {
+          if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l] == NULL)
+            continue;
+
+          if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.present != LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame)
+            continue;
+
+          uint32_t common_mbsfn_SubframeConfig = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.choice.oneFrame.buf[0];
+
+
+          for (j = 0; j < 6; j++)
+            num_sf_alloc += ((common_mbsfn_SubframeConfig & (0x80 >> j)) == (0x80 >> j));
+            //num_sf_alloc=1;
+        }
+	
+	num_sf_alloc = 10;
+
+        num_non_mbsfn_SubframeConfig = (UE_mac_inst[module_idP].non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]<<1 | UE_mac_inst[module_idP].non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]>>7);
+	int ones=0;
+	for(j=0; j < 16; j++){
+		if(num_non_mbsfn_SubframeConfig & 1)
+			ones++;
+		num_non_mbsfn_SubframeConfig>>=1;
+	}
+
+        for (l = 0; l < 28; l++) {
+          if (UE_mac_inst[module_idP].pmch_stop_mtch[l] >= 1/*num_sf_alloc*/) {
+            if (UE_mac_inst[module_idP].pmch_stop_mtch[l] != 2047) {
+              if (UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch] != NULL){
+                mtch_mcs = UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch]->dataMCS_r9;
+    	       //int common_mbsfn_alloc_offset = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]->radioframeAllocationOffset;
+               long common_mbsfn_period  = 1 << UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]->radioframeAllocationPeriod;
+               long commonSF_AllocPeriod = 4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9;
+               if(UE_mac_inst[module_idP].common_num_sf_alloc >= UE_mac_inst[module_idP].pmch_stop_mtch[l]){
+                       //LOG_E(MAC,"Attemp to UE_mac_inst[module_idP].common_num_sf_alloc %d\n",UE_mac_inst[module_idP].common_num_sf_alloc);
+
+                       mtch_mcs = -1;
+               }/*else
+                       OG_W(MAC,"Attemp to UE_mac_inst[module_idP].common_num_sf_alloc %d\n",UE_mac_inst[module_idP].common_num_sf_alloc);*/
+                       LOG_D(MAC,"Attemp to UE_mac_inst[module_idP].common_num_sf_alloc %d num_sf_alloc %d commonSF_AllocPeriod %ld, common_mbsfn_period %ld num_non_mbsfn_SubframeConfig %x ones %d\n",UE_mac_inst[module_idP].common_num_sf_alloc,num_sf_alloc, commonSF_AllocPeriod,common_mbsfn_period,num_non_mbsfn_SubframeConfig,ones);
+                UE_mac_inst[module_idP].common_num_sf_alloc++;
+                UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc % (num_sf_alloc * commonSF_AllocPeriod / common_mbsfn_period-(1+ones)*(commonSF_AllocPeriod/4)); //TODO
+              }
+              else
+                mtch_mcs = -1;
+
+              mch_lcid = (uint8_t)l;
+              break;
+            }
+          }
+        }
+#endif
+
+{
+ 	 // Acount for sf_allocable in Common SF Allocation
+ 	 int num_sf_alloc = 0;
+
+	 for (l = 0; l < 8; l++) {
+          if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l] == NULL)
+            continue;
+
+          if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.present != LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame)
+            continue;
+
+    	  //int common_mbsfn_alloc_offset = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->radioframeAllocationOffset;
+          long common_mbsfn_period  = 1 << UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->radioframeAllocationPeriod;
+          long commonSF_AllocPeriod = 4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9;
+
+
+  	  num_sf_alloc =10*commonSF_AllocPeriod/common_mbsfn_period;
+  	  num_sf_alloc -=1*((commonSF_AllocPeriod/common_mbsfn_period)/4); //CAS sfs
+          uint32_t num_non_mbsfn_SubframeConfig2 = (UE_mac_inst[module_idP].non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]<<1 | UE_mac_inst[module_idP].non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]>>7);
+  	  for (j = 0; j < 10; j++)
+      		num_sf_alloc -= ((num_non_mbsfn_SubframeConfig2 & (0x200 >> j)) == (0x200 >> j))*((commonSF_AllocPeriod/common_mbsfn_period)/period);
+
+	  }
+	
+	 for (l = 0; l < 8; l++) {
+          if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l] == NULL)
+            continue;
+
+          if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.present != LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame)
+            continue;
+
+    	  //int common_mbsfn_alloc_offset = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->radioframeAllocationOffset;
+          long common_mbsfn_period  = 1 << UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->radioframeAllocationPeriod;
+          //long commonSF_AllocPeriod = 4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9;
+
+         
+	  if(msi_flag==1 && UE_mac_inst[module_idP].pmch_Config[mbms_mch_i] != NULL){
+                LOG_D(MAC,"msi(%d) should be allocated:frame(%d),submframe(%d),num_sf_alloc(%d),sf_AllocEnd_r9(%ld),common_num_sf_alloc(%d)\n",mbms_mch_i,frameP,subframe,num_sf_alloc,UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->sf_AllocEnd_r9,
+                UE_mac_inst[module_idP].common_num_sf_alloc);
+          	UE_mac_inst[module_idP].msi_current_alloc = UE_mac_inst[module_idP].common_num_sf_alloc;//num_sf_alloc;
+          	UE_mac_inst[module_idP].msi_pmch = mbms_mch_i;
+	  }else if(UE_mac_inst[module_idP].pmch_Config[mbms_mch_i] != NULL){
+	          if (UE_mac_inst[module_idP].pmch_stop_mtch[mbms_mch_i] >= UE_mac_inst[module_idP].common_num_sf_alloc/*num_sf_alloc*/) {
+	            if (UE_mac_inst[module_idP].pmch_stop_mtch[mbms_mch_i] != 2047) {
+	              mtch_flag = 1;
+	              if (UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch] != NULL)
+	                mtch_mcs = UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch]->dataMCS_r9;
+	              else
+	                mtch_mcs = -1;
+	              mch_lcid = (uint8_t)mbms_mch_i;
+	              LOG_D(MAC,"mtch should be allocated:frame(%d),submframe(%d),num_sf_alloc(%d),mtch_mcs(%d),pmch_stop_mtch(%d),lcid(%d),msi_pmch(%d)\n",frameP,subframe,num_sf_alloc,mtch_mcs,
+	                    UE_mac_inst[module_idP].pmch_stop_mtch[mbms_mch_i],UE_mac_inst[module_idP].pmch_lcids[mbms_mch_i],UE_mac_inst[module_idP].msi_pmch);
+	            }
+	          }
+	  }
+  	  UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc % ((num_sf_alloc-mbms_mch_i) /** commonSF_AllocPeriod *// common_mbsfn_period);//48;
+
+	  if(mtch_flag)
+		break;
+	}
+	if(msi_flag==1){
+		 for (l = 0; l < 8; l++) {
+          		if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l] == NULL)
+            		continue;
+
+		        if ( (/*AJ*/ (/*V*/ ( /*U*/ (frameP %(4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9)) ) / 8 ) % ((8 <<UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->mch_SchedulingPeriod_r9) / 8 ) ) != 0 ){
+                                       msi_flag=0;
+                                       LOG_D(MAC,"frameP %d subframeP %d reset(%d)\n",frameP, subframe, mbms_mch_i);
+                        }
+		}
+	}
+}
+
+  // sf allocation is non-overlapping
+  if ((msi_flag==1) || (mcch_flag==1) || (mtch_flag==1)) {
+    LOG_D(MAC,"[UE %d] Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
+          module_idP, frameP, subframe,l,j,msi_flag,mcch_flag,mtch_flag);
+    *sync_area=i;
+  }
+
+  //if(msi_flag == 1)
+  //   if((num_msi_per_CSA[mbms_mch_i]--)==0){
+  //           LOG_E(MAC,"Both MSI and MTCH Should be reset?\n");
+  //           msi_flag=mtch_flag=0;
+  //}
+
+
+  if ((mcch_flag == 1)) { // || (msi_flag==1))
+    *mcch_active = 1;
+  }
+
+  if ( (mcch_flag==1) || ((msi_flag==1) && (UE_mac_inst[module_idP].mcch_status==1)) ) {
+    if (msi_flag!=1) {
+      for (i=0; i<8; i++)
+        UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] = NULL;
+
+      for (i=0; i<15; i++)
+        UE_mac_inst[module_idP].pmch_Config[i] = NULL;
+
+      for (i=0; i<28 ; i++) {
+        UE_mac_inst[module_idP].pmch_lcids[i] = -1;
+        UE_mac_inst[module_idP].pmch_stop_mtch[i] = 2047;
+        UE_mac_inst[module_idP].msi_status_v[i] = 0;
+      }
+    } else {
+      for (i=0; i<28; i++) {
+        UE_mac_inst[module_idP].pmch_lcids[i] = -1;
+        UE_mac_inst[module_idP].pmch_stop_mtch[i] = 2047;
+        UE_mac_inst[module_idP].msi_status_v[i] = 0;
+      }
+    }
+
+    return mcch_mcs;
+  } else if ((mtch_flag==1) && (UE_mac_inst[module_idP].msi_status_v[(mch_lcid > 27) ? 27 : mch_lcid] == 1)) {
+    return mtch_mcs;
+  } else {
+    return -1;
+  }
+  
+
+
+ // if(mcch_flag == 1 || msi_flag == 1 ){
+ //       *mcch_active = 1;
+ //       return (mcch_mcs);
+ // }else if(mtch_flag == 1){
+ //       mtch_mcs=-1;
+ //       return (mtch_mcs);
+ // } 
+
+ // return -1;
+
+}
+
+
 int ue_query_p_mch(module_id_t module_idP, uint32_t frameP, uint32_t subframe, int *mtch_active, int *msi_active, uint8_t *mch_lcid) {
   int i, j, mtch_mcs = -1;
   int mtch_flag = 0;
@@ -1100,6 +1558,7 @@ int ue_query_p_mch(module_id_t module_idP, uint32_t frameP, uint32_t subframe, i
   return mtch_mcs;
 }
 
+
 int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_t subframe, uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active) {
   int i = 0, j = 0, ii = 0, jj = 0, msi_pos = 0, mcch_mcs = -1, mtch_mcs = -1;
   int l =0;
@@ -1162,6 +1621,11 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
               ii = UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & (0x80 >> msi_pos);
               msi_pos++;
             }
+	    if(msi_pos == subframe){
+	    	UE_mac_inst[module_idP].common_num_sf_alloc=0;
+	    	mbms_mch_i=0;
+	    	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframe, msi_pos,mbms_mch_i);
+	    }
           }
         }
 
@@ -1170,6 +1634,14 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
           case 1:
             if (UE_mac_inst[module_idP].tdd_Config == NULL) {
               if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) {
+		if(UE_mac_inst[module_idP].pmch_Config[mbms_mch_i+1]!=NULL){
+	      	   if( UE_mac_inst[module_idP].common_num_sf_alloc == UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+	      	   	msi_pos=1;
+	      	   	mbms_mch_i++;
+	      	   	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframe, msi_pos,mbms_mch_i);
+	      	   }
+		}
+
                 if (msi_pos == 1) {
                   msi_flag = 1;
                 }
@@ -1188,6 +1660,14 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
           case 2:
             if (UE_mac_inst[module_idP].tdd_Config == NULL) {
               if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) {
+		if(UE_mac_inst[module_idP].pmch_Config[mbms_mch_i+1]!=NULL){
+	      	   if( UE_mac_inst[module_idP].common_num_sf_alloc == UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+	      	   	msi_pos=2;
+	      	   	mbms_mch_i++;
+	      	   	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframe, msi_pos,mbms_mch_i);
+	      	   }
+		}
+
                 if (msi_pos == 2) {
                   msi_flag = 1;
                 }
@@ -1219,6 +1699,14 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
               }
             } else { // FDD
               if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) {
+		if(UE_mac_inst[module_idP].pmch_Config[mbms_mch_i+1]!=NULL){
+	      	   if( UE_mac_inst[module_idP].common_num_sf_alloc == UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+	      	   	msi_pos=3;
+	      	   	mbms_mch_i++;
+	      	   	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframe, msi_pos,mbms_mch_i);
+	      	   }
+		}
+
                 if (msi_pos == 3) {
                   msi_flag = 1;
                 }
@@ -1255,6 +1743,14 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
           case 6:
             if (UE_mac_inst[module_idP].tdd_Config == NULL) {
               if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) {
+		if(UE_mac_inst[module_idP].pmch_Config[mbms_mch_i+1]!=NULL){
+	      	   if( UE_mac_inst[module_idP].common_num_sf_alloc == UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+	      	   	msi_pos=6;
+	      	   	mbms_mch_i++;
+	      	   	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframe, msi_pos,mbms_mch_i);
+	      	   }
+		}
+
                 if (msi_pos == 4) {
                   msi_flag = 1;
                 }
@@ -1286,6 +1782,14 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
               }
             } else { // FDD
               if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) {
+		if(UE_mac_inst[module_idP].pmch_Config[mbms_mch_i+1]!=NULL){
+	      	   if( UE_mac_inst[module_idP].common_num_sf_alloc == UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+	      	   	msi_pos=5;
+	      	   	mbms_mch_i++;
+	      	   	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframe, msi_pos,mbms_mch_i);
+	      	   }
+		}
+
                 if (msi_pos == 5) {
                   msi_flag = 1;
                 }
@@ -1317,6 +1821,13 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
               }
             } else { // FDD
               if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) {
+		if(UE_mac_inst[module_idP].pmch_Config[mbms_mch_i+1]!=NULL){
+	      	   if( UE_mac_inst[module_idP].common_num_sf_alloc == UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->sf_AllocEnd_r9){
+	      	   	msi_pos=6;
+	      	   	mbms_mch_i++;
+	      	   	LOG_D(MAC,"MSP, frameP %d subframeP %d msi_pos(%d) mbms_mch_i %d\n",frameP, subframe, msi_pos,mbms_mch_i);
+	      	   }
+		}
                 if (msi_pos == 6) {
                   msi_flag = 1;
                 }
@@ -1351,6 +1862,14 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
             break;
         }// end switch
 
+ if( (msi_flag == 1) || (mcch_flag == 1) || (mtch_flag == 1) ){
+	UE_mac_inst[module_idP].common_num_sf_alloc++;
+	//if( (msi_flag!=1 && mcch_flag!=1) || (msi_flag!=1 && mcch_flag!=1 && mtch_flag!=1)  ){
+		//UE_mac_inst[module_idP].common_num_sf_alloc++;
+	//}
+  }
+
+#ifdef OLD
         // Acount for sf_allocable in CSA
         int num_sf_alloc = 0;
 
@@ -1392,11 +1911,86 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
             }
           }
         }
+#endif
+
+{
+ 	 // Acount for sf_allocable in Common SF Allocation
+ 	 int num_sf_alloc = 0;
+
+	 for (l = 0; l < 8; l++) {
+             if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l] == NULL)
+               continue;
+
+             if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.present != LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame)
+               continue;
+
+    	     //int common_mbsfn_alloc_offset = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->radioframeAllocationOffset;
+             //long common_mbsfn_period  = 1 << UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->radioframeAllocationPeriod;
+             //long commonSF_AllocPeriod = 4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9;
+
+ 	     uint32_t common_mbsfn_SubframeConfig = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.choice.oneFrame.buf[0];
+
+             for (j = 0; j < 6; j++)
+               num_sf_alloc += ((common_mbsfn_SubframeConfig & (0x80 >> j)) == (0x80 >> j));
+	  }
+
+	
+	 for (l = 0; l < 8; l++) {
+            if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l] == NULL)
+              continue;
+
+            if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.present != LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame)
+              continue;
+
+    	    //int common_mbsfn_alloc_offset = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->radioframeAllocationOffset;
+            long common_mbsfn_period  = 1 << UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->radioframeAllocationPeriod;
+            long commonSF_AllocPeriod = 4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9;
+
+           
+	    if(msi_flag==1 && UE_mac_inst[module_idP].pmch_Config[mbms_mch_i] != NULL){
+                  LOG_D(MAC,"msi(%d) should be allocated:frame(%d),submframe(%d),num_sf_alloc(%d),sf_AllocEnd_r9(%ld),common_num_sf_alloc(%d)\n",mbms_mch_i,frameP,subframe,num_sf_alloc,UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->sf_AllocEnd_r9,
+                  UE_mac_inst[module_idP].common_num_sf_alloc);
+            	  UE_mac_inst[module_idP].msi_current_alloc = UE_mac_inst[module_idP].common_num_sf_alloc;//num_sf_alloc;
+            	  UE_mac_inst[module_idP].msi_pmch = mbms_mch_i;
+	    }else if(UE_mac_inst[module_idP].pmch_Config[mbms_mch_i] != NULL){
+	            if (UE_mac_inst[module_idP].pmch_stop_mtch[mbms_mch_i] >= UE_mac_inst[module_idP].common_num_sf_alloc/*num_sf_alloc*/) {
+	              if (UE_mac_inst[module_idP].pmch_stop_mtch[mbms_mch_i] != 2047) {
+	                mtch_flag = 1;
+	                if (UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch] != NULL)
+	                  mtch_mcs = UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch]->dataMCS_r9;
+	                else
+	                  mtch_mcs = -1;
+	                mch_lcid = (uint8_t)mbms_mch_i;
+	                LOG_D(MAC,"mtch should be allocated:frame(%d),submframe(%d),num_sf_alloc(%d),mtch_mcs(%d),pmch_stop_mtch(%d),lcid(%d),msi_pmch(%d)\n",frameP,subframe,num_sf_alloc,mtch_mcs,
+	                      UE_mac_inst[module_idP].pmch_stop_mtch[mbms_mch_i],UE_mac_inst[module_idP].pmch_lcids[mbms_mch_i],UE_mac_inst[module_idP].msi_pmch);
+	              }
+	            }
+	    }
+	    //LOG_D(MAC,"UE_mac_inst[module_idP].common_num_sf_alloc: %d num_sf_alloc %d mbms_mch_i %d commonSF_AllocPeriod %d common_mbsfn_period %d\n",UE_mac_inst[module_idP].common_num_sf_alloc,num_sf_alloc,mbms_mch_i,commonSF_AllocPeriod,common_mbsfn_period);
+  	    UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc % ((num_sf_alloc* commonSF_AllocPeriod-mbms_mch_i) / common_mbsfn_period);//48;
+	    
+
+	    if(mtch_flag)
+	  	break;
+	}
+	if(msi_flag==1){
+		 for (l = 0; l < 8; l++) {
+          		if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l] == NULL)
+            		continue;
+
+		        if ( (/*AJ*/ (/*V*/ ( /*U*/ (frameP %(4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9)) ) / 8 ) % ((8 <<UE_mac_inst[module_idP].pmch_Config[mbms_mch_i]->mch_SchedulingPeriod_r9) / 8 ) ) != 0 ){
+                                       msi_flag=0;
+                                       LOG_D(MAC,"frameP %d subframeP %d reset(%d)\n",frameP, subframe, mbms_mch_i);
+                        }
+		}
+	}
+
+}
 
         // sf allocation is non-overlapping
         if ((msi_flag==1) || (mcch_flag==1) || (mtch_flag==1)) {
-          LOG_D(MAC,"[UE %d] Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
-                module_idP, frameP, subframe,l,j,msi_flag,mcch_flag,mtch_flag);
+          LOG_D(MAC,"[UE %d] Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d x %d\n",
+                module_idP, frameP, subframe,l,j,msi_flag,mcch_flag,mtch_flag,UE_mac_inst[module_idP].common_num_sf_alloc);
           *sync_area=i;
           break;
         }
diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c
index 5a9620ed010a45edfeb9d7e614e64d062065a41c..bc98e16d39ef07c091affba1b6b72beeb90d09b5 100755
--- a/openair2/LAYER2/NR_MAC_UE/config_ue.c
+++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c
@@ -34,7 +34,6 @@
 #include "NR_MAC_UE/mac_proto.h"
 #include "NR_MAC-CellGroupConfig.h"
 #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
-#include "SCHED_NR/phy_frame_config_nr.h"
 
 int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg,
                          int mu,
@@ -326,6 +325,84 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
 
 }
 
+/** \brief This function is relavant for the UE procedures for control. It loads the search spaces, the BWPs and the CORESETs into the MAC instance and
+    \brief performs assert checks on the relevant RRC configuration.
+    @param NR_UE_MAC_INST_t mac: pointer to local MAC instance
+    @returns void
+    */
+void config_control_ue(NR_UE_MAC_INST_t *mac){
+
+  uint8_t bwp_id = 1, coreset_id = 1, ss_id;
+  NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
+  AssertFatal(scd->downlinkBWP_ToAddModList != NULL, "downlinkBWP_ToAddModList is null\n");
+  AssertFatal(scd->downlinkBWP_ToAddModList->list.count == 1, "downlinkBWP_ToAddModList->list->count is %d\n", scd->downlinkBWP_ToAddModList->list.count);
+
+  NR_BWP_DownlinkCommon_t *bwp_Common = scd->downlinkBWP_ToAddModList->list.array[bwp_id - 1]->bwp_Common;
+  AssertFatal(bwp_Common != NULL, "bwp_Common is null\n");
+
+  NR_BWP_DownlinkDedicated_t *dl_bwp_Dedicated = scd->downlinkBWP_ToAddModList->list.array[bwp_id - 1]->bwp_Dedicated;
+  AssertFatal(dl_bwp_Dedicated != NULL, "dl_bwp_Dedicated is null\n");
+
+  NR_SetupRelease_PDCCH_Config_t *pdcch_Config = dl_bwp_Dedicated->pdcch_Config;
+  AssertFatal(pdcch_Config != NULL, "pdcch_Config is null\n");
+
+  NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
+  AssertFatal(pdcch_ConfigCommon != NULL, "pdcch_ConfigCommon is null\n");
+  AssertFatal(pdcch_ConfigCommon->choice.setup->ra_SearchSpace != NULL, "ra_SearchSpace must be available in DL BWP\n");
+
+  struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
+  AssertFatal(commonSearchSpaceList != NULL, "commonSearchSpaceList is null\n");
+  AssertFatal(commonSearchSpaceList->list.count > 0, "PDCCH CSS list has 0 elements\n");
+
+  struct NR_PDCCH_Config__controlResourceSetToAddModList *controlResourceSetToAddModList = pdcch_Config->choice.setup->controlResourceSetToAddModList;
+  AssertFatal(controlResourceSetToAddModList != NULL, "controlResourceSetToAddModList is null\n");
+  AssertFatal(controlResourceSetToAddModList->list.count == 1, "controlResourceSetToAddModList->list.count=%d\n", controlResourceSetToAddModList->list.count);
+  AssertFatal(controlResourceSetToAddModList->list.array[0] != NULL, "coreset[0][0] is null\n");
+
+  struct NR_PDCCH_Config__searchSpacesToAddModList *searchSpacesToAddModList = pdcch_Config->choice.setup->searchSpacesToAddModList;
+  AssertFatal(searchSpacesToAddModList != NULL, "searchSpacesToAddModList is null\n");
+  AssertFatal(searchSpacesToAddModList->list.count > 0, "list of UE specifically configured Search Spaces is empty\n");
+  AssertFatal(searchSpacesToAddModList->list.count < FAPI_NR_MAX_SS_PER_CORESET, "too many searchpaces per coreset %d\n", searchSpacesToAddModList->list.count);
+
+  struct NR_UplinkConfig__uplinkBWP_ToAddModList *uplinkBWP_ToAddModList = scd->uplinkConfig->uplinkBWP_ToAddModList;
+  AssertFatal(uplinkBWP_ToAddModList != NULL, "uplinkBWP_ToAddModList is null\n");
+  AssertFatal(uplinkBWP_ToAddModList->list.count == 1, "uplinkBWP_ToAddModList->list->count is %d\n", uplinkBWP_ToAddModList->list.count);
+
+  // check pdcch_Config, pdcch_ConfigCommon and DL BWP
+  mac->DLbwp[0] = scd->downlinkBWP_ToAddModList->list.array[bwp_id - 1];
+  mac->coreset[bwp_id - 1][coreset_id - 1] = controlResourceSetToAddModList->list.array[0];
+
+  // Check dedicated UL BWP and pass to MAC
+  mac->ULbwp[0] = uplinkBWP_ToAddModList->list.array[0];
+  AssertFatal(mac->ULbwp[0]->bwp_Dedicated != NULL, "UL bwp_Dedicated is null\n");
+
+  // check available Search Spaces in the searchSpacesToAddModList and pass to MAC
+  // note: the network configures at most 10 Search Spaces per BWP per cell (including UE-specific and common Search Spaces).
+  for (ss_id = 0; ss_id < searchSpacesToAddModList->list.count; ss_id++) {
+    NR_SearchSpace_t *ss = searchSpacesToAddModList->list.array[ss_id];
+    AssertFatal(ss->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n");
+    AssertFatal(ss->searchSpaceType != NULL, "ss->searchSpaceType is null\n");
+    AssertFatal(*ss->controlResourceSetId == mac->coreset[bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n");
+    AssertFatal(ss->monitoringSymbolsWithinSlot != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot is null\n");
+    AssertFatal(ss->monitoringSymbolsWithinSlot->buf != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot->buf is null\n");
+    mac->SSpace[0][0][ss_id] = ss;
+  }
+
+  // Check available CSSs in the commonSearchSpaceList (list of additional common search spaces)
+  // note: commonSearchSpaceList SIZE(1..4)
+  for (int css_id = 0; css_id < commonSearchSpaceList->list.count; css_id++) {
+    NR_SearchSpace_t *css = commonSearchSpaceList->list.array[css_id];
+    AssertFatal(css->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n");
+    AssertFatal(*css->controlResourceSetId == mac->coreset[bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n");
+    AssertFatal(css->searchSpaceId != 0, "css->searchSpaceId is 0\n");
+    AssertFatal(css->searchSpaceType != NULL, "css->searchSpaceType is null\n");
+    AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n");
+    AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n");
+    mac->SSpace[0][0][ss_id] = css;
+    ss_id++;
+  }
+}
+
 int nr_rrc_mac_config_req_ue(
     module_id_t                     module_id,
     int                             cc_idP,
@@ -338,16 +415,16 @@ int nr_rrc_mac_config_req_ue(
 
     NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
 
-    //    NR_ServingCellConfig_t *serving_cell_config = spcell_configP->spCellConfigDedicated;
     //  TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc.
 
-
     if(mibP != NULL){
       mac->mib = mibP;    //  update by every reception
     }
 
     if(cell_group_config != NULL ){
+      mac->scg = cell_group_config;
       mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex;
+      config_control_ue(mac);
       if (cell_group_config->spCellConfig->reconfigurationWithSync) {
         mac->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
 	mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
@@ -355,7 +432,6 @@ int nr_rrc_mac_config_req_ue(
 	mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity;
 	LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti);
       }
-      mac->scg = cell_group_config;
 
       /*      
       if(mac_cell_group_configP != NULL){
@@ -420,8 +496,8 @@ int nr_rrc_mac_config_req_ue(
 	}
       }
       */
-    }   
-    
+    }
+
     return 0;
 
 }
diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h
index 5775e5bfb913a7cf73fe6dec3f56d1f887126102..e45f6a9b695873b1bbb3ca8753150b6269a1379f 100755
--- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h
+++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h
@@ -178,7 +178,6 @@ typedef struct {
   SFN_C_TYPE type0_pdcch_ss_sfn_c;
   uint32_t type0_pdcch_ss_n_c;
   uint32_t type0_pdcch_consecutive_slots;
-  int rnti_type;
 
   /* PDUs */
   /// Outgoing CCCH pdu for PHY
@@ -222,11 +221,6 @@ typedef struct {
   uint32_t RA_tx_frame;
   /// Random-access variable for window calculation (subframe of last change in window counter)
   uint8_t RA_tx_subframe;
-  /// Scheduled RX frame for RA Msg2
-  uint16_t msg2_rx_frame;
-  /// Scheduled RX slot for RA Msg2
-  uint16_t msg2_rx_slot;
-  /// Random-access Group B maximum path-loss
   /// Random-access variable for backoff (frame of last change in backoff counter)
   uint32_t RA_backoff_frame;
   /// Random-access variable for backoff (subframe of last change in backoff counter)
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
index 56ae14f98b8760d0708ebf9684a3b6fa060da999..351bcc292f73cd68852ba775f06a9a7a873333dc 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
@@ -62,9 +62,8 @@
 #include "NR_MAC_COMMON/nr_mac.h"
 #include "LAYER2/NR_MAC_UE/mac_proto.h"
 
-extern int64_t table_6_3_3_2_2_prachConfig_Index [256][9];
 extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9];
-extern const uint16_t nr_slots_per_frame[5];
+extern const uint8_t nr_slots_per_frame[5];
 
 //extern uint8_t  nfapi_mode;
 
@@ -360,11 +359,11 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
 
   uint8_t sdu_lcids[NB_RB_MAX] = {0};
   uint16_t sdu_lengths[NB_RB_MAX] = {0};
-  int TBS_bytes = 848, header_length_total, num_sdus, offset, preambleTransMax, mac_ce_len;
+  int TBS_bytes = 848, header_length_total=0, num_sdus, offset, preambleTransMax, mac_ce_len;
 
   AssertFatal(CC_id == 0,"Transmission on secondary CCs is not supported yet\n");
 
-  if (UE_mode == PRACH && prach_resources->init_msg1) {
+  if (UE_mode < PUSCH && prach_resources->init_msg1) {
 
     LOG_D(MAC, "nr_ue_get_rach, RA_active value: %d", mac->RA_active);
 
@@ -449,7 +448,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
         nr_get_RA_window(mac);
 
         // Fill in preamble and PRACH resources
-        if (mac->generate_nr_prach)
+        if (mac->generate_nr_prach == 1)
           nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 1, prach_resources, rach_ConfigDedicated);
 
         offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus,              // sdus buffer
@@ -471,7 +470,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
             payload[offset + j] = 0; // mac_pdu[offset + j] = 0;
         }
       } 
-    } else { // RACH is active
+    } else if (mac->RA_window_cnt != -1) { // RACH is active
 
       ////////////////////////////////////////////////////////////////
       /////* Random Access Response reception (5.1.4 TS 38.321) */////
@@ -482,7 +481,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
       // - handle beam failure recovery request
       // - handle DL assignment on PDCCH for RA-RNTI
       // - handle backoff and raResponseWindow params
-      // - disabled contention resolution as OAI NSA is contention-free based
 
       // LOG_D(MAC, "[MAC][UE %d][RAPROC] frame %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n",
       //   mod_id, frame, nr_tti_tx, mac->RA_window_cnt, mac->RA_tx_frame, mac->RA_tx_subframe);
@@ -495,12 +493,13 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
 
       if (mac->RA_window_cnt >= 0 && mac->RA_RAPID_found == 1) {
 
-        // mac->ra_state = WAIT_CONTENTION_RESOLUTION;
-        LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR successfully received \n", mod_id, frame, nr_tti_tx);
+        mac->RA_window_cnt = -1;
+        mac->ra_state = RA_SUCCEEDED;
+        LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: nr_tti_tx %d: RAR successfully received \n", mod_id, frame, nr_tti_tx);
 
       } else if (mac->RA_window_cnt == 0 && !mac->RA_RAPID_found) {
 
-        LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR reception failed \n", mod_id, frame, nr_tti_tx);
+        LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: nr_tti_tx %d: RAR reception failed \n", mod_id, frame, nr_tti_tx);
 
         mac->ra_state = RA_UE_IDLE;
         mac->RA_PREAMBLE_TRANSMISSION_COUNTER++;
@@ -572,21 +571,21 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
         // mac->RA_tx_subframe = nr_tti_tx;
 
         // Fill in preamble and PRACH resources
-        if (mac->generate_nr_prach)
+        if (mac->generate_nr_prach == 1)
           nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, prach_resources, rach_ConfigDedicated);
 
       } else {
 
         mac->RA_window_cnt--;
 
-        LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR reception not successful, (RA window count %d) \n",
+        LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: nr_tti_tx %d: RAR reception not successful, (RA window count %d) \n",
           mod_id,
           frame,
           nr_tti_tx,
           mac->RA_window_cnt);
 
         // Fill in preamble and PRACH resources
-        if (mac->generate_nr_prach)
+        if (mac->generate_nr_prach == 1)
           nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, prach_resources, rach_ConfigDedicated);
 
       }
@@ -616,28 +615,28 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac){
   mac->RA_window_cnt = mac->RA_offset*nr_slots_per_frame[mu]; // taking into account the 2 frames gap introduced by OAI gNB
 
   switch (ra_ResponseWindow) {
-    case 0:
+    case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl1:
       mac->RA_window_cnt += 1;
       break;
-    case 1:
+    case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl2:
       mac->RA_window_cnt += 2;
       break;
-    case 2:
+    case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl4:
       mac->RA_window_cnt += 4;
       break;
-    case 3:
+    case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl8:
       mac->RA_window_cnt += 8;
       break;
-    case 4:
+    case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl10:
       mac->RA_window_cnt += 10;
       break;
-    case 5:
+    case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl20:
       mac->RA_window_cnt += 20;
       break;
-    case 6:
+    case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl40:
       mac->RA_window_cnt += 40;
       break;
-    case 7:
+    case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl80:
       mac->RA_window_cnt += 80;
       break;
   }
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
index 53263747fc3363b5983f7628bd95a84816c75026..2285fc5999d77f2258edeade4e0c43ebea753e81 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
@@ -46,6 +46,8 @@
 #endif
 #define LOG_DCI_PARM(a...) LOG_D(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci)" a)
 
+// #define DEBUG_DCI
+
 dci_pdu_rel15_t *def_dci_pdu_rel15;
 
 void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) {
@@ -62,217 +64,261 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd
 
 }
 
-void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot) {
+void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id, uint8_t dci_format){
 
+  uint16_t monitoringSymbolsWithinSlot;
+  uint8_t bwp_id = 1, coreset_id = 1;
+  int sps;
   def_dci_pdu_rel15 = calloc(1,sizeof(dci_pdu_rel15_t));
-
-  NR_BWP_Downlink_t *bwp;
-  NR_BWP_DownlinkCommon_t *bwp_Common;
-  NR_BWP_DownlinkDedicated_t *dl_bwp_Dedicated;
-  NR_SetupRelease_PDCCH_Config_t *pdcch_Config;
-  NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon;
-  struct NR_PDCCH_Config__controlResourceSetToAddModList *controlResourceSetToAddModList;
-  struct NR_PDCCH_Config__searchSpacesToAddModList *searchSpacesToAddModList;
-  struct NR_UplinkConfig__uplinkBWP_ToAddModList *uplinkBWP_ToAddModList;
-  NR_SearchSpace_t *NR_SearchSpace;
-  NR_ControlResourceSet_t *coreset;
-
-  fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15;
-  NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
-
-  uint8_t bwp_id = 1;
-  int ss_id, sps;
-
-  // get PDCCH configuration(s) (Coreset, SearchSpace, etc...) from BWP Dedicated in serving cell config dedicated (scd)
-  // get BWP 1, Coreset ID 0, SearchSpace ID 0 (i.e. configured in MIB and in ServingCellConfigCommon)
-
-  // Check dedicated DL BWP
-  if (mac->DLbwp[0] == NULL) {
-    NR_SearchSpace_t *ss;
-    int ss_id = 0;
-
-    AssertFatal(scd->downlinkBWP_ToAddModList != NULL, "downlinkBWP_ToAddModList is null\n");
-    AssertFatal(scd->downlinkBWP_ToAddModList->list.count == 1, "downlinkBWP_ToAddModList->list->count is %d\n", scd->downlinkBWP_ToAddModList->list.count);
-    mac->DLbwp[0] = scd->downlinkBWP_ToAddModList->list.array[bwp_id - 1];
-
-    dl_bwp_Dedicated = mac->DLbwp[0]->bwp_Dedicated;
-    AssertFatal(dl_bwp_Dedicated != NULL, "dl_bwp_Dedicated is null\n");
-
-    bwp_Common = mac->DLbwp[0]->bwp_Common;
-    AssertFatal(bwp_Common != NULL, "bwp_Common is null\n");
-
-    pdcch_Config = dl_bwp_Dedicated->pdcch_Config;
-    AssertFatal(pdcch_Config != NULL, "pdcch_Config is null\n");
-
-    pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
-    AssertFatal(pdcch_ConfigCommon != NULL, "pdcch_ConfigCommon is null\n");
-    AssertFatal(pdcch_ConfigCommon->choice.setup->ra_SearchSpace != NULL, "ra_SearchSpace must be available in DL BWP\n");
-
-    controlResourceSetToAddModList = pdcch_Config->choice.setup->controlResourceSetToAddModList;
-    AssertFatal(controlResourceSetToAddModList != NULL, "controlResourceSetToAddModList is null\n");
-
-    AssertFatal(controlResourceSetToAddModList->list.count == 1, "controlResourceSetToAddModList->list.count=%d\n", controlResourceSetToAddModList->list.count);
-
-    mac->coreset[0][0] = controlResourceSetToAddModList->list.array[0];
-    coreset = mac->coreset[0][0];
-    AssertFatal(coreset != NULL, "coreset[0][0] is null\n");
-    
-    searchSpacesToAddModList = pdcch_Config->choice.setup->searchSpacesToAddModList;
-    AssertFatal(searchSpacesToAddModList != NULL, "searchSpacesToAddModList is null\n");
-    AssertFatal(searchSpacesToAddModList->list.count > 0, "searchSpacesToAddModList is empty\n");
-    AssertFatal(searchSpacesToAddModList->list.count < FAPI_NR_MAX_SS_PER_CORESET, "too many searchpaces per coreset %d\n", searchSpacesToAddModList->list.count);
-
-    for (int i = 0; i < searchSpacesToAddModList->list.count; i++) {
-      ss = searchSpacesToAddModList->list.array[i];
-      AssertFatal(ss->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n");
-      AssertFatal(ss->searchSpaceType != NULL, "ss->searchSpaceType is null\n");
-      AssertFatal(*ss->controlResourceSetId == coreset->controlResourceSetId, "ss->controlResourceSetId is unknown\n");
-      mac->SSpace[0][0][ss_id] = ss;
-      ss_id++;
-    }
+  AssertFatal(mac->scc != NULL, "scc is null\n");
+  NR_ServingCellConfigCommon_t *scc = mac->scc;
+  NR_BWP_DownlinkCommon_t *bwp_Common = mac->DLbwp[bwp_id - 1]->bwp_Common;
+  NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP;
+  NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id];
+
+  // DCI format configuration
+  rel15->dci_format = dci_format;
+
+  // CORESET configuration
+  NR_ControlResourceSet_t *coreset = mac->coreset[bwp_id - 1][coreset_id - 1];
+  rel15->coreset.duration = coreset->duration;
+  for (int i = 0; i < 6; i++)
+    rel15->coreset.frequency_domain_resource[i] = coreset->frequencyDomainResources.buf[i];
+  rel15->coreset.CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved ? FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED : FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED;
+  if (rel15->coreset.CceRegMappingType == FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED) {
+    struct NR_ControlResourceSet__cce_REG_MappingType__interleaved *interleaved = coreset->cce_REG_MappingType.choice.interleaved;
+    rel15->coreset.RegBundleSize = (interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2 + interleaved->reg_BundleSize);
+    rel15->coreset.InterleaverSize = (interleaved->interleaverSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2 + interleaved->interleaverSize);
+    AssertFatal(scc->physCellId != NULL, "mac->scc->physCellId is null\n");
+    rel15->coreset.ShiftIndex = interleaved->shiftIndex != NULL ? *interleaved->shiftIndex : *scc->physCellId;
+  } else {
+    rel15->coreset.RegBundleSize = 0;
+    rel15->coreset.InterleaverSize = 0;
+    rel15->coreset.ShiftIndex = 0;
   }
-
-  // Check dedicated UL BWP
-  if (mac->ULbwp[0] == NULL) {
-    uplinkBWP_ToAddModList = scd->uplinkConfig->uplinkBWP_ToAddModList;
-    AssertFatal(uplinkBWP_ToAddModList != NULL, "uplinkBWP_ToAddModList is null\n");
-    AssertFatal(uplinkBWP_ToAddModList->list.count == 1, "uplinkBWP_ToAddModList->list->count is %d\n", uplinkBWP_ToAddModList->list.count);
-    mac->ULbwp[0] = uplinkBWP_ToAddModList->list.array[bwp_id - 1];
-    AssertFatal(mac->ULbwp[0]->bwp_Dedicated != NULL, "UL bwp_Dedicated is null\n");
+  rel15->coreset.CoreSetType = 1;
+  rel15->coreset.precoder_granularity = coreset->precoderGranularity;
+
+  // Scrambling RNTI
+  if (coreset->pdcch_DMRS_ScramblingID) {
+    rel15->coreset.pdcch_dmrs_scrambling_id = *coreset->pdcch_DMRS_ScramblingID;
+    rel15->coreset.scrambling_rnti = mac->t_crnti;
+  } else {
+    rel15->coreset.pdcch_dmrs_scrambling_id = *scc->physCellId;
+    rel15->coreset.scrambling_rnti = 0;
   }
 
-  bwp = mac->DLbwp[0];
-  bwp_Common = bwp->bwp_Common;
-  pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
-  dl_bwp_Dedicated = bwp->bwp_Dedicated;
-  pdcch_Config = dl_bwp_Dedicated->pdcch_Config;
-  searchSpacesToAddModList = pdcch_Config->choice.setup->searchSpacesToAddModList;
-
-  // check USSs
-  ss_id = 0;
-  NR_SearchSpace = mac->SSpace[0][0][ss_id];
-  while(NR_SearchSpace != NULL && ss_id < searchSpacesToAddModList->list.count) {
-    AssertFatal(NR_SearchSpace->monitoringSymbolsWithinSlot != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot is null\n");
-    AssertFatal(NR_SearchSpace->monitoringSymbolsWithinSlot->buf != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot->buf is null\n");
-    ss_id++;
+  #ifdef DEBUG_DCI
+    LOG_D(MAC, "[DCI_CONFIG] Configure DCI PDU: ss_id %d bwp %p bwp_Id %d controlResourceSetId %d\n", ss_id, mac->DLbwp[bwp_id - 1], mac->DLbwp[bwp_id - 1]->bwp_Id, coreset->controlResourceSetId);
+  #endif
+
+  // loop over RNTI type and configure resource allocation for DCI
+  switch(rnti_type) {
+    case NR_RNTI_C:
+    // we use DL BWP dedicated
+    sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
+    // for SPS=14 8 MSBs in positions 13 down to 6
+    monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
+    rel15->rnti = mac->crnti;
+    rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275);
+    rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275);
+    rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
+    rel15->dci_length = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format, NR_RNTI_C, rel15->BWPSize, bwp_id);
+    break;
+    case NR_RNTI_RA:
+    // we use the initial DL BWP
+    sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12;
+    monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
+    rel15->rnti = mac->ra_rnti;
+    rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
+    rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); //NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
+    rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
+    rel15->dci_length = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format, NR_RNTI_RA, rel15->BWPSize, bwp_id);
+    break;
+    case NR_RNTI_P:
+    break;
+    case NR_RNTI_CS:
+    break;
+    case NR_RNTI_TC:
+    break;
+    case NR_RNTI_SP_CSI:
+    break;
+    case NR_RNTI_SI:
+    break;
+    case NR_RNTI_SFI:
+    break;
+    case NR_RNTI_INT:
+    break;
+    case NR_RNTI_TPC_PUSCH:
+    break;
+    case NR_RNTI_TPC_PUCCH:
+    break;
+    case NR_RNTI_TPC_SRS:
+    break;
+    default:
+    break;
   }
-
-  if (mac->crnti > 0) {
-
-    NR_SearchSpace_t *css;
-    NR_SearchSpace_t *uss = NULL;
-    NR_ServingCellConfigCommon_t *scc;
-    NR_SearchSpaceId_t ra_SearchSpaceId;
-    rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
-    uint16_t monitoringSymbolsWithinSlot;
-    uint8_t add_dci = 1;
-
-    AssertFatal(mac->scc != NULL, "scc is null\n");
-
-    scc = mac->scc;
-    rel15->dci_format = NR_DL_DCI_FORMAT_1_1;
-
-    // CoReSet configuration
-    coreset = mac->coreset[0][0];
-    rel15->coreset.duration = coreset->duration;
-    for (int i = 0; i < 6; i++)
-      rel15->coreset.frequency_domain_resource[i] = coreset->frequencyDomainResources.buf[i];
-
-    rel15->coreset.CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved ? FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED : FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED;
-
-    if (rel15->coreset.CceRegMappingType == FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED) {
-      struct NR_ControlResourceSet__cce_REG_MappingType__interleaved *interleaved = coreset->cce_REG_MappingType.choice.interleaved;
-      rel15->coreset.RegBundleSize = (interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2 + interleaved->reg_BundleSize);
-      rel15->coreset.InterleaverSize = (interleaved->interleaverSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2 + interleaved->interleaverSize);
-      AssertFatal(scc->physCellId != NULL, "mac->scc->physCellId is null\n");
-      rel15->coreset.ShiftIndex = interleaved->shiftIndex != NULL ? *interleaved->shiftIndex : *scc->physCellId;
-    } else {
-      rel15->coreset.RegBundleSize = 0;
-      rel15->coreset.InterleaverSize = 0;
-      rel15->coreset.ShiftIndex = 0;
+  for (int i = 0; i < sps; i++) {
+    if ((monitoringSymbolsWithinSlot >> (sps - 1 - i)) & 1) {
+      rel15->coreset.StartSymbolIndex = i;
+      break;
     }
+  }
+  #ifdef DEBUG_DCI
+    LOG_D(MAC, "[DCI_CONFIG] Configure DCI PDU: rnti_type %d BWPSize %d BWPStart %d rel15->SubcarrierSpacing %d rel15->dci_format %d rel15->dci_length %d sps %d monitoringSymbolsWithinSlot %d \n",
+      rnti_type,
+      rel15->BWPSize,
+      rel15->BWPStart,
+      rel15->SubcarrierSpacing,
+      rel15->dci_format,
+      rel15->dci_length,
+      sps,
+      monitoringSymbolsWithinSlot);
+  #endif
+  // add DCI
+  dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DCI;
+  dl_config->number_pdus = dl_config->number_pdus + 1;
+}
 
-    rel15->coreset.CoreSetType = 1;
-    rel15->coreset.precoder_granularity = coreset->precoderGranularity;
-
-    if (mac->ra_state == WAIT_RAR){
-
-       NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP;
-       struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
-       AssertFatal(commonSearchSpaceList->list.count > 0, "PDCCH CSS list has 0 elements\n");
-
-       ra_SearchSpaceId = *pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
-
-       // fetch the CSS for RA from the CSS list
-       for (int i = 0; i < commonSearchSpaceList->list.count; i++) {
-         css = commonSearchSpaceList->list.array[i];
-         if(css->searchSpaceId == ra_SearchSpaceId)
-           break;
-       }
-
-       // check CSSs
-       if(css != NULL) {
-         AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n");
-         AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n");
-       }
+void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot) {
 
-      if (frame == mac->msg2_rx_frame && slot == mac->msg2_rx_slot){
-        sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12;
-        monitoringSymbolsWithinSlot = (css->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (css->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
-        rel15->rnti = mac->ra_rnti;
-        rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
-        rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); // NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
-        rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
-        rel15->dci_length = nr_dci_size(scc,mac->scg,def_dci_pdu_rel15,rel15->dci_format,NR_RNTI_C,rel15->BWPSize,bwp_id);
-        for (int i = 0; i < sps; i++)
-        if ((monitoringSymbolsWithinSlot >> (sps - 1 - i)) & 1) {
-          rel15->coreset.StartSymbolIndex = i;
-          break;
+  int ss_id;
+  uint8_t bwp_id = 1, coreset_id = 1;
+  NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
+  NR_BWP_Downlink_t *bwp = mac->DLbwp[bwp_id - 1];
+
+  #ifdef DEBUG_DCI
+    LOG_D(MAC, "[DCI_CONFIG] ra_rnti %p (%x) crnti %p (%x) t_crnti %p (%x)\n", &mac->ra_rnti, mac->ra_rnti, &mac->crnti, mac->crnti, &mac->t_crnti, mac->t_crnti);
+  #endif
+
+  // loop over all available SS for BWP ID 1, CORESET ID 1
+  for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id] != NULL; ss_id++){
+    NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id];
+    fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
+    NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common;
+    NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
+    struct NR_PhysicalCellGroupConfig *phy_cgc = mac->scg->physicalCellGroupConfig;
+    switch (ss->searchSpaceType->present){
+      case NR_SearchSpace__searchSpaceType_PR_common:
+      // this is for CSSs, we use BWP common and pdcch_ConfigCommon
+
+      // Fetch configuration for searchSpaceZero
+      // note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero).
+      if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){
+        LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n");
+        LOG_W(MAC, "[DCI_CONFIG] This should not be available yet...");
+      }
+      if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){
+        // check available SS IDs
+        if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
+          if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
+            LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space\n");
+            switch(mac->ra_state){
+              case WAIT_RAR:
+              config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id, NR_DL_DCI_FORMAT_1_0);
+              fill_dci_search_candidates(ss, rel15);
+              break;
+              case WAIT_CONTENTION_RESOLUTION:
+              rel15->rnti = mac->t_crnti;
+              break;
+              default:
+              break;
+            }
+          }
+        }
+        if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
+          if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
+            // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
+            LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
+          }
+        }
+        if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
+          if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
+            // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
+            LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
+          }
         }
-        fill_dci_search_candidates(css, rel15);
-      } else {
-        add_dci = 0;
+        if (pdcch_ConfigCommon->choice.setup->pagingSearchSpace){
+          if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->pagingSearchSpace){
+            // Configure monitoring of PDCCH candidates in Type2-PDCCH common search space on the MCG
+            LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
+          }
+        }
+        if (phy_cgc){
+          if (phy_cgc->cs_RNTI){
+            LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
+            LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
+          }
+          if (phy_cgc->ext1){
+            if (phy_cgc->ext1->mcs_C_RNTI){
+            LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n");
+            LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
+            }
+          }
+        }
+      } // end DCI 00 and 01
+      // DCI 2_0
+      if (ss->searchSpaceType->choice.common->dci_Format2_0){
+        LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_0 with CRC scrambled by SFI-RNTI \n");
+        LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
       }
-    } else if (mac->ra_state == WAIT_CONTENTION_RESOLUTION){
-
-      rel15->rnti = mac->t_crnti;
-
-    } else {
-
-      rel15->rnti = mac->crnti;
-      rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275);
-      rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275);
-      rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
-      rel15->dci_length = nr_dci_size(scc,mac->scg,def_dci_pdu_rel15,rel15->dci_format,NR_RNTI_C,rel15->BWPSize,bwp_id);
-      // get UE-specific search space
-      for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[0][0][ss_id] != NULL; ss_id++){
-        uss = mac->SSpace[0][0][ss_id];
-        if (uss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) break;
+      // DCI 2_1
+      if (ss->searchSpaceType->choice.common->dci_Format2_1){
+        LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_1 with CRC scrambled by INT-RNTI \n");
+        LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
+      }
+      // DCI 2_2
+      if (ss->searchSpaceType->choice.common->dci_Format2_2){
+        LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_2 with CRC scrambled by TPC-RNTI \n");
+        LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
+      }
+      // DCI 2_3
+      if (ss->searchSpaceType->choice.common->dci_Format2_3){
+        LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI \n");
+        LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
       }
-      AssertFatal(ss_id < FAPI_NR_MAX_SS_PER_CORESET, "couldn't find a UE-specific SS\n");
-      sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
-      // for SPS=14 8 MSBs in positions 13 down to 6
-      monitoringSymbolsWithinSlot = (uss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (uss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
-      for (int i = 0; i < sps; i++)
-        if ((monitoringSymbolsWithinSlot >> (sps - 1 - i)) & 1) {
-          rel15->coreset.StartSymbolIndex = i;
-          break;
-        }
-      fill_dci_search_candidates(uss, rel15);
-    }
-
-    // Scrambling RNTI
-    if (coreset->pdcch_DMRS_ScramblingID) {
-      rel15->coreset.pdcch_dmrs_scrambling_id = *coreset->pdcch_DMRS_ScramblingID;
-      rel15->coreset.scrambling_rnti = mac->t_crnti;
-    } else {
-      rel15->coreset.pdcch_dmrs_scrambling_id = *scc->physCellId;
-      rel15->coreset.scrambling_rnti = 0;
-    }
 
-    if (add_dci){
-      dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DCI;
-      dl_config->number_pdus = dl_config->number_pdus + 1;
+      break;
+      case NR_SearchSpace__searchSpaceType_PR_ue_Specific:
+      // this is an USS
+      if (ss->searchSpaceType->choice.ue_Specific){
+        if(ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1){
+          // Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
+          if (get_softmodem_params()->phy_test == 1 && mac->crnti > 0) {
+            LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n");
+            config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C, ss_id, NR_DL_DCI_FORMAT_1_1);
+            fill_dci_search_candidates(ss, rel15);
+
+            #ifdef DEBUG_DCI
+            LOG_D(MAC, "[DCI_CONFIG] ss %d ue_Specific %p searchSpaceType->present %d dci_Formats %d\n",
+              ss_id,
+              ss->searchSpaceType->choice.ue_Specific,
+              ss->searchSpaceType->present,
+              ss->searchSpaceType->choice.ue_Specific->dci_Formats);
+            #endif
+          }
+          if (phy_cgc){
+            if (phy_cgc->cs_RNTI){
+              LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
+              LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
+            }
+            if (phy_cgc->sp_CSI_RNTI){
+              LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by SP-CSI-RNTI...\n");
+              LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
+            }
+            if (phy_cgc->ext1){
+              if (phy_cgc->ext1->mcs_C_RNTI){
+                LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n");
+                LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
+              }
+            }
+          }
+        }
+      }
+      break;
+      default:
+      AssertFatal(1 == 0, "[DCI_CONFIG] Unrecognized search space type...");
+      break;
     }
   }
 }
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index 47b420d39bb123e75c93b3412f1cc0baf6beba89..60f331a08627534f34b3d70d7718c83919b11175 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -757,191 +757,181 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
         }
       */
     }
-  } else if (ul_info && ul_info->slot_tx == 8) {
-    module_id_t mod_id    = ul_info->module_id;
-    uint32_t gNB_index    = ul_info->gNB_index;
-    int cc_id             = ul_info->cc_id;
-    frame_t rx_frame      = ul_info->frame_rx;
-    slot_t rx_slot        = ul_info->slot_rx;
-    NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
+  } else if (ul_info) {
+
+    if (get_softmodem_params()->phy_test && ul_info->slot_tx == 8) { // ULSCH is handled only in phy-test mode (consistently with OAI gNB)
+
+      uint8_t nb_dmrs_re_per_rb;
+      uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
+      uint8_t data_existing = 0;
+      uint16_t TBS_bytes;
+      uint32_t TBS;
+      int i;
+
+      module_id_t mod_id    = ul_info->module_id;
+      uint32_t gNB_index    = ul_info->gNB_index;
+      int cc_id             = ul_info->cc_id;
+      frame_t rx_frame      = ul_info->frame_rx;
+      slot_t rx_slot        = ul_info->slot_rx;
+      frame_t frame_tx      = ul_info->frame_tx;
+      slot_t slot_tx        = ul_info->slot_tx;
+      NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
+      uint8_t access_mode   = SCHEDULED_ACCESS;
+
+      // program PUSCH. this should actually be done upon reception of an UL DCI
+      nr_dcireq_t dcireq;
+      nr_scheduled_response_t scheduled_response;
+      fapi_nr_tx_request_t tx_req;
+      fapi_nr_tx_request_body_t tx_req_body;
+
+      //--------------------------Temporary configuration-----------------------------//
+      uint16_t rnti               = 0x1234;
+      uint32_t rb_size            = 50;
+      uint32_t rb_start           = 0;
+      uint8_t  nr_of_symbols      = 11;
+      uint8_t  start_symbol_index = 0;
+      uint8_t  nrOfLayers         = 1;
+      uint8_t  mcs_index          = 9;
+      uint8_t  mcs_table          = 0;
+      uint8_t  harq_process_id    = 0;
+      uint8_t  rv_index           = 0;
+      uint16_t l_prime_mask       = get_l_prime(nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1);
+      uint8_t  dmrs_config_type   = 0;
+      uint8_t  ptrs_mcs1          = 2;
+      uint8_t  ptrs_mcs2          = 4;
+      uint8_t  ptrs_mcs3          = 10;
+      uint16_t n_rb0              = 25;
+      uint16_t n_rb1              = 75;
+      uint16_t pdu_bit_map        = PUSCH_PDU_BITMAP_PUSCH_DATA;
+      uint8_t  ptrs_time_density  = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, mcs_index, mcs_table);
+      uint8_t  ptrs_freq_density  = get_K_ptrs(n_rb0, n_rb1, rb_size);
+      uint8_t  no_data_in_dmrs    = 1;
+      uint16_t number_dmrs_symbols = 0;
+      uint16_t ul_dmrs_symb_pos   = l_prime_mask << start_symbol_index;
+      //------------------------------------------------------------------------------//
+
+        for (i = start_symbol_index; i < start_symbol_index + nr_of_symbols; i++) {
+          if((ul_dmrs_symb_pos >> i) & 0x01)
+            number_dmrs_symbols += 1;
+        }
 
-    // program PUSCH. this should actually be done upon reception of an UL DCI
-    nr_dcireq_t dcireq;
-    nr_scheduled_response_t scheduled_response;
+        if(no_data_in_dmrs)
+          nb_dmrs_re_per_rb = 12;
+        else
+          nb_dmrs_re_per_rb = ((dmrs_config_type == pusch_dmrs_type1) ? 6:4);
+
+        TBS = nr_compute_tbs(nr_get_Qm_ul(mcs_index, 0),
+                             nr_get_code_rate_ul(mcs_index, 0),
+                             rb_size,
+                             nr_of_symbols,
+                             nb_dmrs_re_per_rb*number_dmrs_symbols,
+                             0,
+                             0,
+                             nrOfLayers);
+        TBS_bytes = TBS/8;
+
+        if (IS_SOFTMODEM_NOS1){
+          // Getting IP traffic to be transmitted
+          data_existing = nr_ue_get_sdu(mod_id,
+                                        cc_id,
+                                        frame_tx,
+                                        slot_tx,
+                                        0,
+                                        ulsch_input_buffer,
+                                        TBS_bytes,
+                                        &access_mode);
+        }
 
-    //--------------------------Temporary configuration-----------------------------//
-    uint16_t rnti               = 0x1234;
-    uint32_t rb_size            = 50;
-    uint32_t rb_start           = 0;
-    uint8_t  nr_of_symbols      = 11;
-    uint8_t  start_symbol_index = 0;
-    uint8_t  nrOfLayers         = 1;
-    uint8_t  mcs_index          = 9;
-    uint8_t  mcs_table          = 0;
-    uint8_t  harq_process_id    = 0;
-    uint8_t  rv_index           = 0;
-    uint16_t l_prime_mask       = get_l_prime(nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1);
-    uint8_t  dmrs_config_type   = 0;
-    uint8_t  ptrs_mcs1          = 2;
-    uint8_t  ptrs_mcs2          = 4;
-    uint8_t  ptrs_mcs3          = 10;
-    uint16_t n_rb0              = 25;
-    uint16_t n_rb1              = 75;
-    uint16_t pdu_bit_map        = PUSCH_PDU_BITMAP_PUSCH_DATA;
-    uint8_t  ptrs_time_density  = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, mcs_index, mcs_table);
-    uint8_t  ptrs_freq_density  = get_K_ptrs(n_rb0, n_rb1, rb_size);
-    //------------------------------------------------------------------------------//
-
-    dcireq.module_id = mod_id;
-    dcireq.gNB_index = gNB_index;
-    dcireq.cc_id     = cc_id;
-    dcireq.frame     = rx_frame;
-    dcireq.slot      = rx_slot;
-
-    scheduled_response.dl_config  = NULL;
-    scheduled_response.ul_config  = &dcireq.ul_config_req;
-    scheduled_response.tx_request = NULL;
-    scheduled_response.module_id  = mod_id;
-    scheduled_response.CC_id      = cc_id;
-    scheduled_response.frame      = rx_frame;
-    scheduled_response.slot       = rx_slot;
-
-    scheduled_response.ul_config->slot = ul_info->slot_tx;
-    scheduled_response.ul_config->number_pdus = 1;
-    scheduled_response.ul_config->ul_config_list[0].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rnti = rnti;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rb_size = rb_size;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rb_start = rb_start;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nr_of_symbols = nr_of_symbols;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol_index;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask << start_symbol_index;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.dmrs_config_type = dmrs_config_type;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_index = mcs_index;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.num_dmrs_cdm_grps_no_data = 1;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = rv_index;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nrOfLayers = nrOfLayers;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_process_id;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map = pdu_bit_map;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density;
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list   = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t));
-    scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0;
-
-    if (1 << ptrs_time_density >= nr_of_symbols) {
-      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS
-    }
+        //Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity
+        if (!IS_SOFTMODEM_NOS1 || !data_existing) {
+          //Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid
+          //and block this traffic from being forwarded to the upper layers at the gNB
+          LOG_D(PHY, "Random data to be tranmsitted: \n");
 
-    if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){
-      mac->if_module->scheduled_response(&scheduled_response);
-    }
+          //Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2)
+          //in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should
+          //have a valid LCID (nr_process_mac_pdu function)
+          ulsch_input_buffer[0] = 0x31;
 
-    // TODO: expand
-    // Note: Contention resolution is currently not active
-    if (mac->RA_contention_resolution_timer_active == 1)
-      ue_contention_resolution(mod_id, gNB_index, cc_id, ul_info->frame_tx);
-  }
+          for (i = 1; i < TBS_bytes; i++) {
+            ulsch_input_buffer[i] = (unsigned char) rand();
+            //printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
+          }
+        }
 
-  return UE_CONNECTION_OK;
-}
+#ifdef DEBUG_MAC_PDU
 
-// Notes:
-// - Type1-PDCCH CSS configuration from ra-SearchSpace.
-// - Msg2 is scheduled in the mixed slot or in the last dl slot if they are allowed by the Type 1 Common Search Space configuration
-// todo:
-// - if Type1-PDCCH CSS is not configured in RRC message (Coreset and SearchSpace), UE searches in Type 0 PDCCH CSS.
-void nr_ue_msg2_scheduler(module_id_t mod_id,
-                          uint16_t rach_frame,
-                          uint16_t rach_slot,
-                          uint16_t *msg2_frame,
-                          uint16_t *msg2_slot){
-
-  uint8_t bwp_id = 1;
-  NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
-  NR_CellGroupConfig_t *scg = mac->scg;
-  NR_ServingCellConfigCommon_t *scc = mac->scc;
-  NR_BWP_Downlink_t *bwp = scg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id - 1];
-  NR_SearchSpace_t *ss;
-  struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
-  uint8_t mu = *scc->ssbSubcarrierSpacing;
-  uint8_t response_window = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.ra_ResponseWindow;
-  uint8_t slot_window, slot_limit, frame_limit;
-  uint16_t start_next_period, monitoring_slot_period, monitoring_offset;
-
-  // number of mixed slot or of last dl slot if there is no mixed slot
-  uint16_t last_dl_slot_period = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots;
-  uint16_t nr_dl_symbols = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols;
-  uint16_t nr_ul_symbols = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols;
-
-  // lenght of tdd period in slots
-  uint16_t tdd_period_slot = last_dl_slot_period + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
-
-  AssertFatal(commonSearchSpaceList->list.count > 0, "PDCCH common SearchSpace list has 0 elements\n");
-  
-  LOG_D(MAC, "Frame %d, Slot %d: Scheduling Msg2 reception \n", rach_frame, rach_slot);
-
-  // Common searchspace list
-  for (int i = 0; i < commonSearchSpaceList->list.count; i++) {
-    ss = commonSearchSpaceList->list.array[i];
-    if(ss->searchSpaceId == *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace)
-    // retrieving ra pdcch monitoring period and offset
-    find_monitoring_periodicity_offset_common(ss, &monitoring_slot_period, &monitoring_offset);
-  }
+        LOG_D(PHY, "Is data existing ?: %d \n", data_existing);
+        LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", TBS_bytes);
+        for (i = 0; i < TBS_bytes; i++) {
+          printf("%02x", ulsch_input_buffer[i]);
+        }
+        printf("\n");
 
-  if (nr_dl_symbols == 0)
-    last_dl_slot_period--;
-  if ((nr_dl_symbols > 0) || (nr_ul_symbols > 0))
-    tdd_period_slot++;
+#endif
 
-  // computing start of next period
-  start_next_period = (rach_slot - (rach_slot % tdd_period_slot) + tdd_period_slot) % nr_slots_per_frame[mu];
-  *msg2_slot = start_next_period + last_dl_slot_period; // initializing scheduling of slot to next mixed (or last dl) slot
-  *msg2_frame = (*msg2_slot > rach_slot) ? rach_frame : (rach_frame +1);
+      dcireq.module_id = mod_id;
+      dcireq.gNB_index = gNB_index;
+      dcireq.cc_id     = cc_id;
+      dcireq.frame     = rx_frame;
+      dcireq.slot      = rx_slot;
 
-  switch(response_window){
-  case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl1:
-    slot_window = 1;
-    break;
-  case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl2:
-    slot_window = 2;
-    break;
-  case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl4:
-    slot_window = 4;
-    break;
-  case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl8:
-    slot_window = 8;
-    break;
-  case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl10:
-    slot_window = 10;
-    break;
-  case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl20:
-    slot_window = 20;
-    break;
-  case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl40:
-    slot_window = 40;
-    break;
-  case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl80:
-    slot_window = 80;
-    break;
-  default:
-    AssertFatal(1==0,"Invalid response window value %d\n",response_window);
-  }
-  AssertFatal(slot_window<=nr_slots_per_frame[mu], "Msg2 response window needs to be lower or equal to 10ms");
+      scheduled_response.dl_config  = NULL;
+      scheduled_response.ul_config  = &dcireq.ul_config_req;
+      // Config UL TX PDU
+      tx_req.slot = slot_tx;
+      tx_req.sfn = frame_tx;
+      // tx_req->tx_config // TbD
+      tx_req.number_of_pdus = 1;
+      tx_req_body.pdu_length = TBS_bytes;
+      tx_req_body.pdu_index = 0;
+      tx_req_body.pdu = ulsch_input_buffer;
+
+      scheduled_response.tx_request = &tx_req;
+      scheduled_response.tx_request->tx_request_body = &tx_req_body;
+      scheduled_response.module_id  = mod_id;
+      scheduled_response.CC_id      = cc_id;
+      scheduled_response.frame      = rx_frame;
+      scheduled_response.slot       = rx_slot;
 
-  // slot and frame limit to transmit msg2 according to response window
-  slot_limit = (rach_slot + slot_window)%nr_slots_per_frame[mu];
-  frame_limit = (slot_limit>(rach_slot))? rach_frame : (rach_frame +1);
+      scheduled_response.ul_config->slot = ul_info->slot_tx;
+      scheduled_response.ul_config->number_pdus = 1;
+      scheduled_response.ul_config->ul_config_list[0].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rnti = rnti;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rb_size = rb_size;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rb_start = rb_start;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nr_of_symbols = nr_of_symbols;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol_index;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = ul_dmrs_symb_pos;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.dmrs_config_type = dmrs_config_type;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_index = mcs_index;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.num_dmrs_cdm_grps_no_data = 1;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = rv_index;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nrOfLayers = nrOfLayers;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_process_id;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map = pdu_bit_map;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density;
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list   = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t));
+      scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0;
+
+      if (1 << ptrs_time_density >= nr_of_symbols) {
+        scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS
+      }
 
-  // go to previous slot if the current scheduled slot is beyond the response window
-  // and if the slot is not among the PDCCH monitored ones (38.213 10.1)
-  while ((*msg2_slot > slot_limit) || ((*msg2_frame*nr_slots_per_frame[mu] + *msg2_slot - monitoring_offset) % monitoring_slot_period != 0))  {
-    if((*msg2_slot % tdd_period_slot) > 0)
-      (*msg2_slot)--;
-    else
-      AssertFatal(1 == 0, "No available DL slot to schedule reception of msg2 has been found");
+      if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){
+        mac->if_module->scheduled_response(&scheduled_response);
+      }
+
+      // TODO: expand
+      // Note: Contention resolution is currently not active
+      if (mac->RA_contention_resolution_timer_active == 1)
+        ue_contention_resolution(mod_id, gNB_index, cc_id, ul_info->frame_tx);
+    }
   }
-  LOG_D(MAC, "Scheduled Msg2 reception in Frame %d, Slot %d:  \n", *msg2_frame, *msg2_slot);
+  return UE_CONNECTION_OK;
 }
 
 // This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211, tables 6.3.3.2.x
@@ -969,6 +959,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
   config_index = rach_ConfigGeneric->prach_ConfigurationIndex;
 
   mac->RA_offset = 2; // to compensate the rx frame offset at the gNB
+  mac->generate_nr_prach = 0; // Reset flag for PRACH generation
 
   if (is_nr_UL_slot(scc, slotP)) {
 
@@ -1090,8 +1081,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
           }
         }
       }
-    } else {
-      mac->generate_nr_prach = 0;
+    } else if (mac->ra_state == RA_SUCCEEDED){
+      mac->generate_nr_prach = 2;
     }
     mac->scheduled_response.ul_config = ul_config;
   }
@@ -2320,7 +2311,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
   AssertFatal(mac->DLbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n");
   AssertFatal(mac->ULbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n");
 
-  const uint16_t n_RB_DLBWP = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275);
+  const uint16_t n_RB_DLBWP = (mac->ra_state == WAIT_RAR) ? NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275) : NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275);
   const uint16_t n_RB_ULBWP = NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275);
 
   LOG_D(MAC,"nr_ue_process_dci at MAC layer with dci_format=%d (DL BWP %d, UL BWP %d)\n",dci_format,n_RB_DLBWP,n_RB_ULBWP);
@@ -2761,7 +2752,12 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
     dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
 							 mac->scc->dmrs_TypeA_Position,
 							 dlsch_config_pdu_1_0->number_symbols);
-    dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 1 : 2;
+    dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
+    /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */
+    if (dlsch_config_pdu_1_0->number_symbols == 2)
+      dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1;
+    else
+      dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2;
     /* VRB_TO_PRB_MAPPING */
     dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved;
     /* MCS */
@@ -2822,10 +2818,11 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
 	  dlsch_config_pdu_1_0->pucch_resource_id,
 	  dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind);
 
-    if (mac->ra_rnti == rnti)
+    if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){
       dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH;
-    else
+    } else {
       dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
+    }
 
     //	    dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP = n_RB_DLBWP;
 	    
@@ -2880,7 +2877,10 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
     dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
 							 mac->scc->dmrs_TypeA_Position,
 							 dlsch_config_pdu_1_1->number_symbols);
-    dlsch_config_pdu_1_1->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 1 : 2;
+    dlsch_config_pdu_1_1->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
+    /* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214,
+             using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */
+    dlsch_config_pdu_1_1->n_dmrs_cdm_groups = 1;
     /* VRB_TO_PRB_MAPPING */
     if (mac->phy_config.config_req.dl_bwp_dedicated.pdsch_config_dedicated.resource_allocation != 0)
       dlsch_config_pdu_1_1->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved;
@@ -3133,6 +3133,7 @@ void nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
   case NR_DL_DCI_FORMAT_1_0:
     switch(rnti_type) {
     case NR_RNTI_RA:
+      N_RB = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); // TBR hotfix
       // Freq domain assignment
       fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
       pos=fsize;
@@ -3167,8 +3168,6 @@ void nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
 #endif
       break;
 
-    mac->rnti_type = rnti_type;
-
     case NR_RNTI_C:
 	
       // indicating a DL DCI format 1bit
diff --git a/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c b/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c
index 31a865f3176054d39d6393ee84c89599c6596a3c..8d52db6747849300881817f0f3b9b8dd39ecf05f 100644
--- a/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c
+++ b/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c
@@ -107,9 +107,10 @@ uint16_t nr_ue_process_rar(module_id_t mod_id,
     uint8_t n_subPDUs = 0;        // number of RAR payloads
     uint8_t n_subheaders = 0;     // number of MAC RAR subheaders
     //uint8_t best_rx_rapid = -1;   // the closest RAPID receive from all RARs
-    unsigned char freq_hopping, msg3_t_alloc, mcs, tpc_command, csi_req;
-    uint16_t ta_command = 0, msg3_f_alloc, bwp_size;
-    int f_alloc, mask;
+    //unsigned char freq_hopping, msg3_t_alloc, mcs, tpc_command, csi_req; // WIP
+    //uint16_t ta_command = 0, msg3_f_alloc, bwp_size; // WIP
+    uint16_t ta_command = 0;
+    //int f_alloc, mask; // WIP
 
     AssertFatal(CC_id == 0, "RAR reception on secondary CCs is not supported yet\n");
 
@@ -143,6 +144,7 @@ uint16_t nr_ue_process_rar(module_id_t mod_id,
     // LOG_I(MAC, "[UE %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",
     //   mod_id, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2], rar[3], rar[4], rar[5], rarh->RAPID, preamble_index);
 
+    #if 0 // TbD WIP Msg3 development ongoing
     if (ue_mac->RA_RAPID_found) {
       // TC-RNTI
       *t_crnti = rar->TCRNTI_2 + (rar->TCRNTI_1 << 8);
@@ -200,6 +202,7 @@ uint16_t nr_ue_process_rar(module_id_t mod_id,
       ue_mac->t_crnti = 0;
       ta_command = (0xffff);
     }
+    #endif
 
     // move the selected RAR to the front of the RA_PDSCH buffer
     memcpy((void *) (selected_rar_buffer + 0), (void *) rarh, 1);
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
index 2eb4ad498bb8e2d40130bc6edf7872e7ce13b1f3..e90a69638c47216554b29b01096c5c3adcac9b51 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
@@ -42,8 +42,7 @@
 #include "SIMULATION/TOOLS/sim.h" // for taus
 
 extern RAN_CONTEXT_t RC;
-
-const uint8_t nr_slots_per_frame_mac[5] = {10, 20, 40, 80, 160};
+extern const uint8_t nr_slots_per_frame[5];
 
 uint8_t DELTA[4]= {2,3,4,6};
 
@@ -185,7 +184,7 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot,
     tdd_period_slot++;
 
   // computing start of next period
-  uint8_t start_next_period = (rach_slot-(rach_slot%tdd_period_slot)+tdd_period_slot)%nr_slots_per_frame_mac[mu];
+  uint8_t start_next_period = (rach_slot-(rach_slot%tdd_period_slot)+tdd_period_slot)%nr_slots_per_frame[mu];
   *msg2_slot = start_next_period + last_dl_slot_period; // initializing scheduling of slot to next mixed (or last dl) slot
   *msg2_frame = (*msg2_slot>(rach_slot))? rach_frame : (rach_frame +1);
 
@@ -217,16 +216,16 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot,
     default:
       AssertFatal(1==0,"Invalid response window value %d\n",response_window);
   }
-  AssertFatal(slot_window<=nr_slots_per_frame_mac[mu],"Msg2 response window needs to be lower or equal to 10ms");
+  AssertFatal(slot_window<=nr_slots_per_frame[mu],"Msg2 response window needs to be lower or equal to 10ms");
 
   // slot and frame limit to transmit msg2 according to response window
-  uint8_t slot_limit = (rach_slot + slot_window)%nr_slots_per_frame_mac[mu];
+  uint8_t slot_limit = (rach_slot + slot_window)%nr_slots_per_frame[mu];
   //uint8_t frame_limit = (slot_limit>(rach_slot))? rach_frame : (rach_frame +1);
 
 
   // go to previous slot if the current scheduled slot is beyond the response window
   // and if the slot is not among the PDCCH monitored ones (38.213 10.1)
-  while ((*msg2_slot>slot_limit) || ((*msg2_frame*nr_slots_per_frame_mac[mu]+*msg2_slot-monitoring_offset)%monitoring_slot_period !=0))  {
+  while ((*msg2_slot>slot_limit) || ((*msg2_frame*nr_slots_per_frame[mu]+*msg2_slot-monitoring_offset)%monitoring_slot_period !=0))  {
     if((*msg2_slot%tdd_period_slot) > 0)
       (*msg2_slot)--;
     else
@@ -397,11 +396,11 @@ void nr_get_Msg3alloc(NR_ServingCellConfigCommon_t *scc,
   uint8_t k2 = *ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2;
 
   temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213
-  ra->Msg3_slot = temp_slot%nr_slots_per_frame_mac[mu];
-  if (nr_slots_per_frame_mac[mu]>temp_slot)
+  ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu];
+  if (nr_slots_per_frame[mu]>temp_slot)
     ra->Msg3_frame = current_frame;
   else
-    ra->Msg3_frame = current_frame + (temp_slot/nr_slots_per_frame_mac[mu]);
+    ra->Msg3_frame = current_frame + (temp_slot/nr_slots_per_frame[mu]);
 
   ra->msg3_nb_rb = 18;
   ra->msg3_first_rb = 0;
@@ -601,7 +600,11 @@ void nr_generate_Msg2(module_id_t module_idP,
 
     LOG_D(MAC, "[RAPROC] Scheduling common search space DCI type 1 dlBWP BW %d\n", dci10_bw);
 
-    mcsIndex = 0; // Qm>2 not allowed for RAR
+    // Qm>2 not allowed for RAR
+    if (get_softmodem_params()->do_ra)
+      mcsIndex = 9;
+    else
+      mcsIndex = 0;
 
     pdsch_pdu_rel15->pduBitmap = 0;
     pdsch_pdu_rel15->rnti = RA_rnti;
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
index 8841083796b3034b9a09d2a5ca494e144c4ef6ed..9f5d4f5ec747cd4a7dd1535ede8fcb180ffb5a8a 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
@@ -954,11 +954,10 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP,
     pusch_pdu->pusch_ptrs.ptrs_ports_list   = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t));
     pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0;
 
-    pusch_pdu->pdu_bit_map &= PUSCH_PDU_BITMAP_PUSCH_PTRS; // enable PUSCH PTRS
+    pusch_pdu->pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_PTRS; // enable PUSCH PTRS
   }
   else{
-//    if(1<<pusch_pdu->pusch_ptrs.ptrs_time_density >= pusch_pdu->nr_of_symbols)
-      pusch_pdu->pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS
+    pusch_pdu->pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS
   }
 
   // --------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index 6c6bd30070a3ac55c67f4bd4a2814a5e10854db5..c9a62d573b5b78decde8c5af19a814a526151741 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -310,7 +310,7 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const  ctxt_p
           ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
 
     if (h_rc == HASH_TABLE_OK) {
-      LOG_I(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %ld \n",
+      LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %ld \n",
             ctxt.frame, ctxt.instance, len, rab_id);
       LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n",
             ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id,
diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c
index 2fb844f05a8b5d567cc559896e19a71643a1fe56..98c8c3e252da05ebe81b4f237b2078f07ffe39d7 100644
--- a/openair2/LAYER2/RLC/rlc.c
+++ b/openair2/LAYER2/RLC/rlc.c
@@ -519,7 +519,7 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t *const ctxt_pP,
     //  LOG_I(RLC,"DUY rlc_data_req: mbms_rb_id in RLC instant is: %d\n", mbms_rb_id);
     if (sdu_pP != NULL) {
       if (sdu_sizeP > 0) {
-        LOG_I(RLC,"received a packet with size %d for MBMS \n", sdu_sizeP);
+        LOG_D(RLC,"received a packet with size %d for MBMS \n", sdu_sizeP);
         new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc), __func__);
 
         if (new_sdu_p != NULL) {
diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c
index 85ee4e05719f845a6702edc246bd605e4772baa4..4313f379fe0f9e5475dbd8053215f0c73567f5d8 100644
--- a/openair2/LAYER2/RLC/rlc_rrc.c
+++ b/openair2/LAYER2/RLC/rlc_rrc.c
@@ -640,7 +640,8 @@ rlc_union_t *rrc_rlc_add_rlc   (
   } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) {
     rlc_union_p = calloc(1, sizeof(rlc_union_t));
     h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p);
-    h_lcid_rc = hashtable_insert(rlc_coll_p, key_lcid, rlc_union_p);
+    if(MBMS_flagP != TRUE)
+    	h_lcid_rc = hashtable_insert(rlc_coll_p, key_lcid, rlc_union_p);
 
     if ((h_rc == HASH_TABLE_OK) && (h_lcid_rc == HASH_TABLE_OK)) {
       if (MBMS_flagP == TRUE) {
diff --git a/openair2/M2AP/m2ap_MCE_interface_management.c b/openair2/M2AP/m2ap_MCE_interface_management.c
index 1bef8341794aea861c475fe077e850cbc3456f7b..e162c9a5de907d2e82559d499d229287e16d6802 100644
--- a/openair2/M2AP/m2ap_MCE_interface_management.c
+++ b/openair2/M2AP/m2ap_MCE_interface_management.c
@@ -521,6 +521,7 @@ int MCE_send_MBMS_SCHEDULING_INFORMATION(instance_t instance, /*uint32_t assoc_i
 		   mbsfn_subframe_configuration->radioframeAllocationPeriod = m2ap_mbms_scheduling_information->mbms_area_config_list[i].mbms_sf_config_list[j].radioframe_allocation_period;
 		   mbsfn_subframe_configuration->radioframeAllocationOffset = m2ap_mbms_scheduling_information->mbms_area_config_list[i].mbms_sf_config_list[j].radioframe_allocation_offset;
 		   if(m2ap_mbms_scheduling_information->mbms_area_config_list[i].mbms_sf_config_list[j].is_four_sf){
+			   LOG_I(M2AP,"is_four_sf\n");
 			   mbsfn_subframe_configuration->subframeAllocation.present = M2AP_MBSFN_Subframe_Configuration__subframeAllocation_PR_fourFrames;
 			   mbsfn_subframe_configuration->subframeAllocation.choice.oneFrame.buf = MALLOC(3);
 			   mbsfn_subframe_configuration->subframeAllocation.choice.oneFrame.buf[2] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[i].mbms_sf_config_list[j].subframe_allocation) & 0xFF);
@@ -530,6 +531,7 @@ int MCE_send_MBMS_SCHEDULING_INFORMATION(instance_t instance, /*uint32_t assoc_i
 			   mbsfn_subframe_configuration->subframeAllocation.choice.oneFrame.bits_unused = 0;
 
 		   }else{
+			   LOG_I(M2AP,"is_one_sf\n");
 			   mbsfn_subframe_configuration->subframeAllocation.present = M2AP_MBSFN_Subframe_Configuration__subframeAllocation_PR_oneFrame;
 			   mbsfn_subframe_configuration->subframeAllocation.choice.oneFrame.buf = MALLOC(1);
 			   mbsfn_subframe_configuration->subframeAllocation.choice.oneFrame.size = 1;
@@ -1357,11 +1359,10 @@ int MCE_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance,
 
 
 
-int MCE_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance,
-                                                      uint32_t assoc_id,
-                                                      uint32_t stream,
-                                                      M2AP_M2AP_PDU_t *pdu){
+int MCE_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance,module_id_t du_mod_idP){
+
   AssertFatal(1==0,"Not implemented yet\n");
+ 
 }
 
 /*
@@ -1378,16 +1379,138 @@ int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance,
                                                   uint32_t assoc_id,
                                                   uint32_t stream,
                                                   M2AP_M2AP_PDU_t *pdu){
-  AssertFatal(1==0,"Not implemented yet\n");
+  //int i;
+  //AssertFatal(1==0,"Not implemented yet\n");
+  LOG_D(M2AP, "MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE\n");
+
+   AssertFatal(pdu->present == M2AP_M2AP_PDU_PR_successfulOutcome,
+	       "pdu->present != M2AP_M2AP_PDU_PR_successfulOutcome\n");
+   AssertFatal(pdu->choice.successfulOutcome.procedureCode  == M2AP_ProcedureCode_id_mbmsServiceCounting,
+	       "pdu->choice.successfulOutcome->procedureCode != M2AP_ProcedureCode_id_mbmsServiceCounting\n");
+   AssertFatal(pdu->choice.successfulOutcome.criticality  == M2AP_Criticality_reject,
+	       "pdu->choice.successfulOutcome->criticality != M2AP_Criticality_reject\n");
+   AssertFatal(pdu->choice.successfulOutcome.value.present  == M2AP_SuccessfulOutcome__value_PR_MbmsServiceCountingResponse,
+	       "pdu->choice.successfulOutcome.value.present != M2AP_SuccessfulOutcome__value_PR_MbmsServiceCountingResponse\n");
+
+
+  M2AP_MbmsServiceCountingResponse_t    *in = &pdu->choice.successfulOutcome.value.choice.MbmsServiceCountingResponse;
+  //M2AP_MbmsServiceCountingResponse_Ies_t  *ie;
+  //int MCE_MBMS_M2AP_ID=-1;
+  //int ENB_MBMS_M2AP_ID=-1;
+
+
+  MessageDef *msg_g = itti_alloc_new_message(TASK_M2AP_MCE,M2AP_MBMS_SERVICE_COUNTING_RESP); //TODO
+
+  LOG_D(M2AP, "M2AP: MbmsServiceCounting-Resp: protocolIEs.list.count %d\n",
+         in->protocolIEs.list.count);
+  for (int i=0;i < in->protocolIEs.list.count; i++) {
+     //ie = in->protocolIEs.list.array[i];
+    // switch (ie->id) {
+    // case M2AP_ProtocolIE_ID_id_MCE_MBMS_M2AP_ID:
+    //   AssertFatal(ie->criticality == M2AP_Criticality_reject,
+    //               "ie->criticality != M2AP_Criticality_reject\n");
+    //   AssertFatal(ie->value.present == M2AP_SessionStartResponse_Ies__value_PR_MCE_MBMS_M2AP_ID,
+    //               "ie->value.present != M2AP_sessionStartResponse_IEs__value_PR_MCE_MBMS_M2AP_ID\n");
+    //   MCE_MBMS_M2AP_ID=ie->value.choice.MCE_MBMS_M2AP_ID;
+    //   LOG_D(M2AP, "M2AP: SessionStart-Resp: MCE_MBMS_M2AP_ID %d\n",
+    //         MCE_MBMS_M2AP_ID);
+    //   break;
+    //  case M2AP_ProtocolIE_ID_id_ENB_MBMS_M2AP_ID:
+    //   AssertFatal(ie->criticality == M2AP_Criticality_reject,
+    //               "ie->criticality != M2AP_Criticality_reject\n");
+    //   AssertFatal(ie->value.present == M2AP_SessionStartResponse_Ies__value_PR_ENB_MBMS_M2AP_ID,
+    //               "ie->value.present != M2AP_sessionStartResponse_Ies__value_PR_ENB_MBMS_M2AP_ID\n");
+    //   ENB_MBMS_M2AP_ID=ie->value.choice.ENB_MBMS_M2AP_ID;
+    //   LOG_D(M2AP, "M2AP: SessionStart-Resp: ENB_MBMS_M2AP_ID %d\n",
+    //         ENB_MBMS_M2AP_ID);
+    //   break;
+    // }
+  }
+
+  //AssertFatal(MCE_MBMS_M2AP_ID!=-1,"MCE_MBMS_M2AP_ID was not sent\n");
+  //AssertFatal(ENB_MBMS_M2AP_ID!=-1,"ENB_MBMS_M2AP_ID was not sent\n");
+  //M2AP_SESSION_START_RESP(msg_p).
+//  MSC_LOG_RX_MESSAGE(
+//    MSC_M2AP_MCE,
+//    MSC_M2AP_ENB,
+	//return 0;
+//    0,
+//    0,
+//    MSC_AS_TIME_FMT" MCE_handle_M2_SESSION_START_RESPONSE successfulOutcome assoc_id %d",
+//    0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
+//    assoc_id);
+//
+   //LOG_D(M2AP, "Sending  ITTI message to ENB_APP with assoc_id (%d->%d)\n",
+         //assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id));
+
+   itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_g);
+   return 0;
+
 }
 
 
 
-int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance,
-                                                      uint32_t assoc_id,
-                                                      uint32_t stream,
-                                                      M2AP_M2AP_PDU_t *pdu){
-  AssertFatal(1==0,"Not implemented yet\n");
+int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance,  module_id_t du_mod_idP){
+
+  M2AP_M2AP_PDU_t          pdu; 
+  M2AP_MbmsServiceCountingRequest_t      *out;
+  M2AP_MbmsServiceCountingRequest_Ies_t   *ie;
+
+  uint8_t *buffer;
+  uint32_t len;
+  //int	   i=0; 
+  //int 	   j=0;
+
+  /* Create */
+  /* 0. pdu Type */
+  memset(&pdu, 0, sizeof(pdu));
+  pdu.present = M2AP_M2AP_PDU_PR_initiatingMessage;
+  //pdu.choice.initiatingMessage = (M2AP_InitiatingMessage_t *)calloc(1, sizeof(M2AP_InitiatingMessage_t));
+  pdu.choice.initiatingMessage.procedureCode = M2AP_ProcedureCode_id_mbmsServiceCounting;
+  pdu.choice.initiatingMessage.criticality   = M2AP_Criticality_reject;
+  pdu.choice.initiatingMessage.value.present = M2AP_InitiatingMessage__value_PR_MbmsServiceCountingRequest;
+  out = &pdu.choice.initiatingMessage.value.choice.MbmsServiceCountingRequest;  
+
+  /* mandatory */
+  /* c1. MCCH_Update_Time */ //long
+  ie=(M2AP_MbmsServiceCountingRequest_Ies_t *)calloc(1,sizeof(M2AP_MbmsSchedulingInformation_Ies_t));
+  ie->id                        = M2AP_ProtocolIE_ID_id_MCCH_Update_Time;
+  ie->criticality               = M2AP_Criticality_reject;
+  ie->value.present             = M2AP_MbmsServiceCountingRequest_Ies__value_PR_MCCH_Update_Time;
+  //ie->value.choice.MCCH_Update_Time =  ; 
+  //ie->value.choice.MCCH_Update_Time = m2ap_mbms_scheduling_information->mcch_update_time;
+
+  ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);  
+
+
+  /* mandatory */
+  /* c1. MCE_MBMS_M2AP_ID (integer value) */ //long
+  ie = (M2AP_MbmsServiceCountingRequest_Ies_t *)calloc(1, sizeof(M2AP_MbmsServiceCountingRequest_Ies_t));
+  ie->id                        = M2AP_ProtocolIE_ID_id_MBSFN_Area_ID;
+  ie->criticality               = M2AP_Criticality_reject;
+  ie->value.present             = M2AP_MbmsServiceCountingRequest_Ies__value_PR_MBSFN_Area_ID;
+  //ie->value.choice.MCE_MBMS_M2AP_ID = /*F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP);*/ //?
+  ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+  /* mandatory */
+  /* c2. TMGI (integrer value) */
+  ie = (M2AP_MbmsServiceCountingRequest_Ies_t *)calloc(1, sizeof(M2AP_MbmsServiceCountingRequest_Ies_t ));
+  ie->id                        = M2AP_ProtocolIE_ID_id_MBMS_Counting_Request_Session;
+  ie->criticality               = M2AP_Criticality_reject;
+  ie->value.present             = M2AP_MbmsServiceCountingRequest_Ies__value_PR_MBMS_Counting_Request_Session;
+
+  //M2AP_MBMS_Counting_Request_Session_t * m2ap_mbms_counting_request_session = &ie->value.choice.MBMS_Counting_Request_Session;
+
+                        //&ie->choice.TMGI.pLMN_Identity);
+  //INT16_TO_OCTET_STRING(0,&ie->choice.TMGI.serviceId);
+  ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+  if (m2ap_encode_pdu(&pdu, &buffer, &len) < 0) {
+    LOG_E(M2AP, "Failed to encode MBMS Service Counting Results Report\n");
+    return -1;
+  }
+
+  return 0;
 
 }
 
diff --git a/openair2/M2AP/m2ap_MCE_interface_management.h b/openair2/M2AP/m2ap_MCE_interface_management.h
index 6b899e9ea275e8646fbf73c6adf9f8ff0ec5c231..2b1d5824af0d224ff2bbbf06fd94b6c61ec904cc 100644
--- a/openair2/M2AP/m2ap_MCE_interface_management.h
+++ b/openair2/M2AP/m2ap_MCE_interface_management.h
@@ -150,10 +150,7 @@ int MCE_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance,
                                                   uint32_t stream,
                                                   M2AP_M2AP_PDU_t *pdu);
 
-int MCE_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance,
-                                                      uint32_t assoc_id,
-                                                      uint32_t stream,
-                                                      M2AP_M2AP_PDU_t *pdu);
+int MCE_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance,module_id_t du_mod_idP);
 
 /*
  * Service Counting Request
@@ -165,10 +162,7 @@ int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance,
                                                   uint32_t stream,
                                                   M2AP_M2AP_PDU_t *pdu);
 
-int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance,
-                                                      uint32_t assoc_id,
-                                                      uint32_t stream,
-                                                      M2AP_M2AP_PDU_t *pdu);
+int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, module_id_t du_mod_idP);
 /*
  * Service Counting Results Report
  */
diff --git a/openair2/M2AP/m2ap_eNB.c b/openair2/M2AP/m2ap_eNB.c
index 206b7cf8ca7e6b34f75c9064ba79d01c9bb27a66..39c769a43d67ae25e602fc980b84483fbff46951 100644
--- a/openair2/M2AP/m2ap_eNB.c
+++ b/openair2/M2AP/m2ap_eNB.c
@@ -142,6 +142,22 @@ void m2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
               sctp_new_association_resp->ulp_cnx_id);
     //m2ap_handle_m2_setup_message(instance_p, m2ap_enb_data_p,
     //                             sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
+
+	  sleep(4);
+	  int index;
+	  /* Trying to connect to the provided list of eNB ip address */
+	  for (index = 0; index < instance_p->nb_m2; index++) {
+	    //M2AP_INFO("eNB[%d] eNB id %u acting as an initiator (client)\n",
+	     //         instance_id, instance->eNB_id);
+	    m2ap_eNB_register_eNB(instance_p,
+				  &instance_p->target_mce_m2_ip_address[index],
+				  &instance_p->enb_m2_ip_address,
+				  instance_p->sctp_in_streams,
+				  instance_p->sctp_out_streams,
+				  instance_p->enb_port_for_M2C,
+				  instance_p->multi_sd);
+	  }
+
     return;
   }
 
@@ -304,6 +320,8 @@ void m2ap_eNB_handle_register_eNB(instance_t instance,
     DevCheck(new_instance->mcc == m2ap_register_eNB->mcc, new_instance->mcc, m2ap_register_eNB->mcc, 0);
     DevCheck(new_instance->mnc == m2ap_register_eNB->mnc, new_instance->mnc, m2ap_register_eNB->mnc, 0);
     M2AP_WARN("eNB[%d] already registered\n", instance);
+
+     
   } else {
     new_instance = calloc(1, sizeof(m2ap_eNB_instance_t));
     DevAssert(new_instance != NULL);
diff --git a/openair2/M2AP/m2ap_eNB_interface_management.c b/openair2/M2AP/m2ap_eNB_interface_management.c
index 95b83720258dead917526f44f08b9b9f242f8bf7..9649d919c3bf57d380cd28bac0d64d43786d6819 100644
--- a/openair2/M2AP/m2ap_eNB_interface_management.c
+++ b/openair2/M2AP/m2ap_eNB_interface_management.c
@@ -163,8 +163,12 @@ int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance,
 			  M2AP_MBMS_SCHEDULING_INFORMATION(message_p).mbms_area_config_list[i].mbms_sf_config_list[j].radioframe_allocation_period = m2ap_mbsfn_sf_configuration->radioframeAllocationPeriod;
 			  M2AP_MBMS_SCHEDULING_INFORMATION(message_p).mbms_area_config_list[i].mbms_sf_config_list[j].radioframe_allocation_offset = m2ap_mbsfn_sf_configuration->radioframeAllocationOffset;
 			  if( m2ap_mbsfn_sf_configuration->subframeAllocation.present == M2AP_MBSFN_Subframe_Configuration__subframeAllocation_PR_fourFrames ) {
+				LOG_I(RRC,"is_four_sf\n");
+				M2AP_MBMS_SCHEDULING_INFORMATION(message_p).mbms_area_config_list[i].mbms_sf_config_list[j].is_four_sf = 1;
 				M2AP_MBMS_SCHEDULING_INFORMATION(message_p).mbms_area_config_list[i].mbms_sf_config_list[j].subframe_allocation = m2ap_mbsfn_sf_configuration->subframeAllocation.choice.oneFrame.buf[0] | (m2ap_mbsfn_sf_configuration->subframeAllocation.choice.oneFrame.buf[1]<<8) | (m2ap_mbsfn_sf_configuration->subframeAllocation.choice.oneFrame.buf[0]<<16);
 			  }else{
+				LOG_I(RRC,"is_one_sf\n");
+				M2AP_MBMS_SCHEDULING_INFORMATION(message_p).mbms_area_config_list[i].mbms_sf_config_list[j].is_four_sf = 0;
 				M2AP_MBMS_SCHEDULING_INFORMATION(message_p).mbms_area_config_list[i].mbms_sf_config_list[j].subframe_allocation = (m2ap_mbsfn_sf_configuration->subframeAllocation.choice.oneFrame.buf[0] >> 2) & 0x3F;
 			  }
                   }
@@ -1262,46 +1266,226 @@ int eNB_handle_MBMS_SERVICE_COUNTING_REQ(instance_t instance,
                                                   uint32_t stream,
                                                   M2AP_M2AP_PDU_t *pdu)
 {
-  LOG_D(M2AP, "eNB_handle_MBMS_SERVICE_COUNTING_REQUEST assoc_id %d\n",assoc_id);
 
-  MessageDef                         *message_p;
+   LOG_D(M2AP, "eNB_handle_MBMS_SERVICE_COUNTING_REQUEST assoc_id %d\n",assoc_id);
+ 
+   //MessageDef                         *message_p;
   //M2AP_MbmsServiceCountingRequest_t              *container;
   //M2AP_MbmsServiceCountingRequest_Ies_t           *ie;
+  M2AP_MbmsServiceCountingRequest_t              *in;
+  M2AP_MbmsServiceCountingRequest_Ies_t           *ie;
   //int i = 0;
+  int j;
 
   DevAssert(pdu != NULL);
 
  // container = &pdu->choice.initiatingMessage.value.choice.MbmsServiceCountingRequest;
+  in = &pdu->choice.initiatingMessage.value.choice.MbmsServiceCountingRequest;
 
   /* M2 Setup Request == Non UE-related procedure -> stream 0 */
   if (stream != 0) {
-    LOG_D(M2AP, "[SCTP %d] Received MMBS session start request on stream != 0 (%d)\n",
+    LOG_D(M2AP, "[SCTP %d] Received MMBS service Counting Request on stream != 0 (%d)\n",
               assoc_id, stream);
   }
 
-  message_p  = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_MBMS_SERVICE_COUNTING_REQ);
+  for (j=0;j < in->protocolIEs.list.count; j++) {
+     ie = in->protocolIEs.list.array[j];
+     switch (ie->id) {
+     case M2AP_ProtocolIE_ID_id_MCCH_Update_Time:
+       AssertFatal(ie->criticality == M2AP_Criticality_reject,
+                   "ie->criticality != M2AP_Criticality_reject\n");
+       AssertFatal(ie->value.present == M2AP_MbmsServiceCountingRequest_Ies__value_PR_MCCH_Update_Time,
+                   "ie->value.present != M2AP_MbmsServiceCountingRequest_Ies__value_PR_MCCH_Update_Time\n");
+       LOG_D(M2AP, "M2AP: : MCCH_Update_Time \n");
+	break;					
+     case M2AP_ProtocolIE_ID_id_MBSFN_Area_ID:
+       AssertFatal(ie->criticality == M2AP_Criticality_reject,
+                   "ie->criticality != M2AP_Criticality_reject\n");
+       AssertFatal(ie->value.present == M2AP_MbmsServiceCountingRequest_Ies__value_PR_MBSFN_Area_ID,
+                   "ie->value.present != M2AP_MbmsServiceCountingRequest_Ies__value_PR_MBSFN_Area_ID\n");
+       LOG_D(M2AP, "M2AP: : MBSFN_Area_ID \n");
+	break;					
+     case M2AP_ProtocolIE_ID_id_MBMS_Counting_Request_Session:
+       AssertFatal(ie->criticality == M2AP_Criticality_reject,
+                   "ie->criticality != M2AP_Criticality_reject\n");
+       AssertFatal(ie->value.present == M2AP_MbmsServiceCountingRequest_Ies__value_PR_MBMS_Counting_Request_Session,
+                   "ie->value.present != M2AP_MbmsServiceCountingRequest_Ies__value_PR_MBMS_Counting_Request_Session\n");
+       LOG_D(M2AP, "M2AP: : MBMS_Counting_Request_Session \n");
 
+        //ie->value.choice.MBMS_Counting_Request_Session.list.count;
 
-  itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p);
+	break;					
+
+     }
+ }
 
 
 
+   //message_p  = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_MBMS_SERVICE_COUNTING_REQ);
+
 
    return 0;
 }
 int eNB_send_MBMS_SERVICE_COUNTING_REPORT(instance_t instance, m2ap_mbms_service_counting_report_t * m2ap_mbms_service_counting_report)
 {
-  AssertFatal(1==0,"Not implemented yet\n");
+  M2AP_M2AP_PDU_t           pdu;
+  M2AP_MbmsServiceCountingResultsReport_t    *out;
+  M2AP_MbmsServiceCountingResultsReport_Ies_t *ie;
+
+  uint8_t  *buffer;
+  uint32_t  len;
+  //int       i = 0;
+  //
+  // memset(&pdu, 0, sizeof(pdu));
+  pdu.present = M2AP_M2AP_PDU_PR_initiatingMessage;
+  //pdu.choice.initiatingMessage = (M2AP_InitiatingMessage_t *)calloc(1, sizeof(M2AP_InitiatingMessage_t));
+  pdu.choice.initiatingMessage.procedureCode = M2AP_ProcedureCode_id_mbmsServiceCountingResultsReport;
+  pdu.choice.initiatingMessage.criticality   = M2AP_Criticality_reject;
+  pdu.choice.initiatingMessage.value.present = M2AP_InitiatingMessage__value_PR_MbmsServiceCountingResultsReport;
+  out = &pdu.choice.initiatingMessage.value.choice.MbmsServiceCountingResultsReport;
+
+
+  /* Create */
+  /* 0. Message Type */
+  memset(&pdu, 0, sizeof(pdu));
+  pdu.present = M2AP_M2AP_PDU_PR_initiatingMessage;
+  //pdu.choice.successfulOutcome = (M2AP_SuccessfulOutcome_t *)calloc(1, sizeof(M2AP_SuccessfulOutcome_t));
+  pdu.choice.initiatingMessage.procedureCode = M2AP_ProcedureCode_id_mbmsServiceCountingResultsReport;
+  pdu.choice.initiatingMessage.criticality   = M2AP_Criticality_reject;
+  pdu.choice.initiatingMessage.value.present = M2AP_InitiatingMessage__value_PR_MbmsServiceCountingResultsReport;
+  out = &pdu.choice.initiatingMessage.value.choice.MbmsServiceCountingResultsReport;
+  
+  /* mandatory */
+  /* c1. MBSFN_Area_ID (integer value) */ //long
+  ie = (M2AP_MbmsServiceCountingResultsReport_Ies_t *)calloc(1, sizeof(M2AP_MbmsServiceCountingResultsReport_Ies_t));
+  ie->id                        = M2AP_ProtocolIE_ID_id_MBSFN_Area_ID;
+  ie->criticality               = M2AP_Criticality_reject;
+  ie->value.present             = M2AP_MbmsServiceCountingResultsReport_Ies__value_PR_MBSFN_Area_ID;
+  //ie->value.choice.MCE_MBMS_M2AP_ID = /*F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP);*/ //?
+  ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+  /* mandatory */
+  /* c1. MBSFN_Area_ID (integer value) */ //long
+  ie = (M2AP_MbmsServiceCountingResultsReport_Ies_t *)calloc(1, sizeof(M2AP_MbmsServiceCountingResultsReport_Ies_t));
+  ie->id                        = M2AP_ProtocolIE_ID_id_MBMS_Counting_Result_List;
+  ie->criticality               = M2AP_Criticality_reject;
+  ie->value.present             = M2AP_MbmsServiceCountingResultsReport_Ies__value_PR_MBMS_Counting_Result_List;
+  //ie->value.choice.MCE_MBMS_M2AP_ID = /*F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP);*/ //?
+  M2AP_MBMS_Counting_Result_List_t * m2ap_mbms_counting_result_list = &ie->value.choice.MBMS_Counting_Result_List;
+
+  M2AP_MBMS_Counting_Result_Item_t * m2ap_mbms_counting_result_item = (M2AP_MBMS_Counting_Result_Item_t*)calloc(1,sizeof(M2AP_MBMS_Counting_Result_Item_t));
+  m2ap_mbms_counting_result_item->id = M2AP_ProtocolIE_ID_id_MBMS_Counting_Result_Item;
+  m2ap_mbms_counting_result_item->criticality = M2AP_Criticality_reject;
+  m2ap_mbms_counting_result_item->value.present = M2AP_MBMS_Counting_Result_Item__value_PR_MBMS_Counting_Result;
+  M2AP_MBMS_Counting_Result_t * m2ap_mbms_counting_result = &m2ap_mbms_counting_result_item->value.choice.MBMS_Counting_Result;
+
+  M2AP_TMGI_t * tmgi = &m2ap_mbms_counting_result->tmgi;
+  MCC_MNC_TO_PLMNID(0,0,3,&tmgi->pLMNidentity);/*instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,*/
+  uint8_t TMGI[5] = {4,3,2,1,0};
+  OCTET_STRING_fromBuf(&tmgi->serviceID,(const char*)&TMGI[2],3);
+
+  //M2AP_CountingResult_t * m2ap_counting_result = &m2ap_mbms_counting_result->countingResult;
+
+  ASN_SEQUENCE_ADD(&m2ap_mbms_counting_result_list->list,m2ap_mbms_counting_result_item);
+
+
+
+  ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+  if (m2ap_encode_pdu(&pdu, &buffer, &len) < 0) {
+    LOG_E(M2AP, "Failed to encode MBMS Service Counting Results Report\n");
+    return -1;
+  }
    return 0;
 }
+
 int eNB_send_MBMS_SERVICE_COUNTING_RESP(instance_t instance, m2ap_mbms_service_counting_resp_t * m2ap_mbms_service_counting_resp)
 {
   AssertFatal(1==0,"Not implemented yet\n");
+  M2AP_M2AP_PDU_t           pdu;
+  M2AP_MbmsServiceCountingResponse_t    *out;
+  M2AP_MbmsServiceCountingResponse_Ies_t *ie;
+
+  uint8_t  *buffer;
+  uint32_t  len;
+  //int       i = 0;
+
+  /* Create */
+  /* 0. Message Type */
+  memset(&pdu, 0, sizeof(pdu));
+  pdu.present = M2AP_M2AP_PDU_PR_successfulOutcome;
+  //pdu.choice.successfulOutcome = (M2AP_SuccessfulOutcome_t *)calloc(1, sizeof(M2AP_SuccessfulOutcome_t));
+  pdu.choice.successfulOutcome.procedureCode = M2AP_ProcedureCode_id_mbmsServiceCounting;
+  pdu.choice.successfulOutcome.criticality   = M2AP_Criticality_reject;
+  pdu.choice.successfulOutcome.value.present = M2AP_SuccessfulOutcome__value_PR_MbmsServiceCountingResponse;
+  out = &pdu.choice.successfulOutcome.value.choice.MbmsServiceCountingResponse;
+  
+
+  /* mandatory */
+  /* c1. MCE_MBMS_M2AP_ID (integer value) */ //long
+  ie = (M2AP_MbmsServiceCountingResponse_Ies_t*)calloc(1, sizeof(M2AP_MbmsServiceCountingResponse_Ies_t));
+  ie->id                        = M2AP_ProtocolIE_ID_id_MCE_MBMS_M2AP_ID;
+  ie->criticality               = M2AP_Criticality_reject;
+  ie->value.present             = M2AP_MbmsServiceCountingResponse_Ies__value_PR_CriticalityDiagnostics;
+  //ie->value.choice.MCE_MBMS_M2AP_ID = /*F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP);*/ //?
+  ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+  if (m2ap_encode_pdu(&pdu, &buffer, &len) < 0) {
+    LOG_E(M2AP, "Failed to encode MBMS Service Counting Results Report\n");
+    return -1;
+  }
+
+    return 0;
    return 0;
 }
+
 int eNB_send_MBMS_SERVICE_COUNTING_FAILURE(instance_t instance, m2ap_mbms_service_counting_failure_t * m2ap_mbms_service_counting_failure)
 {
-  AssertFatal(1==0,"Not implemented yet\n");
+  M2AP_M2AP_PDU_t           pdu;
+  M2AP_MbmsServiceCountingFailure_t    *out;
+  M2AP_MbmsServiceCountingFailure_Ies_t *ie;
+
+  uint8_t  *buffer;
+  uint32_t  len;
+  //int       i = 0;
+
+  /* Create */
+  /* 0. Message Type */
+  memset(&pdu, 0, sizeof(pdu));
+  pdu.present = M2AP_M2AP_PDU_PR_unsuccessfulOutcome;
+  //pdu.choice.successfulOutcome = (M2AP_SuccessfulOutcome_t *)calloc(1, sizeof(M2AP_SuccessfulOutcome_t));
+  pdu.choice.unsuccessfulOutcome.procedureCode = M2AP_ProcedureCode_id_mbmsServiceCounting;
+  pdu.choice.unsuccessfulOutcome.criticality   = M2AP_Criticality_reject;
+  pdu.choice.unsuccessfulOutcome.value.present = M2AP_UnsuccessfulOutcome__value_PR_MbmsServiceCountingFailure;
+  out = &pdu.choice.unsuccessfulOutcome.value.choice.MbmsServiceCountingFailure;
+  
+
+  /* mandatory */
+  /* c1. MCE_MBMS_M2AP_ID (integer value) */ //long
+  ie = (M2AP_MbmsServiceCountingFailure_Ies_t*)calloc(1, sizeof(M2AP_MbmsServiceCountingFailure_Ies_t));
+  ie->id                        = M2AP_ProtocolIE_ID_id_ENB_MBMS_M2AP_ID;
+  ie->criticality               = M2AP_Criticality_reject;
+  ie->value.present             = M2AP_MbmsServiceCountingFailure_Ies__value_PR_CriticalityDiagnostics;
+  //ie->value.choice.MCE_MBMS_M2AP_ID = /*F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP);*/ //?
+  ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+    /* mandatory */
+  /* c2. Cause */
+  ie = (M2AP_MbmsServiceCountingFailure_Ies_t *)calloc(1, sizeof(M2AP_MbmsServiceCountingFailure_Ies_t));
+  ie->id                        = M2AP_ProtocolIE_ID_id_Cause;
+  ie->criticality               = M2AP_Criticality_ignore;
+  ie->value.present             = M2AP_MbmsServiceCountingFailure_Ies__value_PR_Cause;
+  ie->value.choice.Cause.present = M2AP_Cause_PR_radioNetwork;
+  ie->value.choice.Cause.choice.radioNetwork = M2AP_CauseRadioNetwork_unspecified;
+  ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+
+  if (m2ap_encode_pdu(&pdu, &buffer, &len) < 0) {
+    LOG_E(M2AP, "Failed to encode MBMS Service Counting Results Report\n");
+    return -1;
+  }
+
+
    return 0;
 }
 
diff --git a/openair2/MCE_APP/mce_app.c b/openair2/MCE_APP/mce_app.c
index 6f7454c321a7a3fd9e22b480f42e0082b8792348..817c863f7b31052ccd5bf2da90e9910746f23032 100644
--- a/openair2/MCE_APP/mce_app.c
+++ b/openair2/MCE_APP/mce_app.c
@@ -372,7 +372,8 @@ void *MCE_app_task(void *args_p) {
 
  // /* Try to register each MCE with MCE each other */
  if (is_m3ap_MCE_enabled() /*&& !NODE_IS_DU(RC.rrc[0]->node_type)*/) {
-   	///*m3_register_mce_pending =*/ MCE_app_register_m3 (mce_id_start, mce_id_end);
+   	///*m3_register_mce_pending =*/ 
+	MCE_app_register_m3 (mce_id_start, mce_id_end);
    }
 
   do {
@@ -627,7 +628,7 @@ void *MCE_app_task(void *args_p) {
    	//}
 
 
-   	/*m3_register_mce_pending =*/ MCE_app_register_m3 (mce_id_start, mce_id_end);
+   	/*m3_register_mce_pending =*/ //MCE_app_register_m3 (mce_id_start, mce_id_end);
 
 	//MCE_app_send_m2ap_session_start_req(0);
 	break;
diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
index b18831b5468c4ffbc0efda14324af096ca94c0b0..e63f93b02819877c6bb70919850a3680d1547729 100644
--- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
+++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
@@ -117,13 +117,6 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
 
   if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra){
     nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx);
-    if (mac->generate_nr_prach){
-      //uint16_t monitoring_slot_period, monitoring_offset;
-      uint16_t rach_frame = mac->scheduled_response.ul_config->sfn;
-      uint16_t rx_rach_frame = (rach_frame + mac->RA_offset) % MAX_FRAME_NUMBER; // compensate 2 frames offset delay at gNB side
-      uint16_t rach_slot  = mac->scheduled_response.ul_config->slot;
-      nr_ue_msg2_scheduler(module_id, rx_rach_frame, rach_slot, &mac->msg2_rx_frame, &mac->msg2_rx_slot);
-    }
   }
 
   switch(ret){
@@ -154,7 +147,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
   fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request;
 
   if (!dl_info->dci_ind && !dl_info->rx_ind) {
-    // UL indication to schedule reception DCI reception
+    // UL indication to schedule DCI reception
     nr_ue_scheduler(dl_info, NULL);
   } else {
     // UL indication after reception of DCI or DL PDU
diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c
index 41fb3ddc3a7eebfcdd376c32a3009e75aa602eb4..de42d676248706f90b6409406c6d13a65b69cdd7 100644
--- a/openair2/PHY_INTERFACE/phy_stub_UE.c
+++ b/openair2/PHY_INTERFACE/phy_stub_UE.c
@@ -800,7 +800,37 @@ void dl_config_req_UE_MAC_dci(int sfn,
           UE_mac_inst[ue_id].first_ULSCH_Tx = 1;
         }
       }
-    } else {
+    } 
+    //else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) {
+    //  // BCH case: Last parameter is 1 if first time synchronization and zero
+    //  // otherwise.  Not sure which value to put for our case.
+    //  if (UE_mac_inst[Mod_id].UE_mode[0] == NOT_SYNCHED){
+    //    dl_phy_sync_success(Mod_id, sfn, 0, 1);
+    //    LOG_E(MAC,
+    //          "%s(): Received MIB: UE_mode: %d, sfn/sf: %d.%d\n",
+    //          __func__,
+    //          UE_mac_inst[Mod_id].UE_mode[0],
+    //          sfn,
+    //          sf);
+    //    UE_mac_inst[Mod_id].UE_mode[0] = PRACH;
+    //  } else {
+    //    dl_phy_sync_success(Mod_id, sfn, 0, 0);
+    //  }
+    //} else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_MCH_PDU_TYPE){
+    //    if (UE_mac_inst[Mod_id].UE_mode[0] == NOT_SYNCHED) {
+    //       /* this check is in the code before refactoring, but I don't know
+    //        * why. Leave it in here for the moment */
+    //       continue;
+    //    }
+    //    nfapi_dl_config_request_pdu_t *dl_config_pdu_tmp = &dl_config_pdu_list[i];
+    //    const int pdu_index = dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index;
+    //    ue_send_mch_sdu(Mod_id, 0, sfn,
+    //        tx_request_pdu_list[pdu_index].segments[0].segment_data,
+    //        tx_request_pdu_list[pdu_index].segments[0].segment_length,
+    //        0,0);
+
+    //} 
+    else {
       LOG_W(MAC, "can not handle special RNTI %x\n", rnti);
     }
   }
diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c
index 68017be85bba9f51b06995116a5721df1307e306..d9682b466f2f98148bc920ac221c26d63a93097a 100644
--- a/openair2/RRC/LTE/L2_interface.c
+++ b/openair2/RRC/LTE/L2_interface.c
@@ -28,6 +28,15 @@
  * \email: raymond.knopp@eurecom.fr
  */
 
+/*! \file l2_interface.c
+ * \brief layer 2 interface, added support for FeMBMS RRC sublayer 
+ * \author Javier Morgade
+ * \date 2020
+ * \version 1.0
+ * \email: javier.morgade@ieee.org
+ */
+
+
 #include "platform_types.h"
 #include "rrc_defs.h"
 #include "rrc_extern.h"
@@ -65,6 +74,9 @@ mac_rrc_data_req(
   uint8_t Sdu_size                = 0;
   uint8_t sfn                     = (uint8_t)((frameP>>2)&0xff);
 
+  uint8_t sfn_fembms              = (uint8_t)((frameP>>4)&0xff);
+  sfn_fembms = sfn_fembms<<2;
+
   if (LOG_DEBUGFLAG(DEBUG_RRC)) {
     LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id);
   }
@@ -72,12 +84,14 @@ mac_rrc_data_req(
   eNB_RRC_INST *rrc;
   rrc_eNB_carrier_data_t *carrier;
   LTE_BCCH_BCH_Message_t *mib;
+  LTE_BCCH_BCH_Message_MBMS_t *mib_fembms;
   rrc     = RC.rrc[Mod_idP];
   carrier = &rrc->carrier[0];
   mib     = &carrier->mib;
+  mib_fembms     = &carrier->mib_fembms;
 
   if((Srb_id & RAB_OFFSET) == BCCH_SI_MBMS){
-    if (frameP%4 == 0) {
+    if (frameP%8 == 0) {
       memcpy(&buffer_pP[0],
              RC.rrc[Mod_idP]->carrier[CC_id].SIB1_MBMS,
              RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_MBMS);
@@ -159,6 +173,22 @@ mac_rrc_data_req(
     return(3);
   }
 
+  if( (Srb_id & RAB_OFFSET ) == MIBCH_MBMS) {
+    mib_fembms->message.systemFrameNumber_r14.buf = &sfn_fembms;
+    enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_BCH_Message_MBMS,
+                                     NULL,
+                                     (void *)mib_fembms,
+                                     carrier->MIB_FeMBMS,
+                                     24);
+    LOG_I(RRC,"Encoded MIB MBMS for frame %d (%p), bits %lu %x,%x,%x %x bits_unused %d\n",sfn_fembms>>2,carrier->MIB_FeMBMS,enc_rval.encoded,carrier->MIB_FeMBMS[0],carrier->MIB_FeMBMS[1],carrier->MIB_FeMBMS[2],mib_fembms->message.systemFrameNumber_r14.buf[0],mib_fembms->message.systemFrameNumber_r14.bits_unused);
+    buffer_pP[0]=carrier->MIB_FeMBMS[0];
+    buffer_pP[1]=carrier->MIB_FeMBMS[1];
+    buffer_pP[2]=carrier->MIB_FeMBMS[2];
+    AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+                 enc_rval.failed_type->name, enc_rval.encoded);
+    return(3);
+  }
+
   if( (Srb_id & RAB_OFFSET ) == CCCH) {
     struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti);
 
@@ -203,8 +233,10 @@ mac_rrc_data_req(
            RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
            RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
 
+      LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
+
     if (LOG_DEBUGFLAG(DEBUG_RRC)) {
-      LOG_W(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
+      LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
 
       for (int i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) {
         LOG_T(RRC,"%x.",buffer_pP[i]);
@@ -216,6 +248,29 @@ mac_rrc_data_req(
     return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
   }
 
+  if((Srb_id & RAB_OFFSET) == MCCH_COUNTING) {
+    if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS_COUNTING[mbsfn_sync_area].Active==0) {
+      return 0;  // this parameter is set in function init_mcch in rrc_eNB.c
+    }
+
+    memcpy(&buffer_pP[0],
+           RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE_COUNTING[mbsfn_sync_area],
+           RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE_COUNTING[mbsfn_sync_area]);
+
+    if (LOG_DEBUGFLAG(DEBUG_RRC)) {
+      LOG_W(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE_COUNTING \n",Mod_idP,frameP);
+
+      for (int i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE_COUNTING[mbsfn_sync_area]; i++) {
+        LOG_T(RRC,"%x.",buffer_pP[i]);
+      }
+
+      LOG_T(RRC,"\n");
+    } /* LOG_DEBUGFLAG(DEBUG_RRC) */
+
+    return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE_COUNTING[mbsfn_sync_area]);
+  }
+
+
   if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR) {
     memcpy(&buffer_pP[0],
            RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR,
diff --git a/openair2/RRC/LTE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c
index 61ab63955dd529f6d492b3a837383732701521a7..8c55dbaeb50030fa4e1acdf1ec5038584317a381 100644
--- a/openair2/RRC/LTE/L2_interface_ue.c
+++ b/openair2/RRC/LTE/L2_interface_ue.c
@@ -19,7 +19,7 @@
  *      contact@openairinterface.org
  */
 
-/*! \file l2_interface.c
+/*! \file l2_interface_ue.c
  * \brief layer 2 interface, used to support different RRC sublayer
  * \author Raymond Knopp and Navid Nikaein
  * \date 2010-2014
@@ -28,6 +28,16 @@
  * \email: raymond.knopp@eurecom.fr
  */
 
+
+/*! \file l2_interface_ue.c
+ * \brief layer 2 interface, added support for FeMBMS RRC sublayer
+ * \author J. Morgade
+ * \date 2020
+ * \version 1.0
+ * \email: javier.morgade@ieee.org
+ */
+
+
 #include "platform_types.h"
 #include "rrc_defs.h"
 #include "rrc_extern.h"
@@ -219,6 +229,7 @@ mac_rrc_data_ind_ue(
   if ((srb_idP & RAB_OFFSET) == MCCH) {
     LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %ld from eNB %d\n",
           module_idP,frameP, mbsfn_sync_areaP, srb_idP & RAB_OFFSET,eNB_indexP);
+
     {
       MessageDef *message_p;
       int msg_sdu_size = sizeof(RRC_MAC_MCCH_DATA_IND (message_p).sdu);
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
index 9ede543003270ea62efb6f98f4786a92b5eb9302..09e6245fec1e0c6d75df85989f9a30b02241cbcd 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
@@ -28,6 +28,14 @@
  * \email: raymond.knopp@eurecom.fr and  navid.nikaein@eurecom.fr
  */
 
+/*! \file asn1_msg.c
+ * \brief added primitives to build the asn1 messages for FeMBMS 
+ * \author Javier Morgade
+ * \date 2019-2020
+ * \version 1.0
+ * \email: javier.morgade@ieee.org
+ */
+
 #include <stdio.h>
 #include <sys/types.h>
 #include <stdlib.h> /* for atoi(3) */
@@ -185,7 +193,8 @@ uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId) {
 uint8_t do_MIB_FeMBMS(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t additionalNonMBSFN, uint32_t frame) {
   asn_enc_rval_t enc_rval;
   LTE_BCCH_BCH_Message_MBMS_t *mib_fembms=&carrier->mib_fembms;
-  uint8_t sfn = (uint8_t)((frame>>2)&0xff);
+  frame=198;
+  uint8_t sfn = (uint8_t)((frame>>4)&0xff);
   uint16_t *spare = calloc(1,sizeof(uint16_t));
 
   if( spare == NULL  ) abort();
@@ -223,15 +232,16 @@ uint8_t do_MIB_FeMBMS(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_
         (uint32_t)mib_fembms->message.dl_Bandwidth_MBMS_r14,
         (uint32_t)additionalNonMBSFN,
         (uint32_t)sfn);
+  sfn = sfn<<2;
   mib_fembms->message.systemFrameNumber_r14.buf = &sfn;
   mib_fembms->message.systemFrameNumber_r14.size = 1;
-  mib_fembms->message.systemFrameNumber_r14.bits_unused=0;
+  mib_fembms->message.systemFrameNumber_r14.bits_unused=2;
   mib_fembms->message.spare.buf = (uint8_t *)spare;
   mib_fembms->message.spare.size = 2;
-  mib_fembms->message.spare.bits_unused = 6;  // This makes a spare of 10 bits
+  mib_fembms->message.spare.bits_unused = 3;  // This makes a spare of 10 bits
   //TODO additionalNonBMSFNSubframes-r14  INTEGER (0..3) ?
   //if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
-    //xer_fprint(stdout, &asn_DEF_LTE_BCCH_BCH_Message_MBMS, (void *)mib_fembms);
+    xer_fprint(stdout, &asn_DEF_LTE_BCCH_BCH_Message_MBMS, (void *)mib_fembms);
   //}
   enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_BCH_Message_MBMS,
                                    NULL,
@@ -387,7 +397,11 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
   //  SystemInformation_t systemInformation;
   int num_plmn = configuration->num_plmn;
 
-  LTE_PLMN_IdentityInfo_t *PLMN_identity_info;
+  //LTE_PLMN_IdentityInfo_t *PLMN_identity_info;
+  LTE_PLMN_IdentityInfo_t * PLMN_identity_info = &carrier->PLMN_identity_info_MBMS[0];
+  //LTE_MCC_MNC_Digit_t dummy_mcc[num_plmn][3], dummy_mnc[num_plmn][3];
+  //LTE_MCC_MNC_Digit_t *dummy_mcc = &carrier->dummy_mcc_MBMS[0][0];
+  //LTE_MCC_MNC_Digit_t *dummy_mnc = &carrier->dummy_mnc_MBMS[0][0];
   LTE_MCC_MNC_Digit_t *dummy_mcc_0;
   LTE_MCC_MNC_Digit_t *dummy_mcc_1;
   LTE_MCC_MNC_Digit_t *dummy_mcc_2;
@@ -395,7 +409,9 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
   LTE_MCC_MNC_Digit_t *dummy_mnc_1;
   LTE_MCC_MNC_Digit_t *dummy_mnc_2;
   asn_enc_rval_t enc_rval;
-  LTE_SchedulingInfo_MBMS_r14_t *schedulingInfo;
+  //LTE_SchedulingInfo_MBMS_r14_t *schedulingInfo;
+  //LTE_SchedulingInfo_MBMS_r14_t schedulingInfo;
+  LTE_SchedulingInfo_MBMS_r14_t *schedulingInfo = &carrier->schedulingInfo_MBMS;
   LTE_SIB_Type_t *sib_type;
   uint8_t *buffer                      = carrier->SIB1_MBMS;
   LTE_BCCH_DL_SCH_Message_MBMS_t *bcch_message  = &carrier->siblock1_MBMS;
@@ -408,6 +424,8 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
   //  memcpy(&bcch_message.message.choice.c1.choice.systemInformationBlockType1,sib1,sizeof(SystemInformationBlockType1_t));
   *sib1_MBMS = &bcch_message->message.choice.c1.choice.systemInformationBlockType1_MBMS_r14;
   PLMN_identity_info = CALLOC(1, sizeof(LTE_PLMN_IdentityInfo_t) * num_plmn);
+  //memset(&schedulingInfo,0,sizeof(LTE_SchedulingInfo_MBMS_r14_t));
+  memset(schedulingInfo,0,sizeof(LTE_SchedulingInfo_MBMS_r14_t));
 
   if (PLMN_identity_info == NULL)
     exit(1);
@@ -528,7 +546,7 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
     MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.size= 1;
     MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=0x20<<2;  // FDD: SF1
     MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2;
-    MBSFN_Area1->mcch_Config_r9.signallingMCS_r9= LTE_MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7;
+    MBSFN_Area1->mcch_Config_r9.signallingMCS_r9= LTE_MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n2;
     (MBSFN_Area1)->ext1 = CALLOC (1, sizeof(*(MBSFN_Area1)->ext1));
     memset((MBSFN_Area1)->ext1,0,sizeof(*(MBSFN_Area1)->ext1));
     MBSFN_Area1->ext1->subcarrierSpacingMBMS_r14 = CALLOC(1,sizeof(*( MBSFN_Area1->ext1)->subcarrierSpacingMBMS_r14));
@@ -541,18 +559,18 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
   if(1) {
     (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14 =                             CALLOC(1,sizeof(struct LTE_NonMBSFN_SubframeConfig_r14));
     memset((*sib1_MBMS)->nonMBSFN_SubframeConfig_r14,0,sizeof(struct LTE_NonMBSFN_SubframeConfig_r14));
-    (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14->radioFrameAllocationPeriod_r14 = LTE_NonMBSFN_SubframeConfig_r14__radioFrameAllocationPeriod_r14_rf8;
+    (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14->radioFrameAllocationPeriod_r14 = LTE_NonMBSFN_SubframeConfig_r14__radioFrameAllocationPeriod_r14_rf4;
     (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14->radioFrameAllocationOffset_r14 = 0;
     (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14->subframeAllocation_r14.buf = MALLOC(2);
     //100000001 byte(0)=10000000 byte(1)=xxxxxxx1
-    (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14->subframeAllocation_r14.buf[0] = 0x80<<0;
-    (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14->subframeAllocation_r14.buf[1] = 0x1<<7;
+    (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14->subframeAllocation_r14.buf[0] = 0x8<<0;
+    (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14->subframeAllocation_r14.buf[1] = 0;
     (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14->subframeAllocation_r14.size = 2;
     (*sib1_MBMS)->nonMBSFN_SubframeConfig_r14->subframeAllocation_r14.bits_unused = 7;
   }
 
   //if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
-    //xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message_MBMS, (void *)bcch_message);
+    xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message_MBMS, (void *)bcch_message);
   //}
   enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_DL_SCH_Message_MBMS,
                                    NULL,
@@ -3198,6 +3216,42 @@ uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
   ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list,
                    &rat);
 
+  /* request NR configuration */
+  LTE_UECapabilityEnquiry_r8_IEs_t *r8 = &dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8;
+  LTE_UECapabilityEnquiry_v8a0_IEs_t r8_a0;
+  LTE_UECapabilityEnquiry_v1180_IEs_t r11_80;
+  LTE_UECapabilityEnquiry_v1310_IEs_t r13_10;
+  LTE_UECapabilityEnquiry_v1430_IEs_t r14_30;
+  LTE_UECapabilityEnquiry_v1510_IEs_t r15_10;
+
+  memset(&r8_a0, 0, sizeof(r8_a0));
+  memset(&r11_80, 0, sizeof(r11_80));
+  memset(&r13_10, 0, sizeof(r13_10));
+  memset(&r14_30, 0, sizeof(r14_30));
+  memset(&r15_10, 0, sizeof(r15_10));
+
+  r8->nonCriticalExtension = &r8_a0;
+  r8_a0.nonCriticalExtension = &r11_80;
+  r11_80.nonCriticalExtension = &r13_10;
+  r13_10.nonCriticalExtension = &r14_30;
+  r14_30.nonCriticalExtension = &r15_10;
+
+  /* TODO: no hardcoded values here */
+
+  OCTET_STRING_t req_freq;
+  unsigned char req_freq_buf[5] = { 0x00, 0x20, 0x1a, 0x02, 0x68 };  // bands 7 & nr78
+  //unsigned char req_freq_buf[5] = { 0x00, 0x20, 0x1a, 0x08, 0x18 };  // bands 7 & nr260
+
+  //unsigned char req_freq_buf[13] = { 0x00, 0xc0, 0x18, 0x01, 0x01, 0x30, 0x4b, 0x04, 0x0e, 0x08, 0x24, 0x04, 0xd0 };
+//  unsigned char req_freq_buf[21] = {
+//0x01, 0x60, 0x18, 0x05, 0x80, 0xc0, 0x04, 0x04, 0xc1, 0x2c, 0x10, 0x08, 0x20, 0x30, 0x40, 0xe0, 0x82, 0x40, 0x28, 0x80, 0x9a
+//  };
+
+  req_freq.buf = req_freq_buf;
+  req_freq.size = 5;
+//  req_freq.size = 21;
+
+  r15_10.requestedFreqBandsNR_MRDC_r15 = &req_freq;
   if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
     xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)&dl_dcch_msg);
   }
@@ -3276,17 +3330,17 @@ uint8_t do_NR_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
   /* TODO: no hardcoded values here */
 
   OCTET_STRING_t req_freq;
-  //unsigned char req_freq_buf[5] = { 0x00, 0x20, 0x1a, 0x02, 0x68 };  // bands 7 & nr78
+  unsigned char req_freq_buf[5] = { 0x00, 0x20, 0x1a, 0x02, 0x68 };  // bands 7 & nr78
   //unsigned char req_freq_buf[5] = { 0x00, 0x20, 0x1a, 0x08, 0x18 };  // bands 7 & nr260
 
   //unsigned char req_freq_buf[13] = { 0x00, 0xc0, 0x18, 0x01, 0x01, 0x30, 0x4b, 0x04, 0x0e, 0x08, 0x24, 0x04, 0xd0 };
-  unsigned char req_freq_buf[21] = {
-0x01, 0x60, 0x18, 0x05, 0x80, 0xc0, 0x04, 0x04, 0xc1, 0x2c, 0x10, 0x08, 0x20, 0x30, 0x40, 0xe0, 0x82, 0x40, 0x28, 0x80, 0x9a
-  };
+//  unsigned char req_freq_buf[21] = {
+//0x01, 0x60, 0x18, 0x05, 0x80, 0xc0, 0x04, 0x04, 0xc1, 0x2c, 0x10, 0x08, 0x20, 0x30, 0x40, 0xe0, 0x82, 0x40, 0x28, 0x80, 0x9a
+//  };
 
   req_freq.buf = req_freq_buf;
   req_freq.size = 5;
-  req_freq.size = 21;
+//  req_freq.size = 21;
 
   r15_10.requestedFreqBandsNR_MRDC_r15 = &req_freq;
 
diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c
index bdf992c76a3c64f8d71acbdb1dea96a7fd349e56..c5aa2bc0f8415f748cf6eeb4a5abb3fa4117a17c 100644
--- a/openair2/RRC/LTE/rrc_UE.c
+++ b/openair2/RRC/LTE/rrc_UE.c
@@ -155,14 +155,19 @@ static uint8_t check_trigger_meas_event(
   LTE_Q_OffsetRange_t ofs, LTE_Q_OffsetRange_t ocs, long a3_offset, LTE_TimeToTrigger_t ttt);
 
 static void decode_MBSFNAreaConfiguration(module_id_t module_idP, uint8_t eNB_index, frame_t frameP,uint8_t mbsfn_sync_area);
+static void decode_MBMSCountingRequest(module_id_t module_idP, uint8_t eNB_index, frame_t frameP,uint8_t mbsfn_sync_area);
+
 uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,LTE_SL_DestinationInfoList_r12_t  *destinationInfoList, long *discTxResourceReq,
     SL_TRIGGER_t mode);
 
-
-
-
-
-
+void
+rrc_ue_process_MBMSCountingRequest(
+  const protocol_ctxt_t *const ctxt_pP,
+  LTE_MBMSCountingRequest_r10_t *MBMSCountingRequest,
+  uint8_t eNB_index
+		);
+ 
+protocol_ctxt_t ctxt_pP_local;
 
 
 /*------------------------------------------------------------------------------*/
@@ -520,6 +525,7 @@ static void rrc_ue_generate_RRCConnectionSetupComplete(
   LOG_D(RLC,
         "[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
         ctxt_pP->frame, ctxt_pP->module_id+NB_eNB_INST, size, eNB_index, rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH);
+  ctxt_pP_local.rnti = ctxt_pP->rnti;
   rrc_data_req_ue (
     ctxt_pP,
     DCCH,
@@ -1572,6 +1578,65 @@ rrc_ue_process_securityModeCommand(
                  securityModeCommand->criticalExtensions.present);
 }
 
+void
+rrc_ue_process_MBMSCountingRequest(
+  const protocol_ctxt_t *const ctxt_pP,
+  LTE_MBMSCountingRequest_r10_t *MBMSCountingRequest,
+  uint8_t eNB_index
+)
+{
+  asn_enc_rval_t enc_rval;
+  LTE_UL_DCCH_Message_t ul_dcch_msg;
+  struct LTE_CountingResponseInfo_r10 CountingResponse;
+  uint8_t buffer[200];
+  //int i;
+  LOG_I(RRC,"[UE %d] Frame %d: Receiving from (MCCH), Processing MBMSCoutingRequest (eNB %d)\n",
+        ctxt_pP->module_id,
+        ctxt_pP->frame,
+        eNB_index);
+  memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t));
+  memset((void *)&CountingResponse,0,sizeof(struct LTE_CountingResponseInfo_r10));
+
+
+  ul_dcch_msg.message.present           = LTE_UL_DCCH_MessageType_PR_c1;
+  ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10;
+  LTE_MBMSCountingResponse_r10_t *MBMSCountingResponse = &ul_dcch_msg.message.choice.c1.choice.mbmsCountingResponse_r10;
+
+  MBMSCountingResponse->criticalExtensions.present = LTE_MBMSCountingResponse_r10__criticalExtensions_PR_c1;
+  MBMSCountingResponse->criticalExtensions.choice.c1.present = LTE_MBMSCountingResponse_r10__criticalExtensions__c1_PR_countingResponse_r10; 
+  LTE_MBMSCountingResponse_r10_IEs_t *MBMSCountingResponse_r10_IEs = &MBMSCountingResponse->criticalExtensions.choice.c1.choice.countingResponse_r10;
+
+  MBMSCountingResponse_r10_IEs->mbsfn_AreaIndex_r10 = calloc(1,sizeof(long));
+ // MBMSCountingResponse_r10_IEs->countingResponseList_r10 = calloc(1,sizeof(struct LTE_CountingResponseList_r10));
+//
+//  ASN_SEQUENCE_ADD(
+//        &MBMSCountingResponse->criticalExtensions.choice.c1.choice.countingResponse_r10.countingResponseList_r10.list,
+//        &CountingResponse);
+//
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message, NULL, (void *) &ul_dcch_msg, buffer, 100);
+      AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
+                   enc_rval.failed_type->name, enc_rval.encoded);
+
+      if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+        xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg);
+      }
+        xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg);
+
+
+ LOG_I(RRC,"MBMSCountingResponse Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+      rrc_data_req_ue (
+        &ctxt_pP_local,
+        DCCH,
+        rrc_mui++,
+        SDU_CONFIRM_NO,
+        (enc_rval.encoded + 7) / 8,
+        buffer,
+        PDCP_TRANSMISSION_MODE_CONTROL);
+
+}
+
+
 //-----------------------------------------------------------------------------
 void
 rrc_ue_process_ueCapabilityEnquiry(
@@ -2189,8 +2254,8 @@ rrc_ue_decode_dcch(
 #endif
 }
 
-const char siWindowLength[8][5] = {"1ms","2ms","5ms","10ms","15ms","20ms","40ms","ERR"};
-const char siWindowLength_int[7] = {1,2,5,10,15,20,40};
+const char siWindowLength[9][5] = {"1ms","2ms","5ms","10ms","15ms","20ms","40ms","80ms","ERR"};
+const char siWindowLength_int[8] = {1,2,5,10,15,20,40,80};
 
 const char SIBType[12][6] = {"SIB3","SIB4","SIB5","SIB6","SIB7","SIB8","SIB9","SIB10","SIB11","SIB12","SIB13","Spare"};
 const char SIBPeriod[8][6]= {"rf8","rf16","rf32","rf64","rf128","rf256","rf512","ERR"};
@@ -2700,7 +2765,7 @@ int decode_SIB1_MBMS( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_in
   //LOG_I( RRC, "TDD subframeAssignment                     : %ld\n", sib1_MBMS->tdd_Config->subframeAssignment );
   //LOG_I( RRC, "TDD specialSubframePatterns                : %ld\n", sib1_MBMS->tdd_Config->specialSubframePatterns );
   //}
-  LOG_I( RRC, "siWindowLength                             : %s\n", siWindowLength[min(sib1_MBMS->si_WindowLength_r14,7)] );
+  LOG_I( RRC, "siWindowLength                             : %s\n", siWindowLength[min(sib1_MBMS->si_WindowLength_r14,8)] );
   LOG_I( RRC, "systemInfoValueTag                         : %ld\n", sib1_MBMS->systemInfoValueTag_r14 );
   UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod_MBMS     = siPeriod_int[sib1_MBMS->schedulingInfoList_MBMS_r14.list.array[0]->si_Periodicity_r14];
   UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize_MBMS = siWindowLength_int[sib1_MBMS->si_WindowLength_r14];
@@ -2898,7 +2963,7 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
     LOG_I( RRC, "TDD specialSubframePatterns                : %ld\n", sib1->tdd_Config->specialSubframePatterns );
   }
 
-  LOG_I( RRC, "siWindowLength                             : %s\n", siWindowLength[min(sib1->si_WindowLength,7)] );
+  LOG_I( RRC, "siWindowLength                             : %s\n", siWindowLength[min(sib1->si_WindowLength,8)] );
   LOG_I( RRC, "systemInfoValueTag                         : %ld\n", sib1->systemInfoValueTag );
   UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod     = siPeriod_int[sib1->schedulingInfoList.list.array[0]->si_Periodicity];
   UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize = siWindowLength_int[sib1->si_WindowLength];
@@ -4225,7 +4290,7 @@ int decode_MCCH_Message( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB
           ctxt_pP->frame,
           mbsfn_sync_area);
     return 0; // avoid decoding to prevent memory bloating
-  } else if(UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State >= RRC_CONNECTED /*|| UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_RECONFIGURED*/){
+  } else if(1/*UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State >= RRC_CONNECTED*/ /*|| UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_RECONFIGURED*/){
     dec_rval = uper_decode_complete(NULL,
                                     &asn_DEF_LTE_MCCH_Message,
                                     (void **)&mcch,
@@ -4244,6 +4309,7 @@ int decode_MCCH_Message( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB
     if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
       xer_fprint(stdout, &asn_DEF_LTE_MCCH_Message, (void *)mcch);
     }
+      xer_fprint(stdout, &asn_DEF_LTE_MCCH_Message, (void *)mcch);
 
     if (mcch->message.present == LTE_MCCH_MessageType_PR_c1) {
       LOG_D(RRC,"[UE %d] Found mcch message \n",
@@ -4265,7 +4331,29 @@ int decode_MCCH_Message( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB
           ctxt_pP->frame,
           mbsfn_sync_area);
       }
+    }else if(mcch->message.present == LTE_MCCH_MessageType_PR_later){
+      LOG_D(RRC,"[UE %d] Found mcch message \n",
+            ctxt_pP->module_id);
+        if(mcch->message.choice.later.present == LTE_MCCH_MessageType__later_PR_c2){
+		if(mcch->message.choice.later.choice.c2.present == LTE_MCCH_MessageType__later__c2_PR_mbmsCountingRequest_r10){
+        		LOG_I(RRC,"[UE %d] Frame %d : Found MBMSCountingRequest from eNB %d %p\n",
+              			ctxt_pP->module_id,
+              			ctxt_pP->frame,
+              			eNB_index,&mcch->message.choice.later.choice.c2.choice.mbmsCountingRequest_r10);
+
+  			rrc_ue_process_MBMSCountingRequest(ctxt_pP,&mcch->message.choice.later.choice.c2.choice.mbmsCountingRequest_r10,eNB_index);
+
+			decode_MBMSCountingRequest(
+          			ctxt_pP->module_id,
+          			eNB_index,
+          			ctxt_pP->frame,
+          			mbsfn_sync_area);
+
+
+		}
+	}
     }
+
   }
 
   return 0;
@@ -4323,7 +4411,7 @@ void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_index, f
                         (struct LTE_NonMBSFN_SubframeConfig_r14 *)NULL,
                         (LTE_MBSFN_AreaInfoList_r9_t *)NULL
                        );
-  if(UE_rrc_inst[ue_mod_idP].Info[eNB_index].State >= RRC_CONNECTED /*|| UE_rrc_inst[ue_mod_idP].Info[eNB_index].State == RRC_RECONFIGURED*/)
+  if(1/*UE_rrc_inst[ue_mod_idP].Info[eNB_index].State >= RRC_CONNECTED*/ /*|| UE_rrc_inst[ue_mod_idP].Info[eNB_index].State == RRC_RECONFIGURED*/)
   	UE_rrc_inst[ue_mod_idP].Info[eNB_index].MCCHStatus[mbsfn_sync_area] = 1;
   PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_idP, ENB_FLAG_NO, UE_rrc_inst[ue_mod_idP].Info[eNB_index].rnti, frameP, 0,eNB_index);
   // Config Radio Bearer for MBMS user data (similar way to configure for eNB side in init_MBMS function)
@@ -4347,6 +4435,13 @@ void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_index, f
   // */
 }
 
+void decode_MBMSCountingRequest( module_id_t ue_mod_idP, uint8_t eNB_index, frame_t frameP, uint8_t mbsfn_sync_area ) {
+  //uint8_t i;
+  //protocol_ctxt_t               ctxt;
+
+
+
+}
 
 //-----------------------------------------------------------------------------
 void *rrc_ue_task( void *args_p ) {
diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h
index 3c02c45bc1edccb68f6a448f0fea01a88c818d36..c498e3c6fe369ede99649040b4993ba527dd8c00 100644
--- a/openair2/RRC/LTE/rrc_defs.h
+++ b/openair2/RRC/LTE/rrc_defs.h
@@ -716,6 +716,9 @@ typedef struct {
   LTE_BCCH_BCH_Message_MBMS_t            mib_fembms;
   LTE_BCCH_DL_SCH_Message_MBMS_t         siblock1_MBMS;
   LTE_BCCH_DL_SCH_Message_MBMS_t         systemInformation_MBMS;
+  LTE_SchedulingInfo_MBMS_r14_t 	 schedulingInfo_MBMS;
+  LTE_PLMN_IdentityInfo_t		 PLMN_identity_info_MBMS[6];
+  LTE_MCC_MNC_Digit_t			 dummy_mcc_MBMS[6][3], dummy_mnc_MBMS[6][3];
   LTE_SystemInformationBlockType1_t     *sib1;
   LTE_SystemInformationBlockType2_t     *sib2;
   LTE_SystemInformationBlockType3_t     *sib3;
@@ -732,6 +735,12 @@ typedef struct {
   LTE_MCCH_Message_t                mcch;
   LTE_MBSFNAreaConfiguration_r9_t  *mcch_message;
   SRB_INFO                          MCCH_MESS[8];// MAX_MBSFN_AREA
+  uint8_t                           **MCCH_MESSAGE_COUNTING; //  MAX_MBSFN_AREA
+  uint8_t                           sizeof_MCCH_MESSAGE_COUNTING[8];// MAX_MBSFN_AREA
+  LTE_MCCH_Message_t                mcch_counting;
+  LTE_MBMSCountingRequest_r10_t    *mcch_message_counting;
+  SRB_INFO                          MCCH_MESS_COUNTING[8];// MAX_MBSFN_AREA
+
   //TTN - SIB 18,19,21 for D2D
   LTE_SystemInformationBlockType18_r12_t *sib18;
   LTE_SystemInformationBlockType19_r12_t *sib19;
diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index 1d44751dcaf6396c61305ccb709660c867f87f3b..b6062df2c4a0b60d436784649fcd34ce5808ffe4 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -155,6 +155,7 @@ init_SI(
   LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
 
   if(configuration->radioresourceconfig[CC_id].mbms_dedicated_serving_cell == TRUE) {
+
     LOG_I(RRC, "Configuring MIB FeMBMS (N_RB_DL %d)\n",
           (int)configuration->N_RB_DL[CC_id]);
     RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB_FeMBMS = (uint8_t *) malloc16(4);
@@ -231,6 +232,7 @@ init_SI(
             RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_MBMS->nonMBSFN_SubframeConfig_r14->subframeAllocation_r14.buf);
     }
 
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].FeMBMS_flag=1;
     //AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255");
   }
 
@@ -496,12 +498,15 @@ init_SI(
                            (LTE_PMCH_InfoList_r9_t *) NULL,
                            sib1_v13ext,
                            RC.rrc[ctxt_pP->module_id]->carrier[CC_id].FeMBMS_flag,
-                           (LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL,
+                           (carrier->sib1_MBMS==NULL?(LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL:(LTE_BCCH_DL_SCH_Message_MBMS_t *)carrier->sib1_MBMS),//(LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL,
                            (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
-                           (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
-                           (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                           (LTE_MBSFN_AreaInfoList_r9_t *) NULL
-                          );
+                        (carrier->sib1_MBMS==NULL?(struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL:(struct LTE_NonMBSFN_SubframeConfig_r14 *)carrier->sib1_MBMS->nonMBSFN_SubframeConfig_r14),//(struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
+                        (carrier->sib1_MBMS==NULL?(LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL:(LTE_SystemInformationBlockType1_MBMS_r14_t *)carrier->sib1_MBMS->systemInformationBlockType13_r14),//(LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
+                        (carrier->sib1_MBMS==NULL?(LTE_MBSFN_AreaInfoList_r9_t *) NULL:(LTE_MBSFN_AreaInfoList_r9_t *)&carrier->sib1_MBMS->systemInformationBlockType13_r14->mbsfn_AreaInfoList_r9)//(LTE_MBSFN_AreaInfoList_r9_t *) NULL
+
+			,(LTE_MBSFNAreaConfiguration_r9_t*) NULL
+
+                         );
   }
 
   /* set flag to indicate that cell information is configured. This is required
@@ -584,7 +589,8 @@ init_MCCH(
                            (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                            (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                            (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                           (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                           (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+			   (LTE_MBSFNAreaConfiguration_r9_t*) NULL
                           );
   }
 
@@ -994,11 +1000,14 @@ void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, boolean_t removeFlag) {
   pthread_mutex_unlock(&lock_ue_freelist);
 }
 
+extern int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
+extern int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
+extern void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
+extern void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch);
+
 void release_UE_in_freeList(module_id_t mod_id) {
   int i, j, CC_id, pdu_number;
   protocol_ctxt_t                           ctxt;
-  LTE_eNB_ULSCH_t                          *ulsch = NULL;
-  LTE_eNB_DLSCH_t                          *dlsch = NULL;
   nfapi_ul_config_request_body_t           *ul_req_tmp = NULL;
   PHY_VARS_eNB                             *eNB_PHY = NULL;
   struct rrc_eNB_ue_context_s              *ue_context_pP = NULL;
@@ -1032,6 +1041,25 @@ void release_UE_in_freeList(module_id_t mod_id) {
       for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
         eNB_PHY = RC.eNB[mod_id][CC_id];
 
+	int id;
+
+	// clean ULSCH entries for rnti
+	id = find_ulsch(rnti,eNB_PHY,SEARCH_EXIST);
+        if (id>=0) clean_eNb_ulsch(eNB_PHY->ulsch[id]);
+
+	// clean DLSCH entries for rnti
+	id = find_dlsch(rnti,eNB_PHY,SEARCH_EXIST);
+        if (id>=0) clean_eNb_dlsch(eNB_PHY->dlsch[id][0]);
+
+	// clean UCI entries for rnti
+        for (i=0; i<NUMBER_OF_UCI_VARS_MAX; i++) {
+          if(eNB_PHY->uci_vars[i].rnti == rnti) {
+            LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti);
+            memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
+          }
+        }
+		
+	/*
         for (i=0; i<MAX_MOBILES_PER_ENB; i++) {
           ulsch = eNB_PHY->ulsch[i];
 
@@ -1064,6 +1092,7 @@ void release_UE_in_freeList(module_id_t mod_id) {
             memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
           }
         }
+	*/
 
         if (flexran_agent_get_rrc_xface(mod_id)) {
           flexran_agent_get_rrc_xface(mod_id)->flexran_agent_notify_ue_state_change(
@@ -1458,7 +1487,8 @@ rrc_eNB_generate_RRCConnectionReestablishment(
                                  (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                                  (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                                  (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                                 (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                                 (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+			         (LTE_MBSFNAreaConfiguration_r9_t*) NULL
                                 );
           break;
         }
@@ -5758,7 +5788,8 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
     (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
     (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
     (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-    (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+    (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+    (LTE_MBSFNAreaConfiguration_r9_t*) NULL
   );
   // Configure target eNB SRB2
   /// SRB2
@@ -6438,7 +6469,8 @@ rrc_eNB_configure_rbs_handover(struct rrc_eNB_ue_context_s *ue_context_p, protoc
     (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
     (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
     (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-    (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+    (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+    (LTE_MBSFNAreaConfiguration_r9_t*) NULL
   );
 }
 
@@ -6654,7 +6686,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
                                    (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                                    (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                                    (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                                   (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                                   (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+   				   (LTE_MBSFNAreaConfiguration_r9_t*) NULL
                                   );
           }
         } else {        // remove LCHAN from MAC/PHY
@@ -6713,7 +6746,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
                                    (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                                    (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                                    (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                                   (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                                   (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+   				   (LTE_MBSFNAreaConfiguration_r9_t*) NULL
                                   );
           }
         } // end else of if (ue_context_pP->ue_context.DRB_active[drb_id] == 0)
@@ -6875,7 +6909,8 @@ rrc_eNB_generate_RRCConnectionSetup(
                                      (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                                      (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                                      (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                                     (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                                     (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+   				     (LTE_MBSFNAreaConfiguration_r9_t*) NULL
                                     );
               break;
             }
@@ -8348,6 +8383,8 @@ rrc_eNB_decode_dcch(
       case LTE_UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10:
         T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
           T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+    	LOG_E(RRC, "THINH [LTE_UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10]\n");
+
         break;
 
       case LTE_UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10:
diff --git a/openair2/RRC/LTE/rrc_eNB_M2AP.c b/openair2/RRC/LTE/rrc_eNB_M2AP.c
index bd586dfc71cf7f855f5fa6e1c30ee32def55e02c..98a72895a073a60f18424ccf29efb4b7454be57e 100644
--- a/openair2/RRC/LTE/rrc_eNB_M2AP.c
+++ b/openair2/RRC/LTE/rrc_eNB_M2AP.c
@@ -63,6 +63,71 @@ rrc_M2AP_openair_rrc_top_init_MBMS(int eMBMS_active){
 }
 
 
+static uint8_t rrc_M2AP_do_MBSFNCountingRequest(
+    uint8_t Mod_id,
+    uint8_t sync_area,
+    uint8_t *buffer,
+    LTE_MCCH_Message_t *mcch_message,
+    LTE_MBMSCountingRequest_r10_t **mbsfnCoutingRequest,
+    const m2ap_mbms_service_counting_req_t *const m2ap_mbms_service_counting_req
+) {
+  //int i,j,k;
+
+  asn_enc_rval_t enc_rval;
+  //LTE_MBSFN_SubframeConfig_t *mbsfn_SubframeConfig1;
+  //LTE_PMCH_Info_r9_t *pmch_Info_1;
+  //LTE_MBMS_SessionInfo_r9_t *mbms_Session_1;
+  // MBMS_SessionInfo_r9_t *mbms_Session_2;
+  //eNB_RRC_INST *rrc               = RC.rrc[Mod_id];
+  //rrc_eNB_carrier_data_t *carrier = &rrc->carrier[0];
+  memset(mcch_message,0,sizeof(LTE_MCCH_Message_t));
+  //mcch_message->message.present = LTE_MCCH_MessageType_PR_c1;
+  mcch_message->message.present = LTE_MCCH_MessageType_PR_later;
+  //mcch_message->message.choice.c1.present = LTE_MCCH_MessageType__c1_PR_mbsfnAreaConfiguration_r9;
+  mcch_message->message.choice.later.present = LTE_MCCH_MessageType__later_PR_c2;
+  mcch_message->message.choice.later.choice.c2.present = LTE_MCCH_MessageType__later__c2_PR_mbmsCountingRequest_r10;
+  *mbsfnCoutingRequest = &mcch_message->message.choice.later.choice.c2.choice.mbmsCountingRequest_r10;
+
+
+  //LTE_CountingRequestList_r10_t countingRequestList_r10; // A_SEQUENCE_OF(struct LTE_CountingRequestInfo_r10) list;
+  struct LTE_CountingRequestInfo_r10 *lte_counting_request_info; //LTE_TMGI_r9_t    tmgi_r10;
+  lte_counting_request_info = CALLOC(1,sizeof(struct LTE_CountingRequestInfo_r10));
+  uint8_t TMGI[5] = {4,3,2,1,0};
+  lte_counting_request_info->tmgi_r10.plmn_Id_r9.present = LTE_TMGI_r9__plmn_Id_r9_PR_plmn_Index_r9;
+  lte_counting_request_info->tmgi_r10.plmn_Id_r9.choice.plmn_Index_r9= 1;
+  memset(&lte_counting_request_info->tmgi_r10.serviceId_r9,0,sizeof(OCTET_STRING_t));
+  OCTET_STRING_fromBuf(&lte_counting_request_info->tmgi_r10.serviceId_r9,(const char*)&TMGI[2],3);
+  ASN_SEQUENCE_ADD(&(*mbsfnCoutingRequest)->countingRequestList_r10.list,lte_counting_request_info);
+
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+    xer_fprint(stdout,&asn_DEF_LTE_MCCH_Message,(void *)mcch_message);
+  }
+    
+  xer_fprint(stdout,&asn_DEF_LTE_MCCH_Message,(void *)mcch_message);
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_MCCH_Message,
+                                   NULL,
+                                   (void *)mcch_message,
+                                   buffer,
+                                   100);
+
+    if(enc_rval.encoded == -1) {
+    LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
+          enc_rval.failed_type->name, enc_rval.encoded);
+    return -1;
+  }
+
+  LOG_I(RRC,"[eNB] MCCH Message Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+
+  if (enc_rval.encoded==-1) {
+    msg("[RRC] ASN1 : MCCH  encoding failed for MBSFNAreaConfiguration\n");
+    return(-1);
+  }
+
+  return((enc_rval.encoded+7)/8);
+  
+}
+
 
 static uint8_t rrc_M2AP_do_MBSFNAreaConfig(
     uint8_t Mod_id,
@@ -96,6 +161,7 @@ static uint8_t rrc_M2AP_do_MBSFNAreaConfig(
 		  mbsfn_SubframeConfig1->radioframeAllocationPeriod= m2ap_mbms_scheduling_information->mbms_area_config_list[i].mbms_sf_config_list[j].radioframe_allocation_period;//LTE_MBSFN_SubframeConfig__radioframeAllocationPeriod_n4;
 		  mbsfn_SubframeConfig1->radioframeAllocationOffset= m2ap_mbms_scheduling_information->mbms_area_config_list[i].mbms_sf_config_list[j].radioframe_allocation_offset;
 		  if(m2ap_mbms_scheduling_information->mbms_area_config_list[i].mbms_sf_config_list[j].is_four_sf){
+	         	  LOG_I(RRC,"is_four_sf\n");
 			  mbsfn_SubframeConfig1->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames;
 			  mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(3);
                           mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[2] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[i].mbms_sf_config_list[j].subframe_allocation) & 0xFF);
@@ -106,6 +172,7 @@ static uint8_t rrc_M2AP_do_MBSFNAreaConfig(
 		
 
    		  }else {
+			  LOG_I(RRC,"is_one_sf\n");
 			  mbsfn_SubframeConfig1->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame;
 			  mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1);
 			  mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1;
@@ -128,7 +195,8 @@ static uint8_t rrc_M2AP_do_MBSFNAreaConfig(
 		   */
 		  pmch_Info_1->pmch_Config_r9.sf_AllocEnd_r9= m2ap_mbms_scheduling_information->mbms_area_config_list[i].pmch_config_list[j].allocated_sf_end;
 		  pmch_Info_1->pmch_Config_r9.dataMCS_r9= m2ap_mbms_scheduling_information->mbms_area_config_list[i].pmch_config_list[j].data_mcs;
-		  pmch_Info_1->pmch_Config_r9.mch_SchedulingPeriod_r9= LTE_PMCH_Config_r9__mch_SchedulingPeriod_r9_rf16;
+		  //pmch_Info_1->pmch_Config_r9.mch_SchedulingPeriod_r9= LTE_PMCH_Config_r9__mch_SchedulingPeriod_r9_rf16;
+		  pmch_Info_1->pmch_Config_r9.mch_SchedulingPeriod_r9 = m2ap_mbms_scheduling_information->mbms_area_config_list[i].pmch_config_list[j].mch_scheduling_period;
 		  // MBMSs-SessionInfoList-r9
 		  for(k=0; k < m2ap_mbms_scheduling_information->mbms_area_config_list[i].pmch_config_list[j].num_mbms_session_list; k++){
 			  //  pmch_Info_1->mbms_SessionInfoList_r9 = CALLOC(1,sizeof(struct MBMS_SessionInfoList_r9));
@@ -240,6 +308,9 @@ static void rrc_M2AP_init_MCCH(
   
     RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE =
       malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t *));
+
+    RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE_COUNTING =
+      malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t *));
   
     for (sync_area = 0; sync_area < RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area; sync_area++) {
       RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = 0;
@@ -253,6 +324,20 @@ static void rrc_M2AP_init_MCCH(
           &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message,
 	  m2ap_mbms_scheduling_information 
       );
+
+      RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE_COUNTING[sync_area] = 0;
+      RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE_COUNTING[sync_area] = (uint8_t *) malloc16(32);
+      AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE_COUNTING[sync_area] != NULL,
+                  "[eNB %d]init_MCCH: FATAL, no memory for MCCH MESSAGE allocated \n", enb_mod_idP);
+
+      RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE_COUNTING[sync_area] = rrc_M2AP_do_MBSFNCountingRequest(enb_mod_idP,
+          sync_area,
+          (uint8_t *)RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE_COUNTING[sync_area],
+          &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_counting,
+          &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message_counting,
+          NULL//m2ap_mbms_scheduling_information 
+      );
+
       LOG_I(RRC, "mcch message pointer %p for sync area %d \n",
             RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area],
             sync_area);
@@ -269,6 +354,8 @@ static void rrc_M2AP_init_MCCH(
       AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] != 255,
                   "RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255");
       RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESS[sync_area].Active = 1;
+
+      RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESS_COUNTING[sync_area].Active = 1;
     }
 
 
@@ -297,16 +384,347 @@ static void rrc_M2AP_init_MCCH(
                            (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
                            (LTE_PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9),
                            (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL,
-                        0,
+                           0,
+                           (LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL,
+                           (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
+                           (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
+                           (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
+                           (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+			   (LTE_MBSFNAreaConfiguration_r9_t*)(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message)
+                        );
+  }
+  
+  return;
+}
+
+ 
+static uint8_t rrc_M2AP_do_SIB1_MBMS_SIB13(
+  			  const protocol_ctxt_t *const ctxt_pP,
+			  uint8_t Mod_id, 
+			  int CC_id,
+  			  const m2ap_setup_resp_t *const m2ap_setup_resp,
+  			  const m2ap_mbms_scheduling_information_t *const m2ap_mbms_scheduling_information
+){
+
+  int i,j,l;
+  
+  eNB_RRC_INST *rrc = RC.rrc[ctxt_pP->module_id];
+  rrc_eNB_carrier_data_t *carrier=&rrc->carrier[CC_id];
+
+
+  struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib13_part=NULL;
+  LTE_MBSFN_SubframeConfigList_t *MBSFNSubframeConfigList/*,*MBSFNSubframeConfigList_copy*/;
+
+ asn_enc_rval_t enc_rval;
+
+ LTE_BCCH_DL_SCH_Message_t         *bcch_message = &RC.rrc[Mod_id]->carrier[CC_id].systemInformation;
+ LTE_BCCH_DL_SCH_Message_MBMS_t         *bcch_message_fembms = &RC.rrc[Mod_id]->carrier[CC_id].siblock1_MBMS;
+ uint8_t                       *buffer;
+ uint8_t                       *buffer_fembms;
+ LTE_SystemInformationBlockType2_t **sib2;
+
+
+  LTE_MBSFN_AreaInfoList_r9_t *MBSFNArea_list/*,*MBSFNArea_list_copy*/;
+ LTE_SystemInformationBlockType13_r9_t   **sib13       = &RC.rrc[Mod_id]->carrier[CC_id].sib13;
+ struct LTE_MBSFN_AreaInfo_r9 *MBSFN_Area1;
+
+ LTE_SystemInformationBlockType1_MBMS_r14_t **sib1_MBMS =  &RC.rrc[Mod_id]->carrier[CC_id].sib1_MBMS;
+
+
+
+  if(ctxt_pP->brOption){
+	buffer   = RC.rrc[Mod_id]->carrier[CC_id].SIB23_BR;	
+	sib2 	 =  &RC.rrc[Mod_id]->carrier[CC_id].sib2_BR;
+        LOG_I(RRC,"Running SIB2/3 Encoding for eMTC\n");
+
+
+  }else
+  {
+	buffer   = RC.rrc[Mod_id]->carrier[CC_id].SIB23;	
+	sib2 	 =  &RC.rrc[Mod_id]->carrier[CC_id].sib2;
+  }
+
+  buffer_fembms   = RC.rrc[Mod_id]->carrier[CC_id].SIB1_MBMS;
+
+
+  if (bcch_message) {
+    //memset(bcch_message,0,sizeof(LTE_BCCH_DL_SCH_Message_t));
+  } else {
+    LOG_E(RRC,"[eNB %d] BCCH_MESSAGE is null, exiting\n", Mod_id);
+    exit(-1);
+  }
+
+  if (!sib2) {
+    LOG_E(RRC,"[eNB %d] sib2 is null, exiting\n", Mod_id);
+    exit(-1);
+  }
+
+  if(!sib13){
+    LOG_I(RRC,"[eNB %d] sib13 is null, it should get created\n",Mod_id);
+  }
+
+
+  if(!sib1_MBMS){
+    LOG_I(RRC,"[eNB %d] sib1_MBMS is null, it should get created\n",Mod_id);
+  }
+
+  //if (!sib3) {
+  //  LOG_E(RRC,"[eNB %d] sib3 is null, exiting\n", Mod_id);
+  //  exit(-1);
+  //}
+ 
+ for (i=0; i < bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count; i++) {
+    struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo;
+    typeandinfo = bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i];
+    switch(typeandinfo->present) {
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_NOTHING: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920: 
+	*sib13=&typeandinfo->choice.sib13_v920;
+	(*sib13)->notificationConfig_r9.notificationRepetitionCoeff_r9=LTE_MBMS_NotificationConfig_r9__notificationRepetitionCoeff_r9_n2;
+ 	(*sib13)->notificationConfig_r9.notificationOffset_r9=0;
+ 	(*sib13)->notificationConfig_r9.notificationSF_Index_r9=1;
+	//  MBSFN-AreaInfoList
+ 	MBSFNArea_list= &(*sib13)->mbsfn_AreaInfoList_r9;//CALLOC(1,sizeof(*MBSFNArea_list));
+ 	memset(MBSFNArea_list,0,sizeof(*MBSFNArea_list));
+
+	for( j=0; j < m2ap_setup_resp->num_mcch_config_per_mbsfn; j++){
+ 	   // MBSFN Area 1
+ 	   MBSFN_Area1= CALLOC(1, sizeof(*MBSFN_Area1));
+ 	   MBSFN_Area1->mbsfn_AreaId_r9= m2ap_setup_resp->mcch_config_per_mbsfn[j].mbsfn_area;
+ 	   MBSFN_Area1->non_MBSFNregionLength= m2ap_setup_resp->mcch_config_per_mbsfn[j].pdcch_length;
+ 	   MBSFN_Area1->notificationIndicator_r9= 0;
+ 	   MBSFN_Area1->mcch_Config_r9.mcch_RepetitionPeriod_r9= m2ap_setup_resp->mcch_config_per_mbsfn[j].repetition_period;//LTE_MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_RepetitionPeriod_r9_rf32;
+ 	   MBSFN_Area1->mcch_Config_r9.mcch_Offset_r9= m2ap_setup_resp->mcch_config_per_mbsfn[j].offset; // in accordance with mbsfn subframe configuration in sib2
+ 	   MBSFN_Area1->mcch_Config_r9.mcch_ModificationPeriod_r9= m2ap_setup_resp->mcch_config_per_mbsfn[j].modification_period;
+
+ 	   //  Subframe Allocation Info
+ 	   MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf= MALLOC(1);
+ 	   MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.size= 1;
+ 	   MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=m2ap_setup_resp->mcch_config_per_mbsfn[j].subframe_allocation_info<<2;  // FDD: SF1
+ 	   MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2;
+ 	   MBSFN_Area1->mcch_Config_r9.signallingMCS_r9= m2ap_setup_resp->mcch_config_per_mbsfn[j].mcs;
+ 	   ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area1);
+ 	}
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib14_v1130: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib15_v1130: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib16_v1130: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib17_v1250: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib20_v1310: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430: 
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib24_v1530:
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib25_v1530:
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib26_v1530:
+	break;
+      case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: 
+
+	LOG_I(RRC,"Adding MBSFN subframe Configuration 1 to SIB2, %p %p\n",&typeandinfo->choice.sib2,*sib2);
+
+	for(j=0; j < m2ap_mbms_scheduling_information->num_mbms_area_config_list ; j++) {
+
+    			(&typeandinfo->choice.sib2)->mbsfn_SubframeConfigList = CALLOC(1,sizeof(struct LTE_MBSFN_SubframeConfigList));
+    			MBSFNSubframeConfigList = (&typeandinfo->choice.sib2)->mbsfn_SubframeConfigList;
+
+		for(l=0; l < m2ap_mbms_scheduling_information->mbms_area_config_list[j].num_mbms_sf_config_list; l++){
+			LTE_MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig1;
+    			sib2_mbsfn_SubframeConfig1= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig1));
+    			memset((void *)sib2_mbsfn_SubframeConfig1,0,sizeof(*sib2_mbsfn_SubframeConfig1));
+
+			sib2_mbsfn_SubframeConfig1->radioframeAllocationPeriod = m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].radioframe_allocation_period;
+			sib2_mbsfn_SubframeConfig1->radioframeAllocationOffset = m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].radioframe_allocation_offset;
+
+
+			if(m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].is_four_sf){
+				LOG_I(RRC,"is_four_sf\n");
+				sib2_mbsfn_SubframeConfig1->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames;
+
+    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(3);
+    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 3;
+    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 0;
+  	                        sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[2] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation) & 0xFF);
+                           	sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[1] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation>>8) & 0xFF);
+                           	sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation>>16) & 0xFF);
+
+			}else{
+				LOG_I(RRC,"is_one_sf\n");
+				sib2_mbsfn_SubframeConfig1->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame;
+    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1);
+    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1;
+    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2;
+    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=(m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation<<2);
+
+
+			}
+
+        		ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig1);
+		}	
+	}
+
+	break;
+
+    }
+  }
+
+
+ if(*sib13==NULL){
+    sib13_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+    memset(sib13_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+    sib13_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920;
+
+    *sib13 = &sib13_part->choice.sib13_v920;
+
+   (*sib13)->notificationConfig_r9.notificationRepetitionCoeff_r9=LTE_MBMS_NotificationConfig_r9__notificationRepetitionCoeff_r9_n2;
+   (*sib13)->notificationConfig_r9.notificationOffset_r9=0;
+   (*sib13)->notificationConfig_r9.notificationSF_Index_r9=1;
+
+   //  MBSFN-AreaInfoList
+   MBSFNArea_list= &(*sib13)->mbsfn_AreaInfoList_r9;//CALLOC(1,sizeof(*MBSFNArea_list));
+   memset(MBSFNArea_list,0,sizeof(*MBSFNArea_list));
+
+   for( i=0; i < m2ap_setup_resp->num_mcch_config_per_mbsfn; i++){
+   // MBSFN Area 1
+   MBSFN_Area1= CALLOC(1, sizeof(*MBSFN_Area1));
+   MBSFN_Area1->mbsfn_AreaId_r9= m2ap_setup_resp->mcch_config_per_mbsfn[i].mbsfn_area;
+   MBSFN_Area1->non_MBSFNregionLength= m2ap_setup_resp->mcch_config_per_mbsfn[i].pdcch_length;
+   MBSFN_Area1->notificationIndicator_r9= 0;
+   MBSFN_Area1->mcch_Config_r9.mcch_RepetitionPeriod_r9= m2ap_setup_resp->mcch_config_per_mbsfn[i].repetition_period;//LTE_MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_RepetitionPeriod_r9_rf32;
+   MBSFN_Area1->mcch_Config_r9.mcch_Offset_r9= m2ap_setup_resp->mcch_config_per_mbsfn[i].offset; // in accordance with mbsfn subframe configuration in sib2
+   MBSFN_Area1->mcch_Config_r9.mcch_ModificationPeriod_r9= m2ap_setup_resp->mcch_config_per_mbsfn[i].modification_period;
+  
+   //  Subframe Allocation Info
+   MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf= MALLOC(1);
+   MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.size= 1;
+   MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=m2ap_setup_resp->mcch_config_per_mbsfn[i].subframe_allocation_info<<2;  // FDD: SF1
+   MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2;
+   MBSFN_Area1->mcch_Config_r9.signallingMCS_r9= m2ap_setup_resp->mcch_config_per_mbsfn[i].mcs;
+   ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area1);
+   }
+
+ ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list, sib13_part);
+
+ }
+
+ *sib1_MBMS = &bcch_message_fembms->message.choice.c1.choice.systemInformationBlockType1_MBMS_r14;
+
+
+  if((*sib1_MBMS)->systemInformationBlockType13_r14==NULL){
+         (*sib1_MBMS)->systemInformationBlockType13_r14 =                             CALLOC(1,sizeof(struct LTE_SystemInformationBlockType13_r9));
+         memset((*sib1_MBMS)->systemInformationBlockType13_r14,0,sizeof(struct LTE_SystemInformationBlockType13_r9));
+  }
+
+
+  memcpy((*sib1_MBMS)->systemInformationBlockType13_r14,*sib13,sizeof(struct LTE_SystemInformationBlockType13_r9));
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_DL_SCH_Message_MBMS,
+                                   NULL,
+                                   (void *)bcch_message_fembms,
+                                   buffer_fembms,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+  LOG_I(RRC,"[eNB] MBMS SIB1_MBMS SystemInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+
+  if (enc_rval.encoded==-1) {
+    msg("[RRC] ASN1 : SI encoding failed for SIB23\n");
+    return(-1);
+  }
+
+
+  
+ //xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message, (void *)bcch_message);
+
+ enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_DL_SCH_Message,
+                                   NULL,
+                                   (void *)bcch_message,
+                                   buffer,
+                                   900);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+  LOG_I(RRC,"[eNB] MBMS SIB2 SystemInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+
+  if (enc_rval.encoded==-1) {
+    msg("[RRC] ASN1 : SI encoding failed for SIB23\n");
+    return(-1);
+  }
+
+ carrier->MBMS_flag =1;
+
+ if (NODE_IS_MONOLITHIC(rrc->node_type)) {
+    rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id,
+                           0,0,0,0,0,
+                           0,
+                           0xfffd,//rnti
+                           (LTE_BCCH_BCH_Message_t *)NULL,
+                           (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+                           (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+                           (struct LTE_PhysicalConfigDedicated *)NULL,
+                           (LTE_SCellToAddMod_r10_t *)NULL,
+                         //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
+                           (LTE_MeasObjectToAddMod_t **) NULL,
+                           (LTE_MAC_MainConfig_t *) NULL,
+                           0,
+                           (struct LTE_LogicalChannelConfig *)NULL,
+                           (LTE_MeasGapConfig_t *) NULL,
+                           (LTE_TDD_Config_t *) NULL,
+                           (LTE_MobilityControlInfo_t *)NULL,
+                           (LTE_SchedulingInfoList_t *) NULL,
+			   0, NULL,
+			   (LTE_AdditionalSpectrumEmission_t *)NULL,
+ 			   (LTE_MBSFN_SubframeConfigList_t *) carrier->sib2->mbsfn_SubframeConfigList,
+                           carrier->MBMS_flag,
+                           (LTE_MBSFN_AreaInfoList_r9_t *) & carrier->sib13->mbsfn_AreaInfoList_r9,
+                           (LTE_PMCH_InfoList_r9_t *) NULL 
+                           ,
+                           (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
+                        ,
+                        carrier->FeMBMS_flag,
                         (LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL,
                         (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                         (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                         (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                        (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                        (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+			(LTE_MBSFNAreaConfiguration_r9_t*) NULL
                         );
   }
-  
-  return;
+
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = ((enc_rval.encoded+7)/8);
+ 
+  return 0;
 }
 //static uint8_t rrc_M2AP_do_SIB1(
 //  			  const protocol_ctxt_t *const ctxt_pP,
@@ -501,21 +919,23 @@ static uint8_t rrc_M2AP_do_SIB23_SIB2(
 
 
 			if(m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].is_four_sf){
+				LOG_I(RRC,"is_four_sf\n");
 				sib2_mbsfn_SubframeConfig1->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames;
 
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(3);
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 3;
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 0;
-  	                        sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[2] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[j].subframe_allocation) & 0xFF);
-                           	sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[1] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[j].subframe_allocation>>8) & 0xFF);
+  	                        sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[2] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation) & 0xFF);
+                           	sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[1] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation>>8) & 0xFF);
                            	sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation>>16) & 0xFF);
 
 			}else{
+				LOG_I(RRC,"is_one_sf\n");
 				sib2_mbsfn_SubframeConfig1->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame;
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1);
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1;
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2;
-    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=(m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[j].subframe_allocation<<2);
+    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=(m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation<<2);
 
 
 			}
@@ -580,7 +1000,8 @@ static uint8_t rrc_M2AP_do_SIB23_SIB2(
                         (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                         (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                         (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                        (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                        (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+			(LTE_MBSFNAreaConfiguration_r9_t*) NULL
                         );
   }
 
@@ -752,7 +1173,8 @@ for( i=0; i < m2ap_setup_resp->num_mcch_config_per_mbsfn; i++){
                         (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                         (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                         (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                        (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                        (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+			(LTE_MBSFNAreaConfiguration_r9_t*) NULL
                         );
   }
 
@@ -917,20 +1339,22 @@ static uint8_t rrc_M2AP_do_SIB23_SIB2_SIB13(
 
 			if(m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].is_four_sf){
 				sib2_mbsfn_SubframeConfig1->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames;
+				LOG_I(RRC,"rrc_M2AP_do_SIB23_SIB2_SIB13 is_four_sf\n");
 
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(3);
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 3;
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 0;
-  	                        sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[2] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[j].subframe_allocation) & 0xFF);
-                           	sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[1] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[j].subframe_allocation>>8) & 0xFF);
+  	                        sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[2] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation) & 0xFF);
+                           	sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[1] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation>>8) & 0xFF);
                            	sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0] = ((m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation>>16) & 0xFF);
 
 			}else{
+				LOG_I(RRC,"rrc_M2AP_do_SIB23_SIB2_SIB13 rs_one_sf\n");
 				sib2_mbsfn_SubframeConfig1->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame;
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1);
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1;
     				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2;
-    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=(m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[j].subframe_allocation<<2);
+    				sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=(m2ap_mbms_scheduling_information->mbms_area_config_list[j].mbms_sf_config_list[l].subframe_allocation<<2);
 
 
 			}
@@ -1030,7 +1454,8 @@ static uint8_t rrc_M2AP_do_SIB23_SIB2_SIB13(
                         (LTE_SchedulingInfo_MBMS_r14_t *) NULL,
                         (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
                         (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
-                        (LTE_MBSFN_AreaInfoList_r9_t *) NULL
+                        (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+			(LTE_MBSFNAreaConfiguration_r9_t*) NULL
                         );
   }
 
@@ -1122,7 +1547,11 @@ rrc_eNB_process_M2AP_MBMS_SESSION_START_REQ(
 	 rrc_M2AP_do_SIB23_SIB2(ctxt_pP,ctxt_pP->module_id,CC_id,m2ap_mbms_scheduling_information_g); 
 	 rrc_M2AP_do_SIB23_SIB13(ctxt_pP,ctxt_pP->module_id,CC_id,m2ap_setup_resp_g); 
 	}else{
-	 rrc_M2AP_do_SIB23_SIB2_SIB13(ctxt_pP,ctxt_pP->module_id,CC_id,m2ap_setup_resp_g,m2ap_mbms_scheduling_information_g); 
+	   if(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].FeMBMS_flag){
+		rrc_M2AP_do_SIB1_MBMS_SIB13(ctxt_pP,ctxt_pP->module_id,CC_id,m2ap_setup_resp_g,m2ap_mbms_scheduling_information_g);
+	   }else{ 
+	 	rrc_M2AP_do_SIB23_SIB2_SIB13(ctxt_pP,ctxt_pP->module_id,CC_id,m2ap_setup_resp_g,m2ap_mbms_scheduling_information_g); 
+	   }
 	}
 	 rrc_M2AP_init_MCCH(ctxt_pP,ctxt_pP->module_id,CC_id,m2ap_mbms_scheduling_information_g); 
 	 rrc_M2AP_init_MBMS(ctxt_pP->module_id, CC_id, 0);
diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c
index a7aa38dfe3c5ba83533a07e90103b69bc67feb79..6ea6f3b3b33181ba9944a27df61963b92797f22c 100644
--- a/openair2/RRC/NR/rrc_gNB_reconfig.c
+++ b/openair2/RRC/NR/rrc_gNB_reconfig.c
@@ -917,7 +917,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
  srs_res0->resourceMapping.repetitionFactor=NR_SRS_Resource__resourceMapping__repetitionFactor_n1;
  srs_res0->freqDomainPosition=0;
  srs_res0->freqDomainShift=0;
- srs_res0->freqHopping.c_SRS = 61;
+ srs_res0->freqHopping.c_SRS = 0;
  srs_res0->freqHopping.b_SRS=0;
  srs_res0->freqHopping.b_hop=0;
  srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither;
diff --git a/openair2/X2AP/x2ap_eNB.c b/openair2/X2AP/x2ap_eNB.c
index 6a037b8ee3461f2f53b26ee52d3aa6d8294059e1..bd7727274705b92da83d6c99a00953eaddd4a011 100644
--- a/openair2/X2AP/x2ap_eNB.c
+++ b/openair2/X2AP/x2ap_eNB.c
@@ -116,7 +116,9 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
       /* some sanity check - to be refined at some point */
       if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
         X2AP_ERROR("x2ap_enb_data_p not NULL and sctp state not SCTP_STATE_ESTABLISHED, what to do?\n");
-        abort();
+        // Allow for a gracious exit when we kill first the gNB, then the eNB
+        //abort();
+        return;
       }
 
       x2ap_enb_data_p->in_streams  = sctp_new_association_resp->in_streams;
diff --git a/openair3/M3AP/m3ap_MCE.c b/openair3/M3AP/m3ap_MCE.c
index 232b0c0ecec5842d85398dadabb7bf9a978d7aec..dec9b9689791bf5334082266bdefae0dddb4d079 100644
--- a/openair3/M3AP/m3ap_MCE.c
+++ b/openair3/M3AP/m3ap_MCE.c
@@ -142,6 +142,20 @@ void m3ap_MCE_handle_sctp_association_resp(instance_t instance, sctp_new_associa
               sctp_new_association_resp->ulp_cnx_id);
     //m3ap_handle_m3_setup_message(instance_p, m3ap_enb_data_p,
                                  //sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
+	  sleep(4);
+	  int index;
+	  /* Trying to connect to the provided list of eNB ip address */
+	  for (index = 0; index < instance_p->nb_m3; index++) {
+	    //M2AP_INFO("eNB[%d] eNB id %u acting as an initiator (client)\n",
+	     //         instance_id, instance->eNB_id);
+	    m3ap_MCE_register_MCE(instance_p,
+				  &instance_p->target_mme_m3_ip_address[index],
+				  &instance_p->mme_m3_ip_address,
+				  instance_p->sctp_in_streams,
+				  instance_p->sctp_out_streams,
+				  instance_p->mce_port_for_M3C,
+				  instance_p->multi_sd);
+	  }
     return;
   }
 
diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
index c72e7d4130023930cf0aea054828458a4899c622..1d3c280f0e5d18a6485e5bd9f45cb9f3e0bae916 100644
--- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
+++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
@@ -288,7 +288,7 @@ int ethernet_tune(openair0_device *device,
     /******************* interface level options  *************************/
     case MTU_SIZE: /* change  MTU of the eth interface */
         ifr.ifr_addr.sa_family = AF_INET;
-        strncpy(ifr.ifr_name,eth->if_name, sizeof(ifr.ifr_name));
+        strncpy(ifr.ifr_name,eth->if_name, sizeof(ifr.ifr_name)-1);
         ifr.ifr_mtu =value;
         if (ioctl(eth->sockfdd,SIOCSIFMTU,(caddr_t)&ifr) < 0 )
             perror ("[ETHERNET] Can't set the MTU");
@@ -298,7 +298,7 @@ int ethernet_tune(openair0_device *device,
 
     case TX_Q_LEN:  /* change TX queue length of eth interface */
         ifr.ifr_addr.sa_family = AF_INET;
-        strncpy(ifr.ifr_name,eth->if_name, sizeof(ifr.ifr_name));
+        strncpy(ifr.ifr_name,eth->if_name, sizeof(ifr.ifr_name)-1);
         ifr.ifr_qlen =value;
         if (ioctl(eth->sockfdd,SIOCSIFTXQLEN,(caddr_t)&ifr) < 0 )
             perror ("[ETHERNET] Can't set the txqueuelen");
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
index 1377086e8f47f57eba45b38a32a0c16868e20407..6e94717a6fbcf02525782f11eebf58e31a01cf44 100644
--- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
@@ -976,7 +976,6 @@ extern "C" {
     double usrp_master_clock;
   
     if (device_adds[0].get("type") == "b200") {
-      printf("Found USRP b200\n");
       device->type = USRP_B200_DEV;
       usrp_master_clock = 30.72e6;
       args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c
index b7b435f2d9260cbe514eef093e699bad11f6928b..81ea1cf8ba147a2f4828eab677a1a259a3c991ea 100644
--- a/targets/ARCH/rfsimulator/simulator.c
+++ b/targets/ARCH/rfsimulator/simulator.c
@@ -44,6 +44,7 @@
 #include <common/utils/assertions.h>
 #include <common/utils/LOG/log.h>
 #include <common/utils/load_module_shlib.h>
+#include <common/utils/telnetsrv/telnetsrv.h>
 #include <common/config/config_userapi.h>
 #include "common_lib.h"
 #include <openair1/PHY/defs_eNB.h>
@@ -78,11 +79,25 @@ extern RAN_CONTEXT_t RC;
 #define RFSIMULATOR_PARAMS_DESC {\
     {"serveraddr",             "<ip address to connect to>\n",          0,         strptr:&(rfsimulator->ip),              defstrval:"127.0.0.1",           TYPE_STRING,    0 },\
     {"serverport",             "<port to connect to>\n",                0,         u16ptr:&(rfsimulator->port),            defuintval:PORT,                 TYPE_UINT16,    0 },\
-    {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS,               0,         strlistptr:NULL,                        defstrlistval:NULL,              TYPE_STRINGLIST,0},\
+    {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS,               0,         strlistptr:NULL,                        defstrlistval:NULL,              TYPE_STRINGLIST,0 },\
     {"IQfile",                 "<file path to use when saving IQs>\n",  0,         strptr:&(saveF),                        defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING,    0 },\
-    {"modelname",              "<channel model name>\n",                0,         strptr:&(modelname),                    defstrval:"AWGN",                TYPE_STRING,    0 }\
+    {"modelname",              "<channel model name>\n",                0,         strptr:&(modelname),                    defstrval:"AWGN",                TYPE_STRING,    0 },\
+    {"ploss",                  "<channel path loss in dB>\n",           0,         dblptr:&(rfsimulator->chan_pathloss),   defdblval:0,                     TYPE_DOUBLE,    0 },\
+    {"forgetfact",             "<channel forget factor ((0 to 1)>\n",   0,         dblptr:&(rfsimulator->chan_forgetfact), defdblval:0,                     TYPE_DOUBLE,    0 },\
+    {"offset",                 "<channel offset in samps>\n",           0,         iptr:&(rfsimulator->chan_offset),       defintval:0,                     TYPE_INT,       0 }\
   };
 
+
+
+static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg);
+static telnetshell_cmddef_t rfsimu_cmdarray[] = {
+  {"setmodel","<model name>",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ},  
+  {"","",NULL},
+};
+
+static telnetshell_vardef_t rfsimu_vardef[] = {
+  {"",0,NULL}
+};  
 pthread_mutex_t Sockmutex;
 
 typedef struct complex16 sample_t; // 2*16 bits complex number
@@ -114,6 +129,11 @@ typedef struct {
   double sample_rate;
   double tx_bw;
   int channelmod;
+  double chan_pathloss;
+  double chan_forgetfact;
+  int    chan_offset;
+  void *telnetcmd_qid;
+  poll_telnetcmdq_func_t poll_telnetcmdq;
 } rfsimulator_state_t;
 
 
@@ -148,22 +168,26 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
     // Legacy changes directlty the variable channel_model->path_loss_dB place to place
     // while calling new_channel_desc_scm() with path losses = 0
     static bool init_done=false;
+
     if (!init_done) {
-	    uint64_t rand;
-	    FILE *h=fopen("/dev/random","r");
-            fread(&rand,sizeof(rand),1,h);
-	    fclose(h);
+	  uint64_t rand;
+	  FILE *h=fopen("/dev/random","r");
+      if ( 1 != fread(&rand,sizeof(rand),1,h) )
+        LOG_W(HW, "Simulator can't read /dev/random\n");
+	  fclose(h);
       randominit(rand);
       tableNor(rand);
       init_done=true;
     }
+
     ptr->channel_model=new_channel_desc_scm(bridge->tx_num_channels,bridge->rx_num_channels,
                                             bridge->channelmod,
                                             bridge->sample_rate,
                                             bridge->tx_bw,
-                                            0.0, // forgetting_factor
-                                            0, // maybe used for TA
-                                            0); // path_loss in dB
+                                            bridge->chan_forgetfact, // forgetting_factor
+                                            bridge->chan_offset, // maybe used for TA
+                                            bridge->chan_pathloss); // path_loss in dB
+    set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID);
     random_channel(ptr->channel_model,false);
   }
 }
@@ -290,6 +314,41 @@ void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
     rfsimulator->typeStamp = UE_MAGICDL_FDD;
 }
 
+static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg) {
+  char *modelname=NULL; 
+  int s = sscanf(buff,"%ms\n",&modelname);
+  if (s == 1) {
+    int channelmod=modelid_fromname(modelname);
+    if (channelmod<0)
+      prnt("ERROR: model %s unknown\n",modelname);
+    else {
+  	  rfsimulator_state_t *t = (rfsimulator_state_t *)arg;
+  	  for (int i=0; i<FD_SETSIZE; i++) {
+        buffer_t *b=&t->buf[i];
+        if (b->conn_sock >= 0 ) {
+          channel_desc_t *newmodel=new_channel_desc_scm(t->tx_num_channels,t->rx_num_channels,
+                                                channelmod,
+                                                t->sample_rate,
+                                                t->tx_bw,
+                                                t->chan_forgetfact, // forgetting_factor
+                                                t->chan_offset, // maybe used for TA
+                                                t->chan_pathloss); // path_loss in dB
+          set_channeldesc_owner(newmodel, RFSIMU_MODULEID);
+          random_channel(newmodel,false);
+          channel_desc_t *oldmodel=b->channel_model;
+          b->channel_model=newmodel;
+          free_channel_desc_scm(oldmodel);
+          prnt("New model %s applied to channel connected to sock %d\n",modelname,i);
+        }
+      }
+    }
+  } else {
+  	  prnt("ERROR: no model specified\n");  
+  }
+  free(modelname);
+  return CMDSTATUS_FOUND;
+}
+
 int server_start(openair0_device *device) {
   rfsimulator_state_t *t = (rfsimulator_state_t *) device->priv;
   t->typeStamp=ENB_MAGICDL_FDD;
@@ -379,6 +438,7 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp
   if (t->lastWroteTS > timestamp+nsamps)
     LOG_E(HW,"Not supported to send Tx out of order (same in USRP) %lu, %lu\n",
               t->lastWroteTS, timestamp);
+
   t->lastWroteTS=timestamp+nsamps;
 
   if (!alreadyLocked)
@@ -480,6 +540,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
 	  b->trashingPacket=true;
 	} else if ( b->lastReceivedTS < b->th.timestamp) {
           int nbAnt= b->th.nbAnt;
+
           if ( b->th.timestamp-b->lastReceivedTS < CirSize ) {
           for (uint64_t index=b->lastReceivedTS; index < b->th.timestamp; index++ ) {
             for (int a=0; a < nbAnt; a++) {
@@ -490,8 +551,10 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
           } else {
 	    memset(b->circularBuf, 0, sampleToByte(CirSize,1));
 	  }
+
           if (b->lastReceivedTS != 0 && b->th.timestamp-b->lastReceivedTS > 50 )
             LOG_W(HW,"UEsock: %d gap of: %ld in reception\n", fd, b->th.timestamp-b->lastReceivedTS );
+
           b->lastReceivedTS=b->th.timestamp;
 	  
         } else if ( b->lastReceivedTS > b->th.timestamp && b->th.size == 1 ) {
@@ -510,7 +573,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
           LOG_E(HW,"UEsock: %d Tx/Rx shift too large Tx:%lu, Rx:%lu\n", fd, t->lastWroteTS, b->lastReceivedTS);
 
         pthread_mutex_unlock(&Sockmutex);
-        b->transferPtr=(char *)&b->circularBuf[b->lastReceivedTS%CirSize];
+        b->transferPtr=(char *)&b->circularBuf[(b->lastReceivedTS*b->th.nbAnt)%CirSize];
         b->remainToTransfer=sampleToByte(b->th.size, b->th.nbAnt);
       }
 
@@ -640,8 +703,10 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
       // it seems legacy behavior is: never in UL, each frame in DL
       if (reGenerateChannel)
         random_channel(ptr->channel_model,0);
+      if (t->poll_telnetcmdq)
+      	  t->poll_telnetcmdq(t->telnetcmd_qid,t);
 
-      for (int a=0; a<nbAnt; a++) {
+      for (int a=0; a<nbAnt; a++) {//loop over number of Rx antennas
         if ( ptr->channel_model != NULL ) // apply a channel model
           rxAddInput( ptr->circularBuf, (struct complex16 *) samplesVoid[a],
                       a,
@@ -652,14 +717,16 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
                     );
         else { // no channel modeling
           sample_t *out=(sample_t *)samplesVoid[a];
-          const int64_t base=t->nextTimestamp*nbAnt+a;
-          for ( int i=0; i < nsamps; i++ ) {
-	    const int idx=(i*nbAnt+base)%CirSize;
-            out[i].r+=ptr->circularBuf[idx].r;
-            out[i].i+=ptr->circularBuf[idx].i;
-          }
+          int nbAnt_tx = ptr->th.nbAnt;//number of Tx antennas
+          //LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx);
+          for (int i=0; i < nsamps; i++) {//loop over nsamps
+        	  for (int a_tx=0; a_tx<nbAnt_tx; a_tx++){//sum up signals from nbAnt_tx antennas
+        		  out[i].r+=ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].r;
+        		  out[i].i+=ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].i;
+        	  } // end for a_tx
+          } // end for i (number of samps)
         } // end of no channel modeling
-      } // end for a...
+      } // end for a (number of rx antennas)
     }
   }
 
@@ -734,5 +801,18 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
   rfsimulator->tx_bw=openair0_cfg->tx_bw;
   //randominit(0);
   set_taus_seed(0);
+   /* look for telnet server, if it is loaded, add the channel modeling commands to it */
+  add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);
+ 
+  if (addcmd != NULL) {
+    rfsimulator->poll_telnetcmdq =  (poll_telnetcmdq_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_POLLCMDQ_FNAME);  
+    addcmd("rfsimu",rfsimu_vardef,rfsimu_cmdarray);
+    for(int i=0; rfsimu_cmdarray[i].cmdfunc != NULL; i++) {
+      if (	rfsimu_cmdarray[i].qptr != NULL) {
+        rfsimulator->telnetcmd_qid = rfsimu_cmdarray[i].qptr;
+        break;
+      }
+    }    
+  } 
   return 0;
 }
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
index 2c37e0d03f7b3be0d3af35661d6635085e78dfff..dbcbb2ed4f5456add888adeb842345d3e94fc5f2 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
@@ -248,7 +248,9 @@ RUs = (
          max_pdschReferenceSignalPower = -27;
          max_rxgain                    = 114;
          eNB_instances  = [0];
-	 sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2";
+         #beamforming 1x4 matrix:
+         bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
+         sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2";
          clock_src = "external";
     }
 );  
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 4715a4e99561fd7af741bcf94133040898a5ce20..0d0dde4ac47a322cb436485326f5c911fa32bc90 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -438,9 +438,6 @@ int restart_L1L2(module_id_t enb_id) {
   }
 
   RC.ru_mask |= (1 << ru->idx);
-  /* copy the changed frame parameters to the RU */
-  /* TODO this should be done for all RUs associated to this eNB */
-  memcpy(&ru->frame_parms, &RC.eNB[enb_id][0]->frame_parms, sizeof(LTE_DL_FRAME_PARMS));
   set_function_spec_param(RC.ru[enb_id]);
   /* reset the list of connected UEs in the MAC, since in this process with
    * loose all UEs (have to reconnect) */
@@ -556,6 +553,8 @@ int main ( int argc, char **argv )
 
   MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
   init_opt();
+  // to make a graceful exit when ctrl-c is pressed
+  set_softmodem_sighandler();
   check_clock();
 #ifndef PACKAGE_VERSION
 #  define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
@@ -713,9 +712,12 @@ int main ( int argc, char **argv )
     sync_var=0;
     pthread_cond_broadcast(&sync_cond);
     pthread_mutex_unlock(&sync_mutex);
+    create_tasks_mbms(1);
     config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
   }
-  create_tasks_mbms(1);
+  else
+    create_tasks_mbms(1);
+  //create_tasks_mbms(1);
 
   // wait for end of program
   LOG_UI(ENB_APP,"TYPE <CTRL-C> TO TERMINATE\n");
@@ -725,7 +727,7 @@ int main ( int argc, char **argv )
   // end of CI modifications
   //getchar();
   if(IS_SOFTMODEM_DOFORMS)
-     load_softscope("enb");
+     load_softscope("enb",NULL);
   itti_wait_tasks_end();
   oai_exit=1;
   LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit);
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index a45ecd22981b3b8d4976d9c9f037414643dafc62..54a9f4a669e7fb8087d1acca604348d46442aa82 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -759,7 +759,7 @@ int main( int argc, char **argv ) {
   }
 
   if(IS_SOFTMODEM_DOFORMS)
-    load_softscope("ue");
+    load_softscope("ue",NULL);
 
   config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
   printf("Sending sync to all threads (%p,%p,%p)\n",&sync_var,&sync_cond,&sync_mutex);