This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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:

  • Use a version control system.

  • 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 doing 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 Simulink project, you can:

  • Identify out-of-date targets and include cache files in the share operation by using the Simulink 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 Simulink project from a top model, the project includes associated cache files for the model and its referenced models.

If you do not use a Simulink 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 use model referencing, Simulink cache files are useful for a synchronize and design workflow. For example, assume 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 and the Simulink cache files. The team stores models in a source control system and stores Simulink cache files in a shared location.

  2. After updating the diagram, team members can access the updated models and Simulink cache files in the repository.

  3. Your team member gets the latest version of all models and Simulink cache files for the complete model hierarchy from the repository.

  4. Your team member opens the top model in the hierarchy 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 updates the cache files for those models as needed.

  6. Your team member commits the changes to the repository by submitting the changed models.

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

  8. You get 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