sequencer

Name

sequencer --  Provide a ReadoutGui plugin for nscldaq 8.1 and later that can automate several data taking runs.

Synopsis

package require runSequencer

DESCRIPTION

The runSequencer package provides support for automating data taking runs of fixed duration. runSequencer is a ReadoutGui plugin that is compatible with nscldaq-8.1 and later.

To operate, you must use the ReadoutGUI from nscldaq-8.1 or later. At the NSCL, you can do this by using /usr/opt/daq/8.1/bin/ReadoutShell. See USING for more information on how to use this plugin.

For each run you can define a set of run parameters that are set through custom actions just prior to the start of the run. See CUSTOMIZING below for more information about how to setup these actions and how to specify the parameters.

Run sequences are called Run plans. Run plans are files that can be loaded into the sequencer, edited, saved, and executed. A run plan provides values for all of the parameters for each run in the sequence.

USING

This section desribes using in two senses of the word: Incorporating the sequencerGui into ReadoutGUI, and operating the sequencer once it is installed. Setting up the parameter definitions and actions used by the sequencer are described in CUSTOMIZING below

Incorporating SequencerGui into ReadoutGUI

To incorporate the sequencer into ReadoutGUI you must use a ReadoutCallouts.tcl file to extend ReadoutGui. This file must contain the line:


package require runSequencer
                
Furthermore you must run a Readout GUI from nscldaq version 8.1 or later. At the NSCL, you can run the 8.1 version of the ReadoutGUI as follows: /usr/opt/daq/8.1/bin/ReadoutShell Note that when you run the Readout GUI, the sequencer.config and sequencerActions.tcl files are expected to exist. See CUSTOMIZING below for information about the contents of these files. see "FILES and ENVIRONMENT" for where they belong.

Operating the sequencer GUI

The sequencer creates a second window associated with the Readout GUI. This window consists mainly of a table with column labels defined by the sequencer.config file. Each row of the table represents a run in the sequence of runs in a run plan

You can edit the table to provide values for each of the parameters (columns) for each step in the run sequence. Navigate in the table by using the arrow keys, the mouse or the tab and shift tab keys. Once you are happy with your run plan you can save it using the File->Save... menu command.

The File->Open... menu command allows you to read in a plan from file. This plan can be edited, and saved. File->Clear... clears the table.

To execute a run plan, use the ReadoutGUIPanel to set the length of each run. (The sequencer will turn on timed runs when you start the sequence). Then click the Execute Plan button to start the sequence. The button is relabeled Abort Plan while the plan is running. Clicking it while the plan is running ends the active run and stops the sequence. If event recording was enabled for an aborted run plan you are given the option to discard all the event data that was taken for the sequence.

CUSTOMIZING

The sequencer is completely customizable. The label for each column and actions to take to set each column are defined by the sequencer.config file. This file is a text file. Each line in the file describes a column. Blank lines are ignored as are lines for which the first non-blank character is a hash (#) character. Fields in a line are separated by whitespace. Whitespace can be incorporated into a field either by quoting the field with double quotes (") or curly brackets (for example {this has spaces}).

Each column definition line of sequencer.config has fields in the following order.

Column Name

The text that labels the column in the run plan.

set action

A tcl command that is executed when it is time to change the value of the item in the column. The column name and the value of that cell of the table are appended to the command. If the set action is blank, no action is taken. The action function must return 0 on success or else the run plan will be aborted prior to starting the run for the failing step. Note that if an action can return and error it should indicate to the user what the error was.

initialize action

A tcl command that is executed when the sequencer is set up, before executing any run plan. This is intended to be used for any one-time intialization required to access the item controlled by the table. The column name is appended to this command when it is called.

See EXAMPLES for examples of the sequencer.config file. See "FILES and ENVIRONMENT" for information about where this file belongs.

The actions defined in the sequencer.config file must come from somewhere. During initialization, the sequencer sources the file sequencerActions.tcl this file is a Tcl script that can include procedure definitions, data definitions, etc. Normally it provides the tcl commands that are specified as actions in the sequencer.config file. For a sample sequencerActions.tcl file see EXAMPLES. For information about how the sequender finds this file, see "FILES and ENVIRONMENT"

FILES and ENVIRONMENT

The sequencer must locate a column configuration file and a script that defines the actions used by that file. By default, these files are:

./sequencer.config

The column configuration file. By default this is located in the current working directory of the sequencer when it is started.

./sequencerActions.tcl

A script that defines actions used by the column configuration file. By default, this is sourced from the current working directory of the sequencer when it is started.

Environment variables can alter the location and names of these files:

SEQCONFIGDIR

If defined, this environment variable is the directory from which the two configuration files are loaded for example: export SEQCONFIGDIR=~/config

SEQCONFIGFILE

If defined, this environment variable is the name of the file used to configure the columns. If, for example, you: export SEQCONFIGDIR=~/config and export SEQCONFIGFILE=columns.def The column configuration file loaded will be ~/config/columns.def.

SEQACTIONFILE

If defined, this environment variable is the name of the action script file that defines the actions referenced in the column configurationfile. If, you have export SEQCONFIGDIR=~/config and export SEQACTIONFILE=actions.tcl, The action script file will be sourced from ~/config/actions.tcl.

EXAMPLES

Example 1. Action script example

This example shows part of an action script that defines the actions epicsAccess and epicsSet that provide actions to access epics channels.


package require epics
proc epicsSet {name value} {
  set status [catch  {$name set $value}] msg
  if {$status != 0} {
     tk_msgBox -message $msg -icon error -title {Epics channel set error}
  } 
  return $status
  
}
proc epicsAccess name {
    epicschannel $name
}

                    

Example 2. Sequencer column configuration file

The sequencer file below defines a set of columns that are all epics channels:


# Column         set_action  init_action

P222ET_TARGET    epicsSet    epicsAccess
P222ER           epicsSet    epicsAccess
FLTCHAN73        epicsSet    epicsAccess
P#5:406353       epicsSet    epicsAccess

                    
Not the use of blank lines and comment lines.

The directory examples/sequencer under the installation directory of the nscl daq includes several sample files.