![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1571522/image.png)
Real Time MPC Implementation Using NI DAQ Board
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1569712/image.jpeg)
0 Commenti
Risposta accettata
Hyunuk Ha
il 18 Dic 2023
Spostato: Angelo Yeo
il 25 Dic 2023
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1571522/image.png)
Then, you can directly access your NI hardware with your algorithm.
For more detailed information,
0 Commenti
Più risposte (1)
SANKALP DEV
il 19 Dic 2023
Modificato: SANKALP DEV
il 20 Dic 2023
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:
- Live Acquisition, Signal Processing, and Generation: https://www.mathworks.com/help/daq/live-data-acquisition-signal-processing-and-data-output.html
- Spectral Analysis on Live Data: https://www.mathworks.com/help/daq/performing-spectral-analysis-on-live-data.html
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
0 Commenti
Vedere anche
Categorie
Scopri di più su National Instruments Frame Grabbers in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!