Analog quantity signal filtering automatic adjusting method, system, equipment and medium

By calculating the standard deviation of the analog signal and setting the confidence interval, the problems of frequency range limitation and signal lag in traditional filtering methods are solved, and high accuracy and real-time signal processing is achieved, which enhances the anti-interference ability and response speed of the system.

CN120034155AActive Publication Date: 2025-05-23SHENZHEN HAIGE JINGU CHEM TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510502393.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-05-23
Estimated Expiration
2045-04-22

AI Technical Summary

Technical Problem

Traditional analog signal filtering methods have problems such as frequency range limitation and signal lag, and cannot effectively deal with interfering signals and rapidly changing signals beyond a specific frequency range.

Method used

By calculating the standard deviation of the analog signal value of consecutive K times and setting the confidence interval based on the principle of normal distribution, it is determined whether the current signal is in the confidence interval. If it is not, filtering is performed to generate the second analog signal value and output it.

Benefits of technology

This method effectively filters out abnormal data, improves the accuracy and reliability of signal processing, avoids the problem of slow signal changes caused by frequency domain filtering, improves the system's response speed and real-time performance, enhances the anti-interference ability, and ensures the stability and reliability of the signal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120034155A_ABST
    Figure CN120034155A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to an analog quantity signal filtering automatic adjustment method, system and device and a medium, and the method comprises the steps: receiving a current analog quantity signal value; calculating the standard deviation of the analog quantity signal values for continuous K times before the current analog quantity signal value, wherein K is a natural number greater than 1; setting a confidence interval by using the standard deviation; judging whether the current analog quantity signal value is within the confidence interval or not; if the current analog quantity signal value is not in the confidence interval, filtering the current analog quantity signal value; and generating and outputting a second analog quantity signal value based on a result of the filtering processing. The confidence interval can be dynamically set by using the standard deviation, so that the system can adapt to different working condition changes, and a stable signal processing result is provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a method, system, device and medium for automatically adjusting analog signal filtering. Background Art

[0002] In the field of industrial automation and process control, the accuracy and stability of analog signals are crucial. Traditional analog filtering methods mainly rely on frequency characteristics to design filter circuits, such as low-pass, high-pass, band-pass and band-stop filters. These methods are effective within a specific frequency range, but have significant limitations. First, they can only process signals within a specific frequency range and cannot cope with interference signals outside this range. Secondly, in continuous control loops, frequency domain filters may introduce additional delays, affecting the response speed and control quality of the system, leading to signal lag problems, especially for rapidly changing signals (such as flow, current, etc.), causing operational inconveniences and even affecting equipment safety.

[0003] Therefore, the technical problems of frequency range limitation and signal lag in traditional filtering methods need to be solved urgently. Summary of the invention

[0004] The main purpose of the present application is to provide a method, system, device and medium for automatic adjustment of analog signal filtering, aiming to solve the technical problems of frequency range limitation and signal lag in traditional filtering methods.

[0005] In order to achieve the above-mentioned invention object, the present application proposes a method for automatically adjusting analog signal filtering, the method comprising: Receive the current analog signal value; Calculate the standard deviation of the analog signal values ​​of K consecutive times before the current analog signal value, where K is a natural number greater than 1; setting a confidence interval using the standard deviation; Determine whether the current analog signal value is within the confidence interval; If it is not within the confidence interval, filtering is performed on the current analog signal value; A second analog signal value is generated based on the result of the filtering process and is output.

[0006] Furthermore, the step of calculating the standard deviation of K consecutive analog signal values ​​before the current analog signal value includes: The analog signal value is collected based on the preset sampling frequency and time interval until the analog signal values ​​of K data points are collected; Calculate the average value of the analog signal values ​​corresponding to K data points; Calculate the square of the difference between the analog signal value of each data point and the average value, and calculate the corresponding variance; The standard deviation of K consecutive analog signal values ​​is obtained based on the variance calculation.

[0007] Furthermore, the step of setting the confidence interval using the standard deviation comprises: Setting the lower limit of the confidence interval PV-nσ and the upper limit of the confidence interval PV+nσ to obtain the confidence interval (PV-nσ, PV+nσ); Where PV is the average value of K analog signal values, σ is the standard deviation of K consecutive analog signal values, and n is the confidence level coefficient.

[0008] Furthermore, if the current analog signal value is not within the confidence interval, the step of filtering the current analog signal value comprises: When it is detected that the current analog signal value is not within the set confidence interval, the M consecutive analog signal values ​​before the current analog signal value are obtained, where M is a natural number greater than 1; Arrange the M analog signal values ​​in ascending or descending order according to their numerical values, calculate the intermediate value, and obtain the result of filtering processing.

[0009] Furthermore, if the current analog signal value is not within the confidence interval, the step of filtering the current analog signal value further includes: When it is detected that the current analog signal value is not within the set confidence interval, M consecutive analog signal values ​​before the current analog signal value are obtained, where M is a natural number greater than 1; Calculate the average value of M analog signal values ​​to obtain the result of filtering processing.

[0010] Furthermore, before the step of setting the lower limit PV-nσ of the confidence interval and the upper limit PV+nσ of the confidence interval to obtain the confidence interval (PV-nσ, PV+nσ), the following steps are included: Calculate the average value of K analog signal values; Calculating the deviation value between the standard deviation and the mean value; Based on the deviation value, a corresponding confidence level coefficient within a preset confidence level coefficient range is obtained to obtain a confidence level coefficient n, wherein the deviation value increases in direct proportion to the confidence level coefficient n.

[0011] Furthermore, after the step of receiving the current analog signal value, the following steps are included: Get the total number a of analog signal values ​​currently acquired; Determine whether the total number a is greater than K; If it is less than K, update K based on a, where a is a natural number greater than 1; If it is greater than k, the step of calculating the standard deviation of the K consecutive analog signal values ​​before the current analog signal value is executed.

[0012] The second aspect of the present application further provides an analog signal filtering automatic adjustment system, comprising: A receiving module is used to receive the current analog signal value; A calculation module, used for calculating the standard deviation of K consecutive analog signal values ​​before the current analog signal value, where K is a natural number greater than 1; A setting module, used for setting a confidence interval using the standard deviation; A judgment module, used to judge whether the current analog signal value is within the confidence interval; A filtering module, used for filtering the current analog signal value if it is not within the confidence interval; The adjustment module is used to adjust and generate a second analog signal value based on the result of the filtering process and output it.

[0013] The third aspect of the present application also includes a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.

[0014] The fourth aspect of the present application also includes a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of any of the above methods when executed by a processor.

[0015] Beneficial Effects This application can effectively screen out abnormal data and significantly improve the accuracy and reliability of signal processing by calculating the standard deviation of K consecutive analog signal values ​​and setting the confidence interval based on the normal distribution principle. The confidence interval is dynamically set using the standard deviation to ensure that the system can adapt to different working conditions and provide stable signal processing results. Compared with traditional frequency filters, this solution avoids the problem of slow signal changes caused by frequency domain filtering, especially when processing rapidly changing signals (such as flow, current, frequency, speed, etc.), reducing the lag effect in the control loop and improving the response speed and real-time performance of the system. When the current analog signal value is not within the confidence interval, the system immediately filters it and updates the output value based on the processing result to ensure the continuity and accuracy of signal processing. In addition, by performing median filtering or average filtering on the current analog signal value, the anti-interference ability is further enhanced, the stability and reliability of the signal are guaranteed, and the performance and safety of the entire control system are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A schematic diagram of a flow chart of an automatic adjustment method for analog signal filtering according to an embodiment of the present application; Figure 2This is a schematic block diagram of the structure of an analog signal filtering automatic adjustment system according to an embodiment of the present application; Figure 3 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.

[0017] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0019] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "above", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of features, integers, steps, operations, elements, modules, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, modules, components, and / or groups thereof. It should be understood that when an element is said to be "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any module and all combinations of one or more associated listed items.

[0020] Those skilled in the art will understand that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the field to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.

[0021] Reference Figure 1 The embodiment of the present invention provides a method for automatically adjusting analog signal filtering, comprising steps S1-S6, specifically: S1, receiving the current analog signal value; S2, calculate the standard deviation of K consecutive analog signal values; S3, setting a confidence interval using the standard deviation; S4, determining whether the current analog signal value is within the confidence interval; S5. If the current analog signal value is not within the confidence interval, filtering is performed on the current analog signal value; S6. Adjust and generate a second analog signal value based on the result of the filtering process and output it.

[0022] As described in the above steps S1-S2, first, the current newly entered analog signal value, that is, the analog signal value, is received, and the receiving process is continuous. Every time a new analog signal value is received, the standard deviation is calculated based on the current analog signal as the starting point and the first K consecutive analog signal values ​​of the current signal value, where K is a natural number greater than 1. In practical applications, in order to ensure that the collected data is representative and can reflect the stable state of the system, it is first necessary to set a suitable sampling frequency and time interval. Assuming that the selected sampling frequency is 10 times per second (which can be adjusted according to actual needs), and setting K to 50 times, it means that the analog signal values ​​of 50 consecutive data points will be collected. For example, in an industrial automation control system, these analog signals can be parameters such as temperature, pressure or flow detected by a sensor. The system begins to record the signal value collected each time according to the preset sampling frequency and time interval, and stores it in a temporary buffer or database. For example, assuming that the 50 signal values ​​collected in a certain time period are: 3.2V, 3.3V, 3.4V, ... 3.6V.

[0023] Next, we need to process these 50 data points to calculate the standard deviation. First, we calculate the mean value (PV) of these data points. The calculation formula is: , where x i represents the signal value collected for the i-th time, and K is the total number of collections. Assume that the calculated average value is 3.5V. Then, calculate the variance, which reflects the degree of dispersion of each data point relative to the average value. The specific steps are: calculate the square of the difference between each data point and the average value, sum them, and finally divide by the total number of data points to get the variance. The formula is: , assuming the calculated variance is 0.25. Based on the above variance, calculate the standard deviation σ. The standard deviation is an important indicator to measure the degree to which each value in the data set deviates from the average value. The calculation formula is: .

[0024] In addition, if the system does not reach the data point cache of K analog data values ​​before the current analog signal value at the initial start of the program, then at this time, it is determined that no filtering operation is performed, and the output is directly based on the current analog signal value; or K is changed from a preset value to an automatic assignment, that is, if K is assigned to 50 in the initial state, and the current analog signal value is the 31st analog signal value, then K is not enough to reach the preset data volume. At this time, K is assigned to 30, and the system directly obtains the first 30 analog signal values ​​for standard deviation calculation. Until the preset 50 analog signal values ​​are reached, the standard deviation calculation is continued based on the initial preset value, so as to achieve dynamic calculation.

[0025] This step not only provides a means to quantify the degree of data dispersion, but also lays the foundation for the setting of confidence intervals in subsequent steps. First, as an important indicator for measuring data fluctuations, standard deviation can help identify abnormal data that deviates from the normal range. By setting a reasonable threshold, noise and abnormal signals can be effectively filtered out, improving the accuracy and reliability of signal processing. Secondly, since the calculation of standard deviation and confidence interval is based on real-time collected data, this method can dynamically adapt to different working conditions and ensure reliable signal processing results under various conditions. In addition, compared with traditional frequency filters, this scheme avoids the problem of slow signal changes caused by frequency domain filtering by calculating standard deviation and setting confidence interval in time domain, and improves the response speed and real-time performance of the system. In summary, step S2 calculates the standard deviation of analog signal values ​​for K consecutive times, which not only provides key data support for subsequent steps, but also significantly improves the reliability and real-time performance of the entire signal filtering process, and is suitable for a variety of application scenarios that require high-precision signal processing. This process ensures that the system can maintain high-precision operation in a complex and changing environment and respond to any unexpected changes in a timely manner, thereby improving the performance and safety of the overall control system.

[0026] As described in step S3 above, in step S2, the standard deviation σ of the analog signal values ​​for K consecutive times has been successfully calculated. Next, based on the normal distribution principle, the standard deviation is used to set the confidence interval. Assuming that the selected confidence level coefficient n is 2 (which can be adjusted according to actual needs, for example, the value range of N is 1, 2, 3, 4), this means that a 95% confidence interval will be set. First, determine the average value PV, which is the average value of the analog signal values ​​for K consecutive times obtained from step S2. For example, assume that PV is 3.5V. Then, based on the normal distribution principle, the lower and upper limits of the confidence interval can be calculated by the following formula: confidence interval lower limit PV-nσ; confidence interval upper limit PV+nσ; where n is the confidence level coefficient and σ is the standard deviation. Assuming that the standard deviation σ is 0.5 and the confidence level coefficient n is 2, the lower limit of the confidence interval is: Therefore, the confidence interval is (2.5V, 4.5V). In this way, a reasonable range can be determined, within which the signal value is considered normal, and the signal value outside this range is considered to be an abnormal value. After setting the confidence interval, the system compares the current analog signal value with the interval to determine whether it is within the confidence interval. If the current analog signal value is between (2.5V, 4.5V), the signal value is considered to be credible and is directly output for subsequent calculations; otherwise, the system will further filter the signal value. This method based on the normal distribution principle has many advantages. First, it can effectively identify and exclude noise or abnormal signals that deviate from the normal range, thereby improving the accuracy of signal processing. Secondly, since the calculation of the standard deviation and confidence interval is based on real-time collected data, this method can dynamically adapt to different working conditions and ensure reliable signal processing results under various conditions. Compared with traditional frequency filters, this solution avoids the problem of slow signal changes caused by frequency domain filtering, especially when processing rapidly changing signals (such as flow, current, frequency, speed, etc.), reduces the hysteresis effect in the control loop, and improves the response speed and real-time performance of the system. In addition, by performing median filtering or average filtering on the current analog signal value, the anti-interference ability is further enhanced, the stability and reliability of the signal are guaranteed, and the performance and safety of the entire control system are improved. This method is not only suitable for industrial automation control systems, but can also be widely used in other fields that require high-precision signal processing, such as environmental monitoring, medical equipment, etc. Through these steps, the system can maintain high-precision operation in a complex and changing environment and respond to any unexpected changes in a timely manner, thereby improving the performance and safety of the overall control system. In summary, step S3 sets the confidence interval based on the normal distribution principle, which not only provides key data support for subsequent steps, but also significantly improves the reliability and real-time performance of the entire signal filtering process.

[0027] As described in step S4 above, step S4 is to determine whether the current analog signal value is within the set confidence interval. This process ensures that the system can effectively identify and process abnormal signals and improve the accuracy and reliability of signal processing. Specifically, first, in step S3, a confidence interval (for example, (2.5V, 4.5V)) has been set. Next, whenever a new signal value enters the system, the system will judge the signal value. Assuming that the current analog signal value is 5.0V, the system needs to compare it with the set confidence interval. The specific steps are as follows: First, obtain the current analog signal value: the system collects the new analog signal value in real time and stores it in a temporary buffer or database. For example, assuming that the current analog signal value is 5.0V. Then determine whether it is within the confidence interval: the system compares the current analog signal value with the set confidence interval. If the signal value is within the confidence interval (i.e., between 2.5V and 4.5V), the signal value is considered to be credible and is directly output for subsequent calculations. Otherwise, the system will further process it. For example, since 5.0V is not within the range of (2.5V, 4.5V), the signal value is considered an outlier. Then record the result: Regardless of whether the signal value is within the confidence interval, the system needs to record the judgment result for subsequent analysis and optimization. If the signal value is within the confidence interval, it is marked as "trustworthy" and the corresponding output is performed; if it is not within the confidence interval, it is marked as "untrustworthy" and the next step of filtering is triggered.

[0028] In this way, the system can effectively identify abnormal signals that deviate from the normal range, thereby improving the accuracy of signal processing. Its main functions and advantages include: First, this method can quickly and accurately judge the validity of the signal value, avoiding misjudgment caused by noise or abnormal values. Secondly, since the judgment process is based on real-time collected data, this method can dynamically adapt to different working conditions to ensure reliable signal processing results under various conditions. Compared with traditional frequency filters, this solution avoids the problem of slow signal changes caused by frequency domain filtering, especially when processing rapidly changing signals (such as flow, current, frequency, speed, etc.), reducing the lag effect in the control loop and improving the response speed and real-time performance of the system.

[0029] As described in step S5 above, step S5 is to filter the current analog signal value that is not within the confidence interval. This process ensures that the system can effectively eliminate the influence of abnormal signals and improve the stability and reliability of the signal. When the current analog signal value is determined to be not within the confidence interval (for example, 5.0V is not within the range of (2.5V, 4.5V)), the system will filter it.

[0030] Specifically, first obtain historical data: obtain the most recent M consecutive analog signal values ​​from the database (for example, M=10), where the value of M can usually be the same as K. Assume that these signal values ​​are [2.8V, 3.0V, 3.1V, 3.2V, 3.3V, 3.4V, 3.6V, 3.7V, 3.8V, 3.9V]. Then select the filtering method: different filtering methods can be selected according to actual needs. For example, median filtering or average filtering. For median filtering, the system sorts these M signal values ​​in ascending order according to their numerical values ​​and takes the middle value as the filtering result. For example, the sorted result is [2.8V, 3.0V, 3.1V, 3.2V, 3.3V, 3.4V, 3.6V, 3.7V, 3.8V, 3.9V], and the middle value is (3.3V+3.4V) / 2=3.35V. For average filtering, the system will calculate the average value of these M signal values ​​to obtain the filtering result. For example, the average value is (2.8V+3.0V+3.1V+3.2V+3.3V+3.4V+3.6V+3.7V+3.8V+3.9V) / 10=3.4V. Then, the second analog signal value is generated based on the result of the filtering process. For example, the result of the median filter 3.35V or the result of the average value filter 3.4V is used to replace the original 5.0V signal value (forming the second analog signal value).

[0031] In this way, the system can effectively eliminate the influence of abnormal signals and ensure the stability and reliability of the signal. Effectively smooth the noise in the signal. Secondly, since the filtering process is based on historical data collected in real time, this method can dynamically adapt to different working conditions and ensure reliable signal processing results under various conditions. Compared with traditional frequency filters, this solution avoids the problem of slow signal changes caused by frequency domain filtering, especially when processing rapidly changing signals, reduces the lag effect in the control loop, and improves the response speed and real-time performance of the system.

[0032] As described in step S6 above, when the current analog signal value is determined to be not within the confidence interval and is filtered (for example, 5.0V is filtered to become 3.35V or 3.4V), the system will generate a second analog signal value based on the result of the filtering process to replace the "current analog signal value" for output. For example, assuming that the result of the filtering process is 3.35V (median filtering) or 3.4V (average filtering), the original 5.0V signal value is replaced with 3.35V or 3.4V. Output the replaced signal value: Output the replaced signal value for subsequent calculations. For example, the system outputs 3.35V or 3.4V as a new signal value for further processing by the control system or other modules. Record the processing results: The system needs to record the specific circumstances of each signal value adjustment for subsequent analysis and optimization. For example, record the original signal value, the filtering result, and the final output signal value to ensure that each step of the operation can be traced.

[0033] In this way, the system can provide processed reliable signals, significantly improving the performance and safety of the entire control system. Its main functions and advantages include: First, the adjusted signal value is more stable and reliable, avoiding misoperation caused by abnormal signals. Second, since the output signal value is based on the result of real-time processing, this method can dynamically adapt to different working conditions and ensure reliable signal processing results under various conditions. Compared with traditional frequency filters, this solution avoids the problem of slow signal changes caused by frequency domain filtering, especially when processing rapidly changing signals, reducing the lag effect in the control loop and improving the response speed and real-time performance of the system. In addition, by filtering the current analog signal value and outputting the adjusted result, the anti-interference ability is further enhanced, the stability and reliability of the signal are guaranteed, and the performance and safety of the entire control system are improved. This method is not only suitable for industrial automation control systems, but can also be widely used in other fields that require high-precision signal processing, such as environmental monitoring, medical equipment, etc.

[0034] In one embodiment, the step of calculating the standard deviation of K consecutive analog signal values ​​includes: S20, collecting analog signal values ​​based on a preset sampling frequency and time interval until analog signal values ​​of K data points are collected; S21, calculating the average value corresponding to the analog signal values ​​of K data points; S22, calculating the square of the difference between the analog signal value of each data point and the average value, and calculating the corresponding variance; S23. Obtain the standard deviation of K consecutive analog signal values ​​based on the variance calculation.

[0035] In this embodiment, first, in step S20, the system starts to collect analog signal values ​​based on the preset sampling frequency and time interval. For example, assuming that the sampling frequency is set to 10 times per second and K is 50 times, the system will collect 50 data points within 5 seconds. These data points can be parameters such as temperature, pressure or flow from sensors. The collected data will be stored in a temporary buffer or database for subsequent processing. The system calculates the average value (PV) of these 50 data points, which represents the signal level in the current period of time and is an important reference benchmark for subsequent steps. Then, in step S22, the system calculates the square of the difference between each data point and the average value, sums them, and finally divides them by the total number of data points to obtain the variance. The specific steps are: for each data point, calculate its difference from the average value, take the square and accumulate them, and finally divide them by the total number of data points. The standard deviation not only helps to understand the degree of discreteness of the data, but also provides a key basis for setting the confidence interval in the subsequent steps.

[0036] Through this embodiment, the system can dynamically calculate the standard deviation of K consecutive analog signal values, thereby realizing effective monitoring of signal quality. This method not only provides a means to quantify the discreteness of data, but also can dynamically adapt to different working conditions to ensure reliable signal processing results under various conditions. Compared with the traditional filtering method, this scheme avoids the problem of slow signal changes caused by frequency domain filtering, especially when processing rapidly changing signals, reduces the lag effect in the control loop, and improves the response speed and real-time performance of the system. In addition, by standardizing the signal, the anti-interference ability of the system is further enhanced, and the stability and reliability of the signal are guaranteed. This process lays a solid foundation for subsequent signal judgment and filtering processing.

[0037] In one embodiment, the step of setting the confidence interval based on the normal distribution principle and using the standard deviation includes: S30, setting the lower limit PV-nσ of the confidence interval and the upper limit PV+nσ of the confidence interval to obtain the confidence interval (PV-nσ, PV+nσ); wherein PV is the average value of K analog signal values, σ is the standard deviation of K consecutive analog signal values, and n is the confidence level coefficient.

[0038] In this embodiment, in step S30, the system sets the lower limit and upper limit of the confidence interval according to the confidence level coefficient n. Through these parameters, the system can dynamically adapt to different working conditions to ensure reliable signal processing results under various conditions. Whenever the system receives a new signal value entering the system, the system compares it with the newly calculated confidence zone. If the current analog signal value is within the interval of the confidence zone, it is considered normal and output directly; if it is not within the interval, it is further filtered to eliminate the influence of noise or outliers. This method not only improves the accuracy and reliability of signal processing, but also reduces the hysteresis effect in the control loop and improves the response speed and real-time performance of the system.

[0039] In one embodiment, if the current analog signal value is not within the confidence interval, the step of filtering the current analog signal value comprises: S40, when it is detected that the current analog signal value is not within the set confidence interval, obtaining M consecutive analog signal values ​​before the current analog signal value, where M is a natural number greater than 1; S41. Arrange the M analog signal values ​​in ascending or descending order according to their numerical values, and calculate the intermediate value to obtain the result of filtering processing.

[0040] In this embodiment, if the current analog signal value is not within the set confidence interval, the step of filtering the current analog signal value includes: first, in step S40, when it is detected that the current analog signal value is not within the set confidence interval, the system obtains the previous M consecutive analog signal values ​​starting from the current analog signal value from the database. For example, assuming that M is 10, the system will obtain the 10 analog signal values ​​closest to the current analog signal value. Then, in step S41, the system arranges these M analog signal values ​​in ascending or descending order according to the numerical value, and calculates the middle value to obtain the result of the filtering process. For example, if the 10 sorted signal values ​​are [2.8V, 3.0V, 3.1V, 3.2V, 3.3V, 3.4V, 3.6V, 3.7V, 3.8V, 3.9V], the middle value is (3.3V+3.4V) / 2=3.35V. Through this method, the system can effectively smooth abnormal signals, eliminate the influence of noise or outliers, and ensure the stability and reliability of the output signal. This process not only improves the accuracy of signal processing, but also enhances the system's anti-interference ability, and is suitable for a variety of application scenarios that require high-precision signal processing.

[0041] In one embodiment, if the current analog signal value is not within the confidence interval, the step of filtering the current analog signal value further includes: S50, when it is detected that the current analog signal value is not within the set confidence interval, obtaining M consecutive analog signal values ​​before the current analog signal value, where M is a natural number greater than 1; S51, calculating the average value of M analog signal values ​​to obtain the result of filtering processing.

[0042] In this embodiment, first, in step S50, when it is detected that the current analog signal value is not within the set confidence interval, the system obtains the M consecutive analog signal values ​​before the current analog signal value from the database. For example, assuming that M is 10, the system will obtain the most recent 10 analog signal values, which can be parameters such as temperature, pressure or flow collected by the sensor. Then, in step S51, the system calculates the average value of these M analog signal values ​​to obtain the result of the filtering process. By calculating the average value of these M signal values, the system can effectively smooth abnormal signals, eliminate the influence of noise or abnormal values, and ensure the stability and reliability of the output signal.

[0043] This method not only improves the accuracy of signal processing, but also enhances the system's anti-interference ability, and is suitable for a variety of application scenarios that require high-precision signal processing. Compared with other filtering methods, the way to calculate the average value is simple and efficient, and is particularly suitable for control systems with high real-time requirements. Through these steps, the system can maintain high-precision operation in a complex and changing environment and respond to any unexpected changes in a timely manner, thereby improving the performance and safety of the overall control system.

[0044] In one embodiment, after the step of determining whether the current analog signal value is within the confidence interval, the following steps are performed: S60: If it is within the confidence interval, output the current analog signal value.

[0045] In this embodiment, if the system determines that the current analog signal value is within the set confidence interval, the signal value is output for subsequent calculations. Specifically, assuming that the confidence interval of the system is (2.5V, 4.5V), when the current analog signal value is 4.0V, the value falls within the confidence interval, and the system will confirm the validity of the signal value, that is, confirm whether the signal value (such as 4.0V) is within the set confidence interval (for example, between 2.5V and 4.5V). Once it is confirmed that the signal value is within the confidence interval, the system immediately uses the analog signal value (such as 4.0V) as the output value, and the output analog signal value will be used for various subsequent calculation and analysis tasks. For example, in industrial automation control systems, these analog signal values ​​may be used for control loop adjustment, trend analysis, or alarm triggering. In this way, the system can ensure that only verified signal values ​​within the confidence interval will be further processed and used, thereby improving the reliability and accuracy of the entire system. This process not only improves the accuracy of signal processing, but also enhances the anti-interference ability of the system, and is suitable for a variety of application scenarios that require high-precision signal processing.

[0046] In one embodiment, before the step of setting the lower limit PV-nσ of the confidence interval and the upper limit PV+nσ of the confidence interval to obtain the confidence interval (PV-nσ, PV+nσ), the following steps are included: S70, calculating the average value of the analog signal value K times; S71, calculating the deviation value between the standard deviation and the average value; S72. Obtain a corresponding confidence level coefficient within a preset confidence level coefficient range based on the deviation value to obtain a confidence level coefficient n, wherein the deviation value increases in direct proportion to the confidence level coefficient n.

[0047] In this embodiment, the system first calculates the average value PV of the analog signal values ​​of K consecutive times. For example, assuming that the 50 signal values ​​collected are 3.2V, 3.3V, 3.4V, ... 3.6V, respectively, the calculated average value is 3.5V. Next, the system calculates the standard deviation σ and compares it with the average value PV to obtain the deviation value. Specifically, the deviation value can be calculated by the formula σ / PV. Assuming that the standard deviation σ is 0.5, the deviation value is 0.5 / 3.5≈0.14. According to the deviation value, the system selects a suitable confidence level coefficient n from the preset confidence level coefficient range. Generally, the larger the deviation value, the larger the confidence level coefficient n should be to ensure that more data points are included in the confidence interval. For example, if the preset confidence level coefficient range is 1 to 4, and the deviation value increases in proportion to the confidence level coefficient, then when the deviation value is 0.14, it can be mapped to n=2. By calculating the deviation value between the standard deviation and the average value, and dynamically selecting a suitable confidence level coefficient n based on the deviation value, the system can set the confidence interval more accurately. This method ensures that the confidence interval can adapt to the discreteness of the data under different working conditions, so as to more accurately identify and exclude noise or abnormal signals. For example, when the data fluctuates greatly, choosing a larger confidence level coefficient n can avoid misjudging normal signals as abnormal signals, while when the data is relatively stable, choosing a smaller confidence level coefficient n can more sensitively detect small abnormal changes.

[0048] In one embodiment, after the step of receiving the current analog signal value, the following steps are included: S80, obtain the total number of analog signal values ​​currently acquired a; S81, determine whether the total number a is greater than K; S82. If it is less than K, update K based on a, where a is a natural number greater than 1; S83. If it is greater than k, execute the step of calculating the standard deviation of the K consecutive analog signal values ​​before the current analog signal value.

[0049] In this embodiment, the system compares the total number a with the preset K value. If a is less than K, it means that a sufficient number of data points have not been collected to calculate the standard deviation. If the total number a is less than K, the system will dynamically adjust the K value to make it equal to the total number of data points a currently available. For example, assuming that the preset K value is 50, but only 30 data points have been collected, the system will update K to 30 so as to use all the existing data for preliminary standard deviation calculation and signal processing. If the total number a is greater than or equal to K, the system will continue to perform the next step, that is, to calculate the standard deviation and set the confidence interval based on the initial preset K value. This means that the system already has enough data points for effective signal analysis and processing. When the system just starts running, it may not have collected enough data points (that is, the total number a is less than the preset K value). By dynamically adjusting the K value to make it equal to the total number of data points a currently available, the system can use all the existing data for preliminary standard deviation calculation and signal processing when the data is insufficient. This not only improves the data utilization rate in the initial stage, but also enables the system to provide a certain degree of signal analysis and processing results at an early stage, enhancing the real-time response capability of the system. Compared with traditional methods, this method avoids processing delays or inaccuracies caused by insufficient data, especially in rapidly changing environments. It can effectively reduce the lag effect in the control loop and improve the response speed and real-time performance of the system.

[0050] Reference Figure 2 , is a block diagram of the analog signal filtering automatic adjustment system in one embodiment of the present application, the system includes: The receiving module 100 is used to receive the current analog signal value; The calculation module 200 is used to calculate the standard deviation of the analog signal values ​​of K consecutive times before the current analog signal value, where K is a natural number greater than 1; A setting module 300, configured to set a confidence interval using the standard deviation; The judging module 400 is used to judge whether the current analog signal value is within the confidence interval; A filtering module 500 is used to filter the current analog signal value if it is not within the confidence interval; The adjustment module 600 is used to adjust and generate a second analog signal value based on the result of the filtering process and output it.

[0051] Furthermore, the computing module 200 includes a collection unit, which is used to: The analog signal value is collected based on the preset sampling frequency and time interval until the analog signal values ​​of K data points are collected; Calculate the average value of the analog signal values ​​corresponding to K data points; Calculate the square of the difference between the analog signal value of each data point and the average value, and calculate the corresponding variance; The standard deviation of K consecutive analog signal values ​​is obtained based on the variance calculation.

[0052] Furthermore, the setting module 300 includes a confidence zone setting unit, which is used to: Setting the lower limit of the confidence interval PV-nσ and the upper limit of the confidence interval PV+nσ to obtain the confidence interval (PV-nσ, PV+nσ); Where PV is the average value of K analog signal values, σ is the standard deviation of K consecutive analog signal values, and n is the confidence level coefficient.

[0053] Furthermore, the filtering module 500 includes a median filtering processing unit, which is used to: When it is detected that the current analog signal value is not within the set confidence interval, M consecutive analog signal values ​​before the current analog signal value are obtained, where M is a natural number greater than 1; Arrange the M analog signal values ​​in ascending or descending order according to their numerical values, calculate the intermediate value, and obtain the result of filtering processing.

[0054] Furthermore, the filtering module 500 includes an average filtering processing unit, which is used to: When it is detected that the current analog signal value is not within the set confidence interval, M consecutive analog signal values ​​before the current analog signal value are obtained, where M is a natural number greater than 1; Calculate the average value of M analog signal values ​​to obtain the result of filtering processing.

[0055] Furthermore, the setting module 300 further includes a coefficient acquisition unit, which is used to: Calculate the average value of K analog signal values; Calculating the deviation value between the standard deviation and the mean value; Based on the deviation value, a corresponding confidence level coefficient within a preset confidence level coefficient range is obtained to obtain a confidence level coefficient n, wherein the deviation value increases in direct proportion to the confidence level coefficient n.

[0056] Furthermore, the system also includes a collection point updating unit, which is used to: Get the total number a of analog signal values ​​currently acquired; Determine whether the total number a is greater than K; If it is less than K, update K based on a, where a is a natural number greater than 1; If it is greater than k, the step of calculating the standard deviation of the K consecutive analog signal values ​​before the current analog signal value is executed.

[0057] Reference Figure 3 In an embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, an internal memory, a storage medium (non-volatile storage medium) and a network interface connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes the above-mentioned storage medium (non-volatile storage medium) and the internal memory. The storage medium (non-volatile storage medium) stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the storage medium (non-volatile storage medium). The database of the computer device is used to store usage data in a method for automatically adjusting analog signal filtering, etc. The network interface of the computer device is used to communicate with an external terminal through a network connection. Furthermore, the above-mentioned computer device can also be provided with an input device and a display screen, etc. When the above-mentioned computer program is executed by a processor, it implements a method for automatically adjusting analog signal filtering, including the following steps: receiving a current analog signal value; calculating the standard deviation of K consecutive analog signal values ​​before the current analog signal value, where K is a natural number greater than 1; setting a confidence interval using the standard deviation; determining whether the current analog signal value is within the confidence interval; if it is not within the confidence interval, filtering the current analog signal value; generating a second analog signal value based on the result of the filtering process and outputting it.

[0058] Those skilled in the art will understand that Figure 3 The structure shown in is merely a block diagram of a portion of the structure related to the present application solution and does not constitute a limitation on the computer device to which the present application solution is applied.

[0059] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, an analog signal filtering automatic adjustment method is implemented, including the following steps: receiving a current analog signal value; calculating the standard deviation of K consecutive analog signal values ​​before the current analog signal value, where K is a natural number greater than 1; setting a confidence interval using the standard deviation; determining whether the current analog signal value is within the confidence interval; if it is not within the confidence interval, filtering the current analog signal value; generating a second analog signal value based on the result of the filtering process and outputting it. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.

[0060] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0061] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.

[0062] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for automatically adjusting analog signal filtering, characterized in that: The method comprises: Receive the current analog signal value; Calculate the standard deviation of the analog signal values ​​of K consecutive times before the current analog signal value, where K is a natural number greater than 1; setting a confidence interval using the standard deviation; Determine whether the current analog signal value is within the confidence interval; If it is not within the confidence interval, filtering is performed on the current analog signal value; A second analog signal value is generated based on the result of the filtering process and is output.

2. The method for automatically adjusting analog signal filtering according to claim 1, characterized in that: The step of calculating the standard deviation of K consecutive analog signal values ​​before the current analog signal value comprises: The analog signal value is collected based on the preset sampling frequency and time interval until the analog signal values ​​of K data points are collected; Calculate the average value of the analog signal values ​​corresponding to K data points; Calculate the square of the difference between the analog signal value of each data point and the average value, and calculate the corresponding variance; The standard deviation of K consecutive analog signal values ​​is obtained based on the variance calculation.

3. The method for automatically adjusting analog signal filtering according to claim 1, characterized in that: The step of setting a confidence interval using the standard deviation comprises: Setting the lower limit of the confidence interval PV-nσ and the upper limit of the confidence interval PV+nσ to obtain the confidence interval (PV-nσ, PV+nσ); Where PV is the average value of K analog signal values, σ is the standard deviation of K consecutive analog signal values, and n is the confidence level coefficient.

4. The method for automatically adjusting analog signal filtering according to claim 1, characterized in that: If the current analog signal value is not within the confidence interval, the step of filtering the current analog signal value comprises: When it is detected that the current analog signal value is not within the set confidence interval, M consecutive analog signal values ​​before the current analog signal value are obtained, where M is a natural number greater than 1; Arrange the M analog signal values ​​in ascending or descending order according to their numerical values, calculate the intermediate value, and obtain the result of filtering processing.

5. The method for automatically adjusting analog signal filtering according to claim 1, characterized in that: If the current analog signal value is not within the confidence interval, the step of filtering the current analog signal value further includes: When it is detected that the current analog signal value is not within the set confidence interval, M consecutive analog signal values ​​before the current analog signal value are obtained, where M is a natural number greater than 1; Calculate the average value of M analog signal values ​​to obtain the result of filtering processing.

6. The method for automatically adjusting analog signal filtering according to claim 3, characterized in that: Before the step of setting the lower limit PV-nσ of the confidence interval and the upper limit PV+nσ of the confidence interval to obtain the confidence interval (PV-nσ, PV+nσ), the method includes: Calculate the average value of K analog signal values; Calculating the deviation value between the standard deviation and the mean value; Based on the deviation value, a corresponding confidence level coefficient within a preset confidence level coefficient range is obtained to obtain a confidence level coefficient n, wherein the deviation value increases in direct proportion to the confidence level coefficient n.

7. The method for automatically adjusting analog signal filtering according to claim 1, characterized in that: After the step of receiving the current analog signal value, the method further comprises: Get the total number a of analog signal values ​​currently acquired; Determine whether the total number a is greater than K; If it is less than K, update K based on a, where a is a natural number greater than 1; If it is greater than k, the step of calculating the standard deviation of the K consecutive analog signal values ​​before the current analog signal value is executed.

8. An analog signal filtering automatic adjustment system, characterized in that: include: A receiving module is used to receive the current analog signal value; A calculation module, used for calculating the standard deviation of K consecutive analog signal values ​​before the current analog signal value, where K is a natural number greater than 1; A setting module, used for setting a confidence interval using the standard deviation; A judgment module, used to judge whether the current analog signal value is within the confidence interval; A filtering module, used for filtering the current analog signal value if it is not within the confidence interval; The adjustment module is used to adjust and generate a second analog signal value based on the result of the filtering process and output it.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Filtering device and filtering algorithm based on 3-sigma rule

    CN103412867A

  • Fault prediction method and device of power distribution system

    CN110297140A

  • Mining micro-seismic signal filtering method

    CN112633225A

  • Strength detection system and method for special stainless steel plate

    CN119000304A

  • Environmental monitoring data abnormal value identification method, system and device and storage medium

    CN119377866A