Writing S-Functions    

Chapter 5
Creating Ada S-Functions


The following sections explain how to use the Ada programming language to create S-functions.

Introduction
Overview of creating Ada S-functions.
Ada S-Function Source File Format
Source code structure of an Ada S-function.
Writing Callback Methods in Ada
How to use Ada to implement S-function callback methods.
Building an Ada S-Function
Compiling and linking an Ada S-function.
Example of an Ada S-Function
An Ada version of the timestwo S-function example.

Introduction

Simulink allows you to use the Ada programming language to create S-functions. As with S-functions coded in other programming languages, Simulink interacts with an Ada S-function by invoking callback methods that the S-function implements. Each method performs a predefined task, such as computing block outputs, required to simulate the block whose functionality the S-function defines. Creating an Ada S-function thus entails writing Ada implementations of the callback methods required to simulate the S-function and then compiling and linking the callbacks into a library that Simulink can load and invoke during simulation The following sections explain how to perform these tasks.


  Obsolete Macros Ada S-Function Source File Format