MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Guida Utente Pagina 140

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 210
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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.
Vedere la pagina 139
1 2 ... 135 136 137 138 139 140 141 142 143 144 145 ... 209 210

Commenti su questo manuale

Nessun commento