Simulink Desktop Real-time with DAT I/O (or NON- SLDRT I/O blocks) with the Real-time-sync block, and Matlab functions in Simulink
조회 수: 2 (최근 30일)
이전 댓글 표시
Can the normal Data Acquisition Toolbox Blocks available in Simulink be synchronized in real time with the Desktop Real-time "real-time-sync" block?
I use the signal generator block to generate a sine wave at say 10Hz, directly feed it into an Analog Output from the Data Acquisition Block "Analog Output" (NOT the Desktop real-time analog output block), set the sample rate of my NI PCIe-6321 setting to the max, and set the configuration setting's fixed time step to something like .0001 so that the sine wave is not so aliased and staircasey- on an external real scope connected to the analog output voltage, the sine wave signal is incredibly slow. I realize this is because the simulation time is NOT real time.
I thought I could stick in the Desktop real-time-sync block to make (any?) block in normal mode synchronized to real time, but still see the same result (a very slow sine wave, NOT 10Hz on a real external scope).
I know if I use strictly the Desktop Real-Time analog output this issue is resolved, and it truly is real time.
Am I missing something about the "real-time sync" block then? It can't synchronize a DAT output block? I ran the Van der Wahls example- which has no IO features, its fine. I can't find for the life of me what the "real-time sync" block is limited to... can it synchronize a matlab function that is put into a simulink block?
The reason I ask is, I have a Measurement Computing DAQ that has NO support from the desktop real-time IO blocks (https://www.mathworks.com/matlabcentral/answers/325269-measurement-computing-data-acquisition-devices-support-in-data-acquisition-toolbox-across-releases), or any Simulink DAQ block for that matter. It is one of these nicer 24 bit ones (https://www.mccdaq.com/usb-data-acquisition/USB-2416-Series.aspx). In such a case (it does have regular matlab support I suppose?), if I want to write my own matlab (.m file, not going to another language) to send output and get input from that DAQ, and then put it into a Simulink block, can the real-time-sync block from the Desktop Real-Time be used to synchronize IO such that I get the same result as using a Desktop Real-Time IO block?? I also have DAQs that DO have Simulink DAT support but not in Desktop Real-Time IO support (data translation daq), and GPIB devices I want to control in real time. Are all these synchronizable to real-time control by Dekstop Real-Time IO block, without resorted to generating C code, Mex file, etc? (or what would be the suggested flow in that case).
The path/language/software I choose has a lot of implications for whether my code can be used by other engineers from the get go or how much extra training I need to plan in, and I've spent a week digging around and haven't found a very centralized place discussing all this. Thanks for the help, really appreciate it.
댓글 수: 0
채택된 답변
Mandar Patwardhan
2017년 7월 28일
Can the normal Data Acquisition Toolbox Blocks available in Simulink be synchronized in real time with the Desktop Real-time "real-time-sync" block? Using the Real Time Sync block won't work with the DAQ Blocks. If you want to speed up the execution, you can try running the model with the DAQ blocks in Accelerator mode. (But this won't be in Real Time).
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Target Computer Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!