MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Guía de usuario Pagina 44

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 210
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de 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.
Vista de pagina 43
1 2 ... 39 40 41 42 43 44 45 46 47 48 49 ... 209 210

Comentarios a estos manuales

Sin comentarios