MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Guía de usuario Pagina 181

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 210
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 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:
Vista de pagina 180
1 2 ... 176 177 178 179 180 181 182 183 184 185 186 ... 209 210

Comentarios a estos manuales

Sin comentarios