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

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 210
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 112
Examples of C MEX-File S-Function Blocks
3-69
during the simulation. In the transfer function used in this example, the
parameters of the transfer function vary with time.
The output of
vsfunc is simply the input u delayed by a variable amount of
time.
mdlOutputs sets the output y equal to state x. mdlUpdate sets the state
vector
x equal to u, the input vector. This example calls
mdlGetTimeOfNextVarHit, an S-function routine that calculates and sets the
“time of next hit,” that is, the time when is
vsfunc is next called. In
mdlGetTimeOfNextVarHit themacrossGetU is used togetapointerto theinput
u. Then this call is made:
ssSetTNext(S, ssGetT(S)(*u[1]));
The macro ssGetT gets the simulation time t. T he second input to the block,
(
*u[1]),isaddedtot, andthe macrossSetTNext setsthetimeofnexthitequal
to
t+(*u[1]), delaying the output by the amount of time set in (*u[1]).
Vista de página 112
1 2 ... 108 109 110 111 112 113 114 115 116 117 118 ... 209 210

Comentários a estes Manuais

Sem comentários