MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Uživatelská příručka Strana 140

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 210
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 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.
Zobrazit stránku 139
1 2 ... 135 136 137 138 139 140 141 142 143 144 145 ... 209 210

Komentáře k této Příručce

Žádné komentáře