clsDPC.vb
上传用户:qzhengtong
上传日期:2022-07-16
资源大小:1669k
文件大小:39k
- 'Imports System.Windows.Forms
- '不考虑AMR情况
- '不进行滤波
- '900频段 MS发射功率[5~33]
- '1800频段 MS发射功率 [0~31]
- '所有参数取值范围和默认值都来源于Ericsson AlexUser Description
- '部分取值范围可能超过硬件的能力范围,因为各种硬件在各种频段下的能力都不一样
- '
- Public Class clsDPC
- 'Private FilterLength() As Single = {0.1, 0.3162, 0.4642, 0.5623, 0.631, 0.6813, 0.7197, 0.7499, 0.7743, 0.7943, 0.8111, 0.8254, 0.8377, 0.8483, 0.8577, 0.866, 0.8733, 0.8799, 0.8859, 0.8913, 0.8962, 0.9006, 0.9047, 0.9085, 0.912, 0.9152, 0.9183, 0.9211, 0.9237, 0.9261}
- 'FilterLength 是根据L用来寻找系数a的,现在没有滤波,还没有用到
- Public Class MS_DPC
- Inherits clsDPC.DPC_SubFunction
- Public MS_DPC_Arr(7, 63) As Integer
- Private pUPDWNRATIO As Integer = 200 ''默认值200 取值范围[100~700]
- Public Property UPDWNRATIO() As Integer
- Get
- Return pUPDWNRATIO
- End Get
- Set(ByVal value As Integer)
- If value < 100 Then
- MessageBox.Show("UPDWNRATIO属性值应该在100~700之间." & vbNewLine & "您现在设置的属性小于100!", "该属性不符合规范!")
- Else
- If value > 700 Then
- MessageBox.Show("UPDWNRATIO属性值应该在100~700之间." & vbNewLine & "您现在设置的属性大于700!", "该属性不符合规范!")
- Else
- pUPDWNRATIO = value
- End If
- End If
- End Set
- End Property
- #Region "MS功控参数,{SSDESUL,QDESUL,LCOMPUL,QCOMPUL,SSLENUL,QLENUL,MSPWRMAX,MSPWRMIN,MSTXPWR}"
- Private pSSDESUL As Integer = 92 '默认92 取值范围[47~110] dBm (取负值)
- Public Property SSDESUL() As Integer
- Get
- Return pSSDESUL
- End Get
- Set(ByVal value As Integer)
- If value < 47 Then
- MessageBox.Show("SSDESUL属性值应该在47~110之间." & vbNewLine & "您现在设置的属性小于47!", "该属性不符合规范!")
- Else
- If value > 110 Then
- MessageBox.Show("SSDESUL属性值应该在47~110之间." & vbNewLine & "您现在设置的属性大于110!", "该属性不符合规范!")
- Else
- pSSDESUL = value
- End If
- End If
- End Set
- End Property
- Private pQDESUL As Integer = 30 '默认值30 取值范围 [0~76],单位dtqu
- Public Property QDESUL() As Integer
- Get
- Return pQDESUL
- End Get
- Set(ByVal value As Integer)
- If value < 0 Then
- MessageBox.Show("QDESUL属性值应该在0~76之间." & vbNewLine & "您现在设置的属性小于0!", "该属性不符合规范!")
- Else
- If value > 76 Then
- MessageBox.Show("QDESUL属性值应该在0~76之间." & vbNewLine & "您现在设置的属性大于76!", "该属性不符合规范!")
- Else
- pQDESUL = value
- End If
- End If
- End Set
- End Property
- Private pLCOMPUL As Integer = 6 '默认值6 取值范围[0~100] 单位 %
- Public Property LCOMPUL() As Integer
- Get
- Return pLCOMPUL
- End Get
- Set(ByVal value As Integer)
- If value < 0 Then
- MessageBox.Show("LCOMPUL属性值应该在0~100之间." & vbNewLine & "您现在设置的属性小于0!", "该属性不符合规范!")
- Else
- If value > 100 Then
- MessageBox.Show("LCOMPUL属性值应该在0~100之间." & vbNewLine & "您现在设置的属性大于100!", "该属性不符合规范!")
- Else
- pLCOMPUL = value
- End If
- End If
- End Set
- End Property
- Private pQCOMPUL As Integer = 75 '默认值75 取值范围 [0~100] 单位 %
- Public Property QCOMPUL() As Integer
- Get
- Return pQCOMPUL
- End Get
- Set(ByVal value As Integer)
- If value < 3 Then
- MessageBox.Show("QCOMPUL属性值应该在3~15之间." & vbNewLine & "您现在设置的属性小于3!", "该属性不符合规范!")
- Else
- If value > 15 Then
- MessageBox.Show("QCOMPUL属性值应该在3~15之间." & vbNewLine & "您现在设置的属性大于15!", "该属性不符合规范!")
- Else
- pQCOMPUL = value
- End If
- End If
- End Set
- End Property
- Private pSSLENUL As Integer = 3
- Public Property SSLENUL() As Integer '默认值3
- Get
- Return pSSLENUL
- End Get
- Set(ByVal value As Integer)
- If value < 3 Then
- MessageBox.Show("SSLENUL属性值应该在3~15之间." & vbNewLine & "您现在设置的属性小于3!", "该属性不符合规范!")
- Else
- If value > 15 Then
- MessageBox.Show("SSLENUL属性值应该在3~15之间." & vbNewLine & "您现在设置的属性大于15!", "该属性不符合规范!")
- Else
- pSSLENUL = value
- End If
- End If
- End Set
- End Property
- Private pQLENUL As Integer = 3 '默认值3 取值范围[1~20],单位 SACCH周期(480毫秒
- Public Property QLENUL() As Integer
- Get
- Return pQLENUL
- End Get
- Set(ByVal value As Integer)
- If value < 1 Then
- MessageBox.Show("QLENUL属性值应该在1~20之间." & vbNewLine & "您现在设置的属性小于1!", "该属性不符合规范!")
- Else
- If value > 20 Then
- MessageBox.Show("QLENUL属性值应该在1~20之间." & vbNewLine & "您现在设置的属性大于20!", "该属性不符合规范!")
- Else
- pQLENUL = value
- End If
- End If
- End Set
- End Property
- Private pMSPWRMAX As Integer = 33 'MS最大发射功率
- Public Property MSPWRMAX() As Integer
- Get
- Return pMSTXPWR
- End Get
- Set(ByVal value As Integer)
- If value < pMSPWRMIN Then
- MessageBox.Show("MSPWRMAX必须比MSPWRMIN大!", "该属性不符合规范!")
- Else
- If value < 5 Then
- MessageBox.Show("MSPWRMAX属性值应该在5~30之间." & vbNewLine & "您现在设置的属性小于5!", "该属性不符合规范!")
- Else
- If value > 33 Then
- MessageBox.Show("MSPWRMAX属性值应该在5~33之间." & vbNewLine & "您现在设置的属性大于33!", "该属性不符合规范!")
- Else
- pMSPWRMAX = value
- If pMSPWRMAX < pMSTXPWR Then
- pMSTXPWR = pMSPWRMAX
- End If
- End If
- End If
- End If
- End Set
- End Property
- Private pMSPWRMIN As Integer = 5 'MS最小发射功率 [0~14]
- Public Property MSPWRMIN() As Integer
- Get
- Return pMSPWRMIN
- End Get
- Set(ByVal value As Integer)
- If value > pMSPWRMAX Then
- MessageBox.Show("MSPWRMAX必须比MSPWRMIN大!", "该属性不符合规范!")
- Else
- If value < 0 Then
- MessageBox.Show("MSPWRMIN属性值应该在0~14之间." & vbNewLine & "您现在设置的属性小于0!", "该属性不符合规范!")
- Else
- If value > 14 Then
- MessageBox.Show("MSPWRMIN属性值应该在0~14之间." & vbNewLine & "您现在设置的属性大于14!", "该属性不符合规范!")
- Else
- pMSPWRMIN = value
- End If
- End If
- End If
- End Set
- End Property
- Private pMSTXPWR As Integer = 33 'MS发射功率
- Public Property MSTXPWR() As Integer
- Get
- Return pMSTXPWR
- End Get
- Set(ByVal value As Integer)
- If value < 5 Then
- MessageBox.Show("MSTXPWR属性值应该在5~30之间." & vbNewLine & "您现在设置的属性小于5!", "该属性不符合规范!")
- Else
- If value > 33 Then
- MessageBox.Show("MSTXPWR属性值应该在5~33之间." & vbNewLine & "您现在设置的属性大于33!", "该属性不符合规范!")
- Else
- pMSTXPWR = value
- If pMSPWRMAX < pMSTXPWR Then
- pMSTXPWR = pMSPWRMAX
- End If
- End If
- End If
- End Set
- End Property
- #End Region
- #Region "calculate_MS_DPC"
- Public Sub calculate_MS_DPC()
- '如果没有设置任何参数,就使用默认值,后者前面已经设置的值
- calculate_MS_DPC(pSSDESUL, pQDESUL, pLCOMPUL, pQCOMPUL)
- End Sub
- Public Sub calculate_MS_DPC(ByVal fSSDESUL As Integer, ByVal fQDESUL As Integer, ByVal fLCOMPUL As Integer, ByVal fQCOMPUL As Integer)
- Dim I As Integer, J As Integer, K As Integer
- For I = 0 To 7
- For J = 0 To 63
- K = J - 110
- MS_DPC_Arr(I, J) = DPC_MS_dB(K, I, -fSSDESUL, fQDESUL, fLCOMPUL, fQCOMPUL)
- Next
- Next
- End Sub
- Public Sub calculate_MS_DPC(ByVal fSSDESUL As Integer, ByVal fQDESUL As Integer, ByVal fLCOMPUL As Integer, ByVal fQCOMPUL As Integer, _
- ByVal fSSLENUL As Integer, ByVal fQLENUL As Integer, ByVal fMSPWRMAX As Integer, ByVal fMSPWRMIN As Integer, ByVal fMSTXPWR As Integer)
- '如果全部参数都提供的话,就先设置相关属性,在求值
- SSLENUL = fSSLENUL
- QLENUL = fQLENUL
- MSPWRMAX = fMSPWRMAX
- MSPWRMIN = fMSPWRMIN
- MSTXPWR = fMSTXPWR
- calculate_MS_DPC(fSSDESUL, fQDESUL, fLCOMPUL, fQCOMPUL)
- End Sub
- #End Region
- Public Function DPC_MS_dB(ByVal Rxlev As Integer, ByVal Rxqual_GSM As Integer, ByVal fSSDESUL As Integer, ByVal fQDESUL As Integer, ByVal fLCOMPUL As Integer, ByVal fQCOMPUL As Integer) As Double
- Dim PLused As Integer, PLnew As Integer, PLlast As Integer
- Dim SS_FILTERED As Single, Q_FILTERED As Single
- Dim SS_TCH As Integer, SS_COMP As Integer, Q_COMP As Integer, RXQUAL_dB As Integer
- Dim QDES_dB As Single
- 'Dim PowerOrder As Integer
- Dim bReachedMaxValue As Boolean
- Dim PWR_U As Integer
- bReachedMaxValue = False
- PLused = 0 : PLlast = -1
- PWR_U = pMSTXPWR '当前使用的发射功率
- QDES_dB = dtquTodB(fQDESUL)
- '根据fQDESUL计算出C/I的dB值
- SS_TCH = Rxlev
- SS_COMP = SS_TCH + (pMSTXPWR - PWR_U)
- '这里是SS补偿值,假设当前使用功率为33dBm
- SS_FILTERED = SS_COMP
- '假设没有滤波,因为没法估计两个测量报告
- RXQUAL_dB = dtquTodB(Rxqual_GSM * 10)
- '根据接收到的QDES计算出C/I的dB值
- Q_COMP = RXQUAL_dB + (pMSTXPWR - PWR_U)
- '这里是SQ补偿值
- Q_FILTERED = Q_COMP
- '假设没有滤波,因为没法估计两个测量报告
- 'Maximum down regulation
- Do Until bReachedMaxValue
- '是否达到最大值
- PLnew = PWR_O(SS_FILTERED, Q_FILTERED, fSSDESUL, QDES_dB, fLCOMPUL, fQCOMPUL)
- If PLnew = PLlast Then
- bReachedMaxValue = True
- DPC_MS_dB = pMSTXPWR - PWR_U 'PowerOrder *2 dB
- Exit Do
- End If
- PLlast = PLnew
- PWR_U = Max(PLnew, pMSPWRMIN)
- SS_COMP = SS_TCH + (pMSTXPWR - PWR_U)
- SS_FILTERED = SS_COMP
- Q_COMP = RXQUAL_dB + (pMSTXPWR - PWR_U)
- Q_FILTERED = Q_COMP
- Loop
- End Function
- Private Function PWR_O(ByVal SS_FILTERED As Integer, ByVal Q_FILTERED As Single, _
- ByVal fSSDES As Integer, ByVal QDES_dB As Single, ByVal fLCOMPUL As Integer, ByVal fQCOMPUL As Integer) As Double
- Dim pu1 As Double, pu2 As Double
- Dim PUint As Double
- pu1 = (fLCOMPUL / 100) * (fSSDES - SS_FILTERED) + (fQCOMPUL / 100) * (QDES_dB - Q_FILTERED)
- pu2 = 0.3 * (fSSDES - SS_FILTERED) + 0.4 * (QDES_dB - Q_FILTERED)
- PUint = Max(pu1, pu2)
- 'PUint = (fLCOMPUL / 100) * (fSSDES - SS_FILTERED) + (fQCOMPUL / 100) * (QDES_dB - Q_FILTERED) '-XXXXXXX
- 'PUint = (0.3 * (fSSDES - SS_FILTERED) + 0.4 * (QDES_dB - Q_FILTERED)) '-XXXXXXX
- PUint = Int(PUint / 2) * 2
- If PUint >= 0 Then
- PWR_O = pMSTXPWR
- Else
- PWR_O = pMSTXPWR + PUint
- End If
- End Function
- End Class
- Public Class BTS_DPC
- Inherits clsDPC.DPC_SubFunction
- Private BTS_LAPO As Integer = 30 'BTS lowest allowed power order
- Public BTS_DPC_Arr(7, 63) As Integer
- #Region "BTS功控参数,{BSPWRMIN,BSPWRT,BSPWR,BSTXPWR,Nf,SSDESDL,QDESDL,LCOMPDL,QCOMPDL,SSLENDL,QLENDL }"
- Private pBSPWRMIN As Integer = -20 '默认-20 取值范围[-20~50] dBm
- Public Property BSPWRMIN() As Integer
- Get
- Return pBSPWRMIN
- End Get
- Set(ByVal value As Integer)
- If value < -20 Then
- MessageBox.Show("BSPWR属性值应该在-20~50之间." & vbNewLine & "您现在设置的属性小于-20!", "该属性不符合规范!")
- Else
- If value > 50 Then
- MessageBox.Show("BSPWR属性值应该在-20~50之间." & vbNewLine & "您现在设置的属性大于50!", "该属性不符合规范!")
- Else
- pBSPWRMIN = value
- 'bts最大改变电平
- If pBSTXPWR - pBSPWRMIN > 30 Then
- BTS_LAPO = 30
- Else
- BTS_LAPO = pBSTXPWR - pBSPWRMIN
- End If
- End If
- End If
- End Set
- End Property
- Private pBSPWRT As Integer = 45 '默认45 取值范围[0~63] dBm
- Public Property BSPWRT() As Integer
- Get
- Return pBSPWRT
- End Get
- Set(ByVal value As Integer)
- If value < 0 Then
- MessageBox.Show("BSPWR属性值应该在0~63之间." & vbNewLine & "您现在设置的属性小于0!", "该属性不符合规范!")
- Else
- If value > 63 Then
- MessageBox.Show("BSPWR属性值应该在0~63之间." & vbNewLine & "您现在设置的属性大于63!", "该属性不符合规范!")
- Else
- pBSPWRT = value
- If pBSTXPWR - pBSPWRMIN > 30 Then
- BTS_LAPO = 30
- Else
- ''bts最大改变电平
- BTS_LAPO = pBSTXPWR - pBSPWRMIN
- End If
- End If
- End If
- End Set
- End Property
- Private pBSPWR As Integer = 45 '默认45 取值范围[0~80] dBm
- Public Property BSPWR() As Integer
- Get
- Return pBSPWR
- End Get
- Set(ByVal value As Integer)
- If value < 0 Then
- MessageBox.Show("BSPWR属性值应该在0~80之间." & vbNewLine & "您现在设置的属性小于0!", "该属性不符合规范!")
- Else
- If value > 80 Then
- MessageBox.Show("BSPWR属性值应该在0~80之间." & vbNewLine & "您现在设置的属性大于80!", "该属性不符合规范!")
- Else
- pBSPWR = value
- End If
- End If
- End Set
- End Property
- Private pBSTXPWR As Integer = 45 '默认45 取值范围[0~80] dBm
- Public Property BSTXPWR() As Integer
- Get
- Return pBSTXPWR
- End Get
- Set(ByVal value As Integer)
- If value < 0 Then
- MessageBox.Show("BSTXPWR属性值应该在0~80之间." & vbNewLine & "您现在设置的属性小于0!", "该属性不符合规范!")
- Else
- If value > 80 Then
- MessageBox.Show("BSTXPWR属性值应该在0~80之间." & vbNewLine & "您现在设置的属性大于80!", "该属性不符合规范!")
- Else
- pBSTXPWR = value
- End If
- End If
- End Set
- End Property
- Private pNf As Integer = 1 '默认1 取值范围[1~16] 跳频频点个数
- Public Property Nf() As Integer
- Get
- Return pNf
- End Get
- Set(ByVal value As Integer)
- If value < 1 Then
- MessageBox.Show("SSDESDL属性值应该在1~16之间." & vbNewLine & "您现在设置的属性小于1!", "该属性不符合规范!")
- Else
- If value > 16 Then
- MessageBox.Show("SSDESDL属性值应该在1~16之间." & vbNewLine & "您现在设置的属性大于16!", "该属性不符合规范!")
- Else
- pNf = value
- End If
- End If
- End Set
- End Property
- Private pSSDESDL As Integer = 90 '默认90 取值范围[47~110] dBm (取负值)
- Public Property SSDESDL() As Integer
- Get
- Return pSSDESDL
- End Get
- Set(ByVal value As Integer)
- If value < 47 Then
- MessageBox.Show("SSDESDL属性值应该在47~110之间." & vbNewLine & "您现在设置的属性小于47!", "该属性不符合规范!")
- Else
- If value > 110 Then
- MessageBox.Show("SSDESDL属性值应该在47~110之间." & vbNewLine & "您现在设置的属性大于110!", "该属性不符合规范!")
- Else
- pSSDESDL = value
- End If
- End If
- End Set
- End Property
- Private pQDESDL As Integer = 30 '默认值30 取值范围 [0~76],单位dtqu
- Public Property QDESDL() As Integer
- Get
- Return pQDESDL
- End Get
- Set(ByVal value As Integer)
- If value < 0 Then
- MessageBox.Show("QDESDL属性值应该在0~76之间." & vbNewLine & "您现在设置的属性小于0!", "该属性不符合规范!")
- Else
- If value > 76 Then
- MessageBox.Show("QDESDL属性值应该在0~76之间." & vbNewLine & "您现在设置的属性大于76!", "该属性不符合规范!")
- Else
- pQDESDL = value
- End If
- End If
- End Set
- End Property
- Private pLCOMPDL As Integer = 5 '默认值5 取值范围[0~100] 单位 %
- Public Property LCOMPDL() As Integer
- Get
- Return pLCOMPDL
- End Get
- Set(ByVal value As Integer)
- If value < 0 Then
- MessageBox.Show("LCOMPDL属性值应该在0~100之间." & vbNewLine & "您现在设置的属性小于0!", "该属性不符合规范!")
- Else
- If value > 100 Then
- MessageBox.Show("LCOMPDL属性值应该在0~100之间." & vbNewLine & "您现在设置的属性大于100!", "该属性不符合规范!")
- Else
- pLCOMPDL = value
- End If
- End If
- End Set
- End Property
- Private pQCOMPDL As Integer = 55 '默认值55 取值范围 [0~100] 单位 %
- Public Property QCOMPDL() As Integer
- Get
- Return pQCOMPDL
- End Get
- Set(ByVal value As Integer)
- If value < 3 Then
- MessageBox.Show("QCOMPDL属性值应该在3~15之间." & vbNewLine & "您现在设置的属性小于3!", "该属性不符合规范!")
- Else
- If value > 15 Then
- MessageBox.Show("QCOMPDL属性值应该在3~15之间." & vbNewLine & "您现在设置的属性大于15!", "该属性不符合规范!")
- Else
- pQCOMPDL = value
- End If
- End If
- End Set
- End Property
- Private pSSLENDL As Integer '默认值3 [3~15]
- Public Property SSLENDL() As Integer
- Get
- Return pSSLENDL
- End Get
- Set(ByVal value As Integer)
- If value < 3 Then
- MessageBox.Show("SSLENDL属性值应该在3~15之间." & vbNewLine & "您现在设置的属性小于3!", "该属性不符合规范!")
- Else
- If value > 15 Then
- MessageBox.Show("SSLENDL属性值应该在3~15之间." & vbNewLine & "您现在设置的属性大于15!", "该属性不符合规范!")
- Else
- pSSLENDL = value
- End If
- End If
- End Set
- End Property
- Private pQLENDL As Integer '默认值3 取值范围[1~20],单位 SACCH周期(480毫秒
- Public Property QLENDL() As Integer
- Get
- Return pQLENDL
- End Get
- Set(ByVal value As Integer)
- If value < 1 Then
- MessageBox.Show("QLENDL属性值应该在1~20之间." & vbNewLine & "您现在设置的属性小于1!", "该属性不符合规范!")
- Else
- If value > 20 Then
- MessageBox.Show("QLENDL属性值应该在1~20之间." & vbNewLine & "您现在设置的属性大于20!", "该属性不符合规范!")
- Else
- pQLENDL = value
- End If
- End If
- End Set
- End Property
- #End Region
- Private pUPDWNRATIO As Integer = 200 ''默认值200 取值范围[100~700]
- Public Property UPDWNRATIO() As Integer
- Get
- Return pUPDWNRATIO
- End Get
- Set(ByVal value As Integer)
- If value < 100 Then
- MessageBox.Show("UPDWNRATIO属性值应该在100~700之间." & vbNewLine & "您现在设置的属性小于100!", "该属性不符合规范!")
- Else
- If value > 700 Then
- MessageBox.Show("UPDWNRATIO属性值应该在100~700之间." & vbNewLine & "您现在设置的属性大于700!", "该属性不符合规范!")
- Else
- pUPDWNRATIO = value
- End If
- End If
- End Set
- End Property
- #Region "calculate_BTS_DPC"
- Public Sub calculate_BTS_DPC()
- '如果没有设置任何参数,就使用默认值,后者前面已经设置的值
- calculate_BTS_DPC(pSSDESDL, pQDESDL, pLCOMPDL, pQCOMPDL)
- End Sub
- Public Sub calculate_BTS_DPC(ByVal fSSDESDL As Integer, ByVal fQDESDL As Integer, ByVal fLCOMPDL As Integer, ByVal fQCOMPDL As Integer)
- Dim I As Integer, J As Integer, K As Integer
- For I = 0 To 7
- For J = 0 To 63
- K = J - 110
- BTS_DPC_Arr(I, J) = DPC_BTS_dB(K, I, -fSSDESDL, fQDESDL, fLCOMPDL, fQCOMPDL)
- Next
- Next
- End Sub
- Public Sub calculate_BTS_DPC(ByVal fSSDESUL As Integer, ByVal fQDESUL As Integer, ByVal fLCOMPUL As Integer, ByVal fQCOMPUL As Integer, _
- ByVal fSSLENDL As Integer, ByVal fQLENDL As Integer, _
- ByVal fBSPWRMIN As Integer, ByVal fBSPWRT As Integer, ByVal fBSPWR As Integer, ByVal fBSTXPWR As Integer, ByVal fNf As Integer)
- '如果全部参数都提供的话,就先设置相关属性,在求值
- 'BSPWRMIN,BSPWRT,BSPWR,BSTXPWR,Nf,SSDESDL,QDESDL,LCOMPDL,QCOMPDL,SSLENDL,QLENDL
- BSPWRMIN = fBSPWRMIN
- BSPWRT = fBSPWRT
- BSPWR = fBSPWR
- BSTXPWR = fBSTXPWR
- Nf = fNf
- SSLENDL = fSSLENDL
- QLENDL = fQLENDL
- calculate_BTS_DPC(fSSDESUL, fQDESUL, fLCOMPUL, fQCOMPUL)
- End Sub
- #End Region
- Public Function DPC_BTS_dB(ByVal Rxlev As Integer, ByVal Rxqual_GSM As Integer, ByVal fSSDESDL As Integer, ByVal fQDESDL As Integer, ByVal fLCOMPDL As Integer, ByVal fQCOMPDL As Integer) As Double
- Dim PLused As Integer, PLnew As Integer, PLlast As Integer
- Dim SS_FILTERED As Single, Q_FILTERED As Single
- Dim SS_TCH As Integer, SS_COMP As Integer, Q_COMP As Integer, RXQUAL_dB As Integer, QDES_dB As Single
- 'Dim oldSS_FILTERED As Single
- 'Dim PowerOrder As Integer
- Dim bReachedMaxValue As Boolean
- 'BSPWRT = 45
- bReachedMaxValue = False
- PLused = 0
- PLlast = -1
- QDES_dB = dtquTodB(fQDESDL)
- 'BTS (TRU) output power (k) (dBm) = BSPWRT - 2 * PLused
- '手机实际发射功率的算法
- SS_TCH = Rxlev - (BSPWR - BSTXPWR + 2 * PLused) / Nf
- '跳频和非BCCH补偿
- SS_COMP = SS_TCH + 2 * PLused
- '功控补偿
- SS_FILTERED = SS_COMP
- '假设信号稳定,不需要滤波
- RXQUAL_dB = dtquTodB(Rxqual_GSM * 10)
- Q_COMP = RXQUAL_dB + 2 * PLused
- Q_FILTERED = Q_COMP
- 'Q_FILTERED = fQDESDL
- 'Maximum down regulation
- Do Until bReachedMaxValue
- PLnew = pu(SS_FILTERED, Q_FILTERED, fSSDESDL, QDES_dB, fLCOMPDL, fQCOMPDL)
- If PLnew = PLlast Then 'PLnew = PLlast
- bReachedMaxValue = True
- DPC_BTS_dB = PLused * 2 'PowerOrder *2 dB
- If DPC_BTS_dB > BTS_LAPO Then DPC_BTS_dB = BTS_LAPO
- Exit Do
- End If
- PLlast = PLnew
- PLused = Max(PLnew, 0)
- SS_COMP = SS_TCH + 2 * PLused
- SS_FILTERED = SS_COMP
- 'oldSS_FILTERED = SS_FILTERED
- Q_COMP = RXQUAL_dB + 2 * PLused
- Q_FILTERED = Q_COMP
- Loop
- End Function
- Private Function pu(ByVal SS_FILTERED As Integer, ByVal Q_FILTERED As Single, _
- ByVal SSDES As Integer, ByVal QDES_dB As Single, ByVal LCOMP As Integer, ByVal QCOMP As Integer) As Double
- Dim pu1 As Double, pu2 As Double
- pu1 = (LCOMP / 100) * (SSDES - SS_FILTERED) + (QCOMP / 100) * (QDES_dB - Q_FILTERED)
- pu2 = 0.3 * (SSDES - SS_FILTERED) + 0.4 * (QDES_dB - Q_FILTERED)
- pu = Max(pu1, pu2)
- pu = Int(-pu / 2)
- End Function
- End Class
- Public Class GPRS_MS_DPC
- Inherits clsDPC.DPC_SubFunction
- Public GPRS_BTS_DPC_Arr(31, 63) As Integer
- Private MsMaxPower As Integer
- #Region "GPRS/EGPRS手机功控参数{ALPHA,GAMMA,GAMMA0,CCHPWR,GPRS_MS_TXPWR_MAX_CCH,P_min,CellType}"
- Private pALPHA As Single = 0.6 '默认值0 取值范围[0~1]
- Public Property ALPHA() As Single
- Get
- Return pALPHA
- End Get
- Set(ByVal value As Single)
- If value < 0 Then
- MessageBox.Show("ALPHA属性值应该在0~1之间." & vbNewLine & "您现在设置的属性小于0!", "该属性不符合规范!")
- Else
- If value > 1 Then
- MessageBox.Show("ALPHA属性值应该在0~1之间." & vbNewLine & "您现在设置的属性大于1!", "该属性不符合规范!")
- Else
- pALPHA = Int(value * 10) / 10
- End If
- End If
- End Set
- End Property
- Private pGAMMA As Integer = 0 ''默认值0 取值范围[0~62],偶数
- Public Property GAMMA() As Integer
- Get
- Return pGAMMA
- End Get
- Set(ByVal value As Integer)
- If value < 0 Then
- MessageBox.Show("GAMMA属性值应该在0~62之间." & vbNewLine & "您现在设置的属性小于0!", "该属性不符合规范!")
- Else
- If value > 62 Then
- MessageBox.Show("GAMMA属性值应该在0~62之间." & vbNewLine & "您现在设置的属性大于62!", "该属性不符合规范!")
- Else
- If value Mod 2 = 1 Then
- MessageBox.Show("GAMMA属性值只能为偶数!", "该属性不符合规范!")
- Else
- pGAMMA = value
- End If
- End If
- End If
- End Set
- End Property
- Private pGAMMA0 As Integer = 39 '默认值39 取值范围[39/26],偶数
- Public Property GAMMA0() As Integer
- Get
- Return pGAMMA0
- End Get
- Set(ByVal value As Integer)
- If value = 39 Then
- pGAMMA0 = 39
- Else
- If value = 36 Then
- pGAMMA0 = 36
- Else
- MessageBox.Show("GAMMA0属性值只能是39或者36.", "该属性不符合规范!")
- End If
- End If
- End Set
- End Property
- Private pCCHPWR As Integer = 33 ''默认值33 取值范围[4~43]
- Public Property CCHPWR() As Integer
- Get
- Return pCCHPWR
- End Get
- Set(ByVal value As Integer)
- If value < 4 Then
- MessageBox.Show("CCHPWR属性值应该在4~43之间." & vbNewLine & "您现在设置的属性小于4!", "该属性不符合规范!")
- Else
- If value > 43 Then
- MessageBox.Show("CCHPWR属性值应该在4~43之间." & vbNewLine & "您现在设置的属性大于43!", "该属性不符合规范!")
- Else
- pCCHPWR = value
- MsMaxPower = Min(pCCHPWR, pPmax)
- End If
- End If
- End Set
- End Property
- Private pGPRS_MS_TXPWR_MAX_CCH As Integer = 33 ''默认值33 取值范围[4~43]
- Public Property GPRS_MS_TXPWR_MAX_CCH() As Integer
- Get
- Return pGPRS_MS_TXPWR_MAX_CCH
- End Get
- Set(ByVal value As Integer)
- If value < 4 Then
- MessageBox.Show("GPRS_MS_TXPWR_MAX_CCH属性值应该在4~43之间." & vbNewLine & "您现在设置的属性小于4!", "该属性不符合规范!")
- Else
- If value > 43 Then
- MessageBox.Show("GPRS_MS_TXPWR_MAX_CCH属性值应该在4~43之间." & vbNewLine & "您现在设置的属性大于43!", "该属性不符合规范!")
- Else
- pGPRS_MS_TXPWR_MAX_CCH = value
- End If
- End If
- End Set
- End Property
- Private pPmin As Integer = 13 ''默认值13 取值范围[4~43]
- ' 'GSM800/900 []
- '13 到 43 步长为 2 (GSM 800).
- '13 到 43 步长为 2 (GSM 900).
- '4 到 30 步长为 2 (GSM 1800).
- '4 到 30 步长为 2 (GSM 1900)
- Public Property Pmin() As Integer
- Get
- Return pPmin
- End Get
- Set(ByVal value As Integer)
- If value < 4 Then
- MessageBox.Show("Pmin属性值应该在4~43之间." & vbNewLine & "您现在设置的属性小于4!", "该属性不符合规范!")
- Else
- If value > 700 Then
- MessageBox.Show("Pmin属性值应该在4~43之间." & vbNewLine & "您现在设置的属性大于43!", "该属性不符合规范!")
- Else
- pPmin = value
- End If
- End If
- End Set
- End Property
- Private pPmax As Integer = 33 ''默认值33 取值范围[13~43]
- Public Property Pmax() As Integer
- Get
- Return pPmax
- End Get
- Set(ByVal value As Integer)
- If value < 13 Then
- MessageBox.Show("Pmax属性值应该在13~43之间." & vbNewLine & "您现在设置的属性小于13!", "该属性不符合规范!")
- Else
- If value > 700 Then
- MessageBox.Show("Pmax属性值应该在13~43之间." & vbNewLine & "您现在设置的属性大于43!", "该属性不符合规范!")
- Else
- pPmax = value
- MsMaxPower = Min(pCCHPWR, pPmax)
- End If
- End If
- End Set
- End Property
- Private pCellType As String = "GSM900" '[GSM900,GSM1800,GSM800,GSM1900]
- Public Property CellType() As String
- Get
- Return pCellType
- End Get
- Set(ByVal value As String)
- Select Case value
- Case "GSM800", "GSM900"
- pGAMMA0 = 39
- pCellType = value
- Case "GSM1800", "GSM1900"
- pGAMMA0 = 36
- pCellType = value
- Case Else
- MessageBox.Show("CellType(小区类型)属性值应该在[GSM900,GSM1800,GSM800,GSM1900]之间的一个.", "该属性不符合规范!")
- End Select
- End Set
- End Property
- #End Region
- Public Sub calculate_GPRS_MS_DPC()
- For I As Integer = 0 To 62 Step 2
- pGAMMA = I
- For J As Integer = 0 To 63
- GPRS_BTS_DPC_Arr(I / 2, J) = GPRS_DPC_BTS_dB(J - 110)
- 'Debug.Print("J-110: GAMMA=" & pGAMMA & " C=" & J - 110 & " dB=" & GPRS_DPC_BTS_dB(J - 110))
- 'Debug.Print("J : GAMMA=" & pGAMMA & " C=" & J - 110 & " dB=" & GPRS_DPC_BTS_dB(J))
- Next
- Next
- End Sub
- Public Sub calculate_GPRS_MS_DPC(ByVal fGAMMA As Integer, ByVal fALPHA As Single)
- GAMMA = fGAMMA
- ALPHA = fALPHA
- calculate_GPRS_MS_DPC()
- End Sub
- Public Sub calculate_GPRS_MS_DPC(ByVal fGAMMA As Integer, ByVal fALPHA As Single, ByVal fGAMMA0 As Integer)
- GAMMA = fGAMMA
- ALPHA = fALPHA
- GAMMA0 = fGAMMA0
- calculate_GPRS_MS_DPC()
- End Sub
- Public Sub calculate_GPRS_MS_DPC(ByVal fGAMMA As Integer, ByVal fALPHA As Single, ByVal fGAMMA0 As Integer _
- , ByVal fPmax As Integer, ByVal fPmin As Integer)
- GAMMA = fGAMMA
- ALPHA = fALPHA
- GAMMA0 = fGAMMA0
- Pmax = fPmax
- Pmin = fPmin
- calculate_GPRS_MS_DPC()
- End Sub
- Public Function GPRS_DPC_BTS_dB(ByVal C As Single) As Single
- 'P=min(Pmax,GAMMA0-GAMMA-ALPHA(C+48))
- 'GAMMA=GAMMA0-BSPWRB-SStarget-48
- GPRS_DPC_BTS_dB = Min(MsMaxPower, pGAMMA0 - pGAMMA - pALPHA * (C + 48))
- GPRS_DPC_BTS_dB = Int(Max(GPRS_DPC_BTS_dB, pPmin))
- End Function
- Public Function GPRS_DPC_BTS_dB(ByVal C As Integer, ByVal fGAMMA As Integer, ByVal fALPHA As Single) As Single
- GAMMA = fGAMMA
- ALPHA = fALPHA
- Return GPRS_DPC_BTS_dB(C)
- End Function
- Public Function GPRS_DPC_BTS_dB(ByVal C As Integer, ByVal fGAMMA As Integer, ByVal fALPHA As Single, ByVal fGAMMA0 As Integer) As Single
- GAMMA = fGAMMA
- ALPHA = fALPHA
- GAMMA0 = fGAMMA0
- Return GPRS_DPC_BTS_dB(C)
- End Function
- Public Function GPRS_DPC_BTS_dB(ByVal C As Integer, ByVal fGAMMA As Integer, ByVal fALPHA As Single, ByVal fGAMMA0 As Integer _
- , ByVal fPmax As Integer, ByVal fPmin As Integer) As Single
- GAMMA = fGAMMA
- ALPHA = fALPHA
- GAMMA0 = fGAMMA0
- Pmax = fPmax
- Pmin = fPmin
- Return GPRS_DPC_BTS_dB(C)
- End Function
- End Class
- Public Class DPC_SubFunction
- '提取最大值
- Public Function Max(ByVal A As Double, ByVal B As Double) As Double
- If A >= B Then
- Max = A
- Else
- Max = B
- End If
- End Function
- '提取最小值
- Public Function Min(ByVal A As Double, ByVal B As Double) As Double
- If A >= B Then
- Min = B
- Else
- Min = A
- End If
- End Function
- 'Table 2 Table with relations due to non-linear rxqual to C/I mapping
- 'QDESDL [dtqu] 0 10 20 30 40 50 60 70
- 'rxqual 0 1 2 3 4 5 6 7
- 'C/I [dB] 23 19 17 15 13 11 8 4
- '由QUAL(dtqu)估算出C/I的dB值
- 'R10,R12采用非线性的算法,跟R9等算法不一样
- Public Function dtquTodB(ByVal RXQUAL_dtqu As Double) As Double
- Select Case RXQUAL_dtqu
- Case 0 To 10
- dtquTodB = Interpolation_dB(RXQUAL_dtqu, 0, 10, 23, 19)
- Case 10 To 20
- dtquTodB = Interpolation_dB(RXQUAL_dtqu, 10, 20, 19, 17)
- Case 20 To 30
- dtquTodB = Interpolation_dB(RXQUAL_dtqu, 20, 30, 17, 15)
- Case 30 To 40
- dtquTodB = Interpolation_dB(RXQUAL_dtqu, 30, 40, 15, 13)
- Case 40 To 50
- dtquTodB = Interpolation_dB(RXQUAL_dtqu, 40, 50, 13, 11)
- Case 50 To 60
- dtquTodB = Interpolation_dB(RXQUAL_dtqu, 50, 60, 11, 8)
- Case 60 To 70
- dtquTodB = Interpolation_dB(RXQUAL_dtqu, 60, 70, 8, 4)
- End Select
- End Function
- '在查表得出最大值和最小值的基础上再进行修改,得出比价精确的C/I值(dB)
- Private Function Interpolation_dB(ByVal QDES As Double, ByVal QDESmax As Double, ByVal QDESmin As Double, ByVal CImax As Double, ByVal CImin As Double) As Double
- Interpolation_dB = (QDES - QDESmin) / (QDESmax - QDESmin) * (CImax - CImin) + CImin
- 'Interpolation_dB = CImax + (QDES - QDESmax) / (QDESmax - QDESmin) * (CImax - CImin))
- 'dtqu转换到C/I(dB)是非线性的,但是在查表的到的1/8*8的部分是线性的
- '上面两个算法都可以得出正确的估算值,使用一个即可
- End Function
- End Class
- End Class