NG Toolset开发笔记--NB-IoT Resource Grid(8)

100 篇文章 0 订阅
42 篇文章 1 订阅

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。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值