#!/usr/bin/env perl # Design a class C / L network RF amplifier using Coldsolderjoint'ola MRF # devices and the little smith chart snippet included in their data books. # only works for -j currently $pi = atan2(1,1) * 4; sub Input_Example { print "\33[H\33[J". " Transistor \n". " RF Input Impedance Matching Network (series equivalent)\n\n". " Rshunt (50 ohms) -j \n". " ___________ \n". " +-----/\\/\\/\\---| |--------| |--+ \n". " | | Z Input | | \n". " | | Matching | [ ] Rseries \n". " RF |__________| [ ] \n". " Input [ ] \n". " | | \n". " | | \n". " +---------------------------------------+--> Ground \n\n"; } sub Output_Example { print "\33[H\33[J". " Transistor \n". " (series equivalent) RF Ouput Impedance Matching Network \n\n". " -j \n". " __________ \n". " +--| |----------| |-------------+ \n". " | | Z Output | | \n". " [ ] Rseries | Matching | [ ] Rshunt (50 ohms) \n". " [ ] |__________| [ ] \n". " [ ] [ ] \n". " | | \n". " | | \n". " +----------------------------------------+--> Ground \n\n"; } sub Input_Match { print "\33[H\33[J". " RF Input Impedance Matching Network | \n". " | \n". " Rshunt Cbypass L1 | / Co \n". " Ba |/ \n". " +-----/\\/\\/\\----| |---+--()()()----+-------| \n". " | | | | \n". " | | ( ) |\\ \n". " RF - C1 ( ) \\ \n". " Input - ( ) | \n". " | | RFC | | Em \n". " | | | | \n". " +---------------------+------------+----------+--> Ground \n\n"; printf " Rshunt : %s ohms\n". " Frequency : %s MHz\n\n". " C1 : %.6f uF\n". " : %.4f pF\n",$rp,$frq,$c * 1000000, $c * 1000000000000; printf " L1 : %.6f uH\n". " : %.4f nH\n\n",$l * 1000000,$l * 1000000000; } sub Output_Match { print "\33[H\33[J". " | L2 Cbypass \n". " | \n". " Co +---------------()()()---+---| |------+ \n". " | | | \n". " | / | | \n". " Ba |/ | | \n". " ------| - C2 [ ] Rshunt \n". " |\\ _ [ ] \n". " \\ | [ ] \n". " Em | | | \n". " | | | \n". " +------------------------+------------+--> Ground \n\n"; printf " Rshunt : %s ohms\n". " Frequency : %s MHz\n\n". " C2 : %.6f uF\n". " : %.6f pF\n",$rp,$frq,$c * 1000000, $c * 1000000000000; printf " L2 : %.6f uH\n". " : %.6f nH\n\n",$l * 1000000,$l * 1000000000; } sub Specs { print "\n"; while (!$rp) { print "Enter $VAL shunt resistance (Rshunt in ohms): "; chomp($rp = ); $rp =~ tr/0-9.//csd; } print "\n"; while (!$rs) { print "Enter $VAL series resistance (Rseries in ohms): "; chomp($rs = ); $rs =~ tr/0-9.//csd; } print "\n"; while (!$j) { print "Enter $VAL capacitive reactance (-j in ohms): "; chomp($j = ); $j =~ tr/0-9.//csd; } $qs = sqrt (($rp / $rs) - 1); $xs = $rs * $qs; $xp = $rp / $qs; $c = 1 / (2 * $pi * ($frq * 1000000) * $xp); $l = ($xs + $j) / (2 * $pi * ($frq * 1000000)); #$cb = $qs * $l; } #### Start &Input_Example; print "\n"; while (!$frq) { print "Enter frequency (in MHz): "; chomp($frq = ); $frq =~ tr/0-9.//csd; } &Specs($VAL = "INPUT"); &Input_Match; print "Press ENTER to continue..."; chomp($_ = ); undef $rp, undef $rs; undef $j; &Output_Example; &Specs($VAL = "OUTPUT"); &Output_Match;