2/12号:修改ngnbiotgridui.py中调用NgNbiotGrid方式如下:
2/12 update: 调整调用方式,更新monitorNpdcch和fillNpdcchUss实现。
#step 4: call NgNbiotGrid
nbGrid = NgNbiotGrid(self.ngwin, self.argsNbiot)
#nrf = 0
hsfn = self.argsNbiot['nbHsfn']
sfn = self.argsNbiot['nbSfn']
'''
while True:
#npdcch candidate check?
T = int(nbGrid.ussRmax * nbGrid.args['npdcchUssStartSf'])
k0 = None
for i in range(nbGrid.subfPerRfNbDl):
if (sfn * nbGrid.subfPerRfNbDl + i) % T == math.floor(nbGrid.args['npdcchUssOff'] * T):
k0 = i
break
if nbGrid.recvingNpdcch or (k0 is not None and not nbGrid.recvingNpdsch and not nbGrid.sendingNpusch):
#nbGrid.monitorNpdcch(hsfn, sfn)
hsfn, sfn, subf = nbGrid.monitorNpdcch(hsfn, sfn)
hsfn, sfn = incSfn(hsfn, sfn, 1)
else:
nbGrid.normalOps(hsfn, sfn)
hsfn, sfn = incSfn(hsfn, sfn, 1)
#note: nrf is only used for testing purpose!
nrf = nrf + 1
if nrf > 256:
break
'''
#NB DL SU scheduling simulation
hsfn, sfn, subf = nbGrid.monitorNpdcch(hsfn, sfn) #recv NPDCCH DCI N1
hsfn, sfn, subf = nbGrid.recvNpdschWoBcch(hsfn, sfn, subf) #recv NPDSCH w/o BCCH
#hsfn, sfn, subf = nbGrid.sendNpuschFormat2(hsfn, sfn, subf) #TODO send NPUSCH format 2
hsfn, sfn = incSfn(hsfn, sfn, 1) #wait for next NPDCCH candidate
#NB UL SU scheduling simulation
hsfn, sfn, subf = nbGrid.monitorNpdcch(hsfn, sfn) #recv NPDCCH DCI N0
#hsfn, sfn, subf = nbGrid.sendNpuschFormat1(hsfn, sfn, subf) #TODO send NPUSCH format 1
hsfn, sfn = incSfn(hsfn, sfn, 1) #wait for next NPDCCH candidate
同时修改monitorNpdcch实现如下:
def monitorNpdcch(self, hsfn, sfn):
#2018-2-12 update
#self.ngwin.logEdit.append('monitorNpdcch @ [HSFN=%d,SFN=%d]' % (hsfn, sfn))
while True:
#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
if k0 is not None:
u = list(range(self.ussRmax // self.ussR))
b = u[0] * self.ussR #for simplicity, always use the first candidate
self.ngwin.logEdit.append('call resetNpdcchUssMap with T=%d, R=%d, k0=%d, b=%d @ [HSFN=%d,SFN=%d]' % (T, self.ussR, k0, b, hsfn, sfn))
self.resetNpdcchUssMap(hsfn, sfn, k0, b)
for key,val in self.npdcchUssMap.items():
self.ngwin.logEdit.append('key=%s,val=%s' % (key, val))
break
else:
self.normalOps(hsfn, sfn)
hsfn, sfn = incSfn(hsfn, sfn, 1)
self.normalOps(hsfn, sfn)
self.fillNpdcchUss(hsfn, sfn)
#proceed to receive NPDCCH
allKeys = list(self.npdcchUssMap.keys())
key = str(hsfn) + '_' + str(sfn)
if key in allKeys:
current = key
last = allKeys[-1] if len(allKeys) > 1 else None
else:
current = key
last = allKeys[-1]
if last is not None:
while True:
hsfn, sfn = incSfn(hsfn, sfn, 1)
self.normalOps(hsfn, sfn)
self.fillNpdcchUss(hsfn, sfn)
current = str(hsfn) + '_' + str(sfn)
if current == last:
break
#reset flag after receiving NPDCCH
self.recvingNpdcch = False
#make return tuple
retHsfn, retSfn = allKeys[-1].split('_')
retSubf = self.npdcchUssMap[allKeys[-1]][-1]
return (int(retHsfn), int(retSfn), retSubf)
监听NPDCCH结束(recvingNpdcch=False)时,返回(hsfn, sfn, subf)用于后续的NPDSCH/NPUSCH mapping。
比如NPDSCH接收时序上,参见36.213 16.4.1节,用于计算n和n0。