MATLAB: Does the Data Acquisition Toolbox support real-time closed-loop control

.datdaqData Acquisition Toolboxrealtime

I would like to know if the Data Acquisition Toolbox supports real-time closed-loop control.

Best Answer

The Data Acquisition Toolbox was not designed to support real-time control. The toolbox is specifically designed to bring measured data into MATLAB. The Data Acquisition Toolbox is built on top of MATLAB and operates in a non real-time Microsoft Windows environment. Because of this, it is not possible to achieve deterministic real-time operation.
For real-time control with MATLAB, we suggest that you take a look at the following Products:
- Simulink CoderĀ 
- Simulink Desktop Real time
- Simulink Real Time
These products are specifically designed for Real-time Control, and generate C-code that is downloadable to a real-time operating system which will guarantee real-time control simulation, and hardware-in-the-loop simulation of embedded real-time systems.
If deterministic real-time control is not required, it is possible to use the Data Acquisition Toolbox for single-point acquisition and control, however, the toolbox was not designed for such operation and any use of the Data Acquisition Toolbox for these purposes will be at the user's own risk.
When attempting to use the toolbox in this manner, the data acquired goes through all of the following steps:
1. Data is acquired and brought up through the particular hardware vendor's software
2. The data is handed off to the Data Acquisition Toolbox engine.
3. The data is made available in MATLAB.
4. The data is run through whatever control algorithm the user designs in MATLAB.
5. The data is then routed back to the engine and down through the hardware vendor's software into the board.
Because MATLAB and the Data Acquisition Toolbox are operating in a non-real-time environment, each one of the steps stated above presents an opportunity for a higher priority thread to take precedence over the control loop. This introduces the possibility for jitter in your control loop once the data has been acquired and brought into MATLAB; the complexity of the control algorithm further increases the time required to be able to control the system.