How to avoid Code Inspector warnings about If blocks connected to Constant blocks?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Birdman
il 18 Ott 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 Commenti
Birdman
il 24 Ott 2017
You can set the parameter you want to tune as an input and take it as an output in the function.
Vedere anche
Categorie
Scopri di più su Simulink Code Inspector in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!