%% File Packaging for Models (Code and Data)
% This example shows how referenced models provide system interface encapsulation and incremental code generation.
% You can reference one model from another model (one or more times), and aspects of the referenced
% model are fixed: input/output signal types, parameter types, and sample times.  Therefore, you can modularize your
% design and perform incremental code generation. 
%%
% The code generator partitions data and functions of a referenced model into its own set of files, independent of its 
% parent model. In this example, the referenced model |rtwdemo_mdlrefbot| is referenced three times.  For simulation 
% and code generation, the model is incrementally generated, which means |rtwdemo_mdlrefbot| builds the first time, 
% but not on subsequent builds, unless you change |rtwdemo_mdlrefbot|.
%%
open_system('rtwdemo_mdlreftop')

%%
% # Generate and inspect the code.
% # Change the value of one of the constant inputs in |rtwdemo_mdlreftop|.
% # Generate code.  The code generator does not reproduce code for 
% reference model |rtwdemo_mdlreftop|.
%%
bdclose('rtwdemo_mdlreftop');


%% 
% Copyright 2019 The MathWorks, Inc.