Downsampling of Signal in App Designer for Real-Time Execution (Speedgoat)
6 views (last 30 days)
Show older comments
Felix Brenner on 4 Mar 2022
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.AxesTimeSpan = 10;
InstrumentManager = slrealtime.ui.tool.InstrumentManager(app.UIFigure);
InstrumentManager.Instruments = app.hInstPS01;
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
Jon Lobo on 19 Dec 2022
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.
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.
More Answers (0)
Find more on Target Computer Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!