Disable some or all the optimization for simulink simulation

58 vues (au cours des 30 derniers jours)
Alexandre
Alexandre le 18 Jan 2023
Modifié(e) : Fangjun Jiang le 19 Jan 2023
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.

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 19 Jan 2023
I would suggest using blocks from Simulink Dashboard, e.g. Slider
  2 commentaires
Alexandre
Alexandre le 19 Jan 2023
I also found a couple of tricks by try and error such as use "Log selected signal" option on the wire connected to the Constant block.
But from what I understand, Simulink priority is simulation optimization and we can't go back once it's implemented in new releases?
That's not a bad thing but disabling these optimizations would be a good option to add in Simulink Configuration Parameters menu if it's not already done.
Fangjun Jiang
Fangjun Jiang le 19 Jan 2023
Modifié(e) : Fangjun Jiang le 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Manual Performance Optimization dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by