1.1 声明
2.1 实验设置
实验平台如图1所示,由驱动电机、控制器、行星齿轮箱、平行齿轮箱和制动器组成。其中,电机类型是一个3相和3马力,其电源是三相交流电(230V,60/50Hz)。行星齿轮箱的X和Y方向安装了两个单轴加速度计(PCB352C04)来收集振动信号,并使用Y方向的信号。

(a) 1.电机,2.控制器,3.行星齿轮箱,4.平行齿轮箱,5.制动器,6-7.水平和垂直方向的加速度计

图1 XJTUGearbox数据集实验台 (a)实验台; (b)齿轮和轴承的健康状况
2.2 数据文件描述
如图2所示,XJTUGearbox数据集包括9个子文件夹。可以看出,行星齿轮箱的第一级行星轮是轴承故障,行星轮箱的第二级行星轮是齿轮故障。此外,每个子文件夹中包含2个txt文件,其中


2.3 XJTUGearbox试验台的技术资料
XJTUGearbox试验台的技术信息如下图所示,详细信息可以在以下网址了解:https://spectraquest.com/drivetrains/details/dds/

实验平台如图3(a)所示,其由驱动电机、皮带、轴和变速箱组成。其中,电机的型号为交流变频电机,其电源为单相交流(220V,60/50Hz)。12个单轴加速度计(PCB333B32)安装在变速箱上收集振动信号,并使用第一个传感器的信号。实验中,在直齿轮上加工了四种不同程度的裂纹,如图3(b)所示,再加上正常状态,共采集到五种振动信号。模拟了三种不同的转速,即900r/min、1200r/min,以及从0到1200r/min再到0的变转速。此外,在实验过程中,采样频率设置为10kHz。


图3 XJTUSuprgear数据集的测试台 (a)试验装置; (b)直齿轮的健康状况

图4 XJTUSuprgear数据集的内容

图5 详细的传感器安装位置
3.3 XJTUSuprgear实验台技术资料
XJTUSuprgear试验台的技术信息如下所示:

4.1.1 数据读取
## 导入包from matplotlib import pyplot as pltfrom matplotlib import rcParamsimport numpy as npimport pandas as pdimport osconfig = {"font.family": 'serif', # 衬线字体"font.size": 14, # 相当于小四大小"font.serif": ['SimSun'], # 宋体"mathtext.fontset": 'stix', # matplotlib渲染数学字体时使用的字体,和Times New Roman差别不大'axes.unicode_minus': False # 处理负号,即-号}rcParams.update(config)
##========绘制时域信号图========##def plt_time_domain(arr, fs=1600, ylabel='Amp($m/s^2$)', title='原始数据时域图', img_save_path=None, x_vline=None, y_hline=None):""":fun: 绘制时域图模板:param arr: 输入一维数组数据:param fs: 采样频率:param ylabel: y轴标签:param title: 图标题:return: None"""import matplotlib.pyplot as pltplt.rcParams['font.sans-serif'] = ['SimHei'] # 显示中文plt.rcParams['axes.unicode_minus'] = False # 显示负号font = {'family': 'Times New Roman', 'size': '20', 'color': '0.5', 'weight': 'bold'}plt.figure(figsize=(12,4))length = len(arr)t = np.linspace(0, length/fs, length)plt.plot(t, arr, c='g')plt.xlabel('t(s)')plt.ylabel(ylabel)plt.title(title)if x_vline:plt.vlines(x=x_vline, ymin=np.min(arr), ymax=np.max(arr), linestyle='--', colors='r')if y_hline:plt.hlines(y=0.2, xmin=np.min(t), xmax=np.max(t), linestyle=':', colors='y')#===保存图片====#if img_save_path:plt.savefig(img_save_path, dpi=500, bbox_inches = 'tight')plt.show()
##========绘制频域信号图========##def plt_fft_img(arr, fs, ylabel='Amp(mg)', title='频域图', img_save_path=None, vline=None, hline=None, xlim=None):""":fun: 绘制频域图模板:param arr: 输入一维时域数组数据:param fs: 采样频率:param ylabel: y轴标签:param title: 图标题:return: None"""# 计算频域幅值length = len(arr)t = np.linspace(0, length/fs, length)arr = arr - np.mean(arr)fft_result = np.fft.fft(arr)fft_freq= np.fft.fftfreq(len(arr), d=t[1]-t[0]) # FFT频率fft_amp= 2*np.abs(fft_result)/len(t) # FFT幅值# 绘制频域图plt.figure(figsize=(12,4))plt.title(title)plt.plot(fft_freq[0: int(len(t)/2)], fft_amp[0: int(len(t)/2)], label='Frequency Spectrum', color='b')plt.xlabel('频率 (Hz)')plt.ylabel('幅值')plt.legend()if vline:plt.vlines(x=vline, ymin=np.min(fft_amp), ymax=np.max(fft_amp), linestyle='--', colors='r')if hline:plt.hlines(y=hline, xmin=np.min(fft_freq), xmax=np.max(fft_freq), linestyle=':', colors='y')#===保存图片====#if img_save_path:plt.savefig(img_save_path, dpi=500, bbox_inches = 'tight')if xlim: # 图片横坐标是否设置xlimplt.xlim(0, xlim)plt.tight_layout()plt.show()
def plt_stft_img(arr, fs, ylabel='Amp(mg)', title='stft时频域图', img_save_path=None, vline=None, hline=None, xlim=None):""":fun: 绘制stft时频域图模板:param arr: 输入一维时域数组数据:param fs: 采样频率:param ylabel: y轴标签:param title: 图标题:return: None"""import scipy.signal as signalimport numpy as npimport matplotlib.pyplot as pltf, t, nd = signal.stft(arr, fs=fs, window='hann', nperseg=128, noverlap=64,nfft=None,detrend=False, return_onesided=True, boundary='odd', padded=False, axis=-1)# fs:时间序列的采样频率, nperseg:每个段的长度,默认为256(2^n) noverlap:段之间重叠的点数。如果没有则noverlap=nperseg/2#window :字符串或元组或数组,可选需要使用的窗。# #如果window是一个字符串或元组,则传递给它window是数组类型,直接以其为窗,其长度必须是nperseg。# 常用的窗函数有boxcar,triang,hamming, hann等,默认为Hann窗。#nfft :int,可选。如果需要零填充FFT,则为使用FFT的长度。如果为 None,则FFT长度为nperseg。默认为无# detrend :str或function或False,可选# 指定如何去除每个段的趋势。如果类型参数传递给False,则不进行去除趋势。默认为False。# return_onesided :bool,可选# 如果为True,则返回实际数据的单侧频谱。如果 False返回双侧频谱。默认为 True。请注意,对于复杂数据,始终返回双侧频谱。# boundary :str或None,可选# 指定输入信号是否在两端扩展,以及如何生成新值,以使第一个窗口段在第一个输入点上居中。# 这具有当所采用的窗函数从零开始时能够重建第一输入点的益处。# 有效选项是['even', 'odd', 'constant', 'zeros', None].# 默认为‘zeros’,对于补零操作[1, 2, 3, 4]变成[0, 1, 2, 3, 4, 0] 当nperseg=3.# padded:bool,可选# 指定输入信号在末尾是否填充零以使信号精确地拟合为整数个窗口段,以便所有信号都包含在输出中。默认为True。# 填充发生在边界扩展之后,如果边界不是None,则填充为True,默认情况下也是如此。# axis :int,可选# 绘制STFT时频域图plt.figure(figsize=(12,4))plt.pcolormesh(t, f, np.abs(nd), vmin = np.min(np.abs(nd)), vmax = np.max(np.abs(nd)))plt.title(title)plt.xlabel('时间(t)')plt.ylabel('频率 (Hz)')if vline:plt.vlines(x=vline, ymin=np.min(fft_amp), ymax=np.max(fft_amp), linestyle='--', colors='r')if hline:plt.hlines(y=hline, xmin=np.min(fft_freq), xmax=np.max(fft_freq), linestyle=':', colors='y')#===保存图片====#if img_save_path:plt.savefig(img_save_path, dpi=500, bbox_inches = 'tight')if xlim: # 图片横坐标是否设置xlimplt.xlim(0, xlim)plt.tight_layout()plt.show()
def data_read(file_path):""":fun: 读取xls数据:param file_path: 文件路径:return df:"""df = pd.read_csv(file_path, header=None)[12:] # 第17行开始为加速度数据df.columns = ['Acc_data']df = df.astype(float)return dffile_path = r'E:/03-公开数据集/XJTUGearbox-and-XJTUSuprgear-datasets/XJTU_Gearbox/1ndBearing_ball/Data_Chan1.txt'df = data_read(file_path)acc_z_arr= df['Acc_data']df

4.1.2 绘制时域图
fs = 20480 # 采样频率file_name = r'1ndBearing_Ball.txt'##=====绘制时域数据====##time_img_save_path = file_path.replace('.txt', '时域_.png')plt_time_domain(acc_z_arr, fs=fs, title=file_name, img_save_path=time_img_save_path)

4.1.3 绘制频域图
fs = 20480file_name = r'1ndBearing_Ball.txt'##=====绘制频域数据====##fft_img_save_path = file_path.replace('.txt', '频域_.png')plt_fft_img(acc_z_arr, fs=fs, title=file_name, img_save_path=fft_img_save_path)

4.1.3 绘制时频域图
fs = 20480file_name = r'1ndBearing_Ball.txt'##=====绘制STFT时频域数据====##stft_img_save_path = file_path.replace('.txt', '时频域_.png')plt_stft_img(acc_z_arr, fs=fs, img_save_path=stft_img_save_path)

4.2 XJTUSuprgear数据集
4.2.1 数据读取
def data_read(file_path):""":fun: 读取xls数据:param file_path: 文件路径:return df:"""df = pd.read_csv(file_path, header = None)df.columns = ['Column']# 使用 split 方法分割每行的单元格,expand=True 会将分割后的每个元素作为单独的列返回df_split = df['Column'].str.split('\t', expand=True)# 将分割后的所有列转换为 float 类型df_split = df_split.astype(float)# 重置索引,以便将分割后的列与原始 DataFrame 的索引对齐df_split.reset_index(drop=True, inplace=True)return df_splitfile_path = r'E:/03-公开数据集/XJTUGearbox-and-XJTUSuprgear-datasets/XJTU_Spurgear/0-20-0Hz/spurgear10.txt'df = data_read(file_path)acc_z_arr = df.iloc[:,2].valuesdf

4.2.2 绘制时域图
fs = 10000file_name = r'spurgear10.txt'##=====绘制时域数据====##time_img_save_path = file_path.replace('.txt', '时域_.png')plt_time_domain(acc_z_arr, fs=fs, title=file_name, img_save_path=time_img_save_path)

4.2.3 绘制频域图
fs = 10000file_name = r'spurgear10.txt'##=====绘制频域数据====##fft_img_save_path = file_path.replace('.txt', '频域_.png')plt_fft_img(acc_z_arr, fs=fs, title=file_name, img_save_path=fft_img_save_path)

4.2.4 绘制时频域图
fs = 10000file_name = r'spurgear10.txt'##=====绘制STFT时频域数据====##stft_img_save_path = file_path.replace('.txt', '时频域_.png')plt_stft_img(acc_z_arr, fs=fs, img_save_path=stft_img_save_path)

4.2.5 计算转速
from scipy import signaldef tacho2rpm(x, fs, TLeveL=1, Slope=1, PPR=1, NewFs=None, Filter=13):time = len(x)x1 = np.arange(0, time, 1)t = x1 / fsxDiff = np.diff(np.sign(x - TLeveL).flatten())tDiff = t[1:]NewFs = fsif Slope > 0:tTacho = tDiff[np.where(xDiff == 2)]else:tTacho = tDiff[np.where(xDiff == -2)]rpmt = 60 / (PPR * np.diff(tTacho))rpmt = (rpmt[0:-1] + rpmt[1:]) / 2tTacho = tTacho[1:-1]# 平滑处理if Filter > 1:a = 1b = 1 / Filter * np.ones((1, Filter)).flatten()rpmt = signal.filtfilt(b, a, rpmt)else:passt = np.arange(0, t[-1] + 1 / NewFs, 1 / NewFs)rpm = np.interp(t, tTacho, rpmt)return t, rpm
file_path = r'E:/03-公开数据集/XJTUGearbox-and-XJTUSuprgear-datasets/XJTU_Spurgear/0-20-0Hz/spurgear06.txt'df = data_read(file_path)##======获取编码器信号时间======##tacho_arr = df.iloc[:,13].valuesfs = 10000length = len(tacho_arr)t = np.linspace(0, length/fs, length)plt.figure(figsize=[12,3])plt.plot(t, tacho_arr)plt.ylabel('幅值')plt.xlabel('时间(t)')plt.title('编码器信号图')##======将编码器信号计算得到转速信号====##t, rpm = tacho2rpm(tacho_arr, PPR=1, TLeveL=4, fs=fs)plt.figure(figsize=[12,3])plt.plot(t, rpm)plt.ylabel('转速(rpm)')plt.xlabel('时间(t)')plt.title('转速-时间图')plt.show()print('最大转速:', np.max(rpm))


可见将编码器信号转换至转速后,转速最大为1183rpm,与实际1200rpm很接近。
file_path = r'E:/03-公开数据集/XJTUGearbox-and-XJTUSuprgear-datasets/XJTU_Spurgear/15Hz/spurgear00.txt'df = data_read(file_path)##======获取编码器信号时间======##tacho_arr = df.iloc[:,13].valuesfs = 10000length = len(tacho_arr)t = np.linspace(0, length/fs, length)plt.figure(figsize=[12,3])plt.plot(t, tacho_arr)plt.ylabel('幅值')plt.xlabel('时间(t)')plt.title('编码器信号图')##======将编码器信号计算得到转速信号====##t, rpm = tacho2rpm(tacho_arr, PPR=1, TLeveL=4, fs=fs)plt.figure(figsize=[12,3])plt.plot(t, rpm)plt.ylabel('转速(rpm)')plt.xlabel('时间(t)')plt.title('转速-时间图(900rpm)')plt.show()


file_path = r'E:/03-公开数据集/XJTUGearbox-and-XJTUSuprgear-datasets/XJTU_Spurgear/20Hz/spurgear00.txt'df = data_read(file_path)##======获取编码器信号时间======##tacho_arr = df.iloc[:,13].valuesfs = 10000length = len(tacho_arr)t = np.linspace(0, length/fs, length)plt.figure(figsize=[12,3])plt.plot(t, tacho_arr)plt.ylabel('幅值')plt.xlabel('时间(t)')plt.title('编码器信号图')##======将编码器信号计算得到转速信号====##t, rpm = tacho2rpm(tacho_arr, PPR=1, TLeveL=4, fs=fs)plt.figure(figsize=[12,3])plt.plot(t, rpm)plt.ylabel('转速(rpm)')plt.xlabel('时间(t)')plt.title('转速-时间图(1200rpm)')plt.show()


编辑:李正平
校核:陈凯歌、赵栓栓、董浩杰、曹希铭、赵学功、白亮、陈少华
该文资料搜集自网络,仅用作学术分享,不做商业用途,若侵权,后台联系小编进行删除