Download Writing S-Functions
Transcript
3 Writing S-Functions in C An S-function’s mdlInitializeSizes routine sets the sizes of the various signals and vectors. S-function methods called during the simulation loop can determine the sizes and values of the signals. An S-function method can access input signals in two ways: • Via pointers • Using contiguous inputs Accessing Signals Using Pointers During the 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. Input 1 Input 2 S-function Block To Access Input 1: InputRealPtrs uPtrs0 = ssGetInputPortRealSignalPtrs(S,0) ... uPtrs0 To Access Input 2: InputRealPtrs uPtrs1 = ssGetInputPortRealSignalPtrs(S,1) ... ... uPtrs1 Block I/O Vector 3-18
Related documents
What Is an S
MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS User`s guide
Real-Time Workshop
HP Notebook Hard Drives & Solid State Drives Identifying
Real-Time Workshop User's Guide
Developement Of An Instrument Landing Simulation Using MATLAB
An Integrated, Modular Simulation System for Education and
Simulink User's Guide
MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER User`s guide
Motion Control of Industrial Printers
7.0 User`s Manual - Opal-RT