5 # copyright (c) 1999 Steve Franke K9AN
10 my ($self, $line) = @_;
13 my @f = split /\s+/, $line;
14 my $satname = uc shift @f;
15 my $numhours = shift @f; # the number of hours ahead to print
16 my $step = shift @f; # tracking table resolution in minutes
18 # default hours and step size
19 $numhours = 3 unless $numhours && $numhours =~ /^\d+$/;
20 $step = 5 unless $step && $step =~ /^\d+$/;
22 # get nearest lat and long (I can see we will need the altitude here soon as well :-)
23 my $lat = $self->user->lat;
24 my $lon = $self->user->long;
26 my $call = $self->call;
27 unless ($lon || $lat) {
28 $lat = $main::mylatitude;
29 $lon = $main::mylongitude;
30 $call = $main::mycall;
33 if ($satname && $Sun::keps{$satname}) {
34 my $jtime; # lats and longs in radians
35 my ($sec, $min, $hr, $day, $mon, $yr) = (gmtime($main::systime))[0,1,2,3,4,5];
36 #printf("%2.2d %2.2d %2.2d %2.2d %2.2d\n",$min,$hr,$day,$mon,$yr);
42 $jtime=Sun::Julian_Day($yr,$mon,$day)+$hr/24+$min/60/24;
43 ($yr,$mon,$day,$hr,$min)=Sun::Calendar_date_and_time_from_JD($jtime);
44 #printf("%2.2d %2.2d %2.2d %2.2d %2.2d\n",$min,$hr,$day,$mon,$yr);
45 push @out, $self->msg("pos", $call, slat($lat), slong($lon));
46 push @out, $self->msg("sat1", $satname, $numhours, $step);
47 push @out, $self->msg("sat2");
49 my ($slat,$slon,$salt,$az,$el,$distance)=Sun::get_satellite_pos($jtime,$lat*$d2r,$lon*$d2r,$alt,$satname);
50 # print the current satellite position
51 push @out,sprintf("Now %2.2d:%2.2d %7.1f %7.1f %7.1f %7.1f %7.1f %7.1f",
52 $hr,$min,$slat*$r2d,$slon*$r2d,$salt,
53 $az*$r2d,$el*$r2d,$distance);
56 $jtime=$jtime+$step/24/60;
57 my $disc = 0; # discontinuity flag
58 while ( $numsteps < $numhours*60/$step ) # look $numhours ahead for tracking table
60 my ($yr,$mon,$day,$hr,$min)=Sun::Calendar_date_and_time_from_JD($jtime);
61 my ($slat,$slon,$salt,$az,$el,$distance)=Sun::get_satellite_pos($jtime,$lat*$d2r,$lon*$d2r,$alt,$satname);
62 if ( $el*$r2d > -5 ) {
65 push @out, $self->msg("satdisc");
67 push @out,sprintf("%2.2d/%2.2d %2.2d:%2.2d %7.1f %7.1f %7.1f %7.1f %7.1f %7.1f",
68 $day,$mon,$hr,$min,$slat*$r2d,$slon*$r2d,$salt,
69 $az*$r2d,$el*$r2d,$distance);
74 $jtime=$jtime+$step/60/24;
77 push @out, $self->msg("satnf", $satname) if $satname;
78 push @out, $self->msg("sat3");
79 push @out, $self->msg("sat4");
83 foreach $sat (sort keys %Sun::keps) {
85 push @out, join ' + ', @l;
92 push @out, join ' + ', @l;