2/11号更新fillNpdcchUss(详见系列文章第6篇),完成fillNrs。
fillNrs实现如下:
def fillNrs(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
_nrsPos = [(0, self.symbPerSlotNb-2, 0),
(0, self.symbPerSlotNb-1, 3),
(1, self.symbPerSlotNb-2, 3),
(1, self.symbPerSlotNb-1, 0)]
if self.args['nbDlAp'] == 1:
_nrsPos = _nrsPos[:2]
m = list(range(2))
vShift = self.args['nbPci'] % 6
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) if self.validateNrsSubf(sfn, math.floor(islot/2))]
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(self.args['nbDlAp']):
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
其中validateNrsSubf用于验证当前子帧是否可用于NRS mapping:
def validateNrsSubf(self, sfn, subf):
#from 36.211 10.2.6
#When UE receives higher-layer parameter operationModeInfo indicating inband-SamePCI or inband-DifferentPCI,
#- Before the UE obtains SystemInformationBlockType1-NB, the UE may assume narrowband reference signals are transmitted in subframes #0, #4 and in subframes #9 not containing NSSS.
#- After the UE obtains SystemInformationBlockType1-NB, the UE may assume narrowband reference signals are transmitted in subframes #0, #4, subframes #9 not containing NSSS, and in NB-IoT downlink subframes and shall not expect narrowband reference signals in other downlink subframes.
if subf == 0 or subf == 4 or (sfn % 2 == 1 and subf == 9) or self.validateDlSubf(sfn, subf):
return True
else:
return False