use Carp;
use strict;
-use vars qw($date $sfi $k $a $forecast @allowed @denied $fp $node $from);
+use vars qw($date $sfi $k $a $r $forecast @allowed @denied $fp $node $from);
$fp = 0; # the DXLog fcb
$date = 0; # the unix time of the WWV (notional)
$sfi = 0; # the current SFI value
$k = 0; # the current K value
$a = 0; # the current A value
+$r = 0; # the current R value
$forecast = ""; # the current geomagnetic forecast
$node = ""; # originating node
$from = ""; # who this came from
print $fh "\$sfi = $sfi;\n";
print $fh "\$a = $a;\n";
print $fh "\$k = $k;\n";
+ print $fh "\$r = $r;\n";
print $fh "\$from = '$from';\n";
print $fh "\$node = '$node';\n";
print $fh "\@denied = qw(", join(' ', @denied), ");\n" if @denied > 0;
close $fh;
# log it
- $fp->writeunix($date, "$from^$date^$sfi^$a^$k^$forecast^$node");
+ $fp->writeunix($date, "$from^$date^$sfi^$a^$k^$forecast^$node^$r");
}
# update WWV info in one go (usually from a PC23)
sub update
{
- my ($mydate, $mytime, $mysfi, $mya, $myk, $myforecast, $myfrom, $mynode) = @_;
+ my ($mydate, $mytime, $mysfi, $mya, $myk, $myforecast, $myfrom, $mynode, $myr) = @_;
if ((@allowed && grep {$_ eq $from} @allowed) ||
(@denied && !grep {$_ eq $from} @denied) ||
(@allowed == 0 && @denied == 0)) {
# my $trydate = cltounix($mydate, sprintf("%02d18Z", $mytime));
if ($mydate >= $date) {
+ if ($myr) {
+ $r = 0 + $myr;
+ } else {
+ $r = 0 unless abs ($mysfi - $sfi) > 3;
+ }
$sfi = 0 + $mysfi;
$k = 0 + $myk;
$a = 0 + $mya;
@_ ? $k = shift : $k ;
}
+sub r
+{
+ @_ ? $r = shift : $r ;
+}
+
sub a
{
@_ ? $a = shift : $a ;
@_ ? $forecast = shift : $forecast ;
}
+
#
# print some items from the log backwards in time
#