Downsampling of Signal in App Designer for Real-Time Execution (Speedgoat)
7 次查看(过去 30 天)
显示 更早的评论
Hello all,
I have created a real-time capable model using Simulink Real-Time running on a real-time target machine from Speedgoat. For this I would like to create an additional GUI with the App Designer, in which among other things signals are displayed (UIAxes). The signals are streamed as follows:
% Code that executes after component creation
function startupFcn(app, varargin)
% create instrumentation object PS01
app.hInstPS01 = slrealtime.Instrument(app.mdl);
% connect signals to axes
app.hInstPS01.connectLine(app.UIAxes_PS01,'p_S1_bar');
app.hInstPS01.AxesTimeSpan = 10;
% InstrumentManager
InstrumentManager = slrealtime.ui.tool.InstrumentManager(app.UIFigure);
InstrumentManager.Instruments = app.hInstPS01;
end
The problem is that the model samples at 8kHz, as I would like to have the signals that high resolution in the logsout for post processing. But the app somehow doesn't manage such high sampling rates and is extremely sluggish/slow.
My question: Is there a possibility to sample the signals in the app only every e.g. 0.1s but still get the measured values with 8kHz in the logsout? Or does someone has any other tips how to accelerate the app?
Many thanks and greetings
Felix
0 个评论
采纳的回答
Jon Lobo
2022-12-19
Hi Felix,
If I recall correctly, the instrument object will update the app at roughly 10hz with the 8khz data and I don't believe there is a way to change the 10hz update rate. Having said that, you can downsample the 8khz for the purpose of displaying it in your AppDesigner app. To do this, you can use the name-value pair for Decimation.
app.hInstPS01.connectLine(app.UIAxes_PS01,'p_S1_bar','Decimation',10);
In this example, this should create two signals in the Simulation Data Inspector: Original (8khz) and decimated (800hz).
Personally, I would recommend using decimation for the purpose of a faster app, and use the FileLog block to log the data you are using for post-processing. That data is logged directly to disk and is more performant for high rate data such as the 8khz signal in your model.
-Jon
0 个评论
更多回答(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!