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

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 210
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 139
3 Writing S-Functions As C-MEX files
3-96
To configure an S-function to call a function-call subsystem:
1 Specify which elements are to execute the function-call system in
mdlInitializeSampleTimes. For example:
ssSetCallSystemOutput(S,0); /* call on 1st element */
ssSetCallSystemOutput(S,2); /
* call on 3rd element */
2 Execute the subsystem in the appropriate mdlOutputs or mdlUpdates
S-function routines. For example:
static void mdlOutputs(...)
{
if (((int)*uPtrs[0]) % 2 == 1) {
if (!ssCallSystemWithTid(S,0,tid)) {
/* Error occurred, which will be reported by Simulink */
return;
}
} else {
if (!ssCallSystemWithTid(S,2,tid)) {
/* Error occurred, which will be reported by Simulink */
return;
}
}
...
}
See simulink/src/sfun_fcncall.c for an example.
Function-callsubsystemsareapowerfulmodelingconstruct.You canconfigure
Stateflow® blocks to execute function-call subsystems, thereby extending the
capabilities and integration of state logic (Stateflow) with dataflow (Simulink).
For more information on their use in Stateflow, see the Stateflow
documentation.
Przeglądanie stron 139
1 2 ... 135 136 137 138 139 140 141 142 143 144 145 ... 209 210

Komentarze do niniejszej Instrukcji

Brak uwag