X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fmuf.pl;h=3c01944bb1e861714a910040b63ced9a1a90eddc;hb=refs%2Fheads%2Fnewusers;hp=5c9f92b6e237338346cceb0af17567012f3cde2a;hpb=ad321e7b7e2172228be4ce694d740e4f9629d383;p=spider.git diff --git a/cmd/show/muf.pl b/cmd/show/muf.pl index 5c9f92b6..3c01944b 100644 --- a/cmd/show/muf.pl +++ b/cmd/show/muf.pl @@ -4,12 +4,26 @@ # # Copyright (c) 1999 Dirk Koopman G1TLH # -# $Id$ +# as fixed by Steve Franke K9AN # +# +# + +use Minimuf; my ($self, $line) = @_; -my ($prefix, $hr2) = split /\s+/, $line; +my @f = split /\s+/, $line; + +my $prefix = uc shift @f; return (1, $self->msg('e4')) unless $prefix; +my $lp; +my $hr2; + +while (@f) { + my $f = shift @f; + $lp++ if $f =~ /^l/; + $hr2 = $f if $f =~ /^\d+$/; +} $hr2 = 2 if !$hr2 || $hr2 < 2; $hr2 = 24 if $hr2 > 24; @@ -24,33 +38,50 @@ my ($d, $b1, $b2); # distance, bearing from TX and from RX my ($lat2, $lon2); # lats and longs in radians my $lat1 = $self->user->lat; my $lon1 = $self->user->long; +my $loc1 = $self->user->qth || "unknown"; + if (!$lon1 && !$lat1) { push @out, $self->msg('heade1'); $lat1 = $main::mylatitude; $lon1 = $main::mylongitude; + $loc1 = $main::myqth; } $lat2 = $a->{lat}; $lon2 = $a->{long}; -($b2, $d) = DXBearing::bdist($lat1, $lon1, $lat2, $lon2); -($b1, undef) = DXBearing::bdist($lat2, $lon2, $lat1, $lon1); +($b1, $d) = DXBearing::bdist($lat1, $lon1, $lat2, $lon2); +($b2, undef) = DXBearing::bdist($lat2, $lon2, $lat1, $lon1); # convert stuff into radians $lat1 *= $d2r; $lat2 *= $d2r; -$lon1 *= $d2r; -$lon2 *= $d2r; +$lon1 *= -$d2r; +$lon2 *= -$d2r; $b1 *= $d2r; $b2 *= $d2r; $d = ($d / $R); +# handle long path +if ($lp) { + $d = $pi2 - $d; + $b1 += $pi; + $b1 -= $pi2 if ($b1 >= $pi2); + $b2 += $pi; + $b2 -= $pi2 if ($b2 >= $pi2); +} + + my ($hr1, $day, $month) = (gmtime($main::systime))[2,3,4]; $month++; my $flux = Geomag::sfi; my $ssn = Minimuf::spots($flux); my $theta; # path angle (rad) +$theta=$lon1-$lon2; +$theta=$theta+2.*$pi if( $theta <= -$pi); +$theta=$theta-2.*$pi if( $theta >= $pi); + my ($lats, $lons); # subsolar coordinates (rad) -my $dB1 = 20; # transmitter output power (dBW) +my $dB1 = 26; # transmitter output power (dBW) my $delay; # path delay (ms) my $psi; # sun zenith angle (rad) @@ -64,7 +95,7 @@ my $beta1; # elevation angle (rad) my $dhop; # hop great-circle distance (rad) my $height; # height of F layer (km) my $time; # time of day (hour) -my $rsens = -123; # RX sensitivity +my $rsens = -128; # RX sensitivity my @freq = qw(1.8 3.5 7.0 10.1 14.0 18.1 21.0 24.9 28.0 50.0); # working frequencies (MHz) @@ -90,11 +121,11 @@ $phiF = atan($ftemp / sqrt(1 - $ftemp * $ftemp)); $delay = ((2 * $hop * sin($dhop) * ($R + $hF)) / cos($beta1) / $VOFL) * 1e6; # print summary of data so far -push @out, sprintf("RxSens: $rsens dBM SFI:%4.0lf R:%4.0lf Month: $month Day: $day", $flux, $ssn); +push @out, sprintf("RxSens: $rsens dBM SFI:%4.0f R:%4.0f Month: $month Day: $day", $flux, $ssn); push @out, sprintf("Power : %3.0f dBW Distance:%6.0f km Delay:%5.1f ms", $dB1, $d * $R, $delay); push @out, sprintf("Location Lat / Long Azim"); -push @out, sprintf("%-30.30s %-18s %3.0f", $main::myqth, DXBearing::lltos($lat1*$r2d, $lon1*$r2d), $b1 * $r2d); -push @out, sprintf("%-30.30s %-18s %3.0f", $a->name, DXBearing::lltos($lat2*$r2d, $lon2*$r2d), $b2 * $r2d); +push @out, sprintf("%-30.30s %-18s %3.0f", $loc1, DXBearing::lltos($lat1*$r2d, -$lon1*$r2d), $b1 * $r2d); +push @out, sprintf("%-30.30s %-18s %3.0f", $a->name, DXBearing::lltos($lat2*$r2d, -$lon2*$r2d), $b2 * $r2d); my $head = "UT LT MUF Zen"; for ($i = 0; $i < $nfreq; $i++) { $head .= sprintf "%5.1f", $freq[$i]; @@ -138,7 +169,7 @@ for ($hour = $hr1; $hour < $hr2+$hr1; $hour++) { # the day and decreases at night, as determined # at the midpoint of the path. $height = $hF; - $psi = Minimuf::zenith($d / 2, $lat1, $lon1, $b2, $b1, $lats, $lons); + $psi = Minimuf::zenith($d / 2, $lat1, $lon1, $b1, $theta, $lats, $lons); if ($psi < 0) { $height -= 70.; } else { @@ -147,7 +178,7 @@ for ($hour = $hr1; $hour < $hr2+$hr1; $hour++) { $dhop = $d / ($h * 2.); $beta[$h] = atan((cos($dhop) - $R / ($R + $height)) / sin($dhop)); $path[$h] = 2 * $h * sin($dhop) * ($R + $height) / cos($beta[$h]); - Minimuf::ion($h, $d, $fcF, $ssn, $lat1, $lon1, $b2, $b1, $lats, $lons, \@daynight, \@mufE, \@mufF, \@absorp); + Minimuf::ion($h, $d, $fcF, $ssn, $lat1, $lon1, $b1, $theta, $lats, $lons, \@daynight, \@mufE, \@mufF, \@absorp); } # Display one line for this hour.