Clear Filters
Clear Filters

How to trace a signal from a bus selector block to its original source output port?

10 views (last 30 days)
I have a bus selector block which inputs a bus which was nested several times and comprises of a number of other bus objects. I need to programmatically select a couple of bus objects from this nested bunch of busses which are of a specific bus object type. What is the best way to do it? Should I figure out the way of tracing elements of the nested bus back to the original output ports which generated these elemsnts, or is there a better and simpler way? I would like to avoid compiling the model if possible.
Here is a good example:
Suppose all the inputs are connected outside of this subsystem boundary to sources which generate data as busses. So, motor1, motor2, ... are actually busses themselves. Suppose they were defined as bus objects in workspace which are named 'Motor1BusType', 'Motor2BusType', etc. Now I want to replace Out1 block with a bus selector and programmatically (without opening dialog and tracing signals in it) configure it to output two busses which were originally defined by sources of signals of type 'Motor1BusType' and 'Motor4BusType'. Visually it is easy to see that on the bus selector I would need to pick 'Bus1.Bus2.motor1' and 'Bus1.Bus2.Bus3.motor4', but programmatically I only have the data types information available ( 'Motor1BusType' and 'Motor4BusType').
Any suggestions on how to approach it? Thanks

Answers (1)

Nikita Visnevski
Nikita Visnevski on 4 Jan 2019
Edited: Nikita Visnevski on 4 Jan 2019
I believe ths post almost answers it:
The only problem in it for me is that it appears to compile the models involved. The problem is that it takes a very long time to do all the evaluation steps which I am not sure are all relevant to what I am trying to do at the moment. Also, resulting structures are hard to correlate with corresponding bus object definitions and doing so requires a lot of rather unnecessary coding.
Any other thoughts on the saubject are greatly appreciated.

Products

Community Treasure Hunt

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

Start Hunting!