Main Content

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

execute

클래스: slmetric.Engine
네임스페이스: slmetric

(삭제 예정) 지표 데이터 수집

Metrics Dashboard 사용자 인터페이스, metricdashboard 기능, slmetric 패키지 API 및 해당 사용자 정의는 향후 릴리스에서 제거될 예정입니다. 자세한 내용은 Migrating from Metrics Dashboard to Model Maintainability Dashboard를 참조하세요.

설명

지정된 메트릭 엔진 개체에 대한 모델 메트릭 데이터를 수집합니다. 모델 메트릭 데이터는 정의된 아키텍처 구성 요소를 기반으로 합니다. 구성요소는 다음 Simulink 객체입니다.

  • 모델

  • 하위 시스템 블록

  • 차트

  • MATLAB 함수 블록

  • 보호된 모델

예제

execute(metric_engine)는 MathWorks 지표 및 사용자 정의 지표를 포함할 수 있는 사용 가능한 모델 지표에 대한 지표 데이터를 수집합니다.

예제

execute(slmetric_obj,MetricIDs)는 MathWorks 지표 또는 사용자 정의 지표일 수 있는 지정된 지표에 대해서만 지표 데이터를 수집합니다.

입력 인수

모두 확장

slmetric.Engine 객체를 생성합니다.

metric_engine = slmetric.Engine();

모델 지표 또는 생성한 사용자 정의 모델 지표에 대한 지표 식별자입니다. 하나 이상의 지표 식별자를 지정할 수 있습니다. slmetric.metric.getAvailableMetrics를 호출하여 메트릭 식별자를 얻을 수 있습니다.

예: 'mathworks.metrics.DescriptiveBlockNames'

예제

모두 확장

sldemo_mdlref_basic 모델에 대한 모델 지표 데이터를 수집하고 액세스합니다.

모델을 엽니다.

openExample('sldemo_mdlref_basic'); 

slmetric.Engine 객체를 생성하고 분석을 위해 모델에 루트를 설정합니다.

metric_engine = slmetric.Engine();

% Include referenced models and libraries in the analysis.
% These properties are on by default.
metric_engine.ModelReferencesSimulationMode = 'AllModes';
metric_engine.AnalyzeLibraries = 1;

setAnalysisRoot(metric_engine, 'Root',  'sldemo_mdlref_basic');

모델 지표 데이터 수집

execute(metric_engine);

slmetric.metric.ResultCollection 객체 배열, res_col를 반환하는 모델 메트릭 데이터를 가져옵니다.

res_col = getMetrics(metric_engine, 'mathworks.metrics.SimulinkBlockCount');

mathworks.metrics.SimulinkBlockCount 메트릭에 대한 결과를 표시합니다.

for n=1:length(res_col)
    if res_col(n).Status == 0
        result = res_col(n).Results;
        
        for m=1:length(result)
            disp(['MetricID: ',result(m).MetricID]);
            disp(['  ComponentPath: ', result(m).ComponentPath]);
            disp(['  Value: ', num2str(result(m).Value)]);
            disp(['  AggregatedValue: ', num2str(result(m).AggregatedValue)]);
        end
    else
        disp(['No results for:', result(n).MetricID]);
    end
    disp(' ');
end

sldemo_mdlref_basic 모델에 대한 모델 지표 데이터를 수집하고 액세스합니다.

모델을 엽니다.

openExample('sldemo_mdlref_basic'); 

slmetric.Engine 객체를 생성합니다. 참조된 모델과 라이브러리를 분석에 포함시키고 분석을 위해 모델에 루트를 설정합니다.

metric_engine = slmetric.Engine();
metric_engine.ModelReferencesSimulationMode = 'AllModes';
metric_engine.AnalyzeLibraries = 1;
setAnalysisRoot(metric_engine, 'Root',  'sldemo_mdlref_basic');

모델 지표 데이터 수집

execute(metric_engine, 'mathworks.metrics.ExplicitIOCount');

slmetric.metric.ResultCollection 객체 배열, res_col를 반환하는 모델 메트릭 데이터를 가져옵니다.

res_col = getMetrics(metric_engine, 'mathworks.metrics.ExplicitIOCount');

mathworks.metrics.ExplicitIOCount 메트릭에 대한 결과를 표시합니다.

for n=1:length(res_col)
    if res_col(n).Status == 0
        result = res_col(n).Results;
        
        for m=1:length(result)
            disp(['MetricID: ',result(m).MetricID]);
            disp(['  ComponentPath: ', result(m).ComponentPath]);
            disp(['  Value: ', num2str(result(m).Value)]);
            disp(['  AggregatedValue: ', num2str(result(m).AggregatedValue)]);
            disp(['  Measures: ', num2str(result(m).Measures)]);
            disp(['  AggregatedMeasures: ', num2str(result(m).AggregatedMeasures)]);
        end
    else
        disp(['No results for:', result(n).MetricID]);
    end
    disp(' ');
end

결과는 다음과 같습니다.

MetricID: mathworks.metrics.ExplicitIOCount
  ComponentPath: sldemo_mdlref_basic
  Value: 3
  AggregatedValue: 4
  Measures: 0  3
  AggregatedMeasures: 3  3
MetricID: mathworks.metrics.ExplicitIOCount
  ComponentPath: sldemo_mdlref_basic/More Info
  Value: 0
  AggregatedValue: 0
  Measures: 0  0
  AggregatedMeasures: 0  0
MetricID: mathworks.metrics.ExplicitIOCount
  ComponentPath: sldemo_mdlref_counter
  Value: 4
  AggregatedValue: 4
  Measures: 3  1
  AggregatedMeasures: 3  1

ComponentPath: sldemo_mdlref_basic의 경우 3 출력이 있으므로 값은 3입니다. 세 개의 출력은 Measures 배열의 두 번째 요소에 있습니다. slmetric.metric.AggregationModeMax이므로 AggregatedValuesldemo_mdlref_counter에 대한 입출력 개수인 4입니다. AggregratedMeasures 배열에는 구성 요소 또는 하위 구성 요소에 대한 최대 입력 및 출력 수가 포함됩니다.

버전 내역

R2016a에 개발됨

모두 확장