Model Advisor does not work for Reference Configuration

16 views (last 30 days)
I would like to create Model Advisor check for the project that utilises Model References and has the following structure:
  1. main.sldd file with parameters and signals; also, reference configuration is stored in the same main.sldd file
  2. main.slx model and a couple of .slx files that are linked to the main model via model references
  3. then, I copied Port Color checks from this instruction: https://www.mathworks.com/help/slcheck/ug/fix-a-model-during-edit-time-to-comply-with-conditions-that-you-specify-with-the-model-advisor.html
The checks work fine for main.slx file but when I try to use checks for the reference models I face with the issues. Inside reference model I see that Inport blocks are highlighted as incorrect ones (see the picture below).
However, when I click on the "Warning" message I have the following errors in Matlab console:
Error using ModelAdvisor.getModelConfiguration
No advisor configuration has been setup for my_model. See:
ModelAdvisor.setConfiguration
Error in edittime.util.showBlockViolations
Error in edittime.util.showBlockViolations
Error in edittime.util.showBlockViolations
Error in slSingleSelectionActionConfig
Error in slSingleSelectionActionConfig
Displaying stack trace:
Error using ModelAdvisor.getModelConfiguration
In ModelAdvisor.getModelConfiguration
In edittime.util.showBlockViolations
In edittime.util.showBlockViolations
In edittime.util.showBlockViolations
In slSingleSelectionActionConfig
In slSingleSelectionActionConfig
Then, I tried to manually assign check configuration for model reference via the following command:
ModelAdvisor.setModelConfiguration("my_model","my_config.json");
No error was returned. Then, I launch
ModelAdvisor.getModelConfiguration("my_model");
and get the following error
Error using ModelAdvisor.getModelConfiguration
No advisor configuration has been setup for my_model. See: ModelAdvisor.setConfiguration
If I repeat the same steps but with the ModelAdvisor.setConfiguration command, the result will be the same and errors will repeat.
Could you please help me to setup the same Model Advisor configuration file for the reference configuration?

Answers (1)

Satwik
Satwik on 27 Mar 2024
Hello Anna, it appears that the issue you are encountering with Model Advisor for Model References is due to a known bug in MATLAB version R2022a. You can find the bug report here: https://www.mathworks.com/support/bugreports/details/2781877.
The workflow you are attempting functions properly in the latest version of MATLAB. I recommend updating your MATLAB to the latest release to address this issue.

Categories

Find more on Run Model Advisor Checks in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!