Disable some or all the optimization for simulink simulation
59 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Fangjun Jiang
on 19 Jan 2023
I would suggest using blocks from Simulink Dashboard, e.g. Slider
2 Comments
Fangjun Jiang
on 19 Jan 2023
Edited: Fangjun Jiang
on 19 Jan 2023
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.
See Also
Categories
Find more on Manual Performance Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!