From 87ad2b352cc9696bbb9618094d464ca092a8f739 Mon Sep 17 00:00:00 2001 From: Alexander Ivanov <alexander.ivanov@ligo.org> Date: Tue, 4 Jun 2013 23:38:41 +0000 Subject: [PATCH] Added new code to parse science mode channels, indicated with an asterisk in DAQ config block. Added "uint32" optional type specification for a DAQ channel. git-svn-id: https://redoubt.ligo-wa.caltech.edu/svn/advLigoRTS/trunk@3364 6dcd42c9-f523-4c6d-aada-af552506706e --- src/epics/util/fmseq.pl | 75 +++++++++++++++++++++++++---------- src/epics/util/iniChk.pl | 9 ++++- src/epics/util/lib/Parser3.pm | 40 ++++++++++++++----- 3 files changed, 91 insertions(+), 33 deletions(-) diff --git a/src/epics/util/fmseq.pl b/src/epics/util/fmseq.pl index 2299aff79..d087262ff 100755 --- a/src/epics/util/fmseq.pl +++ b/src/epics/util/fmseq.pl @@ -639,16 +639,33 @@ while (<IN>) { s/\s$//g; my @nr = split /\s+/; next unless length $nr[0]; - $nr[1] = $gds_datarate unless defined $nr[1]; - die "Invalid DAQ channel $nr[0] rate $nr[1]; system rate is $gds_datarate" if $nr[1] > $gds_datarate; - if (is_top_name($nr[0])) { - $nr[0] = "$site:" . top_name_transform($nr[0]); + + my $name, $rate, $type, $science; + $rate = $gds_datarate; + $name = shift @nr; + $type = "float"; + $science = 0; + foreach $f (@nr) { + if ($f eq "uint32") { + $type = "uint32"; + } elsif ($f eq "science") { + $science = 1; + } elsif ($f =~ /^\d+$/) { # An integer + $rate = $f; + } + } + + die "Invalid DAQ channel $name rate $rate; system rate is $gds_datarate" if $rate > $gds_datarate; + if (is_top_name($name)) { + $name = "$site:" . top_name_transform($name); } else { - $nr[0] = "$site:$systems[0]$nr[0]"; + $name = "$site:$systems[0]$name"; } - $DAQ_Channels{$nr[0]} = $nr[1]; - #print $nr[0], " ", $nr[1], "\n"; + $DAQ_Channels{$name} = $rate; + $DAQ_Channels_type{$name} = $type; + $DAQ_Channels_science{$name} = $science; + #print $name, " ", $rate, "\n"; } close IN; @@ -930,18 +947,21 @@ if ($gds_specified) { # Create DAQ config file (default section and a few ADC input channels) my $daqFile = "$ARGV[0].ini"; open(OUTG,">".$daqFile) || die "cannot open $daqFile file for writing"; -print OUTG "[default]\n". - "gain=1.00\n". - "acquire=1\n". - "dcuid=$dcuId\n". - "ifoid=$ifoid\n". - "datatype=4\n". - "datarate=" . $gds_datarate . "\n". - "offset=0\n". - "slope=6.1035e-04\n". - "units=V\n". - "\n"; - +$header = <<END +[default] +gain=1.00 +acquire=1 +dcuid=$dcuId +ifoid=$ifoid +datatype=4 +datarate=$gds_datarate +offset=0 +slope=6.1035e-04 +units=V + +END +; +print OUTG $header; # Open testpoints file my $parFile = "$ARGV[0].par"; @@ -977,6 +997,10 @@ foreach (sort @section_names) { ${$sections{$_}}{"datarate"} = $DAQ_Channels{$_}; undef $comment; delete $DAQ_Channels{$_}; + # See if this is an integer channel + if ($DAQ_Channels_type{$_} eq "uint32") { + ${$sections{$_}}{"datatype"} = 2; + } } else { $comment = "#"; } @@ -989,8 +1013,19 @@ foreach (sort @section_names) { } } # print OUTG "${comment}[${_}_${def_datarate}]\n"; + my $science = $DAQ_Channels_science{$_}; print OUTG "${comment}[${_}_${daq_name}]\n"; - print OUTG "${comment}acquire=$have_daq_spec\n"; + if ($science) { + my $hds = 0; + if ($have_daq_spec) { + # bit 1 set to indicate storage into commissioning; + # bit 2 set to indicate storage into science frames + $hds = 3; + } + print OUTG "${comment}acquire=$hds\n"; + } else { + print OUTG "${comment}acquire=$have_daq_spec\n"; + } foreach $sec (keys %{$sections{$_}}) { if ($sec eq "chnnum" || $sec eq "datarate" || $sec eq "datatype") { print OUTG "${comment}$sec=${$sections{$_}}{$sec}\n"; diff --git a/src/epics/util/iniChk.pl b/src/epics/util/iniChk.pl index 0b6d7c893..f0f625020 100755 --- a/src/epics/util/iniChk.pl +++ b/src/epics/util/iniChk.pl @@ -115,6 +115,9 @@ sub processParameterSection { elsif ($acquireValue == 1) { $acquireCount[1]++; } + elsif ($acquireValue == 3) { + $acquireCount[2]++; + } else { print "\n***ERROR: Incorrect acquire value - $acquireValue\n"; $errorCount++; @@ -258,6 +261,7 @@ foreach $value (@inData) { $acquireCount[0] = 0; $acquireCount[1] = 0; + $acquireCount[2] = 0; # if ($defaultAcquireValue != -1) { # $acquireCount[$defaultAcquireValue]++; @@ -297,11 +301,12 @@ foreach $value (@inData) { # number of lines with "acquire=0" and "acquire=1", as # well as the total of these two values. # -$acquireTotal = $acquireCount[0] + $acquireCount[1]; +$acquireTotal = $acquireCount[0] + $acquireCount[1] + $acquireCount[2]; print "\nTotal count of \'acquire=0\' is $acquireCount[0]"; print "\nTotal count of \'acquire=1\' is $acquireCount[1]"; -print "\nTotal count of \'acquire=0\' and \'acquire=1\' is $acquireTotal\n"; +print "\nTotal count of \'acquire=3\' is $acquireCount[2]"; +print "\nTotal count of \'acquire={0,1,3}\' is $acquireTotal\n"; # # Print the counts for each datarate, as well as diff --git a/src/epics/util/lib/Parser3.pm b/src/epics/util/lib/Parser3.pm index 722ffaf3d..7a7698d8d 100644 --- a/src/epics/util/lib/Parser3.pm +++ b/src/epics/util/lib/Parser3.pm @@ -1433,26 +1433,44 @@ sub process { my @sp = split(/\\n/, ${$annot->{FIELDS}}{Name}); # See if the channel name and rate specified foreach $i (@sp) { + my $rate = ""; + my $type = ""; + my $science = ""; + next if ($i =~ "^#"); my @nr = split(/\s+/, $i); next unless length $nr[0]; my $pn = $prefix . $nr[0]; + # See if this is a science mode channel (ends with an asterisk) + if ($pn =~ /\*$/) { + chop $pn; + $science ="science"; + } die "Bad DAQ channel name specified: $pn\n" unless name_check($pn); - my $rate; - if (defined $nr[1]) { - my @rates = qw(32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536); - my @res = grep {$nr[1] == $_} @rates; - #print $nr[1], " ", @res, "\n"; - die "Bad DAQ channel rate specified: $pn, $nr[1]\n" unless @res; - #print $pn," ", $nr[1], "\n"; - } else { - #print $pn," default rate\n"; + # There are up to three extra fields allowed + # rate, if it is a number + # "uint32" specified data type + # or "science" to indicate a science run mode channel + shift @nr; + foreach $f (@nr) { + if ($f eq "science") { + $science = $f; + } elsif ($f eq "uint32") { + $type = "uint32"; + } elsif ($f =~ /^\d+$/) { # An integer + my @rates = qw(32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536); + my @res = grep {$f == $_} @rates; + print $f, " ", @res, "\n"; + die "Bad DAQ channel rate specified: $pn, $f\n" unless @res; + print $pn," ", $f, "\n"; + $rate = $f; + } } # Add channel name and rate into the hash and print into the _daq file # fmseq.pl then will open and process the DAQ channel data die "Duplicated DAQ channel name $pn\n" if defined $::DAQ_Channels{$pn}; - $::DAQ_Channels{$pn} = $nr[1]; - print ::DAQ $pn, " ", $nr[1], "\n"; + $::DAQ_Channels{$pn} = $rate; + print ::DAQ $pn, " $rate $type $science\n"; } ${$annot->{FIELDS}}{Name} = "Removed"; } -- GitLab