From 5b3e756c07c1f9396f0025013539f00ecfa35a06 Mon Sep 17 00:00:00 2001 From: Hades DAQ Date: Fri, 1 Mar 2019 02:11:49 +0100 Subject: [PATCH] current state,mt --- hmon/hmon_eb_rate.pl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hmon/hmon_eb_rate.pl b/hmon/hmon_eb_rate.pl index e88c39a..6e606c2 100755 --- a/hmon/hmon_eb_rate.pl +++ b/hmon/hmon_eb_rate.pl @@ -14,7 +14,7 @@ use JSON qw( decode_json ); use HADES::TrbNet; my $SLEEP_TIME = .5; # in seconds -my $NUM_AVERAGES = 5; +my $NUM_AVERAGES = 10; my $offset = 2; my $last_rate_endp = 0; my $opt_addr = 3; #CTS @@ -59,10 +59,10 @@ while (1) { $rate_endp >= $last_rate_endp ? $rate_endp - $last_rate_endp : ($rate_endp + 2**16) - $last_rate_endp; } - if ($ctr >= $offset) { + if ($ctr >= $offset) { # JAM2018: direct access to dabc http server instead of epics now: $evtrate_eb_tot += get ($url_erate); - $evtrate_eb_tot += 0 unless defined $evtrate_eb_tot; + $evtrate_eb_tot += 0 unless defined $evtrate_eb_tot; #print Dumper $evtrate_eb_tot; my $builders = get ($url_builders); #print Dumper $builders; @@ -71,15 +71,15 @@ while (1) { my $builder_array = decode_json($builders); $actmask = scalar @$builder_array; # not exactly the bitmask, but this is not used here anyway JAM - } - + } + } $last_rate_endp = $rate_endp; ###cancel integration when spill break is detected my @result = trb_register_read_c($opt_addr, 0xa002 ); $last_spill_on = $spill_on; - $spill_on = !(($result[1] & 0x10) >> 4); + $spill_on = !(($result[1] & 0x10) >> 4); usleep($SLEEP_TIME * 1e6); $ctr++; @@ -100,8 +100,8 @@ while (1) { my $limit = $diff / sqrt($rate_endp || 1); my $status = QA::GetQAState('inside', $limit, @QA::EBDeltaRateLimits); - $status = QA::OK if $rate_endp < 50; - + $status = QA::OK if $rate_endp < 150; + if (! $actmask) { $status = QA::WARN_2; $diff_p_str = "---"; @@ -121,8 +121,8 @@ while (1) { $longtext = " $longtext ErrorCtr: $error_ctr" if ($error_ctr > 0); QA::WriteQALog($flog, "eb", "rate", $SLEEP_TIME * $ctr * 2, $status, $title, $shorttext, $longtext) unless $opt_debug>0; - print "status:$status title:$title short:$shorttext long: $longtext \n" unless $opt_debug<1; - + print "status:$status title:$title short:$shorttext long: $longtext \n" unless $opt_debug<1; + if ($status >= QA::ERROR) { my $speakermsg = "CTS and Eventbuilder rate differ by "; my $pmesg = sprintf "%d", abs($diff_p); -- 2.43.0