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 $numhours = 3 if $numhours < 0;
21 $numhours = 24 if $numhours > 24;
22 $step = 5 unless $step && $step =~ /^\d+$/;
23 $step = 5 if $step < 0;
24 $step = 30 if $step > 30;
26 # get nearest lat and long (I can see we will need the altitude here soon as well :-)
27 my $lat = $self->user->lat;
28 my $lon = $self->user->long;
30 my $call = $self->call;
31 unless ($lon || $lat) {
32 $lat = $main::mylatitude;
33 $lon = $main::mylongitude;
34 $call = $main::mycall;
38 if ($satname && $Sun::keps{$satname}) {
39 my $jtime; # lats and longs in radians
40 my ($sec, $min, $hr, $day, $mon, $yr) = (gmtime($main::systime))[0,1,2,3,4,5];
41 #printf("%2.2d %2.2d %2.2d %2.2d %2.2d\n",$min,$hr,$day,$mon,$yr);
47 $jtime=Sun::Julian_Day($yr,$mon,$day)+$hr/24+$min/60/24;
48 ($yr,$mon,$day,$hr,$min)=Sun::Calendar_date_and_time_from_JD($jtime);
49 #printf("%2.2d %2.2d %2.2d %2.2d %2.2d\n",$min,$hr,$day,$mon,$yr);
50 push @out, $self->msg("pos", $call, slat($lat), slong($lon));
51 push @out, $self->msg("sat1", $satname, $numhours, $step);
52 push @out, $self->msg("sat2");
54 my ($slat,$slon,$salt,$az,$el,$distance)=Sun::get_satellite_pos($jtime,$lat*$d2r,$lon*$d2r,$alt,$satname);
55 # print the current satellite position
56 push @out,sprintf("Now %2.2d:%2.2d %7.1f %7.1f %7.1f %7.1f %7.1f %7.1f",
57 $hr,$min,$slat*$r2d,$slon*$r2d,$salt,
58 $az*$r2d,$el*$r2d,$distance);
61 $jtime=$jtime+$step/24/60;
62 my $disc = 0; # discontinuity flag
63 while ( $numsteps < $numhours*60/$step ) # look $numhours ahead for tracking table
65 my ($yr,$mon,$day,$hr,$min)=Sun::Calendar_date_and_time_from_JD($jtime);
66 my ($slat,$slon,$salt,$az,$el,$distance)=Sun::get_satellite_pos($jtime,$lat*$d2r,$lon*$d2r,$alt,$satname);
67 if ( $el*$r2d > -5 ) {
70 push @out, $self->msg("satdisc");
72 push @out,sprintf("%2.2d/%2.2d %2.2d:%2.2d %7.1f %7.1f %7.1f %7.1f %7.1f %7.1f",
73 $day,$mon,$hr,$min,$slat*$r2d,$slon*$r2d,$salt,
74 $az*$r2d,$el*$r2d,$distance);
79 $jtime=$jtime+$step/60/24;
82 push @out, $self->msg("satnf", $satname) if $satname;
83 push @out, $self->msg("sat3");
84 push @out, $self->msg("sat4");
88 foreach $sat (sort keys %Sun::keps) {
90 push @out, join ' + ', @l;
97 push @out, join ' + ', @l;