A digital filtering method, system, server and medium for analog signal

By recording the number of deviation values ​​between the acquired signal and the last signal, removing the error value, suppressing the influence of periodic interference signals, the problem of inaccurate signal acquisition in the prior art is solved, and higher signal accuracy and anti-interference ability are achieved.

CN115062663BActive Publication Date: 2025-04-11ZHEJIANG ZHENGTAI ZHONGZI CONTROLLING ENG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210737091.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-27
Publication Date
2025-04-11
Estimated Expiration
2042-06-27

AI Technical Summary

Technical Problem

When the prior art performs digital filtering of analog quantity acquisition signals, it is difficult to effectively suppress the deviation effects caused by periodic regular interference signals, resulting in inaccurate signal acquisition and may cause safety failures or accidents.

Method used

The error value is removed by continuously recording whether the deviation value between the collected data and the last data is within the preset range, and the deviation effect caused by classical interference is suppressed. Specific methods include timely obtaining the acquisition signal, calculating the difference value, judging the difference symbol, counting the number of symbol changes, and discarding the acquisition signal in the future fixed time if the preset number is reached, and generating the filtered analog signal based on the stored acquisition signal.

Benefits of technology

It effectively suppresses the deviation impact of the SIS safety system analog quantity acquisition template when acquiring analog signals, and improves the accuracy of the signal and anti-interference ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115062663B_ABST
    Figure CN115062663B_ABST
Patent Text Reader

Abstract

The present application provides a digital filtering method, system, server and medium for analog signals, the method comprising: obtaining a collection signal at a fixed time, obtaining the difference between the collection signal at the current moment and the collection signal at the previous moment based on the collection signal; judging whether the difference belongs to a preset difference interval, if not, obtaining the sign of the difference, judging whether the sign of the difference at the current moment is the same as the sign of the difference at the previous moment, if the same, increasing the statistical number corresponding to the symbol based on the sign at the current moment; if different, clearing the statistical number corresponding to the symbol at the previous moment, increasing the statistical number corresponding to the symbol based on the symbol at the current moment; judging whether the statistical number is less than the preset number, if so, storing the collection signal in an array; otherwise, the newly obtained collection signal within a fixed time is not stored in the array; generating the final result based on the collection signal in the array. The present application can effectively suppress the influence of classical interference on the SIS safety system when collecting analog signals.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of digital filtering technology, and in particular to a digital filtering method, system, server and medium for analog signals. Background Art

[0002] As SIS systems are increasingly used in industrial control systems, the reliability of the system directly affects the safe production and economic operation of the enterprise, making the anti-interference ability of the system the key to the reliable operation of the entire system. As an important part of the SIS system, the analog quantity acquisition template can ensure the accuracy of its acquisition results as much as possible under various types of interference by digitally filtering its analog quantity acquisition results.

[0003] The analog quantity acquisition template of the SIS safety system will be subject to various interferences when collecting signals, such as power frequency interference, surge interference, etc. When interference occurs, the collected signal will produce deviations, which may cause safety failures or accidents. In order to avoid such a bad situation, data filtering will be added to the software during signal collection to suppress the deviation caused by interference. The characteristics of the discrete time system can be used to process the input signal waveform or frequency, or the input signal can be converted into a certain output signal, so as to achieve the purpose of changing the signal spectrum. There are many principles of digital filtering technology, such as algorithm average method, median filter method, limit filter method and inertial filter method. Among them, the algorithm average method is to find a Y based on the collected N data, so that the sum of squares between Y and each collected value is minimized. This method is generally only applicable to signals with periodic interference noise. For the occasional interference signal without periodic regularity, the filtering effect is not ideal. The median filter method is to collect the measured parameter M times continuously and the number of collections is an odd number, and then sort them according to size, and then take the middle value as the valid data collected this time. The number of collections should not be less than 3 times. This method can filter the measured parameter that changes slowly, and can achieve a good filtering effect. Therefore, the existing technologies can only filter noise with a certain pattern, which has certain limitations. Summary of the invention

[0004] By continuously recording the number of times that the deviation between the current collected data and the last collected data is not within the preset range, the error value in the collected signal can be removed, effectively suppressing the deviation effect caused by the classical interference around the SIS safety system analog quantity acquisition template when collecting analog signals.

[0005] In a first aspect, this embodiment provides a digital filtering method for an analog signal, the method comprising:

[0006] Acquire a collection signal at a fixed time, and obtain a difference between the collection signal at a current moment and the collection signal at a previous moment based on the collection signal;

[0007] Determine whether the difference falls within a preset difference interval,

[0008] If the difference falls within the preset difference interval, all statistical times are cleared;

[0009] If the difference does not belong to the preset difference interval, obtain the sign of the difference, and determine whether the sign of the difference obtained at the current moment is the same as the sign of the difference obtained at the previous moment.

[0010] If the sign of the difference obtained at the current moment is the same as the sign of the difference obtained at the previous moment, increase the statistical number corresponding to the sign of the difference based on the sign of the difference at the current moment;

[0011] If the sign of the difference obtained at the current moment is different from the sign of the difference obtained at the previous moment, clear the statistical number corresponding to the sign of the difference at the previous moment, and increase the statistical number corresponding to the sign of the difference based on the sign of the difference at the current moment;

[0012] Determine whether the statistical number is less than a preset number,

[0013] If the statistical number is less than the preset number, the collected signal is stored in an array;

[0014] If the statistical number is not less than the preset number, the newly acquired acquisition signal within the fixed time is not stored in the array;

[0015] A filtered analog signal is generated based on the acquired signals in the array.

[0016] In some embodiments, increasing the statistical number corresponding to the sign of the difference based on the sign of the difference at the current moment includes:

[0017] The statistical times include the rising times and the falling times, obtaining the sign of the difference at the current moment, and determining whether the sign of the difference is positive.

[0018] If the sign of the difference is positive, the number of falling times of the acquisition signal is reset to zero, and the number of rising times is increased by 1;

[0019] If the sign of the difference is negative, the number of rising times of the acquisition signal is reset to zero, and the number of falling times is increased by 1.

[0020] In some embodiments, storing the acquired signals in an array comprises:

[0021] It is determined whether the collected signal stored at the last moment is at the last position in the array. If so, the collected signal is stored at the first position of the array; otherwise, the collected signal is stored after the collected signal stored at the last moment according to a preset storage order.

[0022] In some embodiments, generating a filtered analog signal based on the collected signal in the array includes:

[0023] Based on the collected signals in the array, a plurality of groups of collected signals are obtained, and a first average value group including an average value of each group of collected signals is obtained according to the plurality of groups of collected signals, wherein the number of data in the first average value group is not less than a first value;

[0024] A second average value group excluding several maximum values ​​and minimum values ​​in the first average values ​​is obtained based on the first average value group, and a filtered analog signal is obtained based on the average value of all data in the second average value group.

[0025] In some embodiments, obtaining a first average value group including an average value of each group of collected signals according to the plurality of groups of collected signals comprises:

[0026] Acquire the position of the acquisition signal at the current moment in the array, and obtain a transformation group of acquisition signal updates in the plurality of groups of acquisition signals at the current moment based on the position;

[0027] A first average value of the transformation group is obtained according to the collected signals in the transformation group, and the first average values ​​of other groups obtained at the previous moment are retained.

[0028] In some embodiments, the determining whether the statistical number is less than a preset number further includes:

[0029] Obtaining a flag bit in the array that represents the state of the array,

[0030] Determine whether the flag allows the acquisition signal to be written into the array, and if so, store the acquisition signal in the array;

[0031] Otherwise, it indicates that the statistical number reaches the preset number, and the newly acquired acquisition signal within the fixed time is not stored in the array.

[0032] In some of the embodiments, after the newly acquired acquisition signal within the fixed time is not stored in the array, the method further includes resetting a flag bit of the array.

[0033] In a second aspect, this embodiment provides a digital filtering system for analog signals, the system comprising an acquisition module, a first judgment module, a second judgment module, a third judgment module and a calculation module; wherein,

[0034] The acquisition module is used to regularly acquire the acquisition signal, and obtain the difference between the acquisition signal at the current moment and the acquisition signal at the previous moment based on the acquisition signal;

[0035] The first judgment module is used to judge whether the difference value belongs to a preset difference value interval, and if the difference value belongs to the preset difference value interval, clear all statistical times; if the difference value does not belong to the preset difference value interval, obtain the sign of the difference value;

[0036] The second judgment module is used to judge whether the sign of the difference obtained at the current moment is the same as the sign of the difference obtained at the previous moment. If they are the same, the statistical number corresponding to the sign of the difference is increased based on the sign of the difference at the current moment; if they are different, the statistical number corresponding to the sign of the difference at the previous moment is cleared, and the statistical number corresponding to the sign of the difference is increased based on the sign of the difference at the current moment;

[0037] The third judgment module is used to judge whether the statistical number is less than a preset number, and if so, the collected signal is stored in the array; otherwise, the wipe signal newly acquired within a fixed time is not stored in the array;

[0038] The calculation module is used to generate a filtered analog signal based on the collected signal in the array.

[0039] In a third aspect, an embodiment of the present application provides a server, comprising: a processor and a memory, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, it implements a digital filtering method for analog signals as described in the first aspect.

[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program that can be run on a processor is stored, characterized in that when the computer program is executed by the processor, a digital filtering method for an analog signal as described in the first aspect is implemented.

[0041] By adopting the above scheme, when the present application performs filtering operation on the analog signal, the acquisition signal is first obtained according to a fixed frequency, and the difference between the current acquisition signal and the last acquisition signal is compared with the preset interval to determine whether the values ​​of the two adjacent acquisition signals are greatly changed. If a large change occurs, the possibility that the analog signal is affected by the interference signal is not ruled out. At this time, it is necessary to further determine whether the analog signal is affected by the interference signal and filter out the interference signal. When judging whether the analog signal is affected by the interference signal, the difference sign between the current acquisition signal and the last acquisition signal that does not belong to the preset interval is obtained, and the difference sign is counted based on the sign of the difference, until the number of times with the same sign can be continuously increased by the preset number of times, it can be determined that the analog signal will definitely be affected by the surge interference, and the sampling flag in the array is converted to a state that does not allow writing. Due to the influence of surge interference, the acquisition signal within the future fixed time needs to be discarded at this time. If the number of times with the same sign does not continuously increase by the preset number of times, according to the periodic characteristics of the power frequency interference, regardless of whether the analog signal is affected by the power frequency interference, it is not necessary to discard the acquisition signal within the future time. Finally, in the process of filtering out interference signals, the collected signals in the array are divided into several groups, and the first average value of the collected signals in each group is obtained to obtain several first average values. Considering that the collected signals in the array may be affected by interference signals, it is necessary to discard several maximum and minimum values ​​from several first average values. Finally, the remaining first average values ​​are averaged again as the analog signal output after filtering, which effectively suppresses the deviation caused by the classic interference around the SIS safety system analog acquisition template when collecting analog signals. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 This is a flow chart of a digital filtering method for analog signals provided in this embodiment.

[0043] Figure 2 It is a program flow chart of the digital filtering provided in this embodiment.

[0044] Figure 3 This is a graph of collected signals after power frequency interference is applied, as provided in this embodiment.

[0045] Figure 4 This is a graph of collected signals after applying forward surge interference provided by this embodiment.

[0046] Figure 5 This is a graph of collected signals after negative surge interference is applied, as provided in this embodiment.

[0047] Figure 6 This is a graph of collected signals after applying power frequency interference and adopting digital filtering provided in this embodiment.

[0048] Figure 7 This is a graph of collected signals after applying forward surge interference and adopting digital filtering provided by this embodiment.

[0049] Figure 8 This is a graph of collected signals after negative surge interference is applied and digital filtering is used, as provided in this embodiment.

[0050] Fig. 9 This is a digital filtering system for analog signals provided by this embodiment.

[0051] Fig.10 It is a structural block diagram of the server provided in this embodiment. DETAILED DESCRIPTION

[0052] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. However, it should be understood by those of ordinary skill in the art that the present application can be implemented without these details. For those of ordinary skill in the art, it is obvious that various changes can be made to the embodiments disclosed in the present application, and without departing from the principles and scope of the present application, the general principles defined in the present application can be applied to other embodiments and application scenarios. Therefore, the present application is not limited to the embodiments shown, but conforms to the broadest scope consistent with the scope claimed for protection in the present application.

[0053] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.

[0054] SIS is a safety instrument system including safety interlock system, emergency stop system, toxic and harmful flammable gas and fire detection and protection system, etc. It belongs to the category of enterprise production process automation and is a set of systems used to ensure safe production. Its safety level is higher than that of DCS automation control system. In the process of monitoring production equipment or independent units, when production is normal, SIS is in a dormant or static state. Once the production equipment or facilities have a situation that may cause a safety accident, SIS can intervene instantly and accurately, so that the production process can be safely stopped or automatically imported into a predetermined safe state, reducing the possibility of accidents. Among them, the premise for SIS to intervene instantly and accurately is to effectively filter out the power frequency interference and surge interference of the analog signal in the analog quantity acquisition template in the system, and accurately output the analog signal.

[0055] Figure 1 is a flow chart of a digital filtering method for analog signals provided in this embodiment. Figure 1 As shown, the process includes the following steps:

[0056] Step S101 , acquiring a collection signal at a fixed time, and obtaining a difference between the collection signal at a current moment and the collection signal at a previous moment based on the collection signal.

[0057] Step S102, determining whether the difference value belongs to a preset difference value interval, if so, clearing all statistical times; otherwise, obtaining the sign of the difference value.

[0058] The above adopts a dynamic way to collect analog signals to obtain collection signals, that is, to obtain a collection signal every 2ms. After obtaining the collection signal at the current moment, the collection signal at the current moment is subtracted from the collection signal at the previous moment to determine the change size of the collection signal in two adjacent collection processes. Then the change size is compared with the preset difference interval allowed. If the change size is within the preset difference interval, it indicates that the analog quantity collection template at the current moment is not affected by the interference signal when collecting analog signals; if the change size is not within the preset interval, there may be several reasons. One possibility is that the analog quantity collection template at the current moment is affected by the interference signal when collecting analog signals. There are other possibilities that the measurement itself has errors when collecting the analog signal at the current moment. For example, the measurement equipment is inaccurate, resulting in a large deviation between two adjacent collection signals, and the measurement method is random, so that the collection signal obtained at a certain time is greatly different from the actual phase, resulting in a large deviation between two adjacent collection signals.

[0059] Step S103, determine whether the sign of the difference obtained at the current moment is the same as the sign of the difference obtained at the previous moment. If they are the same, increase the statistical number corresponding to the sign of the difference based on the sign of the difference at the current moment; if they are different, clear the statistical number corresponding to the sign of the difference at the previous moment, and increase the statistical number corresponding to the sign of the difference based on the sign of the difference at the current moment.

[0060] In order to further determine whether the reason why the difference between two adjacent collected signals is not within the preset interval is due to an interference signal, it is also necessary to record the number of times the difference between the current collected signal and the previous collected signal does not belong to the preset difference interval.

[0061] The preset difference interval includes a lower limit and an upper limit, wherein the upper limit and the lower limit are opposite numbers. Therefore, the difference between the current acquisition signal and the previous acquisition signal does not belong to the predicted difference interval and can be divided into two cases, one is that the sign of the difference is positive, and the other is that the sign of the difference is negative. When the sign of the difference is positive, it indicates that the acquisition signal at the current moment is greater than the acquisition signal at the previous moment; otherwise, the acquisition signal at the current moment is less than the acquisition signal at the previous moment. For example, the preset difference interval is -5mv to 5mv. If the acquisition signal at the current moment is 2000mv and the acquisition signal at the previous moment is 1980mv, the difference between the two is 20mv. When the difference does not belong to the preset difference interval, the acquisition signal can be further divided into a signal less than the lower limit of the preset interval and a signal greater than the upper limit of the preset interval by only judging the sign of the difference between the two.

[0062] Since the difference between any two adjacent acquisitions of the acquisition signal affected by power frequency interference will be greater than the preset difference interval, but the product of its continuous number and the time of each acquisition of the acquisition signal will not exceed half a cycle of the power frequency interference, therefore, in order to better reduce the impact of power frequency interference and surge interference on the analog signal, it is necessary to increase the statistical number corresponding to the sign of the difference based on the sign of the difference at the current moment, where the statistical number includes the number of rises and the number of falls. If the sign of the difference is positive, the number of falls of the acquisition signal is cleared and the number of rises is increased by 1; otherwise, the number of rises of the acquisition signal is cleared and the number of falls is increased by 1. In addition, when the difference between two adjacent acquisition signals is within the preset interval, the number of rises and the number of falls of the acquisition signal are both cleared.

[0063] Step S104, determining whether the statistical number is less than a preset number, if so, storing the collected signals in an array; if not, the newly obtained collected signals within a fixed time are not stored in the array.

[0064] Among them, judging whether the number is less than the preset number includes judging whether the number of rises is less than the preset number or whether the number of falls is less than the preset number. Only when the difference does not belong to the preset difference interval and the difference sign can be continuously the same, can the number of rises or the number of falls be added by 1, otherwise, the number of rises or the number of falls will be cleared. The preset number is equal to half a cycle of the power frequency interference divided by the time interval for obtaining the acquisition signal. For example, the second acquisition signal is 10mv greater than the first acquisition signal. At this time, the number of rises is added by 1 and the number of falls is zero; if the third acquisition signal is 8mv greater than the second acquisition signal, the number of rises will continue to be added by 1 and the number of falls will be zero. If the third acquisition signal is 8mv less than the second acquisition signal, the number of rises will be zero and the number of falls will be added by 1, or the third acquisition signal is 3mv greater than the second acquisition signal, which is less than the upper limit of the preset difference interval, and the number of rises and falls are both zero.

[0065] After judging whether the statistical number is less than the preset number, it is also necessary to obtain the flag bit representing the array state in the array, and judge whether the flag bit allows the acquisition signal to be written into the array. If so, the acquisition signal is stored in the array; otherwise, it is ensured that the statistical number reaches the preset number, and the newly acquired acquisition signal within the fixed time is not stored in the array. After one of the rising number or the falling number reaches the preset number, the flag bit in the array will be converted to a state that does not allow the acquisition signal to be written into the array. Therefore, by obtaining the flag bit representing the array state in the array, it can be known whether the statistical number reaches the preset number. Since the analog quantity acquisition template in the SIS system is mainly subject to power frequency interference and surge interference when collecting analog signals, when the analog signal is subject to power frequency interference, neither the rising number nor the falling number will exceed the preset number. Therefore, after the number is not less than the preset number, it can be determined that the acquisition signal is subject to surge interference at this time. In order to reduce the impact of surge interference on the acquisition signal, it is necessary to convert the flag bit of the array to a state that does not allow writing, and filter out several erroneous signals generated by surge interference in the future fixed time. After a fixed time, the flag bit of the array will be reset, that is, the acquisition signal is allowed to be written into the array.

[0066] The future fixed time is determined by the time between two consecutive acquisition signals and the number of acquisition signals that need to be discarded, that is, the future fixed time is equal to the time between two consecutive acquisition signals multiplied by the number of acquisition signals that need to be discarded.

[0067] After the number of times is determined to be less than the preset number, the acquisition signal needs to be stored in the data. Before storing the acquisition signal in the array, it is also necessary to determine whether the acquisition signal stored at the previous moment is at the last position in the array. If so, the acquisition signal is stored at the first position of the array; otherwise, the acquisition signal is stored after the acquisition signal stored at the previous moment in a preset storage order. In this embodiment, the FIFO method is used to store the acquisition signal in the array in a sliding manner, that is, whenever new acquisition data needs to be stored in the array, it is saved from the first position of the array downwards in sequence. After being stored to the last position, the next acquisition signal is stored at the first position of the array, and then stored in sequence, and the cycle repeats.

[0068] Step S105 , generating a filtered analog signal based on the collected signal in the array.

[0069] After the collected signals are stored in the array in turn, generating a filtered analog signal based on the collected signals in the array includes: obtaining a plurality of groups of collected signals based on the collected signals in the array, obtaining a first average value group including an average value of each group of collected signals according to the plurality of groups of collected signals, wherein the number of data in the first average value group is not less than the first value; obtaining a second average value group excluding a plurality of maximum values ​​and minimum values ​​in the first average value based on the first average value group, and obtaining a filtered analog signal based on the average value of all data in the second average value group.

[0070] First, the collected signals in the array are divided into several groups, and the first average value of each group is calculated. Since the collected signals stored in the array may contain more or less interfering signals, in order to more accurately filter out the interfering signals from the analog signal, after obtaining several first average values, it is also necessary to remove several maximum and minimum values ​​of these several first average values, wherein the specific number to be removed can be determined according to the actual situation, and this application does not impose too many restrictions here. After removing several maximum and minimum values, the remaining first average values ​​are averaged to accurately obtain the analog signal after filtering.

[0071] Among them, when obtaining the average value of each group of collected signals based on several groups of collected signals, since the collected signals in the array at the current moment have only changed one position compared with the collected signals in the array at the previous moment. Therefore, it is only necessary to obtain the position of the collected signal at the current moment in the array, and based on the position, obtain other collected signals belonging to the same group as the collected signal, and then obtain the first average value of the group to replace the average value of the group at the previous moment, and the average values ​​of other groups still retain the first average value obtained at the previous moment. This can reduce the calculation steps and improve the calculation efficiency.

[0072] Figure 2 is a flowchart of the digital filtering process provided by this embodiment. Figure 2As shown, after obtaining the acquisition signal at the current moment, the difference between the current acquisition signal and the last acquisition signal is first calculated. The difference has three cases, namely, the difference is less than the lower limit, greater than the upper limit, and between the lower limit and the upper limit. When the difference is less than the lower limit, the number of drops is cleared, the number of rises is increased by 1, and after the number of rises reaches the preset number, the acquisition signal flag is not saved in the array; when the difference is greater than the upper limit, the number of rises is cleared, the number of drops is increased by 1, and after the number of drops reaches the preset number, the acquisition signal flag is not saved in the array; when the difference is between the lower limit and the upper limit, the number of rises and the number of drops are both cleared. Then it is determined whether the flag of not saving the acquisition signal in the array is set. If so, the acquisition signal within the next fixed time is not stored in the data; otherwise, the acquisition signal is stored in the array in a FIFO manner, and then several groups of acquisition signals are obtained according to the array, and the first average value is calculated for each group, and then the maximum value and the minimum value are discarded, and finally the remaining first average values ​​are averaged to obtain the final result. The above process improves the deviation problem caused by typical interference around the SIS safety system analog quantity acquisition template when acquiring analog quantity signals, separates useful signals from noise, improves the signal's anti-interference ability and signal-to-noise ratio, filters out frequency components of no interest, improves sampling accuracy, and separates a single frequency component from complex frequency components.

[0073] When the SIS safety system is used, it will be subject to various interferences due to the complex environment on site, and the interferences will affect the signal acquisition of the analog quantity acquisition template. This embodiment also provides two typical interference effects on the acquisition signal. Figure 3 is a graph of collected signals after power frequency interference is applied, provided in this embodiment. Figure 4 is a graph of collected signals after applying forward surge interference provided by this embodiment, Figure 5 This is a graph of collected signals after negative surge interference is applied, as provided in this embodiment. Figure 3 The collected signal in the figure is the converted voltage value. The normal value of this voltage is 2500mv. After applying the power frequency interference simulated in the laboratory, the voltage value of the collected signal will be as follows: Figure 3 As shown, it becomes a sine wave, which causes a significant deviation in the acquisition and the acquisition accuracy cannot be met. Figure 4 and Figure 5 The collected signal in the figure is the converted voltage value. The normal value of this voltage is 5000mv. After applying the surge interference simulated in the laboratory, the voltage value of the collected signal will be as follows: Figure 4 and Figure 5 As shown, there is a significant deviation in the collection, and the collection accuracy cannot be met.

[0074] Figure 6 is a graph of collected signals after power frequency interference is applied and digital filtering is adopted, provided in this embodiment. Figure 7is a graph of collected signals after applying forward surge interference and adopting digital filtering provided in this embodiment, Figure 8 1 is a graph of the collected signal after negative surge interference is applied and digital filtering is adopted in this embodiment. After adding the above digital filtering method, the same Figure 3 The measurement environment, analog input signal 10mA, after applying the power frequency interference simulated in the laboratory, the output results are as follows Figure 6 As shown in the figure, the acquisition deviation caused by interference has been eliminated and the accuracy requirement is met. After adding the above digital filtering method, the same Figure 4 The measurement environment, analog input signal 20mA, the output results after applying the laboratory simulated forward surge interference are as follows Figure 7 As shown in the figure, the acquisition deviation caused by interference has been eliminated and the accuracy requirement is met. After adding the above digital filtering method, the same Figure 5 The measurement environment, analog input signal 20mA, the output results after applying the negative surge interference simulated in the laboratory are as follows Figure 8 As shown, the acquisition deviation caused by interference has been eliminated and the accuracy requirements have been met.

[0075] Fig. 9 This embodiment provides a digital filtering system for analog signals. Fig. 9 As shown, the system includes an acquisition module, a first judgment module, a second judgment module, a third judgment module, and a calculation module. Among them, the acquisition module is used to obtain the acquisition signal at a fixed time, and obtain the difference between the acquisition signal at the current moment and the acquisition signal at the previous moment based on the acquisition signal; the first judgment module is used to determine whether the difference belongs to the preset difference interval, if the difference belongs to the preset difference interval, clear all statistical times; if the difference does not belong to the preset difference interval, obtain the sign of the difference; the second judgment module is used to determine whether the sign of the difference obtained at the current moment is the same as the sign of the difference obtained at the previous moment, if the same, increase the statistical times corresponding to the sign of the difference based on the sign of the difference at the current moment; if different, clear the statistical times corresponding to the sign of the difference at the previous moment, and increase the statistical times corresponding to the sign of the difference based on the sign of the difference at the current moment; the third judgment module is used to determine whether the statistical times are less than the preset times, if so, store the acquisition signal in the array; otherwise, the newly acquired acquisition signal within a fixed time is not stored in the array; the calculation module is used to generate the analog signal after filtering based on the acquisition signal in the array.

[0076] Fig.10 is a structural block diagram of the server provided in this embodiment, such as Fig.10As shown, the server includes a processor 101 and a memory 102, wherein the memory 102 stores a computer program 103 that can run on the processor 101, and when the computer program 103 is executed by the processor, a method for recommending environmental protection management measures for an enterprise provided in an embodiment of the present application is implemented.

[0077] The memory 102 may be a ROM or other type of static storage device capable of storing static information and instructions, a random access memory, or other type of dynamic storage device capable of storing information and instructions, or an electrically erasable programmable read-only memory, a read-only optical disc or other optical disc storage, an optical disc storage (including a compact disc, a laser disc, an optical disc, a digital versatile disc, a Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program codes in the form of instructions or data structures and capable of being accessed by a computer, but not limited thereto. The memory 102 may be an internal storage unit in some embodiments.

[0078] The processor 101 may be a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component or any combination thereof, and is used to run the program code stored in the memory 102 or process data.

[0079] The processor 101 and the memory 102 are connected via a bus. The bus may include a path to transmit information between the above components. The bus may be a peripheral component interconnect standard bus or an extended industrial standard architecture bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0080] Fig.10 Only a server having a memory 102, a processor 101, and a bus is shown. It can be understood in the art that Fig.10 The structure shown does not constitute a limitation on the server, which can be a bus structure or a star structure. The server can also include more or fewer components than shown in the figure, or combine certain components, or deploy different components. Other existing or future electronic devices, if applicable, should also be included in the scope of protection and included here by reference.

[0081] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the above method embodiment.

[0082] It should be understood that, although the steps in the flowchart of the accompanying drawings are shown in sequence according to the instructions of the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited in order and can be performed in other orders.

[0083] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A digital filtering method for an analog signal, characterized in that: The method comprises: Acquire a collection signal at a fixed time, and obtain a difference between the collection signal at a current moment and the collection signal at a previous moment based on the collection signal; Determine whether the difference falls within a preset difference interval, If the difference falls within the preset difference interval, all statistical times are cleared; If the difference does not belong to the preset difference interval, obtain the sign of the difference, and determine whether the sign of the difference obtained at the current moment is the same as the sign of the difference obtained at the previous moment. If the sign of the difference obtained at the current moment is the same as the sign of the difference obtained at the previous moment, increase the statistical number corresponding to the sign of the difference based on the sign of the difference at the current moment; If the sign of the difference obtained at the current moment is different from the sign of the difference obtained at the previous moment, clear the statistical number corresponding to the sign of the difference at the previous moment, and increase the statistical number corresponding to the sign of the difference based on the sign of the difference at the current moment; Determine whether the statistical number is less than a preset number, If the statistical number is less than the preset number, the collected signal is stored in an array; If the statistical number is not less than the preset number, the newly acquired acquisition signal within the fixed time is not stored in the array; A filtered analog signal is generated based on the acquired signals in the array.

2. The method according to claim 1, characterized in that The statistical number of times corresponding to increasing the sign of the difference based on the sign of the difference at the current moment includes: The statistical times include the rising times and the falling times, obtaining the sign of the difference at the current moment, and determining whether the sign of the difference is positive. If the sign of the difference is positive, the number of falling times of the acquisition signal is reset to zero, and the number of rising times is increased by 1; If the sign of the difference is negative, the number of rising times of the acquisition signal is reset to zero, and the number of falling times is increased by 1.

3. The method according to claim 1, characterized in that The storing of the collected signals in an array comprises: It is determined whether the collected signal stored at the last moment is at the last position in the array. If so, the collected signal is stored at the first position of the array; otherwise, the collected signal is stored after the collected signal stored at the last moment according to a preset storage order.

4. The method according to claim 3, characterized in that The step of generating a filtered analog signal based on the collected signal in the array comprises: Based on the collected signals in the array, a plurality of groups of collected signals are obtained, and a first average value group including an average value of each group of collected signals is obtained according to the plurality of groups of collected signals, wherein the number of data in the first average value group is not less than a first value; A second average value group excluding several maximum values ​​and minimum values ​​in the first average values ​​is obtained based on the first average value group, and a filtered analog signal is obtained based on the average value of all data in the second average value group.

5. The method according to claim 4, characterized in that The step of obtaining a first average value group including an average value of each group of collected signals according to the plurality of groups of collected signals comprises: Acquire the position of the acquisition signal at the current moment in the array, and obtain a transformation group of acquisition signal updates in the plurality of groups of acquisition signals at the current moment based on the position; A first average value of the transformation group is obtained according to the collected signals in the transformation group, and the first average values ​​of other groups obtained at the previous moment are retained.

6. The method according to claim 2, characterized in that After determining whether the statistical number is less than the preset number, the following step further includes: Obtaining a flag bit in the array that represents the state of the array, Determine whether the flag allows the acquisition signal to be written into the array, and if so, store the acquisition signal in the array; Otherwise, it indicates that the statistical number reaches the preset number, and the newly acquired acquisition signal within the fixed time is not stored in the array.

7. The method according to claim 6, characterized in that After the collected signals within a fixed time in the future are not stored in the array, the flag bit of the array is reset.

8. A digital filtering system for analog signals, characterized in that: The system comprises: an acquisition module, a first judgment module, a second judgment module, a third judgment module, and a calculation module; wherein, The acquisition module is used to regularly acquire the acquisition signal, and obtain the difference between the acquisition signal at the current moment and the acquisition signal at the previous moment based on the acquisition signal; The first judgment module is used to judge whether the difference value belongs to a preset difference value interval, and if the difference value belongs to the preset difference value interval, clear all statistical times; if the difference value does not belong to the preset difference value interval, obtain the sign of the difference value; The second judgment module is used to judge whether the sign of the difference obtained at the current moment is the same as the sign of the difference obtained at the previous moment. If they are the same, the statistical number corresponding to the sign of the difference is increased based on the sign of the difference at the current moment; if they are different, the statistical number corresponding to the sign of the difference at the previous moment is cleared, and the statistical number corresponding to the sign of the difference is increased based on the sign of the difference at the current moment; The third judgment module is used to judge whether the statistical number is less than a preset number, and if so, the collected signal is stored in the array; otherwise, the newly acquired collected signal within a fixed time is not stored in the array; The calculation module is used to generate a filtered analog signal based on the collected information in the array.

9. A server, characterized in that: The server comprises: a processor and a memory, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the digital filtering method for analog signals as claimed in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program that can be run on a processor stored thereon, characterized in that: When the computer program is executed by the processor, the digital filtering method for analog signals according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Digital filtering method and system

    CN108805011A

  • Signal timing recovery method, signal timing recovery device, signal demodulation method and signal demodulation system

    CN109462421A