setSubResultStatus
ステータスをチェックまたはサブチェックの結果に追加する
構文
setSubResultStatus(
ft_obj
, 'status
')
説明
setSubResultStatus(
は、結果でステータスを表示するオプションのメソッドです。このメソッドを使用して、結果でチェックまたはサブチェックのステータスを表示します。ft_obj
, 'status
')
はテンプレート オブジェクトへのハンドルです。ft_obj
はチェックのステータスを識別する文字ベクトルです。status
Pass :チェックで問題は特定されませんでした。 |
D-Pass :コンフィギュレーション パラメーターに依存します。チェックで問題は特定されませんでした。 |
Warn :チェックで問題が特定されました。 |
Fail :チェックの実行に失敗しました。 |
例
この例では、最適化設定を検出してレポートするカスタム チェックのコールバック関数を作成する方法を説明します。このチェックは 2 つのサブチェックで構成されています。最初のチェックは [ブロック削減] 最適化設定を確認し、2 番目のチェックは [条件付き入力分岐実行] 最適化設定を確認します。
"サブチェックをもつチェック" の結果には以下の項目が含まれています。
全体的なチェックによる確認対象の説明。
サブチェックのタイトル。
サブチェックによる確認対象の説明。
標準への参照 (該当する場合)。
サブチェックのステータス。
ステータスの説明。
サブチェックの結果。
サブチェックがパスしなかった場合に推奨されるアクション。
サブチェックの結果と結果の間のライン。
% 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, supress 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);