Pacer in the codegen Executable

2 views (last 30 days)
Oliver Ouyang
Oliver Ouyang on 11 Aug 2022
Edited: Infinite_king on 15 Dec 2023
Hi,
I used to use the Set Pace block in the Aerospace Blockset for pilot in the loop simulation and use Simulink coder to generate a .exe file. The .exe can run in real-time as a standalone software without Matlab installed. Mathworks seems to block such function with latest Simulink Coder. The coder will ignor the pace block.
Is there any alternative way to generate an .exe with real-time pace?
Thanks!

Answers (1)

Infinite_king
Infinite_king on 15 Dec 2023
Edited: Infinite_king on 15 Dec 2023
Hi Oliver Ouyang,
I understand that you are looking for a block which has same functionality as ‘Set Pace’ or ‘Simulation pace’ block with the support of code generation.
The “Simulation Pace” block is not suitable for deployment, therefore, it will not generate deployable code. The “Simulation Pace” block allows you to slow down the pace of model simulation, enabling a more comfortable observation of connected animations and a clearer understanding of system behaviour. Slowing down the simulation rate facilitates a better grasp of the underlying system design, identification of design issues, and the demonstration of near real-time behaviour. It provides the ability to view results and inspect your system dynamically while the simulation is ongoing.
This block is particularly useful in situations where one simulated second corresponds to completion in a few milliseconds of wall clock time. While simulating, you can continue to utilize this feature through the 'Simulation Pacing Options.' For more details, please refer to the MATLAB documentation at, https://www.mathworks.com/help/simulink/slref/simulationpacingoptions.html?s_tid=srchtitle_site_search_2_set%20pace%20block
To achieve this behaviour in the executable, one possible approach I can suggest involves two steps:
  1. Redesign the model such that the pace will depend upon set parameters.
  2. Write a script that takes pacing as input, programmatically modifies the model parameters, and generates code for the updated model.
For more information on setting the parameters programmatically, refer the following MATLAB documentation,
For more information on generating code, refer the following MATLAB documentation,
Hope this is helpful.

Categories

Find more on Event Functions in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!