# Starting with Multi-instrument Mode

Multi-instrument Mode (MiM) allows a user to use more than one instrument simultaneously on the Moku platform. Depending on the hardware and instrument combination, different instrument counts and capabilities are available in this mode. For example, Moku:Go supports two instruments simultaneously while Moku:Pro supports four; Moku:Pro's Lock-in Amplifier retains full functionality while Moku:Go's loses extras like the PID Controller.

There are several steps required in order to use MiM:

  1. Select the Multi-instrument Mode configuration you wish to use
  2. Load instruments in to one or more of the slots
  3. Configure connections between the instruments, each other and external I/O
  4. Configure the external I/O (i.e. ADCs, DACs and/or Digital I/O) with the correct settings for gain, direction, impedance etc.

Depending on which programming language you choose, each step may look a little different.

MATLAB, LabVIEW

Multi-instrument Mode is available in MATLAB and LabVIEW, however documentation for these environments is still under development.

# Selecting the Multi-instrument Mode Configuration

The configuration is parameterized by the number of slots you wish to have. At present, Moku:Go supports only 1 or 2 slots; Moku:Pro only supports 1 or 4. Specifying "1" is equivalent to disabling Multi-instrument Mode.

If using the REST API directly, the user is responsible for obtaining a Client Key before entering Multi-instrument Mode. See the REST API Getting Started Guide for more information.

# Loading Instruments to Slots

If using our packaged drivers, like for Python, then the loading and addressing of instruments in specific slots is taken care of by the library, simply request an instrument object from the MultiInstrument class as below rather than creating one directly.

When interacting with an instrument directly from the REST API, the path to the instrument is prefixed with the slot in to which it has been put. For example, if you have Waveform Generators in both slots 1 and 2, then generating waveforms from each of the two instruments would use the paths /api/slot1/waveformgenerator/generate_waveform and /api/slot2/waveformgenerator/generate_waveform. To trigger the load of an instrument to a slot, you just need to GET the instrument's base path, e.g. a GET to http://<ip>/api/slot1/waveformgenerator will trigger the load of a Waveform Generator instrument in to Slot 1.

# Configuring Connections

Connections are specified as a list of maps, where each map specifies a source and destination pair. The following examples set up a routing from Input1 (ADC channel 1) to the first input of Slot 1, the first output of Slot 1 to the first input of Slot 2, then the first output of Slot 2 to Output1 (DAC channel 1).

See also the documentation for set_connections.

# Configuring External I/O

External I/O such as ADCs, DACs and Digital I/O cannot be configured by the instruments themselves when in Multi-instrument Mode. For example, the Oscilloscope cannot set the input range, as that range might be shared by multiple instruments. As such, settings front-end (ADC) settings, output (DAC) settings, and Digital I/O directions, are all done on the Multi-instrument level. If you attempt to do these operations on an individual instrument while in Multi-instrument Mode, an error will be raised.

See also the documentation for the Multi-instrument Mode versions of set_frontend, set_output and set_dio.

# Next Steps

The instruments can now be controlled in the same way as usual. If using a packaged driver like Python, just ensure that you use the instrument object that is returned from the MiM connection, rather than creating a new one. If using the REST API directly, make sure to specify the slot in the URL.

Connection, front-end, output and DIO settings can all be changed dynamically without interrupting the running instruments. New instruments can be loaded in to slots using the procedure above without interrupting the instruments in other slots.