5 # Copyright (c) 1999 Dirk Koopman G1TLH
7 # as fixed by Steve Franke K9AN
12 my ($self, $line) = @_;
13 my ($prefix, $hr2) = split /\s+/, $line;
14 return (1, $self->msg('e4')) unless $prefix;
16 $hr2 = 2 if !$hr2 || $hr2 < 2;
17 $hr2 = 24 if $hr2 > 24;
22 my ($pre, $a) = Prefix::extract($prefix);
24 # calc bearings and distance
25 my ($d, $b1, $b2); # distance, bearing from TX and from RX
26 my ($lat2, $lon2); # lats and longs in radians
27 my $lat1 = $self->user->lat;
28 my $lon1 = $self->user->long;
29 if (!$lon1 && !$lat1) {
30 push @out, $self->msg('heade1');
31 $lat1 = $main::mylatitude;
32 $lon1 = $main::mylongitude;
36 ($b1, $d) = DXBearing::bdist($lat1, $lon1, $lat2, $lon2);
37 ($b2, undef) = DXBearing::bdist($lat2, $lon2, $lat1, $lon1);
39 # convert stuff into radians
48 my ($hr1, $day, $month) = (gmtime($main::systime))[2,3,4];
50 my $flux = Geomag::sfi;
51 my $ssn = Minimuf::spots($flux);
53 my $theta; # path angle (rad)
55 $theta=$theta+2.*$pi if( $theta <= -$pi);
56 $theta=$theta-2.*$pi if( $theta >= $pi);
58 my ($lats, $lons); # subsolar coordinates (rad)
59 my $dB1 = 20; # transmitter output power (dBW)
61 my $delay; # path delay (ms)
62 my $psi; # sun zenith angle (rad)
63 my ($ftemp, $gtemp); # my $temps
64 my ($i, $j, $h, $n); # int temps
65 my $offset; # offset for local time (hours)
66 my $fcF; # F-layer critical frequency (MHz)
67 my $phiF; # F-layer angle of incidence (rad)
68 my $hop; # number of ray hops
69 my $beta1; # elevation angle (rad)
70 my $dhop; # hop great-circle distance (rad)
71 my $height; # height of F layer (km)
72 my $time; # time of day (hour)
73 my $rsens = -123; # RX sensitivity
76 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)
77 my $nfreq = @freq; # number of frequencies
78 my @mufE; # maximum E-layer MUF (MHz)
79 my @mufF; # minimum F-layer MUF (MHz)
80 my @absorp; # ionospheric absorption coefficient
81 my @dB2; # receive power (dBm)
82 my @path; # path length (km)
83 my @beta; # elevation angle (rad)
84 my @daynight; # path flags
86 # calculate hops, elevation angle, F-layer incidence, delay.
87 $hop = int ($d / (2 * acos($R / ($R + $hF))));
89 while ($beta1 < $MINBETA) {
91 $dhop = $d / ($hop * 2);
92 $beta1 = atan((cos($dhop) - $R / ($R + $hF)) / sin($dhop));
94 $ftemp = $R * cos($beta1) / ($R + $hF);
95 $phiF = atan($ftemp / sqrt(1 - $ftemp * $ftemp));
96 $delay = ((2 * $hop * sin($dhop) * ($R + $hF)) / cos($beta1) / $VOFL) * 1e6;
98 # print summary of data so far
99 push @out, sprintf("RxSens: $rsens dBM SFI:%4.0lf R:%4.0lf Month: $month Day: $day", $flux, $ssn);
100 push @out, sprintf("Power : %3.0f dBW Distance:%6.0f km Delay:%5.1f ms", $dB1, $d * $R, $delay);
101 push @out, sprintf("Location Lat / Long Azim");
102 push @out, sprintf("%-30.30s %-18s %3.0f", $main::myqth, DXBearing::lltos($lat1*$r2d, -$lon1*$r2d), $b1 * $r2d);
103 push @out, sprintf("%-30.30s %-18s %3.0f", $a->name, DXBearing::lltos($lat2*$r2d, -$lon2*$r2d), $b2 * $r2d);
104 my $head = "UT LT MUF Zen";
105 for ($i = 0; $i < $nfreq; $i++) {
106 $head .= sprintf "%5.1f", $freq[$i];
112 # Hour loop: This loop determines the min-hop path and next two
113 # higher-hop paths. It selects the most likely path for each
114 # frequency and calculates the receive power. The F-layer
115 # critical frequency is computed directly from MINIMUF 3.5 and
118 $offset = int ($lon2 * 24. / $pi2);
119 for ($hour = $hr1; $hour < $hr2+$hr1; $hour++) {
124 $time = $dh - $offset;
125 $time += 24 if ($time < 0);
126 $time -= 24 if ($time >= 24);
127 my $out = sprintf("%2.0f %2.0f", $dh, $time);
128 $ftemp = Minimuf::minimuf($flux, $month, $day, $dh, $lat1, $lon1, $lat2, $lon2);
129 $fcF = $ftemp * cos($phiF);
131 # Calculate subsolar coordinates.
132 $ftemp = ($month - 1) * 365.25 / 12. + $day - 80.;
133 $lats = 23.5 * $d2r * sin($ftemp / 365.25 * $pi2);
134 $lons = ($dh * 15. - 180.) * $d2r;
136 # Path loop: This loop determines the geometry of the
137 # min-hop path and the next two higher-hop paths. It
138 # calculates the minimum F-layer MUF, maximum E-layer
139 # MUF and ionospheric absorption factor for each
141 for ($h = $hop; $h < $hop + 3; $h++) {
143 # We assume the F layer height increases during
144 # the day and decreases at night, as determined
145 # at the midpoint of the path.
147 $psi = Minimuf::zenith($d / 2, $lat1, $lon1, $b1, $theta, $lats, $lons);
153 $dhop = $d / ($h * 2.);
154 $beta[$h] = atan((cos($dhop) - $R / ($R + $height)) / sin($dhop));
155 $path[$h] = 2 * $h * sin($dhop) * ($R + $height) / cos($beta[$h]);
156 Minimuf::ion($h, $d, $fcF, $ssn, $lat1, $lon1, $b1, $theta, $lats, $lons, \@daynight, \@mufE, \@mufF, \@absorp);
159 # Display one line for this hour.
160 $out .= sprintf("%5.1f%4.0f ", $mufF[$hop], 90 - $psi * $r2d);
162 for ($i = 0; $i < $nfreq; $i++) {
163 $n = Minimuf::pathloss($hop, $freq[$i], 20, $rsens, 0, \@daynight, \@beta, \@path, \@mufF, \@mufE, \@absorp, \@dB2);
164 my $s = Minimuf::ds($n, $rsens, \@dB2, \@daynight);