File Exchange Pick of the Week

Our best user submissions

Simulink Pacer (Again) 2

Posted by Sean de Wolski,

Sean‘s pick this week is Simulink Pacing by MathWorks’ Simulink Development team.

Last summer, I highlighted the Simulink Pacer block as a means to slow a simulation down to a desired speed so you can see what’s happening. Yesterday, one my colleagues was demonstrating a customized prototype that streams data directly from Simulink to a cloud IoT platform. He elegantly used the new simulation pacing capabilities to slow the simulation so you could see the simulation in Simulink and the IoT dashboard updating at the same time.

Here’s the same model from last time. To enable simulation pacing in Simulink, select the “Simulation” drop down and then “Pacing Options”.

The new simulation pacing options allow me to drag the slider to adjust the speed as necessary.

Comments

Give R2018a a try and let us know what you think here.

Get the MATLAB code

Published with MATLAB® R2018a

Note

Comments are closed.

2 CommentsOldest to Newest

Marian Kersting replied on : 1 of 2

Hey,
i have a Question regarding this “RealTimePacer”. Since i was googling i did not find an answer to the Topic of Codegeneration. https://de.mathworks.com/help/simulink/ug/simulation-pacing.html
Following this Link there is no information about it. (Often in other Articles there are Hints at the bottom.)

Can you tell me more about it?
ATM i use a Function i found at MatlabExchange and wrote a TLC-file for Code generation myself. It works. So far, but an implemented Option would be nicer.

Usecase:
I am generating Code of a Simulink Model and export it. Import in Eclipse and (cross-)compile it for a Singe Board Computer with Debian (and lots of input and OutputPorts).

Greetings
Marian Kersting

Greg Wolff replied on : 2 of 2

Hi Marian,
As you probably know, the pacing option discussed above is strictly for simulation in Simulink.

It looks like you want to automate the generation of a real-time scheduler (or at least attachment to the scheduler) in the generated code. This generally requires a code generation target.

Not knowing exactly which Single Board Computer target you are targeting, and what MathWorks products you have available it’s difficult to make a specific recommendation at this point.

As an example of the type of thing that you might be able to use, and potentially customize: https://www.mathworks.com/help/supportpkg/armcortexa/index.html

This supports targeting “Linux” as an operating system.

There is also documentation on “cross compiling” generated code on a Windows machine to Linux here:
https://www.mathworks.com/help/rtw/ug/cross-compiling-code-generated-on-a-microsoft-windows-system.html

There are a fair number of options here, and I’ve just listed two above. You may want to consult MATLAB Answers, the MathWorks File Exchange (as you have done previously) or GitHub for examples like this: https://github.com/CTU-IIG/linux-rt-simtarget

Hope this helps,
-Greg