Sunday, July 31, 2022

500 Watt Antenna Tuner Part 3 - Simulator

The simulator has three functions:

  1. Calculate the exact inductor and capacitor values for the matching network using the analytical model.  It also calculates the maximum values of inductors and capacitors for the top and bottom of each amateur HF (and 6 meter) band.
  2. Approximate the exact inductor and capacitor values using the power of two weighted eight standard inductor and capacitor values.
  3. Calculates the voltage across the capacitors and the current through the inductors.  At the same time, it calculates the current through each specific standard capacitor and the voltage across each standard inductor.

The simulator is written in Go programming language.  You can find the code on Github:

https://github.com/Saied74/tuner

If you know C/C++, the code should be easy to read.  You should also consider learning Go.  It is compiled, strongly typed, object oriented language.  It is compact, expressive, and functional with a rich set of libraries.  

The simulator depends on my command line library that can be found at:

https://github.com/Saied74/cli

I recently noticed that Go has a command line library.  I will have to look into it and maybe switch at some point.

I will describe the operation of simulator through its user interface.  It has a number of commands that it displays in a numbered list.  By entering the number, you will get a prompt to enter one of the options in that feature or command.  It validates the option and if is not a valid option it asks you to enter it again.

Here is the list of the available commands:

1. Change the csv file name = data.csv
2. Change the minMax file name = minMax.csv
3. Source voltage in volts = 223
4. Capacitor Q = 1000
5. Inductor Q = 100
6. Calculate simple LC and LC min max calculation
7. Fit LC to their standard values and calculate max difference to actual values
8. Calculate current and voltage across/through L, C, and relays and their maximum values

Each line shows the command that it invokes and also the default value for that command after the = sign.

The last three lines (6, 7, and 8) execute the three scenarios listed on top of this page (exact L & C calculations, approximation of the L & C values using the standard L and C ladder and currents through and voltages across these components.  The result is written into the file named in line 1.  In each case, the minimum and maximum values of these items are also calculated and the result is written into the file named in line 2.  These files are stored in the directory which is hard coded:

 ~/Documents/hamradio/Antennas/tuner/Simulation_output

The standard L and C ladder values are also hard coded.  If you would like to change either one of these, unfortunately, you will have to edit the source.

Line 3 is the peak sinusoidal voltage applied to the input of the tuner.  For a 500 watt output into 50 ohms, it would be 223 volts.  

The data file is one header line and 3600 rows as the simulator steps through 10 values of SWR and 360 values of the reflection coefficient phase angle.  The max file contains the maximum values of inductors and capacitors or voltages and currents.

The column headings for the first file are:

  • swr: value of the SWR
  • theta: reflection coefficient phase angle
  • r0: normalized (to 50 ohms) load resistance
  • x0: normalized (to 50 ohms) load reactance
  • r1: resistance coordinate of intersection with the r = 1 or g = 1 circles
  • x1: reactance coordinate of intersection with the r = 1 or g = 1 circles
  • region: the region where load is located as described in the analytical model
  • parallel: normalized (to 50 ohms) parallel reactance required for match
  • series: normalized (to 50 ohms) series reactance required for match
  • Columns J through O are not used
  • Columns P through AI the inductance and capacitance to achieve a match at the low and high end of each amateur band.  This is the case for both simple and fit LC calculations.
  • For VI calculations, columns A through I are the same as above.  But columns P through OU show the voltage and currents through inductors and capacitors in each band.  For each end of the band, the capacitor voltage followed by all the capacitor currents are shown in successive columns.  This is followed by inductor current, followed by successive columns of inductor voltages.  The capacitor voltage and inductor current columns are so noted in the headings. 
The minMax file format is much simpler and self explanatory.  

This is a short summary of how to use the simulator.  You can of course read through the source code and modify and enhance it as you need.  I will describe the structure of the code in the comments to the code.

500 Watt Antenna Tuner Part 2 - Analytical Model

To start the discussion, I refer you to Jeff, K6JCA's blog:

https://k6jca.blogspot.com/search/label/Networks%3A%20L

Look at the 7th Smith Chart on this page.  One part of the chart is colored yellow and the other half not colored.  The basic idea behind matching the load to the source is that if the load is in the yellow region, we add capacitance in parallel with the load to reach the r = 1 circle and then add inductance in series with the load to get to the Smith Chart origin.  If the load is in the region not colored, we add inductance in series with the load until we intersect the g = 1 circle and then add capacitance in parallel with the source until we reach the Smith Chart origin.

Now that the basic idea is clear, let's delve into the equations.  We need to calculate the magnitude of the reflection coefficient for SWR values of 1.5, 2, 3, 4, 5, 6, 7, 8, 9, and 10.  We also need to assign values to the phase of the reflection coefficient from 0 to 359 in one degree increments.  So, let's state the value of the SWR in terms of the reflection coefficient:

\begin{equation}S=\frac{1+\left | \Gamma \right |}{1-\left | \Gamma \right |}\end{equation}

And solve it for the magnitude of the reflection coefficient:

\begin{equation}\left | \Gamma \right |=\frac{S-1}{S+1}\end{equation} This describes a family of circles around the origin of the Smith Chart.  
\begin{equation}   \Gamma =\left | \Gamma \right |e^{j\theta } \end{equation}
\begin{equation} \Gamma _{r}=\left | \Gamma \right |cos\theta \end{equation}
\begin{equation}  \Gamma _{i}=\left | \Gamma \right |sin\theta\end{equation}
The magnitude and phase of the reflection coefficient are directly measured by the directional coupler and from that the real and imaginary values of the reflection coefficient are calculated.  Then we need to find the resistance and the reactance of the load:
\begin{equation}\Gamma =\frac{Z_{L}-Z_{0}}{Z_{L}+Z_{0}}\end{equation}
We can normalize this by the system (real) impedance by setting:
\begin{equation}z=\frac{Z_{L}}{Z_{0}}\end{equation}
Which will result in
\begin{equation}\Gamma =\frac{z-1}{z+1}\end{equation}
Now we will solve this for z
\begin{equation}z=\frac{1+\Gamma }{1-\Gamma }\end{equation}
\begin{equation}\Gamma =\Gamma _{r}+j\Gamma _{i}\end{equation} \begin{equation}z=\frac{1+\Gamma _{r}+j\Gamma _{i}}{1-\Gamma _{r}-j\Gamma _{i}}\end{equation}
Which after some algebra becomes:
\begin{equation}z=\frac{1-\left | \Gamma \right |^{2}}{(1-\Gamma _{r})^{2}+\Gamma _{i}^{2}}+j\frac{2\Gamma _{i}}{(1-\Gamma _{r})^{2}+\Gamma _{i}^{2}}\end{equation} \begin{equation}r_{0}=\frac{1-\left | \Gamma \right |^{2}}{(1-\Gamma _{r})^{2}+\Gamma _{i}^{2}}\end{equation} \begin{equation}x_{0}=\frac{2\Gamma _{i}}{(1-\Gamma _{r})^{2}+\Gamma _{i}^{2}}\end{equation}
Since the magnitude of the reflection coefficient is less than or equal to one, the real part of the impedance will always be non-negative.  There is a second way of writing these expressions that sometimes is easier to manipulate.
\begin{equation}r_{0}=\frac{1-\left | \Gamma \right |^{2}}{1+\left | \Gamma \right |^{2}-2\Gamma _{r}}\end{equation} \begin{equation} x_{0}=\frac{2\Gamma _{i}}{1+\left | \Gamma \right |^{2}-2\Gamma _{r}}\end{equation}
Where the subscript 0 indicates the measured location of the load on the Smith Chart.
Knowing the resistance and the reactance of the load, we now want to determine if the load is in the part of the Smith Chart colored in yellow (see K6JCA blogpost referenced above), which we will call Region 1 or in the part of the Smith Chart that is not colored, which we will call Region 2.
All of the points inside the r = 1 circle (normalized resistance larger than one) are in region 1.  All of the points in the upper half of the Smith Chart, except the points inside the g = 1 circle are also included in Region 1.  Analytically, this is expressed as:
\begin{equation}r> 1\ \ or \ \ x>0\ \ and\ \ r< \left | z \right |^{2}\end{equation}
The inequality on the left side of the "or" clause is obvious (inside of r = 1 circle).  The conditions on the right side of the or clause need an explanation.  The x > 0 indicates in the top half of the Smith Chart.  The second term to the right of the and clause indicates outside of the g = 1 according to the following logic:
\begin{equation}z = r + jy\end{equation} \begin{equation}y=\frac{1}{z}=\frac{1}{r+jx}\frac{r-jx}{r-jx}=\frac{r-jx}{r^{2}+x^{2}}=\frac{r-jx}{\left | z \right |^{2}}\end{equation} \begin{equation}y=g+jb=\frac{r}{\left | z \right |^{2}}-j\frac{x}{\left | z \right |^{2}}\end{equation} \begin{equation}g=\frac{r}{\left | z \right |^{2}} \ \ and \ \ b = -\frac{x}{\left | z \right |^{2}}\end{equation} \begin{equation}g< 1 \ \ implies \ \ r< \left | z \right | ^{2}\end{equation}
We can similarly derive the criteria for a load being in Region 2 or assume that if it is not in region 1, it will be in region 2.
There is a technicality that a point might be exactly on the r = 1 in the lower half of the Smith Chart or g = 1 circle in the upper half of the Smith Chart.  In the former case, only a series inductance with the load will be needed.  In the latter case, only a parallel capacitance with the source is required.  We can call these two possibilities Region 3 and Region 4 and in the simulator (and in real life operation) handle them accordingly.  Special numerical treatment will be needed since the simulator will be using 64 bit floating point numbers.

Now that we have calculated the load impedance from the measurement of the reflection coefficient and located it in a region of the Smith Chart, we will find the equation of the appropriate conductance or resistance circle going through the load point and find its intersection with the r = 1 or g = 1 circle.  These equations are analytically derived on a Maxim (now a part of Analog Devices) web page.  I will not re-derive them here, but just restate them.   You can find the derivation here:

The equations for the resistance and reactance circles in the Smith Chart frame of reference are:
\begin{equation}(\Gamma _{r}-\frac{r}{1+r})^{2}+\Gamma _{i}^{2}=(\frac{1}{1+r})^{2}\end{equation} \begin{equation}(\Gamma _{r}-1)^2+(\Gamma _{i}-\frac{1}{x})^{2}=\frac{1}{x^{2}}\end{equation}
The equations for the conductance and and susceptance in the same reference frame are:
\begin{equation}(\Gamma _{r}+\frac {g}{g+1}) ^{2}+\Gamma _{i} ^{2}= (\frac {1}{1+g}) ^{2}\end{equation} \begin{equation}(\Gamma _{r}+1) ^{2} + (\Gamma _{i}+\frac {1}{b}) ^{2} = \frac {1}{b ^{2}}\end{equation}
First, we will deal with the case when the load is in Region 1.  that requires us to solve the two simultaneous equations of the conductance circle of the load with the r = 1 circle.
\begin{equation}(\Gamma _{r}+\frac {g _{0}}{g _{0}+1}) ^{2}+\Gamma _{i} ^{2}= (\frac {1}{1+g _{0}}) ^{2}\end{equation}
\begin{equation}(\Gamma _{r}-\frac{1}{2})^{2}+\Gamma _{i}^{2}=\frac{1}{4}\end{equation}
With a little simplification:
\begin{equation}\Gamma _{r} ^{2} + (\frac {g _{0}}{1+g _{0}}) ^2 + 2(\frac {g _{0}}{1+g _{0}})\Gamma _{r} + \Gamma _{i} ^{2} = (\frac {1}{1+g _{0}} ) ^{2}\end{equation}\begin{equation}\Gamma _{r} ^{2} + \frac {1}{4} - \Gamma _{r} + \Gamma _{i} ^{2} = \frac {1}{4}\end{equation}
Cancelling the 1/4 from both sides of the second equation and subtracting it from the first we get:
\begin{equation}(\frac {g _{0}}{1+g _{0}}) ^{2} + 2(\frac {g _{0}}{1+g _{0}})\Gamma _{r} + \Gamma _{r} = (\frac {1}{1+g _{0}}) ^{2}\end{equation}
Rearranging terms:
\begin{equation}\left [ 2(\frac {g _{0}}{1+g _{0}})+1 \right ]\Gamma _{r} = (\frac {1}{1+g _{0}}) ^{2} - (\frac {g _{0}}{1+g _{0}}) ^{2} = \frac {1-g _{0} ^{2}}{(1+g _{0}) ^{2}}\end{equation}
\begin{equation}(3g _{0}+1)\Gamma _{r} = \frac {(1+g _{0})(1-g _{0})}{1+g _{0}}=1-g _{0}\end{equation}
\begin{equation}\Gamma _{r1} = \frac {1-g _{0}}{1+3g _{0}}\end{equation}
Since this point is on the r = 1 circle, we can plug this value into the second equation and get:
\begin{equation}\Gamma _{i1}=\pm \sqrt{\Gamma _{r1}-\Gamma _{r1} ^{2}}\end{equation}
Since the intersection of the conductance circle with the r = 1 circle will always be in the lower half of the Smith Chart (see the figure referred to above), we will take the negative square root as the answer.  We must also show that the value under the square root is positive:
\begin{equation}\Gamma = \frac {z-1}{z+1}=\frac {r+jx-1}{r+jx+1}=\frac {(r-1)+jx}{(r+1)+jx}\times \frac {(r+1)-jx}{(r+1)-jx}\end{equation}
\begin{equation}\Gamma = \frac {r ^{2}-1+x ^{2}+jx(r+1-r+1)}{(r+1) ^{2} +x ^{2}}= \frac {r ^{2}+x ^{2}-1}{(r+1) ^{2} + x ^{2}}+j\frac {2x}{(r+1) ^{2} + x ^{2}}\end{equation}
\begin{equation}\Gamma _{r1} = \frac {r ^{2} + x ^{2}-1}{(r+1) ^{2} + x ^{2}}\end{equation}
Since this point is on the r = 1 circle, we can plug this value in:
\begin{equation}\Gamma _{r1} = \frac {x _{1} ^{2}}{4+x _{1} ^{2}}\end{equation}
The real part of gamma is positive and less than one, its square will be less than itself.  Hence, the value under the square root will always be positive.
Now armed with the real and imaginary values of the reflection coefficient for the point of intersection between the conductance circle going through the load point and the r = 1 circle, as before, like we did for the location of the load impedance, we can calculate the resistance, reactance, conductance, and susceptance of the intersection point.
Now, knowing r (resistance), x (reactance), g (conductance) and b (susceptance) for both the Smith Chart coordinate of the load (subscript zero) and the intersection of the load conductance circle with the r = 1 circle (subscript 1) we can calculate the following values:
\begin{equation}Bcomp = \frac{b _{1} - b _{0}}{Z _{0}}=\omega C\end{equation}
\begin{equation}Xcomp=Z _{0}x _{1}=\omega L\end{equation}

We add a capacitor with the susceptance of Bcomp in parallel to the load and an inductor with the reactance of Xcomp in series with the load and we are done.  Note that we are rotating clockwise on the conductance circle by adding capacitance and also rotating clockwise on the resistance circle by adding inductance.  They are both consistent with the Smith Chart rules.

If the load resistance and reactance put the initial point in Region 2, we need to solve for the intersection of the resistance circle going through this point and the g = 1 circle:
\begin{equation}(\Gamma _{r} - \frac {r _{0}} {1+r _{0}}) ^{2} + \Gamma _{i} ^{2} = (\frac {1}{1+r _{0}}) ^2\end{equation}
\begin{equation}(\Gamma _{r}+\frac {1}{2}) ^{2}+ \Gamma _{i} ^{2}=\frac {1}{4}\end{equation} 
After some algebra, just like we did in region 1, we will get:
\begin{equation}\Gamma _{r1} = \frac {r _{0}-1}{3r _{0}+1}\end{equation}
\begin{equation}\Gamma _{i1} = \pm \sqrt{-\Gamma _{r1} - \Gamma _{r1} ^{2}}\end{equation}
Since the intersection point is in the upper half of the Smith Chart, this time, we will take the positive root.  In the same way that we showed the value under the square root was positive in Region 1, it can be shown that the value under the square root is positive in this case, except this time, one needs to start with the reactance rather than impedance formula for the reflection coefficient (1-y)/(1+y).
Now armed with the real and imaginary values of the reflection coefficient for the point of intersection between the resistance circle going through the load point and the g = 1 circle, as before, like we did for the location of the load impedance, we can calculate the resistance, reactance, conductance, and susceptance of the intersection point.

Knowing r (resistance), x (reactance), g (conductance) and b (susceptance) for both the Smith Chart coordinate of the load (subscript zero) and the intersection of the load susceptance circle with the g = 1 circle (subscript 1) we can calculate the following values:
\begin{equation} Xcomp = Z _{0}(x _{1}- x _{0})=\omega L\end{equation}
\begin{equation} Bcomp = \frac {b _{1}}{Z _{0}}=\omega C\end{equation}
We add an inductor with the reactance value of Xcomp in series with the load and a capacitor with the susceptance value of Bcomp in parallel with the source.  Again note that we are rotating clockwise on the resistance circle to add inductance and rotating clockwise on the conductance circle to add capacitance, both consistent with the Smith Chart rules.

500 Watt Antenna Tuner Part 1 - Introduction

This is a work in progress.  I am publishing it since it forces me to think more clearly about the project.  I am actively working on this project (in parallel with the EME project at the Delaware Valley Radio Association).  

A 500 watt linear amplifier is not very useful without a tuner.  So, I am taking a detour into the designing and building a tuner.  I am going to follow the general outline of Jeff Anderson's (K6JCA) design:

https://k6jca.blogspot.com/2015/06/antenna-auto-tuner-design-part-1.html

I will start by copying his requirements:

  • Frequency range (3.5 - 30 MHz), continuous (and perhaps 54 MHz if comes for free - and my Ten-Tec Omni D is quite limited in the bands that it covers)
  • Matching network topology low pass L-C Network
  • Load matching range: to better than 1.2:1 with any load up to 10:1 SWR
  • Input power: 200 watts average, 800 watts peak ICAS operation (https://www.ab4oj.com/quadra/icas.html)
K6JCA has extensive antenna tuner analytical models, test data, and discussions in his blog.  If you are planning to design and build a high power tuner, I recommend reading his material.  I have frequently gone back and re-read the material to clarify some points for myself and figure out how to solve my design, build or testing problems.

The power specification requires a bit of discussion.  The human voice dynamic range at a distance of 25 cm (about 10") from the microphone varies from 70 dB (relative to 20 micro Pa) at normal level to 88 dB when shouting, or a 18 dB range (https://www.dpamicrophones.com/mic-university/facts-about-speech-intelligibility).  I am going to assume that the user will adjust the microphone gain for their normal level of speaking, say raised, which is 76 dB (I am a bit hard of hearing).  The same site quotes the peak to average ratio of human voice at 20 - 23 dB.  But, this is a high quality microphones business site and they are probably talking about opera singers.  

I have seen various places on the web that put this range at 12-14 dB and claim that ALC reduces it to 6 dB.  SM5BSZ (http://www.sm5bsz.com/dynrange/alc.htm) quotes this number at 10 dB.  

K6JCA specification of 200 watts is to support AM transmission (see his blog).  So, I will go with it.  

I did not start intending to build an 800 watt power amplifier.  But with the combination of the standard power supply voltages, transistor max VDD specification and the required impedance ratio of the transformer, I ended up with a max 800 watt output capability.  My power amplifier design with a 48 volt power supply and 9:1 impedance transformer at the output can easily deliver 800 watts of output (50/9 = 5.56) with the allowance of 1 volt for overhead:
\begin{equation}P _{out}=\frac {2V _{dd} ^{2}}{R _{L}} = \frac {2\times47 ^{2}}{5.56} = 795\space watts\end{equation}
800 watts of peak power, depending on 10 or 6 dB of peak to average power ratio assumption implies 80 or 200 watts of average power.  It is also important to note that 800 watt output only occurs (if ever) at voice peaks.  Certainly, that level of power is unnecessary and not advised for digital or CW communication.  Hence, for the 800 watts case, the heating effects (current) can be ignored and only voltage effects (breakdown) taken into consideration.

500 Watt Antenna Tuner Part 2 - Analytical Model