您的位置:首页 > 其它

5G-频点频率换算

2020-12-30 21:02 2991 查看
换算原理



 NR-ARFCN和实际频点计算公式如下:

FREF =FREF-Offs+ΔFGlobal(NREF –NREF-Offs)

FREF_Shift =FREF+ΔShift,ΔShift=0kHzor7.5kHz

  栅格步长查询表:



 NRB查询表:



 GSCN计算公式:



 各频段GSCN范围:


项目展示



   通过中心频率计算频点:



   通过中心频点计算频率:


项目代码




#5G各种带宽在不同Scs下的RB数
scs_15={'5':25,'10':52,'15':79,'20':106,'25':133
     ,'30':160,'40':216,'50':270}

scs_30={'5':11,'10':24,'15':38,'20':51,'25':65
     ,'30':78,'40':106,'50':133,'60':162
     ,'70':189,'80':217,'90':245,'100':273}

scs_60={'10':11,'15':18,'20':24,'25':31
     ,'30':38,'40':51,'50':65,'60':79
     ,'70':93,'80':107,'90':121,'100':135
     ,'200':264}

scs_120={'50':32,'100':66,'200':132,'400':264}

#---------------------GSCN输出----------------------
defgscn_print(Fref):
  ifFref<3000andFref>0:
    n=int((Fref-0.15)/1.2)
    return3*n
  ifFref<24250andFref>0:
    n=int((Fref-3000)/1.44)
    return7499+n
  ifFref<100000andFref>0:
    n=int((Fref-24250.08)/17.28)
    return22256+n
  return'NA'

#--------------------RB数据输出---------------------
defrb_print(scs,bandwidth):
  ifscs==120:
    returnscs_120[bandwidth]
  ifscs==60:
    returnscs_60[bandwidth]
  ifscs==30:
    returnscs_30[bandwidth]
  returnscs_15[bandwidth]

#--------------------SSB频点输出--------------------
defssb_print(Rb_number,Nref,scs,F_global):
  ifRb_number%2==0:
    returnNref
  else:
    returnNref-(6*scs)/(F_global*10**3)
    
#-----------------中心频点步长输出------------------
defstep_print(scs,band):
  ifband=='Band-41':
    ifscs==30:
      return6
    else:
      return3
  ifband=='Band-77'orband=='Band-78'orband=='Band-79':
    ifscs==30:
      return2
    else:
      return1
  return20
#---------------------Band输出----------------------
defBand_print(Nref):
  ifNref>402000andNref<405000:
    return'Band-34'

  ifNref>514000andNref<524000:
    return'Band-38'

  ifNref>376000andNref<384000:
    return'Band-39'

  ifNref>460000andNref<480000:
    return'Band-40'

  ifNref>499200andNref<537999:
    return'Band-41'

  ifNref>285400andNref<286400:
    return'Band-51'

  ifNref>42200andNref<440000:
    return'Band-66'

  ifNref>399000andNref<404000:
    return'Band-70'

  ifNref>123400andNref<130400:
    return'Band-71'

  ifNref>286400andNref<303400:
    return'Band-75'

  ifNref>285400andNref<286400:
    return'Band-76'

  ifNref>620000andNref<653333:
    return'Band-78'

  ifNref>620000andNref<680000:
    return'Band-77'

  ifNref>693334andNref<733333:
    return'Band-79'
  ifNref>422000andNref<434000:
    return'Band-1'
  ifNref>386000andNref<398000:
    return'Band-2'
  ifNref>361000andNref<376000:
    return'Band-3'

  ifNref>173800andNref<178800:
    return'Band-5'

  ifNref>524000andNref<538000:
    return'Band-7'

  ifNref>185000andNref<192000:
    return'Band-8'

  ifNref>145800andNref<149200:
    return'Band-12'

  ifNref>158200andNref<164200:
    return'Band-20'

  ifNref>386000andNref<399000:
    return'Band-25'

  ifNref>151600andNref<160600:
    return'Band-28'
  return'NA'

#---------------------频率转频点----------------------
defNref_point():
  #判断用户输入的中心频率是否合法
  whileTrue:
    Fref=input('\n请输入中心频率:')
    try:
      ifint(float(Fref))>0:
        break
      else:
        print('不合规请重新输入')
    except:
      print('不合规请重新输入')
  #判断用户输入的小区带宽是否合法      
  whileTrue:
    bandwidth=input('请输入小区带宽(单位MHz):')
    ifbandwidth.isdigit():
      ifint(bandwidth)in[5,15,20,25,30,40,50,60,70,80,90,100,200,400]:
        break
      else:
        print('不合规请重新输入')
    else:
      print('不合规请重新输入')
  #判断用户输入的子载波间隔是否合法
  whileTrue:
    Scs=input('请输入子载波间隔(单位KHz):')
    ifScs.isdigit():
      ifint(bandwidth)<51andint(Scs)==15:
        break
      ifint(bandwidth)<101andint(Scs)==30:
        break
      ifint(bandwidth)>11andint(bandwidth)<101andint(Scs)==60:
        break
      ifint(bandwidth)>51andint(bandwidth)<101andint(Scs)==120:
        break
      else:
        print('不合规请重新输入')
    else:
      print('不合规请重新输入')
  ifint(Fref)<100000:
    F_global=60*10**-3
    Fref_offs=24250
    Nref_offs=2016667

  ifint(Fref)<24250:
    F_global=15*10**-3
    Fref_offs=3000
    Nref_offs=600000

  ifint(Fref)<3000:
    F_global=5*10**-3
    Fref_offs=0
    Nref_offs=0
  Nref=(int(Fref)-Fref_offs)/F_global+Nref_offs #中心频点计算
  print(Nref)
  Band=Band_print(Nref)#频带获取
  print(Band)
  Step_size=int(step_print(int(Scs),Band)) #频点栅格步长获取
  print(Step_size)

  #中心频点修正
  whileint(Nref)%Step_size!=0:
    Nref+=1

  Rb_number=rb_print(int(Scs),str(int(bandwidth))) #NRB数据获取

  SSB_ref=ssb_print(Rb_number,Nref,int(Scs),F_global) #SSB频点获取

  Gscn=gscn_print(int(Fref))  #GSCN获取

  print('\n计算结果如下:')
  print('  中心频率:',Fref,'MHz')
  print('  小区带宽:',bandwidth,'MHz')
  print('  载波间隔:',Scs,'KHz')
  print('  NRB个数:',Rb_number)
  print('  频点栅格:',int(F_global*10**3),'KHz')
  print('  中心频点:',int(Nref))
  print('  SSB频点:',int(SSB_ref))
  print('  GSCN频点:',Gscn)
  print('  小区频带:',Band)
  print('  频点步长:',Step_size)

#---------------------频点转频率----------------------
defFref_point():
  #判断用户输入的中心频点是否合法
  whileTrue:
    Nref=input('\n请输入中心频点:')
    ifNref.isdigit():
      ifint(Nref)>0:
        break
      else:
        print('不合规请重新输入')
    else:
      print('不合规请重新输入')
  #判断用户输入的小区带宽是否合法      
  whileTrue:
    bandwidth=input('请输入小区带宽(单位MHz):')
    ifbandwidth.isdigit():
      ifint(bandwidth)in[5,15,20,25,30,40,50,60,70,80,90,100,200,400]:
        break
      else:
        print('不合规请重新输入')
    else:
      print('不合规请重新输入')
  #判断用户输入的子载波间隔是否合法
  whileTrue:
    Scs=input('请输入子载波间隔(单位KHz):')
    ifScs.isdigit():
      ifint(bandwidth)<51andint(Scs)==15:
        break
      ifint(bandwidth)<101andint(Scs)==30:
        break
      ifint(bandwidth)>11andint(bandwidth)<101andint(Scs)==60:
        break
      ifint(bandwidth)>51andint(bandwidth)<101andint(Scs)==120:
        break
      else:
        print('不合规请重新输入')
    else:
      print('不合规请重新输入')
  ifint(Nref)<3279167:
    F_global=60*10**-3
    Fref_offs=24250
    Nref_offs=2016667

  ifint(Nref)<2016666:
    F_global=15*10**-3
    Fref_offs=3000
    Nref_offs=600000

  ifint(Nref)<599999:
    F_global=5*10**-3
    Fref_offs=0
    Nref_offs=0
  Band=Band_print(int(Nref))#频带获取
  Step_size=int(step_print(int(Scs),Band)) #频点栅格步长获取

  Fref=int(Fref_offs+F_global*(int(Nref)-Nref_offs))  #中心频率计算

  Rb_number=rb_print(int(Scs),str(int(bandwidth))) #NRB数据获取

  SSB_ref=ssb_print(Rb_number,int(Nref),int(Scs),F_global) #SSB频点获取

  Gscn=gscn_print(int(Fref))  #GSCN获取

  print('\n计算结果如下:')
  print('  中心频率:',Fref,'MHz')
  print('  小区带宽:',bandwidth,'MHz')
  print('  载波间隔:',Scs,'KHz')
  print('  NRB个数:',Rb_number)
  print('  频点栅格:',int(F_global*10**3),'KHz')
  print('  中心频点:',int(Nref))
  print('  SSB频点:',int(SSB_ref))
  print('  GSCN频点:',Gscn)
  print('  小区频带:',Band)
  print('  频点步长:',Step_size)

#-----------------------程序入口------------------------  
if__name__=='__main__':
  print('5G子载波间隔与小区带宽对应规则:')
  print('  15KHz间隔:5M10M15M20M25M30M40M50M')
  print('  30KHz间隔:5M10M15M20M25M30M40M50M60M70M80M90M100M')
  print('  60KHz间隔:10M15M20M25M30M40M50M60M70M80M90M100M200M')
  print('  120KHz间隔:50M100M200M400M')
  whileTrue:
    sele=input('\n请选择计算方式:1、频率转频点;2、频点转频率;3、退出程序:')
    ifsele.isdigit():
      ifint(sele)==3:
        print('\n欢迎再次使用!')
        exit(0)
      ifint(sele)==1:
        Nref_point()
        continue
      ifint(sele)==2:
        Fref_point()
        continue
      else:
        print('输入有误请重新输入')
    else:
            print('输入有误请重新输入'


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: