필터 지우기
필터 지우기

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)?

조회 수: 22 (최근 30일)
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.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2013년 10월 18일
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.
To connect a bus signal to the Input or Output port of the S-Function Builder follow these steps:
1. Create a bus object in the MATLAB workspace. This can be done from interactively using the Simulink Bus Editor, or from the command line by typing:
a = Simulink.Bus
More information about bus objects can be found at this link:
<http://www.mathworks.com/help/simulink/ug/using-bus-objects.html>
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2009a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by