Pacer in the codegen Executable

3 次查看(过去 30 天)
Oliver Ouyang
Oliver Ouyang 2022-8-11
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!

回答(1 个)

Infinite_king
Infinite_king 2023-12-15
编辑:Infinite_king 2023-12-15
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.

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by