Effacer les filtres
Effacer les filtres

Simulink仿真参数动态调节

10 vues (au cours des 30 derniers jours)
鑫 王
鑫 王 le 30 Nov 2023
应用场景:需要从matlab反复启动Simulink并进行仿真,每次仅修改整个系统中的一个模块的部分参数,但每次修改后重新仿真时,均会有编译Simulink模型过程,这个过程会消耗较多时间,请问有没有什么技术手段可以减少启动仿真时编译模型时间

Réponses (1)

Harimurali
Harimurali le 10 Déc 2023
Hi 鑫 王,
由于我的母语不是中文,所以我会尝试用英语回答这个问题。感谢您的理解。
I understand that you want to prevent the model from recompiling each time you modify the parameters of some module.
To reduce the compilation time of a Simulink model when starting simulation, you can consider the following methods:
  • Fast Restart: Simulink provides a feature called "Fast Restart" that allows you to make changes to a model and then restart the simulation without recompiling the entire model. Refer the following documentation for more information on Fast Restart and how to enable it in Simulink: https://www.mathworks.com/help/releases/R2023b/simulink/ug/fast-restart-workflow.html
  • "set_param" function: Simulation time can be reduced by using the "set_param" function to modify simulation parameters and simulate the model. By using "set_param", you avoid the overhead of re-initializing the model and recompiling the generated code. Also, model and its associated data may be cached in memory, reducing the overhead of loading. Here is an example code that shows how to use the "set_param" function:
set_param("path\to\the\block", parameter, value);
set_param('model_name',"SimulationCommand","start");
Refer the following documentation for more information about the "set_param" function:
Hope this helps.

Catégories

En savoir plus sur 编程式模型编辑 dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!