Skip to content
Blake Johnson edited this page Mar 26, 2015 · 5 revisions

Introduction

The BBN Arbitrary Pulse Sequencer (APS) is an arbitrary waveform generator with an advanced sequencing ability. The sequencer allows for specification of individual operations (gates) to be defined as units in a waveform library, so that an algorithm/experiment can be defined by stringing together sequences of gates and delays. This results in a very compact description for efficient memory use.

The most current version of the documentation should reside in the docs/ folder of the repository. We are still moving content there, so this page is provided as a temporary solution.

Installation

Download the latest aps-vX.X.7z file from the downloads tab in the repository. To use these drivers, you simply need to add the relevant paths to your MATLAB or python code. Before plugging in the APS, you must also install a recent version of FTDI's D2XX driver.

For maintainers, please see Requirements and Dependencies.

Programmer's reference

Interface drivers for the BBN APS are available on several platforms including: MATLAB, Python, and LabVIEW. Effort has been made to use consistent naming across these interfaces, so that method signatures look similar in the various platforms. The following methods are available on all platforms, and are consider `public' methods, in the sense that the API for these methods is expected to be consistent across major software versions. Use of methods outside of this list may result in broken code when receiving future software updates.

Methods

APS()

Inputs: None

Outputs: an APS object

Description: This method instantiates an APS driver object. Creation of this object is the first step in all use cases of the driver.

connect(address)

Inputs: integer or string address - device ID (integer) or serial number (string)

Description: Opens the USB connection to the APS. May take as input a device ID or a device serial number. The device ID is determined by an alphanumeric sorting of the connected APS serial numbers. The first device in that sorted list has ID = 0. Consequently, if you only have one APS connected, you can assume that it is device 0.

disconnect()

Inputs: None

Description: Closes the USB connection to the APS. The APS driver allows only one open connection at a time, so it is important to include a call to disconnect() in your code.

init(force)

Inputs: integer force - (optional) 1 = force loading of FPGA firmware, 0 = do not force load (default)

Description: Performs all initialization tasks on the APS. This method should be called by all user code between connect() and all other commands. The driver attempts to detect whether initialization is necessary, and will skip mosts tasks if it detects that the APS is in a ready state. You can force the driver to re-initialize the APS by calling this method with force = 1.

setAll(settings)

Inputs: struct settings - complete APS settings structure

Description: A single method for doing all set up tasks for the APS. The settings structure has the following elements:

  • chan_n.enabled
  • chan_n.amplitude
  • chan_n.offset
  • samplingRate
  • triggerSource
  • seqfile where n in the channel elements identifies the channel number (1-4). You can see an example usage of setAll() below.

loadConfig(path)

Inputs: string path - full path to an APS sequence configuration file

Description: Loads a multi-channel sequence configuration file. loadConfig() will enable any channel for which there is waveform/sequence data in the configuration file.

loadWaveform(channel, waveform[])

Inputs: integer channel - target channel (1-4)
integer array waveform[] - signed integer waveform data in the range (-8191, 8192) or float data in the range (-1,1).

Description: Loads raw waveform data onto a channel of the APS. Use this method only if you do not intend to use that channel for pulse sequencing (this method disables link list mode). To use sequence mode, use loadConfig() or setAll() instead.

run()

Inputs: None

Description: Starts output on all enabled channels. See setEnabled() to see how to enable a channel.

stop()

Inputs: None

Description: Disables output on all enabled channels and resets the pulse sequencer back to the beginning of the sequence.

isRunning()

Inputs: None

Description: Returns true if any channel of the APS is currently running.

setOffset(channel, offset)

Inputs: integer channel - target channel (1-4)
float offset - normalized channel offset in range (-1.0, 1.0)

Description: Sets the voltage offset of the specified channel. Note: the APS mimics a voltage offset by shifting the waveform data. Consequently, it is possible to introduce clipping of the waveform by using this method.

setAmplitude(channel, offset)

Inputs: integer channel - target channel (1-4)
float offset - channel amplitude/scale factor

Description: Sets the channel scale factor. Note: the APS mimics channel amplitude by multiplying the waveform data by the channel scale factor.. It is possible to introduce clipping of the waveform by using this method.

setEnabled(channel, enabled)

Inputs: integer channel - target channel (1-4)
bool enabled - enabled state of channel

Description: Enables or disables the specified channel.

setTriggerDelay(channel, delay)

Inputs: integer channel - target channel (1-4)
integer delay - channel trigger/marker delay with respect to the analog output, specified in units of 4 sample increments (e.g. delay = 3 is a 12 sample delay)

Description: Sets a fixed delay of the marker channel associated with a given analog output channel.

setRunMode(channel, mode)

Inputs: integer channel - target channel (1-4)
integer mode - sequence or waveform mode enumerated by APS.RUN_SEQUENCE and APS.RUN_WAVEFORM.

Description: Sets the APS channel in sequence or waveform mode. Waveform mode will simply play the channel waveform memory. Sequence mode will play the link-list sequence.

setRepeatMode(channel, mode)

Inputs: integer channel - target channel (1-4)
integer mode - triggered or continuous waveform mode enumerated by 1 = continuous and 0 = triggered.

Description: Sets the APS channel in either triggered or continuous looped waveform mode. Applies only to waveform mode and has no effect on sequence mode.

Properties

These can be get/set.

samplingRate

Description: Set or get the sampling rate (in MS/s). Valid inputs are (1200, 600, 300, 100, or 40).

triggerSource

Description: Set the trigger source. Valid inputs are 'internal' or 'external'.

triggerInterval

Description: The internal trigger interval in seconds. Min value is 3.3ns and maximum is 14 seconds.

Examples

Sequence Files

This example usessetAll() on a settings structure rather than calling individual methods.

    % create settings structure
    settings = struct();
    settings.chan_1.enabled = true;
    settings.chan_1.amplitude = 1.0;
    settings.chan_1.offset = 0;
    settings.chan_2.enabled = true;
    settings.chan_2.amplitude = 1.0;
    settings.chan_2.offset = 0;
    settings.chan_3.enabled = true;
    settings.chan_3.amplitude = 0.8;
    settings.chan_3.offset = 0.1;
    settings.chan_4.enabled = true;
    settings.chan_4.amplitude = 1.2;
    settings.chan_4.offset = -0.05;
    settings.samplingRate = 1200;
    settings.triggerSource = `external';
    settings.seqfile = `Ramsey/Ramsey.h5';

    aps = deviceDrivers.APS();
    aps.connect(0);
    aps.init();
    aps.setAll(settings);
    aps.run();

    % acquire data...
    
    aps.stop();
    aps.disconnect();

The same thing can be accomplished with calls to individual methods:

    aps = deviceDrivers.APS();
    aps.connect(0);
    aps.init();
    
    % configure the APS
    % set up channels
    aps.setAmplitude(1, 1.0);
    aps.setOffset(1, 0);
    aps.setEnabled(1,true);
    aps.setAmplitude(2, 1.0);
    aps.setOffset(2, 0);
    aps.setEnabled(2,true);
    aps.setAmplitude(3, 0.8);
    aps.setOffset(3, 0.1);
    aps.setEnabled(3,true);
    aps.setAmplitude(4, 1.2);
    aps.setOffset(4, -0.05);
    aps.setEnabled(4,true);
    
    % load pulse sequence
    aps.loadConfig(`Ramsey/Ramsey.h5');

    % set to sequence mode
    aps.setRunMode(1, aps.RUN_SEQUENCE);
    aps.setRunMode(3, aps.RUN_SEQUENCE);

    % configure output rate and trigger source
    aps.samplingRate = 1200;
    aps.triggerSource = `external';
    
    aps.run();

    % acquire data...
    
    aps.stop();
    aps.disconnect();

Waveform mode

It is also possible to play single waveforms in either a triggered or continuous-loop fashion.

    aps = deviceDrivers.APS();
    aps.connect(0);
    aps.init();
    
    % configure the APS
    % set up channels
    aps.setAmplitude(1, 1.0);
    aps.setOffset(1, 0);
    aps.setEnabled(1,true);
    
    % load waveform in float mode (scaled (-1-1))
    aps.loadWaveform(1, exp(-(linspace(-2,2,100).^2)));

    % set to waveform mode
    aps.setRunMode(1, aps.RUN_WAVEFORM);
    aps.setRunMode(3, aps.RUN_WAVEFORM);

    % configure output rate and trigger source
    aps.triggerSource = `internal';
    aps.triggerInterval = '20e-3';
    
    aps.run();

    % acquire data...
    
    aps.stop();
    aps.disconnect();