A safety valve leakage detection method, electronic equipment, computer readable storage medium and program product
By constructing the time-frequency diagram of the ultrasonic signal of the safety valve and combining it with the energy attenuation rate, and using a deep learning model for analysis, the problem of accuracy in detecting micro-leakage of the safety valve was solved, and efficient and stable detection was achieved in service.
Patent Information
- Application Number
- CN202611623605.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-20
- Publication Date
- 2026-11-20
AI Technical Summary
Existing technologies struggle to accurately detect micro-leakage while safety valves are in service, and the detection results are easily affected by human factors and background noise.
By acquiring the ultrasonic and acoustic emission signals of the safety valve, a time-frequency graph is constructed through short-time Fourier transform processing. Combined with the energy attenuation rate, the graph is input into a deep learning model for analysis, and a graph attention network is used to determine leakage.
It improves the accuracy and stability of micro-leakage detection, reduces the impact of background noise and local disturbances on the detection results, and achieves accurate detection in service conditions.
Smart Images

Figure CN123135338A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of nondestructive testing technology, and more specifically, to a method for detecting leakage in a safety valve, an electronic device, a computer-readable storage medium, and a program product. Background Technology
[0002] During long-term service, safety valves may develop minute gaps between the valve disc and seat due to factors such as sealing surface wear, foreign object adhesion, corrosion, or assembly deviations, resulting in micro-leakage. Current on-site detection methods for such micro-leakage often involve applying soapy water to the safety valve outlet or suspected leak location and manually observing for bubble formation to determine the presence of a leak. While simple to operate, this method is easily affected by factors such as soap concentration, coating thickness, ambient airflow, observation time, and the experience of the inspector. It relies heavily on visual judgment, making it difficult to establish a stable, objective, and quantifiable basis for determining micro-leakage. Especially when the leakage is small, the bubble formation rate is slow, the size is small, or the leakage is not obvious, easily leading to missed or false positives.
[0003] Furthermore, micro-leakage in safety valves typically features small leakage channels, low leakage flow rates, and weak persistence. Under operating conditions, it is also susceptible to interference from factors such as inlet pressure fluctuations, pipeline vibration, media flow noise, and equipment background noise, making the effective response of the micro-leakage easily masked by background disturbances. Meanwhile, safety valves usually need to be tested under conditions that do not affect normal operation, and the testing conditions are limited by the on-site installation status and operating conditions, further increasing the difficulty of identifying micro-leakage. Therefore, how to accurately detect micro-leakage under actual service conditions of safety valves has become an urgent problem to be solved in existing safety valve leakage detection technologies. Summary of the Invention
[0004] In view of this, the purpose of the embodiments of this application is to provide a safety valve leakage detection method, electronic device, computer-readable storage medium and program product, which can improve the accuracy of safety valve micro-leakage detection when the safety valve is in service.
[0005] To achieve the above technical objectives, the technical solution adopted in this application is as follows:
[0006] In a first aspect, embodiments of this application provide a method for detecting leakage in a safety valve, the method comprising:
[0007] The ultrasonic signal and acoustic emission signal of the safety valve are acquired during the detection period. The ultrasonic signal includes an emission signal and a reception signal. The acoustic emission signal is obtained based on an acoustic emission sensor installed on the safety valve.
[0008] The acoustic emission signal is subjected to short-time Fourier transform processing to obtain a first time-frequency diagram, which characterizes the power variation of the acoustic emission signal at different times and different frequency positions.
[0009] Based on the transmitted signal and the received signal, the ultrasonic energy is calculated to obtain the transmitted energy and the received energy, respectively. The energy attenuation rate is obtained based on the transmitted energy and the received energy. The energy attenuation rate characterizes the degree of energy attenuation of the ultrasonic signal during its propagation in the sealing area of the safety valve.
[0010] Based on the first time-frequency graph, a graph structure is constructed. The nodes of the graph structure are time-frequency intervals formed by time windows and frequency bands in the first time-frequency graph. The edges of the graph structure include time edges and frequency edges. The time edges represent the time-domain relationship between corresponding nodes of adjacent time windows within the same frequency band, and the frequency edges represent the frequency-domain relationship between corresponding nodes of adjacent frequency bands within the same time window. The node features of the graph structure include the average power value of each time frame within the time-frequency interval in the corresponding frequency band. The edge features of the graph structure include the first difference between the average power values of the node features.
[0011] The graph structure and the energy decay rate are input into a deep learning model, and a prediction probability is obtained through the deep learning model. The prediction probability is used to determine whether the safety valve is leaking.
[0012] According to the first aspect, the deep learning model includes a graph attention network, which includes a linear mapping layer, a branch mapping layer, a graph attention layer, a global average pooling layer, a fully connected layer, and an output layer. The step of inputting the graph structure and the energy decay rate into the deep learning model to obtain the predicted probability includes:
[0013] The node features are input into the linear mapping layer, and the query vector, key vector, and value vector corresponding to the node features are obtained through the linear mapping layer.
[0014] Based on the energy decay rate, each feature component in the edge feature is processed element by element to obtain the enhanced feature;
[0015] The enhancement feature is input to the branch mapping layer, and the first enhancement feature is obtained through the first branch model in the branch mapping layer. The second enhancement feature is obtained through the second branch model in the branch mapping layer. The first enhancement feature represents the correlation feature between corresponding nodes of adjacent time windows in the same frequency band under ultrasonic energy attenuation. The second enhancement feature represents the correlation feature between corresponding nodes of adjacent frequency bands in the same time window under ultrasonic energy attenuation.
[0016] Based on the query vector, the key vector, the first enhanced feature, and the second enhanced feature, attention weights are obtained through the graph attention layer. The attention weights include a first attention weight and a second attention weight. The first attention weight is obtained based on the first enhanced feature, and the second attention weight is obtained based on the second enhanced feature.
[0017] Based on the value vector, the first attention weight and the second attention weight are weighted and aggregated to obtain aggregated features, and the node fusion features are obtained according to the aggregated features and the node features;
[0018] The fused features are input into the global average pooling layer, and graph-level features are obtained through the global average pooling layer.
[0019] The graph-level features are input into the fully connected layer, and the predicted value is obtained through the fully connected layer.
[0020] Based on the predicted value, the predicted probability is obtained through the output layer.
[0021] According to the first aspect, the step of weighting and aggregating the first attention weight and the second attention weight based on the value vector to obtain aggregated features, and obtaining fused features of nodes based on the aggregated features and the node features, includes:
[0022] Based on the value vector, the first attention weights are weighted and aggregated to obtain the first aggregated feature;
[0023] The first aggregated feature is mapped to the same feature space as the node feature, and the node feature is fused with the mapped first aggregated feature to obtain a first fused feature. The first fused feature characterizes the time variation feature within the frequency band corresponding to the node.
[0024] Based on the first fusion feature, the second attention weights are weighted and aggregated to obtain the second aggregated feature;
[0025] The second aggregated feature is fused with the first fused feature to obtain the second fused feature, which characterizes the frequency correlation features between the node and adjacent frequency bands based on time variation.
[0026] According to the first aspect, obtaining attention weights through the graph attention layer based on the query vector, the key vector, the first enhanced feature, and the second enhanced feature includes:
[0027] Based on the query vector, the key vector, and the first enhanced feature, an attention score is calculated through the graph attention layer to obtain a first attention score, and the first attention score is normalized to obtain a first attention weight.
[0028] Based on the query vector, the key vector, and the second enhanced feature, an attention score is calculated through the graph attention layer to obtain a second attention score, and the second attention score is normalized to obtain a second attention weight.
[0029] According to the first aspect, the step of calculating ultrasonic energy based on the transmitted signal and the received signal, obtaining the transmitted energy and the received energy respectively, and obtaining the energy attenuation rate based on the transmitted energy and the received energy includes:
[0030] The transmitted signal and the received signal are respectively subjected to DC component removal and bandpass filtering to obtain the processed transmitted signal and the processed received signal.
[0031] Based on the time series of the processed transmitted signal, the sampling time corresponding to the first occurrence of the half-peak is determined to obtain the first sampling time, and the sampling time corresponding to the last occurrence of the half-peak is determined to obtain the second sampling time.
[0032] Based on the first sampling time and the second sampling time, the signal interval corresponding to the processed transmitted signal is determined to obtain the first interval signal;
[0033] Perform cross-correlation calculation on the first interval signal and the processed received signal, and determine the third sampling time based on the maximum value of the cross-correlation calculation result;
[0034] Based on the time series of the processed received signal, the second interval signal is determined with the third sampling time as the midpoint time. The time series length of the second interval signal is the same as that of the first interval signal.
[0035] Calculate the sum of squares of the signal amplitudes of the first interval signal and the second interval signal to obtain the transmitted energy and the received energy, respectively.
[0036] The energy attenuation rate is obtained by calculating the ratio of the received energy to the transmitted energy.
[0037] According to the first aspect, before acquiring the ultrasonic signal and acoustic emission signal of the safety valve during the detection period, the method further includes:
[0038] Acquire historical ultrasonic signals, historical acoustic emission signals, and actual leakage status of the safety valve within a historical detection period. The historical ultrasonic signals include historical emission signals and historical received signals.
[0039] The historical acoustic emission signal is processed by short-time Fourier transform to obtain the first historical time-frequency diagram;
[0040] Based on the historical transmitted signal and the historical received signal, the ultrasonic energy is calculated to obtain the historical transmitted energy and the historical received energy, and the historical energy attenuation rate is obtained based on the historical transmitted energy and the historical received energy.
[0041] Based on the historical first time-frequency map, a historical graph structure is constructed. The nodes of the historical graph structure are the historical time-frequency intervals formed by time windows and frequency bands in the historical first time-frequency map. The edges of the historical graph structure include time edges and frequency edges. The time edges represent the time-domain relationship between corresponding nodes of adjacent time windows within the same frequency band, and the frequency edges represent the frequency-domain relationship between corresponding nodes of adjacent frequency bands within the same time window. The historical node features of the historical graph structure include the average power value of each time frame in the historical time-frequency interval within the corresponding frequency band. The historical edge features of the historical graph structure include the historical first difference of the average power values between the historical node features.
[0042] The historical graph structure, the historical energy decay rate, and the actual leakage state are integrated into training data;
[0043] The deep learning model is trained and initialized based on the training data, so that after the graph structure and the energy decay rate are input into the deep learning model, the deep learning model outputs the predicted probability.
[0044] Secondly, embodiments of this application also provide an electronic device, the electronic device including a processor and a memory coupled to each other, the memory storing a computer program, and when the computer program is executed by the processor, causing the electronic device to perform the method as described in the first aspect.
[0045] Thirdly, embodiments of this application also provide a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when run on a computer, causes the computer to perform the method described in the first aspect.
[0046] Fourthly, embodiments of this application also provide a program product, characterized in that it includes a computer program, which, when executed by a processor, implements the method described in the first aspect.
[0047] The invention employing the above technical solution has the following advantages:
[0048] By simultaneously acquiring ultrasonic and acoustic emission signals from the safety valve during the detection period, and characterizing the valve's service status from two different perspectives—ultrasonic energy propagation characteristics and acoustic emission time-frequency variation characteristics—leak detection no longer relies on a single signal feature, which helps reduce the impact of background noise and local transient disturbances on the detection results. The time-frequency graph constructed based on the acoustic emission signal retains the dynamic changes of the micro-leak acoustic emission signal in the time and frequency dimensions. Furthermore, the graph structure formed by time windows and frequency bands characterizes the correlation changes between adjacent time intervals and adjacent frequency bands, enabling the correlation characterization of micro-leakage features dispersed across different time locations and frequency ranges. The energy attenuation rate obtained from the ultrasonic emission and reception energy reflects the energy change of the ultrasonic signal after passing through the safety valve's sealing area, providing characterization information for the safety valve's sealing status that differs from the acoustic emission signal. Integrating the graph structure information and the energy attenuation rate into a deep learning model for comprehensive analysis facilitates the complementarity of different physical information, enhancing the model's ability to identify differences between micro-leakage features and non-leakage disturbances. This improves the accuracy and stability of micro-leakage detection while maintaining the safety valve's service status. Attached Figure Description
[0049] This application can be further illustrated by the non-limiting embodiments given in the accompanying drawings. It should be understood that the following drawings only illustrate some embodiments of this application and should not be considered as limiting the scope. For those skilled in the art, other related drawings can be obtained from these drawings without any inventive effort.
[0050] Figure 1 This is a flowchart of a safety valve leakage detection method provided in an embodiment of this application. Detailed Implementation
[0051] The present application will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that similar or identical parts are referred to by the same reference numerals in the drawings or description. Implementations not shown or described in the drawings are forms known to those skilled in the art. In the description of this application, terms such as "first" and "second" are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0052] Please refer to Figure 1 This application provides a safety valve leakage detection method, which can be applied to electronic devices and whose steps can be executed or implemented by the electronic devices. The electronic devices can be, but are not limited to, personal computers, smartphones, and other electronic devices. The safety valve leakage detection method may include the following steps:
[0053] S10 acquires the ultrasonic signal and acoustic emission signal of the safety valve during the detection cycle. The ultrasonic signal includes an emission signal and a reception signal. The acoustic emission signal is obtained based on an acoustic emission sensor installed on the safety valve.
[0054] S20 performs a short-time Fourier transform on the acoustic emission signal to obtain a first time-frequency diagram, which characterizes the power variation of the acoustic emission signal at different times and different frequency positions.
[0055] S30 calculates the ultrasonic energy based on the transmitted signal and the received signal, obtains the transmitted energy and the received energy respectively, and obtains the energy attenuation rate based on the transmitted energy and the received energy. The energy attenuation rate characterizes the degree of energy attenuation of the ultrasonic signal during its propagation in the sealing area of the safety valve.
[0056] S40 constructs a graph structure based on the first time-frequency graph. The nodes of the graph structure are time-frequency intervals formed by time windows and frequency bands in the first time-frequency graph. The edges of the graph structure include time edges and frequency edges. The time edges represent the time-domain relationship between corresponding nodes of adjacent time windows within the same frequency band. The frequency edges represent the frequency-domain relationship between corresponding nodes of adjacent frequency bands within the same time window. The node features of the graph structure include the average power value of each time frame within the time-frequency interval in the corresponding frequency band. The edge features of the graph structure include the first difference between the average power values of the node features.
[0057] S50 inputs the graph structure and the energy decay rate into the deep learning model, and obtains the prediction probability through the deep learning model. The prediction probability is used to determine whether the safety valve is leaking.
[0058] In S10, the safety valve under test remains installed on the actual production pipeline, and the test is performed without disassembling the safety valve or changing its normal installation state. The safety valve is in the closed state during testing, and the inlet side maintains actual pressure, so that the acquired ultrasonic and acoustic emission signals can reflect the sealing status of the safety valve under actual service conditions. The testing cycle can be predetermined according to the operating status of the safety valve and signal acquisition requirements, completing the acquisition of various signals within the same testing cycle to ensure that different types of signals correspond to the same safety valve operating state.
[0059] An ultrasonic transmitting transducer and an ultrasonic receiving transducer can be installed on the outer surface of the safety valve body. Both the transmitting and receiving transducers are externally mounted. During installation, the ultrasonic propagation path can be determined according to the valve body structure, ensuring that the ultrasonic waves generated by the transmitting transducer propagate through the valve body structure related to the valve disc, valve seat, and their sealing area before reaching the receiving transducer. Within the same detection cycle, the ultrasonic transmitting transducer is first de-excited, and the acoustic emission signal is acquired. Then, during the ultrasonic detection period, ultrasonic excitation is performed, and both the transmitted and received signals are acquired. The ultrasonic transmitting and receiving transducers are respectively positioned on the outer surfaces of the valve body corresponding to the sealing area on both sides of the safety valve, ensuring that the formed ultrasonic propagation path covers the sealing area formed by the valve disc and valve seat, thereby improving the sensitivity of the ultrasonic signal to changes in the sealing state. A preset electrical excitation signal is provided to the ultrasonic transmitting transducer by the ultrasonic excitation module. The ultrasonic transmitting transducer converts the electrical excitation signal into mechanical ultrasonic vibration and emits ultrasonic waves into the safety valve body. The detection device synchronously records the emission signal corresponding to this ultrasonic excitation. The emission signal is used to characterize the ultrasonic excitation state of the input safety valve during this detection process. The emission signal can be obtained through the reference acquisition loop of the ultrasonic emission channel or through the monitoring channel corresponding to the ultrasonic emission transducer, thereby avoiding the use of preset driving parameters to replace the actual emission state.
[0060] An acoustic emission sensor is mounted on the outer surface of the safety valve body. Positioned close to the sealing area formed by the valve seat and valve disc, the sensor effectively transmits the high-frequency disturbances generated by the medium flowing through the micro-leakage channel and their propagation response within the valve body structure to the acoustic emission sensor when a micro-leak occurs. A piezoelectric acoustic emission sensor can be used. The original electrical signal output by the acoustic emission sensor typically has a small amplitude; therefore, it can be amplified by a preamplifier, then signal-conditioned and converted from analog to digital before being input into a data acquisition device to obtain the digital acoustic emission signal within the detection period. It should be noted that the acoustic emission signal in this embodiment is a passively acquired signal; the acquisition process does not require actively applying acoustic emission excitation to the safety valve. When a micro-leak exists in the sealing area of the safety valve, medium with a certain pressure flows through the micro-leakage channel between the valve disc and valve seat. The resulting local flow disturbances, turbulence, and structural excitation can form high-frequency elastic waves, which propagate along the safety valve body to the acoustic emission sensor. The obtained acoustic emission signal reflects the actual leakage response of the safety valve's sealing area.
[0061] In S20, when performing short-time Fourier transform processing on the acoustic emission signal, the continuously acquired acoustic emission signal within the detection period can be divided into multiple time frames according to a preset time length. Adjacent time frames can partially overlap according to a preset overlap length to maintain continuous signal change information between adjacent time frames. The length of the time frame can be determined based on the sampling frequency of the acoustic emission signal and the duration characteristics of the leaked acoustic emission signal, so that the acoustic emission signal in each time frame can be approximately regarded as a locally stationary signal. After obtaining each time frame, the acoustic emission signal in each time frame is windowed. The windowing process is used to reduce spectral leakage caused by time frame truncation, so that the frequency components corresponding to each time frame can be characterized more stably. The window function used can be a Hanning window or a Hamming window, which can smooth the boundaries of the time frames. For each time frame in the same detection process, the same window function and the same window parameters can be used to ensure the comparability of the frequency domain information obtained between different time frames.
[0062] Fourier transforms are performed on each windowed time frame to convert the time-varying acoustic emission signal within each time frame to the frequency domain, obtaining the frequency domain results of the corresponding time frame at multiple frequency points. For each time frame, the frequency distribution information corresponding to that time frame can be obtained. Since each time frame has a definite time position in the original acoustic emission signal, arranging the frequency domain results corresponding to different time frames according to their time order within the detection period can simultaneously preserve the time position information and frequency distribution information of the acoustic emission signal. Further, Fourier transforms are performed on each windowed time frame, and the frequency domain results of each time frame constitute the short-time Fourier transform result, that is, the complex spectral coefficients corresponding to each frequency point of that time frame are obtained. Taking the modulus of the complex spectral coefficients and squaring their modulus values yields the power values of the corresponding time frame and the corresponding frequency point. The power values of each time frame at each frequency point are arranged in chronological order to form the power distribution in the first time-frequency diagram. The first time-frequency diagram is constructed using time position as one dimension, frequency as another dimension, and the power of the corresponding frequency point as the feature value of the time-frequency position. Therefore, any time-frequency position in the first time-frequency diagram corresponds to a specific time position and a specific frequency within the detection period, and has a power value corresponding to that time position and frequency, thereby characterizing the distribution and variation of the power of the acoustic emission signal in the time and frequency dimensions.
[0063] By performing a short-time Fourier transform on the acoustic emission signal, a first time-frequency diagram is obtained. This transforms the non-stationary acoustic emission time-domain signal collected under the service state of the safety valve into two-dimensional time-frequency information that simultaneously characterizes time variation and frequency distribution. This allows the local high-frequency response, transient energy enhancement, and time-varying characteristics of different frequency bands caused by micro-leakage to be distinguished and preserved in the time-frequency domain. Compared to directly performing time-domain analysis or overall spectrum analysis on the entire acoustic emission signal, this processing method reduces the masking effect of equipment operating vibration, environmental noise, and changes in operating conditions on micro-leakage characteristics. It avoids the weakening of local leakage information due to full-time or full-frequency band averaging, thus providing more discriminative basic data for subsequent node construction based on time-frequency response units and analysis of the correlation between different times and different frequency bands. This is beneficial for improving the identification capability of micro-leakage characteristics under the service state of the safety valve, thereby improving the accuracy of micro-leakage detection.
[0064] In S30, the step of calculating ultrasonic energy based on the transmitted signal and the received signal to obtain the transmitted energy and the received energy, and obtaining the energy attenuation rate based on the transmitted energy and the received energy, includes:
[0065] S31 performs DC component removal and bandpass filtering on the transmitted signal and the received signal respectively to obtain the processed transmitted signal and the processed received signal.
[0066] Based on the time series of the processed transmitted signal, S32 determines the sampling time corresponding to the first occurrence of the half-peak value to obtain the first sampling time, and determines the sampling time corresponding to the last occurrence of the half-peak value to obtain the second sampling time;
[0067] S33 determines the signal interval corresponding to the processed transmitted signal based on the first sampling time and the second sampling time, and obtains the first interval signal;
[0068] S34 performs a cross-correlation operation on the first interval signal and the processed received signal, and determines the third sampling time based on the maximum value of the cross-correlation operation result;
[0069] S35 determines a second interval signal based on the time series of the processed received signal, with the third sampling time as the midpoint time. The time series length of the second interval signal is the same as that of the first interval signal.
[0070] S36 calculates the sum of squares of the signal amplitudes of the first interval signal and the second interval signal to obtain the transmitted energy and the received energy, respectively;
[0071] S37 calculates the ratio of the received energy to the transmitted energy to obtain the energy attenuation rate.
[0072] In step S31, the DC component in the transmitted and received signals is removed, ensuring that the processed signals vary around a zero level. This avoids fixed baseline components caused by sensor zero-point offset and acquisition circuit bias being included in subsequent signal amplitude and energy calculations. The transmitted and received signals after removing the DC component are then bandpass filtered, retaining only ultrasonic signal components within a preset frequency range and suppressing low-frequency mechanical vibrations, electrical interference, and high-frequency noise outside the target frequency band, resulting in the processed transmitted and received signals.
[0073] In steps S32 and S33, the effective range of the transmitted signal is determined based on the time series of the processed transmitted signal. Using the peak amplitude of the processed transmitted signal as a reference, the sampling times corresponding to the first and last times the signal amplitude reaches half the peak value are determined along the time series and designated as the first and second sampling times, respectively. Using the first sampling time as the starting position and the second sampling time as the ending position, the corresponding signal interval is extracted from the processed transmitted signal to obtain the first interval signal.
[0074] In steps S34 and S35, using the aforementioned first interval signal as a reference signal, the effective receiving interval corresponding to the transmitted signal is located in the processed received signal. A cross-correlation operation is performed on the first interval signal and the processed received signal. During the cross-correlation operation, the first interval signal is gradually moved along the time axis relative to the processed received signal. At each relative position, the waveform changes of the first interval signal and the corresponding time period in the processed received signal are matched and calculated to obtain the correlation degree corresponding to different time offset positions. As the position of the first interval signal changes in the processed received signal, a cross-correlation result that varies with time offset can be formed. When the cross-correlation result reaches its maximum value, it indicates that the waveform matching degree between the first interval signal and the corresponding time period in the processed received signal is the highest. Based on this, the position in the processed received signal corresponding to the transmission process is determined, and the sampling time corresponding to this position is determined as the third sampling time.
[0075] Using the third sampling time as the positioning reference for the second interval signal, and taking this third sampling time as the midpoint, a signal interval with the same time series length as the first interval signal is extracted from the processed received signal to obtain the second interval signal. Since the received signal typically experiences a propagation delay relative to the transmitted signal after the ultrasonic signal propagates through the safety valve's sealed area, and this delay may not be a fixed value due to factors such as the actual installation location, propagation path, and service status, cross-correlation calculations can be used to determine the position of the received signal based on the actual waveform correspondence between the transmitted and received signals in this test. Then, a fixed-length second interval signal is extracted centered on the position with the highest correlation, ensuring that the second interval signal corresponds as closely as possible in time to the same ultrasonic propagation process represented by the first interval signal.
[0076] In S36, before calculating the transmitted and received energy, amplitude normalization or channel calibration is first performed on the processed transmitted and received signals based on the channel gain, transducer sensitivity, and acquisition range corresponding to the transmitted and received acquisition channels. The signal amplitudes of the first and second interval signals at each sampling time are squared, and the squared amplitudes of each sampling point within the corresponding signal interval are accumulated. The accumulated results are used as the transmitted and received energy, respectively. Since the second interval signal has the same time series length as the first interval signal, the transmitted and received energy are calculated under the same sampling duration and conditions. For the sampled ultrasonic time-domain signal, the signal amplitude reflects the response intensity at the corresponding sampling time, and the energy corresponds to the square of the signal amplitude. Accumulating the squared amplitudes of each sampling point within the effective signal interval provides a comprehensive reflection of the overall signal strength throughout the entire effective propagation interval, rather than judging signal strength solely based on the peak amplitude of a single sampling point.
[0077] In S37, the energy attenuation rate is obtained by calculating the ratio between received energy and transmitted energy, which characterizes the degree of energy change of the ultrasonic signal after propagating through the sealed area of the safety valve. When the ultrasonic signal propagates through the sealed area of the safety valve, its propagation energy is affected by the contact state of the sealing pair, local gaps, and the reflection, transmission, and scattering effects of the propagation interface. When a micro-leak occurs in the safety valve, the local gap or leakage channel formed between the sealing surfaces will change the ultrasonic propagation boundary, thereby causing a change in received energy relative to transmitted energy. Therefore, by utilizing the relative relationship between transmitted and received energy, the state changes of the sealed area that are difficult to observe directly can be transformed into measurable ultrasonic propagation characteristics. Compared with the instantaneous amplitude of a single sampling point, the energy characteristics calculated based on the effective signal interval comprehensively reflect the signal strength within a certain time range, and are less sensitive to local transient fluctuations, which is beneficial for stably characterizing subtle changes in the sealing state of the safety valve. At the same time, when a micro-leak occurs in the safety valve, the leakage channel is usually small, and it may be difficult to stably characterize its state by simply relying on the instantaneous amplitude change, while the energy index comprehensively reflects the overall amplitude change of the signal within a certain time interval, and is relatively less sensitive to local transient fluctuations. By comparing the energy relationship between the transmitter and receiver within the corresponding effective signal range, a more stable ultrasonic propagation characteristic can be obtained, thereby improving the ability to characterize subtle changes in the sealing state of the safety valve.
[0078] In S40, when constructing the graph structure based on the first time-frequency graph, the time dimension of the first time-frequency graph can be divided according to a preset time window length, and the frequency dimension of the first time-frequency graph can be divided according to a preset frequency range, thereby dividing the first time-frequency graph into multiple time-frequency intervals defined by both time windows and frequency bands. Each time-frequency interval corresponds to a local region in the first time-frequency graph, which corresponds to a specific time window in the time dimension and a specific frequency band in the frequency dimension. Each time-frequency interval is set as a node in the graph structure, so that the power information originally arranged in a two-dimensional manner according to time and frequency in the first time-frequency graph is converted into multiple graph nodes with clear time and frequency positions.
[0079] In a graph structure, a time window can include multiple consecutive time frames, and a frequency band can include multiple consecutive frequency points. A node corresponds to a local time-frequency region composed of multiple time frames and multiple frequency points. For any node, within each time frame corresponding to the node, multiple frequency points falling within the corresponding frequency band are determined, and the power values of these multiple frequency points are averaged to obtain the average power value of the time frame within the corresponding frequency band. The average power values are arranged according to the chronological order of the time frames within the time window to form the node feature of the node. The node feature can retain information about the power variation with time frames within the time-frequency interval. For example, if a time window includes multiple consecutive time frames, the node feature of the corresponding node is composed of the average power values of each of the multiple time frames within the target frequency band in sequence. Therefore, for two nodes located in the same frequency band but different time windows, their node features reflect the power changes of the corresponding frequency band in different time stages. For two nodes located in the same time window but different frequency bands, their node features reflect the power changes of different frequency regions within the same time range.
[0080] The connection relationships between nodes are determined based on their time and frequency positions in the first time-frequency diagram. These edges include time edges and frequency edges. Specifically, for two nodes with the same frequency band and adjacent time windows, a time edge is established between them. For example, a time edge is established between nodes corresponding to the first and second time windows within the same frequency band, and between nodes corresponding to the second and third time windows. The time edge continuously connects nodes along the time direction of the first time-frequency diagram, representing the time-domain relationship of acoustic emission signals changing from one time stage to adjacent time stages within the same frequency range. For two nodes with the same time window and adjacent frequency bands, a frequency edge is established between them. For example, within the same time window, a frequency edge is established between nodes corresponding to the first and second frequency bands, and between nodes corresponding to the second and third frequency bands. The frequency edge connects nodes corresponding to adjacent frequency bands along the frequency direction of the first time-frequency diagram, representing the frequency-domain relationship of acoustic emission signals in adjacent frequency regions within the same time range.
[0081] For nodes located within the first time-frequency graph, they can be connected to nodes corresponding to the previous or next time window within the same frequency band via time edges, and also to nodes corresponding to lower or higher frequency bands within the same time window via frequency edges. This ensures that the temporal continuity and frequency adjacency relationships in the first time-frequency graph are simultaneously preserved in the constructed graph structure. For nodes located at time or frequency boundaries, corresponding time or frequency edges are only established with existing adjacent nodes.
[0082] After determining the time edge and frequency edge, the edge features of the corresponding edge are determined based on the node features of the connected nodes. Since the node features of two connected nodes are each composed of multiple average power values arranged in chronological order, the average power values at corresponding positions in the two nodes can be subtracted one by one to obtain multiple first difference values, which are then used to construct the edge features of the corresponding edge. The edge features can preserve the power changes of the connected nodes across multiple corresponding time frames.
[0083] For the time edge, since two connected nodes correspond to adjacent time windows within the same frequency band, the first difference can be determined according to the temporal relationship. For example, the average power value of the node corresponding to the later time window can be subtracted from the average power value of the node corresponding to the earlier time window at the corresponding position. This allows the edge feature of the time edge to characterize the power increase or decrease of the same frequency band from the previous time stage to the next time stage. When the corresponding difference is positive, it indicates that the power at the corresponding position has increased relative to the previous time window. When the corresponding difference is negative, it indicates that the power at the corresponding position has decreased relative to the previous time window. For the frequency edge, since two connected nodes correspond to adjacent frequency bands within the same time window, the first difference can be determined according to the frequency from low to high. For example, the average power value of the node corresponding to the higher frequency band can be subtracted from the average power value of the node corresponding to the lower frequency band at the corresponding position. This allows the edge feature of the frequency edge to characterize the power change of the acoustic emission signal between adjacent frequency bands within the same time stage. Although both the time edge and the frequency edge use the first difference between the corresponding average power values of connected nodes as the edge feature, they respectively correspond to the power change relationship in the time direction and the frequency direction.
[0084] For micro-leakage in safety valves, the acoustic emission response is often weak in amplitude, and the effective information may be scattered across continuous time periods and adjacent frequency bands. Examining the absolute power at a single moment or frequency location is easily affected by background noise, operating condition fluctuations, and transient disturbances. Characterizing the relationship between adjacent time-frequency regions using a graph structure improves the ability to identify weak but continuous and correlated leakage characteristics. Using the power difference between adjacent nodes as edge features helps to highlight the changing trends between local time-frequency regions.
[0085] In S50, the deep learning model includes a graph attention network, which comprises a linear mapping layer, a branch mapping layer, a graph attention layer, a global average pooling layer, a fully connected layer, and an output layer. The step of inputting the graph structure and the energy decay rate into the deep learning model to obtain the predicted probability includes:
[0086] S51 inputs the node features into the linear mapping layer, and obtains the query vector, key vector and value vector corresponding to the node features through the linear mapping layer;
[0087] S52 performs element-wise processing on each feature component in the edge feature based on the energy decay rate to obtain the enhanced feature;
[0088] S53 inputs the enhancement feature to the branch mapping layer, obtains the first enhancement feature through the first branch model in the branch mapping layer, and obtains the second enhancement feature through the second branch model in the branch mapping layer. The first enhancement feature represents the correlation feature between corresponding nodes of adjacent time windows in the same frequency band under ultrasonic energy attenuation, and the second enhancement feature represents the correlation feature between corresponding nodes of adjacent frequency bands in the same time window under ultrasonic energy attenuation.
[0089] S54 obtains attention weights through the graph attention layer based on the query vector, the key vector, the first enhanced feature, and the second enhanced feature. The attention weights include a first attention weight and a second attention weight. The first attention weight is obtained based on the first enhanced feature, and the second attention weight is obtained based on the second enhanced feature.
[0090] S55, based on the value vector, performs weighted aggregation on the first attention weight and the second attention weight to obtain aggregated features, and obtains the fusion features of the nodes based on the aggregated features and the node features;
[0091] S56 inputs the fused features into the global average pooling layer, and obtains graph-level features through the global average pooling layer;
[0092] S57 inputs the graph-level features into the fully connected layer, and obtains the predicted value through the fully connected layer;
[0093] S58 obtains the predicted probability through the output layer based on the predicted value.
[0094] In S51, the node features of node i are input into the linear mapping layer, and through three sets of independent linear transformations, the query vector, key vector, and value vector are obtained respectively:
[0095]
[0096]
[0097]
[0098] in, Represents the node characteristics of node i; , and These represent the trainable weight matrices corresponding to the query vector, key vector, and value vector, respectively. , and These represent the corresponding bias vectors; , and These represent the query vector, key vector, and value vector of node i, respectively.
[0099] In S52, based on the energy attenuation rate, each first difference in the feature sequence is enhanced, so that the edge feature retains the local power change information of adjacent nodes while introducing the ultrasonic propagation state information corresponding to the safety valve sealing area within the current detection period. The edge feature is composed of the first difference of the average power values of two connected nodes in corresponding time frames. For any edge, its edge feature can be expressed as:
[0100]
[0101] in, L represents the edge features between node i and node j; L represents the number of average power values contained in the node features. This represents the first difference in the average power values of two connected nodes at the l-th corresponding position.
[0102] For the l-th first difference value in the edge features, the enhancement process can be expressed as:
[0103]
[0104] in, This represents the energy attenuation rate obtained from the ultrasonic transmitted and received signals; This represents the l-th first difference before enhancement; This represents the l-th first difference after the energy decay rate is enhanced.
[0105] The first difference values in the edge features corresponding to an edge are processed separately to obtain the enhanced features corresponding to that edge. :
[0106]
[0107] In S53, when the edge between node i and node j is a time edge, the corresponding enhanced feature is input into the first branch model. The first branch model performs feature mapping to obtain the first enhanced feature.
[0108]
[0109] in, This represents the first augmented feature corresponding to the time edge; This represents the weight matrix of the first branch model; This represents the bias vector of the first branch model; ( ) represents the activation function, and the ReLU activation function can be used.
[0110] Since the time edge connects nodes corresponding to adjacent time windows within the same frequency band, the first enhancement feature reflects the node relationship formed by the acoustic emission signal changing with adjacent time windows within the same frequency range.
[0111] When the edge between node i and node j is a frequency edge, the corresponding enhanced feature is input into the second branch model. The second branch model performs feature mapping to obtain the second enhanced feature.
[0112]
[0113] in, This represents the second enhanced feature corresponding to the frequency edge; This represents the weight matrix of the second branch model; This represents the bias vector of the second branch model.
[0114] The frequency edge connects nodes corresponding to adjacent frequency bands within the same time window. After the second branch model maps the enhancement features corresponding to the frequency edge, the resulting second enhancement feature is used to characterize the correlation features between nodes corresponding to adjacent frequency bands within the same time window under the current ultrasonic energy attenuation state.
[0115] The time edge mainly reflects the relationship between acoustic emission characteristics and time within the same frequency band, while the frequency edge mainly reflects the correlation between adjacent frequency bands within the same time window. By performing feature mapping separately, deep learning models can learn different feature representations for the two types of relationships, thereby enhancing their ability to distinguish between time-varying features and frequency-related features.
[0116] In S54, obtaining attention weights through the graph attention layer based on the query vector, the key vector, the first enhanced feature, and the second enhanced feature includes:
[0117] S541 calculates an attention score based on the query vector, the key vector, and the first enhanced feature through the graph attention layer to obtain a first attention score, and normalizes the first attention score to obtain a first attention weight;
[0118] S542 calculates an attention score based on the query vector, the key vector, and the second enhanced feature through the graph attention layer to obtain a second attention score, and normalizes the second attention score to obtain a second attention weight.
[0119] In S541, for target node i, neighboring node j connected to target node i via a time edge is determined. Based on the query vector of target node i, the key vector of neighboring node j, and the first enhancement feature corresponding to the time edge, a first attention score between target node i and neighboring node j is jointly calculated. The first attention score can be expressed as:
[0120]
[0121] in, This represents the first attention score between target node i and its temporal neighbor node j; Represents the query vector for target node i; d represents the key vector of adjacent node j; d represents the feature dimension of the query vector and the key vector. This represents the first augmenting feature between node i and node j; This represents a trainable parameter vector used to convert the first enhanced feature into an attention relation score; ( ) represents the activation function.
[0122] The matching result between the query vector and the key vector is used to characterize the correlation between the target node and its neighboring nodes at the node feature level. The first enhanced feature corresponds to the temporal edge relationship between the target node and its neighboring nodes and includes information on the power change in adjacent time windows under the influence of energy decay rate. Both are used together to calculate the first attention score, so that the first attention score simultaneously considers the node feature matching relationship between the target node and its neighboring nodes, as well as the correlation features corresponding to the temporal edge.
[0123] For all temporal adjacent nodes of target node i, calculate the first attention score respectively in the above manner to obtain a set of first attention scores for the target node. Normalize the first attention scores within the temporal adjacent nodes of the target node to obtain the first attention weights:
[0124]
[0125]
[0126] in, This represents the first attention weight of target node i to its temporal neighbor node j; This represents the set of adjacent nodes connected to the target node i via a time edge; This represents the first attention score between the target node i and its temporal neighbor node k.
[0127] In S542, for target node i, the neighboring node j connected to target node i through frequency edges is determined, and the second attention score between target node i and neighboring node j is calculated based on the query vector of target node i, the key vector of neighboring node j and the second enhancement feature of the corresponding frequency edge.
[0128] The second attention score can be expressed as:
[0129]
[0130] in, This represents the second attention score between target node i and its frequency edge neighbor node j; Represents the query vector for target node i; d represents the key vector of adjacent node j; d represents the feature dimension of the query vector and the key vector. This represents the second augmenting feature between node i and node j; This represents a trainable parameter vector used to convert the second enhanced feature into an attention relation score; ( ) represents the activation function.
[0131] For all frequency-edge adjacent nodes of target node i, calculate the second attention score according to the above method, and normalize it within the range of frequency-edge adjacent nodes of the target node to obtain the second attention weight:
[0132]
[0133]
[0134] in, This represents the second attention weight of target node i for its frequency edge neighbor node j; This represents the set of adjacent nodes connected to the target node i via frequency edges; This represents the second attention score between the target node i and its frequency edge neighbor node k.
[0135] In S55, the step of weighting and aggregating the first attention weight and the second attention weight based on the value vector to obtain aggregated features, and obtaining the fusion features of the nodes based on the aggregated features and the node features, includes:
[0136] S551 Based on the value vector, the first attention weights are weighted and aggregated to obtain the first aggregated feature;
[0137] S552 maps the first aggregated feature to the same feature space as the node feature, and performs feature fusion between the node feature and the mapped first aggregated feature to obtain a first fused feature, wherein the first fused feature characterizes the time variation feature within the frequency band corresponding to the node.
[0138] S553 performs weighted aggregation on the second attention weights based on the first fusion feature to obtain the second aggregated feature;
[0139] S554 performs feature fusion with the second aggregated feature and the first fusion feature to obtain a second fusion feature, which characterizes the frequency correlation features between the node and adjacent frequency bands based on time variation.
[0140] In S551, for target node i, each neighboring node connected to target node i via a time edge is determined, and the value vector corresponding to each neighboring node is obtained. Based on the first attention weight, the value vectors of each neighboring node are weighted and summed to obtain the first aggregated feature corresponding to target node i.
[0141] The first aggregation feature can be represented as:
[0142]
[0143] in, This represents the first aggregated feature of target node i; This represents the set of adjacent nodes connected to the target node i via a time edge; This represents the first attention weight between target node i and its temporal neighbor node j; This represents the value vector obtained by the adjacent node j through the linear mapping layer.
[0144] For each temporal neighbor of target node i, the value vector of that neighbor is multiplied by its corresponding first attention weight to obtain the weighted feature transmitted from that neighbor to the target node. The weighted features corresponding to all temporal neighbors are summed to obtain the first aggregated feature. Since the first attention weight is normalized within the temporal neighbor range of the target node, the value vectors of different neighbors participate in feature aggregation with different weights according to their temporal correlation with the target node. The first aggregated feature is obtained by aggregating the information of nodes corresponding to adjacent time windows within the same frequency band and is used to characterize the feature information obtained by the target node from its temporal neighbors.
[0145] In S552, the first aggregated feature is derived from the weighted result of the value vector, while the node feature is derived from the average power value sequence of the corresponding time-frequency interval in the first time-frequency graph. The two may not be consistent in feature dimension and feature representation space. Therefore, before fusion, the first aggregated feature needs to be linearly mapped to transform it into the same feature space as the node feature.
[0146] For target node i, the first aggregated feature can be mapped as:
[0147]
[0148] in, This represents the first aggregated feature of target node i; This represents the trainable weight matrix used for feature space transformation of the first aggregated feature; This represents the corresponding bias vector; the feature dimension of the first aggregated feature and the node features of the target node. They are the same. Node features describe the local power changes within the corresponding time-frequency interval of the target node, while the first aggregated feature describes the temporal correlation information transmitted to the target node from adjacent time windows within the same frequency band. Through a trainable linear mapping, the first aggregated feature can be reorganized according to subsequent fusion requirements and a correspondence established with the node's own features.
[0149] After completing the feature space mapping, the mapped first aggregated feature is fused with the node features of the target node itself. For example, the first fused feature can be obtained by element-wise addition:
[0150]
[0151] in, The node characteristics representing the target node i; This represents the first aggregated feature after mapping; ( ) represents the activation function; This represents the first fusion feature of target node i.
[0152] The first fusion feature integrates the local power information of the target node itself with the temporal correlation information provided by adjacent time windows within the same frequency band, thereby characterizing the continuous variation features of the target node's corresponding frequency band within a local time range. By filtering the information of adjacent nodes at different times using the first attention weight, the influence of random noise or abnormal fluctuations on the feature representation of the target node can be reduced, improving the stability of the temporal variation features.
[0153] In S553, for target node i, each neighboring node connected to target node i via frequency edges is determined, and the first fusion feature of each frequency edge neighboring node is obtained. Based on the second attention weight, the first fusion features of each frequency edge neighboring node are weighted and aggregated to obtain the second aggregated feature corresponding to target node i. Specifically, this can be expressed as:
[0154]
[0155] in, This represents the second aggregation feature of target node i; This represents the set of adjacent nodes connected to the target node i via frequency edges; This represents the second attention weight between target node i and its frequency edge neighbor node j; The first fusion feature represents the frequency edge adjacent node j. The first fusion feature has fused the node's own features and the information of the nodes corresponding to adjacent time windows in the same frequency band, and is used to characterize the time change features in the frequency band corresponding to the node.
[0156] The second aggregated feature is obtained by weighting and aggregating the first fused features of adjacent nodes at each frequency edge using a second attention weight. Since the aggregated first fused features already contain time variation information within each frequency band, the second aggregated feature can further gather information from adjacent frequency bands based on the time variation representation. This is beneficial for simultaneously preserving the continuous changes in the acoustic emission signal in the time direction and the correlated changes in the frequency direction, allowing the micro-leakage features dispersed in adjacent frequency bands to establish further connections based on time evolution information, thereby enhancing the comprehensive characterization capability of the acoustic emission features of micro-leakage in safety valves.
[0157] In S554, the second aggregated feature corresponding to the target node is fused with the first fusion feature of the target node itself to obtain the second fusion feature. The second fusion feature can be represented as:
[0158]
[0159] in, This represents the second fusion feature of target node i; This represents the first fusion feature of target node i; This represents the second aggregation feature of target node i; ( ) represents the activation function.
[0160] The second aggregated feature is fused with the first fusion feature of the target node itself to obtain the second fusion feature. The second fusion feature simultaneously contains the time variation information of the frequency band where the target node is located and the correlation information between adjacent frequency bands, thereby forming a node feature representation that takes into account both time continuity and frequency correlation.
[0161] For micro-leakage in safety valves, the acoustic emission response is typically weak, and features at a single time location or in a single frequency band are easily affected by background noise and fluctuations in service conditions. The second fusion feature jointly represents the continuous temporal variation with corresponding changes between adjacent frequency bands. This allows the model to utilize the coordinated variation characteristics of the micro-leakage acoustic emission signal in both time and frequency dimensions, reducing dependence on isolated local power anomalies. This improves the ability to distinguish micro-leakage features from non-leakage disturbances, thus enhancing the accuracy of micro-leakage detection in the service state of safety valves.
[0162] In steps S56 to S58, the fused features obtained from the aforementioned time-relationship aggregation and frequency-relationship aggregation of each node are summarized at the graph level, and the predicted probability of safety valve leakage is further obtained. For all nodes in the graph structure corresponding to the current detection period, the fused features of each node are input into a global average pooling layer, and the fused features of all nodes are averaged according to the corresponding feature dimensions to obtain graph-level features that can characterize the state of the entire graph structure.
[0163]
[0164] in, Represents graph-level features; N represents the total number of nodes in the graph structure; This represents the fused feature corresponding to the i-th node. Through global average pooling, local features distributed in nodes across different time windows and frequency bands are aggregated into a fixed-dimensional overall feature, thus forming an overall representation of the acoustic emission time-frequency state in the current detection period.
[0165] The graph-level features are input into a fully connected layer, which then performs a linear combination of the graph-level features to obtain the predicted values.
[0166]
[0167] Where s represents the predicted value; This represents the trainable weight parameters of the fully connected layer; This represents the corresponding bias parameter. The predicted value is used to characterize the discrimination score for determining whether the safety valve is in a leaking state.
[0168] The predicted value is input into the output layer, and the predicted value is transformed to the range of 0 to 1 using the Sigmoid function to obtain the predicted probability P:
[0169]
[0170] This application transforms the detection of micro-leakage in safety valves from judging a single signal amplitude or local anomaly to comprehensively identifying the correlation between changes in the propagation state of the sealing area and the acoustic response of the leak by synergistically characterizing the ultrasonic propagation state and the time-frequency variation of acoustic emission. Ultrasonic energy attenuation information reflects changes in the overall propagation conditions of the safety valve's sealing area, while the acoustic emission map structure further characterizes the evolution of the micro-leakage signal in terms of temporal continuity and frequency correlation. These two elements form a complementary state representation in the model. By extracting the time variation within the same frequency band and analyzing the correlation between adjacent frequency bands based on this time variation, the model can identify micro-leakage features with stable propagation patterns from continuously correlated time-frequency variations. This reduces the interference of background noise, transient disturbances, and operating condition changes on the detection results during service, enhances the ability to distinguish between weak leakage features and non-leakage disturbances, and thus improves the accuracy and stability of micro-leakage detection while the safety valve remains in service.
[0171] The deep learning model can be trained in the following way:
[0172] The system acquires historical ultrasonic signals, historical acoustic emission signals, and actual leakage states of the safety valve within a historical detection period. The historical ultrasonic signals include historical transmitted signals and historical received signals. A short-time Fourier transform is performed on the historical acoustic emission signals to obtain a first historical time-frequency graph. Based on the historical transmitted and received signals, ultrasonic energy is calculated to obtain the historical transmitted energy and historical received energy, respectively. The historical energy attenuation rate is then obtained based on the historical transmitted and received energy. A historical graph structure is constructed based on the first historical time-frequency graph. The nodes of the historical graph structure are historical time-frequency intervals formed by time windows and frequency bands in the first historical time-frequency graph. The edges of the historical graph structure include time edges and frequency edges. The time edge represents the temporal relationship between corresponding nodes of adjacent time windows within the same frequency band, and the frequency edge represents the frequency domain relationship between corresponding nodes of adjacent frequency bands within the same time window. The historical node features of the historical graph structure include the average power value of each time frame within the corresponding frequency band in the historical time-frequency interval, and the historical edge features of the historical graph structure include the historical first difference of the average power values between the historical node features. The historical graph structure, the historical energy decay rate, and the actual leakage state are integrated into training data. A deep learning model is trained and initialized based on the training data so that after the graph structure and the energy decay rate are input into the deep learning model, the deep learning model outputs the predicted probability.
[0173] Multiple historical safety valves' test data generated during actual testing can be collected in advance. For any historical safety valve, historical transmission signals, historical reception signals, and historical acoustic emission signals are acquired using the same signal acquisition method as the safety valve under test. To ensure consistency between the data processing methods in the training and actual testing phases, historical transmission and reception signals are processed using the same method described above to obtain the historical energy attenuation rate. The actual leakage state is used as the status label for the historical safety valve. The actual leakage state is represented as a binary label, with historical safety valves confirmed to have leakage marked as 1 and those confirmed not to have leakage marked as 0. The actual leakage state is obtained based on the test results of the safety valve's actual sealing state. The sealing state confirmation results or the safety valve sealing performance test results obtained during subsequent safety valve maintenance can be used as the basis for the actual state.
[0174] Historical acoustic emission signals are processed using the same short-time Fourier transform processing method as the acoustic emission signals to obtain a historical first time-frequency map. The historical emission signals and the historical received signals are processed using the same signal processing method described above to obtain the historical energy attenuation rate. Based on the historical power information in the historical first time-frequency map, a historical graph structure is constructed. The historical energy attenuation rate and the historical graph structure are used as input features of the model, and the actual leakage state labels are used as supervision signals to construct a training dataset. After initializing the deep learning model, a loss function is used for training. After training is complete, only the energy attenuation rate and the graph structure need to be input during the testing phase for the model to output the predicted probability. In this embodiment, the collected training dataset is divided into a training set and a test set in an 8:2 ratio, with 80% of the data used for model training and the remaining 20% used for testing.
[0175] For training data containing N historical samples, the average loss of each historical sample can be calculated as the model training loss:
[0176]
[0177] in, This indicates the actual leakage status; it can be set to 1 when there is a leak and 0 when there is no leak. This represents the predicted leakage probability output by the model.
[0178] This application provides an electronic device that may include a processing module and a memory. The memory stores a computer program, which, when executed by the processor, enables the electronic device to perform the corresponding steps in the aforementioned safety valve leakage detection method.
[0179] In this embodiment, the processor can be an integrated circuit chip with signal processing capabilities. For example, the processor can be a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0180] The memory can be, but is not limited to, random access memory, read-only memory, programmable read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, etc.
[0181] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the electronic device described above can be referred to the corresponding steps in the aforementioned method, and will not be elaborated further here.
[0182] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the safety valve leakage detection method as described in the above embodiments.
[0183] Computer-readable storage media may be magnetic disks, optical disks, read-only memory, random access memory, flash memory, USB flash drives, hard disks, or solid-state drives, etc., and may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implement the methods shown in the above embodiments.
[0184] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the aforementioned safety valve leakage detection method. The computer program product may exist in a computer-readable storage medium in forms including, but not limited to, source files, executable files, and installation package files.
[0185] Based on the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This software product can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, mobile hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, electronic device, or network device, etc.) to execute the methods described in the various implementation scenarios of this application.
[0186] In the embodiments provided in this application, it should be understood that the disclosed methods can also be implemented in other ways. The method embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or part of code, which includes one or more executable instructions for implementing a specified logical function. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0187] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for detecting leakage in a safety valve, characterized in that, The method includes: The ultrasonic signal and acoustic emission signal of the safety valve are acquired during the detection period. The ultrasonic signal includes an emission signal and a reception signal. The acoustic emission signal is obtained based on an acoustic emission sensor installed on the safety valve. The acoustic emission signal is subjected to short-time Fourier transform processing to obtain a first time-frequency diagram, which characterizes the power variation of the acoustic emission signal at different times and different frequency positions. Based on the transmitted signal and the received signal, the ultrasonic energy is calculated to obtain the transmitted energy and the received energy, respectively. The energy attenuation rate is obtained based on the transmitted energy and the received energy. The energy attenuation rate characterizes the degree of energy attenuation of the ultrasonic signal during its propagation in the sealing area of the safety valve. Based on the first time-frequency graph, a graph structure is constructed. The nodes of the graph structure are time-frequency intervals formed by time windows and frequency bands in the first time-frequency graph. The edges of the graph structure include time edges and frequency edges. The time edges represent the time-domain relationship between corresponding nodes of adjacent time windows within the same frequency band, and the frequency edges represent the frequency-domain relationship between corresponding nodes of adjacent frequency bands within the same time window. The node features of the graph structure include the average power value of each time frame within the time-frequency interval in the corresponding frequency band. The edge features of the graph structure include the first difference between the average power values of the node features. The graph structure and the energy decay rate are input into a deep learning model, and a prediction probability is obtained through the deep learning model. The prediction probability is used to determine whether the safety valve is leaking.
2. The method according to claim 1, characterized in that, The deep learning model includes a graph attention network, which comprises a linear mapping layer, a branch mapping layer, a graph attention layer, a global average pooling layer, a fully connected layer, and an output layer. The step of inputting the graph structure and the energy decay rate into the deep learning model to obtain the predicted probability includes: The node features are input into the linear mapping layer, and the query vector, key vector, and value vector corresponding to the node features are obtained through the linear mapping layer. Based on the energy decay rate, each feature component in the edge feature is processed element by element to obtain the enhanced feature; The enhancement feature is input to the branch mapping layer, and the first enhancement feature is obtained through the first branch model in the branch mapping layer. The second enhancement feature is obtained through the second branch model in the branch mapping layer. The first enhancement feature represents the correlation feature between corresponding nodes of adjacent time windows in the same frequency band under ultrasonic energy attenuation. The second enhancement feature represents the correlation feature between corresponding nodes of adjacent frequency bands in the same time window under ultrasonic energy attenuation. Based on the query vector, the key vector, the first enhanced feature, and the second enhanced feature, attention weights are obtained through the graph attention layer. The attention weights include a first attention weight and a second attention weight. The first attention weight is obtained based on the first enhanced feature, and the second attention weight is obtained based on the second enhanced feature. Based on the value vector, the first attention weight and the second attention weight are weighted and aggregated to obtain aggregated features, and the node fusion features are obtained according to the aggregated features and the node features; The fused features are input into the global average pooling layer, and graph-level features are obtained through the global average pooling layer. The graph-level features are input into the fully connected layer, and the predicted value is obtained through the fully connected layer. Based on the predicted value, the predicted probability is obtained through the output layer.
3. The method according to claim 2, characterized in that, The step of weighting and aggregating the first attention weight and the second attention weight based on the value vector to obtain aggregated features, and obtaining fused features of nodes based on the aggregated features and the node features, includes: Based on the value vector, the first attention weights are weighted and aggregated to obtain the first aggregated feature; The first aggregated feature is mapped to the same feature space as the node feature, and the node feature is fused with the mapped first aggregated feature to obtain a first fused feature. The first fused feature characterizes the time variation feature within the frequency band corresponding to the node. Based on the first fusion feature, the second attention weights are weighted and aggregated to obtain the second aggregated feature; The second aggregated feature is fused with the first fused feature to obtain the second fused feature, which characterizes the frequency correlation features between the node and adjacent frequency bands based on time variation.
4. The method according to claim 2, characterized in that, The process of obtaining attention weights through the graph attention layer based on the query vector, the key vector, the first enhanced feature, and the second enhanced feature includes: Based on the query vector, the key vector, and the first enhanced feature, an attention score is calculated through the graph attention layer to obtain a first attention score, and the first attention score is normalized to obtain a first attention weight. Based on the query vector, the key vector, and the second enhanced feature, an attention score is calculated through the graph attention layer to obtain a second attention score, and the second attention score is normalized to obtain a second attention weight.
5. The method according to claim 1, characterized in that, The step of calculating ultrasonic energy based on the transmitted signal and the received signal, obtaining the transmitted energy and the received energy respectively, and obtaining the energy attenuation rate based on the transmitted energy and the received energy includes: The transmitted signal and the received signal are respectively subjected to DC component removal and bandpass filtering to obtain the processed transmitted signal and the processed received signal. Based on the time series of the processed transmitted signal, the sampling time corresponding to the first occurrence of the half-peak is determined to obtain the first sampling time, and the sampling time corresponding to the last occurrence of the half-peak is determined to obtain the second sampling time. Based on the first sampling time and the second sampling time, the signal interval corresponding to the processed transmitted signal is determined to obtain the first interval signal; Perform cross-correlation calculation on the first interval signal and the processed received signal, and determine the third sampling time based on the maximum value of the cross-correlation calculation result; Based on the time series of the processed received signal, the second interval signal is determined with the third sampling time as the midpoint time. The time series length of the second interval signal is the same as that of the first interval signal. Calculate the sum of squares of the signal amplitudes of the first interval signal and the second interval signal to obtain the transmitted energy and the received energy, respectively. The energy attenuation rate is obtained by calculating the ratio of the received energy to the transmitted energy.
6. The method according to claim 1, characterized in that, Before acquiring the ultrasonic signal and acoustic emission signal of the safety valve during the detection cycle, the method further includes: Acquire historical ultrasonic signals, historical acoustic emission signals, and actual leakage status of the safety valve within a historical detection period. The historical ultrasonic signals include historical emission signals and historical received signals. The historical acoustic emission signal is processed by short-time Fourier transform to obtain the first historical time-frequency diagram; Based on the historical transmitted signal and the historical received signal, the ultrasonic energy is calculated to obtain the historical transmitted energy and the historical received energy, and the historical energy attenuation rate is obtained based on the historical transmitted energy and the historical received energy. Based on the historical first time-frequency map, a historical graph structure is constructed. The nodes of the historical graph structure are the historical time-frequency intervals formed by time windows and frequency bands in the historical first time-frequency map. The edges of the historical graph structure include time edges and frequency edges. The time edges represent the time-domain relationship between corresponding nodes of adjacent time windows within the same frequency band, and the frequency edges represent the frequency-domain relationship between corresponding nodes of adjacent frequency bands within the same time window. The historical node features of the historical graph structure include the average power value of each time frame in the historical time-frequency interval within the corresponding frequency band. The historical edge features of the historical graph structure include the historical first difference of the average power values between the historical node features. The historical graph structure, the historical energy decay rate, and the actual leakage state are integrated into training data; The deep learning model is trained and initialized based on the training data, so that after the graph structure and the energy decay rate are input into the deep learning model, the deep learning model outputs the predicted probability.
7. An electronic device, characterized in that, The electronic device includes a processor and a memory coupled together, the memory storing a computer program that, when executed by the processor, causes the electronic device to perform the method as described in any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1 to 6.
9. A program product, characterized in that, It includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 6.
