areaDetector Plugin NDPluginCircularBuff

December 22, 2014

Edmund Warrick

Diamond Light Source

Contents

Overview

NDPluginCircularBuff is a triggering plugin. It receives NDArrays from a plugin or driver and checks them for the "ExternalTrigger" attribute. Once this is detected it outputs the triggering NDArray, along with a configurable number of pre- and post-trigger NDArrays.

Acquisition is started by setting the "NDPluginCircularBuffControl" parameter to non-zero (via the "Capture" record in the associated database). The plugin then copies all received NDArrays to its ring buffer, wrapping once the specified pre-count is reached.

Triggering can be achieved either by setting the "ExternalTrigger" attribute to non-zero on an NDArray sent to the plugin, or else by using the soft trigger (controlled from the "Trigger" database record).

Once the trigger is detected, the plugin will immediately output all the NDArrays stored in the ring buffer in order from oldest to newest (by calling doCallbacksGenericPointer). After the trigger is set, new NDArrays will then be output as soon as they arrive, until the post-count is reached. The plugin will then stop buffering or outputting NDArrays until it is reset via NDPluginCircularBuffControl

NDPluginCircularBuff inherits from NDPluginDriver. The NDPluginCircularBuff class documentation describes this class in detail.

NDPluginCircularBuff defines the following parameters. It also implements all of the standard plugin parameters from NDPluginDriver . The EPICS database NDCircularBuff.template provides access to these parameters, listed in the following table.

v
Parameter Definitions in NDPluginCircularBuff.h and EPICS Record Definitions in NDCircularBuff.template
Parameter index variable asyn interface Access Description drvInfo string EPICS record name EPICS record type
NDPluginCircularBuffControl asynInt32 r/w Toggle triggering & buffering on/off CIRCULAR_BUFF_CONTROL $(P)$(R)Capture
$(P)$(R)Capture_RBV
longout
longin
NDPluginCircularBuffStatus asynOctet r/o Plugin status feedback string CIRCULAR_BUFF_STATUS $(P)$(R)StatusMessage stringin
NDPluginCircularBuffPreTrigger asynInt32 r/w Number of pre-trigger NDArrays to store CIRCULAR_BUFF_PRE_TRIGGER $(P)$(R)PRECOUNT
$(P)$(R)PRECOUNT_RBV
longout
longin
NDPluginCircularBuffPostTrigger asynInt32 r/w Number of post-trigger NDArrays to output CIRCULAR_BUFF_POST_TRIGGER $(P)$(R)POSTCOUNT
$(P)$(R)POSTCOUNT_RBV
longout
longin
NDPluginCircularBuffCurrentImage asynInt32 r/o Number of NDArrays currently stored in ring buffer CIRCULAR_BUFF_CURRENT_IMAGE $(P)$(R)CurrentQty_RBV longin
NDPluginCircularBuffPostCount asynInt32 r/o Number of post-trigger NDArrays emitted so far CIRCULAR_BUFF_POST_COUNT $(P)$(R)PostTriggerQty_RBV longin
NDPluginCircularBuffSoftTrigger asynInt32 r/w Set to non-zero to force a trigger on next NDArray CIRCULAR_BUFF_SOFT_TRIGGER $(P)$(R)Trigger longout
NDPluginCircularBuffTriggered asynInt32 r/o Current trigger status CIRCULAR_BUFF_TRIGGERED $(P)$(R)Trigger_RBV longin

Configuration

The NDPluginCircularBuff plugin is created with the NDCircularBuffConfigure command, either from C/C++ or from the EPICS IOC shell.

NDCircularBuffConfigure(const char *portName, int queueSize, int blockingCallbacks,
                        const char *NDArrayPort, int NDArrayAddr,
                        int maxBuffers, size_t maxMemory)
  

For details on the meaning of the parameters to this function refer to the detailed documentation on the NDCircularBuffConfigure function in the NDPluginCircularBuff.cpp documentation and in the documentation for the constructor for the NDPluginCircularBuff class.

In particular, note that maxBuffers constrains the size of the ring buffer - the plugin will discard any changes to the pre- or post count if this would result in (pre-count + post-count) exceeding maxBuffers.