主要内容

Define Constraint Using Referenced Configurations

R2026b

In Simulink® Variant Manager™, you can define constraints for the top-level model using referenced component configurations. This approach is especially helpful for complex models, where manually writing out control variable expressions to define the constraint can be time-consuming.

In the plant controller system of the top-level model slexVariantManagerOverviewGS, the low-fidelity nonlinear controller is not designed to handle noise from the plant's feedback signal. Define a constraint in the top-level model that fails for configurations that implement such a variant combination.

Open Example Model

This tutorial uses the example model slexVariantManagerOverviewGS, which comes with a minimal set of variant configurations. You can use this model to follow along with the steps in the tutorial.

modelName = "slexVariantManagerOverviewGS";
open_system(modelName);

Define Variant Constraint

Open Variant Manager.

  1. Go to the Constraints tab and add a new constraint named UnsupportedControllersForNoise.

  2. Click the Show referenced component configurations button . The Referenced Configurations view for the constraint opens as a tab in the model hierarchy pane.

  3. For the Controller component, select the NonLinearLowFid configuration in the Selected Configuration column.

  4. Click the Add button . This action inserts the corresponding condition controllerConfigsGS.isConfigActive('NonLinearLowFid') into the Condition box.

    Variant Manager window shows the component configurations tab for creating constraints. The NonLinearLowFid configuration is selected for the Controller component.

  5. Manually edit the expression in the Condition box to append the variant condition expression corresponding to noisy input: vNoise == NoiseTypesGS.Gaussian.

  6. Negate the condition using the ~ operator.

  7. Click Apply Changes and save the top-level data dictionary dVariantManagerGS.sldd.

If you try to activate a configuration that uses this combination now, it will fail due to this constraint.

The Constraints pane shows the constraint condition that is built using the component configuration corresponding to the NonLinearLowFid controller.

Open Completed Model

You can also access a fully set-up version of the models used in this tutorial, which already includes all configurations. To open this version, use this command.

open_system("slexVariantManagerOverview");

See Also

|

Topics