Sunday, August 12, 2018

Additional Notes on Measuring Antenna Tuner Power Loss

This post updates the technique I have used for measuring antenna tuner power loss.  As such, it supersedes the techniques I described a few years ago in this blog post:

This current method of measuring tuner power loss is, at its essence, based upon the fifth technique (Technique 5) described in this earlier blog post (above).  But I have simplified its calculations to focus on "Operating Power Gain" (Gp) (although I do also calculate "Transducer Gain" (Gt), but this is primarily for comparison purposes).

Operating Power Gain, Gp:

Gp is simply the ratio of the power delivered to a network's load divided by the power delivered to the network (which in this case is a two-port network).  Any difference in these two powers must be due to power lost within the network.

Gp can be calculated using a network's 2-port S-parameters (S11, S12, S21, S22) and its load's gamma using the following equations:

(Derivation of Gp can be found here: UC Berkeley Notes)

Transducer Gain, Gt:

Gt is slightly different from Gp in that it is the ratio of the power delivered to a network's load divided by the power available from the generator.

Note that the Gt formula now includes terms representing the source's gamma.  So Gt is also a function of the match between the source's impedance and the network's input impedance.  Thus, if the source is not matched to the network's input impedance (i.e. not conjugately-matched), not all of the power that is available from the generator will be delivered to the network.

So, for the purposes of calculating Antenna Tuner loss, Gt can be thought of as comprising two sources of power loss.  The first source of loss being the loss within the network (i.e. the loss calculated with Gp), and the second loss being a loss due to the mismatch between source and network-input impedances (i.e. the loss due to a non-conjugate match between source and network-input impedances).

For antenna tuners adjusted for low SWR's (measured at the network's input port), Gt and Gp should be (essentially) identical.  But as SWR increases, Gt loss will increase compared to Gp loss because of the the Gt loss's increasing source-to-network mismatch loss.  Thus, Gt is not nearly as useful for determining Tuner power loss because it includes this additional "external to the tuner" loss.

(Derivation of Gt can be found here: UC Berkeley Notes)

Determining Gp:

From the formulas above, to calculate Gp we need to measure a tuner's two-port S-parameters (S11, S21, S12, S22) when the tuner has been tuned to match (as best it can) a load, and we should also have the load's gamma (calculated from its own S11 parameters).

S-parameters are ideally measured with a Vector Network Analyzer (VNA), and the resulting data can then be used to calculate Gp.  Although this calculation can be performed by hand, MATLAB software provides a convenient way to both capture the S-parameter data from the VNA (via MATLAB's "Instrument Control Box") and to perform the Gp calculation (via MATLAB's powergain() function in its RF Toolbox).  Note that a single MATLAB statement will calculate Gp:

Gp = powergain(s_params,z0,zl,'Gp')

What could be simpler?

S-parameter Capture and Gp Calculation Using MATLAB:

The rest of this blog post describes how I measure Tuner power loss using my VNA and MATLAB.

I use the following equipment and software:
1. An HP 8753C Vector Network Analyzer (VNA) and an HP 85046A S-Parameter Test Set.
2. An Agilent 82357B USB/GPIB Interface Module, to interface a computer to the VNA.
3. A recent version of MATLAB, with the following toolboxes:  1) RF Toolbox, 2) Instrument Control Toolbox.
(A note regarding MATLAB:  their "Home" version is, in my opinion, a great value, and it is this version that I personally use.)

Previously I have measured Tuner Loss with the tuner terminated (and tuned for) either a 5 ohm (resistive) or 500 ohm (resistive) load (when measuring loss in the Elecraft KAT-500 and also in my own tuner design).  Both of these loads represent an SWR of 10:1.  But other loads could be used, too.

As an example, I will go through the steps of measuring the loss within a Drake MN-4 "Matching Network" when it has been terminated with a 5 ohm load and tuned to a 1:1 SWR at 29 MHz.

(Note that the Drake MN-4 is only spec'd to tune loads with a maximum SWR of 5:1.  So a 5 ohm load is well outside its specified load range!  Never the less, the tuner will match 5 ohms to 50 ohms on 29 MHz, and this is a load I have at hand, so I will use it as an example for measuring Tuner Loss).

Procedure to Calculate Tuner Loss:

Step 1.  Measure the Load's S11 characteristics:

Strictly speaking, if the impedance of the Test Load is known (e.g. 5 ohms), this step can be skipped and the Test Load's impedance can simply be inserted into the "zl" field of MATLAB's powergain function: powergain(s_params,z0,zl,'Gp').

But I prefer to use the VNA to measure the load's actual S11 characteristics for the frequency range of interest.  Below is my 5 ohm Test Load attached to Port 1 of the S-Parameter Test Set:

(Note that the 5-ohm load consists of two 10 ohm 1% resistors connected in parallel across the back of a female SMA connector).

The frequency range will be 28 to 30 MHz (because, from previous experiments, I know that the MN-4 can match a 5-ohm load at 29 MHz).

After setting up the VNA for the appropriate frequency range and performing a full two-port calibration using the cables I will use to connect to the Tuner's ports (do not skip this step!), I use a MATLAB routine (vna_s11.m) written by Dick Benson, W1QG, to capture the load's S11 data:

Step 2:  Store this S11 Data in S1P File Format:

This same routine is then used to store the captured S11 data in S1P file format.

In this example, I have named the file: 180810_8753C_S11_5ohm_Load_28-30MHz.s1p .

Step 3:  Attach the Test-Load to Tuner and Adjust for the Tuner for Minimum SWR:

Now I need to tune the Tuner to match the 5 ohm Test Load.  To do this, I first:
• Attach the 5-ohm load to the Tuner's "Antenna" port.
• Attach Port 1 of the S-Parameter Test Set to the Tuner's "Transmitter" port.
With the VNA still in S11 mode, I then tune the Tuner for minimum SWR at the frequency of interest (e.g. 29.0 MHz).

Step 4:  Measure S11 with the Tuned Tuner and Load:

This next step is optional (because it is not needed for calculating Gp).  I do it to validate my measurements, as I will show, later.

With the Tuner tuned for minimum SWR, I then make another S11 capture using the VNA and the vna_s11.m MATLAB routine.

The results are stored in a new file, again in S1P format.

In this example, the file is: 180810_8753C_S11_MN-4_5ohm_load_28-30MHz.s1p

Step 5:  Remove the Test-Load and Measure the Tuner's S11, S12, S21, and S22 characteristics:

Without touching the Tuner's settings (!!!), I remove the 5-ohm Test Load from the Tuner's "Antenna Port" and connect this port instead to Port 2 of the S-Parameter Test Set, as shown below (The tuner's Transmitter port is on the left, and its Antenna port is on the right):

Using the VNA, I capture S11, S12, S21, and S22 with a different MATLAB routine written by Dick Benson, W1QG to perform two-port S-Parameter capture (vna_gui_1.m):

Step 6: Store this Data in S2P File Format:

Via this same program (vna_gui_1.m), I then store this data in S2P file format.

In this example, the file is: 180810_8753C_ s2p_MN-4_tuned_for_5_ohms_28-30MHz.s2p.

Step 7:  Calculate the "Operating Power Gain" (Gp):

To calculate Gp (and thus Tuner Power Loss)) I will use the following S-parameter files that I have created (above):

• The Tuner's S2P file: 180810_8753C_ s2p_MN-4_tuned_for_5_ohms_28-30MHz.s2p
The result will be the Tuner's power loss when it has been adjusted to match a 5 ohm load at 29 MHz.

To perform this calculation I use the MATLAB script below (Plotting_Network_Gp_from_S2P.m).
Note:  I usually only write MATLAB routines once or twice a year, and in between each session I typically forget what I had learned previously (the hazards of age!).  Please forgive any awkward MATLAB code that might offend the more experienced programmer!
```% Plotting_Network_Gp_from_S2P.m
%
% Predicting Network Loss with MATLAB
% Date:  180811
%
% By Jeff Anderson, K6JCA,
% from code originally written by Dick Benson, W1QG.

clc;
clearvars;
close all;

path=[pwd,'\'];
dir;

% Note: objects must have the SAME number of points (e.g.
% 201 or 401)
% HP 8753C generates S2P files with 201 points, while the
% HP 3577A generates S1P and S2P files with 401 points.

% Get the Load-only S1P file.  This is simply the S11 data
% of the load, itself.

% Get Network-only S2P file -- this is S11, S12, S21, S22
% of the network "tuned" to an SWR of 1:1 when the load
% in the S1P file (above) was attached, but captured via
% the VNA *without* the load attached.
s= '180810_8753C_ s2p_MN-4_tuned_for_5_ohms_28-30MHz.s2p';
[Network_Obj,Network_Notes,Network_State]...

% As an optional check, get the S1P file of the Network
% with Load attached. This will then be compared to the
% gamma data generated from the Network-only S2P file (above)
% and the Load-only S1P file (also above).
%
% In other words, this is the S11 data for the network
% tuned to an SWR of 1:1 WITH the load still attached.
[System_Obj,System_Notes,System_State]...

Zo = Network_Obj.Z0;  % 50 ohms for all s-parameter files.
FreqMHz= Network_Obj.Freq*1e-6; % Freq Vector.

% Convert the load's S11 data to Impedance (Z):

% Calculate the Gamma at the network's input from the
% network's S2P file data (with network tuned for
% appropriate load) and that load's impedance
% (also known as Z_Load).

% And for the Gt calculation, set Zs to equal Zo.
%   Note that if Zs is set to equal the
%   complex conjugate of the impedance seen at the
%   tuner's input port, then Gt, when
%   calculated, will equal Gp.
%   To see this, set Zs to be:
%   Zs = conj(gamma2z(gamma));
%   instead of the next statement:
Zs = Zo;      % So Zs now equals 50 ohms.

% Calculating the power gains...
%
% Note that Gp has no dependence on the source impedance
% (Zs).
% It only depends on the Networks' S-Parameters (which
% are Zo referenced) and the Load impedance.
%
% Gt is also calculated, but as SWR diverges from 1:1,
% Gt will worsen (because it also depends upon the
% source impedance's match to the Tuner's input Z).
% Gp is thus the preferred value to use because of its
% independence from the source impedance.
GpSystem = powergain(Network_Obj.S_Parameters,...
GtSystem = powergain(Network_Obj.S_Parameters,...

% Calculate the SWR from the measured S11 data of the
% Network with Load attached.
SWR_System = vswr( squeeze(System_Obj.S_Parameters));

% Plots:

% Figure 1:
% Plot Gp and Gt losses
%
figure;
x0=150;
y0=80;
width=600;
height=500;
set(gcf,'units','points','position',...
[x0,y0,width,height]);

h_lines= plot(FreqMHz,10*log10(abs(GpSystem)),...
FreqMHz,10*log10(abs(GtSystem)));
set(h_lines(1),'Linewidth',2);
set(h_lines(2),'Linewidth',2,'Linestyle',':');
xlabel('Freq in MHz');
ylabel('Loss in dB');
legend('Gp Loss','Gt Loss','Location','east');
grid on
grid minor
ax = gca;
ax.GridAlpha = 0.4;  % Make grid less transparent.
ax.GridColor = [0,0,0]; %
ax.MinorGridAlpha = 0.5;  % Make grid less transparent.
ax.MinorGridColor = [0,0,0]; %
title(['Power Loss, Drake MN-4 Matching Network',...
' Tuned for a 5 ohm Load']);

% Figure 2:
% Plot Smith Chart and compare the measured gamma
% (from S11 measured at the network's input with the
% load attached) versus the gamma derived from the
% Network-only S2P file and the Load-only S1P file.
%
figure;
x0=250;
y0=150;
width=600;
height=500;
set(gcf,'units','points','position',...
[x0,y0,width,height]);

hsm1 = smithchart(squeeze(System_Obj.S_Parameters));
set(hsm1,'Linewidth',2);
hold;

hsm2 = smithchart(gamma);  %
set(hsm2,'Linewidth',2,'Linestyle',':');

legend('Measured gamma',...
'Calculated gamma');
legend('Location','southwestoutside');
%legend('boxoff');
%title('180602');
tx=text(-1.8,1.1,['Drake MN-4 Matching Network,',char(10),...
'           5 ohm Load,',char(10),...
'            28-29.7 MHz']);
tx.FontSize = 16;
tx.FontWeight = 'bold';
```
`Published with MATLAB® R2017a`
Note that this code has file names and other descriptors specific to the measurement of the Drake MN-4 Tuner when terminated with a 5 ohm load and measured at 29 MHz.

To use for other networks, loads, or frequencies, the following changes should be made:
• Change the three file names (one S2P file and two S1P files).
• Change the Title of Figure 1 (Gp and Gt losses),
• Change the Text of Figure 2 (Smith Chart)

Below are the resultant plots:

First, the Power Loss plot:

Note that Gp has been converted to dB in the plot, above.  Gp(dB) equals 10*log10(Gp).

And in the plot, note that Gp(dB) is -0.7291 dB at about 29 MHz.  This represents a power loss of 15.5%, calculated using this formula:

Power Loss (percent) = 100 * ( 1 - 10^(Gp(dB)/10) )

(Note, too, that Gp(dB) must be negative when calculating a loss with this formula).

If one only wants to express Power Loss in percent, rather than in dB, the calculated MATLAB Gp value can be easily converted to percent using the following formula:

Power Loss (percent) = 100 * ( 1 - Gp )

Gt is also plotted, but it is not as useful for determining Tuner loss because Gt doesn't just represent Tuner loss, it also includes power loss due to any mismatch between the source's impedance and the tuner's input impedance.  So if the SWR, after tuning the Tuner, is low (i.e. the tuner's input appears to be Zo (typically 50 ohms)), then Gt will essentially equal Gp.  But as SWR increases, Gt will diverge from Gp and thus Gp will no longer accurately reflect only Tuner loss.

As an aside, note that if the source impedance, Zs, in the Gt calculation is defined to be the complex-conjugate of the tuner's input impedance when the tuner is terminated with the Test-load, then Gt will equal Gp.  You can see this using the MATLAB code, above, by changing the definition of Zs from "Zs = Zo" (i.e. Zs = 50 ohms) to:

Zs = conj(gamma2z(gamma))

where "gamma" is calculated earlier in the code and represents the gamma of the Tuner's input when the Tuner is tuned to minimize SWR with the Test-load attached to the Tuner's Antenna port.

As an additional (and optional) verification step (per Step 4, above), I also compare the measured gamma versus the gamma predicted from the independently captured Network S2P and Load S1P files...

You can see that the two curves are quite close, as they should be.

One final note:  as I mentioned above, this 5 ohm load is well outside the MN-4's range of spec'd loads (it is spec'd for loads having up to a 5:1 SWR).  Please do not take this example of a 15.5% loss to represent what MN-4 loss would be with less extreme loads.

(Update!  Actually, measured MN-4 loss is fairly constant despite load impedance (even with 50 ohm loads).  More details on this observation can be found here:

MATLAB Scripts for Plotting VNA Data:

Dick Benson's MATLAB scripts for capturing VNA data (e.g. from an HP 8753x) and displaying it (that I use above) can be downloaded from his page in the MathWorks file exchange section:  Dick Benson MATLAB files

Antenna Tuner Blog Posts:

A quick tutorial on Smith Chart basics:
http://k6jca.blogspot.com/2015/03/a-brief-tutorial-on-smith-charts.html

The L-network:
http://k6jca.blogspot.com/2015/03/notes-on-antenna-tuners-l-network-and.html

A correction to the usual L-network design constraints:
http://k6jca.blogspot.com/2015/04/revisiting-l-network-equations-and.html

Calculating L-Network values when the components are lossy:
http://k6jca.blogspot.com/2018/09/l-networks-new-equations-for-better.html

A look at highpass T-Networks:
http://k6jca.blogspot.com/2015/04/notes-on-antenna-tuners-t-network-part-1.html

More on the W8ZR EZ-Tuner:
http://k6jca.blogspot.com/2015/05/notes-on-antenna-tuners-more-on-w8zr-ez.html  (Note that this tuner is also discussed in the highpass T-Network post).

The Elecraft KAT-500:
http://k6jca.blogspot.com/2015/05/notes-on-antenna-tuners-elecraft-kat500.html

The Nye Viking MB-V-A tuner and the Rohde Coupler:
http://k6jca.blogspot.com/2015/05/notes-on-antenna-tuners-nye-viking-mb-v.html

The Drake MN-4 Tuner:
http://k6jca.blogspot.com/2018/08/notes-on-antenna-tuners-drake-mn-4.html

Measuring a Tuner's "Match-Space":

Standard Caveat:

As always, I might have made a mistake in my equations, assumptions, drawings, or interpretations.  If you see anything you believe to be in error or if anything is confusing, please feel free to contact me or comment below.

And so I should add -- this information is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.