Disable some or all the optimization for simulink simulation

조회 수: 58 (최근 30일)
Alexandre
Alexandre 2023년 1월 18일
편집: Fangjun Jiang 2023년 1월 19일
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.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2023년 1월 19일
I would suggest using blocks from Simulink Dashboard, e.g. Slider
  댓글 수: 2
Alexandre
Alexandre 2023년 1월 19일
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 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 CenterFile Exchange에서 Manual Performance Optimization에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by