**Rectangular Radio Antenna and eTCL Slot Calculator Demo Example** This page is under development. Comments are welcome, but please load any comments in the comments section at the bottom of the page. Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Aside from your courtesy, your wiki MONIKER and date as a signature and minimal good faith of any internet post are the rules of this TCL-WIKI. Its very hard to reply reasonably without some background of the correspondent on his WIKI bio page. Thanks, [gold] 12DEC2018 ---- <> **Introduction** [gold] Here is some eTCL starter code for calculating rectangular antennas from source frequency and other dimensions. The impetus for these calculations was designing rectangular antennas. Most of the testcases involve modeled data, using assumptions and rules of thumb . The hentenna is a rectangular radio antenna with a cross bar tie for antenna leads. The original hentenna was designed for short wave frequencies on the order of 20 to 50 megahertz. Given a design frequency in megahertz, the various dimensions and proportions of the radio antenna are cut at heigth of wavelength(1/2), width of wavelength(1/6), and cross tie of wavelength(1/10). For simplified calculations, the radio wavelength in meters is equal to the speed_of_light in kilometers per second (300) over the radio frequency in megahertz. For an example of a receiving antenna for 100 megahertz and rounded numbers, the expressions below can be pasted into the eTCL console: A rectangular radio antenna or hentenna designed for 99.7 mhz was built from half inch copper pipe. The antenna had sufficiently narrow beamwidth to distinguish between two FM broadcast transmitters about 10 degrees azimuth apart. The hentenna has a horizontally polarized output. The horizontal output cancels out some of the urban noise environment, since many broadcast signals are vertically polarized. ====== namespace path {::tcl::mathop ::tcl::mathfunc} set megafrequency 100. set wavelength [/ 300. $megafrequency ] set wavelength2 [/ $wavelength 2.] set wavelength6 [/ $wavelength 6.] set wavelength10 [/ $wavelength 10.] ====== ---- ***Testcases Section*** In planning any software, it is advisable to gather a number of testcases to check the results of the program. The math for the testcases can be checked by pasting statements in the TCL console. Aside from the TCL calculator display, when one presses the report button on the calculator, one will have console show access to the capacity functions (subroutines). **** Testcase 1 **** %|quantity| calc output| hand solution | comment |% &| frequency megahertz| 500. | 500. | input |& &| antenna height meters| .3| .91 | output |& &| antenna width meters|.1| .28 | output |& &| tie bar height|.06| .21| output|& **** Testcase 2 **** %|quantity| calc output| hand solution | comment |% &| frequency megahertz| 144. | 144. | input |& &| antenna height meters| .34| .314 | output |& &| antenna width meters|1.04| .824 | output |& &| tie bar height|.208| .219| output|& **** Testcase 3 **** %|quantity| calc output| hand solution | comment |% &| frequency megahertz| 99.7| 100. | input |& &| antenna height meters| 1.5| .31 | output |& &| antenna width meters|.5| .11 | output |& &| tie bar height|.3| .6| output|& **** Testcase 4 **** %|quantity| calc output| hand solution | comment |% &| frequency megahertz| 150| 150 | input |& &| antenna height meters| 1.| .9 | output |& &| antenna width meters|.3| .31 | output |& &| tie bar height|.2| .25| output|& **** Testcase 5 **** %|quantity| calc output| hand solution | comment |% &| frequency megahertz| 50. | 50. | input |& &| antenna height meters| 3.| 3.1 | output |& &| antenna width meters|1.| .9 | output |& &| tie bar height|.6| .61| output|& ---- ***Screenshots Section*** ****figure 1.**** [Rectangular Radio Antenna and etcl Slot Calculator Demo Example figure1.png%|% width=600 height=400] ****figure 2.**** [Rectangular Radio Antenna and etcl Slot Calculator Demo Example concepts.png%|% width=600 height=400] ****figure 3.**** [Rectangular Radio Antenna and etcl Slot Calculator Demo Example figure2.png%|% width=600 height=400] ****figure 4.**** [Rectangular Radio Antenna and etcl Slot Calculator Demo Example figure3.png%|% width=600 height=400] ****figure 5.**** [Rectangular Radio Antenna and etcl Slot Calculator Demo Example figure4.png%|% width=600 height=400] ---- ***References:*** * Antennas, Balanis ---- **Appendix Code** ***appendix TCL programs and scripts *** ====== # TCL source code follows # pretty print from autoindent and ased editor # Rectangular Radio Antenna calculator V2 # written on Windows XP on TCL # working under TCL version 8.6 # gold on TCL Club, 12Dec2018 package require Tk package require math::numtheory namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory } set tcl_precision 17 frame .frame -relief flat -bg aquamarine4 pack .frame -side top -fill y -anchor center set names {{} {frequency megahertz:} } lappend names {answers: wavelength meters:} lappend names {wavelengthsq meters sq: } lappend names {surface area meters sq: } lappend names {antenna height meters:} lappend names {antenna width meters: } lappend names {cross tie height meters: } lappend names {corrected height above ground meters:: } foreach i {1 2 3 4 5 6 7 8} { label .frame.label$i -text [lindex $names $i] -anchor e entry .frame.entry$i -width 35 -textvariable side$i grid .frame.label$i .frame.entry$i -sticky ew -pady 2 -padx 1 } proc about {} { set msg "Calculator for Rectangular Radio Antenna from TCL # gold on TCL Club, 12Dec2018 " tk_messageBox -title "About" -message $msg } proc self_help {} { set msg " Rectangular Radio Antenna V2 from TCL , # self help listing # problem, Rectangular Radio Antenna V2 # 1 given follows. 1) frequency megahertz: # Recommended procedure is push testcase and fill frame, # change first three entries etc, push solve, # and then push report. Report allows copy and paste # from console to conventional texteditor. For testcases # testcase number is internal to the calculator and # will not be printed until the report button is pushed # for the current result numbers. # >>> copyright notice <<< # This posting, screenshots, and TCL source code is # copyrighted under the TCL/TK license terms. # Editorial rights and disclaimers # retained under the TCL/TK license terms # and will be defended as necessary in court. Conventional text editor formulas or grabbed from internet screens can be pasted into green console. # gold on TCL Club, 12Dec2018 " tk_messageBox -title "Self_Help" -message $msg } proc calculate { } { global answer2 global side1 side2 side3 side4 side5 global side6 side7 side8 global testcase_number global wavelength wavelength2 global wavelength6 wavelength10 global wavelengthsq surfacearea global megafrequency incr testcase_number set side1 [* $side1 1. ] set side2 [* $side2 1. ] set side3 [* $side3 1. ] set side4 [* $side4 1. ] set side5 [* $side5 1. ] set side6 [* $side6 1. ] set side7 [* $side7 1. ] set side8 [* $side8 1. ] global wavelength wavelength2 global wavelength6 wavelength10 global wavelengthsq surfacearea global megafrequency incr testcase_number set megafrequency $side1 set wavelength [/ 300. $megafrequency ] set wavelength2 [/ $wavelength 2.] set wavelength6 [/ $wavelength 6.] set wavelength10 [/ $wavelength 10.] set wavelengthsq [* $wavelength2 $wavelength2 ] set surfacearea [* $wavelength2 $wavelength6 ] set corrected_height_above_ground [* $wavelength 2.] set side2 $wavelength set side3 $wavelengthsq set side4 $surfacearea set side5 $wavelength2 set side6 $wavelength6 set side7 $wavelength10 set side8 $corrected_height_above_ground } proc fillup {aa bb cc dd ee ff gg hh} { .frame.entry1 insert 0 "$aa" .frame.entry2 insert 0 "$bb" .frame.entry3 insert 0 "$cc" .frame.entry4 insert 0 "$dd" .frame.entry5 insert 0 "$ee" .frame.entry6 insert 0 "$ff" .frame.entry7 insert 0 "$gg" .frame.entry8 insert 0 "$hh" } proc clearx {} { foreach i {1 2 3 4 5 6 7 8 } { .frame.entry$i delete 0 end } } proc reportx {} { global answer2 global side1 side2 side3 side4 side5 global side6 side7 side8 global testcase_number global wavelength wavelength2 global wavelength6 wavelength10 global wavelengthsq surfacearea global megafrequency console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} console eval {wm title . " Rectangular Radio Antenna Report V2, screen grab and paste from console 2 to texteditor"} console eval {. configure -background orange -highlightcolor brown -relief raised -border 30} console show; puts "%|table $testcase_number |printed in| tcl format|% " puts "&| quantity| value| comment, if any|& " puts "&| $testcase_number :|testcase_number | |&" puts "&| $side1 :|frequency megahertz: | |&" puts "&| $side2 :|answers: wavelength meters: | |& " puts "&| $side3 :|wavelengthsq meters sq: | |& " puts "&| $side4 :|surface area meters sq: | |&" puts "&| $side5 :|antenna height meters: | |&" puts "&| $side6 :|antenna width meters: | |&" puts "&| $side7 :|cross tie height meters: | |&" puts "&| $side8 :|corrected height above ground meters: | |&" } frame .buttons -bg aquamarine4 ::ttk::button .calculator -text "Solve" -command { set side8 0 ; calculate } ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 146. 2. 1. .35 1.0981 .34 .205 4.1 } ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 99.7 3.2 2.2 .75 1.5 .5 .3 6.0 } ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 500. .6 .09 .03 .28 .1 .06 1.2 } ::ttk::button .clearallx -text clear -command {clearx } ::ttk::button .about -text about -command {about} ::ttk::button .self_help -text self_help -command { self_help } ::ttk::button .cons -text report -command { reportx } ::ttk::button .exit -text exit -command {exit} pack .calculator -in .buttons -side top -padx 10 -pady 5 pack .clearallx .cons .self_help .about .exit .test4 .test3 .test2 -side bottom -in .buttons grid .frame .buttons -sticky ns -pady {0 10} . configure -background aquamarine4 -highlightcolor brown -relief raised -border 30 wm title . "Rectangular Radio Antenna Calculator V2" ====== *** Pushbutton Operation*** ---- For the push buttons, the recommended procedure is push testcase and fill frame, change first three entries etc, push solve, and then push report. Report allows copy and paste from console. For testcases in a computer session, the eTCL calculator increments a new testcase number internally, eg. TC(1), TC(2) , TC(3) , TC(N). The testcase number is internal to the calculator and will not be printed until the report button is pushed for the current result numbers (which numbers will be cleared on the next solve button.) The command { calculate; reportx } or { calculate ; reportx; clearx } can be added or changed to report automatically. Another wrinkle would be to print out the current text, delimiters, and numbers in a TCL wiki style table as ====== puts " %| testcase $testcase_number | value| units |comment |%" puts " &| volume| $volume| cubic meters |based on length $side1 and width $side2 |&" ====== ---- *** Initial Console Program *** ====== # pretty print from autoindent and ased editor # written on Windows XP on eTCL # working under TCL version 8.6.2 and_or eTCL 1.0.1 # gold on TCL WIKI, 15oct2014 #Console program for rectangular antenna (hentenna in Japan) package require Tk namespace path {::tcl::mathop ::tcl::mathfunc} console show proc antenna {args} { foreach item $args { set megafrequency $item set wavelength [/ 300. $megafrequency ] set wavelength2 [/ $wavelength 2.] set wavelength6 [/ $wavelength 6.] set wavelength10 [/ $wavelength 10.] puts " design fc mhz $megafrequency wavelength $wavelength \ ant. height $wavelength2 ant. width $wavelength6 ant. tie_bar \ height $wavelength10 \n "}} antenna 50. 99.7 144. 150. 500. # output # design fc mhz 50. wavelength 6.0 ant. height 3.0 ant. width 1.0 ant. tie_bar height 0.6 # design fc mhz 99.7 wavelength 3.009 ant. height 1.504 ant. width 0.501 ant. tie_bar height 0.300 # design fc mhz 144. wavelength 2.083 ant. height 1.041 ant. width 0.347 ant. tie_bar height 0.208 # design fc mhz 150. wavelength 2.0 ant. height 1.0 ant. width 0.333 ant. tie_bar height 0.2 # design fc mhz 500. wavelength 0.6 ant. height 0.3 ant. width 0.099 ant. tie_bar height 0.06 ====== ---- [gold] This page is copyrighted under the TCL/TK license terms, [http://tcl.tk/software/tcltk/license.html%|%this license]. **Comments Section** <> Please place any comments with the courtesy of your wiki MONIKER and date here, Thanks, [gold] 12DEC2018 <> Numerical Analysis | Toys | Calculator | Mathematics| Example| Toys and Games | Games | Application | GUI ---- <> Development | Concept| Algorithm