- Considering that only one subsystem being activated at one point of time in code, it is not the best modelling technique to use enabled subsystem for this. A better way to achieve this is to use* Variant Subsystems* (<https://www.mathworks.com/help/releases/R2016b/ecoder/ug/represent-variants-in-generated-code.html>) where you can have both subsystems as variants (<https://www.mathworks.com/help/releases/R2016b/simulink/variant-systems.html>) and set the conditions based on the parameters.
- If your architecture has a lot of legacy model and its difficult for you to modify all enabled subsystem logic, you can replace merge blocks with Variant Sources (<https://www.mathworks.com/help/simulink/slref/variantsource.html>) with appropriate conditions. So the generated code does not generate unused global variables.
Is there any way of optimization of generated code for disabled subsystem in MATLAB R2016b?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 2 Août 2020
Réponse apportée : MathWorks Support Team
le 2 Août 2020
There are 2 enabled subsystems triggered by boolean constants. I have configured "function packaging" setting available in code generation section of block parameter for both subsystems. While doing code generation, I changed value of one of the boolean constants to zero to disable the subsystem. But the generated code contains declaration of global variable (BooleanSignalTwo) which is not used by any function. This is resulting in increase in overall memory footprint.
Is there any way to optimize generated code for disabled subsystem so as to avoid auto code generation for global variable used to disable that subsystem ?
Réponse acceptée
MathWorks Support Team
le 2 Août 2020
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Component-Based Modeling dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!