From 5af7d19d8485e0c64a6b1d9531b5d446e9ddaef5 Mon Sep 17 00:00:00 2001 From: Michael Traxler Date: Thu, 13 Nov 2014 21:51:48 +0100 Subject: [PATCH] Update to CBM RICH configuration --- dmon/scripts/dmon_billboard.pl | 30 ++++++++++++++-- dmon/scripts/dmon_padiwatemp.pl | 2 +- thresholds/thresholds_automatic.pl | 10 +++--- thresholds/write_thresholds.pl | 7 ++-- users/cern_cbmrich/dmon_config.pl | 3 +- users/cern_cbmrich/register_config_tdc.db | 10 +++--- users/cern_cbmrich/register_configgbe_ip.db | 36 +++++++++---------- users/cern_cbmrich/startup.sh | 10 +++--- .../thresh/thresholds_padiwa_amps.thr | 16 +++++++++ 9 files changed, 86 insertions(+), 38 deletions(-) create mode 100644 users/cern_cbmrich/thresh/thresholds_padiwa_amps.thr diff --git a/dmon/scripts/dmon_billboard.pl b/dmon/scripts/dmon_billboard.pl index b9d9e1f..c480cdb 100755 --- a/dmon/scripts/dmon_billboard.pl +++ b/dmon/scripts/dmon_billboard.pl @@ -10,18 +10,44 @@ use Time::HiRes qw(usleep gettimeofday tv_interval); use Dmon; use HPlot; use Data::Dumper; +use Perl2Epics; my %config = Dmon::StartUp(); my $t0; +for(my $i = 1; $i<=20; $i++) { + my $name = sprintf('CBM:PWRSWITCH:GetCurrent%02x',$i); + Perl2Epics::Connect("C".$i,$name); +} + while(1) { +# update billboard + my @billboardValues = (); + my $reg; + + my $epicsData = Perl2Epics::GetAll(); + + # temp & pressure + $billboardValues[0] = 0xdeadc0de; + + # currents + for(my $i = 1; $i<=20; $i++) { + my $milAmp = $epicsData->{"C".$i}->{"val"} * 1000; + $reg = 0 unless $i & 1; + $reg |= ($milAmp & 0xffff) << (16 * ($i&1)); + $billboardValues[$i / 2 + 1] = $reg; + } + + trb_register_write_mem($config{BillboardAddress}, 0xb100, 0, \@billboardValues, scalar @billboardValues); # copy data + trb_register_write($config{BillboardAddress}, 0xb000, scalar @billboardValues); # commit + +# build statistics my $title = "Billboard"; my $longtext=''; my $value=''; my $status = Dmon::OK; my $regs = trb_registertime_read_mem($config{BillboardAddress},0xb000, 0, 5); - if(defined $regs->{$config{BillboardAddress}}) { my $rates = Dmon::MakeRate(0,32,0,$regs); if (defined($rates->{$config{BillboardAddress}}{rate}) && $t0) { @@ -46,6 +72,6 @@ while(1) { $t0 = [gettimeofday]; Dmon::WriteQALog($config{flog},"billboard",6,$status,$title,$value,$longtext) if ($longtext); - usleep(5e6); + usleep(5e5); } diff --git a/dmon/scripts/dmon_padiwatemp.pl b/dmon/scripts/dmon_padiwatemp.pl index 041bfd5..cd61e5d 100755 --- a/dmon/scripts/dmon_padiwatemp.pl +++ b/dmon/scripts/dmon_padiwatemp.pl @@ -55,7 +55,7 @@ while(1) { $max = $temp; $maxboard = $b; } - elsif ($min > $temp) { + if ($min > $temp) { $min = $temp; $minboard = $b; } diff --git a/thresholds/thresholds_automatic.pl b/thresholds/thresholds_automatic.pl index ff3c8fe..f753491 100755 --- a/thresholds/thresholds_automatic.pl +++ b/thresholds/thresholds_automatic.pl @@ -4,6 +4,8 @@ use strict; use warnings; use Data::Dumper; +use lib "/home/hadaq/trbsoft/daqtools/dmon/code"; +use Dmon; use Getopt::Long; use Log::Log4perl qw(get_logger); @@ -234,7 +236,7 @@ write_thresholds($mode, $chain, \@best_thresh); my $uid; foreach my $i (reverse (0..3)) { #print "send command: $endpoint , i: $i\n"; - $rh_res = send_command($endpoint, $chain, 0x10000000 | $i * 0x10000); + $rh_res = Dmon::PadiwaSendCmd($endpoint, $chain, 0x10000000 | $i * 0x10000); $uid .= sprintf("%04x", $rh_res->{$endpoint} &0xffff); #print $uid; } @@ -262,7 +264,7 @@ sub read_thresholds { die "could not lock shared element"; } - my $rh_res = trb_register_write($endpoint,0xd410, 1 << $chain); +# my $rh_res = trb_register_write($endpoint,0xd410, 1 << $chain); foreach my $current_channel (0..15) { @@ -281,7 +283,7 @@ sub read_thresholds { } $command = $fixed_bits | ($current_channel << 16) ; - my $rh_res = send_command($endpoint, $chain, $command); + my $rh_res = Dmon::PadiwaSendCmd($endpoint, $chain, $command); push (@thresh , $rh_res->{$endpoint}); } @@ -323,7 +325,7 @@ sub write_thresholds { } $command = $fixed_bits | ($current_channel << 16) | ($ra_thresh->[$current_channel] << $shift_bits); - send_command($endpoint, $chain, $command); + Dmon::PadiwaSendCmd($endpoint, $chain, $command); } diff --git a/thresholds/write_thresholds.pl b/thresholds/write_thresholds.pl index 08d8323..734e0a6 100755 --- a/thresholds/write_thresholds.pl +++ b/thresholds/write_thresholds.pl @@ -4,6 +4,9 @@ use strict; use warnings; use Data::Dumper; +use lib "/home/hadaq/trbsoft/daqtools/dmon/code"; +use Dmon; + use Getopt::Long; use HADES::TrbNet; @@ -91,9 +94,9 @@ sub write_threshold { $shift_bits = 4; } - my $command= $fixed_bits | ($current_channel<<16) | ($thresh << $shift_bits); + my $command= $fixed_bits | ($current_channel << 16) | ($thresh << $shift_bits); - send_command($endpoint, $chain, $command); + Dmon::PadiwaSendCmd($endpoint, $chain, $command); } diff --git a/users/cern_cbmrich/dmon_config.pl b/users/cern_cbmrich/dmon_config.pl index e55a97c..456f3f4 100755 --- a/users/cern_cbmrich/dmon_config.pl +++ b/users/cern_cbmrich/dmon_config.pl @@ -33,7 +33,8 @@ PadiwaTrbAdresses => [0x0010,0x0011,0x0012,0x0013, 0x00d0,0x00d1,0x00d2,0x00d3, 0x00e0,0x00e1,0x00e2,0x00e3, 0x00f0,0x00f1,0x00f2,0x00f3, - 0x0100,0x0101,0x0102,0x0103], + 0x0100,0x0101,0x0102,0x0103, + 0x0111], HubTrbAdresses => [0x7005,0x7000,0x7001,0x7002,0x7003, 0x0015, diff --git a/users/cern_cbmrich/register_config_tdc.db b/users/cern_cbmrich/register_config_tdc.db index 887d2b9..905b6f6 100644 --- a/users/cern_cbmrich/register_config_tdc.db +++ b/users/cern_cbmrich/register_config_tdc.db @@ -89,9 +89,7 @@ 0x0102 0 0xffffffff 0x00000000 0x0103 0 0x00000000 0x00000000 -#for now: disable TDC for beam counter - - 0x0110 0 0x0000ffff 0x00000000 - 0x0111 0 0x00000000 0x00000000 - 0x0112 0 0x00000000 0x00000000 - 0x0113 0 0x00000000 0x00000000 + 0x0110 0 0x0000ffff 0x00000000 #gpin + 0x0111 0 0xffffffff 0x00000000 #padiwa amps + #0x0112 0 0x00000000 0x00000000 #billboard + #0x0113 0 0x00000000 0x00000000 diff --git a/users/cern_cbmrich/register_configgbe_ip.db b/users/cern_cbmrich/register_configgbe_ip.db index 7b455fd..455bcf9 100644 --- a/users/cern_cbmrich/register_configgbe_ip.db +++ b/users/cern_cbmrich/register_configgbe_ip.db @@ -28,24 +28,24 @@ # Hub # Type # C0 # C1 # C2 # C3 # C4 # C5 # C6 # C7 # C8 # ######################################################################################################################################## - 0x7005 0 0x7e344bb9 0x4016 0xc0a80003 0xc350 0xdead8000 0x001b 0xc0a80000 0xc350 0x0578 - 0x8015 0 0x7e344bb9 0x4016 0xc0a80003 0xc351 0xdead8001 0x001b 0xc0a80001 0xc351 0x0578 - 0x8025 0 0x7e344bb9 0x4016 0xc0a80003 0xc352 0xdead8002 0x001b 0xc0a80002 0xc352 0x0578 - 0x8035 0 0x7e344bb9 0x4016 0xc0a80003 0xc353 0xdead8003 0x001b 0xc0a80003 0xc353 0x0578 - 0x8045 0 0x7e344bb9 0x4016 0xc0a80003 0xc354 0xdead8004 0x001b 0xc0a80004 0xc354 0x0578 - 0x8055 0 0x7e344bb9 0x4016 0xc0a80003 0xc355 0xdead8005 0x001b 0xc0a80005 0xc355 0x0578 - 0x8065 0 0x7e344bb9 0x4016 0xc0a80003 0xc356 0xdead8006 0x001b 0xc0a80006 0xc356 0x0578 - 0x8075 0 0x7e344bb9 0x4016 0xc0a80003 0xc357 0xdead8007 0x001b 0xc0a80007 0xc357 0x0578 - 0x8085 0 0x7e344bb9 0x4016 0xc0a80003 0xc358 0xdead8008 0x001b 0xc0a80008 0xc358 0x0578 - 0x8095 0 0x7e344bb9 0x4016 0xc0a80003 0xc359 0xdead8009 0x001b 0xc0a80009 0xc359 0x0578 - 0x80a5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35a 0xdead8010 0x001b 0xc0a80010 0xc35a 0x0578 - 0x80b5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35b 0xdead8011 0x001b 0xc0a80011 0xc35b 0x0578 - 0x80c5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35c 0xdead8012 0x001b 0xc0a80012 0xc35c 0x0578 - 0x80d5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35d 0xdead8013 0x001b 0xc0a80013 0xc35d 0x0578 - 0x80e5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35e 0xdead8014 0x001b 0xc0a80014 0xc35e 0x0578 - 0x80f5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35f 0xdead8015 0x001b 0xc0a80015 0xc35f 0x0578 - 0x8105 0 0x7e344bb9 0x4016 0xc0a80003 0xc360 0xdead8016 0x001b 0xc0a80016 0xc360 0x0578 - 0x8115 0 0x7e344bb9 0x4016 0xc0a80003 0xc361 0xdead8017 0x001b 0xc0a80017 0xc361 0x0578 + 0x7005 0 0x7e344bb9 0x4016 0x0aa0004d 0xc350 0xdead8000 0x001b 0xc0a80000 0xc350 0x0578 + 0x8015 0 0x7e344bb9 0x4016 0x0aa0004d 0xc351 0xdead8001 0x001b 0xc0a80001 0xc351 0x0578 + 0x8025 0 0x7e344bb9 0x4016 0x0aa0004d 0xc352 0xdead8002 0x001b 0xc0a80002 0xc352 0x0578 + 0x8035 0 0x7e344bb9 0x4016 0x0aa0004d 0xc353 0xdead8003 0x001b 0xc0a80003 0xc353 0x0578 + 0x8045 0 0x7e344bb9 0x4016 0x0aa0004d 0xc354 0xdead8004 0x001b 0xc0a80004 0xc354 0x0578 + 0x8055 0 0x7e344bb9 0x4016 0x0aa0004d 0xc355 0xdead8005 0x001b 0xc0a80005 0xc355 0x0578 + 0x8065 0 0x7e344bb9 0x4016 0x0aa0004d 0xc356 0xdead8006 0x001b 0xc0a80006 0xc356 0x0578 + 0x8075 0 0x7e344bb9 0x4016 0x0aa0004d 0xc357 0xdead8007 0x001b 0xc0a80007 0xc357 0x0578 + 0x8085 0 0x7e344bb9 0x4016 0x0aa0004d 0xc358 0xdead8008 0x001b 0xc0a80008 0xc358 0x0578 + 0x8095 0 0x7e344bb9 0x4016 0x0aa0004d 0xc359 0xdead8009 0x001b 0xc0a80009 0xc359 0x0578 + 0x80a5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35a 0xdead8010 0x001b 0xc0a80010 0xc35a 0x0578 + 0x80b5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35b 0xdead8011 0x001b 0xc0a80011 0xc35b 0x0578 + 0x80c5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35c 0xdead8012 0x001b 0xc0a80012 0xc35c 0x0578 + 0x80d5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35d 0xdead8013 0x001b 0xc0a80013 0xc35d 0x0578 + 0x80e5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35e 0xdead8014 0x001b 0xc0a80014 0xc35e 0x0578 + 0x80f5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35f 0xdead8015 0x001b 0xc0a80015 0xc35f 0x0578 + 0x8105 0 0x7e344bb9 0x4016 0x0aa0004d 0xc360 0xdead8016 0x001b 0xc0a80016 0xc360 0x0578 + 0x8115 0 0x7e344bb9 0x4016 0x0aa0004d 0xc361 0xdead8017 0x001b 0xc0a80017 0xc361 0x0578 #0x8125 0 0x7e344bb9 0x4016 0xc0a80002 0xc362 0xdead8018 0x001b 0xc0a80018 0xc362 0x0578 #0x8135 0 0x7e344bb9 0x4016 0xc0a80002 0xc363 0xdead8019 0x001b 0xc0a80019 0xc363 0x0578 #0x8145 0 0x7e344bb9 0x4016 0xc0a80002 0xc364 0xdead8020 0x001b 0xc0a80020 0xc364 0x0578 diff --git a/users/cern_cbmrich/startup.sh b/users/cern_cbmrich/startup.sh index 139fc04..9bcdcdf 100755 --- a/users/cern_cbmrich/startup.sh +++ b/users/cern_cbmrich/startup.sh @@ -16,17 +16,19 @@ then fi #export TRB3_SERVER=trb056 -export DAQOPSERVER=localhost:56 +export DAQOPSERVER=10.160.0.77:56 + -echo -n "- number of trb endpoints in the system: " -trbcmd i 0xffff | wc -l ################################################## ## System Reset ################################################## +echo "Doing reset" trbcmd reset +echo -n "- number of trb endpoints in the system: " +trbcmd i 0xffff | wc -l ################################################## ## Set addresses ################################################## @@ -89,7 +91,7 @@ echo "XXX: Running prepare padiwas invert leds" 0x00d0 0x00d1 0x00d2 0x00d3 \ 0x00e0 0x00e1 0x00e2 0x00e3 \ 0x00f0 0x00f1 0x00f2 0x00f3 \ -0x0100 0x0101 0x0102 0x0103 " +0x0100 0x0101 0x0102 0x0103 0x111" echo "done..." # enable used channels diff --git a/users/cern_cbmrich/thresh/thresholds_padiwa_amps.thr b/users/cern_cbmrich/thresh/thresholds_padiwa_amps.thr new file mode 100644 index 0000000..5668c68 --- /dev/null +++ b/users/cern_cbmrich/thresh/thresholds_padiwa_amps.thr @@ -0,0 +1,16 @@ +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 00 threshold: 0x06F6, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 01 threshold: 0xDB23, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 02 threshold: 0x077D, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 03 threshold: 0xDC50, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 04 threshold: 0x0672, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 05 threshold: 0xDC50, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 06 threshold: 0xffff, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 07 threshold: 0x0000, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 08 threshold: 0xffff, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 09 threshold: 0x0000, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 10 threshold: 0xffff, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 11 threshold: 0x0000, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 12 threshold: 0xffff, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 13 threshold: 0x0000, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 14 threshold: 0xffff, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 15 threshold: 0x0000, uid: 0 \ No newline at end of file -- 2.43.0