Agilent Technologies 86038A User Manual page 181

Optical dispersion analyzer
Table of Contents

Advertisement

Example 1: Simple Application for Controlling the ODA
Agilent 86038A Optical Dispersion Analyzer, Third Edition
// Transfer the gain data over from the ODA and save it to a
file
double[] gainData;
double
xStart;
double
xStop;
double
xStep;
int
npoin;
string
buf;
int
cnt;
double
x;
// Get the gain data from port one
gainData = odaClient.Results.YData(ODACommon.eMeasurement-
Type.Gain, ODACommon.eODAPort.One);
npoin=gainData.Length;
// Get the start and stop wavelengths
xStart = odaClient.Results.XStart(ODACommon.eMeasurement-
Type.Gain);
xStop = odaClient.Results.XStop(ODACommon.eMeasurement-
Type.Gain);
xStep = (xStop - xStart)/ (npoin - 1);
// Open the file
StreamWriter file = new StreamWriter(fileName, false);
file.WriteLine("Sample ODA File");
file.WriteLine("Wavelength (nm), Gain (dB)");
// Write the data
for (cnt=0;cnt<npoin;++cnt)
{
x = xStart + cnt * xStep;
buf = x.ToString() + ", " + gainData[cnt].ToString();
file.WriteLine(buf);
}
// Close the file
file.Close();
}
private void Form1_Closing(object sender, System.Component-
Model.CancelEventArgs e)
{
// Release the ODA
odaClient.Connectivity.Disconnect();
// Unregister our status handler
odaClient.NewStatus - = this.NewStatusHandler;
odaClient.TriggerProgress - = this.TriggerHandler;
// Shut down the object
odaClient.Connectivity.TerminateSession();
}
private void pbConnect_Click(object sender, System.EventArgs e)
{
// Instantiate the odaClient
odaClient = new RemoteClient.Communicator();
// Connect to the ODA
odaClient.Connectivity.Connect(tbOdaName.Text);
// Create our event handlers
this.NewStatusHandler = new ODARemoting.NewStatusDele-
gate(this.NewStatusEvent);
this.TriggerHandler = new ODARemoting.TriggerProgressDele-
gate(this.TriggerProgressEvent);
// Register event handlers
Remote Operation
181

Advertisement

Table of Contents
loading

Table of Contents