Chapter 59. Injecting variables into the USB data taking frameworks

Both the VMUSBReadout and CCUSBReadout frameworks support recording the value of Tcl variables in their Tcl servers to the event stream sent to the output ring buffer. One use of this is to make controlpush(1epics) a client of the slow controls server so that EPICS process variables are recorded along with event data.

To use this mechanism you must:

How to push variable values into the controls Tcl server is beyond the scope of this chapter. We have already pointed at one pre-written application (controlpush(1epics)), that can do this. The remainder of this chapter described hot to set a up variables to be watched and monitored.

The controls Tcl server watch command takes as a parameter a Tcl variable, an array or an array element. At the beginning of a run, all watched variables and array elements and their values are output as a MONITORED_VARIABLES ring item. Every second, watched variables that have changed are output in additional MONITORED_VARIABLES ring items.

The best place to declare watched variables is in the control configuration file. Scalar variables and array elements need not have been created to be watched. To watch an array does require that an array of that name have been created. Below is a sample fragment from a control configuration script that shows all three uses of the watch command.

Example 59-1. The watch command.


watch scalar
watch array(element)
array set anarray [list]
watch anarray
        

The first two watch commands in the example above watch a variable named scaler and the element element of the array array. The last two commands create an array with no elements and declare that the entire array will be watched.