Missing documentation for slrealtime.Instrument methods?

조회 수: 2 (최근 30일)
Leonardo Ricupero
Leonardo Ricupero 2022년 6월 13일
댓글: Stefanie Schwarz 2023년 10월 25일
Hello,
I'm trying to evaluate a setup for real time testing. I've found useful information on this link, where it is shown how to leverage python scripting to run a slrealtime application and get the acquired signals from the real time HW.
The script runs fine, but in an attempt to extend it for our purposes, I'm struggling to find some documentation on some of the methods used in such script. For example:
instrument.getBufferedData % no doc for getBufferedData method
and:
instrument.BufferData=true % no docs for BufferData property
The purpose is to be able to get signal values in real time in order to take actions during the execution of a test case.
Thanks in advance for any help!
Leonardo

채택된 답변

Pablo Romero
Pablo Romero 2023년 1월 9일
You can find more information about the getBufferedData method and the BufferData property at Gets data from the real-time application instrument buffer - MATLAB getBufferedData (mathworks.com).
Please notice that the main purpose of the buffered data mode is providing support for external languages via the MATLAB Engine API that do not support callbacks. Using buffered data mode is not strictly required when manipulatin real-time data within MATLAB.
  댓글 수: 3
Hui Xiao
Hui Xiao 2023년 9월 8일
slrealtime.Instrument object don't have a public propertiey BufferedData, so I am still confused on how to enable the buffered data mode.
Stefanie Schwarz
Stefanie Schwarz 2023년 10월 25일
Hi Hui, there is a typo in the 'getBufferedData' our documentation. It should be:
Instrument.BufferData = true;
('BufferData', not 'BufferedData').
We apologize for this and will fix the typo in the future MATLAB documentation.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Marcel Schoch
Marcel Schoch 2022년 9월 16일
I have not found any documentation neither, but after having played around with the various options to get data in realtime, I've noticed the following:
Getting realtime data with the callback method
I've made somewhat mixed experience with using a callback method, especially in an app, it consumed a lot of resources and the callback is called very irregularely. It also made my application very slow, because it is called multiple times per second, and there does not seem to be any control over the call frequency.
instrument = slrealtime.Instrument('path_to_model.mldatx');
instrument.addSignal(path, 1);
inst.connectCallback(@(o,e)thisisacallback(o,e)); % adding a callback method
instrument.AxesTimeSpan = 10;
instrument.AxesTimeSpanOverrun = 'wrap';
tg.addInstrument(instrument);
Getting realtime data with getBufferedData
The following code works very well, instrument.getBufferedData() and datas(...) takes only very little time to execute. I prefer this solution as I have control over when data is read out.
instrument = slrealtime.Instrument('path_to_model.mldatx');
instrument.addSignal('path_to_signal', 1);
tg.addInstrument(instrument);
instrument.BufferData = true; % set buffered to true
% read out data:
datas = instrument.getBufferedData();
data = datas('path_to_signal:1');
Maybe this helps a bit.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by