From: minima Date: Sun, 23 Sep 2001 15:42:09 +0000 (+0000) Subject: added Steve's (K9AN) new versions X-Git-Tag: R_1_49~103 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=d0adf21cbcea77d72ffc021441961039c41852bf;p=spider.git added Steve's (K9AN) new versions --- diff --git a/Changes b/Changes index 8363ca58..be0a0978 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,11 @@ +23Sep01======================================================================= +1. I have incorporated Steve's (K9AN) lastest sh/sun and sh/moon stuff which +copes much better with some of the end effects that occur in these calc- +ulations. You can now also see up to a year into the past or future. The +results compare favourably with the US Naval Obs (unlike certain other +software's output which "I would not want to use their results to aim my +moon rocket..."). It also fixes some ambiguity about which day the results +are actually for. 21Sep01======================================================================= 1. fix set/lockout so that it is possible to lock out all SSIDs except those specifically unlocked and so that you don't need to lock the non-SSID call in diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 095b7764..b6e41a03 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1514,6 +1514,15 @@ For example:- SH/MOON SH/MOON G1TLH W5UN +You can also use this command to see into the past or the future, so +if you want to see yesterday's times then do:- + + SH/MOON -1 + +or in three days time:- + + SH/MOON +3 W9 + === 0^SHOW/MUF [][long]^Show the likely propagation to a prefix This command allow you to estimate the likelihood of you contacting a station with the prefix you have specified. The output assumes a modest @@ -1673,7 +1682,7 @@ that callsign is connected to the cluster. If no callsign is given then show the information for yourself. -=== 0^SHOW/SUN [|]^Show sun rise and set times +=== 0^SHOW/SUN [+/- days][|]^Show sun rise and set times Show the sun rise and set times for a (list of) prefixes or callsigns, together with the azimuth and elevation of the sun currently at those locations. @@ -1690,6 +1699,15 @@ For example:- SH/SUN SH/SUN G1TLH K9CW ZS +You can also use this command to see into the past or the future, so +if you want to see yesterday's times then do:- + + SH/SUN -1 + +or in three days time:- + + SH/SUN +3 W9 + === 0^SHOW/TIME [|]^Show the local time If no prefixes or callsigns are given then this command returns the local time and UTC as the computer has it right now. If you give some prefixes diff --git a/cmd/show/moon.pl b/cmd/show/moon.pl index ef1ba457..8013345a 100644 --- a/cmd/show/moon.pl +++ b/cmd/show/moon.pl @@ -4,14 +4,34 @@ # # 1999/11/9 Steve Franke K9AN # 2000/10/27 fixed bug involving degree to radian conversion. +# 2001/09/15 accept prefix/call and number of days from today (+ or -). +# e.g. sh/moon 2 w0 w9 shows rise/set 2 days hence for w0, w9 +# sh/moon w0 w9 2 same thing +# az and el are shown only when day offset is zero (i.e. today). my ($self, $line) = @_; -my @list = split /\s+/, $line; +my @f = split /\s+/, $line; -my $l; my @out; +my $f; +my $l; +my $n_offset; +my @list; + +while ($f = shift @f){ + if(!$n_offset){ + ($n_offset) = $f =~ /^([-+]?\d+)$/; + next if $n_offset; + } + push @list, $f; +} +$n_offset = 0 unless defined $n_offset; +$n_offset = 0 if $n_offset > 365; # can request moon rise/set up to 1 year ago or from now... +$n_offset = 0 if $n_offset < -365; + my ($lat, $lon); # lats and longs in radians -my ($sec, $min, $hr, $day, $month, $yr) = (gmtime($main::systime))[0,1,2,3,4,5]; +my ($sec, $min, $hr, $day, $month, $yr) = (gmtime($main::systime+$n_offset*24*60*60))[0,1,2,3,4,5]; + $month++; $yr += 1900; @@ -43,12 +63,20 @@ if (@list) { } } -push @out, $self->msg('moon'); +if( !$n_offset ) { + push @out, $self->msg('moon_with_azel'); +} else { + push @out, $self->msg('moon'); +} foreach $l (@in) { my ($rise, $set, $az, $dec, $loss )=Sun::rise_set($yr,$month,$day,$hr,$min,$l->[1],$l->[2],1); $l->[3] =~ s{(-\d+|/\w+)$}{}; - push @out,sprintf("%-6.6s %-30.30s %s %s %6.1f %6.1f %3.1f", $l->[3], $l->[0], $rise, $set, $az, $dec, $loss); + if( !$n_offset ) { + push @out,sprintf("%-6.6s %-30.30s %02d/%02d/%4d %s %s %6.1f %6.1f", $l->[3], $l->[0], $day, $month, $yr, $rise, $set, $az, $dec); + } else { + push @out,sprintf("%-6.6s %-30.30s %02d/%02d/%4d %s %s", $l->[3], $l->[0], $day, $month, $yr, $rise, $set); + } } diff --git a/cmd/show/sun.pl b/cmd/show/sun.pl index 07172ce0..d7c9766c 100644 --- a/cmd/show/sun.pl +++ b/cmd/show/sun.pl @@ -4,14 +4,34 @@ # # 1999/11/9 Steve Franke K9AN # 2000/10/27 fixed bug involving degree to radian conversion. +# 2001/09/15 accept prefix/call and number of days from today (+ or -). +# e.g. sh/moon 2 w0 w9 shows rise/set 2 days hence for w0, w9 +# sh/moon w0 w9 2 same thing +# az and el are shown only when day offset is zero (i.e. today). my ($self, $line) = @_; -my @list = split /\s+/, $line; +my @f = split /\s+/, $line; -my $l; my @out; +my $f; +my $l; +my $n_offset; +my @list; + +while ($f = shift @f){ + if(!$n_offset){ + ($n_offset) = $f =~ /^([-+]?\d+)$/; + next if $n_offset; + } + push @list, $f; +} +$n_offset = 0 unless defined $n_offset; +$n_offset = 0 if $n_offset > 365; # can request moon rise/set up to 1 year ago or from now... +$n_offset = 0 if $n_offset < -365; + my ($lat, $lon); # lats and longs in radians -my ($sec, $min, $hr, $day, $month, $yr) = (gmtime($main::systime))[0,1,2,3,4,5]; +my ($sec, $min, $hr, $day, $month, $yr) = (gmtime($main::systime+$n_offset*24*60*60))[0,1,2,3,4,5]; + $month++; $yr += 1900; @@ -43,13 +63,21 @@ if (@list) { } } -push @out, $self->msg('sun'); +if( !$n_offset ) { + push @out, $self->msg('sun_with_azel'); +} else { + push @out, $self->msg('sun'); +} + foreach $l (@in) { - my ($rise, $set, $az, $dec )=Sun::rise_set($yr,$month,$day,$hr,$min,$l->[1],$l->[2],0); - $l->[3] =~ s{(-\d+|/\w+)$}{}; - push @out,sprintf("%-6.6s %-30.30s %s %s %6.1f %6.1f ", $l->[3], $l->[0], $rise, $set, $az, $dec); + my ($rise, $set, $az, $dec, $loss )=Sun::rise_set($yr,$month,$day,$hr,$min,$l->[1],$l->[2],0); + $l->[3] =~ s{(-\d+|/\w+)$}{}; + if( !$n_offset ) { + push @out,sprintf("%-6.6s %-30.30s %02d/%02d/%4d %s %s %6.1f %6.1f", $l->[3], $l->[0], $day, $month, $yr, $rise, $set, $az, $dec); + } else { + push @out,sprintf("%-6.6s %-30.30s %02d/%02d/%4d %s %s", $l->[3], $l->[0], $day, $month, $yr, $rise, $set); + } } - return (1, @out); diff --git a/perl/Messages b/perl/Messages index 0f9c0e13..e4ee79c6 100644 --- a/perl/Messages +++ b/perl/Messages @@ -160,7 +160,8 @@ package DXM; msg3 => 'Msg $_[0]: $_[1] changed from $_[2] to $_[3]', msgu => 'usage: msg data...', merge1 => 'Merge request for $_[1] spots and $_[2] WWV sent to $_[0]', - moon => 'Location Rise Set Azim Elev RGain dB', + moon => 'Location dd/mm/yyyy Rise Set', + moon_with_azel => 'Location dd/mm/yyyy Rise Set Azim Elev', mond => 'Monitoring Disabled', mone => 'Monitoring Enabled', namee1 => 'Please enter your name, set/name ', @@ -233,7 +234,8 @@ package DXM; statvhf => 'VHF+ DX Spot Stats, last 31 days', statvhft => 'VHF+ DX Spot Stats, last 31 days for DXCC $_[0]', statdx => 'Total DX Spots last 31 days', - sun => 'Location Rise Set Azim Elev', + sun => 'Location dd/mm/yyyy Rise Set', + sun_with_azel => 'Location dd/mm/yyyy Rise Set Azim Elev', suser1 => 'usage: callsign user_field_name value', suser2 => 'User $_[0] not found', suser3 => 'User field \'$_[0]\' was \'$_[1]\' now set to \'$_[2]\'', diff --git a/perl/Sun.pm b/perl/Sun.pm index 13f7d20c..2fe033cd 100644 --- a/perl/Sun.pm +++ b/perl/Sun.pm @@ -18,6 +18,8 @@ # # $Id$ # +# 2001/09/15 some changes to take care of cases where the object +# doesn't rise or set on a given day... package Sun; @@ -160,6 +162,10 @@ sub rise_set my $lon = shift; my $sun0_moon1=shift; # 0 for sun, 1 for moon, 2 for venus... + my $norise = 0; + my $noset = 0; + my ($risehr,$risemin,$risetime,$sethr,$setmin,$settime); + my ($alpha1,$alpha2,$alpha3,$delta1,$delta2,$delta3); my ($m0,$m1,$m2,$theta,$alpha,$delta,$H,$az,$h,$h0,$aznow,$hnow,$corr); my ($i,$arg,$argtest,$H0,$alphanow,$deltanow,$distance,$distancenow); @@ -205,14 +211,10 @@ sub rise_set } $arg = (sindeg($h0)-sindeg($lat)*sindeg($delta2))/(cosdeg($lat)*cosdeg($delta2)); - $argtest = tandeg($lat)*tandeg($delta2); - - if ( $argtest < -1. ) { - return sprintf("Doesn't rise."); - } - if ( $argtest > 1. ) { - return sprintf("Doesn't set."); - } + if ( abs($arg) > 1. ) { # either up all day or down all day + $norise = 1; # leave it to the user to examine + $noset = 1; # the elevation angle (or look outside!) + } # to figure out which. $H0 = acos($arg)*$r2d; my $aa=$alpha2-$alpha1; @@ -248,56 +250,71 @@ sub rise_set $m0=$m0-1 if( $m0 > 1 ); } - $m1 = $m0 - $H0/360.; - $m1=$m1+1 if( $m1 < 0 ); - $m1=$m1-1 if( $m1 > 1 ); - for ($i=1; $i<=2; $i++) { - $theta = $theta0+360.985647*$m1; - $alpha=$alpha2+$m1*($aa+$ba+$m1*$ca)/2; - $delta=$delta2+$m1*($ad+$bd+$m1*$cd)/2; - $H=$theta-$lon-$alpha; - $H=reduce_angle_to_360($H); - ($az,$h)=get_az_el($H,$delta,$lat); - $corr=($h-$h0)/(360*(cosdeg($delta)*cosdeg($lat)*sindeg($H))); - $m1=$m1+$corr; + + if( !$norise ){ + $m1 = $m0 - $H0/360.; $m1=$m1+1 if( $m1 < 0 ); $m1=$m1-1 if( $m1 > 1 ); + for ($i=1; $i<=2; $i++) { + $theta = $theta0+360.985647*$m1; + $alpha=$alpha2+$m1*($aa+$ba+$m1*$ca)/2; + $delta=$delta2+$m1*($ad+$bd+$m1*$cd)/2; + $H=$theta-$lon-$alpha; + $H=reduce_angle_to_360($H); + ($az,$h)=get_az_el($H,$delta,$lat); + $corr=($h-$h0)/(360*(cosdeg($delta)*cosdeg($lat)*sindeg($H))); + $m1=$m1+$corr; + $norise=1 if( $m1 < 0 || $m1 > 1); + } } - $m2 = $m0 + $H0/360.; - $m2=$m2+1 if( $m2 < 0 ); - $m2=$m2-1 if( $m2 > 1 ); - for ($i=1; $i<=2; $i++) { - $theta = $theta0+360.985647*$m2; - $alpha=$alpha2+$m2*($aa+$ba+$m2*$ca)/2; - $delta=$delta2+$m2*($ad+$bd+$m2*$cd)/2; - $H=$theta-$lon-$alpha; - $H=reduce_angle_to_360($H); - ($az,$h)=get_az_el($H,$delta,$lat); - $corr=($h-$h0)/(360*(cosdeg($delta)*cosdeg($lat)*sindeg($H))); - $m2 = $m2 + $corr; + if( !$norise ) { + $risehr=int($m1*24); + $risemin=($m1*24-int($m1*24))*60+0.5; + if ( $risemin >= 60 ) { + $risemin=$risemin-60; + $risehr=$risehr+1; + } + $risetime=sprintf("%02d:%02dZ",$risehr,$risemin); + } else { + $risetime="NoRise"; + } + + if( !$noset ){ + $m2 = $m0 + $H0/360.; $m2=$m2+1 if( $m2 < 0 ); $m2=$m2-1 if( $m2 > 1 ); + for ($i=1; $i<=2; $i++) { + $theta = $theta0+360.985647*$m2; + $alpha=$alpha2+$m2*($aa+$ba+$m2*$ca)/2; + $delta=$delta2+$m2*($ad+$bd+$m2*$cd)/2; + $H=$theta-$lon-$alpha; + $H=reduce_angle_to_360($H); + ($az,$h)=get_az_el($H,$delta,$lat); + $corr=($h-$h0)/(360*(cosdeg($delta)*cosdeg($lat)*sindeg($H))); + $m2 = $m2 + $corr; + $noset=1 if( $m2 < 0 || $m2 > 1); + } } - my ($risehr,$risemin,$sethr,$setmin); - $risehr=int($m1*24); - $risemin=($m1*24-int($m1*24))*60+0.5; - if ( $risemin >= 60 ) { - $risemin=$risemin-60; - $risehr=$risehr+1; - } - $sethr=int($m2*24); - $setmin=($m2*24-int($m2*24))*60+0.5; - if ( $setmin >= 60 ) { - $setmin=$setmin-60; - $sethr=$sethr+1; - } + + if( !$noset ) { + $sethr=int($m2*24); + $setmin=($m2*24-int($m2*24))*60+0.5; + if ( $setmin >= 60 ) { + $setmin=$setmin-60; + $sethr=$sethr+1; + } + $settime=sprintf("%02d:%02dZ",$sethr,$setmin); + } else { + $settime="NoSet "; + } + if ( $sun0_moon1 == 0 ) { - return (sprintf("%02d:%02dZ", $risehr,$risemin), sprintf("%02d:%02dZ",$sethr,$setmin),$aznow+180,$hnow); + return (sprintf("%s", $risetime), sprintf("%s",$settime),$aznow+180,$hnow); } if ( $sun0_moon1 == 1 ) { - return (sprintf("%02d:%02dZ", $risehr,$risemin), sprintf("%02d:%02dZ",$sethr,$setmin), + return (sprintf("%s", $risetime), sprintf("%s",$settime), $aznow+180,$hnow, -40*log10($distance/385000) ); } }