From 93085eaff9a85e3d1e817ef4bcf1a71e274789bb Mon Sep 17 00:00:00 2001 From: Cbm Rich Date: Sun, 16 Nov 2014 14:48:30 +0100 Subject: [PATCH] updates to dmon --- dmon/scripts/dmon_beammonitors.pl | 2 +- dmon/scripts/dmon_billboard.pl | 12 +++++---- dmon/scripts/dmon_heatmaprich.pl | 42 +++++++++++++++++++++++++------ 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/dmon/scripts/dmon_beammonitors.pl b/dmon/scripts/dmon_beammonitors.pl index c3c2f6d..a927967 100755 --- a/dmon/scripts/dmon_beammonitors.pl +++ b/dmon/scripts/dmon_beammonitors.pl @@ -23,7 +23,7 @@ HPlot::PlotInit({ sizex => 430, sizey => 360, curvewidth => 1.5, -# ymin => -1, + ymin => 0, ymax => "1000<*", # xscale => 5, nokey => 1, diff --git a/dmon/scripts/dmon_billboard.pl b/dmon/scripts/dmon_billboard.pl index 755be5a..68345fa 100755 --- a/dmon/scripts/dmon_billboard.pl +++ b/dmon/scripts/dmon_billboard.pl @@ -33,9 +33,9 @@ while(1) { # temp & pressure push @billboardValues, - (($billboardVersion & 0x3) << 30) | # version 2 bit - (($epicsData{"Pres"} & 0x1fffff) << 9) | # pressure 21 bit - (($epicsData{"Temp"} & 0x1ff ) << 0); # temp 9 bit + (( 0 ) << 30) | # version 2 bit + (($epicsData->{"Pres"}->{"val"} & 0x1fffff) << 9) | # pressure 21 bit + (($epicsData->{"Temp"}->{"val"} & 0x1ff ) << 0); # temp 9 bit # padiwa currents for(my $i = 0; $i < 16; $i++) { @@ -52,8 +52,10 @@ while(1) { # hv values for(my $i=0; $i < 16; $i++) { push @billboardValues, - ((("HV_I".$i) * 1e6) & 0xffff) << 16) | - ((("HV_U".$i) * 1e2) & 0xffff) << 0); + ((($epicsData->{"HV_I".$i}->{"val"} * 1e6) & 0xffff) << 16) | + ((($epicsData->{"HV_U".$i}->{"val"} * 1e2) & 0xffff) << 0); + + #print(($epicsData->{"HV_I".$i}->{"val"} * 1e6) . "uA @ " . ($epicsData->{"HV_U".$i}->{"val"} * 1e3) . " mV \n"); } trb_register_write_mem($config{BillboardAddress}, 0xb100, 0, \@billboardValues, scalar @billboardValues); # copy data diff --git a/dmon/scripts/dmon_heatmaprich.pl b/dmon/scripts/dmon_heatmaprich.pl index b79db38..234c55d 100755 --- a/dmon/scripts/dmon_heatmaprich.pl +++ b/dmon/scripts/dmon_heatmaprich.pl @@ -4,6 +4,8 @@ use warnings; use strict; use POSIX qw(strftime); use FileHandle; +use lib "./code"; +use lib "../tools"; use lib "../users/cern_cbmrich"; use HADES::TrbNet; use Time::HiRes qw(usleep); @@ -34,26 +36,53 @@ $plot2->{xmax} = 32.5; $plot2->{ymin} = 0.5; $plot2->{ymax} = 32.5; $plot2->{cbmin} = "0"; -$plot2->{cbmax} = "100<*"; +$plot2->{cbmax} = "100<*<1000000"; $plot2->{showvalues} = 0; $plot2->{xlabel} = "column"; $plot2->{ylabel} = "row"; -$plot2->{addCmd} = "set lmargin at screen 0.07\nset rmargin at screen 0.85\nset bmargin at screen 0.07\nset tmargin at screen 0.95"; +$plot2->{addCmd} = "set lmargin at screen 0.07\nset rmargin at screen 0.80\nset bmargin at screen 0.07\nset tmargin at screen 0.95"; HPlot::PlotInit($plot2); my $str = Dmon::MakeTitle(9,14,"HeatmapRich",0); - $str .= qq@@; + $str .= qq@
@; $str .= Dmon::MakeFooter(); Dmon::WriteFile("HeatmapRich",$str); +sub generateDef { + my $x = 56; my $y = 51; my $w = (564-$x) / 32.0; my $h = (619-$y) / 32.0; + + $str = qq@ + var HeatmapDef = { + 'x': $x, 'y': $y, 'w': $w, 'h': $h, + 'labels': [ + @; + + for my $ix (1..32) { + $str .= '['; + for my $iy (1..32) { + my $fpga = $ChannelMapping::chanmap->{fpga}->[$ix]->[$iy]; + my $channel = ($ChannelMapping::chanmap->{chan}->[$ix]->[$iy]-1) / 2; + + $str .= sprintf("'0x%04x CH: %d'", $fpga, $channel) . ($iy == 32 ? '' : ','); + } + $str .= ']' . ($ix == 32 ? '' : ',') . "\n"; + } + + $str .= ']};'; + return $str; +} + +open FH, ">", Dmon::DMONDIR . '/HeatmapRichDefs.js'; +print FH generateDef; +close FH; my $old; my $oldtime = time(); my $time = time(); my $diff; + while (1) { - my $sum = 0; my $o = trb_register_read_mem($config{PadiwaBroadcastAddress},0xc000,0,33); if (defined $old) { @@ -71,15 +100,14 @@ while (1) { my $fpga = $ChannelMapping::chanmap->{fpga}->[$x]->[$y]; my $channel = $ChannelMapping::chanmap->{chan}->[$x]->[$y]; HPlot::PlotFill('HeatmapRich',$diff->{$fpga}->[$channel],$x,$y); - $sum += $diff->{$fpga}->[$channel]; } } HPlot::PlotDraw('HeatmapRich'); } my $status = Dmon::OK; my $title = "Heatmap"; - my $value = Dmon::SciNotation($sum); - my $longtext = "Total: ".$value; + my $value = ""; + my $longtext = "See plot"; Dmon::WriteQALog($config{flog},"heatmaprich",5,$status,$title,$value,$longtext,'1-HeatmapRich'); $old = $o; $oldtime = time(); -- 2.43.0