source: ntrip/trunk/BNC/scripts/getGlonassFrequencies.pl@ 10503

Last change on this file since 10503 was 9668, checked in by wiese, 3 years ago

ADD: script for parsing GLO frequencies from BNC log file

  • Property svn:executable set to *
  • Property svn:keywords set to Header
File size: 1.8 KB
RevLine 
[9668]1#!/usr/bin/env perl
2
3#
4# getGlonassFrequencies.pl - parse GLONASS slot & freq information from a logfile written by BNC in scanRTCM mode
5#
6# Revision: $Header: trunk/BNC/scripts/getGlonassFrequencies.pl 9668 2022-03-23 12:51:45Z wiese $
7#
8
9use strict;
10use warnings;
11
12my $scanRTCMlogfile = shift @ARGV;
13defined ($scanRTCMlogfile) || die ( HELP_MESSAGE(), "\n" );
14
15my %frq_of = parseGloFrequencies($scanRTCMlogfile);
16die ("no GLO frequencies found in $scanRTCMlogfile\n") if ( scalar ( keys %frq_of ) < 1 );
17
18foreach ( sort { $a <=> $b } keys %frq_of ) {
19 print STDOUT $_ . ' ' . $frq_of{$_} . "\n";
20}
21
22# 22-03-23 08:46:19 USCL00CHL0: GLONASS Slot:Freq R07:5 R08:6 R12:-1 R13:-2 R14:-7 R17:4 R23:3 R24:2
23sub parseGloFrequencies {
24 my ($logfile) = @_;
25
26 my %frq_of = ();
27 open ( my $inp, '<', $logfile ) || die "could not open file '$logfile': $!\n";
28 while ( my $ln = <$inp> ) {
29 chomp $ln;
30 next unless ( $ln =~ /GLONASS Slot:Freq/ );
31 my $idx = index ( $ln, "Freq", 30 );
32 next unless ($idx);
33 my $slotsStr = substr ( $ln, $idx + 5 );
34 $slotsStr =~ s/^[\s]*//g;
35 my @hlp = split ( /\s+/, $slotsStr );
36 foreach (@hlp) {
37 my ( $sat, $frq ) = split ( ":", $_, 2 );
38 my $satNr = int ( substr ( $sat, 1 ) );
39 if ( exists $frq_of{$satNr} && $frq_of{$satNr} != $frq ) {
40 warn ("frq differs for existing $sat:$frq_of{$satNr} in line: $ln\n");
41 }
42 $frq_of{$satNr} = int ($frq);
43 }
44 }
45 close ($inp);
46 return %frq_of;
47}
48
49sub HELP_MESSAGE {
50 print <<EOI_KURZHILFE;
51getGlonassFrequencies.pl - Parse GLONASS slot & freq information from a logfile written by BNC in scanRTCM mode
52
53Usage: getGlonassFrequencies.pl /path/to/BNC-logfile
54
55Arguments:
56 -h|--help print help
57 -BNC-logfile BNC-logfile with activated scanRTCM mode
58
59Copyright (c) 2022 BKG Frankfurt <Erwin.Wiesensarter\@bkg.bund.de>
60EOI_KURZHILFE
61}
62
Note: See TracBrowser for help on using the repository browser.