|
| 1 | +# DEMO: アプリを使用した特徴量調査 |
| 2 | + |
| 3 | +このプログラムでは、デモに使用するデータファイル sampleData.mat を作成します。もともとの1 日当たり 6 秒間の振動信号を連続 50 日間取得したものですが、ここでは計算量軽減のため、1 日当たり 1 秒間、1 日おき 25 日分のデータに削減します。 |
| 4 | + |
| 5 | +# Dataset |
| 6 | + |
| 7 | +20 歯のピニオンギヤで駆動する 2 MW 風力タービン高速シャフトから収集されたデータを使用します[1]。まず、[https://github.com/mathworks/WindTurbineHighSpeedBearingPrognosis-Data](https://github.com/mathworks/WindTurbineHighSpeedBearingPrognosis-Data) からリポジトリ全体を zip ファイルとしてダウンロードして、本スクリプトと同じディレクトリに保存してください。以下のコマンドを使用してファイルを解凍します。こちらのデータでは計測間隔は 1 日間隔です。 |
| 8 | + |
| 9 | +```matlab:Code |
| 10 | +if exist('WindTurbineHighSpeedBearingPrognosis-Data-master.zip', 'file') |
| 11 | + unzip('WindTurbineHighSpeedBearingPrognosis-Data-master.zip') |
| 12 | +end |
| 13 | +``` |
| 14 | + |
| 15 | +# Data Import |
| 16 | + |
| 17 | +まず風力タービンデータに対して fileDatastore を作成します。使用するデータには振動とタコメータの信号が含まれています。各 mat ファイルからcutomreader 関数で読み取りますが、1 秒分の振動データに加えてファイル名から日付情報も合わせて取得します。 |
| 18 | + |
| 19 | +```matlab:Code |
| 20 | +dir = 'WindTurbineHighSpeedBearingPrognosis-Data-master'; |
| 21 | +ds = fileDatastore(fullfile('.', dir,'*.mat'),'ReadFcn',@customreader,'UniformRead',true); |
| 22 | +data = readall(ds) |
| 23 | +``` |
| 24 | + |
| 25 | +| |Date|vibration| |
| 26 | +|:--:|:--:|:--:| |
| 27 | +|1|2013/03/07|97656x1 timetable| |
| 28 | +|2|2013/03/08|97656x1 timetable| |
| 29 | +|3|2013/03/09|97656x1 timetable| |
| 30 | +|4|2013/03/10|97656x1 timetable| |
| 31 | +|5|2013/03/11|97656x1 timetable| |
| 32 | +|6|2013/03/12|97656x1 timetable| |
| 33 | +|7|2013/03/13|97656x1 timetable| |
| 34 | +|8|2013/03/14|97656x1 timetable| |
| 35 | +|9|2013/03/15|97656x1 timetable| |
| 36 | +|10|2013/03/16|97656x1 timetable| |
| 37 | + |
| 38 | +# Data Reduction |
| 39 | + |
| 40 | +ここでは計算量軽減のため、さらに1 日おき 25 日分のデータに削減します。 |
| 41 | + |
| 42 | +```matlab:Code |
| 43 | +sampleData = data; |
| 44 | +sampleData(1:2:end,:) = []; |
| 45 | +``` |
| 46 | + |
| 47 | +さらに前半のデータには faultCode = 0、後半のデータについては faultcode = 1 とラベル付けします。 |
| 48 | + |
| 49 | +```matlab:Code |
| 50 | +sampleData.faultcode = [zeros(13,1); ones(12,1)]; |
| 51 | +save('sampleData.mat','sampleData'); |
| 52 | +``` |
| 53 | + |
| 54 | +任意に変更して、他にもアプリで使用するサンプルデータを作成して試してみてください。 |
| 55 | + |
| 56 | +# References |
| 57 | + |
| 58 | +[1] [<http://data-acoustics.com/measurements/bearing-faults/bearing-3/](http://data-acoustics.com/measurements/bearing-faults/bearing-3/)> Bechhoefer, Eric, Brandon Van Hecke, and David He. "Processing for improved spectral analysis." *Annual Conference of the Prognostics and Health Management Society, New Orleans, LA, Oct*. 2013. |
| 59 | + |
| 60 | +# Helper Function |
| 61 | + |
| 62 | +```matlab:Code |
| 63 | +function data = customreader(filename) |
| 64 | +% Read variables for the fileEnsemble |
| 65 | +% Inputs: |
| 66 | +% filename - a string of the mat file name to read from. |
| 67 | +% Output: |
| 68 | +% data - return a table with a single row |
| 69 | +% Copyright 2018 The MathWorks, Inc. |
| 70 | +
|
| 71 | +data = table; |
| 72 | +% Extract the datetime information from the file names |
| 73 | +[~, fname] = fileparts(filename); |
| 74 | +token = regexp(fname, 'data-(\d+)', 'tokens'); |
| 75 | +data.Date = datetime(token{1}{1}, 'InputFormat', 'yyyyMMdd'); |
| 76 | +
|
| 77 | +% Load the vibration signal from the mat file |
| 78 | +mfile = matfile(filename); % Allows partial loading |
| 79 | +vib = mfile.vibration; |
| 80 | +
|
| 81 | +% Extract the first 1s of signal and convert it to timetable |
| 82 | +fs = 97656; % Sampling rate |
| 83 | +tVibration = timetable(vib(1:fs),'SamplingRate',fs); |
| 84 | +data.vibration = {tVibration}; |
| 85 | +
|
| 86 | +end |
| 87 | +
|
| 88 | +``` |
| 89 | + |
| 90 | +*Copyright 2018 The MathWorks, Inc.* |
0 commit comments