MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Guide de l'utilisateur Page 98

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 210
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 97
3 Writing S-Functions As C-MEX files
3-54
The parameter can also be a variable as in
modules = 'sfun_module1 sfun_module2'
set_param(sfun_block,'SFunctionModules','modules')
or a string to be evaluated (this is needed when the modules are valid
identifiers):
set_param(sfun_block,'SFunctionModules','''sfun_module1 sfun_module2''')
S-Function RTWdata for Generating Code with RTW
There is a property of blocks called RTWdata, which can be used by the Target
Language Compiler when inlining an S-function.
RTWdata is a s tru ctu re of
strings that yo u can at tach to a block. It is s av ed wit h the mod e l and placed in
the
model.rtw file when generating code. For example, this set of MATLAB
commands,
mydata.field1 = 'information for field1';
mydata.field2 = 'information for field2';
set_param(gcb,'RTWdata',mydata)
get_param(gcb,'RTWdata')
produces this result:
ans =
field1: 'information for field1'
field2: 'information for field2'
Inside the model.rtw for the associated S-function block is this information:
Block {
Type "S-Function"
RTWdata {
field1 "information for field1"
field2 "information for field2"
}
mdlRTW
The mdlRTW routine can help you inline (embed) your S-function in the
generated code. Inlining means to embed in your code in Real-Time Workshop
generated code. Typically, this is done for performance reasons. You may also
be required to inline your S-function if you have an
mdlProcessParameters
Vue de la page 97
1 2 ... 93 94 95 96 97 98 99 100 101 102 103 ... 209 210

Commentaires sur ces manuels

Pas de commentaire