Periodically repeated signal identification and accidental anomaly detection method

By using the Gaussian weighted KNN algorithm in the oscilloscope to construct a comparison data set and perform signal normalization processing, the problem of low efficiency in identifying periodic repetitive signals in the existing technology is solved, and high-accuracy signal identification and anomaly detection are achieved. Improved fault diagnosis efficiency.

CN118626979APending Publication Date: 2024-09-10UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410653390.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing oscilloscopes have insufficient efficiency and accuracy in identifying periodic and recurring abnormal signals, and are particularly difficult to automate in complex electronic systems, resulting in low fault diagnosis efficiency and limited system reliability.

Method used

The KNN algorithm based on Gaussian weighting is used to construct a comparison data set, sample and divide standard sine waves and triangle waves, normalize sample signals and intercept test sequences, and use Euclidean distance and Gaussian weighting processing to achieve signal identification and anomalies detection.

Benefits of technology

It improves the recognition accuracy of periodic repetitive signals, reduces errors caused by human eye recognition, improves diagnostic efficiency and accuracy, and adapts to complex signal analysis needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626979A
    Figure CN118626979A
Patent Text Reader

Abstract

The invention discloses a periodic repetition signal identification and accidental anomaly detection method, which comprises the following steps of: sampling standard sine waves and triangular waves, and constructing a comparison set for signal identification; the method comprises the following steps of: acquiring a to-be-identified sample signal, normalizing the sample signal, intercepting a test sequence according to a zero crossing point, and comparing the test sequence with a sampling sequence in a comparison set to complete identification and accidental anomaly detection of the sample signal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of oscilloscopes, and more specifically, relates to a method for identifying periodic repetitive signals and detecting occasional anomalies. Background Art

[0002] Introducing the function of identifying periodically repetitive abnormal signals into oscilloscopes has far-reaching practical significance and important value. First of all, this function significantly improves the efficiency and accuracy of fault diagnosis.

[0003] In modern electronic systems, especially in areas with high reliability requirements (such as aerospace, medical equipment, and automotive safety systems), occasional abnormal signals often indicate potential failures or problems. By automatically identifying these anomalies, oscilloscopes can help engineers quickly locate and solve these problems, thereby reducing system downtime and maintenance costs. Secondly, this capability is essential to ensure system reliability and safety. In some critical applications, timely detection and processing of these abnormal signals can prevent serious failures and accidents. Furthermore, with the increasing complexity of electronic systems, manual identification of abnormal signals has become increasingly difficult and unreliable.

[0004] Therefore, automated abnormal signal recognition not only improves the efficiency of diagnosis, but also provides a powerful tool for non-expert users, enabling them to use oscilloscopes more effectively for fault diagnosis and system testing. In addition, with the rapid development of communication technology, especially in the fields of 5G and the Internet of Things (IoT), there is a growing demand for efficient and accurate signal analysis tools. In this context, oscilloscopes with advanced signal recognition capabilities will become particularly important, as they can provide engineers with deeper insights and help them cope with more complex technical challenges. Therefore, from improving work efficiency and ensuring system stability to adapting to the needs of technological development, the introduction of the recognition function of periodically repetitive occasional abnormal signals in oscilloscopes is an important step in the development of the field of electronic measurement.

[0005] In actual engineering, if only manual debugging and visual recognition of the waveform are performed, the recognition rate will be reduced. Therefore, the introduction of machine learning methods can effectively improve the recognition efficiency and accuracy. Summary of the invention

[0006] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method for periodic repetitive signal recognition and occasional anomaly detection, which realizes high-accuracy recognition of periodic repetitive signals based on Gaussian weighted KNN algorithm.

[0007] To achieve the above-mentioned object of the invention, the present invention provides a method for identifying periodic repetitive signals and detecting occasional anomalies, characterized in that it comprises the following steps:

[0008] (1) Construct a comparison dataset;

[0009] (1.1) Data collection;

[0010] Using mathematical tools, the standard sine wave and triangle wave are sampled at the left and right halves, upper and lower halves, and a quarter of the waveform to obtain multiple sampling sequences, each of which has a length of m.

[0011] (1.2), comparison set division;

[0012] The two-end waveforms from the zero-crossing point to the maximum value point and then to the zero-crossing point, and from the zero-crossing point to the minimum value point and then to the zero-crossing point are used as the upper and lower half comparison sets;

[0013] From the minimum point to the zero point and then to the maximum point, and from the maximum point to the zero point and then to the minimum point as the left and right half comparison set;

[0014] Divide the sampling points of a quarter-cycle waveform into comparison sets:

[0015] The sampling points of the quarter-cycle waveform changing from the maximum point to the zero-crossing point are set as training set a, the sampling points of the quarter-cycle waveform changing from the zero-crossing point to the minimum point are set as training set b, the sampling points of the quarter-cycle waveform changing from the minimum point to the zero-crossing point are set as training set c, and the sampling points of the quarter-cycle waveform changing from the zero-crossing point to the maximum point are set as training set d;

[0016] (2) Data collection and preprocessing;

[0017] (2.1) Use ADC to sample the sine wave, triangle wave or square wave respectively to obtain the sample sequence {x i};

[0018] (2.2), the sample sequence {x i} is input to the top_percent function to obtain the sample absolute value sequence {|x i |};

[0019] Calculate the average value of each element in the sample absolute value sequence Then each element in the sample absolute value sequence |x i Divide by the mean Get the value y i ;

[0020] Statistical value y iThe percentage of the number of values ​​greater than 0.8 and less than 1.2 in the total length of the sequence. If the percentage exceeds 75%, the sample sequence is determined to be a square wave sequence, and the output result is displayed as a square wave, and the subsequent sine wave and triangle wave identification is not performed; otherwise, the triangle wave and sine wave are identified, and the step (3) is entered;

[0021] (3) Periodicity determination and normalization of sample sequences;

[0022] (3.1), the sample sequence {x i} Input to find_valleyandpeaks function, according to data x i The positive and negative values ​​are converted into a Boolean array {t i};

[0023]

[0024] Among them, FULSE represents error and TREE represents correct;

[0025] (3.2) Use np.where function to count {t i}, if the number of zero-crossing points exceeds three, then the sample sequence {x i} contains a complete cycle, then go to step (3.3); otherwise, determine the sample sequence {x i} does not have a complete cycle, then go to step (3.4);

[0026] (3.3), according to the zero-crossing point in the sample sequence {x i}, record the distance crossing_length between two adjacent zero crossing points:

[0027]

[0028] Among them, k represents the number of zero-crossing points, and crossing[k] represents the number of zero-crossing points in the original sample sequence {x i} in the position;

[0029] For the sample sequence {x i} to normalize the data: transform the sample sequence {x i} Divide each element by the maximum value to obtain the normalized standard sequence

[0030] (3.4), for the sample sequence {x i} is smoothed, and then the number of maximum values ​​is counted. If the number of maximum values ​​is not 0, the sample sequence {x i Divide each element in} by the maximum value to obtain the standard sequence after the maximum value is normalized

[0031] Otherwise, it is determined that the maximum value does not exist, and the maximum amplitude value |x| is selected. max , then the sample sequence {x i}divide each element by the maximum value |x| max , get the standard sequence after the maximum value normalization

[0032] (4) Intercept the test sequence;

[0033] (4.1), determine the sample sequence {x i}Whether it has a complete cycle;

[0034] When the number of zero-crossing points is less than 2, the sample sequence {x i} does not have a complete period, go to step (4.2); if the sample sequence {x i}, the number of zero crossings is greater than or equal to 2, first calculate the cycle length L, L = crossing_length * 2, if the cycle length L is greater than {x i}, then the sample sequence {x i} has a complete cycle, go to step (4.5); otherwise, determine whether the sample sequence {x i} does not have a complete cycle, go to step (4.2);

[0035] (4.2) Statistics of the entire standard sequence The proportion of data with different signs in the total data. If the proportion is less than 10%, it is determined that the sample sequence has no zero crossing point and the waveform length will not exceed half a period, and the process goes to step (4.3); otherwise, it is determined that the sample sequence contains a zero crossing point and the waveform length exceeds half a period, and the process goes to step (4.4);

[0036] (4.3), calculate the standard sequence Starting point x1, end point x n and the middle x n / 2 The derivative of the point is then multiplied. If the product is greater than or equal to zero, it is determined that the sample sequence does not include the maximum point or one of the starting point and the end point is the maximum point. At this time, the waveform shape of the sample sequence is considered to be similar to the quarter-cycle waveform, and the sample sequence {x i} as the test sequence; then determine the starting point x1, the end point x n The positive or negative value of the sample sequence is used to determine whether the waveform shape of the sample sequence is a quarter waveform located at the rising edge or the falling edge:

[0037] If the amplitude difference between the starting point and the second point is greater than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in comparison set a;

[0038] If the amplitude difference between the starting point and the second point is greater than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in the comparison set b;

[0039] If the amplitude difference between the starting point and the second point is smaller than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in the comparison set c;

[0040] If the amplitude difference between the starting point and the second point is smaller than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in the comparison set d;

[0041] If the product is less than zero, it is determined that the sample sequence includes extreme points and does not contain zero crossings. At this time, it is considered that the waveform shape of the sample sequence is similar to the upper and lower half cycle waveforms;

[0042] Furthermore, when the product is less than zero and the starting point and the end point are not zero points, the maximum or minimum value in the sample sequence waveform is counted; when the sample sequence waveform contains only the maximum value or only the minimum value, the length of the sequence on the left and right ends of the extreme value point is compared, and the longer section is selected as the test sequence; if it contains both the maximum value and the minimum value, the sequence between the two extreme values ​​is intercepted as the test sequence; if it contains neither the maximum value nor the minimum value, the sequence between the maximum value and the minimum value is selected as the test sequence;

[0043] (4.4), and the standard sequence is calculated in the same way Starting point x1, end point x n and the middle x n / 2 The derivative of the point is then multiplied. If the product is greater than or equal to zero, the sample sequence is determined to be monotonic and similar to the waveform of the left and right half period, and further compared with the standard sequence The proportion of negative numbers in the total data. If the proportion is greater than 50%, the sample sequence {x i} by dividing each element by the minimum value |x| min , otherwise, the sample sequence {x i}divide each element by the maximum value |x| max , again for the sample sequence {x i Normalize the data;

[0044] If the product is less than zero, it is determined that the sample sequence includes a maximum value and a minimum value, and the waveform is intercepted from the coordinates of the maximum value and the minimum value of the sample sequence respectively, and then the sequence with the longest data volume is selected as the test sequence;

[0045] (4.5), if the sample sequence {x i If there is no zero point, the sample sequence period is judged incorrectly and the sample sequence is discarded;

[0046] If the sample sequence {x i} contains only one zero-crossing point, the waveform from the starting point to the zero-crossing point is intercepted as the test sequence;

[0047] If the sample sequence {x i} contains two zero crossing points, the waveform between the first zero crossing point and the second zero crossing point is intercepted as the test sequence;

[0048] If the sample sequence {x i If there are more than two zero-crossing points in}, the waveform between two adjacent zero-crossing points is intercepted as the test sequence;

[0049] (5) Perform extraction or interpolation processing on the test sequence;

[0050] If the number of points in the test sequence is less than the number of points in the sampling sequence m, the test sequence is linearly interpolated using the following formula:

[0051]

[0052] Among them, xnew k represents the value of the kth point after interpolation of the test sequence, x i represents the value of the i-th point in the test sequence, and n represents the number of data points in the test sequence;

[0053] If the number of points in the test sequence is greater than the number of points in the sampling sequence m, the test sequence is sampled using the following formula:

[0054]

[0055] xnew k =x1+k*d, k=1,2,…,m

[0056] Among them, xnew k The value of the kth point after the test sequence is drawn, and d is the intermediate variable;

[0057] (6) Identification of test sequence types;

[0058] Compare the test sequence after extraction or interpolation with each sampling sequence in the corresponding comparison set, calculate the Euclidean distance of the corresponding data points, then sum the Euclidean distances of m groups of corresponding data points, and select the sampling sequence with the smallest distance as the result of the identification type;

[0059] (7) Gaussian weighted processing of test sequences;

[0060] Perform Gaussian weighting on the test sequence after extraction or interpolation processing and each sampling sequence in the corresponding comparison set;

[0061]

[0062]

[0063] Among them, F is the Gaussian weight, which is the probability of judging that the sequence belongs to a certain category; f(x k ) represents the data point x in the test sequence k The distance value weight, x i represents the value of the i-th data point of any sampling sequence in the comparison set, and a and c are coefficients;

[0064] (8) Occasional anomaly detection;

[0065] The test sequence is compared with each sampling sequence in the corresponding comparison set. If the sum of the Euclidean distances of the data points between the test sequence and each sampling sequence in the comparison set exceeds the threshold, the current waveform is judged to be abnormal, that is, the current waveform does not match any type of waveform.

[0066] For a sequence containing multiple zero-crossing points, if the waveforms between two adjacent zero-crossing points are identified as different types, the current waveform is directly judged to be abnormal; if the waveforms between two adjacent zero-crossing points are identified as the same type, but the difference in Gaussian weighting F is greater than five percent, the current waveform is also judged to be abnormal.

[0067] The object of the invention of the present invention is achieved in this way:

[0068] The present invention discloses a method for identifying periodic repetitive signals and detecting occasional anomalies. The method first samples standard sine waves and triangle waves to construct a comparison set for signal identification. Then, a sample signal to be identified is collected, and then the sample signal is normalized. A test sequence is intercepted according to a zero-crossing point. Finally, the test sequence is compared with a sampling sequence in a comparison set to complete the identification of the sample signal and the detection of occasional anomalies.

[0069] At the same time, the method for periodic repetitive signal recognition and occasional anomaly detection of the present invention also has the following beneficial effects:

[0070] (1) By using the Gaussian weighted KNN algorithm, high-accuracy recognition of periodic repetitive signals is achieved, avoiding the discrimination error caused by human eye experience recognition;

[0071] (2) Compared with the simple voting of the traditional KNN algorithm, the use of Gaussian weighting in possibility judgment increases the influence of location information on recognition possibility and improves recognition efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] Figure 1 It is a flow chart of a method for periodic repetitive signal recognition and occasional anomaly detection of the present invention;

[0073] Figure 2 This is an example graph of the upper and lower half alignment set;

[0074] Figure 3 This is an example graph of the left and right half alignment set;

[0075] Figure 4 This is the recognition result diagram of the square wave signal;

[0076] Figure 5 This is the recognition result diagram of the sine wave;

[0077] Figure 6 This is the recognition result diagram of the triangle wave. DETAILED DESCRIPTION

[0078] The specific implementation of the present invention is described below in conjunction with the accompanying drawings so that those skilled in the art can better understand the present invention. It should be noted that in the following description, when the detailed description of known functions and designs may dilute the main content of the present invention, these descriptions will be omitted here.

[0079] Example

[0080] Figure 1 The present invention is a flow chart of a method for periodic repetitive signal recognition and occasional anomaly detection.

[0081] In this embodiment, if Figure 1 As shown, the present invention provides a method for identifying periodic repetitive signals and detecting occasional anomalies, comprising the following steps:

[0082] S1, build comparison data set;

[0083] S1.1, data collection;

[0084] MATLAB is used to sample the standard sine wave and triangle wave at the left and right halves, upper and lower halves, and a quarter of the waveform to obtain multiple sampling sequences, each with a length of 50.

[0085] S1.2, comparison set division;

[0086] The waveforms at both ends from the zero crossing point to the maximum point and then to the zero crossing point, and from the zero crossing point to the minimum point and then to the zero crossing point are taken as the upper and lower half comparison sets. For example, the upper and lower half comparison sets are Figure 2 As shown;

[0087] From the minimum point to the zero point and then to the maximum point, and from the maximum point to the zero point and then to the minimum point as the left and right half comparison set, where the left and right half comparison set is as follows: Figure 3 As shown;

[0088] Divide the sampling points of a quarter-cycle waveform into comparison sets:

[0089] The sampling points of the quarter-cycle waveform changing from the maximum point to the zero-crossing point are set as training set a, the sampling points of the quarter-cycle waveform changing from the zero-crossing point to the minimum point are set as training set b, the sampling points of the quarter-cycle waveform changing from the minimum point to the zero-crossing point are set as training set c, and the sampling points of the quarter-cycle waveform changing from the zero-crossing point to the maximum point are set as training set d;

[0090] S2, data collection and preprocessing;

[0091] S2.1. Use ADC to sample the sine wave, triangle wave or square wave respectively to obtain the sample sequence {x i};

[0092] S2.2, the sample sequence {x i} is input to the top_percent function to obtain the sample absolute value sequence {|x i |};

[0093] Calculate the average value of each element in the sample absolute value sequence Then each element in the sample absolute value sequence |x i Divide by the mean Get the value y i ;

[0094] In this embodiment, the shape characteristics of the square wave are quite different from those of the triangle wave and the sine wave, so first determine whether it is a square wave sequence. The square wave sequence is characterized by the fact that most of the data is at the peak or trough position, while in the absolute value sequence of the square wave, most of the data is near the peak, so most of the data at the peak is at the average value. Fluctuation nearby.

[0095] Therefore, we only need to count the values ​​y i The percentage of the number of values ​​greater than 0.8 and less than 1.2 in the total length of the sequence. If the percentage exceeds 75%, the sample sequence is determined to be a square wave sequence, and the output result is displayed as a square wave. The subsequent sine wave and triangle wave identification is not performed, and the identification ends; otherwise, the identification of triangle wave and sine wave is entered, and the step S3 is entered;

[0096] S3, sample sequence periodicity identification and normalization processing;

[0097] S3.1. Substitute the sample sequence {x i} Input to find_valleyandpeaks function, according to data x i The positive and negative values ​​are converted into a Boolean array {t i};

[0098]

[0099] Among them, FULSE represents error and TREE represents correct;

[0100] S3.2, use np.where function to count {t i}, if the number of zero-crossing points exceeds three, then the sample sequence {x i} contains a complete cycle, then proceed to step S3.3; otherwise, determine whether the sample sequence {x i} does not have a complete cycle, then enter step S3.4;

[0101] In this embodiment, the KNN algorithm is a distance discrimination type based on the sample sequence. In order to reduce the influence of the relative size of the signal value on the discrimination distance, the overall shape of the data of the sample sequence needs to be unified, so the following normalization processing is required;

[0102] S3.3, according to the zero-crossing point in the sample sequence {x i}, record the distance crossing_length between two adjacent zero crossing points:

[0103]

[0104] Among them, k represents the number of zero-crossing points, and crossing[k] represents the number of zero-crossing points in the original sample sequence {x i} in the position;

[0105] For the sample sequence {x i} to normalize the data: transform the sample sequence {x i} Divide each element by the maximum value to obtain the normalized standard sequence

[0106] S3.4, for the sample sequence {x i} is smoothed, and then the number of maximum values ​​is counted. If the number of maximum values ​​is not 0, the sample sequence {x i Divide each element in} by the maximum value to obtain the standard sequence after the maximum value is normalized

[0107] Otherwise, it is determined that the maximum value does not exist, and the maximum amplitude value |x| is selected. max , then the sample sequence {x i}divide each element by the maximum value |x| max , get the standard sequence after maximum normalization

[0108] S4, intercept the test sequence;

[0109] S4.1. Determine the sample sequence {x i}Whether it has a complete cycle;

[0110] When the number of zero-crossing points is less than 2, the sample sequence {x i} does not have a complete cycle, go to step S4.2; if the sample sequence {x i}, the number of zero crossings is greater than or equal to 2, first calculate the cycle length L, L = crossing_length * 2, if the cycle length L is greater than {x i}, then the sample sequence {x i} has a complete cycle, go to step S4.5; otherwise, determine that the sample sequence {x i} does not have a complete cycle, go to step S4.2;

[0111] S4.2. Statistics of the entire standard sequence The proportion of data with different signs in the total data is determined. If the proportion is less than 10%, it is determined that the sample sequence has no zero crossing point and the waveform length does not exceed half a period, and the process goes to step S4.3; otherwise, it is determined that the sample sequence has a zero crossing point and the waveform length exceeds half a period, and the process goes to step S4.4;

[0112] S4.3. Calculation of standard sequence Starting point x1, end point x n and the middle x n / 2 The derivative of the point is then multiplied. If the product is greater than or equal to zero, it is determined that the sample sequence does not include the maximum point or one of the starting point and the end point is the maximum point. At this time, the waveform shape of the sample sequence is considered to be similar to the quarter-cycle waveform, and the sample sequence {x i} as the test sequence; then determine the starting point x1, the end point x n The positive or negative value of the sample sequence is used to determine whether the waveform shape of the sample sequence is a quarter waveform located at the rising edge or the falling edge:

[0113] If the amplitude difference between the starting point and the second point is greater than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in comparison set a;

[0114] If the amplitude difference between the starting point and the second point is greater than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in the comparison set b;

[0115] If the amplitude difference between the starting point and the second point is smaller than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in the comparison set c;

[0116] If the amplitude difference between the starting point and the second point is smaller than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in the comparison set d;

[0117] If the product is less than zero, it is determined that the sample sequence includes extreme points and does not contain zero crossings. At this time, it is considered that the waveform shape of the sample sequence is similar to the upper and lower half cycle waveforms;

[0118] Furthermore, when the product is less than zero and the starting point and the end point are not zero points, the maximum or minimum value in the sample sequence waveform is counted; when the sample sequence waveform contains only the maximum value or only the minimum value, the length of the sequence on the left and right ends of the extreme value point is compared, and the longer section is selected as the test sequence; if it contains both the maximum value and the minimum value, the sequence between the two extreme values ​​is intercepted as the test sequence; if it contains neither the maximum value nor the minimum value, the sequence between the maximum value and the minimum value is selected as the test sequence;

[0119] S4.4. Calculate the standard sequence in the same way Starting point x1, end point x n and the middle x n / 2 The derivative of the point is then multiplied. If the product is greater than or equal to zero, the sample sequence is determined to be monotonic and similar to the waveform of the left and right half period, and further compared with the standard sequence The proportion of negative numbers in the total data. If the proportion is greater than 50%, the sample sequence {x i} by dividing each element by the minimum value |x| min , otherwise, the sample sequence {x i}divide each element by the maximum value |x| max , again for the sample sequence {x i Normalize the data;

[0120] If the product is less than zero, it is determined that the sample sequence includes a maximum value and a minimum value, and the waveform is intercepted from the coordinates of the maximum value and the minimum value of the sample sequence respectively, and then the sequence with the longest data volume is selected as the test sequence;

[0121] S4.5. If the sample sequence {x i If there is no zero point, the sample sequence period is judged incorrectly and the sample sequence is discarded;

[0122] If the sample sequence {x i} contains only one zero-crossing point, the waveform from the starting point to the zero-crossing point is intercepted as the test sequence;

[0123] If the sample sequence {x i} contains two zero crossing points, the waveform between the first zero crossing point and the second zero crossing point is intercepted as the test sequence;

[0124] If the sample sequence {x i If there are more than two zero-crossing points in}, the waveform between two adjacent zero-crossing points is intercepted as the test sequence;

[0125] S5, performing extraction or interpolation processing on the test sequence;

[0126] Since it is necessary to compare the test sequence and the sampling sequence in the comparison set point by point when using KNN, it is necessary to determine the number of points contained in each sampling sequence so as to keep the test sequence consistent with its number of points. When selecting the number of points, the discrimination speed and discrimination accuracy should also be considered in total. By testing the number of points in different comparison sets, it is found that setting the number of points in the sampling sequence to 50 has a better effect. It will not cause a slow processing speed due to a large number of selected points, nor will it cause a large error in waveform information recognition due to too small a number of sampling points.

[0127] If the number of points in the test sequence is less than the number of points in the sampling sequence, the test sequence is linearly interpolated using the following formula:

[0128]

[0129] Among them, xnew k represents the value of the kth point after interpolation of the test sequence, x i represents the value of the i-th point in the test sequence, and n represents the number of data points in the test sequence;

[0130] If the number of points in the test sequence is greater than the number of points in the sampling sequence, the test sequence is sampled using the following formula:

[0131]

[0132] xnew k =x1+k*d, k=1,2,…,50

[0133] Among them, xnew k The value of the kth point after the test sequence is drawn, and d is the intermediate variable;

[0134] S6, identification of the type of test sequence;

[0135] Compare the test sequence after extraction or interpolation with each sampling sequence in the corresponding comparison set, calculate the Euclidean distance of the corresponding data points, and then sum the Euclidean distances of 50 groups of corresponding data points, and select the sampling sequence with the smallest distance as the result of identification type. If the sampling sequence with the smallest distance is a triangle wave, it is identified as a triangle wave category. If the sampling sequence with the smallest distance is a sine wave, it is identified as a sine wave category.

[0136] S7, Gaussian weighted processing of test sequence;

[0137] In actual projects, the waveform may not be completely standard, and there may be noise and burr signals. At the same time, due to bandwidth limitations, the high-order harmonics of the square wave may not be collected, making the square wave and the sine wave more similar. In this case, it is more important to determine the possibility of the waveform. Simply put, if the program can let the user know the percentage of probability of determining that the current waveform is a sine wave and the percentage of probability of being a triangle wave, it can effectively improve the accuracy of the judgment. Directly making a positive judgment may have the risk of misjudgment.

[0138] The traditional KNN algorithm has certain limitations for signal classification. If the k value of the output result is directly used as the input for calculating the percentage with equal importance, the use of distance information is greatly lost, resulting in a large distortion of the judgment result. Because in the Euclidean distance calculation, the smallest k value corresponds to the greatest classification possibility, that is, the waveform in the current input and the comparison set has the greatest shape similarity. Based on the different distances between the sampling sequence waveforms in the comparison set from the test training to each different shape, the output k value should not only be simply added to one statistics, but also adjusted in weight. Through the Gaussian weighted KNN algorithm, the Gaussian function is used to optimize the weights of samples of different distances. The weights of closer neighbors are increased accordingly. When the distance between the sampling sequence and the test sequence increases, the weight of the distance value decreases, and the weighted average is finally calculated.

[0139] Then, the test sequence after extraction or interpolation is subjected to Gaussian weighting processing with each sampling sequence in the corresponding comparison set;

[0140]

[0141]

[0142] Among them, F is the Gaussian weight, which is the probability of judging that the sequence belongs to a certain category; f(x k ) represents the data point x in the test sequence k The distance value weight, x i represents the value of the i-th data point of any sampling sequence in the comparison set, a and c are coefficients, and their values ​​are 1 and 2 respectively;

[0143] S8, occasional anomaly detection;

[0144] The test sequence is compared with each sampling sequence in the corresponding comparison set. If the sum of the Euclidean distances of the data points between the test sequence and each sampling sequence in the comparison set exceeds the threshold, the current waveform is judged to be abnormal, that is, the current waveform does not match any type of waveform.

[0145] For a sequence containing multiple zero-crossing points, if the waveforms between two adjacent zero-crossing points are identified as different types, the current waveform is directly judged to be abnormal; if the waveforms between two adjacent zero-crossing points are identified as the same type, but the difference in Gaussian weighting F is greater than five percent, the current waveform is also judged to be abnormal.

[0146] Finally, the software code of the present invention is called by an industrial computer, and the square wave, sine wave and triangle wave sequences sampled by the ADC are input into the algorithm, and the following can be obtained: Figure 4 , 5 , 6 shows the high accuracy recognition results, where Figure 4 is the recognition result of the square wave, Figure 5 is the recognition result of the sine wave, Figure 6 It is the recognition result of triangle wave.

[0147] Although the above describes the illustrative specific embodiments of the present invention to facilitate those skilled in the art to understand the present invention, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations using the concept of the present invention are protected.

Claims

1. A method for identifying periodic repetitive signals and detecting occasional anomalies, characterized in that: The following steps are involved: (1) Construct a comparison dataset; (1.1) Data collection; Using mathematical tools, the standard sine wave and triangle wave are sampled at the left and right halves, upper and lower halves, and a quarter of the waveform to obtain multiple sampling sequences, each of which has a length of m. (1.2), comparison set division; The two-end waveforms from the zero-crossing point to the maximum value point and then to the zero-crossing point, and from the zero-crossing point to the minimum value point and then to the zero-crossing point are used as the upper and lower half comparison sets; From the minimum point to the zero point and then to the maximum point, and from the maximum point to the zero point and then to the minimum point as the left and right half comparison set'' Divide the sampling points of a quarter-cycle waveform into comparison sets: The sampling points of the quarter-cycle waveform changing from the maximum point to the zero-crossing point are set as training set a, the sampling points of the quarter-cycle waveform changing from the zero-crossing point to the minimum point are set as training set b, the sampling points of the quarter-cycle waveform changing from the minimum point to the zero-crossing point are set as training set c, and the sampling points of the quarter-cycle waveform changing from the zero-crossing point to the maximum point are set as training set d; (2) Data collection and preprocessing; (2.1) Use ADC to sample the sine wave, triangle wave or square wave respectively to obtain the sample sequence {x i }; (2.2), the sample sequence {x i } is input to the top_percent function to obtain the sample absolute value sequence {x i |}; Calculate the average value of each element in the sample absolute value sequence Then each element in the sample absolute value sequence |x i Divide by the mean Get the value y i ; Statistical value y i The percentage of the number of values ​​greater than 0.8 and less than 1.2 in the total length of the sequence. If the percentage exceeds 75%, the sample sequence is determined to be a square wave sequence, and the output result is displayed as a square wave, and the subsequent sine wave and triangle wave identification is no longer performed; Otherwise, the process proceeds to the determination of triangle wave and sine wave, and then to step (3); (3) Periodicity determination and normalization of sample sequences; (3.1), the sample sequence {x i } Input to find_valleyandpeaks function, according to data x i The positive and negative values ​​are converted into a Boolean array {t i }; Among them, FULSE represents error and TREE represents correct; (3.2) Use np.where function to count {t i }, if the number of zero-crossing points exceeds three, then the sample sequence {x i } contains a complete cycle, then go to step (3.3); otherwise, determine the sample sequence {x i } does not have a complete cycle, then go to step (3.4); (3.3), according to the zero-crossing point in the sample sequence {x i }, record the distance crossing_length between two adjacent zero crossing points: Among them, k represents the number of zero-crossing points, and crossing[k] represents the number of zero-crossing points in the original sample sequence {x i } in the position; For the sample sequence {x i } to normalize the data: transform the sample sequence {x i } Divide each element by the maximum value to obtain the normalized standard sequence (3.4), for the sample sequence {x i } is smoothed, and then the number of maximum values ​​is counted. If the number of maximum values ​​is not 0, the sample sequence {x i Divide each element in} by the maximum value to obtain the standard sequence after the maximum value is normalized Otherwise, if the maximum value does not exist, the maximum amplitude value |x is selected. max , then the sample sequence {x i } by the maximum value |x max , get the standard sequence after the maximum value normalization (4) Intercept the test sequence; (4.1), determine the sample sequence {x i }Whether it has a complete cycle; When the number of zero-crossing points is less than 2, the sample sequence {x i } does not have a complete period, go to step (4.2); if the sample sequence {x i }, the number of zero crossings is greater than or equal to 2, first calculate the cycle length L, L = crossing_length * 2, if the cycle length L is greater than {x i }, then the sample sequence {x i } has a complete cycle, go to step (4.5); otherwise, determine whether the sample sequence {x i } does not have a complete cycle, go to step (4.2); (4.2) Statistics of the entire standard sequence The proportion of data with different signs in the total data. If the proportion is less than 10%, it is determined that the sample sequence has no zero crossing point and the waveform length will not exceed half a period, and the process goes to step (4.3); otherwise, it is determined that the sample sequence contains a zero crossing point and the waveform length exceeds half a period, and the process goes to step (4.4); (4.3), calculate the standard sequence Starting point x1, end point x n and the middle x n / 2 The derivative of the point is then multiplied. If the product is greater than or equal to zero, it is determined that the sample sequence does not include the maximum point or one of the starting point and the end point is the maximum point. At this time, the waveform shape of the sample sequence is considered to be similar to the quarter-cycle waveform, and the sample sequence {x i } as the test sequence; then determine the starting point x1, the end point x n The positive or negative value of the sample sequence is used to determine whether the waveform shape of the sample sequence is a quarter waveform located at the rising edge or the falling edge: If the amplitude difference between the starting point and the second point is greater than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in comparison set a; If the amplitude difference between the starting point and the second point is greater than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in the comparison set b; If the amplitude difference between the starting point and the second point is smaller than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in the comparison set c; If the amplitude difference between the starting point and the second point is smaller than the amplitude difference between the end point and the second to last point, then the waveform shape of the sample sequence is similar to the waveform in the comparison set d; If the product is less than zero, it is determined that the sample sequence includes extreme points and does not contain zero crossings. At this time, it is considered that the waveform shape of the sample sequence is similar to the upper and lower half cycle waveforms; Furthermore, when the product is less than zero and the starting point and the end point are not zero points, the maximum or minimum value in the sample sequence waveform is counted; when the sample sequence waveform contains only the maximum value or only the minimum value, the length of the sequence on the left and right ends of the extreme value point is compared, and the longer section is selected as the test sequence; if it contains both the maximum value and the minimum value, the sequence between the two extreme values ​​is intercepted as the test sequence; if it contains neither the maximum value nor the minimum value, the sequence between the maximum value and the minimum value is selected as the test sequence; (4.4), and the standard sequence is calculated in the same way Starting point x1, end point x n and the middle x n / 2 The derivative of the point is then multiplied. If the product is greater than or equal to zero, the sample sequence is determined to be monotonic and similar to the waveform of the left and right half period, and further compared with the standard sequence The proportion of negative numbers in the total data. If the proportion is greater than 50%, the sample sequence {x i } by dividing each element by the minimum value |x min , otherwise, the sample sequence {x i } by the maximum value |x max , again for the sample sequence {x i Normalize the data; If the product is less than zero, it is determined that the sample sequence includes a maximum value and a minimum value, and the waveform is intercepted from the coordinates of the maximum value and the minimum value of the sample sequence respectively, and then the sequence with the longest data volume is selected as the test sequence; (4.5), if the sample sequence {x i If there is no zero point, the sample sequence period is judged incorrectly and the sample sequence is discarded; If the sample sequence {x i } contains only one zero-crossing point, the waveform from the starting point to the zero-crossing point is intercepted as the test sequence; If the sample sequence {x i } contains two zero crossing points, the waveform between the first zero crossing point and the second zero crossing point is intercepted as the test sequence; If the sample sequence {x i If there are more than two zero-crossing points in}, the waveform between two adjacent zero-crossing points is intercepted as the test sequence; (5) Perform extraction or interpolation processing on the test sequence; If the number of points in the test sequence is less than the number of points in the sampling sequence m, the test sequence is linearly interpolated using the following formula: Among them, xnew k represents the value of the kth point after interpolation of the test sequence, x i represents the value of the i-th point in the test sequence, and n represents the number of data points in the test sequence; If the number of points in the test sequence is greater than the number of points in the sampling sequence m, the test sequence is sampled using the following formula: xnew k =x1+k*d,k=1,2,…,m Among them, xnew k The value of the kth point after the test sequence is drawn, and d is the intermediate variable; (6) Identification of test sequence types; Compare the test sequence after extraction or interpolation with each sampling sequence in the corresponding comparison set, calculate the Euclidean distance of the corresponding data points, then sum the Euclidean distances of m groups of corresponding data points, and select the sampling sequence with the smallest distance as the result of the identification type; (7) Gaussian weighted processing of test sequences; Perform Gaussian weighting on the test sequence after extraction or interpolation processing and each sampling sequence in the corresponding comparison set; Among them, F is the Gaussian weight, which is the probability of judging that the sequence belongs to a certain category; f(x k ) represents the data point x in the test sequence k The distance value weight, x i represents the value of the i-th data point of any sampling sequence in the comparison set, and a and c are coefficients; (8) Occasional anomaly detection; The test sequence is compared with each sampling sequence in the corresponding comparison set. If the sum of the Euclidean distances of the data points between the test sequence and each sampling sequence in the comparison set exceeds the threshold, the current waveform is judged to be abnormal, that is, the current waveform does not match any type of waveform. For a sequence containing multiple zero-crossing points, if the waveforms between two adjacent zero-crossing points are identified as different types, the current waveform is directly judged to be abnormal; if the waveforms between two adjacent zero-crossing points are identified as the same type, but the difference in Gaussian weighting F is greater than five percent, the current waveform is also judged to be abnormal.

Citation Information

Cited By

  • Method for capturing accidental abnormal signals of intelligent oscilloscope in real time

    CN119416117A