MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Guide de l'utilisateur Page 151

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 210
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 150
The C MEX S-Function SimStruct
3-107
ssGetInputPortRealSignalPtrs
(S,inputPortIdx)
Canbeusedinanysimulationloop(seep.3-16)
S-function routine to access an input port signal. The
input port index starts at 0 and ends at the number of
input ports minus 1. This macro returns a pointer to an
array of pointers to the
real_T input signal elements.
Thelengthofthearrayofpointersisequaltothewidth
of the input port. For example, to read all input port
signals, use:
int_T i,j;
int_T nInputPorts = ssGetNumInputPorts(S);
for (i = 0; i < nInputPorts; i++) {
InputRealPtrsType uPtrs =
ssGetInputPortRealSignal(S,i);
int_T nu = ssGetInputPortWidth(S,i);
for (j = 0; j < nu; j++) {
SomeFunctionToUseInputSignalElement(*uPtrs
[j]);
}
}
ssGetInputPortSampleTime
(S,inputPortIdx)
Canbeusedinanyroutine(exceptmdlInitializeSizes)
to determine the sample time of an input port. This
should only be used if you have specified the sample
timesasport-based.
ssGetInputPortOffsetTime
(S,inputPortIdx)
Canbeusedinanyroutine(exceptmdlInitializeSizes)
to determine the offset time of an input port. This should
only be used if you have specified the sample times as
port-based.
Table 3-7: Input and Output Port Signal SimStruct Macros (Continued)
Macro Description
Vue de la page 150
1 2 ... 146 147 148 149 150 151 152 153 154 155 156 ... 209 210

Commentaires sur ces manuels

Pas de commentaire