ScalerDisplay

Name

ScalerDisplay -- Live Scaler Displays

Synopsis

export DAQHOST=datasourcecomputer

ScalerDisplay configfile

DESCRIPTION

This script provides a configurable scaler display for the NSCL Data Acquisition system. The script requires that:

In addition to configuring the display itself, ScalerDisplay supports the invocation of user written code at well defined points of operations. For more information about that see CALLOUTS below.

CONFIGURATION COMMANDS

The ScalerDisplay program understands the following object types:

channels

A channel is a scaler channel. It has a name and an index. The name is used to refer to and label the channel. The index is the offset into the set of scalers (numbered from 0) that contains that channel.

pages

A page is a set of scalers grouped together on one display page. Pages have a title, which is an arbitrary text string that is displayed at the top of the page when the page is active, and a Tabname which is used to select the page from the tabbed notebook widget that displays them.

lines

A line is a single scaler or a pair of scalers or blank displayed on a line of the scaler display.

stripcharts

A strip chart is a plot of the rate of one or more scaler channels or their ratios with respect to time. The strip chart part of the user interface is only visible if configured or at least one channel has been added to the chart.

Channels are defined using the channel command. The format of this command is:


                    
channel [?options?] name index
                    
                

Several options control how the channel is treated.

The -lowalarm and -hialarm allow the user to set lower and upper limits on the 'healthy count rates'. If the actual count rates go outside those limits, the scaler channel will be in the alarm state.

Channels in the low alarm state, and their counts are displayed in the low alarm color which defaults to green (see CONFIGURATION below). The channel is considered to be in the high alarm state. Channels in the high alarm state and their counts are displayed in the high alarm color which defaults to red. Note that in the case of a ratio where one is in high alarm state and the other is in low alarm state, the colors of the names reflects the individual channel alarm states while the rate values are shown using the 'both alarm color' which defaults to orange.

Scalers that are not cleared after each read are also supported. to declare such a scaler you must add the -incremental no option/value pair. For non incremental scalers, the scaler display program must know the full scale range of the scaler. This is provided using the -width option. The value of this option is the number of bits in the scaler. Omitting this is like specifying -width 32.

Pages are defined via the page command. The format of this command is:


                    
page Tabname "Some meaningful title string"
                    
                

Note that the title string must be enclosed in quotes if it contains whitespace or other TCL word-separators. The Tabname text is used to label the tab of the page in the tabbed notebook widget that is used to display the scalers. If a page that is not currently being displayed has alarms, its tab will be displayed using either the low, high or both alarm color as appropriate to the alarm state of the channels within that page.

Single scaler lines are defined via the display_single command. The format of this command is:


                
display_single Tabname channelname
                
                

Where Tabname is the Tab name of a scaler page and c hannelname is the name of a scaler channel.

Ratio lines are defined via the display_ratio command:


                
display_ratio  Tabname numerator_chanel denominator_channel
                
            

Blank lines are defined via the blank command:


                
blank Tabname
                
            

Strip charts are defined using the stripparam stripratio and stripconfig commands. The format of the stripparam command is:


                
stripparam channel
                
            

The channel is the name of a channel defined by the channel command. The count rates of this scaler are added to the set of scaler rates on the strip chart using the next free line color and style (see CONFIGURATION below).


                
stripratio numerator denominator
                
            

The ratio of the rates in the two channels numerator and denominator are added to the seet of rates on the strip chart using the next free line color and style. The data set created will be named numerator_over_denominator.


                
stripconfig [?-log 0|1?]  [?-timeaxis seconds?]
                
            

Configures either or both of the Y axis scale type and the length the time axis of the strip chart. If the parameter of the -log option is 1, the Y axis will intially be a logarithmically scaled axis. If 0, the Y axis will be linear. The seconds parameter to the -timeaxis option determines the number of seconds of scaler data that will be displayed on the time axis. The default for these options is to use a linear Y scale and a time axis that is 3600 seconds (1 hour) long. For additional strip chart configuration options, see the CONFIGURATION section.

CONFIGURATION

This section describes some advanced configuration techniques. The key to understanding the advanced this section is to realize that the scaler display program is just a Tcl/Tk script that is sourced in to a TclServer interpreter, and that your configuration file is also just a Tcl script that is sourced in after the display program script. As such, any defaults established by the scaler display program can be overridden by your configuration script.

Alarm Colors

Three global variables control the three alarm colors. lowColor contains the color to use when displaying channels in the low alarm state. hiColor contains the color to use when displaying channels in the high alarm state, and bothColor contains the color used when it is necessary to indicate that both alarm states are present. You may modify these colors within your script. Colors may be specified by name in many cases or by hexadecimal values. On linux systems, see the file: /usr/X11R6/lib/X11/rgb.txt for the list of known color names. Hexdecimal color values are given in any of the following forms: #RGB #RRGGBB #RRRGGGBBB or #RRRRGGGGBBBB where R,G,B are hexadecimal digits which, when taken together, form the Red, Green and Blue intensities of the color respectively. The two lines below both set the low alarm color to cyan (an equal mixture of Green and Blue):


                 set lowColor cyan
                 set lowColor #0ff
            

Tear off pages

The BLT tabset widget in which the scaler pages are displayed supports tear-off pages. When enabled, this feature allows you to tear off any page of the notebook into a new top level window. When the top level window is deleted, it is returned to the notebook. This feature and other BLT tabset configuration options can be configured by using the fact that the notebook widget path is stored in the global variable Notebook. Thus to enable the tear-off functionality the following line can be added to the configuration file:


                $Notebook configure -tearoff 1
        

Strip chart line styles and colors

Channels on the strip chart widget are assigned line color and style by iterating over a list of colors and line styles. The procedure selectElementStyle does this and is expected to return a two element list. The first element of this list is the color of the line used to draw the element, and the second the argument to the -dashes configuration option for the element. You can modify the way in which colors and line styles are selected either by modifying the values in the color and linestyle list or by just overriding the definition of the selectElementStyle procedure.

The default implementation of selectElementStyle iterates through a list of colors stored in the global variable stripColors, selecting linestyles from the dash specifications in the global variable stripStyles. When colors are exhausted, the procedure steps to the next line style, resetting the index into the color list to zero. The two lines below add the color yellow to the set of colors that can be used to chart rates (yellow is low contrast relative to the white chart background so it was left off the default list), and a new linestyle where every other pixel is lit with the selected color or is background:


              lappend stripColors yellow
              lappend stripStyles [list 1 1]
        

Strip chart configuration

The strip chart widget path is stored in the variable stripchartWidget. The Widget itself is only created when the first of stripparam, stripratio or stripconfig command is seen. You may therefore only configure the strip chart widget directly after one of these commnds has executed in your configuration file. You can then use the stripchartWidget variable to configure the strip chart widget arbitrarily. The example below enables the display of gridlines on the plot surface, and moves the legend to the left side of the plot area:


              stripconfig -timeaxis 3600;   # Trick to get the widget defined....
              $stripchartWidget grid configure -hide 0
              $stripchartWidget legend configure -position left
        

For more information about how you can configure the stripchart at its elements, see the BLT stripchart widget documentation.

CALLOUTS

The scaler script will invoke user written procedures defined in the configuration script (or scripts sourced by it) at well defined points of the run. These callouts can be used to provide functionality not originally foreseen by the program.

UserUpdate

UserUpdate, if defined, is called by the script whenever it has updated the displays. No parameters are passed in to the procedure but several global variables are useful (see GLOBAL VARIABLES below).

UserBeginRun

UserBeginRun is called at the beginning of a run, if it has been defined. No parameters are passed.

UserEndRun

UserEndRun, if defined, is called at the end of a run. No parameters are passed.

GLOBAL VARIABLES

The following global variables defined or can be defined.

RunNumber

The number of the current run.

RunTitle

A string contaning the title of the current run.

Scaler_Totals

An array indexed by scaler channel number containing the total number of counts in each channel.

Scaler_Increments

An array indexed by scaler channel number containing the number of counts in the last time increment (see also ScalerDeltaTime)

ScalerDeltaTime

The number of seconds of counts represented by the Scaler_Increments array elements.

DefaultScalerDT

Can be defined if scaler events don't have interval timing information. Whenever the difference between the scaler readout start and stop times are zero, ScalerDeltaTime will be set to DefaultScalerDT instead so that rates can be meaningfully computed.

ScalerMap

An array indexed by scaler names. Each element of this array is the index of the corresponding scaler. For example, if you have defined a channel named george, ScalerMap(george) will be the scaler channel index associated with george.

scalerWin

This global is the name of the widget into which the scaler display will be drawn, or "" if the display is drawn into "."

If you are adding more elements to the GUI you can use this to know where to manage these new elements. For example:


checkbutton $scalerWin.silence -text {Silence Alarms} -command [silence]
                

creates a checkbutton that is a child of the scaler display page and can be packed on that page.

If you are using the scaler display program from within SpecTcl, you can set this widget to allow the scaler display program to pop up in a separate top level. For example:


               set  scalerWin [toplevel .scaler]
               source /usr/opt/daq/current/Scripts/scaler.tcl
                

Creates the scaler display in a new top level widget called .scaler

maxStripPoints

Sets a limit on the number of points the strip chart recorder data series can have. If this is zero (the default), there is no limit. If non zero, when more than maxStripPoints time intervals have been added to the data series, every other point is removed from the first 1/2 of the time. This means that:

  1. The most recent 1/2 of data is always at full resolution

  2. The oldest data is shown at progressively poorer time resolution as successive data trims are performed.

ENVIRONMENT

The environment variable SCALER_RINGNAME can select a specific ring while DAQHOST selects the host on which that ring originates. Specifically, the ring data source is: tcp://$DAQHOST/$SCALER_RINGNAME. If not defined DAQHOST defaults to localhost while SCALER_RINGNAME defaults to your username.

EXAMPLE(S)


       #
       #   Define the scaler channels:
       #
       #   These can be in any order, I'm just copying the order from the original
       #   file.  my preference in fact would be to go in channel order.
       #   This is a TCL script with
       #    commands 'channel'  - to define a chanel name/buffer position correspondence
       #             'page'     - To define a scaler page.
       #             'display_single' - To define a single scaler line in a page.
       #

       #
       channel gas.PIN.cfd       0
       channel gas.qA.cfd       16
       channel gas.qB.cfd       17
       channel gas.gC.cfd       18;              # is this a typo in the original file?
       channel gas.qD.cfd       19
       channel gas.de.cfd        1
       channel gas.Ge.cfd        2
       channel gas.Ge.cfd_B-OFF 12
       channel gas.PS.cfd        5
       channel gas.PS.cfd_B-OFF 13
       channel I2.SCI.N          3
       channel I2.SCI.S          4
       channel TA.BaF2           6
       channel master.gated     11
       channel master.free      10
       channel cpu.lam.TO        7
       channel clock.gated       9
       channel clock.free        8
       channel beam.cycle.on    14
       channel beam.cycle.off   15

       #
       #  Next define the pages, their long titles and the tab name
       #  and their contents.
       #  I've defined the page ALL to be the original page
       #  as well as some additional pages so that you can get the
       #  idea of how you can use this to organize the display if you want to.
       #  If you don't, you can rip out the extra pages.
       #
       #

       page ALL  "Gas Cell DAQ All Scalers"
       display_single ALL gas.PIN.cfd
       display_ratio  ALL gas.qA.cfd      gas.qB.cfd
       display_ratio  ALL gas.gC.cfd      gas.qD.cfd
       display_single ALL gas.Ge.cfd
       display_ratio  ALL gas.Ge.cfd      gas.Ge.cfd_B-OFF
       display_ratio  ALL gas.PS.cfd      gas.PS.cfd_B-OFF
       display_ratio  ALL I2.SCI.N        I2.SCI.S
       display_single ALL TA.BaF2
       display_ratio  ALL master.gated        master.free
       display_ratio  ALL cpu.lam.TO          master.gated
       display_ratio  ALL clock.gated         clock.free
       display_ratio  ALL gasN4.dE.cfd        gasN4.PIN.cfd
       display_ratio  ALL beam.cycle.on       beam.cycle.off

       # If you only want the first page, then remove all lines
       #------------------------- cut below here -------------------

       #  A second page:
       #   Just showing the livetime information  mostly.

       page Livetime "Live time information"
       display_ratio Livetime  master.gated master.free
       display_ratio Livetime  clock.gated  clock.free
       display_ratio Livetime  cop.lam.TO   master.gated

       #  A third page showing only the gas cell:

       page GasCell "Gas cell scalers"

       display_single GasCell gas.PIN.cfd
       display_ratio  GasCell gas.qA.cfd      gas.qB.cfd
       display_ratio  GasCell gas.gC.cfd      gas.qD.cfd
       display_single GasCell gas.Ge.cfd
       display_ratio  GasCell gas.Ge.cfd      gas.Ge.cfd_B-OFF
       display_ratio  GasCell gas.PS.cfd      gas.PS.cfd_B-OFF

       # Do a strip chart of the live master rates and the
       # Livetime computed by clock.gated/clock.free:

       stripparam master.gated
       stripratio clock.gated clock.free

BUGS AND RESTRICTIONS

SEE ALSO

tclserver(1), sclclient(1)