MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Podręcznik Użytkownika Strona 176

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 210
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 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
Przeglądanie stron 175
1 2 ... 171 172 173 174 175 176 177 178 179 180 181 ... 209 210

Komentarze do niniejszej Instrukcji

Brak uwag