Filter löschen
Filter löschen

How are R2018b and earlier Variant Model blocks are converted to Variant Subsystems?

1 Ansicht (letzte 30 Tage)
How are R2018b and earlier Variant Model blocks are converted to Variant Subsystems?

Antworten (1)

Rajesh Bandreddi
Rajesh Bandreddi am 25 Mai 2024
Bearbeitet: Rajesh Bandreddi am 19 Jun. 2024
Variant Subsystems contain more functionality than Model Variant blocks that are found in R2018b and earlier. Variant Subsystems can contain Model blocks and thus using Variant Subsystems with Model blocks as choices provides more functionality than the older Model Variant block. The older Model Variant block found in R2018b and earlier directly referenced model choices without the choice layer that is found in Variant Subsystems. Sometimes these older Model Variant blocks were referred to as “Model Reference Variants”. In the R2019a Simulink library, we have the newer “simulink/Ports & Subsystems/Variant Model” block which is a Variant Subsystem containing Model blocks as choices in the choice layer.
Starting with R2019a, Simulink automatically converts older Model Variant blocks into Variant Subsystems during model load. This automatic conversion helps smooth transition from older Model Variant blocks to Variant Subsystems. The transformation can occur in two ways:
Consistent ports case: Older Model Variant block with model choices having consistent ports. When the Model Variant block references two model choice blocks, the converted Variant Subsystem block contains the Model blocks as choices after the model is loaded. The number of ports on the resulting Variant Subsystem are the union of the Model block choices ports.
Inconsistent ports case: Older Model Variant block containing choices with inconsistent port names and numbers. Conversion is based on the selected model choice block. In this case, Simulink inserts a wrapper subsystem on the other model block choices to ensure correct name mapping in the Variant Subsystem. This process ensures that the behavior of the model variant block is accurately represented in the Variant Subsystem.
Consistent Ports Case Example
Consider the model which has older Model Variant block referencing two model choice blocks (‘mChild1.slx’, ‘mChild2.slx’). Both the models have the same number of input ports and output ports and matching names.
After loading this model, the ‘Controller’ block is converted to a Variant Subsystem block with the two model blocks as choices referencing ‘mChild1.slx’ and ‘mChild2.slx’ respectively.
Inconsistent Ports Case Example
Consider an older Model Variant block which refers to model choices which have inconsistent ports. In this case, conversion of the Model Variant block is based on selected model block. In the example below, ’mChildA2.slx’ Inport 1 is mapping correctly to sensor1 but Inport 2 is matching sensor3 which is different from selected choice model ‘mChildA1.slx’. When the port names and numbers are not consistent to ensure correct mapping in Variant Subsystem, Simulink inserts wrapper subsystems on the other Model block choices:
Note: Second port (sensor3) of ‘mChildA2’ is driven by ‘Sine2 externallyin case of Model Variant block.
When this model is loaded in R2019a, this will automatically convert to Variant Subsystem as shown below.
If we look closely on the ‘mChildA2’ choice, the Model block is wrapped inside a subsystem so that second input port (sensor3) of ‘mChildA2’Model block is mapped to second port (sensor2) of the Variant Subsystem to match the behavior of Model Variant block.

Kategorien

Mehr zu Component-Based Modeling finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by