%% Control Variant Condition Propagation
% Copyright 2010-2018 The MathWorks, Inc.
%%
% During variant condition propagation, Simulink automatically assigns
% conditions to blocks. You can control how the variant condition
% propagates upstream and downstream in a model.
%%
% Consider this model.  
%%
model = 'slexVariantStopCondProp';
open_system(model);
%%
% In Simulink, click *Simulation* > *Run* to view the variant condition
% propagation to blocks.
%% 
% <<../controlvarcondpropagation.png>>
%%
%%
% The |Variant Source1| block has the |A==1| condition, which propagates
% backward and forward to the blocks connected to |Variant
% Source1| block. The variant condition propagates to |Gain4| block but
% does not propagate to the |Sine Wave1| block. 
%%
% The |Scope| block is unconditional and receives its inputs from the |Sine
% Wave1| block. Therefore, the |Sine Wave1| block is unconditional. If
% you remove the |Scope| block, the variant condition propagates to the
% |Sine Wave1| block.
%%
% If you replace the |Scope| block with any other block (including
% the |Terminator| block), the |Sine Wave1| block remains unconditional. 
%% 
% A block is unconditional if at least one of its inputs is unconditional.
% The input side of the |Sum| block is connected to |Gain5| (conditional)
% block and to the |Sine Wave2| (unconditional) block. Therefore, the |Sum|
% block is unconditional.
%% 
% You can use these concepts to create a Subsystem block that controls the
% propagation of variant conditions to both sides or to one side.
%% Stop Propagation of Variant Condition Upstream and Downstream
% Consider the section of the model that is connected to the |Variant
% Source2| and |Variant Source3| blocks.
% When you simulate the model, the Variant condition from the |Variant
% Source2| block and the |Variant Source3| blocks propagates upstream and
% downstream.
%%
% The |Stop on both sides| block between |Gain6| and the |Gain7| block
% prevents the Variant condition from propagating upstream or downstream. 
% Double-click the |Stop on both sides| block to view its components.
%%
% <<../stopboth-prop.png>>
%%
% The |Stop on both sides| block uses a |Terminator| to stop the variant
% condition propagation on upstream of the |Subsystem| block. To stop the
% condition propagation on the downstream side of the |Subsystem| block,
% one of the inports is connected to |Ground| (unconditional). Therefore,
% this arrangement stops the variant condition propagation upstream and
% downstream. Similarly, you can selectively stop the condition propagation
% of variant condition upstream or downstream for a model. For example,
% if you remove the |Terminator| block, variant condition propagates
% upstream but is stopped downstream.

%% Stop Propagation of Variant Condition Downstream
%%
% <<../stopdown1-prop.png>>
%%
% Here, one input port of the Subsystem block is unconditional making the
% Subsystem block unconditional at input side and thus stopping the
% propagation of variant condition downstream.
%% More About
%
% * <docid:simulink_ug.mw_d91f6889-3ee6-4831-a7f8-10f46d80f208 Variant Condition Propagation Overview>
% * <docid:simulink_ug.bu73fdb>
% * <https://www.mathworks.com/solutions/variant-system-design.html Variant System Design>
