Disable some or all the optimization for simulink simulation
56 次查看(过去 30 天)
显示 更早的评论
Hi,
I'd like to know if there is option to disable some or all the simulation optimization in Simulink? I sometimes run my simulation in real-time and I modify Constant block while looking at scopes to troubleshoot. Here are the optimization that I do not want and that causes me problem :
- If I create a logic that originates from a Constant block, I can't have a scope constantly updating. The workaround I found was to set Constant block sampling time to -1 but unfortunately, I can't make Simulink do it by default each time I add a Constant in my model and it's very easy to forget.
- Some Constant block are modifyable when simulation is running, some are not and I found out it was caused by optimization :
>> set_param(gcb,'Value','0.5')
Cannot change parameter 'Value' of 'Digital_Cmd_Treatment2/p_HW_CMD_DIS1' while simulation is running.
The block was made virtual as it was optimized for simulation.
- When I run a simulation in Accelerator, almost all my signals yellow label shows "optimized" instead of the signal value.
Is there solution to disable some optimization?
Thank you.
0 个评论
回答(1 个)
Fangjun Jiang
2023-1-19
I would suggest using blocks from Simulink Dashboard, e.g. Slider
2 个评论
Fangjun Jiang
2023-1-19
编辑:Fangjun Jiang
2023-1-19
The optimization you are looking for is under "Simulation Target", "Block reduction".
When you run simulation in accelerator mode, it generates code first. The optimization is under "code generation", "optimization".
But fundermentally, changing the sample time of a Constant block, or making a signal "test point" is not the right approach. Making the Constant variable "tunable" is the right way. That is basically what the Slider block does.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Manual Performance Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!