%% Export-Function model with Variant Subsystem
% This example shows how to use Variant Subsystem model with Function-Call blocks as choice. 



% Copyright 2018 The MathWorks, Inc.


%%
% Consider this model containing a Variant Subsystem block. 
%
% *Note:* If you use Function-Call system as a variant choice for the
% Linear Subsystem block, then the other Subsystem block (Nonlinear) within
% the Variant Subsystem must also be Function-Call system. Additionally,
% the control ports in Linear and Nonlinear blocks and the corresponding
% inport block must have the same name (fcn).
%%
%%
% <<../export_function.png>>
%%
% The Variant Subsystem "VariantFcnCall" gets the inputs from two inport blocks. The "VariantFcnCall" block has two variant choices, Linear and Nonlinear governed
% by conditions VSSMODE==0 and VSSMODE==1. Root inport(fcn) is a
% function-call inport connecting variant subsystem making this model as
% export function model.
%% 
% <<../block_parameters1.png>>
%%
% You can simulate the model slexVariantSubsystemEnableChoice and verify
% the behavior of the counters by examining the results.
%% Code Generation
% You can use the Simulink Coder to generate code from a model containing
% Variant Subsystem blocks. By default the generated code contains only the
% active variant. Alternatively, you can generate code for all variants
% guarded by C preprocessor conditionals (#if, #elif, #endif) when using
% the Embedded Coder.
% In the generated code, the code inside fcn definition is guarded by C
% preprocessor conditionals inside export function.

% fcn() {
% #if VSSMODE==0
% // code for Linear choice
% .......
% #endif 
% #if VSSMODE==1
% // code for Nonlinear choice
% .......
% #endif 
%% More about
%
% * <docid:simulink_ug.mw_1f8a3eb7-5636-4aec-a746-d18de76fe6f6 Variant Systems with Conditional Systems>