Quick Start Page
Note
- The quick start page is written in C#. To learn how to access the automation interface from other languages, please refer to Add AI Reference.
- 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 Analyzer Suite” installer available for download at www.omicron-lab.com
- The initial connection to the Bode 100 device may take around one minute because of the internal device calibration. The internal device calibration is performed when a Bode 100 is connected the first time on a PC.
- Always ShutDown() the Bode 100 device after you have completed your measurements.
- For Programming Languages which need enumerations as int, string, decimal or other format have a look at the OmicronLab.VectorNetworkAnalysis.AutomationInterface.Enumerations.
Automation Interface Overview
The AutomationInterface (AI) basically consists of 4 parts.
We will first explain these four parts in detail and then start with a step by step example on “How to create an AutomationInterface Application for the Bode 100”.
BodeAutomationInterface
- The OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.BodeAutomationInterface class acts as the entry point for the application.
- With this class it is possible to search and connect to devices.
- The two events “DeviceAdded” and “DeviceRemoved” can be used to track whenever a Bode 100 is connected or disconnected to the computer.
BodeAutomationInterface Class Overview
Property / Method / Event | Parameters | Return Type | Description |
---|---|---|---|
Version | - | String | Version number as text |
Connect | None | BodeDevice | Connects to the first found Bode 100 device. |
ConnectWithSerialNumber | 1: [String] | SerialNumber | Connects to the Bode 100 device with the given serial number. |
ScanForAttachedDevices | None | String[] | Returns the serial numbers of all attached Bode 100 devices. |
ScanForFreeDevices | None | String[] | Returns the serial numbers of all free Bode 100 devices. |
SetLogToFile | 1: [String] log file path 2: [LogLevel] the log level | None | Sets up a file logger. |
SetLogToUdpStream | 1: [int] streaming port 2: [LogLevel] the log level | None | Sets up a stream logger. |
Dispose | - | - | Allows to free unneeded resources |
DeviceAdded | - | - | Triggers an event when a new Device is connected to the PC |
DeviceRemoved | - | - | Triggers an event when a connected device is removed from the PC |
InternalCalibrationUpdate | 1: [double] progress | - | Triggers an event during the internal device calibration |
BodeDevice
The OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.BodeDevice represents a bode device. Here we can:
- Check the “DeviceType” (Bode 100 Revision 1 or 2).
- Trigger an "InternalCalibration".
- Select the "SourceMode" of the Device.
- Create a Measurement from an available Measurement Category.
To create a measurement one can choose out of three categories: Reflection, Impedance and Transmission.
Connecting to a bode device is not a big deal:
//Create the Bode Automation Interface
BodeAutomationInterface auto = new BodeAutomation();
//Automatically search and connect to the first found Bode 100
BodeDevice bode = auto.Connect();
BodeDevice Class Overview
Property / Method / Event | Parameters | Return Type | Description |
---|---|---|---|
DeviceType | - | String | Returns the DeviceType (Rev. 1 or Rev. 2) |
SerialNumber | - | String | Returns the serial number of the device |
InternalCalibration | - | InternalCalibration | Gets the internal calibration class. |
Reflection | - | Reflection | Gets the factory to create Reflection measurements. |
Impedance | - | Impedance | Gets the factory to create Impedance measurements. |
Transmission | - | Transmission | Gets the factory to create Transmission measurements. |
SourceMode | - | SourceMode | Select the SourceMode of the Device: AutoOff, AlwaysOn |
ShutDown | None | None | Shuts down the Device. This function is mandatory before ending the program. |
Measurement
Bode is supporting different Measurement Modes which can be divided into three different Measurement Categories.
Measurement Categories
Reflection | Impedance | Transmission |
---|---|---|
S11ExternalCouplerMeasurement | OnePortMeasurement | GainMeasurement |
S11OnePortMeasurement | AdapterMeasurement | S21Measurement |
- | ExternalBridgeMeasurement | - |
- | SeriesThruMeasurement | - |
- | ShuntThruMeasurement | - |
- | VoltageCurrentGainMeasurement | - |
There are slightly different settings available for every measurement mode. For the standard measurement settings have a look at Measurement Modes.
Note
The only mandatory setting is to configure the frequency range and the measurement points.
Measurement Classes Overview
In this section all possible Properties, Methods and Events from a measurement are listed. Have a look at the class description to see which of these are actually visible in the measurement mode of interest.
Property / Method / Event | Parameters | Return Type | Description |
---|---|---|---|
Attenuation | - | Attenuation | With this property the Attenuation Value for Channel1 and Channel2 can be changed. |
Calibration | - | GainCalibration ImpedanceCalibration |
Execute and Save/Load the Calibration. |
DutDelay | - | - | Gets or sets the Device under Test Delay value for the measurement. |
MeasurementFrequencies | - | double[] | Gets the measurement frequencies configure in "ConfigureSweep". |
NumberOfpoints | - | int | Gets the number of configured measurement points. |
ReveiverBandwidth | - | ReceiverBandwidth | Gets the configured max. receiver bandwidth. |
Results | - | ImpedanceResult GainResults |
Gets the Result object depending on the configured measurement mode. |
Shaping | - | Shaping | Gets shape object. There all shape configuration can be done. |
PortExtension | - | PortExtension | Gets port-extension object. There all port-extension related configurations can be done. |
StartFrequency | - | double | Gets the configured start frequency. |
StopFrequency | - | double | Gets the configured stop frequency. |
SweepMode | - | SweepMode | Gets the configured sweep mode. |
TerminationChannel1 | - | Termination | Gets or sets the Termination for Channel1. |
TerminationChannel2 | - | Termination | Gets or sets the Termination for Channel2. |
NominalImpedanceZ0 | - | - | Gets or sets the nominal impedance Z0. |
CalculateMeasurementTime | None | double | Precalculates the measurement time of a measurement. Note that this is just an approximation. |
ConfigureCustomSweep | 1: double[] frequencies | - | Configure a sweep measurement with custom frequencies. |
ConfigureSinglePoint | 1: double frequency | - | Configure a single point measurement. |
ConfigureSweep | 1: double StartFrequency 2: double StopFrequency 3: int NumberOfPoints 4: SweepMode |
- | Configure a sweep measurement with start and stop frequency, numberOfPoints and sweep mode. The frequencies will be calculated by these values. |
ExecuteMeasurement | None | ExecutionState | Executes the measurement, returns the state of the execution. |
GetSourceLevel | 1: LevelUnit | double | Return the source level depending ob the given unit. |
SetSourceLevel | - | double LevelUnit |
Sets the source leven depending on the unit. |
StopCurrentExecution | - | - | Stops the current execution. |
NewResultAvailable | 1: int result index | - | This event will be triggered everytime a new result is available. As parameter the actual measured frequency index is delivered. |
Averaging | - | Averaging | With this property the settings for the Averaging calculation can be changed. |
The following code snippet shows how a measurement can be created:
//Create a S21 Measurement
S21Measurement s21Measurement = bode.Transmission.CreateS21Measurement();
//Create a OnePort Measurement
OnePortMesurement onePortMeasurement = bode.Impedance.CreateOnePortMeasurement();
//Create a S11OnePort Measurement
S11OnePortMesurement measurement = bode.Reflection.CreateS11OnePortMeasurement();
Result
After creating and configuring a measurement the measurement needs to be executed to obtain measurement results:
//Execute the measurement
ExecutionState state = s21Measurement.ExecuteMeasurement();
There are three different result classes avaiable depending on the selected measurement mode.
- Transmission Measurements will return a GainResult.
- Impedance Measurements will return an ImpedanceResult.
- Reflection Measurements will return a ReflectionResult.
Every measurement allows access to the measured results by reading the Results property. Results will normally be read after the execution has been completed. Additionally it is possible to get results during a running measurement
by attaching to the NewResultAvailable(int index) event.
All result types allow access to the whole result array (e.g. Results.Magnitude) or index based by using the "At" variant (e.g. Results.MagnitudeAt). The relation between index and frequency can be
obtained easily by reading Results.MeasurementFrequency
respectively Results.MeasurementFrequencyAt at the specific index.
Note
- Do NOT use the functions which are returning the whole array DURING a measurement (e.g measurement.result.Magnitude(MagnitudeUnit unit)) because they are very slow.
- Do NOT read QTg and Tg results during the sweep since they are calculated using next neighbour difference.
- For accessing QTg or Tg in combination with NewResultAvailable(int index) please have a look at the Best Practice example.
- It is possible to convert impedance results and reflection results into each other and additionaly into admittance results using the ImpedanceResult.AsAdmittance respectively the ReflectionResult.AsAdmittance property.
For more information about the Result Classes have a look at: Results
Reading Measurement Results Example:
//Read out the magnitude in dB.
double[] magnitudes = s21Measurement.Results.Magnitude(MagnitudeUnit.dB);
//Read out the measurement frequencies.
double[] measurementFrequencies = s21Measurement.Results.MeasurementFrequencies;
Console.WriteLine($"First frequency = {measurementFrequencies[0]}Hz");
Step by step example to perform a simple measurement
First of all you need to add an AI reference to your projct (see Add AI Reference).
The starting point of an AI application is the BodeAutomationInterface class. After initializing the BodeAutomationInterface it is possible to search free or occupied devices and connect to them.
//Create and initialize a bodeAutomationInterface object.
BodeAutomationInterface automationInterface = new BodeAutomation();
Searching for free devices is done with the “ScanForFreeDevices()” function. If you want to find all devices attached to the PC no matter if it is busy in another measurement use the “ScanForAttachedDevices()” function.
To connect with a Bode 100 device we use the “ConnectWithSerialNumber(string SerialNumber)” function which will connect to the device with the given serial number.
It is also possible to let the AI automatically search and connect to the first found device. This is done by using the “Connect()” function.
Note
It is not possible to influence the ordering of the found devices, since this is related to the device drivers.
//Find all free devices connected to the PC.
string[] devices = automationInterface.ScanForFreeDevices();
//Connect to the second device found.
BodeDevice bode = automationInterface.ConnectWithSerialNumber(devices[0]);
Note
Do not execute the above code directly in the GUI-Thread. 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.
When the connection is successful we can select a measurement. Like mentioned in The Measurement Categories there are three categories. In this example we will create an S21Measurement from the category Transmission.
//Create a S21 Measurement
S21Measurement s21Measurement = bode.Transmission.CreateS21Measurement();
The selected Transmission measurement measures S21 using the internal reference.
After selecting the measurement we have to configure the frequency range of the measurement. Therefore we have to define the Start Frequency, Stop Frequency, Number of Points to measure and the scale of the frequency points (Linear or Logarithmic). The parameter restrictions can be found at Definitions.
//Configure Frequency Points, StartFrequency 1kHz, StopFrequency 22MHz, 201 Points, Logarithmic scale
s21Measurement.ConfigureSweep(1000, 22000000, 201, SweepMode.Logarithmic);
The next step is defining all necessary measurement settings.
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.
//Set the source level of the output to 0dBm
s21Measurement.SetSourceLevel(0, LevelUnit.dBm);
//Set the maximum receiver bandwidth to 1kHz
s21Measurement.ReceiverBandwidth = ReceiverBandwidth.kHz1;
//Set the Attenuation level of Channel one and two to 10dB
s21Measurement.Attenuation.Channel1 = Attenuator.dB10;
s21Measurement.Attenuation.Channel2 = Attenuator.dB10;
//Set the Termination impedance of Channel 2 to 50Ohm
s21Measurement.TerminationChannel2 = Termination.Ohm50;
Once the measurement is properly configured it can be executed.
//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;
}
The ExecuteMeasurement function will return the Execution State as result. After checking the state the results can be read out.
//Read out the frequencies and measured magnitude values in dB
double[] frequencies = s21Measurement.Results.MeasurementFrequencies;
double[] magnitudes = s21Measurement.Results.Magnitude(MagnitudeUnit.dB);
More information about the result class can be found here: Result Types
It is mandatory to shut down the device if it is not longer required.
//Disconnect Bode 100 device to release it for future connection
device.ShutDown();