Testing reception quality
Jump to navigation
Jump to search
Testing all channels and get an average
Why? When?
Script that gets you all channels and averages everything
Can be good when doing major changes to the installation, like replacing cables or installing a masthead amplifier. Create a baseline, then compare.
Script
#!/usr/bin/perl -w # Original script from José Oliver Segura <primijos@gmail.com> # From Hex to % for signal strength by Nicolas Will <nico@youplala.net> Feb. 1, 2008 # License unknown.... # Make sure that the tzap and channels.conf locations are correct #use strict; my($tzap) = "/usr/bin/tzap"; my($tzapArgs) = "-r"; my(@channels); my(%channelsHz); my(%channelsFEC1); my(%channelsFEC2); my(%signalFreqAcum); my(%signalFreqCount); my(%berFreqAcum); my(%berFreqCount); my(%uncFreqAcum); my(%uncFreqCount); sub loadChannels() { my $file = $ENV{"HOME"} . "/.tzap/channels.conf"; open (CHANNELS,"< $file") or die $!; while (<CHANNELS>) { chomp; @_ = split (/:/,$_); my $channelName = $_[0]; $channelsHz{$channelName} = $_[1]; $channelsFEC1{$channelName} = $_[4]; $channelsFEC2{$channelName} = $_[5]; push(@channels,$channelName); } close CHANNELS; } &loadChannels(); print "Starting...\n"; my $channel; foreach $channel (@channels) { my $count = 0; my $freq = $channelsHz{$channel}; my $fec1 = $channelsFEC1{$channel}; my $fec2 = $channelsFEC2{$channel}; print "================================================================================"; print "\n"; print "Tunning channel $channel ($freq)\n"; my $zapPid = open ZAP, "$tzap $tzapArgs \"$channel\" 2>&1 |" or die $! . ": $tzap $tzapArgs \"$channel\""; while ( $count < 10 && defined( my $line = <ZAP> ) ) { chomp($line); if ($line =~ /FE_HAS_LOCK/) { #print "$line\n"; $count++; ## ## status 1f | signal a1ae | snr 0000 | ber 00000000 | unc 00000012 | FE_HAS_LOCK ## $line =~ /.+signal (....).+ber (........).+unc (........).+/; my $signal = hex $1; my $ber = hex $2; my $unc = hex $3; $signalFreqAcum{$freq} += $signal; $signalFreqCount{$freq}++; $berFreqAcum{$freq} += $ber; $berFreqCount{$freq}++; $uncFreqAcum{$freq} += $unc; $uncFreqCount{$freq}++; print join("\t","Signal: ".int($signal/65536*100)."%","BER ".$ber,"UNC ".$unc),"\n"; } else { print "$line\n"; } } close ZAP; print "\n"; } print "Summary statistics:\n"; print "Frequency\tSignal\tBer \tUnc\n"; print "=========\t======\t========\t========\n"; my $freq; foreach $freq (keys(%signalFreqAcum)) { print "$freq\t"; print int($signalFreqAcum{$freq}/$signalFreqCount{$freq}/65536*100)." %"; print "\t"; #printf "%08x",$berFreqAcum{$freq}/$berFreqCount{$freq}; print $berFreqAcum{$freq}/$berFreqCount{$freq}; print "\t"; printf "%08x",$uncFreqAcum{$freq}/$uncFreqCount{$freq}; print "\n"; }
Original author: José Oliver Segura
How? =
Requirements: a channels.conf file, tzap, veryfy the locations of programs and files in the code.
Usage:
tzap channel | tzapfilter.py
Sample output
Test a channel continuously
Why? When?
Script that takes a channel and gives continuous results.
Can be good when pointing the antenna.
Script
#!/usr/bin/env python import sys f = sys.stdin while True: l = f.readline().strip() fields = l.split(" | ") if len(fields) < 2: print l else: # Sig Strength sigStr = fields[1].split(" ")[1] sig = int(sigStr, 16) / float(int('ffff', 16)) fields[1] = "signal %.1f%%" % (sig * 100.0) # BER berStr = fields[3].split(" ")[1] ber = int(berStr, 16) fields[3] = "ber %08d" % (ber) print " | ".join(fields)
Original author: Matt Doran
How?
Requirements: a channels.conf file, tzap
Usage:
tzap channel | tzapfilter.py