Summary

In this chapter we've learned what S-functions are and how they can be used to build custom blocks to extend the basic Simulink functionality.

We have learned which required callbacks and optional ones need to be implemented if the S-function will use work vectors to store internal states and allocate system resources.

We developed and built two simple Level 2 MATLAB S-function blocks and used them to interface the cruise controller model with an external application. Then we implemented the same block functionality in the C language, learning how to develop and build C MEX S-functions with the mex tool.

These S-functions can be used as a good starting point to develop other interfaces to communicate with virtually any application or physical device.

With the knowledge acquired in this chapter, we can greatly extend Simulink's functionality by creating new blocks or porting legacy C code to Simulink.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.133.61