Main Content

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

slmetric.Engine 클래스

네임스페이스: slmetric
슈퍼클래스:

(제거 예정) 모델 또는 모델 구성 요소에 대한 지표 데이터 수집

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

설명

slmetric.Engine 개체를 사용하면 execute를 호출하여 모델에 대한 메트릭 데이터를 수집할 수 있습니다. getMetrics를 사용하여 지표 데이터에 액세스하고 slmetric.metric.ResultCollection 개체의 배열을 반환합니다. 이 메트릭 데이터는 시뮬레이션 캐시 폴더에 유지됩니다. 동일한 모델에 대한 slmetric.Engine 개체의 향후 인스턴스화에서는 메트릭 데이터를 재생성하지 않고도 캐시된 메트릭 데이터에 액세스할 수 있습니다.

생성

metric_engine = slmetric.Engine()는 메트릭 엔진 개체를 생성합니다.

속성

모두 확장

slmetric.Engine.setAnalysisRoot 방법으로 지정된 대로 메트릭 데이터를 수집할 루트 모델 또는 하위 시스템의 이름입니다. 이 속성은 읽기 전용입니다.

메트릭 엔진이 루트 아래의 참조 모델 내부 라이브러리를 포함하여 루트 모델의 라이브러리 연결 하위 시스템을 분석하는지 여부를 지정합니다. 메트릭 분석에는 Simulink 내장 라이브러리에 연결된 블록이 포함되지 않습니다. 메트릭 분석에 라이브러리를 포함하지 않으려면 이 매개변수를 false 또는 0로 설정하십시오.

데이터형: logical

메트릭 엔진이 루트 모델의 참조 모델을 분석하는지 지정합니다. 다음 값 중에서 선택하십시오.

설명
'None'메트릭 엔진은 참조 모델에 대한 메트릭 데이터를 수집하지 않습니다.
'NormalModeOnly'메트릭 엔진은 일반 시뮬레이션 모드에서 실행되는 참조 모델에 대해서만 메트릭 데이터를 수집합니다.
'AllModes'메트릭 엔진은 일반 및 가속 시뮬레이션 모드에서 실행되는 참조 모델에 대한 메트릭 데이터를 수집합니다.

데이터형: char

메서드

execute(삭제 예정) 지표 데이터 수집
exportMetrics(제거 예정) 모델 메트릭 내보내기
getAnalysisRootMetric(제거 예정) 분석 루트에 대해서만 하나의 지표에 대한 지표 데이터 가져오기
getErrorLog(제거 예정) 오류 로그 가져오기
getMetricDistribution(제거 예정) 지표 분포 가져오기
getMetricMetaInformation(삭제 예정) 메트릭 메타 정보 얻기
getMetrics(삭제 예정) 모델 메트릭 데이터에 액세스
getStatistics(삭제 예정) 지표 데이터에 대한 통계 가져오기
setAnalysisRoot(제거 예정) 메트릭 분석을 위한 모델 또는 하위 시스템 지정

예제

모두 축소

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, '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에 개발됨

모두 확장

R2022a: Metrics Dashboard이 제거됩니다

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