Equipment real-time fault diagnosis method based on FPGA and SNN
By combining FPGA and SNN in industrial fault diagnosis, the SNN diagnosis model with attention mechanism is established and deployed, which solves the shortcomings of traditional methods in model establishment and real-time performance, and achieves efficient and low-latency real-time fault diagnosis.
Patent Information
- Application Number
- CN202510322850.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-06-27
Smart Images

Figure CN120213431A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of mechanical equipment monitoring and intelligent diagnosis, and particularly relates to a real-time fault diagnosis method for equipment based on FPGA and SNN. Background Art
[0002] Industrial data fault diagnosis detects faults by collecting vibration signals of equipment. Traditional methods based on mathematical and physical models rely on in-depth understanding of mechanical systems and complex mathematical derivations. Traditional methods face many challenges in practical applications, such as difficult model establishment, poor adaptability, and poor sensitivity to environmental changes. In recent years, data-driven artificial neural network (ANN) and convolutional neural network (CNN) methods have made remarkable progress in industrial fault diagnosis. These methods learn features from a large amount of vibration signal data and achieve high-accuracy fault detection and classification.
[0003] However, in actual industrial deployments, such solutions face two major bottlenecks: computing power constraints and edge latency paradox. On the one hand, industrial field devices are usually limited by the limited resources of edge computing nodes and are difficult to carry deep networks with a large number of parameters. On the other hand, diagnostic methods often sacrifice real-time performance while achieving high accuracy. There is a high delay in the data transmission and processing process, and it is difficult to play a role in application scenarios with high real-time requirements.
[0004] Therefore, there is an urgent need to construct a new vibration diagnosis paradigm that integrates the advantages of edge computing to achieve high-precision, low-latency, and adaptive real-time fault diagnosis under limited resource constraints. Summary of the Invention
[0005] In view of this, the present invention discloses a real-time fault diagnosis method for equipment based on FPGA (Field Programmable Gate Array) and SNN (Spiking Neural Network) to solve the above problems.
[0006] A real-time fault diagnosis method for equipment based on FPGA and SNN includes:
[0007] S1. Obtain the original vibration signal on the mechanical equipment and construct a local training set according to the original vibration signal;
[0008] S2. Based on the fast Fourier transform and spiking neurons, establish an SNN diagnosis model based on the attention mechanism, and use the local training set to train the SNN diagnosis model based on the attention mechanism to obtain a trained SNN model;
[0009] S3. Convert the SNN model into a hardware description language and deploy the SNN model to the FPGA side;
[0010] S4. Construct a real-time mechanical vibration signal acquisition system based on FPGA;
[0011] S5. The real-time mechanical vibration signal acquisition system obtains the real-time vibration data of the mechanical equipment and performs cross-point sliding window preprocessing on the real-time vibration data;
[0012] S6. The SNN model deployed to the FPGA side infers the preprocessed data to obtain the real-time fault diagnosis result of the mechanical equipment.
[0013] The beneficial effects of the present invention include: by adopting the SNN diagnosis model based on the attention mechanism to simulate the pulse generation mechanism of biological neurons, a more efficient event-driven computing method is realized, significantly reducing the computing resources and energy consumption; by adopting the field-programmable gate array customized hardware architecture to optimize the data path and computing process, the computing efficiency and real-time processing ability of the deep neural network are improved; by combining the SNN model with the FPGA, low-power and high-efficiency computing is realized, meeting the strict requirements for real-time performance and low latency in industrial applications, and further ensuring the efficient operation and long service life of the equipment. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 is a schematic flowchart of the method for real-time fault diagnosis of equipment based on FPGA and SNN in the present invention;
[0015] Figure 2 is a schematic structural diagram of the SNN diagnosis model based on the attention mechanism in the present invention;
[0016] Figure 3 is a schematic structural diagram of the real-time mechanical vibration signal acquisition system based on FPGA in the present invention;
[0017] Figure 4 is a schematic diagram of the pipeline processing architecture in the fault diagnosis process of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0018] In order to make the purpose, technical solutions, features and advantages of the present invention clearer and more understandable, the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0019] A method for real-time fault diagnosis of equipment based on FPGA and SNN, the flowchart of the method is as Figure 1 shown, including:
[0020] S1. Obtain the original vibration signal on the mechanical equipment and construct a local training set according to the original vibration signal.
[0021] Specifically, the original vibration signal is acquired at a sampling rate of 20 kHz by an IEPE acceleration sensor installed on mechanical equipment.
[0022] S2. Based on the fast Fourier transform and pulse neurons, an SNN diagnosis model based on the attention mechanism is established, and the SNN diagnosis model based on the attention mechanism is trained using a local training set to obtain a trained SNN model.
[0023] Specifically, the structural diagram of the SNN diagnosis model based on the attention mechanism is as Figure 2 shown, including, connected in sequence: a fast Fourier transform module, a fully connected layer, an improved attention mechanism module, a branch fusion module, a first fully connected - leaky integrate - and - fire layer, and a second fully connected - leaky integrate - and - fire layer.
[0024] Furthermore, the processing of the input data by the SNN diagnosis model based on the attention mechanism includes: inputting the input data into the SNN diagnosis model based on the attention mechanism, and the above - mentioned modules perform four repeated propagations on the input data to respectively obtain four main - path prediction pulse sequences and four auxiliary - path prediction pulse sequences; performing a sliding - average fusion on all the main - path prediction pulse sequences and auxiliary - path prediction pulse sequences to obtain the output of the SNN diagnosis model based on the attention mechanism.
[0025] Furthermore, the improved attention mechanism module includes, connected in sequence: a first fully connected layer, a Relu activation function layer, a second fully connected layer, a sigmod activation function layer, a feature recalibration module, and a leaky integrate - and - fire layer. Among them, the fully connected layer is used to map the input features to a low - dimensional feature space; the ReLU activation function and the Sigmoid activation function are used to generate attention weights; the feature recalibration module is used to multiply the attention weights generated by the sigmod activation function element - by - element with the input of the improved attention mechanism module to obtain a complementary dual mask.
[0026] Furthermore, the formula for the activation function module to process data is:
[0027]
[0028] where x represents the input of the improved attention mechanism module, represents the attention weight, W1 and W2 respectively represent the first and second fully connected layers, σ represents the Sigmoid activation function, and δ represents the Relu activation function.
[0029] Furthermore, the formula for the feature recalibration module to generate the forward feature weight and the reverse feature weight is:
[0030]
[0031] Among them, m p represents the output of the main path of the feature recalibration module, and m s represents the output of the auxiliary path of the feature recalibration module. represents the attention weight. After the output of the main path and the output of the auxiliary path are respectively processed by the leaky integrate-and-fire layer, the forward feature weight and the reverse feature weight are obtained. The forward feature weight and the reverse feature weight are used to further combine with subsequent levels for more in-depth feature extraction and information fusion.
[0032] Furthermore, in the leaky integrate-and-fire layer, the membrane potential V(t) of the neuron at each time step is updated according to the input current I(t) and the membrane potential V(t - 1) of the previous time step. The update equation of the membrane potential is as follows:
[0033] V(t) = βV(t - 1) + I(t) - R(t)
[0034] Among them, β is the leakage factor; R(t) is the reset term, which represents the membrane potential reset operation of the neuron after emitting a pulse. When the membrane potential V(t) exceeds the preset threshold θ, the neuron emits a pulse S(t) and triggers the reset of the membrane potential. The pulse emission function uses the Heaviside step function H(x):
[0035] S(t) = H(V(t) - θ)
[0036]
[0037] Furthermore, after the neuron emits a pulse, the membrane potential is reset according to the following equation:
[0038] R(t) = βS(t)θ
[0039] Among them, the reset term R(t) is proportional to the pulse S(t) and the threshold θ respectively, and is used to ensure that the membrane potential of the neuron decreases appropriately after emitting a pulse, so as to facilitate the emission of the next pulse.
[0040] Furthermore, since the Heaviside function is not differentiable at V(t) = θ, the present invention adopts an approximate gradient method, using the derivative of the arctangent function as the gradient approximation of the Heaviside function:
[0041]
[0042] Furthermore, the branch fusion module is used to perform weighted summation on the forward feature weight and the reverse feature weight, and the calculation formula is:
[0043]
[0044] Furthermore, the formula for sliding average fusion of all main path prediction pulse sequences and auxiliary path prediction pulse sequences is as follows:
[0045]
[0046] where λ t represents the weight of the predefined time step t, and Spk3 (t) represents the main path prediction pulse sequence, represents the auxiliary path prediction pulse sequence.
[0047] Furthermore, the network configuration is initialized using the Adam optimization algorithm. The initial learning rate of the Adam algorithm is set in the range of 0.001 - 0.01, and a stepped learning rate scheduler is configured to decay the learning rate to 10% of the current value every 10 training epochs. The initialization range of the decay coefficient beta of the neuron membrane potential is 0.5 - 0.9, and the initial value of the first-layer neurons in this embodiment is 0.7.
[0048] Furthermore, a spatio-temporal joint training mechanism is adopted for training, and the training includes a forward propagation stage and a loss calculation stage. Forward propagation stage: The input data stream is divided into 5 - 20 consecutive time steps, and within each time step, the following operations are performed: The input data is converted into a pulse sequence through Poisson encoding, the pulse signal propagates spatio-temporally between layers according to the synaptic weights, and the neurons in each layer update their states according to the membrane potential differential equation; The SNN diagnostic model based on the attention mechanism calculates the loss function using the mean square error, and the formula is as follows:
[0049]
[0050] where S p and S s respectively represent the main path pulse sequence and the auxiliary path pulse sequence in the SNN diagnostic model based on the attention mechanism, y true represents the true target sequence in the local training set, The calculation formula of
[0051]
[0052] where α represents the predefined weight coefficient, represents the output pulse encoding where the model prediction type matches the target at time step t, represents the pulse encoding where the model prediction type does not match the target at time step t, t target represents the target output value corresponding to the target pulse encoding at time step t, usually the true label during network training, represents the square of the L2 norm.
[0053] S3. Convert the SNN model into a hardware description language and deploy the SNN model to the FPGA side, including:
[0054] S31. Decompose each layer module of the SNN model into C++ sub-modules, and use High-Level Synthesis (HLS) instructions to convert the C++ sub-modules into parallel processing units.
[0055] Specifically, use high-level programming languages (C, C++) to describe the forward propagation process of the SNN model and import the weight parameters of the trained SNN model. Implement model compression using a dynamic fixed-point quantization strategy, and implement synaptic operation acceleration using 16-way loop-block parallelization.
[0056] S32. Apply optimization instructions, such as pipelining, loop unrolling, and data parallelism, to the parallel processing units to improve the running efficiency of the network model on the FPGA side.
[0057] S33. Use the Xilinx Vivado HLS tool to convert the HLS description into RTL (Register Transfer Level) code.
[0058] S34. Use the Xilinx Vivado tool to implement, place, and route the RTL code to generate a configuration file that can run on the FPGA side.
[0059] S35. Perform functional verification and performance testing on the trained model on the FPGA hardware.
[0060] Specifically, the functional verification and performance testing include: pulse sequence timing test, comparing the pulse sequence values output by the model on the FPGA hardware with the model simulation results for timing alignment to observe whether the values are consistent; single-batch data processing delay test, testing whether the time from input loading to pulse output completion of 2048 sample data is less than 1 ms at a main frequency of 100 MHz, i.e., T total = T FFT + T SNN < 1 ms; power consumption test, testing whether the peak power consumption for processing a batch of data is less than or equal to 3.2 W, and whether the processing capacity corresponding to the energy efficiency ratio per watt of power consumption is greater than or equal to 45 billion operations per second.
[0061] S4. Build a real-time mechanical vibration signal acquisition system based on the FPGA.
[0062] Such as Figure 3The figure shows a schematic diagram of a real-time mechanical vibration signal acquisition system based on FPGA. The system includes: a four-channel vibration sensor drive unit, a signal conditioning unit, an analog-to-digital conversion unit, an FPGA processing unit, a power interface, and a debugging interface. An SNN model is deployed in the FPGA processing unit.
[0063] Furthermore, the internal circuit of the real-time mechanical vibration signal acquisition system based on FPGA is used to implement the acquisition of vibration signals, including a vibration sensor drive circuit, a filtering circuit, a single-ended to differential circuit, an analog-to-digital converter peripheral circuit, a power circuit, and a processor circuit. The vibration sensor drive circuit is used to convert physical vibration signals into electrical signals; the filtering circuit is used to perform anti-aliasing filtering on the electrical signals; the single-ended to differential circuit is used to convert single-ended signals into differential signals to meet the input requirements of the analog-to-digital converter; the analog-to-digital converter peripheral circuit is used to convert the amplified signals from the single-ended to differential circuit into digital signals; the power circuit and the processor circuit are used to provide a stable operating voltage for the system.
[0064] Specifically, eight-channel mechanical vibration signals are acquired through the analog-to-digital converter in the high-precision multi-channel synchronous data acquisition circuit; the eight-channel data acquired are transmitted to the DDR (Double Data Rate Synchronous Dynamic Random Access Memory) memory at the processing system end through the FIFO (First In First Out) buffer by using the FPGA driver program for temporary storage.
[0065] S5. The real-time mechanical vibration signal acquisition system obtains the real-time vibration data of the mechanical equipment and performs cross-point sliding window preprocessing on the real-time vibration data.
[0066] Furthermore, the cross-point sliding window preprocessing includes: obtaining the original vibration signal, dividing overlapping sub-windows, with 50% overlap between adjacent windows when dividing the overlapping sub-windows; using a linearly decreasing weighting function to perform weighted fusion on the data in the overlapping area; the formula is:
[0067] x fse [n] = w[n]·x prev [n] + (1 - w[n])·x curr [n], n ∈ [1, 1024]
[0068] where n represents the vibration signal, x fuse [n] represents the data point after sliding window processing, w[n] represents the linearly decreasing weight, x prev [n] represents the data of the previous window, x curr [n] represents the data of the current window; the total time T for single-window preprocessingfuse <1 ms.
[0069] Specifically, when N = 8192 original vibration data points are accumulated in the DDR, 3 windows are generated with a sliding step of 1024, and a 50% overlap rate is set for each window. Weight fusion is performed on the 1024-point overlapping area of each window. After processing, the processed window data is pushed to the FFT (Fast Fourier Transform) at the PL (Programmable Logic) end through the HP0 port. When the PL end processes the Nth window, the PS (Processing System) end processes the sliding window block division and fusion of the (N + 1)th window in parallel.
[0070] S6. The SNN model deployed to the FPGA end performs inference on the preprocessed data to obtain the real-time fault diagnosis result of the mechanical equipment.
[0071] Furthermore, as Figure 4 shown in the real-time diagnostic pipeline processing architecture of the vibration signal, the IEPE acceleration sensor is connected through the sensor interface, and the vibration signal is acquired at a sampling rate of fs ≥ 20 kHz. Each time 4096 points (80 ms) are collected, a transmission is triggered, and the original data is written into the circular buffer of the DDR. When the buffer of the double buffer pool in the DDR is half full, a processing interrupt is triggered at the PS end. The PS performs sliding window, normalization, and quantization preprocessing. After the processing is completed, it is sent to the FFT and SNN algorithm circuits solidified at the PL end for real-time inference. Based on the inference result of the SNN model, it is determined in real time whether the vibration data conforms to the preset fault mode, that is, the diagnostic result of the mechanical vibration signal is obtained.
[0072] Finally, it should be noted that the above only describes some embodiments of the present invention. For those skilled in the art, various changes, modifications, substitutions, and variations can be conceived without departing from the principle and spirit of the present invention. The protection scope of the present invention is defined by the appended claims and their equivalents, and the above actions should all be covered within the protection scope of the present invention.
Claims
1. A real-time fault diagnosis method for equipment based on FPGA and SNN, characterized in that: include: S1. Obtain the original vibration signal on the mechanical equipment and construct a local training set based on the original vibration signal; S2. Based on fast Fourier transform and pulse neurons, an SNN diagnosis model based on attention mechanism is established, and the SNN diagnosis model based on attention mechanism is trained using a local training set to obtain a trained SNN model; S3, convert the SNN model into hardware description language, and deploy the SNN model to the FPGA end; S4. Build a real-time acquisition system of mechanical vibration signals based on FPGA; S5. The real-time collection system of mechanical vibration signals obtains the real-time vibration data of the mechanical equipment and performs cross-point sliding window preprocessing on the real-time vibration data; S6. The SNN model deployed on the FPGA side infers the preprocessed data to obtain real-time fault diagnosis results of the mechanical equipment.
2. The real-time fault diagnosis method for equipment based on FPGA and SNN according to claim 1 is characterized in that: The SNN diagnosis model based on the attention mechanism includes: a fast Fourier transform module, a fully connected layer, an improved attention mechanism module, a branch fusion module, a first fully connected-leakage integral issuance layer, and a second fully connected-leakage integral issuance layer connected in sequence; The SNN diagnosis model based on the attention mechanism processes the input data, including: inputting the input data into the SNN diagnosis model based on the attention mechanism, the module performs four repeated propagations on the input data, and obtains four main path prediction pulse sequences and four auxiliary path prediction pulse sequences respectively; The sliding average fusion of all main path prediction pulse sequences and auxiliary path prediction pulse sequences is performed to obtain the output of the SNN diagnosis model based on the attention mechanism.
3. The real-time fault diagnosis method for equipment based on FPGA and SNN according to claim 2 is characterized in that: The improved attention mechanism module includes the following connected in sequence: a first fully connected layer, a Relu activation function layer, a second fully connected layer, a sigmod activation function layer, a feature recalibration module, and a leakage integral issuance layer; the improved attention mechanism module outputs a positive feature weight and a negative feature weight.
4. The real-time fault diagnosis method for equipment based on FPGA and SNN according to claim 3 is characterized in that: The feature recalibration module is used to multiply the attention weight generated by the sigmoid activation function by the input of the improved attention mechanism module element by element to obtain a complementary double mask; the formula for generating the forward feature weight and the reverse feature weight by the feature recalibration module is: Where x represents the input of the improved attention mechanism module, W1 represents the first fully connected layer, δ represents the Relu activation function, W2 represents the second fully connected layer, σ represents the sigmoid activation function, represents the attention weight generated by the sigmoid activation function layer, m p represents the main path output of the feature recalibration module, m s It represents the auxiliary path output of the feature recalibration module. The two outputs of the feature recalibration module are processed by the leakage integral issuance layer to obtain the forward feature weight and the reverse feature weight.
5. The real-time fault diagnosis method for equipment based on FPGA and SNN according to claim 2 is characterized in that: The formula for sliding average fusion of all main path prediction pulse sequences and auxiliary path prediction pulse sequences is: Among them, λ t represents the weight of a predefined time step t, Spk3 (t) represents the main path prediction pulse sequence, represents the auxiliary path prediction pulse sequence.
6. The real-time fault diagnosis method for equipment based on FPGA and SNN according to claim 2 is characterized in that: The mean square error is used to calculate the loss function for the SNN diagnosis model training based on the attention mechanism. The formula is: Among them, S p and S s represents the output sequence of the second fully connected-leaky scoring layer, y true represents the true target sequence in the local training set, The calculation formula is: Among them, α represents the predefined weight coefficient, represents the output pulse code whose model prediction type matches the target at time step t, Indicates that at time step t, the model predicts a pulse code whose type does not match the target, t target represents the target output value corresponding to the target pulse code at time step t, Represents the square of the L2 norm.
7. The real-time fault diagnosis method for equipment based on FPGA and SNN according to claim 1 is characterized in that Convert the SNN model into a hardware description language and deploy the SNN model to the FPGA, including: S31, disassemble each layer module of the SNN model into C++ sub-modules, and use HLS instructions to convert the C++ sub-modules into parallel processing units; S32, applying optimization instructions, pipeline, loop unrolling and data parallelism to the parallel processing unit to improve the operation efficiency of the network model on the FPGA side; S33, converting the HLS description into RTL code; S34, implement, layout and route the RTL code, and generate a configuration file running on the FPGA side; S35. Perform functional verification and performance testing on the trained model on FPGA hardware.
8. The real-time fault diagnosis method for equipment based on FPGA and SNN according to claim 1 is characterized in that: The FPGA-based real-time mechanical vibration signal acquisition system includes: a four-way vibration sensor drive unit, a signal conditioning unit, an analog-to-digital conversion unit, an FPGA processing unit, a power supply interface, and a debugging interface, wherein the FPGA processing unit is deployed with an SNN model.
9. The real-time fault diagnosis method for equipment based on FPGA and SNN according to claim 1, characterized in that: The intersection sliding window preprocessing includes: obtaining the original vibration signal, dividing the overlapping sub-windows, and when dividing the overlapping sub-windows, the adjacent windows overlap by 50%; using a linear decreasing weighting function to perform weighted fusion on the intersection area data; the formula is: x fuse [n]=w[n]·x prev [n]+(1-w[n])·x curr [n],n∈[1,1024] Where n represents the vibration signal, x fuse [n] represents the data point after sliding window processing, w[n] represents the linear decreasing weight, x prev [n] represents the previous window data, x curr [n] represents the current window data.
Citation Information
Cited By
Equipment fault diagnosis and monitoring hardware acceleration method and device based on FPGA (Field Programmable Gate Array)
CN120849126A
FPGA-based device fault diagnosis and monitoring hardware acceleration method and device
CN120849126B