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

这篇博客记录了NG Toolset的开发过程,重点在于NPUSCH Format 2的实现,包括resetNprachMapping函数的更新,计算NPRACH Gap和占用slot,incSlot函数的增加以递增UL slot,并修复了一个incSubf的bug。此外,sendNpuschFormat2函数实现了NPUSCH Format 2的发送逻辑,validateNpuschSlot用于验证UL slot是否与NPRACH冲突。博客提供了不同UI配置参数下的输出示例。
摘要由CSDN通过智能技术生成

2/22号完成:

(1)更新resetNprachMapping,计算nprachGapSlots和nprachSlots,分别为NPRACH Gap及NPRACH占用hsfn-sfn-slot列表;

(2)增加incSlot,用于递增n个ul slot;(修正一处incSubf bug)

(3)实现了sendNpuschFormat2。

其中incSlot定义如下:

def incSlot(hsfn, sfn, slot, n, slotPerRf):
    if n <= 0:
        return (hsfn, sfn, slot)
    
    slot = slot + n
    if slot >= slotPerRf:
        hsfn, sfn = incSfn(hsfn, sfn, slot // slotPerRf)
        slot = slot % slotPerRf
        
    return (hsfn, sfn, slot)

sendNpuschFormat2实现了NPUSCH Format 2发送逻辑(npusch与nprach slot重叠及npusch gap)

def sendNpuschFormat2(self, hsfn, sfn, subf):
        self.ngwin.logEdit.append('<font color=purple>sendNpuschFormat2 with N=%d, sc=%d, k0=%d @ [HSFN=%d,SFN=%d,SUBF=%d]</font>' % (self.args['npuschFormat2NumRep']*4, self.args['npuschFormat2Sc'], self.args['npuschFormat2K0'], hsfn, sfn, subf))
        
        oldHsfn, oldSfn = hsfn, sfn
        oldKey = str(hsfn)+'_'+str(sfn)
        
        #36.213 16.4.2	UE procedure for reporting ACK/NACK
        #The UE shall upon detection of a NPDSCH transmission ending in NB-IoT subframe n intended for the UE and for which an ACK/NACK shall be provided, start, at the end of n+k0-1 DL subframe transmission of the NPUSCH carrying ACK/NACK response using NPUSCH format 2 in N consecutive NB-IoT UL slots.
        N = self.args['npuschFormat2NumRep'] * 4    #36.211 Table 10.1.2.3-1
        k0 = self.args['npuschFormat2K0']
        hsfn, sfn, subf = incSubf(hsfn, sfn, subf, k0-1)
        
        newKey = str(hsfn)+'_'+str(sfn)
        while oldKey != newKey:
            oldHsfn, oldSfn = incSfn(oldHsfn, oldSfn, 1)
            oldKey = str(oldHsfn) + '_' + str(oldSfn)
            self.normalOps(oldHsfn, oldSfn)
        
        if self.args['nbUlScSpacing'] == NbiotPhy.NBIOT_UL_3DOT75K.value:
            if subf / self.slotDurNbUl > self.slotPerRfNbUl - 1:
                hsfn, sfn = incSfn(hsfn, sfn)
                slot = 0
            else:
                slot = math.floor(subf / self.slotDurNbUl)
        else:
            slot = math.floor(subf / self.slotDurNbUl)
        
        self.npuschFmt2Map.clear()
        self.npuschGap.clear()
        npuschGapTh = math.floor(256 / self.slotDurNbUl)    #slot number for 256ms
        npuschGapDur = math.floor(40 / self.slotDurNbUl)    #slot number for 40ms
        slotMapped = 0
        slotTotal = 0
        slotRaPostponed = 0
        self.npuschPostponed = False
        while slotMapped < N:
            if slotTotal > 0 and slotTotal % npuschGapTh == 0: #after 256ms, a 40ms npusch gap is inserted
                self.ngwin.logEdit.append('<font color=red>NPUSCH gap [N=%d,slotMapped=%d,slotRaPostponed=%d,slotTotal=%d] @ [HSFN=%d,SFN=%d,SLOT=%d]</font>' % (N, slotMapped, slotRaPostponed, slotTotal, hsfn, sfn, slot))
                #36.211 10.1.3.6 Mapping to physical resources
                #The portion of a postponement due to NPRACH which coincides with a (NPUSCH) gap is counted as part of the gap.
                slotActGap = npuschGapDur - slotRaPostponed
                for i in range(slotActGap):
                    hsfn, sfn, slot = incSlot(hsfn, sfn, slot, 1, self.slotPerRfNbUl)
                    newKey = str(hsfn)+'_'+str(sfn)
                    if newKey != oldKey:
                        self.normalOps(hsfn, sfn)
                        oldKey = newKey
                        
                    if newKey in self.npuschGap:
                        self.npuschGap[newKey].append(slot)
                    else:
                        self.npuschGap[newKey] = [slot]
                #reset slotRaPostponed
                slotRaPostponed = 0
                
            hsfn, sfn, slot = incSlot(hsfn, sfn, slot, 1, self.slotPerRfNbUl)
            newKey = str(hsfn)+'_'+str(sfn)
            if newKey != oldKey:
                self.normalOps(hsfn, sfn)
                oldKey = newKey
                
            if self.validateNpuschSlot(hsfn, sfn, slot):
                for i in range(self.nSlots):
                    hsfn, sfn, slot = incSlot(hsfn, sfn, slot, i, self.slotPerRfNbUl)
                    
                    newKey = str(hsfn)+'_'+str(sfn)
                    if newKey != oldKey:
                        self.normalOps(hsfn, sfn)
                        oldKey = newKey
                        
                    self.fillNpuschFormat2(hsfn, sfn, slot)
                    #keep track of npuschFmt2Map
                    key = str(hsfn) + '_' + str(sfn)
                    if key in self.npuschFmt2Map:
                        self.npuschFmt2Map[key].append(slot)
                    else:
                        self.npuschFmt2Map[key] = [slot]
                slotMapped = slotMapped + self.nSlots
                slotTotal = slotTotal + self.nSlots
                self.npuschPostponed = False
                #reset slotRaPostponed
                slotRaPostponed = 0
            else:
                slotRaPostponed = slotRaPostponed + 1
                slotTotal = slotTotal + 1
                self.npuschPostponed = True
        
        self.ngwin.logEdit.append('contents of self.npuschFmt2Map:')
        for key, val in self.npuschFmt2Map.items():
            self.ngwin.logEdit.append('-->[NPUSCH FORMAT 2]key=%s,val=%s' % (key, val))
        if len(self.npuschGap) > 0:
            self.ngwin.logEdit.append('<font color=red>contents of self.npuschGap:</font>')
            for key, val in self.npuschGap.items():
                self.ngwin.logEdit.append('<font color=red>-->[NPUSCH GAP]key=%s,val=%s</font>' % (key, val))

        #make return tuple
        allKeys = list(self.npuschFmt2Map.keys())
        retHsfn, retSfn = list(map(int, allKeys[-1].split('_')))
        retSubf = math.floor((self.npuschFmt2Map[allKeys[-1]][-1] + 1) * self.slotDurNbUl)
        if retSubf == self.subfPerRfNbDl:
            retSubf = 0
            retHsfn, retSfn = incSfn(retHsfn, retSfn, 1)
        return (retHsfn, retSfn, retSubf)

validateNpuschSlot用于校验UL slot是否与NPRACH重叠。


采用缺省参数时,输出如下:

[2018-02-22 21:13:23] ***nb-iot grid generation started!***
CCE statistics:
-->CCE number in subframe 0 = 21
-->CCE number in subframe 1 = 21
-->CCE number in subframe 2 = 21
-->CCE number in subframe 3 = 21
-->CCE number in subframe 4 = 21
-->CCE number in subframe 5 = 21
-->CCE number in subframe 6 = 21
-->CCE number in subframe 7 = 21
-->CCE number in subframe 8 = 21
-->CCE number in subframe 9 = 21
Max PUCCH allocation info:
-->max PUCCH region in subframe 0: 4
-->max PUCCH region in subframe 1: 4
-->max PUCCH region in subframe 2: 4
-->max PUCCH region in subframe 3: 4
-->max PUCCH region in subframe 4: 4
-->max PUCCH region in subframe 5: 4
-->max PUCCH region in subframe 6: 4
-->max PUCCH region in subframe 7: 4
-->max PUCCH region in subframe 8: 4
-->max PUCCH region in subframe 9: 4
###以上为调用NgLteGrid的输出

NPRACH frequency locations (nInit=2):
-->NPRACH repetition #0: [2,3,9,8]
monitorNpdcch @ [HSFN=0,SFN=0]
call resetNpdcchUssMap with T=4, R=1, k0=0, b=0 @ [HSFN=0,SFN=0]
key=0_0,val=[1]
normalOps @ [HSFN=0,SFN=0]
nprach start slot=[0_0_16], end slot=[0_1_7]
contents of self.nprachSlots:
-->[NPRACH]key=0_0,val=[16, 17, 18, 19]
-->[NPRACH]key=0_1,val=[0, 1, 2, 3, 4, 5, 6, 7]
sendingNprach=True @ [HSFN=0,SFN=0]
###上行NPRACH资源

recving NPDCCH @ [HSFN=0,SFN=0]
###下行接收NPDCCH DCI N1

recvNpdschWoBcch with N=1, k0=0 @ [HSFN=0,SFN=0,SUBF=1]
key=0_0,val=[7]
recving NPDSCH w/o BCCH @ [HSFN=0,SFN=0]
###下行接收NPDSCH without BCCH

sendNpuschFormat2 with N=4, sc=0, k0=13 @ [HSFN=0,SFN=0,SUBF=7]
normalOps @ [HSFN=0,SFN=1]
sendingNprach=False @ [HSFN=0,SFN=1]
normalOps @ [HSFN=0,SFN=2]
contents of self.npuschFmt2Map:
-->[NPUSCH FORMAT 2]key=0_1,val=[19]
-->[NPUSCH FORMAT 2]key=0_2,val=[0, 1, 2]
###上行发送NPUSCH format 2(HARQ-ACK feedback)

monitorNpdcch @ [HSFN=0,SFN=3]
call resetNpdcchUssMap with T=4, R=1, k0=2, b=0 @ [HSFN=0,SFN=3]
key=0_3,val=[3]
normalOps @ [HSFN=0,SFN=3]
recving NPDCCH @ [HSFN=0,SFN=3]
[2018-02-22 21:13:25] ***nb-iot grid generation finished!***

如果UI配置参数为(nbiot ul tab,npusch format 2/ACK-NACK-numRepetitions-NB-r13=r128,nprach/numRepetitionsPerPreambleAttempt-r13=r8),NPUSCH format 2部分输出为:

contents of self.npuschFmt2Map:
-->[NPUSCH FORMAT 2]key=0_5,val=[12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_6,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_7,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_8,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
-->[NPUSCH FORMAT 2]key=0_13,val=[12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_14,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_15,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_16,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
-->[NPUSCH FORMAT 2]key=0_21,val=[12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_22,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_23,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_24,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
-->[NPUSCH FORMAT 2]key=0_29,val=[12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_30,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_31,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_32,val=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
-->[NPUSCH FORMAT 2]key=0_37,val=[12, 13, 14, 15, 16, 17, 18, 19]
-->[NPUSCH FORMAT 2]key=0_38,val&#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值