W8WWV - N2PK VNA - VNAgra: API For Computing Actual Reflection Coefficients (VNAgra.dll)

Seed Solutions, Inc.


Introduction

VNAgra (va-nag-ra) is an API (application programming interface)  which provides a set of functions that deal with measured and actual reflection coefficients. Although this API was created to work with the N2PK VNA, there is nothing about it which is specific to that hardware. The primary purpose of VNAgra is to convert measured reflection coefficients into actual reflection coefficients for devices under test (DUT). The approach supported follows the so-called OSL (open, short, load) calibration method used to make reflection measurements in many VNAs (vector network analyzers).

A complete discussion of the ideas and math behind OSL calibration, and one-port error correction, is beyond the scope of this page. But, here is a quick overview.

 

The usual goal is to measure impedance - impedance as a complex number, with both resistance and reactance. Impedance can be computed from the reflection coefficient, given the complex reflection coefficient, and a system impedance, such as 50 + j 0 Ohms. Ideally, you could measure the actual reflection coefficient directly with a perfect bridge, or some implementation  that can measure the forward and reflected waves. In practice, there are no perfect implementations. An imperfect measurement device can be corrected for through the introduction of error correction terms. In the one-port calibration method, three error correction terms are used. These terms take a measured complex number, the DUT reflection coefficient, and compute an actual reflection coefficient. The three error correction terms are often called directivity, port match, and tracking in the literature.

These three error correction terms turn out to be complex numbers themselves. We need them, how do we compute them?

Thinking back to high school, if we want to solve for three unknowns, we usually need three simultaneous equations. That is the approach used in this case. Each equation relates a measured reflection coefficient to an actual reflection coefficient, through the error terms. In fact, if we come up with any three pairs of actual/measured reflection coefficients, we can use them to determine the three error correction terms, and then use those terms to derive the actual reflection coefficient for an unknown device based upon its measured reflection coefficient.

As often happens in life, if we know a few things, we can use that information to help us learn something new.

We must find three devices which have known (or actual) reflection coefficients. The simple act of measuring them will provide their measured reflection coefficients. We will then have what we need to compute the error correction terms, and then, finally, measure an unknown DUT, and compute its actual reflection coefficient.

Traditionally, these three devices consist of an open circuit, a short circuit, and a precision load resistor, with known characteristics. These standards have been chosen for several good reasons. First, opens and shorts should be fairly easy to construct. Second, they have reflection coefficients which are on opposite sides of the Smith Chart, which makes them good vantage points to evaluate data which occurs across the whole chart. The load resistor may be more difficult to obtain, and even more expensive, since we want to know its resistance with the greatest possible accuracy.

In fact, if all of the errors present in the VNA hardware could be compensated for by the three error terms, then the accuracy of the resulting measurements would be a function of the accuracy of the standards. In practice, no VNA is that perfect, but to a large degree, the quality of the resulting measurements will be a reflection of the quality of the standards, and the degree to which they are characterized.

In order to improve the quality of the standards, they may come with, or you may want to compute or measure, their parasitic properties. Like all parasites, these are properties that we wish didn't exist, but do, and are deviations from perfection. For example, in the case of an open circuit, some small capacitance will exist between the two terminals. It may be a small fraction of a picofarad, but it cannot be avoided. The connection between the precision resistor will have some very small inductance. This is a deviation from perfection. We don't need perfect opens, shorts, and loads, but rather ones that are well-characterized. There are approximately six parasitic properties across the three calibration standards. VNAgra includes a function which applies parasitic inductance, capacitance, and resistance properties to a standard, and computes a more accurate actual reflection coefficient.

I've used the term measured reflection coefficient a number of times in this section. What does it really mean? Like all reflection coefficients, it is a complex number, meaning that it has two numeric components. In the context of the N2PK VNA, a measured reflection coefficient is obtained by taking two samples from the analog to digital (ADC) converter. The only requirement is that there be a phase shift of 90 degrees in one of the oscillators between the two samples. It is a further requirement that the same shift take place across all measurements that will be related together, such as standards and DUTs. And, of course, all of this discussion applies to a single frequency.

In summary, and for a given frequency,  the three standards (usually open, short, and load) are sequentially placed on the VNA bridge, and their measured complex reflection coefficients are captured by the software. The actual reflection coefficients, and any parasitic parameters, are directly entered into the software. The software applies the parasitic parameters, improving the correctness of the actual reflection coefficients. The improved actual reflection coefficients, and their matching measured reflection coefficients are used to create a system of three equations in three unknowns. The three unknowns are the directivity, port match, and tracking error correction terms.

The unknown device is then connected to the VNA, and it's measured reflection coefficient is captured. The three error terms are then used to compute the actual reflection coefficient of the DUT. From that, we can compute a number of useful parameters, such as impedance, SWR, and return loss.

 

VNAgra is provided in a DLL (dynamic link library) form. The code has been written so as to minimize dependence upon additional packages, features or software. It is written in the C++ language, and was developed using the Microsoft Visual Studio, version 6. It should be usable with other languages, such as Visual Basic.

Highlights

Consult VNAgra.h for the complete list of available functions. Here are some highlights.

VNAgra includes utility functions to convert between rectangular and polar formats.

VNAgra is built around the C double data type. When data is conceptually complex, a pair of doubles are used.

Downloads

The VNAgra download consists several individual files. These files are individually downloaded by clicking on the file name link.

  1. VNAgra.h: The header file. Usually included into C source programs. Function declarations and manifest constants. To the extent that there is documentation for VNAgra, it is in this file.
     

  2. VNAgra.lib: Used by the linker when linking a program which uses VNAgra.dll. Not necessary if the program is willing to call LoadLibrary and GetProcAddress explicitly.
     

  3. VNAgra.dll: The definitions of the functions in VNAgra. Used when the application program is running.
     

The header file is used to compile the program. The .lib file is used to link the program. The .dll file is used during program execution.

Only the most recent version will be available for download. A version number retrieval function is included in the header file, please call it to detect changes in the files. Needless to say, consistency is a good idea between the versions of the three files.

Problems, Questions, Comments?

If you have problems, questions, or comments (concerning this software), please contact me via email, at ordy@seed-solutions.com.

License and Legal Notices

VNAgra  was developed by, and is owned by Seed Solutions, Inc. Copyright , 2004, Seed Solutions, Inc. All rights reserved. No warranty of any kind is made as to performance, or fitness of use in any application. Your use of this software is your agreement with these terms. You agree to hold Seed Solutions, Inc. free from responsibility for any damages that may or may not be associated with the installation or operation of the program.

This software may be redistributed in original form. No fee may be charged for redistribution without the prior and specific written consent of Seed Solutions. Inc. This software is licensed for personal and non-commercial use only, and is subject to the export laws and regulations as defined by the State Department of the United States of America, and other applicable regulatory agencies.

Windows, Windows 95, Windows 98, Windows NT, Windows 2000, Windows ME, Windows XP are either registered trademarks or trademarks of Microsoft Corporation. Other product and company names mentioned on this site may be the trademarks of their respective owners.

Back to my Software Contributions Page

Back to my Experimentation Page

Back to my Amateur Radio Page


Last update: Saturday, October 16, 2004 04:56:02 PM
Back to my Home Page