How to avoid Code Inspector warnings about If blocks connected to Constant blocks?

6 visualizaciones (últimos 30 días)
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.

Respuestas (1)

Birdman
Birdman el 18 de Oct. de 2017
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 comentarios
Nathan B
Nathan B el 23 de Oct. de 2017
I will test this out - but I suspect I will lose the ability to tune the parameter as the model is running (using generated code). I will try and report back.
Birdman
Birdman el 24 de Oct. de 2017
You can set the parameter you want to tune as an input and take it as an output in the function.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Code Inspector en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by