Quick Start Page
Please read the following quick start guide to get started. The quick start guide leads you through the initial start up of the Bode 100 and shows how to perform a simple measurement.
For a detailed overview of the AI classes and an structured example have a look at the next section Detailed Class Description
Note
The quick start guide is written in C#
Some important information:
- The initial connection to the Bode 100 device measurement may take very long 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.
Getting Started
- Create an AI Application
- BodeAutomationInterface Class
- BodeDevice
- Measurement Categories
- Select a Measurement Example
- Bode Device Class Overview
- Measurement Mode Classes
- Transmission Measurement Modes
- Impedance Measurement Modes
- Reflection Measurement Modes
- Measurement Mode Classes Overview
- Result Class Overview
Create an AI Application
Add the AI reference to your projct (see \ref add_references "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]);
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 Gain/Phase (transfer function H(f)) using the internal reference.
After selecting the measurement we have to configure the frequency range of the measurement. Therfore 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 specifications of the device 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. The available settings and there default values can be found at \ref measurement_class "Measurement Type Classes".
//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();
if(state != ExecutionState.Ok)
{
//Error ....
bode.ShutDown(); //Shut down the Bode 100 device.
return;
}
The ExecuteMeasurement function will return the Execution State as result. After checking the state the results can be read out.
//Read out the magnitude as dB.
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.
//Shut down the Bode 100 device.
bode.ShutDown();
Detailed Class Description
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 tutorial on “How to create an AutomationInterface Application for the Bode 100”.
Note
All following programing examples are written in C#
The BodeAutomationInterface Class
- 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.
\subsection automationInterface_functions 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
- TheOmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.BodeDevice represents a device.
- Here we can check the “DeviceType” (Bode Revision 1 or 2).
- Trigger an "InternalCalibration".
- Select the "SourceMode" of the Device.
- Create a Measurement from an available Measurement Categorie.
To create a measurement one can choose out of three categories: Reflection, Impedance and Transmission.
Connect Bode 100 Example
//Create the Bode Automation Interface
BodeAutomationInterface auto = new BodeAutomation();
//Automatically search and connect to the first found Bode 100
BodeDevice bode = auto.Connect();
The Measurement Categories
Reflection | Impedance | Transmission |
---|---|---|
S11ExternalCouplerMeasurement | OnePortMeasurement | GainMeasurement |
S11OnePortMeasurement | AdapterMeasurement | S21Measurement |
- | ExternalBridgeMeasurement | - |
- | SeriesThruMeasurement | - |
- | ShuntThruMeasurement | - |
- | VoltageCurrentGainMeasurement | - |
Select a Measurement Example
//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();
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 Mode Classes
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.
Transmission Measurement Modes
- OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.Measurements.S21Measurement
- OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.Measurements.GainMeasurement
Impedance Measurement Modes
- OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.Measurements.AdapterMeasurement
- OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.Measurements.ExternalBridgeMeasurement
- OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.Measurements.OnePortMeasurement
- OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.Measurements.SeriesThruMeasurement
- OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.Measurements.ShuntThruMeasurement
- OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.Measurements.VoltageCurrentGainMeasurement
Reflection Measurement Modes
- OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.Measurements.S11ExternalCouplerMeasurement
- OmicronLab.VectorNetworkAnalysis.AutomationInterface.Interfaces.Measurements.S11OnePortMeasurement
Measurement Mode 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 unter Test Delay value for the measurement. |
MeasurementFrequencies | - | double[] | Gets the measurement frequencies configure in "ConfiugreSweep". |
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. |
Result Class Overview
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)) if not necessary 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");