Real Time MPC Implementation Using NI DAQ Board

10 ビュー (過去 30 日間)
Muhammad
Muhammad 2023 年 12 月 15 日
移動済み: Angelo Yeo 2023 年 12 月 25 日
Dear MATLAB Community,
I am replacing PID controller with Model Predictive Controller for Atomic Force Microscopy (a physical Instrument)
I have designed MPC Controller in simulink, at this stage it is not good in disturbance rejection but coming to main point, I want to implement it to the real system using NI DAQ USB 6363, or Compact NI RIO 9024, both are available in my Lab.
How can I use anyone of above device and simulate controller in real time?
I will have one input (Blue arrow) from Simulink to Plant, and one Measured output from Analog sensor to MPC Controller (red arrow).
I think, implementation with real time requires some additional code to calculate the voltage signal and translate my voltage signal etc.
I am looking for some guideline and help regarding this matter. Please guide me in detail.

採用された回答

Hyunuk Ha
Hyunuk Ha 2023 年 12 月 18 日
移動済み: Angelo Yeo 2023 年 12 月 25 日
Hi Muhammad,
You can utilize 'Data Acquisition Toolbox Support Package for National Instruments NI-DAQmx devices' at:
Once you installed,
(MathWorks toolbox) Data acquisition toolbox
Support Package for NI-DAQ
then, you can select you H/W at,
'Configuration(Ctrl+E) -> Hardware Implementation -> Hardware board' with yours.
Then, you can directly access your NI hardware with your algorithm.
For more detailed information,

その他の回答 (1 件)

SANKALP DEV
SANKALP DEV 2023 年 12 月 19 日
編集済み: SANKALP DEV 2023 年 12 月 20 日
Hello Muhammad,
I understand that you are interested in implementing a MPC controller model in Simulink using NI DAQ USB 6363 or Compact NI RIO 9024.To achieve this you can go through following steps:
1) Install Support Package: Install the Data Acquisition Toolbox Support Package for National Instruments NI-DAQmx Devices. You can refer to the following installation guide: https://www.mathworks.com/matlabcentral/fileexchange/45086-data-acquisition-toolbox-support-package-for-national-instruments-ni-daqmx-devices
2) Hardware Connection: To acquire data from a National Instruments device and discover a device that supports input measurements, access the device in the table returned by the daqlist command. For detailed instructions on hardware connection and data acquisition, refer to the following link: https://www.mathworks.com/help/daq/acquire-data-using-ni-devices.html
3) Simulink Model Preparation: You must modify your Simulink model to include I/O blocks compatible with the NI hardware. To perform live acquisition, signal processing and generation you can go through the following examples:
4) Generate Voltage signals: Once you know the module, slot and the name of the channel, you should create a DataAcquisition, set the generation scan rate by setting the Rate property and add analog output channels using addoutput. For detailed information on acquisition, signal processing, and generation consider exploring the following example: https://www.mathworks.com/help/daq/generate-signals-on-ni-devices-that-output-voltage.html
For additional information on getting started with NI devices, utilizing analog and digital inputs and outputs, and performing simultaneous and synchronized operations, please refer to the following MATLAB documentation: https://www.mathworks.com/help/daq/national-instruments-hardware-examples.html
Thanks, and regards,
Sankalp dev

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by