Bode 100 - Quick Start Guide
Using the Bode Automation Interface with C#
Written for Automation Interface version 3.12 or newer.
1. Add the Automation Interface Reference
To add the Automation Interface Reference to Visual Studio 2010 or higher follow these steps:
Install the OmicronLab.VectorNetworkAnalysis.AutomationInterface NuGet package with the following command in the Package Manager Console
PM> Install-Package OmicronLab.VectorNetworkAnalysis.AutomationInterface
Note
You need to have the correct USB driver installed on your system. The simplest way to install the USB driver is to run our “Bode Automation Interface” installer available for download at OmicronLab
2. Set up a Bode 100 connection
//Create new BodeAutomationInterface
BodeAutomationInterface bodeAutomationInterface = new BodeAutomation();
//Search for connected devices
String[] devices = bodeAutomationInterface.ScanForFreeDevices();
//Connect to the first found device
BodeDevice device = bodeAutomationInterface.ConnectWithSerialNumber(devices[0]);
Note
Do not execute the above code directly in the GUI-Thread (deadlock)! The connection can take up to 1.5 minutes when connecting to a Bode 100 at the very first time. Bode 100 will then execute the internal device calibration during the first connection.
3. Configure a measurement
Next you need to configure a measurement. In this example, we will configure a S21 Measurement where we sweep linearly from 1 kHz to 10 MHz using 201 measurement points. The source output level is configured to 0 dBm.
Note
Every measurement configures some default values. e.g: Termination Resistance, Attenuation etc. For the exact values and more information, have a look at the Measurement Modes.
//Create a S21 Measurement
S21Measurement s21Measurement = device.Transmission.CreateS21Measurement();
//Configures a sweep measurement
s21Measurement.ConfigureSweep(1000, 10000000, 201, SweepMode.Linear);
//set source level
s21Measurement.SetSourceLevel(0, LevelUnit.dBm);
4. Execute the measurement and get results
//Execute the measurement
ExecutionState state = s21Measurement.ExecuteMeasurement();
//Check if execution state is correct.
if (state != ExecutionState.Ok)
{
//An error happened
// If the measurement is aborted here don’t forget to shutdown the Bode
device.Shutdown();
//...
return;
}
//Read out the frequencies and measured magnitude values in dB
double[] frequencies = s21Measurement.Results.MeasurementFrequencies;
double[] magnitudes = s21Measurement.Results.Magnitude(MagnitudeUnit.dB);
//Disconnect Bode 100 device to release it for future connection
device.ShutDown();