MATLAB SIMULINK VERIFICATION AND VALIDATION - S Guide de l'utilisateur Page 616

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 674
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 615
25 Create Model Advisor Checks
25-40
Here is an example of a detailed check callback function that checks optimization
settings for simulation and code generation.
function [ResultDescription, ResultDetails] = SampleStyleTwoCallback(system)
ResultDescription ={};
ResultDetails ={};
model = bdroot(system);
mdladvObj = Simulink.ModelAdvisor.getModelAdvisor(system); % get object
mdladvObj.setCheckResultStatus(true); % init result status to pass
% Check Simulation optimization setting
ResultDescription{end+1} = ModelAdvisor.Paragraph(['Check Simulation '...
'optimization settings:']);
if strcmp(get_param(model,'BlockReduction'),'off');
ResultDetails{end+1} = {ModelAdvisor.Text(['It is recommended to '...
'turn on Block reduction optimization option.'],{'italic'})};
mdladvObj.setCheckResultStatus(false); % set to fail
mdladvObj.setActionEnable(true);
else
ResultDetails{end+1} = {ModelAdvisor.Text('Passed',{'pass'})};
end
% Check code generation optimization setting
ResultDescription{end+1} = ModelAdvisor.Paragraph(['Check code generation '...
'optimization settings:']);
ResultDetails{end+1} = {};
if strcmp(get_param(model,'LocalBlockOutputs'),'off');
ResultDetails{end}{end+1} = ModelAdvisor.Text(['It is recommended to'...
' turn on Enable local block outputs option.'],{'italic'});
ResultDetails{end}{end+1} = ModelAdvisor.LineBreak;
mdladvObj.setCheckResultStatus(false); % set to fail
mdladvObj.setActionEnable(true);
end
if strcmp(get_param(model,'BufferReuse'),'off');
ResultDetails{end}{end+1} = ModelAdvisor.Text(['It is recommended to'...
' turn on Reuse block outputs option.'],{'italic'});
mdladvObj.setCheckResultStatus(false); % set to fail
mdladvObj.setActionEnable(true);
end
if isempty(ResultDetails{end})
ResultDetails{end}{end+1} = ModelAdvisor.Text('Passed',{'pass'});
end
Check Callback Function with Hyperlinked Results
This callback function automatically displays hyperlinks for every object returned by
the check so that you can easily locate problem areas in your model or subsystem. The
keyword for this type of callback function is StyleThree. The check definition requires
this keyword (see “Define Custom Checks” on page 25-30).
This callback function takes the following arguments.
Vue de la page 615
1 2 ... 611 612 613 614 615 616 617 618 619 620 621 ... 673 674

Commentaires sur ces manuels

Pas de commentaire