Acquire single sample from multiple analog channels of data acquisition device
Data Acquisition Toolbox™
Note: Some devices are not supported by the Simulink® blocks in Data Acquisition Toolbox. To see if your device supports Simulink, refer to Supported Hardware.
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 execution. The block acquires a single sample every time step, synchronously from the device, during the model run time.
The block has no input ports. It has one or more output ports, depending on the configuration you choose in its dialog box.
Use the Analog Input (Single Sample) block to incorporate live measured data into Simulink for:
System and algorithm modeling
Model and design validation
Analog input acquisition is done synchronously, according to the following diagram.
At the first time step (T1), data is acquired from the selected hardware channels. The simulation does not continue until data is read from all channels.
Notes To use this block, you need both Data Acquisition Toolbox and Simulink software.
You can use Analog Input (Single Sample) block only with devices that support single sample acquisition. If the device does not support single sample acquisition, the model generates an error. To acquire data from devices that do not support acquisition of a single sample (such as devices designed for sound and vibration), use the Analog Input block.
If you have DSP System Toolbox™, you can use this block for signal applications.
This block supports the use of Simulink Accelerator™ mode, but not Rapid Accelerator or code generation.
The block supports the use of model referencing, so that your model can include other Simulink models as modular components.
For more information on these features, see the Simulink documentation.
Use the Block Parameters dialog box to select your device and to set other configuration options.
The 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.
The channel configuration table lists your device hardware channels and lets you configure them. Specify these parameters for each selected channel:
Channel ID — Hardware channel ID specified by the device. The Channel ID column is read-only and the parameters are defined when the device is selected.
Name — Channel name. By default
the table displays any names provided by the hardware, but you can
edit the names. For example, if the device is a sound card with two
channels, you can name them
Module — Device ID the channel belongs to. The Module column is read-only. If a compactDAQ chassis is selected, it shows the ID of the compactDAQ module which the channel belongs to; otherwise it shows the ID of the device.
Measurement Type — Measurement type of the channel.
Input Range — Input ranges available for each channel supported by the hardware, defined when a device is selected.
Terminal Configuration — Hardware terminal configuration, such as single-ended, differential, etc. The terminal configuration options are defined by the capabilities of the selected channel.
Coupling — Hardware coupling configuration, such as AC or DC. The coupling type is defined when a device is selected
1 for all channels (default) — Outputs data from a single port as a vector with an element for each selected channel.
1 per channel — Outputs data from
N ports, where N is equal to the number of selected channels. The
output for each port is a scalar value. For naming, each output port
uses the channel name if one was specified, otherwise the 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 1 (seconds). For more information, see What Is Sample Time?.
Select this option to output the absolute timestamp. This option
adds a new output port to the block. The data type of this port is
double (datenum), which corresponds to a serial date number. You can
convert the data into a datetime array with the