2/7号,完成以下coding:
- self.fillHostCrs(hsfn, sfn)
- self.fillNpss(hsfn, sfn)
- self.fillNsss(hsfn, sfn)
- self.fillNpbch(hsfn, sfn)
举例NPBCH mapping实现:
def fillNpbch(self, hsfn, sfn):
dn = str(hsfn) + '_' + str(sfn)
if not dn in self.gridNbDl:
self.ngwin.logEdit.append('Call NgNbiotGrid.fillHostCrs at first to initialize NgNbiotGrid.gridNbDl!')
return
if self.gridNbDlTmp is None:
self.fillGridNbDlTmp()
slots = (0, 1) #subframe 0 of each radio frame
for iap in range(self.args['nbDlAp']):
for islot in slots:
for isymb in range(3, self.symbPerSlotNb): #skip first 3 ofdm symbols which are reserved by PDCCH
for isc in range(self.scNbDl):
if self.gridNbDl[dn][iap][isc][islot*self.symbPerSlotNb+isymb] == NbiotResType.NBIOT_RES_BLANK.value and self.gridNbDlTmp[iap][isc][islot*self.symbPerSlotNb+isymb] == NbiotResType.NBIOT_RES_BLANK.value:
self.gridNbDl[dn][iap][isc][islot*self.symbPerSlotNb+isymb] = NbiotResType.NBIOT_RES_NPBCH.value
NgNbiotGrid..fillGridNbDlTmp实现如下:
def fillGridNbDlTmp(self):
if self.gridNbDlTmp is not None:
return
#from 36.211 10.2.4.4
#For the purpose of the (NPBCH) mapping, the UE shall assume cell-specific reference signals for antenna ports 0-3 and
#narrowband reference signals for antenna ports 2000 and 2001 being present irrespective of the actual configuration.
self.gridNbDlTmp = np.full((4, self.scNbDl, self.symbPerRfNbDl), NbiotResType.NBIOT_RES_BLANK.value)
_crsPos = [(0, 0, 0),
(0, self.symbPerSlotNb-3, 3),
(1, 0, 3),
(1, self.symbPerSlotNb-3, 0),
(2, 1, 0),
(2, 1, 3),
(3, 1, 3),
(3, 1, 6)]
_nrsPos = [(0, self.symbPerSlotNb-2, 0),
(0, self.symbPerSlotNb-1, 3),
(1, self.symbPerSlotNb-2, 3),
(1, self.symbPerSlotNb-1, 0)]
m = list(range(2))
vShift = self.args['nbPci']% 6
#Temporary CRS mapping with 4 antenna ports
for ap, l, v in _crsPos:
k = list(map(lambda x : 6*x+(v+vShift)%6, m))
if ap in [0, 1]:
symb = [islot * self.symbPerSlotNb + l for islot in range(self.slotPerRfNbDl)]
elif (ap == 2 and v == 0) or (ap == 3 and v == 3):
symb = [islot * self.symbPerSlotNb + l for islot in range(self.slotPerRfNbDl) if islot % 2 == 0]
else: #(ap == 2 and v == 3) or (ap == 3 and v == 6)
symb = [islot * self.symbPerSlotNb + l for islot in range(self.slotPerRfNbDl) if islot % 2 == 1]
for _k in k:
for _symb in symb:
if self.gridNbDlTmp[ap][_k][_symb] == NbiotResType.NBIOT_RES_BLANK.value:
self.gridNbDlTmp[ap][_k][_symb] = NbiotResType.NBIOT_RES_CRS.value
for _ap in range(4):
if _ap != ap:
for _k in k:
for _symb in symb:
if self.gridNbDlTmp[_ap][_k][_symb] == NbiotResType.NBIOT_RES_BLANK.value:
self.gridNbDlTmp[_ap][_k][_symb] = NbiotResType.NBIOT_RES_DTX.value
#Temporary NRS mapping with 2 antenna ports
for ap, l, v in _nrsPos:
k = list(map(lambda x : 6*x+(v+vShift)%6, m))
symb = [islot * self.symbPerSlotNb + l for islot in range(self.slotPerRfNbDl)]
for _k in k:
for _symb in symb:
if self.gridNbDlTmp[ap][_k][_symb] == NbiotResType.NBIOT_RES_BLANK.value:
self.gridNbDlTmp[ap][_k][_symb] = NbiotResType.NBIOT_RES_NRS.value
for _ap in range(2):
if _ap != ap:
for _k in k:
for _symb in symb:
if self.gridNbDlTmp[_ap][_k][_symb] == NbiotResType.NBIOT_RES_BLANK.value:
self.gridNbDlTmp[_ap][_k][_symb] = NbiotResType.NBIOT_RES_DTX.value