Upgrade Advisor
Do you run the Upgrade Advisor on your models when upgrading to a new release? If not, you should!
Upgrading a model to a new version
Today, I want to show how the Upgrade Advisor can help when transitioning to a new version to take advantage of new features, as well as the reasons behind some of the changes we’ve made that require upgrading.
To show this, I launched MATLAB R2007b and made a Simulink model with a few blocks.
I open it in the latest release, R2015b. I am able to simulate it without errors, but I will use Upgrade Advisor to see if new changes introduced since R2007b affect this model.
The Upgrade Advisor is launched from the Analysis menu:
You will notice that it looks very much like the Model Advisor... because it is based on the same technology. It contains different checks, targeted at helping you to upgrade to new versions.
I enable all the checks and run them all. Here are the results:
Wow... 8 warnings! Let's see what those are.
Check usage of function-call connections
In the past, the default value of this diagnostic setting was "Use local setting". Since then, we realized that allowing that was sometimes leading to non-deterministic model execution. Now we recommend to always set this diagnostic to "Error".
This can easily be fixed by clicking the "Modify Settings" button below the check result
Check that the model is saved in SLX format
In R2012b, we introduced a new Simulink file format with .slx extension. This format provides a lot of advantages compared to the old .mdl format. The files generated are usually 10 times smaller, better support for non-English characters like Chinese and Korean, and some recent features are supported only in this mode.
Once again, this can be fixed by a single button click.
Check signal logging save format
In R2007b, signals were saved in ModelDataLogs format. Since then, many bugs and usability issues have been found with this format. We decided to address this issue by creating a completely new logging format, the Dataset.
You can see an example problem with the old ModelDataLogs format in Bug Report 495436.
If you are ready to move to the Dataset format, the action button will do it for you.
Check model for block upgrade issues requiring compile time information
This one is very important. Since R2007b, we decided to deprecate the 1D Lookup Table block and to replace it with the n-D Lookup, configured with one dimension.
If we compare the dialog of the two blocks, we can see that the new one offers a lot more options, like spline interpolation. The new block also has improved performance, both in simulation and generated code.
Many other blocks can be found by this check.
Merge, Buses and Simplified Initialization
The next 3 checks are closely related. As was the case for Check usage of function-call connections, we realized since R2007b that some semantics in Simulink can lead to results that are difficult to understand.
To help with that, we decided to discourage, and in certain case completely disallow, certain practices like mixing buses and muxes, allowing multiple writes to the Merge block during the same time step, etc.
If you are lucky, your model did not contain such patterns and you will be able to apply the recommended settings easily. If your model contains such pattern, the results of those checks will guide you on how to manually modify the model if it cannot be done automatically.
Analyze model hierarchy and continue upgrade sequence
If the model contains library blocks or referenced models, this last check will re-run the Upgrade Advisor on those, until the entire hierarchy is updated.
Note that in R2015b, a bug got introduced in this last check. I recommend installing the patch attached to Bug Report 1307296 to avoid it.
Now I have a clean model fully updated
Now it's your turn
I hope you learned a few things about why it is important to run the model through the Upgrade Advisor when moving to a new release. Without the Upgrade Advisor, there are multiple things that I could have missed, and might have caused me trouble later.
Let us know what you think of the Upgrade Advisor by leaving a comment here.
- Category:
- Simulink Tips
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.