How can I have a Bus Selector block accept signal from an Inport block in a subsystem in Simulink?

6 次查看(过去 30 天)
I am trying to create a subsystem that accepts a bus signal from an Inport block and feeds it to a Bus Selector block. The final objective is to generate an S-function from the subsystem. However, when I attempt to run the model with the subsystem configured as mentioned above, I get the following error message:
'untitled/Subsystem/Bus Selector' must be connected to a Bus Creator, Bus Selector or a block that outputs a bus using a bus object. It can also be connected to bus capable blocks that meet the conditions for supporting buses provided the bus entering the block has been created by using a bus creator.
At the root level, I have connected an Inport block to the input port of the subsystem.

采纳的回答

MathWorks Support Team
In order to create and build a subsystem, which has an Inport block feeding into a Bus Selector block, perform the following steps:
1. Double click on the Inport Block to view the Block Properties. Click on the Signal Specification tab and check ‘Specify properties via bus object’. Keep the default name as ‘BusObject’. You will have to do this for the Inport blocks at the root level and also within the subsystem.
2. Create the bus object, BusObject, by using the Bus Editor. To create the bus object and edit its properties execute the following code at the MATLAB command prompt:
BusObject = Simulink.Bus
buseditor
In the resulting window, the Bus Editor, add the signals that the input bus will have with the appropriate names. Verify that the change has been saved by typing ‘BusObject’ at the prompt.
3. You should now be able to right click on the system and build it by selecting Real-Time Workshop from the menu.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by