Main Content

Upgrade Advisor

Fix models and upgrade them to the current release

Description

Use the Upgrade Advisor to fix your Simulink® models and upgrade them to the current release.

The Upgrade Advisor helps you:

  • Identify models that no longer work because of behavior changes or improvements in Simulink.

  • Identify models that you can enhance by using newly released features and settings in Simulink.

  • Transition to new technologies and upgrade a model hierarchy by performing automatic upgrades or providing instructions for manual fixes.

For more information about using Upgrade Advisor with your models, see Upgrade Models Using Upgrade Advisor.

Upgrade Advisor tool

Open the Upgrade Advisor

  • Simulink Editor: On the Modeling tab, select Model Advisor > Upgrade Advisor.

  • MATLAB® Command Window:

    upgradeadvisor("modelname")

  • Model Advisor: In the Model Advisor, click Upgrade Advisor.

Examples

expand all

Open the vdp example model.

openExample("vdp.slx");
On the Modeling tab, select Model Advisor > Upgrade Advisor to open the Upgrade Advisor for this model.

  1. Select only the check you want to run.

  2. Click Run This Check.

    Upgrade Advisor with one check selected in the left pane and Run This Check button in the right pane

  1. Open the Upgrade Advisor for the vdp example model.

    openExample("vdp.slx");
    upgradeadvisor("vdp")
    

  2. Alternatively, you can open the Upgrade Advisor for the currently selected model.

    upgradeadvisor(bdroot)
    

This example shows how to analyze and upgrade your model, and then apply automatic fixes when they are available.

1. Load your model and create an upgrader object. In this example, to load and open the example model, open the project that contains the model.

openProject("ModelReferenceHierarchy");
upgrader = upgradeadvisor("sldemo_mdlref_depgraph.slx")
upgrader = 
  Upgrader with properties:

      ChecksToSkip: {}
     SkipLibraries: 0
     SkipBlocksets: 1
      OneLevelOnly: 0
        ShowReport: 1
    VerboseLogging: 0
         RootModel: 'sldemo_mdlref_depgraph'
        ReportFile: ''

Run "upgrade" on this Upgrader object to analyze and automatically upgrade your models.

2. Analyze the model for recommended upgrades, following library links and model references.

analyze(upgrader);
(1/14) Analyzing Model "sldemo_mdlref_depgraph"
(2/14) Analyzing Model "sldemo_mdlref_heat2cost"
(3/14) Analyzing Model "sldemo_mdlref_house"
(4/14) Analyzing Model "sldemo_mdlref_F2C"
(5/14) Analyzing Model "sldemo_mdlref_outdoor_temp"
(6/14) Analyzing Model "sldemo_mdlref_thermostat"
(7/14) Analyzing Model "sldemo_mdlref_heater"
(8/14) Analyzing Model "sldemo_mdlref_heat2cost" using compile time information
(9/14) Analyzing Model "sldemo_mdlref_house" using compile time information
(10/14) Analyzing Model "sldemo_mdlref_F2C" using compile time information
(11/14) Analyzing Model "sldemo_mdlref_outdoor_temp" using compile time information
### Starting serial model reference simulation build.
### Model reference simulation target for sldemo_mdlref_F2C is up to date.

Build Summary

0 of 1 models built (1 models already up to date)
Build duration: 0h 0m 2.1551s
### Starting serial model reference code generation build.
### Checking status of model reference code generation target for model 'sldemo_mdlref_F2C' used in 'sldemo_mdlref_outdoor_temp'.
### Checking for structural changes in sldemo_mdlref_F2C because the model reference rebuild option is set to 'If any changes detected'. Structural changes cause the model reference code generation target to be rebuilt.
### Checking for structural changes in model reference code generation target for: sldemo_mdlref_F2C
### Generating code and artifacts to 'Model specific' folder structure
### Code for the model reference code generation target for model sldemo_mdlref_F2C is up to date because no functional changes were found in referenced model.
### Model reference code generation target for sldemo_mdlref_F2C is up to date.

Build Summary

0 of 1 models built (1 models already up to date)
Build duration: 0h 0m 1.3025s

### Starting serial model reference simulation build.
### Model reference simulation target for sldemo_mdlref_F2C is up to date.

Build Summary

0 of 1 models built (1 models already up to date)
Build duration: 0h 0m 1.4746s
(12/14) Analyzing Model "sldemo_mdlref_thermostat" using compile time information
(13/14) Analyzing Model "sldemo_mdlref_heater" using compile time information
### Starting serial model reference simulation build.
### Model reference simulation target for sldemo_mdlref_thermostat is up to date.

Build Summary

0 of 1 models built (1 models already up to date)
Build duration: 0h 0m 1.4151s
### Starting serial model reference code generation build.
### Checking status of model reference code generation target for model 'sldemo_mdlref_F2C' used in 'sldemo_mdlref_heater'.
### Checking for structural changes in sldemo_mdlref_F2C because the model reference rebuild option is set to 'If any changes detected'. Structural changes cause the model reference code generation target to be rebuilt.
### Checking for structural changes in model reference code generation target for: sldemo_mdlref_F2C
### Generating code and artifacts to 'Model specific' folder structure
### Code for the model reference code generation target for model sldemo_mdlref_F2C is up to date because no functional changes were found in referenced model.
### Model reference code generation target for sldemo_mdlref_F2C is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_thermostat' used in 'sldemo_mdlref_heater'.
### Checking for structural changes in sldemo_mdlref_thermostat because the model reference rebuild option is set to 'If any changes detected'. Structural changes cause the model reference code generation target to be rebuilt.
### Checking for structural changes in model reference code generation target for: sldemo_mdlref_thermostat
### Generating code and artifacts to 'Model specific' folder structure
### Code for the model reference code generation target for model sldemo_mdlref_thermostat is up to date because no functional changes were found in referenced model.
### Model reference code generation target for sldemo_mdlref_thermostat is up to date.

Build Summary

0 of 2 models built (2 models already up to date)
Build duration: 0h 0m 2.0631s

### Starting serial model reference simulation build.
### Model reference simulation target for sldemo_mdlref_thermostat is up to date.

Build Summary

0 of 1 models built (1 models already up to date)
Build duration: 0h 0m 1.5653s
(14/14) Analyzing Model "sldemo_mdlref_depgraph" using compile time information
### Starting serial model reference simulation build.
### Model reference simulation target for sldemo_mdlref_F2C is up to date.
### Model reference simulation target for sldemo_mdlref_thermostat is up to date.
### Model reference simulation target for sldemo_mdlref_heat2cost is up to date.
### Model reference simulation target for sldemo_mdlref_house is up to date.
### Model reference simulation target for sldemo_mdlref_outdoor_temp is up to date.

Build Summary

0 of 5 models built (5 models already up to date)
Build duration: 0h 0m 0.7038s
### Starting serial model reference code generation build.
### Checking status of model reference code generation target for model 'sldemo_mdlref_F2C' used in 'sldemo_mdlref_depgraph:sldemo_mdlref_heater'.
### Model reference code generation target for sldemo_mdlref_F2C is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_thermostat' used in 'sldemo_mdlref_depgraph:sldemo_mdlref_heater'.
### Model reference code generation target for sldemo_mdlref_thermostat is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_heat2cost' used in 'sldemo_mdlref_depgraph'.
### Model reference code generation target for sldemo_mdlref_heat2cost is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_house' used in 'sldemo_mdlref_depgraph'.
### Model reference code generation target for sldemo_mdlref_house is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_heater' used in 'sldemo_mdlref_depgraph'.
### Model reference code generation target for sldemo_mdlref_heater is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_outdoor_temp' used in 'sldemo_mdlref_depgraph'.
### Model reference code generation target for sldemo_mdlref_outdoor_temp is up to date.

Build Summary

0 of 6 models built (6 models already up to date)
Build duration: 0h 0m 0.77985s

### Starting serial model reference simulation build.
### Model reference simulation target for sldemo_mdlref_F2C is up to date.
### Model reference simulation target for sldemo_mdlref_thermostat is up to date.
### Model reference simulation target for sldemo_mdlref_heat2cost is up to date.
### Model reference simulation target for sldemo_mdlref_house is up to date.
### Model reference simulation target for sldemo_mdlref_outdoor_temp is up to date.

Build Summary

0 of 5 models built (5 models already up to date)
Build duration: 0h 0m 0.68423s

3. Specify an output to find the location of the report.

reportLocation = upgrader.ReportFile;

4. Configure options before you analyze or upgrade your model.

  • By default, upgradeadvisor generates backup copies for models during the upgrade process. To turn off the generation of backup files, set the EnableBackups property.

upgrader.EnableBackups = false;
  • To skip a check, in the Upgrade Advisor, right-click the check, select Send Check ID to Workspace, and set the ChecksToSkip property.

upgrader.ChecksToSkip = {"mathworks.design.CSStoVSSConvert"};
  • To analyze or upgrade the current model without analyzing library links, model references, or test harnesses that are saved as external models, enable the OneLevelOnly property.

upgrader.OneLevelOnly = true;
  • To analyze or upgrade the current model and model references but not library links, enable the SkipLibraries property.

upgrader.SkipLibraries = true;
  • To analyze and upgrade the current models and files in blocksets or toolboxes, disable the SkipBlocksets property. By default, the Upgrade Advisor does not upgrade files in blocksets or toolboxes. The Upgrade Advisor detects blocksets from the output of the ver function and the existence of the Contents file.

upgrader.SkipBlocksets = false;
  • To turn off showing the report after you analyze or upgrade your model, disable the ShowReport property.

upgrader.ShowReport = false;

5. Upgrade the model and apply automatic fixes when they are available.

upgrade(upgrader);
(1/2) Upgrading Model "sldemo_mdlref_depgraph"
(2/2) Upgrading Model "sldemo_mdlref_depgraph" using compile time information
### Starting serial model reference simulation build.
### Model reference simulation target for sldemo_mdlref_F2C is up to date.
### Model reference simulation target for sldemo_mdlref_thermostat is up to date.
### Model reference simulation target for sldemo_mdlref_heat2cost is up to date.
### Model reference simulation target for sldemo_mdlref_house is up to date.
### Model reference simulation target for sldemo_mdlref_outdoor_temp is up to date.

Build Summary

0 of 5 models built (5 models already up to date)
Build duration: 0h 0m 0.66955s
### Starting serial model reference code generation build.
### Checking status of model reference code generation target for model 'sldemo_mdlref_F2C' used in 'sldemo_mdlref_depgraph:sldemo_mdlref_heater'.
### Model reference code generation target for sldemo_mdlref_F2C is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_thermostat' used in 'sldemo_mdlref_depgraph:sldemo_mdlref_heater'.
### Model reference code generation target for sldemo_mdlref_thermostat is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_heat2cost' used in 'sldemo_mdlref_depgraph'.
### Model reference code generation target for sldemo_mdlref_heat2cost is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_house' used in 'sldemo_mdlref_depgraph'.
### Model reference code generation target for sldemo_mdlref_house is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_heater' used in 'sldemo_mdlref_depgraph'.
### Model reference code generation target for sldemo_mdlref_heater is up to date.
### Checking status of model reference code generation target for model 'sldemo_mdlref_outdoor_temp' used in 'sldemo_mdlref_depgraph'.
### Model reference code generation target for sldemo_mdlref_outdoor_temp is up to date.

Build Summary

0 of 6 models built (6 models already up to date)
Build duration: 0h 0m 0.67922s

### Starting serial model reference simulation build.
### Model reference simulation target for sldemo_mdlref_F2C is up to date.
### Model reference simulation target for sldemo_mdlref_thermostat is up to date.
### Model reference simulation target for sldemo_mdlref_heat2cost is up to date.
### Model reference simulation target for sldemo_mdlref_house is up to date.
### Model reference simulation target for sldemo_mdlref_outdoor_temp is up to date.

Build Summary

0 of 5 models built (5 models already up to date)
Build duration: 0h 0m 0.99939s

The Upgrade Advisor displays the list of found issues and automatic fixes.

The Upgrade Advisor saves fixes to the model files.

Related Examples

Programmatic Use

expand all

upgradeadvisor("modelname") opens the Upgrade Advisor for the model specified by modelname. This command loads the model if necessary, but does not open it in the Simulink Editor. Use the Upgrade Advisor to upgrade and improve models with features in the current release.

upgrader = upgradeadvisor("modelname") returns an object that you can use to analyze and upgrade a hierarchy of models programmatically. If you specify an output, then the Upgrade Advisor does not open. You can use the analyze and upgrade object functions with the upgrader object that the upgradeadvisor function returns.

  • To programmatically analyze a model for recommended upgrades, create an upgrader object and use the analyze object function.

  • To programmatically analyze and upgrade a model, create an upgrader object and use the upgrade object function.

  • For information about how to configure options before you analyze or upgrade your model, see Programmatically Analyze and Upgrade Model.

Tips

  • For models with no hierarchy, by default, the Upgrade Advisor selects and runs all checks except the Analyze model hierarchy and continue upgrade sequence check.

    For model hierarchies, use the Analyze model hierarchy and continue upgrade sequence check to guide you through upgrade checks. You must run upgrade checks in this order: first the checks that do not require compile time information and do not trigger an Update Diagram, then the compile checks. For more information, see Analyze model hierarchy and continue upgrade sequence.

  • For the list of individual upgrade advisor checks, see Model Upgrades.

  • For an example that shows how to upgrade your entire MATLAB project, see Check for Compatibility Issues and Upgrade Simulink Models Using Project Upgrade.

Version History

Introduced in R2012b