2/10初步完成NgNbiotGrid.fillNpdcchUss(TODO:NPDCCH Gap未实现)。
2018-2-11:fillNpdcchUss中,参照36.211更新npdcch mapping。
2018-2-12:增加flag:recvingNpdcch, recvingNpdsch和sendingNpusch。
2/12 update:resetNpdcchUssMap在monitorNpdcch中调用。
def fillNpdcchUss(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
'''2018-2-12 update
#from 36.213 16.6
#The locations of starting subframe k are given by k=k_b where k_b is the bth consecutive NB-IoT DL subframe from subframe k0,
#excluding subframes used for transmission of SI messages, and b=u*R , and u=0,1,...,R_max/R-1, and where:
#-subframe k0 is a subframe satisfying the condition: (10*nf + floor(ns/2)) mod T = floor(a_offset * T)
#-where T = R_max * G, T >= 4
T = int(self.ussRmax * self.args['npdcchUssStartSf'])
k0 = None
for i in range(self.subfPerRfNbDl):
if (sfn * self.subfPerRfNbDl + i) % T == math.floor(self.args['npdcchUssOff'] * T):
k0 = i
break
u = list(range(self.ussRmax // self.ussR))
b = u[0] * self.ussR #for simplicity, always use the first candidate
#2018-2-12 update
if not self.recvingNpdcch and not self.recvingNpdsch and not self.sendingNpusch and k0 is not None:
#if k0 is not None:
self.resetNpdcchUssMap(hsfn, sfn, k0, b)
self.recvingNpdcch = True
'''
key = str(hsfn) + '_' + str(sfn)
if not key in self.npdcchUssMap:
return
slots = []
for subf in self.npdcchUssMap[key]:
slots.extend([2*subf, 2*subf+1])
'''
for iap in range(self.args['nbDlAp']):
for islot in slots:
for isymb in range(self.symbPerSlotNb):
for isc in range(self.scNbDl):
if self.gridNbDl[dn][iap][isc][islot*self.symbPerSlotNb+isymb] == NbiotResType.NBIOT_RES_BLANK.value:
self.gridNbDl[dn][iap][isc][islot*self.symbPerSlotNb+isymb] = NbiotResType.NBIOT_RES_NPDCCH.value
'''
#2018-2-11 update
#from 36.211 10.2.5.5
#...which meet all of the following criteria:
#- they are part of the NCCE(s) assigned for the NPDCCH transmission, and
#- they are not used for transmission of NPBCH, NPSS, or NSSS , and
#- they are assumed by the UE not to be used for NRS, and
#- they are not overlapping with resource elements used for PBCH, PSS, SSS, or CRS as defined in clause 6 (if any), and
#- the index l in the first slot in a subframe fulfills l >= l_NPDCCH_start where l_NPDCCH_start is given by clause 16.6.1 of 3GPP TS 36.213 [4].
for iap in range(self.args['nbDlAp']):
for islot in slots:
#for simplicity, let l = CFI of host LTE in the first slot if a subframe
for isymb in range(self.args['hostLteCfi'] if islot % 2 == 0 else 0, self.symbPerSlotNb):
#for simplicity, always use NCCE0 when AL==1
for isc in range(self.scNbDl // 2 if self.ussAggLev == 1 else self.scNbDl):
if self.gridNbDl[dn][iap][isc][islot*self.symbPerSlotNb+isymb] == NbiotResType.NBIOT_RES_BLANK.value and self.args['hostLteGridDl'][iap][self.args['nbInbandPrbIndDl'] * 12 + isc][islot*self.symbPerSlotNb+isymb] == LteResType.LTE_RES_PDSCH.value:
self.gridNbDl[dn][iap][isc][islot*self.symbPerSlotNb+isymb] = NbiotResType.NBIOT_RES_NPDCCH.value
#TODO: NPDCCH Gap to be implemented!
resetNpdcchUssMap用于生成NPDCCH USS candidate子帧序列。self.npdcchUssMap定义如下:
#data structure for NPDCCH USS mapping
self.npdcchUssMap = OrderedDict() #key='hsfn_sfn', value=[list of dl subframes for the first uss candidate]
self.ussRmax = self.args['npdcchUssNumRep']
#Table 16.6-1: NPDCCH UE- specific search space candidates
_ussCand = {1 : [(1, 1, 'ncce0')], #(1, 1, 'ncce1'), (1, 2, 'ncce01') not supported!
2 : [(1, 1, 'ncce0'), (2, 2, 'ncce01')], #(1, 1, 'ncce1'), (2, 2, 'ncce01') not supported!
4 : [(1, 2, 'ncce01'), (2, 2, 'ncce01'), (4, 2, 'ncce01')],
8 : [(self.ussRmax // 8, 2, 'ncce01'), (self.ussRmax // 4, 2, 'ncce01'), (self.ussRmax // 2, 2, 'ncce01'), (self.ussRmax, 2, 'ncce01')]}
self.ussR, self.ussAggLev, ncce = _ussCand[self.ussRmax][self.args['nbDciN0N1SfRep']] if self.ussRmax < 8 else _ussCand[8][self.args['nbDciN0N1SfRep']]
ngnbiotgridui.py中增加self.argsNbiot['hostLteGridDl'],用于NPDCCH re mapping:
#step 2: call NgLteGrid
lteGrid = NgLteGrid(self.ngwin, self.argsLte)
if lteGrid.isOk:
lteGrid.fillCrs()
lteGrid.fillPbch()
lteGrid.fillSch()
#36.211 10.2.5.5 NPDCCH mapping
#- they are not overlapping with resource elements used for PBCH, PSS, SSS, or CRS as defined in clause 6 (if any),
#note the use of ndarray.copy()!
self.argsNbiot['hostLteGridDl'] = lteGrid.gridDl.copy()
#...(omitted)