Testing reception quality: Difference between revisions

From LinuxTVWiki
Jump to navigation Jump to search
(→‎How?: perl signaltest.pl)
(Undo revision 33403 by Walter- (talk))
 
(20 intermediate revisions by 8 users not shown)
Line 1: Line 1:
= Analogue TV specific tests=
== Testing all channels and get an average ==
=== Why? When? ===
Script that gets you all channels and averages everything


=DVB specific tests=
== Testing all channels and get an average ==
'''Why? When?'''<br>
Can be good when doing major changes to the installation, like replacing cables or installing a masthead amplifier. Create a baseline, then compare.
Can be good when doing major changes to the installation, like replacing cables or installing a masthead amplifier. Create a baseline, then compare.



=== Script ===
=== Script ===
This following script gets you all channels and averages everything


#!/usr/bin/perl -w
#!/usr/bin/perl -w
# Original script from José Oliver Segura <primijos@gmail.com>
# Original script from José Oliver Segura
# From Hex to % for signal strength by Nicolas Will <nico@youplala.net> Feb. 1, 2008
# From Hex to % for signal strength by Nicolas Will, with help from GT, Feb. 1, 2008
# License unknown....
# License unknown....
# Make sure that the tzap and channels.conf locations are correct
# Make sure that the tzap and channels.conf locations are correct
#
# Changes 2009-04-21
# * moved channel.conf variable to beginning of script
# * applied channel.conf to tzap arguments
# * removed unused variables channelsFEC1 and channelsFEC2
# * added ignoring of first X output lines to let tuner/decoder settle
# * sorting output by frequency
# * changed formating of output to be more readable
# * added samplesPerChannel variable (used to be hard coded 10)
use strict;
use warnings;
my $tzap = "/usr/bin/tzap";
#use strict;
my $channelsConf = "$ENV{HOME}/.tzap/channels.conf";
my $ignoreFirstLines = 2 ; # sometimes ber/unc can be be extremely high after switching to a new channel
my $samplesPerChannel = 10 ;
my($tzap) = "/usr/bin/tzap";
my $tzapArgs = "-r -c $channelsConf";
my @channels;
my($tzapArgs) = "-r";
my(@channels);
my %channelsHz;
my(%channelsHz);
my %signalFreqAcum;
my(%channelsFEC1);
my %signalFreqCount;
my(%channelsFEC2);
my %berFreqAcum;
my(%signalFreqAcum);
my %berFreqCount;
my(%signalFreqCount);
my %uncFreqAcum;
my(%berFreqAcum);
my %uncFreqCount;
my(%berFreqCount);
my(%uncFreqAcum);
my(%uncFreqCount);
sub loadChannels() {
sub loadChannels() {
my $file = $ENV{"HOME"} . "/.tzap/channels.conf";
my $file = $channelsConf;
open (CHANNELS,"< $file") or die $!;
open (CHANNELS,'<',$file) or die $!;
while (<CHANNELS>) {
while (<CHANNELS>) {
chomp;
chomp;
@_ = split (/:/,$_);
my ($channelName,$value) = split (/:/);
my $channelName = $_[0];
$channelsHz{$channelName} = $value;
$channelsHz{$channelName} = $_[1];
$channelsFEC1{$channelName} = $_[4];
$channelsFEC2{$channelName} = $_[5];
push(@channels,$channelName);
push(@channels,$channelName);
}
}
Line 45: Line 55:
}
}
&loadChannels();
loadChannels();
print "Starting...\n";
print "Starting...\n";
my $channel;
foreach my $channel (@channels) {
foreach $channel (@channels) {
my $count = 0;
my $count = 0;
my $ignore = $ignoreFirstLines;
my $freq = $channelsHz{$channel};
my $freq = $channelsHz{$channel};
my $fec1 = $channelsFEC1{$channel};
my $fec2 = $channelsFEC2{$channel};
print "================================================================================";
print "================================================================================";
Line 58: Line 66:
print "Tunning channel $channel ($freq)\n";
print "Tunning channel $channel ($freq)\n";
my $zapPid = open ZAP, "$tzap $tzapArgs \"$channel\" 2>&1 |" or die $! . ": $tzap $tzapArgs \"$channel\"";
my $zapPid = open ZAP, "$tzap $tzapArgs \"$channel\" 2>&1 |" or die $! . ": $tzap $tzapArgs \"$channel\"";
while ( $count < 10 && defined( my $line = <ZAP> ) ) {
while ( $count < $samplesPerChannel && defined( my $line = <ZAP> ) ) {
chomp($line);
chomp($line);
if ($line =~ /FE_HAS_LOCK/) {
if ($line =~ /FE_HAS_LOCK/) {
if ($ignore > 0 ) {
print "$line (Ignoring to let tuner/decoder settle.($ignore)\n";
$ignore--;
next;
}
#print "$line\n";
#print "$line\n";
$count++;
$count++;
Line 86: Line 99:
print "Summary statistics:\n";
print "Summary statistics:\n";
print "Frequency\tSignal\tBer \tUnc\n";
print "Frequency\tSignal \tBer \tUnc\n";
print "=========\t======\t========\t========\n";
print "=========\t========\t========\t========\n";
foreach my $freq (sort(keys(%signalFreqAcum))) {
my $freq;
foreach $freq (keys(%signalFreqAcum)) {
print "$freq\t";
print "$freq\t";
print int($signalFreqAcum{$freq}/$signalFreqCount{$freq}/65536*100)." %";
printf "%6.1f %%",$signalFreqAcum{$freq}/$signalFreqCount{$freq}/65536*100;
print "\t";
print "\t";
#printf "%08x",$berFreqAcum{$freq}/$berFreqCount{$freq};
printf "%8.1f",$berFreqAcum{$freq}/$berFreqCount{$freq};
print $berFreqAcum{$freq}/$berFreqCount{$freq};
print "\t";
print "\t";
printf "%08x",$uncFreqAcum{$freq}/$uncFreqCount{$freq};
printf "%8.1f",$uncFreqAcum{$freq}/$uncFreqCount{$freq};
print "\n";
print "\n";
}
}
Line 102: Line 113:
Original author: José Oliver Segura
Original author: José Oliver Segura


It requires a channels.conf file, [[tzap]]. Also veryfy the locations of programs and files in the above code.


Its usage is as such:
=== How? ===

Requirements: a channels.conf file, tzap, veryfy the locations of programs and files in the code.

Usage:
perl signaltest.pl
perl signaltest.pl
Which produces output similar to the following sample:

=== Sample output ===


================================================================================
================================================================================
Tunning channel TopUp Anytime3 (722166670)
Tunning channel DSF (754000000)
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
tuning to 722166670 Hz
tuning to 754000000 Hz
video pid 0x0000, audio pid 0x0000
video pid 0x0081, audio pid 0x0082
status 07 | signal 5cbf | snr 0000 | ber 001fffff | unc 00000000 |
Signal: 42% BER 2097151 UNC 0
status 1f | signal 5c99 | snr 0000 | ber 000002f0 | unc 00000000 | FE_HAS_LOCK (Ignoring to let tuner/decoder settle.(2)
Signal: 43% BER 0 UNC 0
status 1f | signal 5db6 | snr 0000 | ber 00000160 | unc 00000000 | FE_HAS_LOCK (Ignoring to let tuner/decoder settle.(1)
Signal: 42% BER 240 UNC 0
Signal: 43% BER 1232 UNC 0
Signal: 36% BER 1664 UNC 0
Signal: 42% BER 192 UNC 0
Signal: 36% BER 84272 UNC 254
Signal: 43% BER 256 UNC 0
Signal: 37% BER 30176 UNC 493
Signal: 43% BER 416 UNC 0
Signal: 36% BER 27808 UNC 334
Signal: 43% BER 240 UNC 0
Signal: 36% BER 4528 UNC 185
Signal: 43% BER 592 UNC 0
Signal: 37% BER 400 UNC 20
Signal: 43% BER 368 UNC 0
Signal: 38% BER 464 UNC 2
Signal: 38% BER 816 UNC 0
Signal: 37% BER 1808 UNC 18
Signal: 36% BER 7952 UNC 18
================================================================================
Tunning channel n-tv (778000000)
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
tuning to 778000000 Hz
video pid 0x0101, audio pid 0x0102
status 07 | signal 3e01 | snr 0000 | ber 001fffff | unc 00000188 |
status 1f | signal 3e4f | snr 0000 | ber 00000000 | unc 0000000a | FE_HAS_LOCK (Ignoring to let tuner/decoder settle.(2)
status 1f | signal 3efa | snr 0000 | ber 00000000 | unc 0000000a | FE_HAS_LOCK (Ignoring to let tuner/decoder settle.(1)
Signal: 24% BER 0 UNC 0
Signal: 24% BER 0 UNC 0
Signal: 24% BER 0 UNC 0
Signal: 24% BER 0 UNC 0
Signal: 23% BER 0 UNC 0
Signal: 24% BER 0 UNC 0
Signal: 24% BER 0 UNC 0
Signal: 23% BER 0 UNC 0
Signal: 24% BER 0 UNC 0
Signal: 24% BER 0 UNC 0
Summary statistics:
Summary statistics:
Frequency Signal Ber Unc
Frequency Signal Ber Unc
========= ====== ======== ========
========= ======== ======== ========
177500000 68.4 % 9121.6 0.0
713833330 38 % 209715 00000000
191500000 88.4 % 0.0 0.0
634000000 41 % 214722 00000000
506000000 58.9 % 0.0 0.0
658000000 41 % 209715 00000000
522000000 80.5 % 0.0 0.0
578000000 51 % 209715 00000000
570000000 47.3 % 30.4 0.0
546000000 46 % 209715 00000000
658000000 45.1 % 15747.2 0.0
722166670 43 % 210289 00000000
754000000 37.0 % 15988.8 132.4
778000000 24.3 % 0.0 0.0

While it's desirable to not have any errors, what really matters is how UNC changes over the measurement interval.
Nonzero, but not increasing, UNC values are ok.


== Test a channel continuously ==
== Test a channel continuously ==
=== Why? When? ===
'''Why? When?'''<br>
Having the ability to monitor signal strength is highly useful when pointing/positioning an antenna. Here are two methods:


===Using femon===
Script that takes a channel and gives continuous results.
Recent versions of femon, a command line utility included in the [[LinuxTV_dvb-apps]] package, have this functionality built-in, and simply require the user to run:


femon -H
Can be good when pointing the antenna.


which provides "human readable" output, as opposed to the default Hexadecimal representation of the varying attributes of the signal.


=== Script ===
=== Script ===
This following script tunes a channel and simply converts the Signal strength into a percentage in the tzap output.


#!/usr/bin/env python
#!/usr/bin/env python
Line 161: Line 199:
# Sig Strength
# Sig Strength
sigStr = fields[1].split(" ")[1]
sigStr = fields[1].split(" ")[1]
sig = int(sigStr, 16) / float(int('ffff', 16))
sig = int(sigStr, 16) / float(0xffff)
fields[1] = "signal %.1f%%" % (sig * 100.0)
fields[1] = "signal %.1f%%" % (sig * 100.0)
Line 170: Line 208:
print " | ".join(fields)
print " | ".join(fields)


Original author: Matt Doran
Original author is : Matt Doran


It requires a channels.conf file, and [[tzap]]. It would be used by running:
tzap channel 2>&1 | tzapfilter.py
which would produce output like the sample shown below:
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
tuning to 578000000 Hz
video pid 0x0000, audio pid 0x0000
status 1f | signal 51.0% | snr 0000 | ber 02097151 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 0000000f | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.0% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.0% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.0% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK


=== How? ===
=Also See=
* [http://www.ivtvdriver.org/index.php/Howto:Improve_signal_quality Improving signal quality]

Requirements: a channels.conf file, tzap

Usage:
tzap channel | tzapfilter.py



[[Category:Software]]
=== Sample output ===

Latest revision as of 22:39, 4 June 2014

Analogue TV specific tests

DVB specific tests

Testing all channels and get an average

Why? When?
Can be good when doing major changes to the installation, like replacing cables or installing a masthead amplifier. Create a baseline, then compare.

Script

This following script gets you all channels and averages everything

#!/usr/bin/perl -w

# Original script from José Oliver Segura
# From Hex to % for signal strength by Nicolas Will, with help from GT, Feb. 1, 2008
# License unknown....
# Make sure that the tzap and channels.conf locations are correct
#
# Changes 2009-04-21
#   * moved channel.conf variable to beginning of script
#   * applied channel.conf to tzap arguments
#   * removed unused variables channelsFEC1 and channelsFEC2
#   * added ignoring of first X output lines to let tuner/decoder settle
#   * sorting output by frequency
#   * changed formating of output to be more readable
#   * added samplesPerChannel variable (used to be hard coded 10)

use strict;
use warnings;

my $tzap = "/usr/bin/tzap";
my $channelsConf = "$ENV{HOME}/.tzap/channels.conf";
my $ignoreFirstLines = 2 ; # sometimes ber/unc can be be extremely high after switching to a new channel
my $samplesPerChannel = 10 ;

my $tzapArgs = "-r -c $channelsConf";
my @channels;
my %channelsHz;
my %signalFreqAcum;
my %signalFreqCount;
my %berFreqAcum;
my %berFreqCount;
my %uncFreqAcum;
my %uncFreqCount;

sub loadChannels() {
        my $file = $channelsConf;
        open (CHANNELS,'<',$file) or die $!;
        while (<CHANNELS>) {
                chomp;
                my ($channelName,$value) = split (/:/);
		 $channelsHz{$channelName} = $value;
                push(@channels,$channelName);
        }
        close CHANNELS;
}

loadChannels();
print "Starting...\n";
foreach my $channel (@channels) {
	my $count = 0;
	my $ignore = $ignoreFirstLines;
	my $freq = $channelsHz{$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 < $samplesPerChannel && defined( my $line = <ZAP> )  ) {
     		chomp($line);
		if ($line =~ /FE_HAS_LOCK/) {
			if ($ignore > 0 ) {
				print "$line (Ignoring to let tuner/decoder settle.($ignore)\n";
				$ignore--;
				next;
			}
     			#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";
foreach my $freq (sort(keys(%signalFreqAcum))) {
	print "$freq\t";
	printf "%6.1f %%",$signalFreqAcum{$freq}/$signalFreqCount{$freq}/65536*100;
	print "\t";
	printf "%8.1f",$berFreqAcum{$freq}/$berFreqCount{$freq};
	print "\t";
	printf "%8.1f",$uncFreqAcum{$freq}/$uncFreqCount{$freq};
	print "\n";
}

Original author: José Oliver Segura

It requires a channels.conf file, tzap. Also veryfy the locations of programs and files in the above code.

Its usage is as such:

perl signaltest.pl

Which produces output similar to the following sample:

================================================================================
Tunning channel DSF (754000000)
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
tuning to 754000000 Hz
video pid 0x0081, audio pid 0x0082
status 07 | signal 5cbf | snr 0000 | ber 001fffff | unc 00000000 |
status 1f | signal 5c99 | snr 0000 | ber 000002f0 | unc 00000000 | FE_HAS_LOCK (Ignoring to let tuner/decoder settle.(2)
status 1f | signal 5db6 | snr 0000 | ber 00000160 | unc 00000000 | FE_HAS_LOCK (Ignoring to let tuner/decoder settle.(1)
Signal: 36%     BER 1664        UNC 0
Signal: 36%     BER 84272       UNC 254
Signal: 37%     BER 30176       UNC 493
Signal: 36%     BER 27808       UNC 334
Signal: 36%     BER 4528        UNC 185
Signal: 37%     BER 400 UNC 20
Signal: 38%     BER 464 UNC 2
Signal: 38%     BER 816 UNC 0
Signal: 37%     BER 1808        UNC 18
Signal: 36%     BER 7952        UNC 18

================================================================================
Tunning channel n-tv (778000000)
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
tuning to 778000000 Hz
video pid 0x0101, audio pid 0x0102
status 07 | signal 3e01 | snr 0000 | ber 001fffff | unc 00000188 |
status 1f | signal 3e4f | snr 0000 | ber 00000000 | unc 0000000a | FE_HAS_LOCK (Ignoring to let tuner/decoder settle.(2)
status 1f | signal 3efa | snr 0000 | ber 00000000 | unc 0000000a | FE_HAS_LOCK (Ignoring to let tuner/decoder settle.(1)
Signal: 24%     BER 0   UNC 0
Signal: 24%     BER 0   UNC 0
Signal: 24%     BER 0   UNC 0
Signal: 24%     BER 0   UNC 0
Signal: 23%     BER 0   UNC 0
Signal: 24%     BER 0   UNC 0
Signal: 24%     BER 0   UNC 0
Signal: 23%     BER 0   UNC 0
Signal: 24%     BER 0   UNC 0
Signal: 24%     BER 0   UNC 0

Summary statistics:
Frequency       Signal          Ber             Unc
=========       ========        ========        ========
177500000         68.4 %          9121.6             0.0
191500000         88.4 %             0.0             0.0
506000000         58.9 %             0.0             0.0
522000000         80.5 %             0.0             0.0
570000000         47.3 %            30.4             0.0
658000000         45.1 %         15747.2             0.0
754000000         37.0 %         15988.8           132.4
778000000         24.3 %             0.0             0.0

While it's desirable to not have any errors, what really matters is how UNC changes over the measurement interval. Nonzero, but not increasing, UNC values are ok.

Test a channel continuously

Why? When?
Having the ability to monitor signal strength is highly useful when pointing/positioning an antenna. Here are two methods:

Using femon

Recent versions of femon, a command line utility included in the LinuxTV_dvb-apps package, have this functionality built-in, and simply require the user to run:

femon -H

which provides "human readable" output, as opposed to the default Hexadecimal representation of the varying attributes of the signal.

Script

This following script tunes a channel and simply converts the Signal strength into a percentage in the tzap output.

#!/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(0xffff)
               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 is : Matt Doran

It requires a channels.conf file, and tzap. It would be used by running:

tzap channel 2>&1 | tzapfilter.py

which would produce output like the sample shown below:

using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
tuning to 578000000 Hz
video pid 0x0000, audio pid 0x0000
status 1f | signal 51.0% | snr 0000 | ber 02097151 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 0000000f | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.0% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.0% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.0% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 51.1% | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK

Also See