How can I implement a two stage/level variant subsystem in Simulink?

1 Ansicht (letzte 30 Tage)
How can I implement a two stage/level variant subsystem in Simulink?
I would like to use a single mask with multiple layers of variance in a library.
Please see the attached models "TwoLayerVariant.slx" and the "TwoVariantLibrary.slx" for an example.
Both of the blocks in "TwoLayerVariant" are linked to the "TwoVariantLibrary". If you look under the mask of the "original" one, you can double-click on one of the variant subsystems to choose an appropriate variant for the second layer. However, when you try to change the mask, you will see the following message:
Warning: Attempt to change parameters of the block within a link. These changes can later be discarded or propagated to the library.
Now, if you look at the mask of the "improved" block, you will see that you can choose your task from the top level and you do not receive any library warnings. Additionally, the set of tasks changes depending on the current hardware configuration. Notice that initially, the updated block shows tasks A, B, and C, but if you execute the following command in the MATLAB command window, this list changes to only show tasks A and B.
>> evalin(get_param('TwoLayerVariant','ModelWorkspace'),'current_hardware = 1');
However, this method of implementing two layer variant subsystems causes the following error when the model is first opened.
Error in VARIANT_BLOCK: Initialization commands cannot be evaluated.
Caused by:
Block VARIANT_BLOCK_SUBSYSTEM attempted to change the active variant during update diagram. The active variant must be configured before the update diagram.

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 18 Jun. 2019
I believe that there is no straightforward way to get around this error regarding attempting to change the variant subsystem during model compile.
I would recommend that you create a separate library block for each variant at one level of the two-level variant subsystems. Then, you can have a single layer of variants.

Weitere Antworten (0)

Tags

Noch keine Tags eingegeben.

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by