⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testerverification.frm

📁 通过VB, GPIB协议控制测试仪器, 实现测试自动化, 这个行业的人才有些缺乏, 本人愿意分享
💻 FRM
📖 第 1 页 / 共 5 页
字号:
    Dim dblResults7 As Double
    Dim dblResults8 As Double
    Dim dblResults9 As Double
    Dim ItemsMeasured1 As Long
    Dim ItemsMeasured2 As Long
'    Dim resArray1(0 To 499) As Double

'    Dim resArray2(0 To 499) As Double
'    Dim resArray3(0 To 499) As Long
    Dim freqArray(0 To age1960_ARRAY_MAX - 1) As Double
    Dim offsetArray(0 To age1960_ARRAY_MAX - 1) As Double
    
    Dim sngLoLimit As Single
    Dim sngHiLimit As Single
    Dim itemResult As String
    Dim tempOffset As Single
    
   
    freqArray(0) = PATH_LOSS_FREQ '
    offsetArray(0) = -0.5   'PATH_LOSS 'set amplitude offset for given frequency
    
    bCompareTest = CBool(chkCompareTest.Value)
    bRepeatTest = CBool(chkRepeatTest.Value)
    bStopAtError = CBool(chkStopAtError.Value)
    
    TxPowerOffset = CSng(txtPowerOffset.Text)
    FreqErrOffset = CSng(txtFreqErrOffset.Text)
    PeakPhaseErrOffset = CSng(txtPeakPhaseErrOffset.Text)
    RMSPhaseErrOffset = CSng(txtRMSPhaseErrOffset.Text)
    PVTLevelOffset = CSng(txtPVTLevelOffset.Text)
    ORFSLevelOffset = CSng(txtORFSLevelOffset.Text)
    BEROffset = CSng(txtBEROffset.Text)
    RxLevelOffset = CSng(txtRxLevelOffset.Text)
    RxQualityOffset = CSng(txtRxQualityOffset.Text)
    
    If bCompareTest = True Then
        If bLoadRefFile = False Then
            MsgBox "欲执行比较测试, 请先点击参考文件栏, 以选择参考数据文件!"
            Exit Sub
        ElseIf InStr(RefMSSampleNo, MSSampleNo) <= 0 Then
            MsgBox "你所选择的样机必须同参考数据文件中的样机必须是同一部!"
            Exit Sub
        End If
    End If
            
    MSSampleNo = InputBox("Input Mobile Sample No")
    
    Tester.Refresh
   
    ' set the mouse pointer for the form to the hour glass
    Tester.MousePointer = vbHourglass
    
'    sTestResults = ""
    lstTestResults.Clear
    iTestNo = 0
    bFinalPass = True
    
    labTestResult.Caption = "Running..."
    labTestResult.BackColor = &H8000000A     'System active border  &HFF00&     'Green
    labTestResult.Visible = True
'-------------------------------------------------
' Configure the BS Emulator

    If vi = 0 Then
        Call Preset_8960
    End If
    
    ' Perform an instrument partial preset

    ErrorStatus = age1960_partialPreset(vi)
    If ErrorStatus < VI_SUCCESS Then
        PrintInfo "Failed to partial preset the instrument."
        Exit Sub
    End If
    
    ' Configure the operating mode
    ErrorStatus = age1960_operatingMode(vi, age1960_ACELL_MODE)
    If CheckError(ErrorStatus) = True Then Exit Sub
    
    ' Configure the display  mode
    'ErrorStatus = age1960_cmd(vi, "DISP:MODE FAST")

    'If CheckError(ErrorStatus) = True Then Exit Sub

    
    ' Configure the cell band
    'ErrorStatus = age1960_cellBand(vi, age1960_CELL_1, age1960_PGSM_BAND)
    ErrorStatus = age1960_cellBand(vi, age1960_CELL_1, age1960_EGSM_BAND)
    If CheckError(ErrorStatus) = True Then Exit Sub
    
    ' Configure the TCH  band
    ErrorStatus = age1960_TCHBand(vi, age1960_EGSM_BAND)
    If CheckError(ErrorStatus) = True Then Exit Sub
     
    ' Configure the broadcast channel and do not wait for it to change
    ErrorStatus = age1960_BCHARFCN(vi, age1960_CELL_1, 20, age1960_CURRENT_BAND, VI_FALSE)

    If CheckError(ErrorStatus) = True Then Exit Sub
    
    ' Apply the path loss factor to the instrument for the uplink loss
    'ErrorStatus = age1960_amplitudeOffset(vi, freqArray(0), offsetArray(0), 1)
    ErrorStatus = age1960_amplitudeOffset(vi, freqArray(0), offsetArray(0), 0)  'Turn off Path loss compensation
    
    If CheckError(ErrorStatus) = True Then Exit Sub

    ' Configure the cell power with a 0 dB difference between downlink
    ' and uplink loss.
    ErrorStatus = age1960_cellPower(vi, age1960_CELL_1, CELL_POWER_HIGH, 0)
    If CheckError(ErrorStatus) = True Then Exit Sub

    ' set the IMSI reported information
'    ErrorStatus = age1960_cmd(vi, "CALL:MS:REP:IMSI " & Trim(txtIMEI.Text))
    ErrorStatus = age1960_cmd(vi, "CALL:PAG:IMSI " & Trim(txtPagingIMSI.Text))
    If CheckError(ErrorStatus) = True Then Exit Sub
'-------------------------------------------------

' Configure the measurements

    ' Configure TX Power
    ErrorStatus = age1960_confTXPower(vi, 5, age1960_TRIG_AUTO, 0, 1, 5)
    If CheckError(ErrorStatus) = True Then Exit Sub
    

    ErrorStatus = age1960_confPowerVsTime(vi, 5, age1960_TRIG_AUTO, 0, _
                                          age1960_BSYNC_MID, 12, PVTTimeOffset(0), 5)
    If CheckError(ErrorStatus) = True Then Exit Sub

    ' Configure PFER
    ErrorStatus = age1960_confPFER(vi, 30, age1960_TRIG_AUTO, 0, _
                                   1, age1960_BSYNC_MID, 5)
    If CheckError(ErrorStatus) = True Then Exit Sub

    
    ErrorStatus = age1960_confORFS(vi, 5, 5, age1960_TRIG_AUTO, _
                                   0, 8, SwitchSpectrumOffset(0), 22, ModSpectrumOffset(0), 5)
    If CheckError(ErrorStatus) = True Then Exit Sub

    ' Configure BER
    ErrorStatus = age1960_confBER(vi, 10000, age1960_BER_RES_TYPE_II, 5, _
                                      VI_TRUE, VI_TRUE, 0.5, 5)
    If CheckError(ErrorStatus) = True Then Exit Sub


    
    ' Configure IQT
    'ErrorStatus = age1960_confIQTuning(vi, 1, _
    '                     age1960_TRIG_RF_RISE, 0#, _
    '                     age1960_IQ_REF_NEG67K, VI_TRUE, _
    '                     age1960_IQT_SPURFREQ_MIN_1, 5)
    
    'If CheckError(ErrorStatus) = True Then Exit Sub

    ' Configure Dynamic Power
    'ErrorStatus = age1960_confDynPower(vi, 1, 0, 2)
    
    'If CheckError(ErrorStatus) = True Then Exit Sub

'-------------------------------------------------


' Establish the call
    ErrorStatus = age1960_originateCall(vi, age1960_CALL_CONNECTED, 20)
    If CheckError(ErrorStatus) = True Then Exit Sub
           
'
'-------------------------------------------------
' Read the mobile information

    ' read the IMSI reported information
    'ErrorStatus = age1960_cmdString_Q(vi, "CALL:MS:REP:IMSI?", Len(ReturnString), ReturnString)

    'If CheckError(ErrorStatus) = True Then Exit Sub
    'PrintInfo ("IMSI: " & StrEnd(ReturnString))


    ' read the IMEI reported information
    'ErrorStatus = age1960_cmdString_Q(vi, "CALL:MS:REP:IMEI?", Len(ReturnString), ReturnString)
    'If CheckError(ErrorStatus) = True Then Exit Sub
    'PrintInfo ("IMEI: " & StrEnd(ReturnString))

    ' read the Revision Level reported information
    'ErrorStatus = age1960_cmdString_Q(vi, "CALL:MS:REP:REV?", Len(ReturnString), ReturnString)
    'If CheckError(ErrorStatus) = True Then Exit Sub
    'PrintInfo ("Revision: " & StrEnd(ReturnString))


    ' read the supported band reported information
    'ErrorStatus = age1960_cmdString_Q(vi, "CALL:MS:REP:SBAN?", Len(ReturnString), ReturnString)
    'If CheckError(ErrorStatus) = True Then Exit Sub
    'PrintInfo ("Supported Band: " & StrEnd(ReturnString))

    ' read the power class reported information
    'ErrorStatus = age1960_cmdReal64_Q(vi, "CALL:MS:REP:PCL?", dblResults1)
    'If CheckError(ErrorStatus) = True Then Exit Sub
    'PrintInfo ("Power Class: " & Str(dblResults1))


'-------------------------------------------------
' Set the cell and MS TX levels for testing

    ' Configure the cell power for Bit Error and Transmitter tests.
        
    ErrorStatus = age1960_cellPower(vi, age1960_CELL_1, CELL_POWER_MEDIUM, 0#)
    If CheckError(ErrorStatus) = True Then Exit Sub

    'ErrorStatus = age1960_PowerVsTimePlot_Q(vi, 3000, Integrity, dblResults1, dblResults2, dblResults3, dblResults4, Array1(0))
    'If CheckError(ErrorStatus) = True Then Exit Sub


    ' Set the MS TX level.
    'ErrorStatus = age1960_MSTXLevel(vi, 7, age1960_CURRENT_BAND, VI_TRUE)
    'If CheckError(ErrorStatus) = True Then Exit Sub
    
    
'-------------------------------------------------
' Test the desired channels

'    For TestChannel = 1 To 121 Step 60
    'PrintInfo ("Present test channel = " & Str(TestChannel))
    For iTest = 0 To UBound(giTestChan)
        If giTestChan(iTest) >= 512 And giTestChan(iTest) <= 885 Then
        ' Configure the cell band
            ErrorStatus = age1960_TCHBand(vi, age1960_DCS1800_BAND)
        Else
            ErrorStatus = age1960_TCHBand(vi, age1960_EGSM_BAND)
        End If
        If CheckError(ErrorStatus) = True Then Exit Sub
        TimeDelay (500)
        
        'PrintInfo ("Present test channel = " & Str(giTestChan(iTest)))
        ' Set the TCH Channel.
        ErrorStatus = age1960_TCHARFCN(vi, giTestChan(iTest), age1960_CURRENT_BAND, VI_TRUE)

        If CheckError(ErrorStatus) = True Then Exit Sub
        TimeDelay (500)
        
        ' Set the MS TX level.
        ErrorStatus = age1960_MSTXLevel(vi, giTestPCL(iTest), age1960_CURRENT_BAND, VI_TRUE)
        If CheckError(ErrorStatus) = True Then Exit Sub
        
        PrintInfo ("Set Traffic Channel = " & Str(giTestChan(iTest)) & " and MS Power Control Level = " & Str(giTestPCL(iTest)))
        TimeDelay (1000)
'-------------------------------------------------
' Read the MS power and auto range the test set

        ' Range the test set and read the TX Power.
        ErrorStatus = age1960_readTXPower_Q(vi, VI_TRUE, Integrity, dblResults1)
        If CheckError(ErrorStatus) = True Then Exit Sub
        If Integrity <> 0 Then
            PrintInfo ("Get Tx Power Value abnormally!")
            labTestResult.Caption = "Abnormal End"
            labTestResult.BackColor = &HFF&         'red
            GoTo LoopEnd
        Else
            'PrintInfo (Format_ResultLine(" Tx Power" & KeepValueDigit(Str(dblResults1), 2)))
            'PrintInfo (Format_Resultline(" Tx Power" & Str(FormatNumber(dblResults1, 2))))
            If giTestChan(iTest) >= 512 And giTestChan(iTest) <= 885 Then
               sngLoLimit = TargetTxPower_DCS(giTestPCL(iTest)) - TxPowerTolerance_DCS(giTestPCL(iTest))
               sngHiLimit = TargetTxPower_DCS(giTestPCL(iTest)) + TxPowerTolerance_DCS(giTestPCL(iTest))
               
            Else
               sngLoLimit = TargetTxPower_EGSM(giTestPCL(iTest)) - TxPowerTolerance_EGSM(giTestPCL(iTest))
               sngHiLimit = TargetTxPower_EGSM(giTestPCL(iTest)) + TxPowerTolerance_EGSM(giTestPCL(iTest))
            
            End If
            If dblResults1 >= sngLoLimit And dblResults1 <= sngHiLimit Then
                itemResult = "PASS"
            Else
                itemResult = "FAILxxxxxxxx"
                bFinalPass = False
            End If
            If bCompareTest = True Then
                PrintInfo (Format_Resultline(" Tx Power", dblResults1, bCompareTest, TxPowerOffset))
            Else
                PrintInfo (Format_Resultline1(" Tx Power =, " & Str(FormatNumber(dblResults1, 2)) & "," & sngLoLimit & "," & sngHiLimit & "," & itemResult))
            End If
        End If
        
'-------------------------------------------------
' Start the desired concurrent measurements


        ' Start concurrent measurements
        MeasFcns(0) = age1960_PVTIME
        MeasFcns(1) = age1960_PFER
        'MeasFcns(2) = age1960_ORFS
        'MeasFcns(3) = age1960_BER
        ErrorStatus = age1960_initMeasFcns(vi, 2, MeasFcns(0))
        If CheckError(ErrorStatus) = True Then Exit Sub

'-------------------------------------------------
' Fetch the results when they become available

        ' Wait for measurement to complete then fetch the results

        ' Measured results are not printed in this example
        Do
            ErrorStatus = age1960_waitForInitDone_Q(vi, 10, MeasFcnDone)
            If CheckError(ErrorStatus) = True Then Exit Sub

            If MeasFcnDone = age1960_NONEINIT Then Exit Do

            If MeasFcnDone = age1960_PVTIME Then
                ErrorStatus = age1960_fetchPowerVsTime_Q(vi, _
                                      50, Integrity, dblResults1, _
                                      dblResults2, PowerVsTimeValue(0), ItemsMeasured1)

               If CheckError(ErrorStatus) = True Then Exit Sub
                'PrintInfo (Format_ResultLine(" Power vs Time Integrity  " & Str(Integrity)))
                If Integrity <> 0 Then
                    PrintInfo ("Get Power vs Time Value abnormally!")
                    labTestResult.Caption = "Abnormal End"
                    labTestResult.BackColor = &HFF&         'red
                    GoTo LoopEnd
                Else
'                    If dblResults1 <> 0 Then
'                        bFinalPass = False
'                    End If
'                    PrintInfo (Format_Resultline(" Power vs Time Mask Status ", IIf(dblResults1, "FAIL", "PASS"), bCompareTest, dblResults1))
                    sngLoLimit = 0
                    sngHiLimit = 0
            
                    If dblResults1 >= sngLoLimit And dblResults1 <= sngHiLimit Then
                        itemResult = "PASS"
                    Else
                        itemResult = "FAILxxxxxxxx"
                        bFinalPass = False
                    End If
                    If bCompareTest = True Then
                        PrintInfo (Format_Resultline(" Power vs Time Mask Status ", dblResults1, bCompareTest, 0))
                    Else
                        PrintInfo (Format_Resultline1(" Power vs Time Mask Status =, " & dblResults1 & "," & sngLoLimit & "," & sngHiLimit & "," & itemResult))
                    End If

                End If
'                For i = 0 To ItemsMeasured1 - 1
'                    PrintInfo ("   PVT Time Offset:" & Str(PVTTimeOffset(i) * 1000000) & "uS= " & Str(PowerVsTimeValue(i)))
'                Next
            End If

            If MeasFcnDone = age1960_PFER Then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -