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

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 210
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 63
3 Writing S-Functions As C-MEX files
3-20
The length of the various signals and vectors is configured in the
mdlInitializeSizes routine. The signals as well as their length can be
accessed in S-function routi nes that are called during the simulation loop.
During t he simulation loop, accessing the input signals is performed using:
InputRealPtrs uPtrs = ssGetInputPortRealSignalPtrs(S,portIndex)
This is an array of pointers, where portIndex starts at 0. There is one for each
input port. To access an element of this signal you must use:
*uPtrs[element]
as described by this figure:
Figure 3-5: Accessing Input Data from S-Function Input Ports
Note that input array pointers may point at noncontig uous places in memory.
You can retrieve the output signal by using this code:
real_T *y = ssGetOutputPortSignal(S,outputPortIndex);
S-function
Block
Input 1
Input 2
uPtrs0
...
...
Block I/O
Vector
InputRealPtrs uPtrs0 = ssGetInputPortRealSignalPtrs(S,0)
To Access Input 1:
uPtrs1
...
InputRealPtrs uPtrs1 = ssGetInputPortRealSignalPtrs(S,1)
To Access Input 2:
Vista de página 63
1 2 ... 59 60 61 62 63 64 65 66 67 68 69 ... 209 210

Comentários a estes Manuais

Sem comentários