Simulink Code Generation: blocks with masks and tunability

3 vues (au cours des 30 derniers jours)
Gerardo Medrano Arana
Gerardo Medrano Arana le 1 Déc 2022
Commenté : Fangjun Jiang le 7 Déc 2022
Is is possible to generate tunable code from a masked block with parameters in the mask?
For example:
In the Matlab Workspace:
>> K100 = Simulink.Parameter(1.0);
A masked Simulink Block has a parameter with "Name" 'P'. In the mask I introduce K100, so P has a value of K100.
Now, P is accessible under that mask, where it takes the same value of K100.
Is there a way to generate code from that block and ensure that the C code retains tunability (if K100 changes)?
Thanks

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 2 Déc 2022
  2 commentaires
Gerardo Medrano Arana
Gerardo Medrano Arana le 7 Déc 2022
Thanks, that worked, but I am having issues with arrays, for example:
>> K100 = Simulink.Parameter([1 2]);
'P' takes that from the mask input, and under the mask I use a Gain block with, for example P(1).
Tunabilty is lost in this case. Is there any workaround?
Thanks again.
Fangjun Jiang
Fangjun Jiang le 7 Déc 2022
I remember this is one of the limitations for tunability, although I can't pinpoint the exact reference in this link.
Maybe just turn on the " Detect loss of tunability" to see if it detects it and point you to the reference.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Schedule Model Components dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by