**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 in your comment with the same courtesy that I will give you. Its very hard to reply intelligibly without some background of the correspondent. Thanks,[gold] ---- <> **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 *** ====== # pretty print from autoindent and ased editor # rectangular radio antenna calculator # written on Windows XP on eTCL # working under TCL version 8.5.6 and eTCL 1.0.1 # gold on TCL WIKI , 9feb2014 package require Tk namespace path {::tcl::mathop ::tcl::mathfunc} frame .frame -relief flat -bg aquamarine4 pack .frame -side top -fill y -anchor center set names {{} {frequency megahertz:} } lappend names {answer: wavelength meters:} lappend names {wavelengthsq meters sq: } lappend names {surface area meters sq: } lappend names {answer: antenna height meters} lappend names {antenna width meters:} lappend names {cross tie height meters: } foreach i {1 2 3 4 5 6 7} { 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 WIKI, written on eTCL " tk_messageBox -title "About" -message $msg } proc calculate { } { global answer2 global side1 side2 side3 side4 side5 global side6 side7 testcase_number 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 side2 $wavelength set side3 $wavelengthsq set side4 $surfacearea set side5 $wavelength2 set side6 $wavelength6 set side7 $wavelength10 } proc fillup {aa bb cc dd ee ff gg} { .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"} proc clearx {} { foreach i {1 2 3 4 5 6 7} { .frame.entry$i delete 0 end } } proc reportx {} { global side1 side2 side3 side4 side5 global side6 side7 testcase_number global wavelengthsq surfacearea global megafrequency console show; puts "testcase number: $testcase_number " puts "frequency (f) megahertz: $side1 " puts "wavelength (w) meters: $side2 " puts "wavelengthsq (w*w) meters sq: $side3 " puts "surfacearea meters sq (h*w) : $side4 " puts "wavelength/2 meters: $side5 " puts "wavelength/6 meters: $side6 " puts "wavelength/10 meters: $side7 " } frame .buttons -bg aquamarine4 ::ttk::button .calculator -text "Solve" -command { calculate } ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 146. 2. 1. .35 1.0981 .34 .205 } ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 99.7 3.2 2.2 .75 1.5 .5 .3 } ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 500. .6 .09 .03 .28 .1 .06 } ::ttk::button .clearallx -text clear -command {clearx } ::ttk::button .about -text about -command about ::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 .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 " ====== *** 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 here, Thanks. <> Numerical Analysis | Toys | Calculator | Mathematics| Example