Agilent Technologies 86038A User Manual page 168

Optical dispersion analyzer
Table of Contents

Advertisement

Remote Operation
168
Fill out the function so it looks like:
' Only do something if this is a measurement
If eTriggerMode = Agilent.LWD.Ag86038x.InstrumentObjects.ODACom-
mon.enumAcquisitionMode.eMeasurement Then
' Only do something if the measurement is complete
If progress = Agilent.LWD.Ag86038x.InstrumentObjects.ODACom-
mon.enumStatus.COMPLETE Then
' Write the data to disk
sendDataToFile("c:\mydata.txt")
End If
End If
6 Add the sendDataToFile function. This is a very simple implementation using
text streams. Insert this function immediately after
odaClient_TriggerProgress:
Private Sub sendDataToFile(ByVal fileName As String)
Dim gainData() As Double
Dim xStart As Double
Dim xStop As Double
Dim xStep As Double
Dim npoin As Integer
Dim cnt As Integer
Dim idx As Integer
Dim buf As String
' Get the data and figure out the wavelength axis
gainData = odaClient.Results.YData _
(Agilent.LWD.Ag86038x.InstrumentObjects.ODACommon.eMeasurement-
Type.Gain, _
Agilent.LWD.Ag86038x.InstrumentObjects.ODACommon.eODAPort.One)
npoin = UBound(gainData) - LBound(gainData)
xStart = odaClient.Results.XStart _
(Agilent.LWD.Ag86038x.InstrumentObjects.ODACommon.eMeasurement-
Type.Gain)
xStop = odaClient.Results.XStop _
(Agilent.LWD.Ag86038x.InstrumentObjects.ODACommon.eMeasurement-
Type.Gain)
xStep = (xStop - xStart) / (npoin - 1)
' Open the file and write the data
Dim file As System.IO.StreamWriter
file = New System.IO.StreamWriter(fileName)
file.WriteLine _
("Sample ODA File, written from Visual Basic.net")
file.WriteLine("Wavelength (nm), Gain (dB)")
idx = 0
For cnt = LBound(gainData) To UBound(gainData)
buf = CStr(xStart + xStep * idx) + "," + CStr(gainData(cnt))
file.WriteLine(buf)
idx = idx + 1
Next
file.Close()
End Sub
7 Run the software, connect and take a sweep. Then look for c:\mydata.txt.
You can look at it with a text editor or import it into a spreadsheet.
This program will grab data even if a sweep is triggered from the front panel. Run
the software, and then connect. Go to the ODA front panel and click Local, then
Example 1: Simple Application for Controlling the ODA
Agilent 86038A Optical Dispersion Analyzer, Third Edition

Advertisement

Table of Contents
loading

Table of Contents