#!/usr/bin/env perl # fm class calculator sub Print { printf "\n\nFM Station Class %s\n". "-------------------\n\n",\$class; printf " Maximum ERP : %.1f kW\n\n",\$kw; printf " Maximum HAAT : %d meters (%.2f feet)\n\n",\$haat,(3.281 * \$haat); printf " Primary service : %d dBu, %.2f mV/m\n". " contour\n\n",\$dbu,\$mvm; printf " Distance to primary : %.2f km (%.2f miles)\n". " service contour\n\n",\$pro,\$prom; printf " Distance to 70 dBu : %.2f km (%.2f miles)\n". " or 3.16 mV/m\n contour\n\n",\$db70,\$db70m; } print "\n\n\t\tFM Station Classes and Service Contours\n\n"; while (!\$_) { SEL: print "Enter FM station class (a,b,b1,c3,c2,c1,c): "; chomp(\$_ = ); } if (/^a/i) { \$class = "A"; \$kw = 6; \$haat = 100; \$dbu = 60; \$mvm = 1; \$pro = 28.3; \$prom = \$pro / 1.609; \$db70 = 16.2; \$db70m = \$db70 / 1.609; } elsif (/^b1/i) { \$class = "B1"; \$kw = 25; \$haat = 100; \$dbu = 57; \$mvm = 0.71; \$pro = 44.7; \$prom = \$pro / 1.609; \$db70 = 23.2; \$db70m = \$db70 / 1.609; } elsif (/^b/i) { \$class = "B"; \$kw = 50; \$haat = 150; \$dbu = 54; \$mvm = 0.50; \$pro = 65.1; \$prom = \$pro / 1.609; \$db70 = 32.6; \$db70m = \$db70 / 1.609; } elsif (/^c3/i) { \$class = "C3"; \$kw = 25; \$haat = 100; \$dbu = 60; \$mvm = 1; \$pro = 39.1; \$prom = \$pro / 1.609; \$db70 = 23.2; \$db70m = \$db70 / 1.609; } elsif (/^c2/i) { \$class = "C2"; \$kw = 50; \$haat = 150; \$dbu = 60; \$mvm = 1; \$pro = 52.2; \$prom = \$pro / 1.609; \$db70 = 32.6; \$db70m = \$db70 / 1.609; } elsif (/^c1/i) { \$class = "C1"; \$kw = 100; \$haat = 299; \$dbu = 60; \$mvm = 1; \$pro = 72.3; \$prom = \$pro / 1.609; \$db70 = 50; \$db70m = \$db70 / 1.609; } elsif (/^c/i) { \$class = "C"; \$kw = 100; \$haat = 600; \$dbu = 60; \$mvm = 1; \$pro = 91.8; \$prom = \$pro / 1.609; \$db70 = 67.7; \$db70m = \$db70 / 1.609; } else { goto SEL; } &Print;