In Bus Element
Select input from external port
Libraries:
Simulink / Ports & Subsystems
Simulink / Sources
HDL Coder / Ports & Subsystems
HDL Coder / Sources
Alternative Configurations of In Bus Element Block:
Bus Element In
Description
TheIn Bus Elementblock, also known as theBus Element Inblock, combines the functionality of anInportblock and a总线选择器block. This block is of theInportblock type, and allIn Bus Elementblocks that correspond with the same port share a dialog box.
Use anIn Bus Elementblock to select a bus element, bus, nonbus signal, or message associated with the port. To select multiple elements from a bus, use multipleIn Bus Elementblocks.
For interfaces that include buses composed of many bus elements,In Bus Elementblocks:
Reduce signal line complexity and clutter in a block diagram.
Allow you to more easily make incremental changes to the interface.
Allow access to a bus element closer to the point of usage, avoiding the use of a总线选择器andGotoblock configuration.
To convert an interface to useIn Bus Elementblocks, seeSimplify Subsystem and Model Interfaces with Bus Element Ports。
TheIn Bus Elementblock does not support mixing message and signal elements as outputs.
Examples
Create Input Bus Element Port
In a model component, each input bus element port is represented by one or more In Bus Element blocks.
Open the example model namedCreateInputBusElementPort
。
To add an input bus element port for a model, add an In Bus Element block to the top level of the model. For example, double-click the canvas and start typing the block name. Then, select the In Bus Element block.
To add an input bus element port to a subsystem, add an In Bus Element block to the subsystem or click the edge of the Subsystem block and selectCreate in bus port。
打开子系统,双击子system block.
The subsystem contains a default In Bus Element block that corresponds to the input port you created on the Subsystem block. The block label uses default values for its two interactive text fields: the port name (InBus
) and the bus element (signal1
).
To create another input bus element port from inside a model component, holdCtrlwhile you drag an existing In Bus Element block to a new location. Upon releasing the pointer, click创建新的端口。
An In Bus Element block with a unique port name appears.
In this example, the new port is namedInBus1
。
To edit the port name, click the port name in the block label. Then, enter a new name.
Alternatively, set thePort nameblock parameter to the desired name for the port.
When multiple blocks are associated with the same port and you change the name of the port, all blocks that share the port update to reflect the new port name.
Select Entire Input from Bus Element Port
The input to a bus element port can be a bus, signal, or message. To pass the entire input through anIn Bus Elementblock instead of selecting an element of an input bus, remove the part of the block label that represents an element.
For example, in theInBus.signal1
label of a defaultIn Bus Elementblock, clicksignal1
。
删除the text from this field. Then, click elsewhere on the canvas to commit the change.
To change the name of the port associated with the block, edit the first text field in the block label.
For example, suppose the port expects a chirp signal. In the block label, clickInBus
。
删除InBus
and enterchirp
。Ignore the placeholder text that shows where you can enter an element name.
Alternatively, set thePort nameblock parameter to the desired name for the port.
Select Elements of Subsystem Input Port
To select elements of an input bus element port of a subsystem, use an In Bus Element block for each element that you want to select.
Open and compile the example model namedSelectInputBusElements
。To compile the model, on theModelingtab of the Simulink Toolstrip, clickUpdate ModelorRun。Compiling the model updates the line styles, which you can use to visually identify buses.
A Bus Creator block creates a virtual bus that contains two elements: a nested bus namednonconstant
and a signal namedconstant
。Thenonconstant
bus contains two signals namedsine
andchirp
。The top-level bus connects to the input port of the Subsystem block.
打开子系统,双击子system block.
The subsystem contains an In Bus Element block that corresponds to the input port. The block label indicates that the block selects the signal namedconstant
from the input port.
To change the element that the block selects, edit the second text field in the block label. When the second text field is empty, a menu provides the elements of the port along with the previously selected element.
When the list of input elements is long, filter the list of elements by starting to type the name of the element you want to select.
For this example, typechirp
。
The list provides the text you type as an option. However, the top-level input bus does not contain a signal namedchirp
。The nested bus namednonconstant
contains the signal namedchirp
。Therefore, select the option namednonconstant.chirp
。Each dot in the label follows the name of a bus in the input bus hierarchy.
Open the Property Inspector. Then, select the In Bus Element block. Alternatively, double-click the block to open a dialog box.
The element that the block selects is highlighted. The elements that an In Bus Element block does not select are gray and italicized.
To add blocks for additional input elements, click an element name or holdCtrlas you click multiple element names. Then, clickAdd blocks for selected signals。
Corresponding In Bus Element blocks appear in the block diagram.
Multiple In Bus Element blocks can select the same element. For example, add another block that selects the element namedconstant
。
The duplicate block is highlighted.
To find duplicate blocks when the block diagram is complicated, select the block, pause on the ellipsis, and in the action bar, clickRelated Blocks。
When multiple blocks correspond to the selected block, a list of related blocks opens. You can filter the list of related blocks by entering a search term in the text box. Clicking a related block in the list selects the block in the block diagram.
Specify and Select Elements of Model Interface
To specify the elements of an input bus element port at a model interface, you can:
Define the bus hierarchy with a
Simulink.Bus
object.Add elements with or without adding blocks to the block diagram.
Referenced models support passing through an entire bus with anIn Bus Elementblock in either of these scenarios:
The bus is defined by a
Simulink.Bus
object.AdditionalIn Bus Elementblocks pass each leaf element of the bus into the referenced model.
Note
Only elements that are selected by blocks supportSimulink.Bus
object data types.
This example shows how to define an input bus element port at a model interface without aSimulink.Bus
object.
In a blank model, add anIn Bus Elementblock.
Open theProperty Inspector。Then, select theIn Bus Elementblock. Alternatively, double-click the block to open a dialog box.
To add an element to the port with a block, select the element that you want to contain the new element. Then, click theAdd elementbutton.
The new element is nested under the previously selected element. In the block diagram, a block that selects the new element appears.
To add an element without a block, in the Property Inspector or dialog box, select the element that you want to contain a new element. Then, click theAdd elementbutton arrow, and selectAdd element without block。
The new element is nested under the previously selected element in the Property Inspector or dialog box. The block diagram is unchanged.
Optionally, reorder input elements by dragging them to new locations in the list of elements.
To add blocks for additional input elements, click an element name or holdCtrlas you click multiple element names. Then, clickAdd blocks for selected signals。
CorrespondingIn Bus Elementblocks appear in the block diagram.
When multipleIn Bus Elementblocks select the same element, selecting one of the blocks highlights the other blocks that select the same element.
To find duplicate blocks when the block diagram is complicated, select the block, pause on the ellipsis, and in the action bar, clickRelated Blocks。
When multiple blocks correspond to the selected block, a list of related blocks opens. You can filter the list of related blocks by entering a search term in the text box. Clicking a related block in the list selects the block in the block diagram.
Customize Appearance of In Bus Element and Out Bus Element Blocks
Use compact labels and block colors to customize the appearance of In Bus Element and Out Bus Element blocks.
Open the example model namedBusElementPortBlocks
。
The model contains:
In Bus Element blocks that represent two unique bus element ports named
Inbus
andpulse
Out Bus Element blocks that represent a bus element port named
OutBus
To reduce the size of the block labels, display only the leaf element names. Select an In Bus Element or Out Bus Element block, pause on the ellipsis, and in the action bar, clickCompact Notation。
All In Bus Element and Out Bus Element blocks in the block diagram display shortened block labels that use only the leaf element name.
To show the full block label, in the action bar, you can clickExpanded Notation。For this example, keep the compact block labels.
Block colors can help differentiate unique ports when the block labels are compact.
Open the Property Inspector. Then, select an In Bus Element block that corresponds with the port namedInBus
。For example, select the block labeledconstant
。另外,双击打开一个块dialog box.
In the Property Inspector or dialog box, selectInBus
。Then, clickSet colorand select a color from the menu.
The blocks related to the port use the chosen color.
To identify the blocks that select the nested bus namednonconstant
or its elements, selectnonconstant
。Then, clickSet colorand select a different color from the menu.
The blocks related to the nested bus use the chosen color.
Remove Blocks That Select Invalid Elements
To remove allIn Bus Elementblocks associated with the selected element or elements in the Property Inspector or dialog box, you can click a button.
For a subsystem interface, clickRemove blocks of selected signals
。This operation removes all blocks that select the highlighted elements. When a corresponding element is available at the input port, it remains in the list of elements.
For a model interface, clickRemove selected elements
。This operation removes the highlighted elements and allIn Bus Elementblocks that select them.
For example, suppose you have a subsystem interface that receives a bus namedInBus
。One of the elements of the bus, namedpulse
, has been removed. However, at least oneIn Bus Elementblock selects the element.
To remove the blocks that select the invalidpulse
element, click the element name. Then, clickRemove blocks of selected signals。
The operation removes the invalid element and corresponding block.
Extended Examples
Ports
Output
Port_1—Selected input from external port
scalar | vector | matrix | array | bus
Select a bus, signal, or message from the corresponding external input port of the parent subsystem or model.
While you can select bus elements, you cannot select elements of arrays of buses.
Data Types:single
|double
|half
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|string
|Boolean
|fixed point
|enumerated
|bus
Complex Number Support:Yes
Parameters
To interactively edit the parameters of the block, the corresponding port, and the elements at the port, double-click the block or open theProperty Inspectorand select the block.
Port name—Name of input port
InBus
(default) | port name
Specify a port name that is not already in use by another block or port. The name appears on the parentSubsystemorModelblock. The name also appears next to the block. Multiple blocks can access the same port.
Programmatic Use
To set the block parameter value programmatically, use theset_param
function.
Parameter: | PortName |
Values: | 'InBus' (default) | character vector | string scalar |
Example:set_param('mymodel/Subsystem1/PortBlock','PortName','myBus')
Port number—Position of port on parent block
1
(default) | real integer
Specify the order in which the port that corresponds to the block appears on the parentSubsystemorModelblock.
If you add a block that creates another port, the port number is the next available number.
Deleting all blocks associated with a port deletes the port. Other ports are renumbered so that they are sequential and do not skip any numbers.
Specifying a port number that exceeds the number of ports creates a port for that number and for any skipped sequential numbers.
Programmatic Use
To set the block parameter value programmatically, use theset_param
function.
Parameter: | Port |
Values: | '1' (default) | character vector | string scalar |
Example:set_param('mymodel/Subsystem1/PortBlock','Port','5')
Set color—Block background color
Black
(default) |White
|Red
|Green
|Blue
|Cyan
|Magenta
|Yellow
|Gray
|Light Blue
|Orange
|Dark Green
|More Colors
Specify the block background color. This specification sets the color of blocks associated with selected bus elements, or of all blocks associated with the port if you do not select any bus elements.
Programmatic Use
To set the block parameter value programmatically, use theset_param
function.
Parameter: | BackgroundColor |
Values: | 'black' (default) |'white |'red' |'green' |'blue' |'cyan' |'magenta' |'yellow' |'gray' |'lightBlue' |'orange' |'darkGreen' |'[r,g,b]' wherer ,g , andb , are the red, green, blue values of the color in the range 0.0 to 1.0 |
Example:set_param('mymodel/Subsystem1/PortBlock','BackgroundColor','magenta')
Filter—Filter for set of displayed signals
no default
Specify a search term to use for filtering a long list of bus elements. Do not enclose the search term in quotation marks. The filter does a partial string search and supports regular expressions. To use a regular expression character as a literal, include an escape character (\
). For example, to use a question mark, typesig\?1
。
Attributes
To specify attributes, such as data type, pause on the name of a bus, signal, or message. Then, click the pencil buttonthat appears.
When you specify attributes, they appear next to the name of the bus, signal, or message. Click an attribute summary to edit the attributes of the bus, signal, or message.
Data type—Data type
Inherit: auto
(default) |double
|single
|half
|int8
|uint8
|int16
|uint16
| ...
The data type of a bus, signal, or message can be inherited, specified directly, or expressed as a data type object such as aSimulink.NumericType
object.
You can specify any of these options:
Inherited data type
Built-in Simulink®data type — For example, specify
single
oruint8
。SeeData Types Supported by Simulink。Fixed-point data type — Use the
fixdt
function. For example, specifyfixdt(1,16,0)
。Enumerated data type — Use the name of the type preceded by
Enum:
。For example, specifyEnum: myEnumType
。Bus data type — Use the name of the
Simulink.Bus
object preceded byBus:
。For example, specifyBus: myBusObject
。Value type — Use the name of the
Simulink.ValueType
object preceded byValueType:
。For example, specifyValueType: windVelocity
。Custom data type — Use a MATLAB expression that specifies the type. For example, you can specify a
Simulink.NumericType
object whoseDataTypeMode
property is set to a value other than'Fixed-point: unspecified scaling'
。
When you specify aSimulink.ValueType
object as the data type, some parameters of the element are ignored. For example, theMin,Max, andUnitparameters are ignored. The software uses the corresponding properties of theSimulink.ValueType
object. For example, suppose you setUnittoft/s
for an element. When theData typeof the element specifies aValueType
object that hasm/s
as its unit, the element usesm/s
instead offt/s
。
When you specify aSimulink.Bus
object as the data type, some parameters of the element are reset to their default values. For example, theMin,Max, andUnit参数重置。软件使用相关系数ponding properties of theSimulink.BusElement
objects in theSimulink.Bus
object instead.
Tips
When you specify a bus using aSimulink.Bus
object or aSimulink.ValueType
object with aSimulink.Bus
object data type, the Property Inspector and block dialog box display the elements defined by the correspondingSimulink.BusElement
objects.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | OutDataTypeStr |
Values: | 'Inherit: auto' (default) |'double' |'single' |'half' |'int8' |'uint8' |'int16' |'uint16' |'int32' |'uint32' |'int64' |'uint64' |'boolean' |'fixdt(1,16)' |'fixdt(1,16,0)' |'fixdt(1,16,2^0,0)' |'string' |'Enum: |'Bus: |'ValueType: |'' |
Example:set_param('mymodel/Subsystem1/myBus.signal1','OutDataTypeStr','int32')
Bus virtuality—Virtual or nonvirtual bus
inherit
(default) |virtual
|nonvirtual
Specify whether to inherit the bus virtuality or define the bus as virtual or nonvirtual. For more information, seeComposite Interface Guidelines。
This parameter determines whether the blocks inherit or define the bus virtuality. If the blocks define the bus virtuality and the virtuality of the input bus does not match, compiling the model produces an error.
Dependencies
To enable this parameter,Data typemust resolve to aSimulink.Bus
object. For example, setData typeto aSimulink.Bus
object or aSimulink.ValueType
object that specifies aSimulink.Bus
object as its data type.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | BusVirtuality |
Values: | 'inherit' (default) |'virtual' |'nonvirtual' |
Example:set_param('mymodel/Subsystem1/myBus.nestedBus','BusVirtuality','nonvirtual')
Data mode—Data mode of bus elements
inherit
(default) |signal
|message
Specify the data mode of the elements of the bus.
inherit
— Bus elements inherit their data modes.signal
— Bus elements must be signals.message
— Bus elements must be messages.When you choose
message
as the data mode, an envelope button appears next to the bus or bus element. Use the envelope button to specify custom queue properties for each message element.
Dependencies
To enable this parameter, the block must be at the top level of a model.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | DataMode |
Values: | 'inherit' (default) |'signal' |'message' |
Example:set_param('mymodel/InBus','DataMode','signal')
Dimensions—Signal dimensions
-1
(default) | integer | [integer, integer]
Specify the dimensions of a signal.
-1
— The signal can have any dimensions.N
— The signal must be a vector of sizeN
。[R C]
— The signal must be a matrix havingR
rows andC
columns.
Dependencies
WhenData typespecifies a
Simulink.Bus
object, the software sets this parameter to1
。The software uses the dimensions specified by theSimulink.BusElement
objects in theSimulink.Bus
object.WhenData typespecifies a
Simulink.ValueType
忽略了对象,软件的价值标准ameter. The software uses the dimensions specified by theSimulink.ValueType
object instead.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | PortDimensions |
Values: | '-1' (default) | character vector | string scalar |
Example:set_param('mymodel/Subsystem1/myBus.signal1','PortDimensions','[1 3]')
Dims mode—Option to allow only variable-size or fixed-size signals
Inherit
(default) |Fixed
|Variable
Specify the type of signals allowed.
Inherit
— Allow variable-size and fixed-size signals.Variable
— Allow only variable-size signals.Fixed
— Allow only fixed-size signals. Do not allow variable-size signals.
When the signal is variable-sized, theDimensionsparameter specifies the maximum dimensions of the signal.
Dependencies
WhenData typespecifies a
Simulink.Bus
object, the software sets this parameter toInherit
。The software uses the dimensions modes specified by theSimulink.BusElement
objects in theSimulink.Bus
object.WhenData typespecifies a
Simulink.ValueType
忽略了对象,软件的价值标准ameter. The software uses the dimensions mode specified by theSimulink.ValueType
object instead.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | VarSizeSig |
Values: | 'Inherit' (default) |'No' |'Yes' |
Example:set_param('mymodel/Subsystem1/myBus.signal1','VarSizeSig','No')
Unit—Physical unit
inherit
(default) | unit supported by Simulink software
Specify the physical unit of the signal. For a list of supported units, in the MATLAB Command Window, entershowunitslist
。
Dependencies
WhenData typespecifies a
Simulink.Bus
object, the software sets this parameter toinherit
。The software uses the units specified by theSimulink.BusElement
objects in theSimulink.Bus
object.WhenData typespecifies a
Simulink.ValueType
忽略了对象,软件的价值标准ameter. The software uses the unit specified by theSimulink.ValueType
object instead.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | Unit |
Values: | 'inherit' (default) | character vector | string scalar |
Example:set_param('mymodel/Subsystem1/myBus.signal1','Unit','m/s')
Complexity—Numeric type
auto
(default) |real
|complex
Specify the numeric type of the signal. To choose the numeric type of the signal, selectauto
。Otherwise, choose a real or complex signal type.
Dependencies
WhenData typespecifies a
Simulink.Bus
object, the software sets this parameter toauto
。The software uses the complexity specified by theSimulink.BusElement
objects in theSimulink.Bus
object.WhenData typespecifies a
Simulink.ValueType
忽略了对象,软件的价值标准ameter. The software uses the complexity specified by theSimulink.ValueType
object instead.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | SignalType |
Values: | 'auto' (default) |'real' |'complex' |
Example:set_param('mymodel/Subsystem1/myBus.signal1','SignalType','real')
Minimum—Minimum value
[]
(default) | scalar
Lower value of the range that the software checks.
This number must be a finite real double scalar value.
The software uses this value to perform:
Simulation range checking. For more information, seeSpecify Signal Ranges。
Automatic scaling of fixed-point data types.
Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes such as SIL or external mode. For more information, seeOptimize using the specified minimum and maximum values(Embedded Coder)。
Dependencies
WhenData typespecifies a
Simulink.Bus
object, the software sets this parameter to[]
。The software uses the minimum values specified by theSimulink.BusElement
objects in theSimulink.Bus
object.WhenData typespecifies a
Simulink.ValueType
忽略了对象,软件的价值标准ameter. The software uses the minimum value specified by theSimulink.ValueType
object instead.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | OutMin |
Values: | '[]' (default) | character vector | string scalar |
Example:set_param('mymodel/Subsystem1/myBus.signal1','OutMin','0')
Maximum—Maximum value
[]
(default) | scalar
Upper value of the range that the software checks.
This number must be a finite real double scalar value.
The software uses this value to perform:
Simulation range checking. For more information, seeSpecify Signal Ranges。
Automatic scaling of fixed-point data types.
Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes such as SIL or external mode. For more information, seeOptimize using the specified minimum and maximum values(Embedded Coder)。
Dependencies
WhenData typespecifies a
Simulink.Bus
object, the software sets this parameter to[]
。The software uses the maximum values specified by theSimulink.BusElement
objects in theSimulink.Bus
object.WhenData typespecifies a
Simulink.ValueType
忽略了对象,软件的价值标准ameter. The software uses the maximum value specified by theSimulink.ValueType
object instead.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | OutMax |
Values: | '[]' (default) | character vector | string scalar |
Example:set_param('mymodel/Subsystem1/myBus.signal1','OutMax','2')
Description—Description of bus, bus element, signal, or message
no default
Use the description to document information about the bus, signal, or message, such as where it is used. This information does not affect processing.
Dependencies
WhenData typespecifies a
Simulink.Bus
object, the software sets this parameter to''
(empty). The software uses the description specified by theSimulink.Bus
object.WhenData typespecifies a
Simulink.ValueType
忽略了对象,软件的价值标准ameter. The software uses the description specified by theSimulink.ValueType
object instead.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | Description |
Values: | '' (default) | character vector | string scalar |
Example:set_param('mymodel/Subsystem1/myBus.signal1','Description','This signal is used by...')
Execution Attributes
To specify execution attributes, such as sample time, pause on the name of a bus, signal, or message. Then, click Specify execution attributes。
Sample time—Sample time
-1
(default) | scalar
Specify the discrete interval between sample time hits or specify another type of sample time, such as continuous (0
) or inherited (-1
). For more options, seeTypes of Sample Time。
By default, the signal inherits its sample time.
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | SampleTime |
Values: | '-1' (default) | character vector | string scalar |
Example:set_param('mymodel/Subsystem1/InBus.signal1','SampleTime','2')
Events—Option to trigger model partition based on flow of data into port
cell array of event trigger objects
In a rate-based system, you can configure an input port in the top model or on a model reference interface to trigger the execution of one or more model partitions in response to the flow of data into the port. The parameter stores the event triggers associated with the port. Each event trigger maps an input event to the name of the schedule event it triggers. The schedule for the model specifies the partition to execute in response to the schedule event and the priority of execution.
The table summarizes the event triggers you can configure. You can configure an input port with one event trigger for each input event.
Input Event | Input Event Description | Event Trigger Object |
---|---|---|
Input write | Value for input port updates. | simulink.event.InputWrite |
Input write timeout | Input port value does not update within a specified amount of time. | simulink.event.InputWriteTimeout |
Input write lost | Input port value update overwrites unprocessed data. | simulink.event.InputWriteLost |
To configure the schedule for your model, use theSchedule Editor。
When you configure input events on a bus port, where you specify the event triggers depends on the virtuality of the bus.
For a virtual bus, specify event triggers on leaf elements of the bus. Specifying input events on the virtual bus itself is not supported.
For a nonvirtual bus, specify event triggers on the bus. Specifying input events on elements of a nonvirtual bus is not supported.
In Bus Elementblocks must select each element with event triggers.
Dependencies
To enable this parameter, the block must be at the top level of a model.
Programmatic Use
To set the block parameter value programmatically, use theset_param
function.
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | EventTriggers |
Values: | [] (default) |1 -by-1 cell array |2 -by-1 cell array |3 -by-1 cell array |
Example:set_param('mymodel/PortBlock','EventTriggers',{inputWrite,writeTimeout,writeLost})
Example:set_param('mymodel/InBus.signal1','EventTriggers',{inputWrite,writeTimeout,writeLost})
Queue Attributes
Queue attributes are visible only when the block is at the top level of a model and you set theData modeparameter tomessage
。
To specify queue attributes, click the envelope buttonnext to the name of a bus or message.
Use default queue attributes—Default or custom queue specifications
on (default) | off
Use this parameter to select between default or custom queue specifications.
To use the default queue properties, leave the parameter selected. In this case, for each message bus element, a LIFO overwriting queue of capacity 1 is automatically inserted.
To use custom specifications, clear the parameter and configure the queue properties. Queue attributes are applicable if there is no storage block placed outside a component.
For more information, seeSpecify Queue Properties for Message Interface。
Dependencies
To enable this parameter for an element, set theData modeof the element tomessage
。
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | MessageQueueUseDefaultAttributes |
Values: | 'on' (default) |'off' |
Example:set_param('mymodel/InBus.message1','MessageQueueUseDefaultAttributes','off')
Queue capacity—Message storage capacity
1 (default) | scalar
Specify the number of messages elements the queue can store.
Dependencies
To enable this parameter for an element, set theData modeof the element tomessage
。
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | MessageQueueCapacity |
Values: | '1' (default) | character vector | string scalar |
Example:set_param('mymodel/InBus.message1','MessageQueueCapacity','10')
Queue type—Choose FIFO or LIFO queue
LIFO
(default) |FIFO
Choose one of these queue types:
FIFO
— First-in-first-outLIFO
— Last-in-first-out
Dependencies
To enable this parameter for an element, set theData modeof the element tomessage
。
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | MessageQueueType |
Values: | 'LIFO' (default) |'FIFO' |
Example:set_param('mymodel/InBus.message1','MessageQueueType','FIFO')
Queue overwriting—Queue message overwriting policy
on (default) | off
Select this parameter to choose between two queue overwriting policies.
If you select the parameter, an incoming message element overwrites the oldest message if the queue is full.
If you clear the parameter, the block does not accept new messages if the queue is full.
Dependencies
To enable this parameter for an element, set theData modeof the element tomessage
。
Programmatic Use
To programmatically set the attribute value for an element, use theset_param
function, specifying the element as the block path of the model component with the element label.
Parameter: | MessageQueueOverwriting |
Values: | 'on' (default) |'off' |
Example:set_param('mymodel/InBus.message1','MessageQueueOverwriting','off')
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Alternative Configurations
![Bus Element In block](http://www.tatmou.com/ch/ch/help/simulink/slref/in_bus_element_block_icon.png)
Bus Element In—Select input from external port
TheBus Element Inblock differs from theIn Bus Elementblock by name only.
Libraries:
Simulink / Signal Routing
HDL Coder / Signal Routing
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
HDL Code Generation
Generate Verilog and VHDL code for FPGA and ASIC designs using HDL Coder™.
This block can be used to simplify subsystem bus interfaces when you use the block in subsystems that generate HDL code, but it is not included in the hardware implementation.
To learn more about using buses for HDL code generation, seeBuses(HDL Coder)andUse Bus Signals to Improve Readability of Model and Generate HDL Code(HDL Coder)。
Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.
Version History
Introduced in R2017aR2023a:Property Inspector supportsIn Bus Elementblocks
TheProperty InspectorsupportsIn Bus ElementandOut Bus Elementblocks.
R2023a:Messages link to relatedIn Bus Elementblocks
Warning and error messages forIn Bus ElementandOut Bus Elementblocks now link to the corresponding block in the block diagram, helping you quickly find the source of the warning or error. In previous releases, warning and error messages refer to a hidden block and do not provide a link.
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:。
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- Denmark(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- France(Français)
- Ireland(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- Norway(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)