wangEditor在Vue项目中的高级用法:动态修改工具栏配置与实时内容监听

核心内容摘要

【含文档+PPT+源码】基于微信小程序的房屋租赁系统
中文NLP综合分析系统(RexUniNLU)保姆级教程:Gradio界面汉化与定制

【RTD MCAL 实战】K312 MCU时钟配置:从Option B方案到CLKOUT验证全解析

✨ 本团队擅长数据搜集与处理、建模仿真、程序设计、仿真代码、论文写作与指导毕业论文、期刊论文经验交流。

✅ 专业定制毕设、代码✅ 成品或定制查看文章底部微信二维码(

基于支路电流的永磁同步电机多故障特征增强与提取方法永磁同步电机在长期运行过程中转子永磁体可能因高温退磁、不可逆退磁或局部损坏而发生退磁故障转子与定子之间的气隙不均匀分布则会导致偏心故障。

这两类故障都会改变电机的磁场分布特性进而在定子绕组中感应出异常的电流分量。

传统的故障诊断方法通常采用三相定子电流作为分析对象但由于三相电流是多个绕组电流合成的结果部分故障特征在合成过程中相互抵消或被掩盖导致故障信号的信噪比较低。

本研究提出采用定子绕组的支路电流作为故障诊断的数据源相比于三相合成电流支路电流能够更直接地反映各绑组与转子磁场相互作用的局部特征故障信息含量更加丰富。

在特征提取环节设计了一种双模态特征提取框架综合利用时域和频域两个维度的信息实现故障特征的互补增强。

首先采用变分模态分解算法对支路电流信号进行自适应分解将原始信号分离为若干个具有不同中心频率的本征模态分量每个分量对应特定频段内的振动特征。

然后对各模态分量分别进行快速傅里叶变换获取其频域表示提取与退磁故障和偏心故障相关的特征频率成分的幅值。

将时域统计特征和频域特征频率幅值进行拼接构成完整的故障特征向量输入后续的分类识别模型。

这种双模态特征融合策略能够同时捕捉故障信号的瞬态特性和周期性特性显著提高了不同故障类型之间的可分辨度。

(

基于级联卷积神经网络的电机多故障智能诊断模型针对传统机器学习方法在处理高维复杂特征时泛化能力不足的问题本研究设计了一种集成多尺度卷积层、扩张卷积层和通道注意力机制的级联卷积神经网络用于电机多故障分类识别。

网络的第一阶段采用多尺度并行卷积结构通过不同尺寸的卷积核同时提取输入特征在不同空间尺度上的局部模式小尺寸卷积核捕捉细粒度的高频特征大尺寸卷积核获取粗粒度的低频特征两者并行处理后进行特征融合。

网络的第二阶段引入扩张卷积模块扩张卷积通过在标准卷积核中插入间隔采样点来扩大感受野范围在不增加参数量的情况下使网络能够捕捉更大范围的上下文信息对于周期性故障特征的识别尤为有效。

在特征图的通道维度上嵌入注意力机制模块自适应地学习各通道特征的重要性权重增强包含关键故障信息的通道响应抑制与故障判别无关的冗余通道。

多个卷积模块级联堆叠形成深层网络结构通过残差连接缓解梯度消失问题并保留浅层特征的有效信息。

最终的全连接层将高级语义特征映射到故障类别空间输出各故障类型的概率分布。

在包含局部退磁故障、动态偏心故障和正常状态的多分类数据集上进行实验验证所提出的诊断模型在测试集上达到了较高的分类准确率且不同故障类型的特征在高维空间中呈现良好的聚类分离性。

(

基于生成对抗网络的退磁故障磁极定位方法准确定位发生退磁的具体磁极位置对于制定针对性的维修策略和评估电机剩余使用寿命具有重要意义。

然而在实际工业应用中电机内部的支路电流往往难以直接测量而外部可获取的三相电流信息又不足以精确区分不同磁极的退磁状态。

针对这一矛盾本研究提出一种基于生成对抗网络的故障定位方法利用相对容易获取的三相电流数据生成高保真的支路电流信号进而通过支路电流特征实现退磁磁极的精确定位。

首先采用电磁场有限元仿真软件建立永磁同步电机的精细化模型分别模拟各个磁极发生退磁故障时的支路电流响应构建覆盖所有可能故障位置的退磁故障样本库。

然后设计生成对抗网络的网络结构生成器以三相电流时序数据为输入通过多层卷积和反卷积操作生成对应的支路电流波形判别器则负责区分生成的支路电流与真实支路电流之间的差异。

在对抗训练过程中生成器不断优化其参数以生成越来越逼真的支路电流使判别器难以分辨真伪。

训练完成后将实际测量的三相电流输入生成器得到预测的支路电流波形。

最后计算生成的支路电流与故障样本库中各磁极退磁状态支路电流之间的皮尔逊相关系数相关系数最高的磁极即为最可能发生退磁的故障位置。

import numpy as np import torch import torch.nn as nn import torch.optim as optim from scipy.signal import hilbert from scipy.fft import fft, fftfreq from sklearn.metrics import accuracy_score, confusion_matrix class VMDFeatureExtractor: def __init__(self, K5, alpha

: self.K K self.alpha alpha def vmd_decompose(self, signal, tau0, tol1e-7, max_iter

: N len(signal) freqs fftfreq(N) f_hat np.fft.fft(signal) u_hat np.zeros((self.K, N), dtypecomplex) omega np.linspace(0,

5, self.K) lambda_hat np.zeros(N, dtypecomplex) for _ in range(max_iter): u_hat_old u_hat.copy() for k in range(self.K): sum_uk np.sum(u_hat, axis

- u_hat[k] numerator f_hat - sum_uk lambda_hat / 2 denominator 1 2 * self.alpha * (freqs - omega[k])**2 u_hat[k] numerator / denominator if np.sum(np.abs(u_hat[k])**

0: omega[k] np.sum(freqs * np.abs(u_hat[k])**

/ np.sum(np.abs(u_hat[k])**

lambda_hat lambda_hat tau * (f_hat - np.sum(u_hat, axis

) if np.sum(np.abs(u_hat - u_hat_old)**

/ (np.sum(np.abs(u_hat_old)**

1e-

tol: break return np.real(np.fft.ifft(u_hat, axis

) def extract_time_features(self, modes): features [] for mode in modes: features.extend([ np.mean(mode), np.std(mode), np.max(mode), np.min(mode), np.sqrt(np.mean(mode**

), np.mean(mode**

/ (np.std(mode)**3 1e-

, np.mean(mode**

/ (np.std(mode)**4 1e-

]) return np.array(features) def extract_freq_features(self, modes, fs): features [] for mode in modes: spectrum np.abs(fft(mode))[:len(mode)//2] freqs fftfreq(len(mode), 1/fs)[:len(mode)//2] features.extend([ np.max(spectrum), freqs[np.argmax(spectrum)], np.sum(spectrum * freqs) / (np.sum(spectrum) 1e-

, np.sqrt(np.sum(spectrum**2 * (freqs - np.mean(freqs))**

/ (np.sum(spectrum**

1e-

) ]) return np.array(features) def extract_dual_modal_features(self, signal, fs): modes self.vmd_decompose(signal) time_features self.extract_time_features(modes) freq_features self.extract_freq_features(modes, fs) return np.concatenate([time_features, freq_features]) class MultiScaleConvBlock(nn.Module): def __init__(self, in_channels, out_channels): super(MultiScaleConvBlock, self).__init__() self.conv1 nn.Conv1d(in_channels, out_channels // 3, 3, padding

self.conv2 nn.Conv1d(in_channels, out_channels // 3, 5, padding

self.conv3 nn.Conv1d(in_channels, out_channels - 2*(out_channels//

, 7, padding

self.bn nn.BatchNorm1d(out_channels) self.relu nn.ReLU() def forward(self, x): out1 self.conv1(x) out2 self.conv2(x) out3 self.conv3(x) return self.relu(self.bn(torch.cat([out1, out2, out3], dim

)) class DilatedConvBlock(nn.Module): def __init__(self, channels, dilation): super(DilatedConvBlock, self).__init__() self.conv nn.Conv1d(channels, channels, 3, paddingdilation, dilationdilation) self.bn nn.BatchNorm1d(channels) self.relu nn.ReLU() def forward(self, x): return self.relu(self.bn(self.conv(x))) x class ChannelAttention(nn.Module): def __init__(self, channels, reduction

: super(ChannelAttention, self).__init__() self.avg_pool nn.AdaptiveAvgPool1d(

self.fc nn.Sequential( nn.Linear(channels, channels // reduction), nn.ReLU(), nn.Linear(channels // reduction, channels), nn.Sigmoid() ) def forward(self, x): b, c, _ x.size() y self.avg_pool(x).view(b, c) y self.fc(y).view(b, c,

return x * y class CascadedCNN(nn.Module): def __init__(self, input_length, num_classes): super(CascadedCNN, self).__init__() self.ms_conv1 MultiScaleConvBlock(1,

self.attention1 ChannelAttention(

self.pool1 nn.MaxPool1d(

self.dilated1 DilatedConvBlock(64,

self.dilated2 DilatedConvBlock(64,

self.ms_conv2 MultiScaleConvBlock(64,

self.attention2 ChannelAttention(

self.pool2 nn.MaxPool1d(

self.global_pool nn.AdaptiveAvgPool1d(

self.fc nn.Sequential( nn.Linear(128,

, nn.ReLU(), nn.Dropout(

0.

, nn.Linear(64, num_classes) ) def forward(self, x): if x.dim() 2: x x.unsqueeze(

x self.ms_conv1(x) x self.attention1(x) x self.pool1(x) x self.dilated1(x) x self.dilated2(x) x self.ms_conv2(x) x self.attention2(x) x self.pool2(x) x self.global_pool(x).squeeze(-

return self.fc(x) class BranchCurrentGenerator(nn.Module): def __init__(self, input_channels3, output_channels6, seq_length

: super(BranchCurrentGenerator, self).__init__() self.encoder nn.Sequential( nn.Conv1d(input_channels, 64, 7, 2,

, nn.BatchNorm1d(

, nn.LeakyReLU(

0.

, nn.Conv1d(64, 128, 5, 2,

, nn.BatchNorm1d(

, nn.LeakyReLU(

0.

, nn.Conv1d(128, 256, 3, 2,

, nn.BatchNorm1d(

, nn.LeakyReLU(

0.

) self.decoder nn.Sequential( nn.ConvTranspose1d(256, 128, 4, 2,

, nn.BatchNorm1d(

, nn.ReLU(), nn.ConvTranspose1d(128, 64, 4, 2,

, nn.BatchNorm1d(

, nn.ReLU(), nn.ConvTranspose1d(64, output_channels, 4, 2,

, nn.Tanh() ) def forward(self, x): encoded self.encoder(x) decoded self.decoder(encoded) return decoded class BranchCurrentDiscriminator(nn.Module): def __init__(self, input_channels

: super(BranchCurrentDiscriminator, self).__init__() self.model nn.Sequential( nn.Conv1d(input_channels, 64, 4, 2,

, nn.LeakyReLU(

0.

, nn.Conv1d(64, 128, 4, 2,

, nn.BatchNorm1d(

, nn.LeakyReLU(

0.

, nn.Conv1d(128, 256, 4, 2,

, nn.BatchNorm1d(

, nn.LeakyReLU(

0.

, nn.AdaptiveAvgPool1d(

, nn.Flatten(), nn.Linear(256,

, nn.Sigmoid() ) def forward(self, x): return self.model(x) class DemagnetizationFaultLocator: def __init__(self, num_poles

: self.num_poles num_poles self.fault_database {} self.generator BranchCurrentGenerator() self.discriminator BranchCurrentDiscriminator() def build_fault_database(self, simulation_data): for pole_idx in range(self.num_poles): self.fault_database[pole_idx] simulation_data[pole_idx] def train_gan(self, three_phase_data, branch_current_data, epochs200, lr

0.

: optimizer_g optim.Adam(self.generator.parameters(), lrlr, betas(

5,

0.

) optimizer_d optim.Adam(self.discriminator.parameters(), lrlr, betas(

5,

0.

) criterion nn.BCELoss() for epoch in range(epochs): real_labels torch.ones(three_phase_data.size(

,

fake_labels torch.zeros(three_phase_data.size(

,

optimizer_d.zero_grad() real_output self.discriminator(branch_current_data) real_loss criterion(real_output, real_labels) fake_branch self.generator(three_phase_data) fake_output self.discriminator(fake_branch.detach()) fake_loss criterion(fake_output, fake_labels) d_loss real_loss fake_loss d_loss.backward() optimizer_d.step() optimizer_g.zero_grad() fake_branch self.generator(three_phase_data) fake_output self.discriminator(fake_branch) g_loss criterion(fake_output, real_labels) g_loss.backward() optimizer_g.step() def generate_branch_current(self, three_phase_current): self.generator.eval() with torch.no_grad(): generated self.generator(three_phase_current) return generated def compute_pearson_correlation(self, signal1, signal

: mean1, mean2 np.mean(signal

, np.mean(signal

std1, std2 np.std(signal

, np.std(signal

if std1 1e-10 or std2 1e-10: return 0 return np.mean((signal1 - mean

* (signal2 - mean

) / (std1 * std

def locate_faulty_pole(self, generated_branch_current): correlations {} generated_np generated_branch_current.numpy().flatten() for pole_idx, reference_current in self.fault_database.items(): reference_np reference_current.flatten() min_len min(len(generated_np), len(reference_np)) corr self.compute_pearson_correlation(generated_np[:min_len], reference_np[:min_len]) correlations[pole_idx] corr faulty_pole max(correlations, keycorrelations.get) return faulty_pole, correlations class PMSMFaultDiagnosisSystem: def __init__(self, num_poles8, num_classes

: self.feature_extractor VMDFeatureExtractor() self.classifier CascadedCNN(1024, num_classes) self.fault_locator DemagnetizationFaultLocator(num_poles) def diagnose_fault_type(self, branch_current, fs

: features self.feature_extractor.extract_dual_modal_features(branch_current, fs) features_tensor torch.FloatTensor(features).unsqueeze(

self.classifier.eval() with torch.no_grad(): output self.classifier(features_tensor) pred torch.argmax(output, dim

.item() fault_types [normal, demagnetization, eccentricity] return fault_types[pred] def locate_demagnetization(self, three_phase_current): three_phase_tensor torch.FloatTensor(three_phase_current).unsqueeze(

generated_branch self.fault_locator.generate_branch_current(three_phase_tensor) faulty_pole, correlations self.fault_locator.locate_faulty_pole(generated_branch[0]) return faulty_pole, correlations具体问题可以直接沟通

樱花论坛python-樱花论坛应用

百度百家号客服电话人工服务

123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123