Main Content

이 페이지는 기계 번역을 사용하여 번역되었습니다. 영어 원문을 보려면 여기를 클릭하십시오.

setSubResultStatus

점검 또는 하위 점검 결과에 상태 추가

구문

setSubResultStatus(ft_obj, 'status')

설명

setSubResultStatus(ft_obj, 'status')은 결과에 상태를 표시하는 선택적 방법입니다. 결과에 검사 또는 하위 검사 상태를 표시하려면 이 방법을 사용합니다. ft_obj는 템플릿 개체에 대한 핸들입니다. status은 검사 상태를 식별하는 문자형 벡터입니다.

Pass: 확인 결과 문제가 식별되지 않았습니다.
D-Pass: 구성 매개변수에 따라 다릅니다. 확인 결과 문제가 식별되지 않았습니다.
Warn: 확인 결과 문제가 확인되었습니다.
Fail: 확인이 실행되지 않습니다.

예제

이 예에서는 최적화 설정을 찾고 보고하는 사용자 정의 검사에 대한 콜백 함수를 생성하는 방법을 보여줍니다. 점검은 두 개의 하위 점검으로 구성됩니다. 첫 번째는 블록 축소 최적화 설정을 검토하고 두 번째는 조건부 입력 분기 실행 최적화 설정을 검토합니다.

하위 검사가 포함된 검사 결과에는 다음 항목이 포함됩니다.

  • 전체 검사에서 검토하는 내용에 대한 설명입니다.

  • 하위 검사의 제목입니다.

  • 하위 검사가 검토하는 내용에 대한 설명입니다.

  • 해당되는 경우 표준에 대한 참조.

  • 하위 검사의 상태입니다.

  • 상태에 대한 설명입니다.

  • 하위 검사 결과입니다.

  • 하위 검사를 통과하지 못한 경우 권장되는 조치입니다.

  • 하위 검사 결과 사이의 선입니다.

% Sample Check 3 Callback Function: Check with Subchecks and Actions
% Find and report optimization settings
function ResultDescription = OptmizationSettingCallback(system)
% Initialize variables
system =getfullname(system);
mdladvObj = Simulink.ModelAdvisor.getModelAdvisor(system);
mdladvObj.setCheckResultStatus(false); % Default check status is 'Warning'
ResultDescription = {};

% Format results in a list using Model Advisor Result Template API
% Create a list template object for first subcheck
ft1 = ModelAdvisor.FormatTemplate('ListTemplate');

% Description of check in results
setCheckText(ft1,'Check optimization settings');

% Title and description of first subcheck
setSubTitle(ft1,'Verify Block reduction optimization setting');
setInformation(ft1,['Check to confirm that the Block reduction ' ...
                                'check box is cleared.']);
% Add See Also section with references to applicable standards
docLinks{1}     = {['Reference DO331 Section MB.6.3.4.e - Source code ' ...
                            'is traceable to low-level requirements']};
% Review 'Block reduction' optimization
setRefLink(ft1,docLinks);
if strcmp(get_param(system,'BlockReduction'),'off')
    % 'Block reduction' is cleared
    % Set subresult status to 'Pass' and display text describing the status
    setSubResultStatus(ft1,'Pass');
    setSubResultStatusText(ft1,['The ''Block reduction'' ' ...
                                    'check box is cleared']);
    ResultStatus = true;
else
    % 'Block reduction' is selected
    % Set subresult status to 'Warning' and display text describing the status
    setSubResultStatus(ft1,'Warn');
    setSubResultStatusText(ft1,['The Block reduction ' ...
                                    'check box is selected.']);
    setRecAction(ft1,['Clear the ''Optimization > Block reduction''' ...
                ' check box in the Configuration Parameters dialog box.']);
    ResultStatus = false;
end

ResultDescription{end+1} = ft1;

% Title and description of second subcheck
ft2 = ModelAdvisor.FormatTemplate('ListTemplate');
setSubTitle(ft2,'Verify Conditional input branch execution setting');
setInformation(ft2,['Check to confirm that the ''Conditional input branch ' ...
                                    'execution'' check box is cleared.'])
% Add See Also section and references to applicable standards
docLinks{1} = {['Reference DO331 Section MB.6.4.4.2 - Test coverage ' ...
                            'of software structure is achieved']};
setRefLink(ft2,docLinks);

% Last subcheck, suppress line
setSubBar(ft2,0);

% Check status of the 'Conditional input branch execution' check box
if strcmp(get_param(system,'ConditionallyExecuteInputs'),'off')
    % The 'Conditional input branch execution' check box is cleared
    % Set subresult status to 'Pass' and display text describing the status
    setSubResultStatus(ft2,'Pass');
    setSubResultStatusText(ft2,['The ''Conditional input branch ' ...
                                'execution'' check box is cleared.']);
else
    % 'Conditional input branch execution' is selected
    % Set subresult status to 'Warning' and display text describing the status
    setSubResultStatus(ft2,'Warn');
    setSubResultStatusText(ft2,['The ''Conditional input branch ' ...
                        'execution'' check box is selected.']);
    setRecAction(ft2,['Clear the ''Optimization > Conditional input branch ' ...
            'execution'' check box in the Configuration Parameters dialog box.']);
    ResultStatus = false;
end

ResultDescription{end+1} = ft2; % Pass list template object to Model Advisor
mdladvObj.setCheckResultStatus(ResultStatus); % Set overall check status
% Enable Modify Settings button when check fails
mdladvObj.setActionEnable(~ResultStatus);