%% Adaptive Interface for Variant Subsystems
% Copyright 2016-2018 The MathWorks, Inc.
%%
% This example shows how propagating variant conditions outside a Variant
% Subsystem block enables the block to adapt its interface according to
% the state of the underlying blocks.
%% Explore the Model
% Open the model |slexVariantSubsystemsAdaptiveInterface|.
%%
model = 'slexVariantSubsystemsAdaptiveInterface';
open_system(model)
%%
% The Controller block is a Variant Subsystem that provides a |Linear| and 
% a |Nonlinear| choice. The |Linear| choice is active when |V = 1|,  
% |Nonlinear| choice is active when |V = 2|. |V| is a variant control
% variable of type |Simulink.Parameter| and is defined in the
% |PostLoadFcn| callback of the model.
%
% To change the value of the variant control variable, in the MATLAB
% Command Window, type |V.Value = 1| or |V.Value = 2|.
%
% Double-click the |Controller| block to view its contents. The |Linear|
% and |Nonlinear| choices do not have a similar interface. The |Linear|
% choice is using the |sensor1| and |sensor3| inputs of the |Controller|
% block. The |Linear| choice is not using the |sensor2| input and does not
% produce a |saturate| output.
%
% In the Block Parameters dialog box for the |Controller| block, the *Propagate
% condition outside of variant subsystem* check box is selected. This
% setting propagates the conditions outside the block and enables the Variant
% Subsystem block to adapt its interface according to the state of the
% underlying blocks.
%% Simulate the Model
% Simulate the model after setting the active choice to |Linear|. The
% condition |V = 2| propagates to the |In2|, |filter|, and |saturation
% logger| blocks. These blocks become inactive because the |Linear|
% choice is not using the |sensor2| input and is not writing to the
% |saturate| output of the |Controller| block.
%%
% <<../adaptive-interface-model-simulated.png>>
