You can create interfaces between components in System Composer™ to structure transmitted data. Use composite data interfaces with data elements or value types to manage data defined on ports. Assign a data interface or value type to a data element so the data element inherits attributes and reuses data. Use the model below as a starting point before adding interfaces using the Interface Editor. For interfaces terminology, see Define Port Interfaces Between Components.
Open the mobile robot platform architecture model.
Open Interface Editor
The System Composer Interface Editor is a web-based widget and might appear blank when you first
launch it. If this occurs, save the model and relaunch MATLAB® with the command line option
Create Composite Data Interfaces
To add a new data interface definition, click the icon. Name the data interface
To add a data element to the data interface, click the icon. Data interface and data element names must be valid MATLAB variable names.
You can delete data interfaces and data elements in the Interface Editor using the button.
You can view and edit the properties of an element in the Property Inspector. Right-click the data element and select Inspect Properties. For data interfaces, use the Property Inspector to apply stereotypes.
For a comparative view, you can edit data element properties from the relevant Interface Editor columns.
Create Value Types as Interfaces
To add a value type in the Interface Editor, select the down arrow next to the icon and select Value Type. Name the
motorSpeedType. Value type names must be valid MATLAB variable names.
motorSpeed data element and select Set 'Type' > motorSpeedType. The data element
motorSpeed is assigned to the value type
Any data changes on the
motorSpeedType value type is propagated to
motorSpeed data element. You can reuse value types any number of
times. Data changes on a value type will propagate to each data element that uses the value
Nest Interfaces to Reuse Data
A nested interface contains another data interface. Create a nested data interface by assigning a data interface as the type of a data element. For information about the corresponding buses, see Define Multilevel Bus Hierarchy Using Type Editor.
For example, let
coordinates be a data interface that consists of
z coordinates. The
GPSdata data interface includes
location and a
timestamp. If the
location data element is in the
same format as the
coordinates interface, you can set its type to
location and select Set 'Type' > coordinates. The available interface options include all value types and all data
interfaces in the model, except the parent of the data element.
The nested data interface displays the inherited data elements.
To change the number of columns that display in the Interface Editor, click the icon. Select or clear the desired columns to show or hide them.