| Embedded IDE Link™ CC | ![]() |
Model reference lets your model include other models as modular components. This technique provides useful features because it:
Simplifies working with large models by letting you build large models from smaller ones, or even large ones.
Lets you generate code once for all the modules in the entire model and only regenerate code for modules that change.
Lets you develop the modules independently.
Lets you reuse modules and models by reference, rather than including the model or module multiple times in your model. Also, multiple models can refer to the same model or module.
Your Real-Time Workshop documentation provides much more information about model reference.
Model reference behaves differently in simulation and in code generation. For this discussion, you need to know the following terms:
Top model — The root model block or model. It refers to other blocks or models. In the model hierarchy, this is the topmost model.
Referenced models — Blocks or models that other models reference, such as models the top model refers to. All models or blocks below the top model in the hierarchy are reference models.
The following sections describe briefly how model reference works. More details are available in your Real-Time Workshop documentation in the online Help system.
When you simulate the top model, Real-Time Workshop software detects that your model contains referenced models. Simulink software generates code for the referenced models and uses the generated code to build shared library files for updating the model diagram and simulation. It also creates an executable (a MEX file, .mex) for each reference model that is used to simulate the top model.
When you rebuild reference models for simulations or when you run or update a simulation, Simulink software rebuilds the model reference files. Whether reference files or models are rebuilt depends on whether and how you change the models and on the Rebuild options settings. You can access these setting through the Model Reference pane of the Configuration Parameters dialog box.
Real-Time Workshop software requires executables to generate code from models. If you have not simulated your model at least once, Real-Time Workshop software creates a .mex file for simulation.
Next, for each referenced model, the code generation process calls make_rtw and builds each referenced model. This build process creates a library file for each of the referenced models in your model.
After building all the referenced models, Real-Time Workshop software calls make_rtw on the top model, linking to all the library files it created for the associated referenced models.
With few limitations or restrictions, Embedded IDE Link CC provides full support for generating code from models that use model reference.
The most important requirement for using model reference with the TI's processors is that you must set the Build action (go to Configuration Parameters > Embedded IDE Link CC) for all models referred to in the simulation to Archive_library.
To set the build action
Select Simulation > Configuration Parameters from the model menus.
The Configuration Parameters dialog box opens.
In the right pane, under Runtime, select set Archive_library from the Build action list.
If your top model uses a reference model that does not have the build action set to Archive_library, the build process automatically changes the build action to Archive_library and issues a warning about the change.
As a result of selecting the Archive_library setting, other options are disabled:
DSP/BIOS is disabled for all referenced models. Only the top model supports DSP/BIOS operation.
Interrupt overrun notification method, Export IDE link handle to the base workspace, and System stack size are disabled for the referenced models.
Each referenced model and the top model must include a Target Preferences block for the correct processor. You must configure all the Target Preferences blocks for the same processor.
To obtain information about which compiler to use and which archiver to use to build the referenced models, the referenced models require Target Preferences blocks. Without them, the compile and archive processes does not work.
By design, model reference does not allow information to pass from the top model to the referenced models. Referenced models must contain all the necessary information, which the Target Preferences block in the model provides.
Model reference with Embedded IDE Link CC does not allow you to use certain blocks or S-functions in reference models:
No blocks from the C62x DSP Library (in c6000lib) (because these are noninlined S-functions)
No blocks from the C64x DSP Library (in c6000lib) (because these are noninlined S-functions)
No noninlined S-functions
No driver blocks, such as the ADC or DAC blocks from any Target Support Package™ TC2 or Target Support Package TC6 block library
processors that you plan to use in Model Referencing must meet some general requirements.
A model reference compatible processor must be derived from the ERT or GRT processors.
When you generate code from a model that references another model, you need to configure both the top-level model and the referenced models for the same code generation processor.
The External mode option is not supported in model reference Real-Time Workshop software processor builds. Embedded IDE Link CC does not support External mode. If you select this option, it is ignored during code generation.
To support model reference builds, your TMF must support use of the shared utilities directory, as described in Supporting Shared Utility Directories in the Build Process.
To use an existing processor, or a new processor, with Model Reference, you set the ModelReferenceCompliant flag for the processor. For information on how to set this option, refer to ModelReferenceCompliant in the online Help system.
If you start with a model that was created prior to version 2.4 (R14SP3), to make your model compatible with the model reference processor, use the following command to set the ModelReferenceCompliant flag to On:
set_param(bdroot,'ModelReferenceCompliant','on')
Models that you develop with versions 2.4 and later of Embedded IDE Link CC automatically include the model reference capability. You do not need to set the flag.
![]() | processor Function Library and Embedded IDE Link CC | Verification | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |