Share Simulation Builds for Faster Simulations

You can reuse a simulation build for a model that builds a Simulink accelerator, rapid accelerator, or referenced model simulation (SIM) target. The first time that you simulate this model or update the diagram for this model, the build process creates a Simulink® cache file to store build artifacts. Simulink creates:

  • A Simulink accelerator target for the top model

  • A rapid accelerator target for the top model

  • A SIM target for a referenced model that has one or more accelerator mode instances in a model hierarchy

For a model hierarchy, each referenced model that generates these targets has an associated cache file. The cache file name is the name of the model with an .slxc file extension. You can use the same cache file on different platforms after creating the cache file on each platform. Use cache files to:

  • Speed up first-time builds for later use by yourself or others.

  • Speed up parallel simulations.

  • Avoid manual updates associated with setting the Rebuild configuration parameter to Never. That setting prevents SIM target builds and cache file updates.

When you modify a model and then update the diagram or simulate, Simulink determines whether to rebuild based on the Rebuild setting for the model. For a rebuild, Simulink updates the build artifacts on disk and the cache file.

Store Simulink Cache Files

Simulink stores cache files in the folder specified by the Simulation cache folder preference. You can change the default location. To use the cache file with the model, store the cache file on the MATLAB® path. To preserve a version of the cache file:

  • Manually move the cache file outside the folder specified by the Simulation cache folder preference.

  • Specify a different folder by the Simulation cache folder preference before a rebuild.

Share Simulink Cache Files

Sharing Simulink cache files with team members saves them the first-time build overhead when they use your model. If you use a project, you can:

  • Identify out-of-date targets and include cache files in the share operation by using the Project tab Share button.

  • Display cache files and highlight missing cache files in the project tree by clicking the Dependency Analysis node.

When you create a project from a top model, the project includes associated cache files for the model and its referenced models.

If you do not use a project, you can save the cache files in a shared location or attach the cache files to an email. If you share an out-of-date cache file with someone, when that person simulates the model, Simulink detects that it must rebuild.

Use Simulink Cache Files

For team development of large models that reference other models, Simulink cache files are useful for a synchronize and design workflow. For example, assume that in this model development environment:

  • A team of 20 people is working on a model hierarchy containing 100 models.

  • All the referenced models simulate in accelerator mode.

  • The team uses one platform for development.

  • The team uses a source control system for their models.

The team uses Simulink cache files in this workflow:

  1. A pool of parallel worker machines updates the diagram for the model hierarchy using the latest version of the models.

  2. Your team member fetches the latest version of all models from the source control system.

  3. Your team member fetches the latest version of all Simulink cache files from the build archive.

  4. Your team member opens the top model and simulates it. During simulation, Simulink extracts the necessary artifacts from the cache files. The simulation begins without any builds.

  5. Your team member changes some models in the hierarchy and simulates, which rebuilds models as needed. While updating the diagram, Simulink locally updates the cache files for those models as needed.

  6. Your team member commits the changes to the source control system by submitting the changed models.

  7. The pool of parallel worker machines builds the latest version of the model hierarchy.

  8. You fetch the latest version of all models and cache files.

  9. You simulate the top model. Simulink extracts the necessary artifacts from the cache files without building.

Related Topics

External Websites