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:
- Model Reference: Break down your Simulink model into referenced models. This way, when you modify a specific module, you only need to recompile and simulate the referenced model, rather than the entire system. This can significantly reduce compilation time. Refer the following documentation for more information about using model reference in Simulink: https://www.mathworks.com/help/releases/R2023b/simulink/ug/overview-of-model-referencing-1.html
Hope this helps.