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

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 210
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 43
2 Writing S-Functions As M-Files
2-20
function sys = mdlOutputs(t,x,u)
sys = x(1);
% end mdlOutputs
%
%==============================================================
% mdlGetTimeOfNextVarHit
% Return the time of the next hit for this block. Note that the
% result is absolute time.
%==============================================================
%
function sys = mdlGetTimeOfNextVarHit(t,x,u)
sys = t + u(2);
% End of mdlGetTimeOfNextVarHit.
mdlGetTimeOfNextVarHit
returns the “time of the next hit,” the time in the
simulationwhen
vsfunc isnext called. Thismeans that thereis no outputfrom
this S-function until the time of the next hit . In
vsfunc, the time of the next hit
is set to
t + u(2), whichmeans that the secondinput, u(2), sets thetime when
the next call to
vsfunc occurs.
Passing Additional Parameters
Simulink always passes t, x, u,andflag into S-functions. It is poss ible t o pass
additional parameters into yo ur M-file S-function . For an examp le of how to d o
this, se e
limintm.m in the toolbox/simulink/blocks directory.
Vedere la pagina 43
1 2 ... 39 40 41 42 43 44 45 46 47 48 49 ... 209 210

Commenti su questo manuale

Nessun commento