Target Language Compiler    

Wrapper Inlined S-Function Example

The following diagram illustrates inlining an S-function as a wrapper. The algorithm is directly called from the generated model code, removing the S-function overhead but maintaining the user function.

This is the inlining TLC file for a wrapper version of the timestwo block.

Analysis

The function BlockTypeSetup is called once for each type of block in a model; it doesn't produce output directly like the Outputs function. Use BlockTypeSetup to include a function prototype in the model.h file and to tell the build process to compile an additional file, myfile.c.

Instead of performing the multiply directly, the Outputs function now calls the function mytimestwo. So, all instances of this block in the model will call the same function to perform the multiply. The resulting model function, MdlOutputs, then becomes

Summary

This section has been a brief introduction to the model.rtw file and the concepts of inlining an S-function using the Target Language Compiler. Contents of model.rtw, and model.rtw, contain more details of the model.rtw file and its contents. Inlining S-Functions, and A TLC Tutorial, contain details on writing TLC files, including a comprehensive tutorial.


  Fully Inlined S-Function Example A TLC Tutorial