When generating an s-function from a simulink block, can I select fields within an input structure to make them tunable parameters which show up within the s-functions mask?

6 vues (au cours des 30 derniers jours)
I'm really just curious if there is a simple way to make tunable parameters from individual fields within structures that are passed into a simulink block when generating an s-function. What I'm looking for is something analgous to how you would normally select an input as a tunable parameter when generating an s-function, which then shows up in your s-functions simulink block mask. However, with passing workspace structures into the simulink block, it seems like you can select the structure as tunable and the generated code seems to provied a path to make the underlying fields tunable. However, I can't seem to find a simple way for this structure information to show up within my mask, that is, without having to do some code editing and recompiling, which I'm trying to avoid.

Réponse acceptée

Benjamin Thompson
Benjamin Thompson le 25 Fév 2022
It seems possible, according to this article in the Mathworks documentation, "Organize Data into Structures in Generated Code".
Your comment about passing individual fields of a structure to an S-Function as tunable parameters could be problematic, as I seem to remember that the "." operator was in the list of operators making an expression non-tunable. Right now I cannot lay my mouse on that article in the documentation. If you have success please post a followup comment.
  1 commentaire
Jeremy Bauman
Jeremy Bauman le 28 Fév 2022
Like you mention, I also believe it is possible (though untested by me) to edit the generated code and recompile to make underlying structure fields tunable. However, I was hoping there might be a very simple streamlined (click a button, check a couple boxes) way to make those structure fields tunable. But you also correctly point out that the "." operator is a category 4 operator, which is not supported as mentioned in the documentation "Limitations for Block Parameter Tunability in Generated Code". Thanks for the reply. Hopefully this might be something possible in the future.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Simulink Coder dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by