Data Acquisition Toolbox™ provides Simulink® blocks for acquiring live data into Simulink models and for outputting live signals to the physical hardware.
This example shows how to uses the Analog Input block to acquire live analog data from a data acquisition device into Simulink. The acquired data is processed in Simulink and uses the Analog Output block to output data to an analog data acquisition device. Its shows how a Simulink model can communicate with multiple pieces of hardware in the same model. In this case, the data acquisition devices used are from Measurement Computing™ and National Instruments®.
Note: This example requires 32-bit version of MATLAB®, Data Acquisition Toolbox and Simulink to open and run the model.
Watch the system response. (5 seconds)
The input signals are acquired from an MCC data acquisition device (USB-1616FS). Signals are acquired from three channels at the rate of 30 samples/second.
The acquired data is quantized, and processed using a switch whose output value depends on the square trigger input. A weighted moving average block is used to determine the output signal. The processing algorithm can be simple or complex depending on your process.
The processed data is output to a single channel of a National Instruments device (PCI-6251) at a rate of 30 samples/second. A plot of the input and the output signals are shown below.
Even though Measurement Computing and National Instruments devices were used for this example, this model can be easily updated to connect your models to other supported data acquisition devices. This provides you the flexibility to use the same Simulink model with different data acquisition hardware.