Technical Solutions
How can I input and output Bus signals to and from an S-function created using the S-function builder in Simulink 7.3 (R2009a)?
Date Last Modified: Tuesday, September 15, 2009
| Solution ID: | 1-9DB26T | |
| Product: | Simulink | |
| Reported in Release: | R2009a | |
| Platform: | All Platforms | |
| Operating System: | All OS |
Subject:
How can I input and output Bus signals to and from an S-function created using the S-function builder in Simulink 7.3 (R2009a)?
Problem Description:
In the S-function Limitations section of the Simulink documentation, I see that handwritten C MEX S-functions do not support bus input and output signal.
For the S-Function Builder block, bus signals are not mentioned, so I am assuming that the S-function Builder block supports bus input and output signals.
However, I can not find any documentation or demo explaining how to do this.
Solution:The documentation explaining how to connect bus signals to the S-Function Builder block has been omitted in Simulink 7.3 (R2009a). A link to download an updated version of the documentation section titled "Writing S-Function in C" is provided below.
2. In the S-Function block, go to the "Data Properties" tab and add an Input port. 3. You will notice that the input port has two properties related to bus signals, "Bus" and "Bus Name". Set the "Bus" property to "on" and the "Bus Name" to the bus object created in the MATLAB workspace. 4. You can repeat the same operations for other input and output ports. It is now possible to access the bus elements in the Outputs, Continuous Derivatives and Discrete Update section of the S-Function Builder. An example model using bus signals with the S-Function Builder can be reached in MATLAB 7.7 (R2009a) by executing this command:
sfbuilder_bususage
|
Related Documents/Files:
|
|
Store

