MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Guia do Utilizador Página 140

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 210
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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.
Vista de página 139
1 2 ... 135 136 137 138 139 140 141 142 143 144 145 ... 209 210

Comentários a estes Manuais

Sem comentários