| Simulink® Verification and Validation™ | ![]() |
| On this page… |
|---|
About Registering Custom Checks, Tasks, and Groups Methods for Registering Custom Checks and Groups Code Example: Methods for Registering Custom Checks and Tasks |
To register checks, tasks, and groups in the Model Advisor, you must create the function sl_customization() in the sl_customization.m file on your MATLAB® path. This function accepts one argument, a handle to an object called Simulink.CustomizationManager, as in this example:
function sl_customization(cm)
The customization manager object includes methods for registering custom checks and tasks. You should use these methods to register customizations specific to your application, as described and demonstrated in the sections that follow.
Simulink® reads sl_customization.m files when it starts. If you subsequently change the contents of your customization file, update your environment by performing these tasks:
Close the Model Advisor if it is open.
If you previously opened the Model Advisor, reinitialize it either by removing the slprj folder from your working directory or by closing your model.
Enter the following command at the MATLAB command line:
sl_refresh_customizations
Open your model.
Start the Model Advisor.
The Simulink.CustomizationManager class includes the following methods for registering custom checks and tasks:
addModelAdvisorCheckFcn (@checkDefinitionFcn)
Adds the checks specified by the check definition function to the By Product folder of the Model Advisor unless otherwise specified using ModelAdvisor.Root.publish,ModelAdvisor.Group or ModelAdvisor.FactoryGroup. The checkDefinitionFcn argument is a handle to the function that defines all custom checks to be added to Model Advisor as instances of the ModelAdvisor.Check class (see Defining Custom Checks).
addModelAdvisorTaskFcn (@factorygroupDefinitionFcn)
Adds the checks specified by the factorygroupDefinitionFcn to the By Task folder of the Model Advisor unless otherwise specified using ModelAdvisor.Root.publish or ModelAdvisor.Group. The factorygroupDefinitionFcn argument is a handle to the function that calls all custom checks to be added to Model Advisor as instances of the ModelAdvisor.FactoryGroup class (see Defining Custom Groups).
addModelAdvisorTaskAdvisorFcn (@taskDefinitionFcn)
Adds the tasks specified by taskDefinitionFcn to the folder specified using ModelAdvisor.Root.publish or ModelAdvisor.Group. The taskDefinitionFcn argument is a handle to the function that defines all custom tasks to be added to Model Advisor as instances of the ModelAdvisor.Task class (see Defining Custom Tasks).
addModelAdvisorProcessFcn (@modelAdvisorProcessFcn)
Adds the process callback function for the Model Advisor checks (see Defining a Process Callback Function).
The following code example registers custom checks, custom tasks, and a process callback function:
function sl_customization(cm) % register custom checks cm.addModelAdvisorCheckFcn(@defineModelAdvisorChecks); % register custom factory group cm.addModelAdvisorTaskFcn(@defineModelAdvisorTasks); % register custom tasks. cm.addModelAdvisorTaskAdvisorFcn(@defineTaskAdvisor); % register custom process callback cm.addModelAdvisorProcessFcn(@ModelAdvisorProcessFunction);
![]() | Formatting Model Advisor Outputs | Function Reference | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |