Acquire single sample from multiple analog channels of data acquisition device
Data Acquisition Toolbox™
Note: You cannot use certain devices with Data Acquisition Toolbox Simulink® blocks. Refer to the Supported Hardware page to see if your device supports Simulink use.
The Analog Input (Single Sample) block opens, initializes, configures, and controls an analog data acquisition device. The opening, initialization, and configuration of the device occur once at the start of the model's execution. The block acquires a single sample every sample time, synchronously from the device, during the model's run time.
Note: You need a license for both Data Acquisition Toolbox and Simulink software to use this block.
The block has no input ports. It has one or more output ports, depending on the configuration you choose in the Source Block Parameters dialog box. The following diagram shows the block configured with one port for both channels and with one port for each channel, in the case of a device that has two channels.
Use the Analog Input (Single Sample) block to incorporate live measured data into Simulink for:
System and algorithm modeling
Model and design validation
Note: You can use Analog Input (Single Sample) block only with devices that support single sample acquisition. The block will error out when the model is run with a device that does not support single sample acquisition. To acquire data from devices that do not support acquisition of a single sample (like devices designed for sound and vibration), use the Analog Input block.
You can use the Analog Input (Single Sample) block for signal applications by using it with basic Simulink and DSP System Toolbox™.
The Analog Input (Single Sample) block supports the use of Simulink Accelerator™ mode. This feature speeds up the execution of Simulink models.
Note: You need the C++ Compiler to use Simulink Accelerator mode.
This block supports the use of model referencing. This feature lets your model include other Simulink models as modular components.
For more information on these features, see the Simulink documentation.
Use the Source Block Parameters dialog box to select your device and to set other configuration options.
The data acquisition device from which you want to acquire data. The items in the list vary, depending on which devices you have connected to your system. Devices in the list are specified by adaptor/vendor name and unique device ID, followed by the name of the device. The first available device is selected by default.
Specifies the hardware channel configuration, such as single-ended, differential, etc. When you select a device, the device capability defines the available values for input type.
The channel configuration table lists your device's hardware channels and lets you configure them. Use the check boxes and selection buttons to specify which channels to acquire data from. These parameters are specified for each selected channel:
Hardware Channel — Displays the hardware channel ID specified by the device. The Hardware Channel column is read-only and the parameters are defined when the device is selected.
Name — Specifies the channel name.
By default the table will display any names provided by the hardware,
but you can edit the names. For example, if you are using a device
to acquire indoor and outdoor temperature from two channels, you can
Input Range — Specifies the input ranges available for each channel supported by the hardware, and the available values are defined when a device is selected.
Select 1 for all hardware channels (default) or 1 per hardware channel.
Using 1 for all hardware channels, outputs data from a single port as a matrix, with a size of [1 x Number of Channels selected].
Using 1 per hardware channel, outputs data
from N ports, where N is equal to the number of selected channels.
Each output port will be a scalar value. For naming, each output port
will use the channel name if one was specified, or otherwise use ["HWChannel"
+ channel ID], for example,
Specifies the sample time of the block during the simulation. This is the rate at which the block is executed during simulation. The default value is 0.01 (seconds).