How to avoid Code Inspector warnings about If blocks connected to Constant blocks?
조회 수: 5 (최근 30일)
이전 댓글 표시
I have a model that I'm trying to update to pass all Code Inspector checks within Model Advisor, because I will be generating code from it. One check that I've not been able to resolve is under the "Check If blocks" section and reads as follows:
Warning: The following blocks are constant or have ports connected to Constant blocks or other blocks that are constant
An example is that we have an internal timer where the confirmation time is coming from a Constant block; the Constant block has a non-inf update rate and the parameter within it is tuneable. So when code is generated, it may actually change during execution but it fails the Code Inspector checks.
How can use tuneable parameters, in Constant blocks or otherwise, and avoid the error I described above?
Edit: this is with R2016, and we have standards that we should avoid placing parameters within masks as this can hide functionality.
댓글 수: 0
답변 (1개)
Birdman
2017년 10월 18일
If you are using an internal timer, Simulink has a block named Clock, which provides the simulation time of the model. You may use it instead of a Constant block. Hope this helps.
댓글 수: 4
Birdman
2017년 10월 24일
You can set the parameter you want to tune as an input and take it as an output in the function.
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Code Inspector에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!