Notes on the use of ZIZL Version 2.2 Dan Maguire AC6LA email: bagardn@ibm.net ZIZL was originally written to allow me to see what the impedance (R+jX) would be at the antenna (load) end of a transmission line given a measured impedance value at the input end, using real world line with losses. At the time, I could find no other programs which would compute in the "input to load" direction for non-ideal line. John Grebenkemper, KI6WX, wrote an article in the August 1989 QST entitled "Improving and Using R-X Noise Bridges". In that article, and in later editions of the ARRL Antenna Book, he offered to make available BASIC source code listings for the solution of the transmission line equation. I obtained that document (ARRL technical order no. 3495), created a BASIC program, verified my results with those obtained from some other sources, and basically (pun intended!) took off from there. As my curiosity about different aspects of transmission line performance was aroused, or as a need arose to actually solve some real world problem for an antenna system, I would add more function to the program. I think ZIZL is fairly simple to use, but of course that's not a fair assessment since I wrote it! With that in mind, I've created these notes to walk a new user through a typical session with the program. The program is supplied as a .BAS file. I've learned a lot about both technical issues and BASIC programming techniques by reading the source code provided by others, so I'd like to return that favor by making my source code available. I'm not a professional programmer, but I have tried to make the source code as readable and understandable as possible. Begin by entering whatever environment you have for executing .BAS programs. I've tested it under BASICA, GWBASIC, and QuickBasic. Once you've got the program running, the first prompt is for the frequency. Enter a value in MHz, with 0.001 being the minimum value allowed. There is no limit on a maximum value, but note that some of the equations used in the program will probably not hold for frequencies up in the GHz range. In the prompt for frequency, and in many of the other prompts in ZIZL, you'll notice a value enclosed in square brackets. That's the default value for this prompt, and will be used if you just press Enter without typing any other data. You can change all the defaults to suit yourself. See the section below titled "Changing the Defaults". Next is a prompt for an impedance value, entered as R in ohms and jX in ohms, separated by a comma. The value for reactance, X, is entered with a '+' sign (optional) to indicate inductive reactance and a minus sign '-' to indicate capacitive reactance. An example of a valid entry would be '40,-30' (without the quotes, of course) to indicate 40 ohms of resistance and 30 ohms of capacitive reactance. If you don't enter the comma and an X value, the program will assume a reactance value of 0 (which may or may not equal the current default). Next is a prompt to specify whether the impedance value you just entered is at the input or load end of the transmission line. You might have measured the impedance at the input end and want to see what that means at the load (antenna) end. Or you might have modeled an antenna with EZNEC and have a good idea what the impedance at the load (antenna) end is and want to see what it will be in the shack. Enter either 'i' or 'l'. This is a good time to talk about entering character data in ZIZL. The program assumes that all character input will be in -lower- case. Make sure Caps Lock is turned off on your keyboard. I didn't bother to add the extra code that would be required to recognize both upper and lower case. Next you enter the input power to the line in watts, with the "as delivered" default being 1000. I like QRP myself, but entering a large value at the input lets you see several significant digits at the output. Next you choose what type of transmission line you have. The choices are presented to you first, then a prompt to let you specify one. ZIZL has built in several types of common line, mostly the ones that I have used for some of my projects. If you want to change any of the parameters for these, or add additional types of line, see the section below titled "Changing or Adding Transmission Lines". If you want to use line parameters which are not built in to ZIZL, enter '00' as the line type. You'll then be prompted for: Characteristic impedance: Enter the Ro (resistive) part of the line Zo, like '52' or '75'. Optionally, you can also enter a comma and the Xo part. If you don't enter the Xo part then ZIZL will compute it, which is probably best since the computation is a little complicated. Velocity factor: Enter a decimal value, like '.66'. Attenuation: Enter a value in dB/100 feet. Optionally, you can also enter a comma and a reference frequency (in MHz) which is the frequency to which the attenuation value pertains. (Most references list attenuation in dB per 100 feet at 10 MHz, 50 MHz, 100 MHz, etc.) If you don't enter this optional part, the program will use the frequency value that you entered for the first prompt. Last but not least, enter the length of the transmission line. If you don't do anything special the value you enter will be assumed to be in units of feet. You can also specify an electrical length, either by appending a 'w' for wavelengths (eg, '.5w') or a 'd' for degrees (eg, '180d'). A value of 0 is valid (input the same as load), which you may want to use for convenience if you are not interested in the input - output transform but instead want to investigate some of the other items which will be calculated for you. The next screen is what you've been waiting for. ZIZL calculates the impedance at the "other" end of the line, and shows you that plus several other items. The top part of the screen repeats all the data you entered to start or which was picked up from the built in transmission line data. Also shown are the computed values for the reactive part of the line characteristic impedance and the matched line attenuation for the frequency in use, if that frequency is different from the attenuation reference frequency. The middle part of the screen shows the R (resistance), X (reactance), Z (total scalar impedance), the SWR on the line, the SWR referenced to 50 ohms (like a meter would show), along with the P (power), I (current), and E (voltage) values at both ends. Below that are figures for the matched line loss (at the given frequency and length), the additional loss due to SWR on the line, and the total combined loss. The bottom part of the screen is used for what I think is one of the nice features of ZIZL. You can change any of the parameters which you originally specified (one at a time) and immediately see what the results are using that new value. This is kind of like a spreadsheet program. I use this feature all the time to play "what if" games with transmission lines. On a 486DX machine the new calculations are done almost instantly, and even on an old 286AT machine it only takes a second or two. To use this feature, enter the 1-3 character code for the item you want to change (Lower case, please!). You'll then get a prompt for that particular item. Enter the new value (or sometimes set of values, separated by a comma), and the screen will be refreshed with all the new calculations. If you want to change multiple items, make the changes one at a time. The refresh is done so fast that you'll not lose your train of thought. I use this feature so much that I added a shortcut way to do it. After you've used the program for a while you'll know what the secondary prompt is going to be, and you'll get annoyed having to go through that extra step. To shortcut, just type the code letter(s) for the item you want to change, followed by the new value, then press Enter. The screen will be refreshed with the new calculations immediately. You can put some extra blanks between the code letter(s) and the new value if you like or if your fingers happen to do it that way, but it's not necessary. For example, suppose the current frequency is '7.040' and you want to change it to '7.125'. You can type 'f', press Enter, get the second prompt, type '7.125', and press Enter again. Or you can just type 'f7.125' or 'f 7.125' and press Enter. Another example would be changing the input R and X values to 43.21 and -1.23, respectively. Just type 'i43.21,-1.23' and press Enter. Typing 'i 43.21 , -1.23' does the same thing. Of course, if you ever forget what any of the code letters mean just type the letter(s), press Enter, and get the prompt. Here are a few special cases concerning the use of ZIZL, in no particular order. Once you have the main screen displayed there are two ways to change the frequency. You can enter a new value in MHz as noted above. But you can also enter a value with a 'w' or 'd' appended. Keeping the same physical line length in feet, the program will calculate what frequency would be required to make the line the specified number of wavelengths or degrees long in electrical length. Then the screen will be refreshed using that frequency. This is useful if you have a particular length (in feet) of line and want to know, for instance, what frequency would be one quarter wavelength for that line. If you change one of the transmission line parameters (as opposed to picking a completely new line type), the line type and description fields near the top of the screen will be slightly modified. This is just to remind you that you are no longer working with a "built in" set of line values. If you want to see what the results would be if the reactive part of the line characteristic impedance had not been included in the calculations, enter 'z' and then enter both the Ro part (as shown near the top of the screen) and also ',0' for the optional second part (eg, '52,0'). If you then want to go back to including the Xo calculations, enter 'z' again but this time specify just the resistive part (eg, '52') and the program will compute and use the Xo part. If you want to see the results for "ideal" line (no dB loss, no Xo component), enter 'at' and a value of 0 for the attenuation. Doing this is a quick way to "get rid of" both of these non-ideal factors. There may be times when you want to specify a current (I) at the load end of the line of exactly 1.0 amps. Playing with separate lines going to two different elements in a phased array might be an example. There is no direct way to do this, but the following technique works. First note the ratio between the input power and load power. Using this ratio, calculate what input power would yield an output power (in watts) which is exactly equal to whatever the R value (in ohms) is at the load. Use this input power, and the I value at the load (in amps) will now be exactly 1.0. (If you used the default of 1000 for input power, the equation would be New power = 1000 / Load P * Load R.) An even quicker method is to first set the length ('len') to 0, then set the input power ('p') to whatever the load R value is. Of course this only works if you leave the length set to 0 on the main screen, but that just might be the case if all you want to do is play around with the "Steps" screen (or with plotting), explained below. Concerning physical length versus electrical length: If you enter a new frequency or new velocity factor, the program assumes that the physical length of the line is to remain the same. (I had to choose one or the other, and keeping the physical length the same seems more appropriate.) If you want to keep the same electrical length, change 'f' or 'vf' first and then just choose a new length ('len'), but specify the length in wavelengths ('##w') or degrees ('##d'). There are four other choices you can make in addition to those just described. If you enter 's' you will be shown what is called the Steps screen. This screen lets you see the R,X,Z,P,I,E values at one or more points back from the load end of the line, specified in electrical degrees. For example, if you want to get a good feel for the way the values of R and X change along the line (as well as the I and E standing waves), you can specify a set of points in the form '0,180,15'. That means start at 0 degrees back from the load (the load end itself), and show values every 15 degrees until you get back to 180 degrees. If you want to see what's happening at critical points on the line, say at either 45 or 90 degrees back from the load, specify something like '85,95,.5'. That lets you see points every half degree around the critical point of interest. When you first start playing with this sub-screen I suggest you use ideal line (no loss, no Xo component). That lets you easily see what's happening without losing your way in all the "clutter" of real line. For a real eye-opener, specify a load impedance of '5,0' and then look at the line in 15 degree steps from 0 to 180 degrees. Then specify a load of '500,0' and do the same thing. Do this with a paper Smith chart on your desk next to your high-tech digital version of the same thing. I guarantee you'll get a new appreciation for Mr. Smith's invention. (You might also want to plot these points. See below.) The first time you use the 's' code you'll see an explanation similar to what you just read. On subsequent use, the steps that you chose previously will be re-displayed. This is convenient if you are looking at a particular set of steps but want to go back to the main screen to change any of the other items, like frequency, input or load R and X, line type, etc. If you want to specify a new set of points, just enter the appropriate numbers at the prompt which appears on the Steps screen. And yes, once you get used to the proper form of data entry, you can use the shortcut with the 's' code. The second choice you can make is 'fs' for frequency sweep. Keeping the same physical line length and the same impedance and power at the load end of the line, the program will sweep through a range of frequencies (resulting in different electrical line lengths) and show the parameters at the input end of the line. This is very similar to the Steps screen, except that you specify frequencies in MHz instead of line lengths in degrees and the line always stays the same physical length. The third choice you can make has to do with plotting. If you enter 'plt' the program will produce plots of R and X versus length in degrees from the load end (for a maximum of 720 degrees), Z and Z phase versus length, and I and E magnitude versus length. You use the PgUp and PgDn keys to move from one set of plots to another. You can use the Cursor Left and Cursor Right keys to change the horizontal scale from 720-0 to 360-0 to 180-0, and you can use the Cursor Up and Cursor Down keys to show a sub-window with the actual data points used to produce the plots. Entering 'res' on the main screen will let you see/change the plot resolution. You can use 2.5, 5, 7.5, or 10 degrees. The "as delivered" default is 2.5, but this can be changed with the other default values. Use the smallest value which produces an acceptable wait time for generating the plots. Note that some of the plotted values, particularly reactance, can change significantly over a 2.5 degree span. (The choice of 2.5 as a minimum was a compromise between memory requirements, processing time, and plot granularity.) If you want to see data points at a finer resolution or in a range beyond 720 degrees, use the Steps screen (described above). As with the Steps screen, keep in mind that the I and E values are calculated keeping the power -at the load- constant. If you go back to the main screen and change the line length to 720 degrees (assuming it was something else), the I and E values you see will not match those shown at the 720 degree point on the plots. That's because power is specified as -input- power on the main screen. If you change the line length on the main screen the -output- power will change, and it's the output power that is held constant for the plots. Note that the I and E values on the plot will match the main screen values at the point on the plot which matches the specified line length on the main screen. The fourth choice you can make is '1', '2', or '3' for number of decimal places (or 'e', explained below.) The default is 2. This lets you see more digits to the right of the decimal point for small values, or more digits to the left of the decimal point for large values. Since the total number of digits for each item remains constant at 7, doing this also changes the maximum value that can be shown. (Maximums will be 999999.9, 99999.99, or 9999.999.) Any value that exceeds the current maximum will display as all 9's, although the actual value will still be used for calculations. If you see all 9's shown, you can safely assume that the actual value is "something bigger than that." Values less than the maximum will be rounded to the number of decimal places specified. Whatever choice you make will apply to all of the R, X, etc. values which are shown for the input and load ends of the line. A word of caution though: I added this feature mostly to let me investigate a few special cases using ideal line. Don't put a lot of faith in a few thousandths of an ohm, especially for real transmission line. Minor changes in line parameters (characteristic impedance, velocity factor, attenuation) will generally swamp out any results beyond a tenth of an ohm. Play around yourself and see. (Also see the section below concerning extreme values.) You can also enter a value of 'e'. This will result in values being displayed in scientific notation with a mantissa and exponent. However, because of space limitations on the screen you only get to see three significant digits (eg, 1.23E+04). I didn't use scientific notation as a default because I personally find it easier to read and mentally interpret the data when all the decimal points are the same and are all lined up. However, there are times when you might want to see if a number shown as 0 really is 0, or see what the real value is for an item which was "maxed out" at all 9's. Keep in mind the caveats above about believing everything you see on a computer screen. Also, there may be cases where ZIZL actually sets a number to the value 1.7E+38, which means "infinity" for all practical purposes. That's all you need to know to use ZIZL. (Heck, that was a lot more than you -really- needed!) The sections below cover some of the finer details. Changing the Defaults The default values that are shown in square brackets for several prompts can be easily changed. They are contained in the first line of the separate file named 'ZIZL.DAT'. You may use any text editor to change this file, like Windows Notepad for example. There are comments in the file itself to guide you. Be sure that the defaults themselves remain on the first line. The program isn't smart enough to go looking for them anyplace else. Changing or Adding Transmission Lines The various parameters for the "built in" transmission lines are also contained in the 'ZIZL.DAT' file. Feel free to change the existing values, or add additional file lines for more types as you see fit, using any text editor. Again, there are comments in the file to guide you. But a word of caution: Don't think that you will be able to find the "true" values for any given type of line. You can get your data from a variety of sources, such as the ARRL Handbook, the ARRL Antenna Book, the Press Jones ("The Wireman") Wirebook, the Cable X-Perts catalog, the Radio Works catalog, the output of the Dean Straw N6BV TL.EXE program, at least a few of the programs in the George Murphy VE3ERP HAMCALC package, (whew) and dozens of other places. With the exception of the two ARRL books, you'll probably find different numbers for at least some of the parameters for any given type of line. You won't find a source for "truth" because the numbers change depending on manufacturer, age of the line, etc. Perhaps your best bet would be to actually measure at least some of the parameters yourself. (Velocity factor isn't too tough to measure and it's the one most likely to be "off" from published values.) If you own an Autek RF-1 instrument you can use it in conjunction with the RF1CHAR program to measure velocity factor, Ro component of line characteristic impedance, and matched line dB loss values. A few technical items: For the Line type code, use values that have meaning to you. You are shown the list of choices when the program first starts, but after that if you want to change the line type you just enter a new value without the reminders being shown (unless you specifically ask to see them again). I like to use a trailing 'f' for 'foam' type coax, and a trailing 'c' (custom) to indicate values that I have measured or are otherwise different from standard. And don't forget the business about lower case. For the line characteristic impedance, you only specify the resistive component (Ro). The program will automatically compute the reactive component (Xo), which varies with the velocity factor, the matched line attenuation, and the frequency being used. (Thanks go to W7XC for the details on all that.) The other item which might be a bit confusing is the next to last value in each file line, which is the sigma used to interpolate the matched line attenuation to frequencies other than the one you specify. To calculate the sigma value you need to know the matched line attenuation at two different frequencies. (Most sources show it at 10 MHZ, 50 MHz, 100 MHz, etc.) If F1 is the lower frequency and F2 the higher, and DBF1 and DBF2 are the respective attenuation values, then sigma is LOG(DBF2/DBF1) divided by LOG(F2/F1). If you don't care to figure all this out just use .5 for a sigma value, which is a good approximation. Extreme Values and Single versus Double Precision The program will accept and use for computation any (reasonable) values you enter for input or load impedance, including 0 for R. The "Divide by 0" and "Overflow" conditions which would normally result from such input are trapped and avoided. Under BASICA and GWBASIC all calculations (usually) are done in single precision. (Trig functions are done single precision in these environments unless you specify the BASIC '/D' command option, so it doesn't make much sense to do other calculations in double precision.) If you run ZIZL under Quick Basic (or under BASICA/GWBASIC with the '/D' option), everything (including built in trig functions) is done in double precision. You can look for a semi-hidden 'S' or 'D' near the bottom of the main screen to tell you which method was used. The difference is noticeable only under the most extreme cases. For instance (using single precision) if you specify a load of '0.1,0', ideal line, and a length of exactly 90 degrees, you'll notice that the reactance value (X) at the input end is not exactly 0, which it should be in theory. Under double precision, the X would be 0 (out to a whole bunch of decimal places, at least). Don't lose any sleep worrying about this. For real line with attenuation and for realistic values of input or load impedance, you'll (almost) never notice the difference. I only went to double precision because I was investigating a few special cases with ideal line. If I had known what a can of worms it was going to open, I don't think I would have bothered! Negative dB SWR loss component Wouldn't it be nice (especially for us QRP types) if you could get more power out of a transmission than what you put into it? Well that's not going to happen, but you might sometimes notice that the loss figure due to SWR is a negative value. Charles Michaels, W7XC, who by the way is truly one of ham radio's "Really Smart Guys", has assured me that the calculations are not in error. It is a little misleading to think of it as getting free power, though. Instead, he prefers to view it as just a factor which serves to reduce the total loss along a particular length of line. (You'll never see the total loss dB value go negative.) The situation only appears when including Xo in the calculations, for loads which have an R value at or in a range above the Ro of the line, and for the section of line within a quarter wavelength from the load. I won't try to give you a physical or mathematical explanation because I'd end up both misquoting W7XC and making a fool of myself. Be assured that the number is accurate, but perhaps misleading. Change history Version 1 Original version made available in conjunction with the article "RF Fun with the RF-1", published in the Spring 1997 issue of QRPp, the Journal of the NorCal QRP Club. Most of the program was actually written in the winter of 95/96. Version 2.0 Technical: Automatic computation of line Xo. Double precision (under QuickBasic only). Changed method of computing loss due to SWR. Allow extreme values, like R = 0 and R > 99999. Traps to avoid "Division by 0" and "Overflow" conditions. Allow reflection coefficient greater than one and negative SWR. Compute SWR(50). Removed tuner sub-screen (too confusing). Usability: Color. Defaults for most prompts. Defaults and transmission line parameters in external file for easier modification. Display results with 1 to 3 decimals, or scientific notation. "Short cuts" on the main screen to change parameters. Version 2.1 Allow base frequency to be set in terms of wavelengths or degrees. Added frequency sweep (fs) sub-screen. Allow double precision under BASICA/GWBASIC if the BASIC '/D' command option was used. Version 2.2 Added plotting function. Minor cosmetic changes. Feedback appreciated to "bagardn@ibm.net". 73, Dan Maguire AC6LA