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

  • 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 175
4 Guidelines for Writing C MEX S-Functions
4-10
This figure i llustrates the wrapper S-function concept:
Figure 4-1: How S-Functions Interface with Hand-Written Code
wrapsfcn
wrapsfcn.c
...
mdlOutputs(...)
{
...
my_alg();
}
Simulink
Placethe name of your S-functionin
the S-function block’s dialog box.
S-function
mdlOutputs in
wrapsfcn.mex
calls external
function my_alg
.
my_alg.c
...
real_T my_alg(real_T u)
{
...
y=f(u);
}
In Simulink,the S-function
calls mdlOutputs,which
in turn calls my_alg.
Real-Time Workshop
wrapper.c
,the generated
code, calls MdlOutputs
,
whichthencallsmy_alg.
wrapper.mdl
wrapper.c
...
MdlOutputs(...)
{
...
my_alg();
}
In the TLC wrapper
version of the
S-function, MdlOutputs
in wrapper.exe calls
my_alg
.
*The dotted line above would be the path taken if the S-function did not
havea TLC wrapper file. Ifthere is noTLC wrapper file, thegenerated code
calls
mdlOutputs.
*see note below
Vue de la page 175
1 2 ... 171 172 173 174 175 176 177 178 179 180 181 ... 209 210

Commentaires sur ces manuels

Pas de commentaire