Missing documentation for slrealtime.Instrument methods?

1 次查看(过去 30 天)
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.

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by