Main Content

jc_0630: Usage of Multiport Switch blocks

Since R2020a

Guideline Publication

Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®

Sub ID Recommendations

  • NA-MAAB — a, c

  • JMAAB — a, b, c

MATLAB Versions

All

Rule

Sub ID a

Multiport Switch block parameter Number of data ports shall be two or more.

Custom Parameter

Not Applicable

Sub ID b

The input to the Multiport Switch control port shall be an unsigned integer.

Custom Parameter

Not Applicable

Sub ID c

When Multiport Switch block parameter Data port order is set to Specify indices, these block parameters shall be set as follows:

  • Set Data port for default case to Additional data port.

  • Set Diagnostic for default case to None.

Custom Parameter

Not Applicable

Example — Correct

Example — Incorrect

Rationale

Sub ID a:

  • Unintended output can occur when there is only one data port because the block changes to extract scalars from vectors.

Sub ID b:

  • The control port is an input range that expects an integer value of zero or greater. When a signed or non-integer signal is connected to the control port, it can appear as a misconnection.

  • There is a possibility of data ports being unintentionally selected when negative or non-integer values are input.

Sub ID c:

  • When block parameter Data port order is set to Specify indices, a value that inputs to the Multiport Switch block, other than the index specified for the control port, is treated the same as the last value of the specified index. As a result, an unintended data port can be selected.

Verification

Model Advisor check: Check settings for data ports in Multiport Switch blocks (Simulink Check)

Last Changed

R2020a

Version History

Introduced in R2020a