# $longtext Long description text (PopUp)
sub WriteQALog {
my ($fh, $entry, $ttl, $status, $title, $value, $longtext,$link) = @_;
+ $link = "" unless defined $link;
my $tmp = time()."\t$entry\t$ttl\t$status\t$title\t$value\t$longtext\t$link\n";
if ($fh == 0) {
.byg {background:#ac0;}
.bye {background:#ff2;}
.bor {background:#fa0;}
-.brd {background:#f00; }
+.brd {background:#f00;}
.bgr {background:#000;color:#aaa !important;}
.bwh {background:#eee;}
-.bmg {background:#f0a ;}
-.bbl {background:#9bf};
+.bmg {background:#f0a;}
+.bbl {background:#9bf;}
.blinkon .brdb {
background:#f00;
#This a an example configuration file. Copy this file to your user directory and give
#start.pl a link to this file as first argument.
-
+#Scripts to start & order of icons in the Overview
activeScripts => [['time','-','-','-','daqop'],
- ['numfee','temperature','-','-','-'],
+ ['numfee','temperature','reftime','-','-'],
['trgrate','-','-','-','-'],
['-','-','-','-','-'],],
-
+
+#Names to be shown in left column of Overview
qaNames => ['system','main','trigger','-','-','-'],
-NumberOfFpga => 11, #Expected number of FPGAs in system
-CtsAddress => 0x8000, #The address of the CTS
\ No newline at end of file
+#Expected number of FPGAs in system
+NumberOfFpga => 11,
+
+#The address of the CTS
+CtsAddress => 0x8000,
+
+#Addresses of all TDCs. Either single or broadcast addresses
+TdcAddress => [0xfe48,0xfe4e,0x8000],
\ No newline at end of file
--- /dev/null
+#!/usr/bin/perl -w
+
+use warnings;
+use POSIX qw(strftime);
+use FileHandle;
+use lib "./code";
+use lib "../tools";
+use HADES::TrbNet;
+use Time::HiRes qw(usleep);
+use Dmon;
+use Data::Dumper;
+
+
+my %config = do $ARGV[0];
+my $flog = Dmon::OpenQAFile();
+trb_init_ports() or die trb_strerror();
+
+
+my $value, my $longtext, my $status;
+
+my $lasterrors = 0;
+while(1) {
+ my $errors = 0;
+ foreach my $b (@{$config{TdcAddress}}) {
+ my $r = trb_register_read($b,0xc100);
+ foreach my $c (%{$r}) {
+ if ($c & 0x10000) {$errors++;}
+ }
+ }
+ my $title = "Ref Polarity";
+
+ if ($errors) { $value = $errors." errors"; }
+ else { $value = "OK";}
+
+ my $longtext = "Polarity of the reference time signals on TDCs seems to be: ".$value;
+ if($errors && $lasterrors) { $status = Dmon::GetQAState('below',$errors,(0,1,4));}
+ else { $status = Dmon::OK;}
+ Dmon::WriteQALog($flog,"reftime",10,$status,$title,$value,$longtext);
+ $lasterrors = $errors;
+ sleep 10;
+ }
my %config = do $ARGV[0];
my $flog = Dmon::OpenQAFile();
-trb_init_ports() or die trb_strerror();
+
my $old;
my $summing = 0;
my $cnt = 0;
-
-my $plot = ();
-$plot->{name} = "TriggerRate";
-$plot->{file} = Dmon::DMONDIR."TriggerRate";
-$plot->{entries} = 600;
-$plot->{type} = HPlot::TYPE_HISTORY;
-$plot->{output} = HPlot::OUT_PNG;
-$plot->{titles}->[0] = "";
-$plot->{xlabel} = "Time [s]";
-$plot->{ylabel} = "Rate [Hz]";
-$plot->{sizex} = 750;
-$plot->{sizey} = 270;
-$plot->{xscale} = 5;
-$plot->{nokey} = 1;
-$plot->{buffer} = 1;
-HPlot::PlotInit($plot);
+HPlot::PlotInit({
+ name => "TriggerRate",
+ file => Dmon::DMONDIR."TriggerRate",
+ entries => 600,
+ type => HPlot::TYPE_HISTORY,
+ output => HPlot::OUT_PNG,
+ titles => ["Trigger Rate"],
+ xlabel => "Time [s]",
+ ylabel => "Rate [Hz]",
+ sizex => 750,
+ sizey => 270,
+ xscale => 5,
+ nokey => 1,
+ buffer => 1
+ });
my $str = Dmon::MakeTitle(10,6,"TriggerRate",0);
$str .= qq@<img src="%ADDPNG TriggerRate.png%" type="image/png">@;
$str .= Dmon::MakeFooter();
Dmon::WriteFile("TriggerRate",$str);
-
-
-
while(1) {
- my $r = trb_register_read($config{CtsAddress},0xa000);
- my $value = $r->{$config{CtsAddress}};
- my $rate = ($value||0) - ($old||0);
- $rate += 2**32 if $rate < 0;
-
- if( defined $old) {
- $summing += $rate;
- HPlot::PlotAdd('TriggerRate',$rate*5,0);
- print $rate;
+ trb_init_ports() or die trb_strerror();
+
+ while(1) {
+ my $r = trb_register_read($config{CtsAddress},0xa000);
+ my $value = $r->{$config{CtsAddress}};
+ my $rate = ($value||0) - ($old||0);
+ $rate += 2**32 if $rate < 0;
- unless($cnt++ % 10) {
- my $title = "Rate";
- my $value = $summing/2;
- my $longtext = $value." triggers pre second";
- my $status = Dmon::GetQAState('above',$value,(15,2,1));
- Dmon::WriteQALog($flog,"trgrate",5,$status,$title,$value,$longtext,'2-TriggerRate');
-
- HPlot::PlotDraw('TriggerRate');
- $summing = 0;
+ if( defined $old) {
+ $summing += $rate;
+ HPlot::PlotAdd('TriggerRate',$rate*5,0);
+
+ unless($cnt++ % 10) {
+ my $title = "Rate";
+ my $value = $summing/2;
+ my $longtext = $value." triggers pre second";
+ my $status = Dmon::GetQAState('above',$value,(15,2,1));
+ Dmon::WriteQALog($flog,"trgrate",5,$status,$title,$value,$longtext,'2-TriggerRate');
+
+ HPlot::PlotDraw('TriggerRate');
+ $summing = 0;
+ }
}
+ $old = $value;
+ usleep(200000);
}
- $old = $value;
- usleep(200000);
-}
+ sleep 10;
+ }