Is related to http://www.mathworks.fr/matlabcentral/answers/80099-rtw-s-function-for-different-behavior Apparently the desired behavior comes "out of the box", to be verifed through.
S-Function with different behaviors during simulation and embedded coding
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I have a microprocessor target for which I would like to have my S-function "simulate" and "generate embedded code".
By "simulation", I mean that the S-Function is executed in the computer and behaves like an I/O block reading/writing microprocessor input/output pins via a network link (the microprocessor target then runs an existing IO program). Right now, a m-file S-Function does it perfectly.
By "generation of embedded code", I mean that the generated code runs directly on the microprocessor target and is not related to any network link at all (the microprocessor target runs a program containing all the Simulink model). I'm about to write a TLC file for this second behavior.
After a look at the RTW User Guide, I could not find clues for having a single block with these two different behaviors. Is it possible using R2013?
My second question is about accelerated "simulations", how to prevent Matlab from using the TLC file and only rely on the m-file S-function? (the TLC file does not contain the simulation behavior).
Same question about the "external mode", how to force the usage of the TLC file in this mode when the code is generated?
TIA,
- Florent
Réponse acceptée
Kaustubha Govind
le 30 Déc 2013
Yes, as you noted from my previous answer, your M-file will define simulation behavior, while the TLC will be used for code generation. So you can keep your MATLAB S-function as it is, and write your TLC using the target libraries. I believe that TLC is not used for accelerated mode by default. C S-functions need to add the SS_OPTION_USE_TLC_WITH_ACCELERATOR to opt out of this behavior for instance.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Simulink Coder dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!