File Exchange Pick of the Week

Our best user submissions

Bus Object Bus Creator

Posted by Richard Ruff , June 19, 2015

Richard is an Application Engineer at MathWorks focused on the Embedded Coder product for code generation, primarily in the Aerospace industry.

Richard's pick this week is Bus Object Bus Creator by Landon Wagner.

Pick

My pick this week is the Simulink library submission for automatically populating the input signal names to a bus creator for a specified bus object: Bus Object Bus Creator.

Do you use bus objects in your Simulink models? Do you spend a lot of time configuring the Bus Creator to match the desired Bus Object? If so, this File Exchange entry is for you.

The description from the entry sums up the benefits nicely:

When working with bus object types in a design in order to employ strongly "typed" IO the collection of signals into a busCreator associated with a defined bus object type is tedious. After choosing the "Bus:" type in the busCreator "Output data type" the native busCreator does no further favors for you - the user must know or look up how many signals are in the bus type they wish to employ and set "Number of inputs" accordingly. Worse yet, the user must name the individual signals going into the busCreator with the signal names defined in the bus object type. This tool's job is to do that favor for you. (Note that the tool itself is just a masked busCreator running some callback scripts so the inclusion of this tool does not overtly stick out in a design.) Details can be found in BOBCreadme.txt but essentially the tool's mask provides the user with candidate bus object types (From the workspace.) to choose from and upon selection and application of a bus object type the tool provides a busCreator with the necessary number of inputs and with those inputs populated with NAMED stubbed signal lines. These names match the BusElement names in the chosen bus object type. From these named stubbed lines the underlying busCreator inherits the names for "Signals in the bus." Again, this saves the user with having to know these signal names and fill them out themselves.

A basic example is shown here. Below is a list of the Bus Objects defined in the MATLAB Workspace.

Inspecting the "GuidanceBus" in the Bus Editor, we can see the elements of the bus object: "Ve", "Xe", etc.

Opening the "BusObjectBusCreator" library, we see it contains a single block.

Adding this block to a model and opening the dialog, we can select from the dropdown list of available bus objects. Once we apply the selection, we can see the block is updated to reflect the selected bus object. The number of input ports is altered to reflect the number of elements in the bus and the signals feeding the inputs are labeled to match the bus elements.

Comments

Give it a try and let us know what you think here or leave a comment for Landon.




Published with MATLAB® R2015a

|

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.