Multiport Switch - Choose between multiple block inputs

Library

Signal Routing

Description

The Multiport Switch block chooses between a number of inputs. The first input is called the control input, while the rest of the inputs are called data inputs. The value of the control input determines which data input is passed through to the output port. (See Changing the Orientation of a Block in the Simulink documentation for a description of the port order for various block orientations.)

If the control input is an integer value, then the specified data input is passed through to the output. For example, suppose the Use zero-based indexing parameter is not selected. If the control input is 1, then the first data input is passed through to the output. If the control input is 2, then the second data input is passed through to the output, and so on. If the control input is not an integer value, the block first truncates the value to an integer by rounding to floor. If the truncated control input is less than 1 or greater than the number of input ports, an out-of-bounds error is returned.

You specify the number of data inputs with the Number of inputs parameter. The data inputs can be scalar or vector. The block output is determined by these rules:

The Index Vector block, also in the Signal Routing library, is another implementation of the Multiport Switch block that has different default parameter settings.

Data Type Support

The control signal can be of any data type supported by Simulink software, including fixed-point and enumerated types, except Boolean. If the control signal is numeric, it cannot be complex. If it is enumerated, the block uses the value of the underlying integer to select a data port. If the underlying integer does not correspond to a data port, an error occurs.

The data signals can be of any data type supported by Simulink software. If any data signal is of an enumerated type, all others must be of the same enumerated type.

For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink in the Simulink documentation.

Parameters and Dialog Box

The Main pane of the Multiport Switch block dialog appears as follows:

Number of inputs

Specify the number of data inputs to the block.

Use zero-based indexing

If selected, the block uses zero-based indexing. Otherwise, the block uses one-based indexing.

Sample time (-1 for inherited)

Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See Specifying Sample Time in the online documentation for more information.

The Signal Attributes pane of the Multiport Switch block dialog appears as follows:

Require all data port inputs to have the same data type

Select to require all data port inputs to have the same data type.

Output minimum

Specify the minimum value that the block should output. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:

Output maximum

Specify the maximum value that the block should output. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:

Output data type

Specify the output data type. You can set it to:

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.

See Specifying Block Output Data Types for more information.

Lock output scaling against changes by the autoscaling tool

Select to lock scaling of outputs. This parameter is visible only if you enter an expression for the Output data type parameter.

Round integer calculations toward

Select the rounding mode for fixed-point operations. For more information, see Rounding in the Simulink Fixed Point User's Guide.

Saturate on integer overflow

Select to have overflows saturate.

Bus Support

The Multiport Switch block is a bus-capable block. The inputs can be virtual or nonvirtual bus signals subject to the following restrictions:

All signals in a nonvirtual bus input to a Multiport Switch block must have the same sample time, even if the elements of the associated bus object specify inherited sample times. You can use a Rate Transition block to change the sample time of an individual signal, or of all signals in a bus. See Using Buses and Bus-Capable Blocks for more information.

Characteristics

Bus-capableYes, with restrictions as noted above

Direct Feedthrough

Yes

Sample Time

Specified in the Sample time parameter

Scalar Expansion

Yes

Dimensionalized

Yes

Multidimensionalized

Yes

Zero Crossing

No

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS