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

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 210
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 147
3 Writing S-Functions As C-MEX files
3-104
ssSetInputPortReusable
(S,inputPortIdx,value)
Used in mdlInitializeSizes (after
ssSetNumInputPorts) to specify whether the input port
memory buffer can be reuse d by other signals in the
model. This macro can tak e on two values:
Off (
value=0) specifies that the input por t is not
reusable. This is the default.
On (
value=1) specifies that the input port is
reusable.
In Simulink, reusable sign als share the same memory
space. When this macro is turned on, t he input port
signal to the S-function may be reused by other signals in
the model. This reuse results in less memory use during
Simulink simulation and more efficiency in the
Real-Time Workshop generated code.
You must use caut ion when using this macro; y ou can
safely turn it on only if the S-function reads its input port
signal in its
mdlOutputs routine and does not access this
input port sig nal until the next call to
mdlOutputs.
When an S-functions’s input port signal is reused, other
signals in the model overwrite it prior to the execution of
mdlUpdate, mdlDerivatives, or other run-time
S-function routines. For example, if the S-function reads
the input port signal in its
mdlUpdate routine, or reads
the input port signal in the
mdlOutputs routine and
expectsthisvaluetobepersistentuntiltheexecutionof
its
mdlUpdate routine, turning this at tribute on is
incorrect and will lead to erroneous results.
The d efault setting, o ff, is safe. It prevents any reuse of
the S-function inp ut po r t signals, which means that the
inport port signals have the same value in any run-time
S-function routine during a single execution of the
simulation loop.
Table 3-7: Input and Output Port Signal SimStruct Macros (Continued)
Macro Description
Vedere la pagina 147
1 2 ... 143 144 145 146 147 148 149 150 151 152 153 ... 209 210

Commenti su questo manuale

Nessun commento