User`s guide

25 Create Model Advisor Checks
25-20
rec = ModelAdvisor.Check('com.mathworks.Check1');
rec.Title = 'Example: Check model configuration parameters';
rec.setCallbackFcn(@(system)(Advisor.authoring.CustomCheck.checkCallback...
(system)), 'None', 'StyleOne');
rec.TitleTips = 'Example check for model configuration parameters';
% --- data file input parameters
rec.setInputParametersLayoutGrid([1 1]);
inputParam1 = ModelAdvisor.InputParameter;
inputParam1.Name = 'Data File';
inputParam1.Value = 'ex_DataFile.xml';
inputParam1.Type = 'String';
inputParam1.Description = 'Name or full path of XML data file.';
inputParam1.setRowSpan([1 1]);
inputParam1.setColSpan([1 1]);
rec.setInputParameters({inputParam1});
% -- set fix operation
act = ModelAdvisor.Action;
act.setCallbackFcn(@(task)(Advisor.authoring.CustomCheck.actionCallback...
(task)));
act.Name = 'Modify Settings';
act.Description = 'Modify model configuration settings.';
rec.setAction(act);
mdladvRoot = ModelAdvisor.Root;
mdladvRoot.register(rec);
%% defineModelAdvisorGroups
function defineModelAdvisorGroups
mdladvRoot = ModelAdvisor.Root;
% --- sample factory group 1
rec = ModelAdvisor.FactoryGroup('com.mathworks.Test.factoryGroup');
rec.DisplayName='Example: My Group';
rec.addCheck('com.mathworks.Check1');
mdladvRoot.publish(rec);
3
Create the Example: Check model configuration parameters. At the command
prompt, enter:
sl_refresh_customizations
4
At the command prompt, type vdp.
5
In the model window, select Simulation > Model Configuration Parameters. In
the Diagnostics pane, to trigger check warnings, set the configuration parameters
as follows:
Algebraic loop to none
Minimize algebraic loop to warning
Block Priority Violation to warning