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

  • 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 180
Writing Wrapper S-Functions
4-15
to your C algorithm (my_alg), you can elim inate bo th the SimStruct and the
extra function call, thereby improving the efficiency and reducing the size of
the generated code.
Inlining a wrapper S-function requires an
sfunction.tlc file for the
S-function; this file must contain the function call to
my_alg.Thispicture
shows the relationships between the algorithm, the wrapper S-function, and
the
sfunction.tlc file:
Figure 4-2: Inlining an Algorithm by Using a TLC File
To inline this ca ll, y o u hav e t o place your function cal l into an sfunction.tlc
file with the sam e na me as t he S-function (in this example, wrapsfcn.tlc).
This cause s the Target L ang u ag e Compiler t o override the default met hod of
my_alg.c
myalg()
{
<C code here>
}
wrapper.c
...
MdlOutputs
{
...
y = my_alg();
...
}
...
wrapsfcn.tlc
...
%<y> = my_alg(%<u>);
...
The wrapsfcn.tlc file tells the
Real-Time Workshop how to inline the
call to
my_alg using this statement:
Vue de la page 180
1 2 ... 176 177 178 179 180 181 182 183 184 185 186 ... 209 210

Commentaires sur ces manuels

Pas de commentaire