Import Data and Analysis Example Program

This Visual Basic program does the following:

 

Public Function Example_LoadDataAnalysis() As Boolean

        'create PLTS application

        Dim app = New PLTS.CPLTSApplication()

        System.Threading.Thread.Sleep(1000) 'grace time for PLTS startup

        app.ShowWindow(3)

        'load a data and open an analysisview

        Dim dataFilePath As String = "C:\[DEMO] E8364B 12-port 10MHz-20GHz.s12p"

        Dim templateViewName As String = "USB3.0 Connector (12p)" 'case sensitive

        Dim docObj As Object = Nothing

        Dim viewObj As Object = Nothing

        app.ImportData(dataFilePath, templateViewName, docObj, viewObj)

        'look into each plot

        Dim view As PLTS.IPLTSView = viewObj

        Dim plotsCnt As Short = 0

        view.GetNumberOfPlots(plotsCnt)

        For i As Short = 0 To plotsCnt

            'export each plot to a picture file

            Dim outputPicFilePath As String = "C:\plot" & i & ".jpg"

            view.ExportPlot(i, outputPicFilePath, 800, 600)

            'get plot title

            Dim title As String = ""

            view.GetPlotTitle(i, title)

            Console.WriteLine(title)

            'get pass/fail status

            Dim pass As Boolean = True

            Dim passFailDetails As String = ""

            view.GetPlotPassFail(i, pass, passFailDetails)

            Console.WriteLine(passFailDetails)

            'get plot measurement

            Dim measDetails As String = ""

            view.GetPlotMeasurements(i, measDetails)

            'get x-axis values

            Dim xdatObj As Object = Nothing

            Dim xunit As String = ""

            view.GetPlotTraceXData(i, xdatObj, xunit)

            Dim xdat As Double() = xdatObj

            If xdat Is Nothing Then

                Continue For

            End If

            Console.WriteLine("x data length: " & xdat.Length)

            'get traces

            Dim tracesCnt As Short = 0

            view.GetPlotNumberOfTraces(i, tracesCnt)

            For j As Short = 0 To tracesCnt

                'get trace name

                Dim trName As String = ""

                view.GetPlotTraceName(i, j, trName)

                'get y-axis data

                Dim ydatObj As Object = Nothing

                Dim yunit As String = ""

                view.GetPlotTraceYData(i, j, ydatObj, yunit)

                Dim trDat As Double() = ydatObj

                If trDat Is Nothing Then

                    Continue For

                End If

                Console.WriteLine("trace " & j & " data length: " & trDat.Length)

            Next j

        Next i

        'exit

        app.CloseAllFiles()

        app.Exit()

        Return True

    End Function