NAME¶gsmc - A GTK Smith Chart Calculator for RF impedance matching
DESCRIPTION¶gsmc is a GTK application that allows one to do all the calculation usually done on a Smith Chart. It permits one to make calculation for network composed by resistor, capacitor, inductance, and transmission line (also as stub). Network topology is limited to series, parallel and as trasmissive for transmission line. No series connection are allowed in parallel branch, neither parallel connection in series branch. Transmission line can be placed as quadrupole or as a parallel or series stub, either opened or shorted at the other end.
Calculation procedure starts with setting the initial impedance to be matched, next network elements are added and tuned to obtain the desidered impedance value.
The network so obtained can be saved in spice format for other analysis; current work can be saved for successive retrieve.
The initial (start) impedance is thought as "the load" so when adding a transmission line placed as a quadrupole rotation is clockwise, going "toward generator"; generator is placed after the last network element, as can be seen from spice output.
INTERACTIVE COMMANDS¶gsmc is a menu based GTK application with as much as possible accelerators and mnemonics. Nearly all the command can to be issued as a single keystroke or keystroke with modifiers. This is, in the author's opinion, the preferable way for very specialistic programs that has to be used extensively.
- Quit the program.
- Toggle visualization of impedance (Z) circle
- Toggle visualization of admittance (Y) circle
- Toggle visualization of reflection coefficient (RHO) circle
- Toggle visualization of constant Q circle
- Set start point: can be entered as impedance, admittance or reflection coefficient
- Ctrl+0 (zero)
- Set characteristic impedance z0
- Set frequency (f0)
- Add a resistor
- Add an inductor
- Add a capacitor
- Add a transmission line or stub
- Insert a resistor before the highlighted element
- Insert an inductor before the highlighted element
- Insert a capacitor before the highlighted element
- Insert a transmission line or stub before the highlighted element
- Delete the currently highlighted element
- Shift+Curs Up
- Highlight previous element
- Shift+Curs Down
- Highlight next element
- Shift+Curs Left
- Decrease the first field of currently highlighted element
- Shift+Curs Right
- Increase the first field of currently highlighted element
- Mod+Curs Left
- Decrease the second field of currently highlighted element
- Mod+Curs Right
- Increase the second field of currently highlighted element
- Mod+Curs Up
- Increase the tuning step
- Mod+Curs Down
- Decrease the tuning step
- Write network file in spice format
- Restart for a new calculation with a clean chart
- Change first field of currently highlighted element
- Change second field of currently highlighted element
- Start autotune procedure (tune goal is characteristic impedance)
- Toggle lock flag in autotune procedure
- Write an EPS or PS file
- Load a previously saved .B gsmc job
- Save a .B gsmc job
- Increase frequency
- Decrease frequency
Check online keystroke for an updated list of commands.
For operation that requires data entry a widget is created; it is composed by an text entry field and optionally some radio button to chose the format of data entry.
The format for data entry can be a single number, or a more complex string. First of all every number can be supplied using standard prefix for unit of measure i.e.:
- (atto) 1e-18
- (femto) 1e-15
- (pico) 1e-12
- (nano) 1e-9
- (micro) 1e-6
- (milli) 1e-3
- (kilo) 1e3
- (mega) 1e6
- (giga) 1e9
- (tera) 1e12
Where a complex number is required both the rectangular and the polar format are recognized: the former can be supplied as '12.3-j456m' while the latter can be supplied as '34.2 145' meaning a modulus of 34.2 with a phase of 145 degrees. If the complex number is purely imaginary only something like 'j82' can be supplied, while if imaginary part is zero a single number can be given. Imaginary operator can be issued as 'i' as well as 'j'.
DATA PRESENTATION¶The single window of gsmc is divided in four parts:
- The Smith chart itself in the upper left portion, where arcs and constant circle are drawn.
- The vertical bar on the right of the Smith chart, where initial, final and cursor impedance are presented together general data.
- The horizontal bar on the bottom of Smith chart where the network element are listed.
- The portion in the lower right portion, for future use...
EXAMPLE OF USE¶Let's try a simple example to understand how gsmc work. Suppose to have a load of 10-j35ohm to be matched to 50+j0ohm at an operating frequency of 15.5MHz and we can use only concentrated reactive elements, i.e. inductances and capacitors.
So start with setting operating frequency: press 'f' and a dialog win will appear. Type in the string '15.5M' and then press enter. Now in the vertical bar the frequency entered is displayed.
Next set the start point impedance: press 's' and a dialog win will appear with the title "Start Point"; select the format for start point either clicking the "Z" radio button or using the mnemonic via Mod+Z. Now the impedance can be entered as the string '10-j35' followed by enter. The starting point is now displayed as a small circle.
The network has now to be constructed: let start with a series inductance of 800nH, so press 'l' and next introduce the value as '800n', be sure that "Series" radio button is selected before pressing enter. TAB and Shift+TAB is useful to move across items in dialog win without leave hands from keyboard. This value is really too large, use Shift+Left cursor to reduce a bit. Up to where? Let's help you displaying the admittance constant circles pressing "Ctrl+2", the arc should arrive to the G=1 circle (also called the mirror circle), it's around 546nH.
Now add a capacitor in parallel connection, saying of 200pF: press 'c' and insert the string '200p' and select Parallel either with mouse or with "Mod+p". Now the admittance circles may confuse, remove it by pressing "Ctrl+2" again. The value of 200pF is too small, enlarge it by pressing Shift+Left cursor up to get the end point near to the chart's center. The point reached with 429pF has nearly zero imaginary but is 43ohm of real part instead of 50ohm.
So back to the inductance and try to modify it, with Shift+Cursor up move to the first component and then try to change the inductance value by pressing cursor left and right. The changes are too large and 50+j0 cannot be reached. So press "Mod+Cursor down" and the "tunestep" value shown in the vertical bar is reduced from 10% to 5%, try again to use Shift+Cursors left and right. It feel better. Now do the same on the capacitor, moving to it by pressing cursor down and than adjusting value as for the inductance.
Final values should be around 568nH and 408pF. Now you want to see what happen using the closest standard commercial values, that is 560nH and 390pF in the E12 series. Select (with Shift+Cursor Up), if needed, the inductance and then press '=', the dialog window appear (middle line is unused) and the string '560n s' has to be introduced. Next move to capacitor (Shift+Curs Down) and pressing '=' here insert '390p p'. The final result is of SWR=1.14, if it's enough for you...
Moving the mouse to the point where the two arcs ends you can see that the point has an impedance of about 10+j20ohm.
Transmission line and resistor can be used similarly refer to the section INTERACTIVE COMMANDS for knowing how they can be placed. The major difference with transmission line is that they have two parameter, the electrical length and the characteristic impedance: the former can be adjusted with Shift+Cursor left/right as for resistor, inductance and capacitor; the latter can be adjusted with Mod+cursor left/right.
Now the network can be saved either in a gsmc format (.gdt extension) by pressing Ctrl+s or in spice format pressing Ctrl+w: The file so generated can be now analyzed with a spice simulator or gnucap or ngspice ; maybe you are interested in simulating it sweeping around 15.5MHz, so modify the line
.ac lin 1 15.50MEG 15.50MEG
.ac lin 51 10MEG 30MEG
and run spice or gnucap
This example should be included in gsmc package an can be retrieved by pressing Ctrl+l and selecting example1.gdt.
Autotune algorithm is very primitive and may not reach what is very simple to do by hand, do not ask to much from it, work in progress...
Charts so drawn can be printed to a Postscript or Encapsulated Postscript file; in printed file some information are added on the chart drawing as well as Circuit Description and some of the Current Value are transcripted. Automatic recognition of filename extension .eps or .ps allows one to specify if the file has to be in encapsulated format or not.
FILES¶gsmc don't use special configuration file, a gtkrc file is supplied and can be tuned to user preferences; if present it must be in /root/.gsmc/gtkrc. File describing the network currently analyzed can be generated, it's only needed that a minimum file permission is allowed, if not the program will work but data could not be saved.
Data file (.gdt) contain a copy of internal data structures in a quite human readable format; by inspection one can recognize and modify some parts using a text editor. For more details compare a .gdt file with smcdata struct defined in source file main.h.
LIMITATIONS¶Porting can be very very difficult, since all is based on X windows programming and GTK library, but for other platform a plenty of similar program are available, free and good one too.
BUGS¶Help me to find.
TODO¶• Improve autotune algorithm
• Target setting (not always one want to match to z0) for autotune.
• Auxiliary window for error reporting instead of stderr.
COPYING¶This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
AUTHOR¶Lapo Pieri (IK5NAX)
Home address: via delle Ortensie, 22 I-50142 Firenze Italy Phone: +39 055 706881 e-mail: firstname.lastname@example.org website: www.qsl.net/ik5nax ; www.radioteknos.it
SEE ALSO¶spice3(?), gnucap(1), ngspice(1), qucs(1)