Gas meter anti-electromagnetic interference method, device, electronic equipment and storage medium
By comparing the average flow rate of the main gas meter and the sub-gas meter, anti-interference detection and filtering processing are performed, which solves the problem of ultrasonic gas meters being susceptible to interference and achieves efficient and accurate metering of the gas company.
Patent Information
- Application Number
- CN202311512710.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2043-11-14
AI Technical Summary
Existing ultrasonic gas meters are susceptible to pipe network fluctuations and electromagnetic interference, resulting in reduced measurement accuracy. Existing detection methods are time-consuming and labor-intensive and cannot detect sub-gas meter errors in a timely manner, affecting the measurement accuracy of gas companies.
By obtaining the average flow rate of the main gas meter and the sub-gas meter for comparison, the abnormal state is determined, anti-interference detection and filtering are performed, the time domain or frequency domain filtering algorithm is adaptively selected, the interference components are filtered, and the non-zero error is calculated for compensation. , to ensure the accuracy of gas flow rate measurement.
It realizes real-time anti-interference processing of sub-gas meters, improves the accuracy and efficiency of measurement, can detect errors in time, and ensures the measurement accuracy of gas companies.
Smart Images

Figure CN117647289B
Abstract
Description
Technical Field
[0001] The present application relates to the field of ultrasonic gas meters, and specifically to a method, device, electronic device and storage medium for preventing electromagnetic interference of a gas meter. Background Art
[0002] Natural gas is a natural clean energy. With the country's vigorous development of natural gas, it has become popular. The existing gas meters generally refer to natural gas meters, and the commonly used method is to measure through gas meters.
[0003] Ultrasonic gas meter is a type of gas meter. Its working principle is to use the time difference method to measure the gas flow rate. It reflects the flow rate of the fluid by measuring the difference in the speed of the ultrasonic signal when it propagates downstream and upstream in the fluid. Because the error caused by the change of the sound velocity of the time difference method with the temperature of the fluid is small and the accuracy is high, it is currently widely used. However, when the ultrasonic gas meter is actually used, pipeline fluctuations and electromagnetic interference will affect the meter's measurement accuracy. At present, to determine whether there are errors in each sub-gas meter in the pipeline network system, it is necessary to regularly perform error detection on all sub-gas meters. Determining whether there are errors in the sub-gas meters is time-consuming and labor-intensive. Regular detection cannot promptly determine whether there are errors in the sub-gas meters, resulting in inaccurate measurement by the gas company. Summary of the invention
[0004] The present application provides a gas meter anti-electromagnetic interference method, device, electronic device and storage medium. By comparing the main gas meter with other sub-gas meters, it is determined whether there is a gas meter that is interfered with among the sub-gas meters. It is possible to promptly determine whether there are errors in the sub-gas meters, thereby improving the accuracy of the gas company's measurement.
[0005] In a first aspect, the present application provides a method for preventing electromagnetic interference of a gas meter, the method comprising:
[0006] Obtain the average value of the main gas flow rate of the main gas meter over a period of time, and the average value of the sub-gas flow rates of other sub-gas meters over a period of time;
[0007] When the main gas flow rate is not equal to the sum of the average values of all the sub-gas flow rates, it is determined that one of the sub-gas meters is in an abnormal state;
[0008] Performing anti-interference detection on all the sub-gas meters to determine the sub-gas meters that are interfered with;
[0009] Performing filtering processing on the sub-gas meter that is disturbed to obtain a non-zero time error;
[0010] The disturbed sub-gas meter is compensated based on the non-zero time error to obtain the correct gas flow rate.
[0011] By adopting the above technical solution, the average value of the main gas flow rate of the main gas meter and the average value of the sub-gas flow rates measured by other sub-gas meters are obtained. When the main gas flow rate is not equal to the sum of the average values of all sub-gas flow rates, it is determined that there is a gas meter in an abnormal state among the sub-gas meters. Anti-interference detection is performed on all sub-gas meters to determine the sub-gas meters that are interfered with. The sub-gas meters that are interfered with are filtered, and their time difference signals are processed by adaptively selecting time domain or frequency domain filtering algorithms to filter out interference components and obtain filtered time difference signals. The average value of the filtered time difference signal is calculated as a non-zero time error. Finally, the non-zero time error value is used as a compensation reference to compensate for the measurement of the interfered sub-gas meter, thereby obtaining the correct gas flow rate. This method of comparing the flow rates of the main gas meter and the sub-gas meter to determine the abnormal meter and then filtering and compensating the designated meter avoids redundant processing of all normal sub-gas meters and directly processes the meter with problems, greatly improving the judgment and compensation efficiency. It allows the system to perform anti-interference processing in real time, ensures the accuracy of measurement, and promptly determines whether there are errors in the sub-gas meter, thereby improving the accuracy of gas company measurement.
[0012] Optionally, the performing anti-interference detection on all the sub-gas meters to determine the sub-gas meter that is interfered with includes:
[0013] Obtain the time difference signals of all sub-gas meters over a period of time;
[0014] Performing Fourier transform on the time difference signal to obtain a corresponding frequency spectrum time difference signal;
[0015] An amplitude analysis is performed based on the frequency spectrum time difference signal, and when the amplitude exceeds a preset amplitude threshold, it is determined that the corresponding sub-gas meter is interfered.
[0016] By adopting the above technical solution, the time difference signals of all sub-gas meters within a period of time are obtained, and then these time difference signals are Fourier transformed to obtain the corresponding spectrum time difference signals. By performing amplitude analysis on the spectrum signal, it is possible to detect whether there is an abnormal spectrum amplitude in the time difference signal. When there is an abnormal amplitude in the spectrum time difference signal, it can be determined that the corresponding sub-gas meter is interfered with. This method of detecting whether the sub-gas meter is interfered with by performing frequency domain analysis on the time difference signal avoids the complexity of manually analyzing the time domain waveform, can quickly perform anti-interference detection, and automatically detect the interfered sub-gas meter. At the same time, frequency domain analysis can also find the frequency components of the interference signal, which is conducive to constructing a filter for filtering processing. Therefore, this method of detecting the interfered meter by frequency domain analysis can realize the automation of anti-interference processing and improve the efficiency of detection and processing.
[0017] Optionally, filtering the interfered sub-gas meter to obtain a non-zero time error includes:
[0018] When the user stops using gas, the time difference signal of the disturbed sub-gas meter is collected for a period of time;
[0019] Based on the time difference signal of the sub-gas meter for a period of time, the absolute value of the slope between the time difference signals of adjacent sampling points is calculated, and based on all the absolute values of the slope, the average value of the absolute values of the slope is calculated;
[0020] determining an adaptive threshold based on an average of the absolute values of the slopes;
[0021] If the average value is less than the adaptive threshold, filtering the time difference signal by an improved smoothing filter to obtain a filtered time difference signal;
[0022] If the average value is greater than the adaptive threshold, all the time difference signals are filtered by frequency domain filtering to obtain the time difference signals after filtering of all the time difference signals;
[0023] Based on the filtered time difference signal, an average value is calculated to obtain a non-zero time error.
[0024] By adopting the above technical solution, when the user stops using gas, the time difference signal of the interfered sub-gas meter is collected, the absolute value of the slope between the sampling points of the time difference signal is calculated, and the average value of all the absolute values of the slope is obtained. The adaptive threshold is determined according to the average slope absolute value. If the average slope absolute value is less than the threshold, the time difference signal is subjected to improved smoothing filtering, and if it is greater than the threshold, frequency domain filtering is performed. Finally, the average value of the filtered time difference signal is calculated as the non-zero time error. This method realizes the adaptive selection of the filtering method by analyzing the slope characteristics of the time difference signal. When the signal changes slowly, a simple smoothing filter is used, and when the signal changes violently, a frequency domain filter is used to accurately filter out the interference. In this way, the optimal filtering algorithm can be selected according to the characteristics of the signal, while ensuring the filtering effect and minimizing the amount of calculation, and improving the processing efficiency. Obtaining the non-zero time error through adaptive filtering can accurately reflect the interference error and provide a reliable basis for subsequent compensation.
[0025] Optionally, determining the adaptive threshold based on the average value of the absolute value of the slope includes:
[0026] If the average value of the absolute value of the slope is less than 1, the adaptive threshold is 1;
[0027] If the average value of the absolute value of the slope is greater than 5, the adaptive threshold is 5;
[0028] If 1 is greater than or equal to the average value of the absolute value of the slope and is less than or equal to 5, the adaptive threshold is adaptively adjusted to minimize the non-zero time error.
[0029] By adopting the above technical solution, an adaptive threshold is set according to the size of the average value of the absolute value of the slope of the time difference signal: when the absolute value of the average slope is less than 1, the threshold is 1; when the absolute value of the average slope is greater than 5, the threshold is 5; when the absolute value of the average slope is between 1 and 5, the threshold is adaptively adjusted so that the non-zero time error finally calculated accurately reflects the interference error. This method of setting the adaptive threshold according to the characteristics of the signal can flexibly select the threshold according to the slope change of the specific time difference signal, while ensuring the filtering effect, so that the obtained non-zero time error more accurately represents the interference error, providing a reliable basis for subsequent compensation, thereby improving the accuracy of the compensation result. The setting of the adaptive threshold improves the accuracy of the time difference signal filtering and the acquisition of the non-zero time error, and is one of the key technologies required for accurate compensation.
[0030] Optionally, filtering the time difference signal by improved smoothing filtering to obtain a filtered time difference signal includes:
[0031] Determine the maximum and minimum values of the time difference signal in the time difference signal of the sub-gas meter within a period of time;
[0032] Substituting the maximum value and the minimum value of the time difference signal into the improved smoothing filter formula, the filtered time difference signal is obtained.
[0033] By adopting the above technical solution, the maximum and minimum values of the sub-gas meter time difference signal within a period of time are obtained, and the time difference signal is substituted into the improved smoothing filter formula for filtering to obtain the filtered time difference signal. This improved smoothing filter method based on the maximum and minimum values of the signal can effectively filter out the random noise in the time difference signal and retain the effective time difference characteristics by considering the extreme value characteristics of the signal. At the same time, compared with the traditional smoothing filter, the improved algorithm can better maintain the detailed characteristics of the signal and avoid signal distortion. Using this adaptive smoothing filter method to process the time difference signal can not only effectively filter out the noise, but also maintain the true characteristics of the time difference signal, thereby improving the accuracy of subsequent time error calculation and compensation. This improved smoothing filter algorithm can fully combine the specific characteristics of the time difference signal to design a filtering scheme, so that the filtering effect is better.
[0034] Optionally, filtering all the time difference signals by frequency domain filtering to obtain the time difference signals after filtering all the time difference signals includes:
[0035] Performing discrete Fourier transform on the time difference signal to obtain a corresponding frequency spectrum time difference signal;
[0036] Constructing a filter based on the corresponding time difference signal spectrum;
[0037] Filtering the spectrum time difference signal based on the filter to obtain a filtered spectrum time difference signal;
[0038] The filtered spectral time difference signal is subjected to discrete Fourier transform to obtain a filtered time difference signal.
[0039] By adopting the above technical solution, the time difference signal is subjected to discrete Fourier transform to obtain the spectrum time difference signal in the frequency domain. A filter is constructed according to the spectrum time difference signal, and then the spectrum time difference signal is filtered by the filter to filter out the noise and interference frequency components to obtain the filtered spectrum time difference signal. Finally, the filtered spectrum time difference signal is subjected to inverse discrete Fourier transform to obtain the filtered time domain time difference signal. This method of filtering the time difference signal in the frequency domain can accurately locate and filter out the corresponding components of the interference signal in the spectrum, effectively remove the noise in the spectrum, and retain the real time difference characteristic frequency components. Frequency domain filtering can make full use of the spectrum information for interference identification, perform targeted filtering, and avoid affecting the effective time difference signal. Therefore, the frequency domain filtering method can effectively improve the anti-interference ability of the time difference signal, obtain more accurate time difference characteristics, and provide reliable guarantee for subsequent time error detection and compensation.
[0040] Optionally, before obtaining the average main gas flow rate of the main gas meter for a period of time and the average sub-gas flow rates of other sub-gas meters for a period of time, the method further includes:
[0041] The instantaneous large flow rate fluctuations in the main gas flow rate measured by the main gas meter over a period of time are eliminated.
[0042] By adopting the above technical solution, before obtaining the average value of the main gas flow rate of the main gas meter, it is necessary to process the main gas flow rate measured by the main gas meter to eliminate the instantaneous large flow rate fluctuations. After this preprocessing, the average flow rate is calculated. This can filter the sudden abnormal data in the main gas flow rate signal, avoid the influence of these transient anomalies on the average flow rate calculation, and ensure the reliability of the main gas flow rate average value. Since the main gas flow average value is the basis for subsequent judgment of sub-meter abnormalities, its reliability directly affects the accuracy of abnormal judgment. By eliminating transient abnormal changes in the mainstream velocity, a more accurate and reliable mainstream velocity average value can be obtained, reducing the probability of false alarm of sub-meter abnormalities, improving the accuracy of abnormal judgment, and laying a solid foundation for subsequent anti-interference processing.
[0043] In a second aspect of the present application, a gas meter anti-electromagnetic interference device is provided, comprising:
[0044] Data acquisition module 1, used to obtain the average value of the main gas flow rate of the main gas meter over a period of time, and the average value of the sub-gas flow rates of other sub-gas meters over a period of time;
[0045] A state determination module 2, configured to determine that a gas meter among the sub-gas meters is in an abnormal state when the main gas flow rate is not equal to the sum of the average values of all the sub-gas flow rates;
[0046] Interference determination module 3, used for performing anti-interference detection on all the sub-gas meters to determine the sub-gas meters that are interfered with;
[0047] The error determination module 4 is used to filter the sub-gas meter that is disturbed to obtain a non-zero time error;
[0048] The error compensation module 5 is used to compensate the disturbed sub-gas meter based on the non-zero time error to obtain the correct gas flow rate.
[0049] In a third aspect of the present application, a computer storage medium is provided, wherein the computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above method steps.
[0050] In a fourth aspect of the present application, an electronic device is provided, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.
[0051] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0052] 1. The present application obtains the average value of the main gas flow rate of the main gas meter and the average value of the sub-gas flow rates measured by other sub-gas meters. When the main gas flow rate is not equal to the sum of the average values of all sub-gas flow rates, it is determined that there is a gas meter in an abnormal state among the sub-gas meters. Anti-interference detection is performed on all sub-gas meters to determine the sub-gas meters that are interfered with. The interfered sub-gas meters are filtered, and their time difference signals are processed by adaptively selecting time domain or frequency domain filtering algorithms to filter out interference components to obtain filtered time difference signals. The average value of the filtered time difference signal is calculated as a non-zero time error. Finally, the non-zero time error value is used as a compensation reference to compensate for the measurement of the interfered sub-gas meter, thereby obtaining the correct gas flow rate. This method of comparing the flow rates of the main gas meter and the sub-gas meter to determine the abnormal meter and then filtering and compensating the designated meter avoids redundant processing of all normal sub-gas meters and directly processes the meter with problems, greatly improving the judgment and compensation efficiency. It allows the system to perform anti-interference processing in real time, ensures the accuracy of measurement, and promptly determines whether there are errors in the sub-gas meter, thereby improving the accuracy of gas company measurement.
[0053] 2. The present application obtains the time difference signals of all sub-gas meters within a period of time, and then performs Fourier transform on these time difference signals to obtain corresponding spectrum time difference signals. By performing amplitude analysis on the spectrum signal, it is possible to detect whether there is an abnormal spectrum amplitude in the time difference signal. When there is an abnormal amplitude in the spectrum time difference signal, it can be determined that the corresponding sub-gas meter is interfered with. This method of detecting whether the sub-gas meter is interfered with by performing frequency domain analysis on the time difference signal avoids the complexity of manually analyzing the time domain waveform, can quickly perform anti-interference detection, and automatically detect the interfered sub-gas meter. At the same time, frequency domain analysis can also find out the frequency components of the interference signal, which is conducive to constructing a filter for filtering processing. Therefore, this method of detecting the interfered meter by frequency domain analysis can realize the automation of anti-interference processing and improve the efficiency of detection and processing.
[0054] 3. This application collects the time difference signal of the interfered sub-gas meter when the user stops using gas, calculates the absolute value of the slope between the sampling points of the time difference signal, and obtains the average value of all the absolute values of the slope. The adaptive threshold is determined according to the average slope absolute value. If the average slope absolute value is less than the threshold, the time difference signal is subjected to improved smoothing filtering, and if it is greater than the threshold, frequency domain filtering is performed. Finally, the average value of the filtered time difference signal is calculated as the non-zero time error. This method realizes the adaptive selection of the filtering method by analyzing the slope characteristics of the time difference signal. When the signal changes smoothly, a simple smoothing filter is used, and when the signal changes violently, a frequency domain filter is used to accurately filter out interference. In this way, the optimal filtering algorithm can be selected according to the characteristics of the signal, ensuring the filtering effect while minimizing the amount of calculation and improving processing efficiency. Obtaining the non-zero time error through adaptive filtering can accurately reflect the interference error and provide a reliable basis for subsequent compensation. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 A schematic diagram of the gas meter anti-electromagnetic interference method provided in an embodiment of the present application;
[0056] Figure 2 A schematic diagram of the gas meter anti-electromagnetic interference device provided in an embodiment of the present application;
[0057] Figure 3 A schematic diagram of the structure of an electronic device provided in this application.
[0058] Description of the drawings: 1. Data acquisition module; 2. State determination module; 3. Interference determination module; 4. Error determination module; 5. Error compensation module; 300. Electronic device; 301. Processor; 302. Communication bus; 303. User interface; 304. Network interface; 305. Memory. DETAILED DESCRIPTION
[0059] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0060] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.
[0061] In the description of the embodiments of the present application, the term "multiple" means two or more. For example, multiple devices refer to two or more devices, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0062] In order to facilitate understanding of the method and device provided by the embodiments of the present application, before introducing the embodiments of the present application, the background of the embodiments of the present application is first introduced.
[0063] As a clean energy, the use of natural gas is in a period of rapid growth in my country. In order to measure the use of natural gas, a gas flow meter is usually used. Among them, ultrasonic gas meters are widely used because they use the time difference method to measure the gas flow rate with high accuracy. However, in actual use, ultrasonic gas meters are easily affected by pipeline pressure fluctuations and external electromagnetic fields, resulting in measurement errors. At present, the error detection of sub-gas meters in the pipeline system still remains in the traditional method of regular inspection of all meters one by one. This method is time-consuming and labor-intensive, affecting the real-time performance of anti-interference processing.
[0064] Faced with the technical problem that ultrasonic gas meters are susceptible to interference, it is necessary to develop a more efficient sub-meter anomaly detection method to achieve real-time monitoring of the pipeline system and improve anti-interference capabilities. This is of great significance to ensure the accuracy of natural gas metering, carry out natural gas metering and management, and achieve efficient utilization of natural gas resources.
[0065] After the background introduction of the above content, those skilled in the art can understand the problems existing in the prior art. The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.
[0066] Based on the above background technology, please refer to Figure 1 , Figure 1 The architecture diagram of the gas meter anti-electromagnetic interference method provided in the embodiment of the present application, the device can be implemented by a computer program, or it can be run as an independent tool application. Specifically, in the embodiment of the present application, the method can be applied to a detector, but it can also be applied to electronic devices such as servers. The gas meter anti-electromagnetic interference method includes the following steps:
[0067] S101, obtaining an average value of the main gas flow rate of the main gas meter for a period of time, and an average value of the sub-gas flow rates of other sub-gas meters for a period of time;
[0068] Specifically, this embodiment first needs to obtain the average gas flow rate of the main gas meter and the sub-gas meter. The reason for obtaining the average flow rate of the main and sub-gas meters is that they can reflect the overall flow rate level of each meter over a period of time. Among them, the average flow rate of the main gas meter is globally representative and can reflect the total flow of the entire pipe network system. The average flow rate of each sub-gas meter represents the local flow level in the local area. In order to detect whether the sub-gas meter is interfered with, it is necessary to compare the average flow rate of the main meter with the average flow rate of all sub-meters. If the local flow of the sub-meter does not match the total flow of the main meter, it can be determined that there may be a table in an abnormal and non-normal state in the sub-meter, thereby determining the subsequent anti-interference detection direction. Therefore, obtaining the average flow rate of the main and sub-meters is the basis for abnormal judgment and the primary step in implementing subsequent anti-interference processing. By analyzing the average flow rate of the main and sub-meters, the abnormal condition of the sub-meter can be effectively detected, laying the foundation for anti-interference processing.
[0069] S102, when the main gas flow rate is not equal to the sum of the average values of all the sub-gas flow rates, determining that one of the sub-gas meters is in an abnormal state;
[0070] Specifically, after obtaining the average flow rate of the main and sub-gas meters, it is necessary to compare the average flow rate of the main gas meter with the sum of the average flow rates of all sub-gas meters. The reason for such a comparison is that the flow rate of the main meter represents the total flow of the entire pipe network system, and the sum of the flow rates of the sub-meters should also represent the flow of the entire system. If the two are not equal, it means that the local flow of the sub-meter does not match the total flow of the system, and it is very likely that some of the sub-meters are abnormal.
[0071] Specifically, if the average value of the main gas flow rate is not equal to the sum of the average values of all sub-gas flow rates, it can be determined that there is an abnormal gas meter in the sub-gas meter, and it can be determined that a meter in the sub-meter is interfered with. This comparison method can quickly determine whether there is a problem meter in the sub-meter, locate the abnormal area, and lay the foundation for subsequent anti-interference detection. In this way, the detection of normal sub-meters can be skipped, and the sub-meters with abnormalities can be directly determined, greatly improving the detection efficiency. By comparing the average flow rates of the main and sub-meters, abnormal sub-gas meters can be quickly and effectively identified, and the abnormal conditions of the sub-meters can be determined, providing a basis for subsequent anti-interference processing.
[0072] S103, performing anti-interference detection on all the sub-gas meters to determine the sub-gas meters that are interfered with;
[0073] Specifically, in order to determine whether the sub-gas meter is interfered with, it is necessary to first obtain the time difference signals of all sub-gas meters within a period of time. The reason for obtaining the time difference signal of the sub-gas meter is that it reflects the time difference when the ultrasonic wave propagates in the measurement pipeline and contains the working status information of the meter. When the meter is interfered with, its time difference signal will be abnormal. Therefore, the time difference signal can be used as a basis for determining whether the meter is interfered with.
[0074] Specifically, when the pipeline is transmitting gas normally, the time difference between the signals sent by the upstream and downstream sensors received by the ultrasonic probe corresponding to each sub-gas meter is obtained, that is, the time difference signal. The time difference signal is collected for a period of time for all sub-meters to obtain the continuous working status information of the meter. The data for obtaining the sub-meter time difference signal includes the time difference value of each sampling point and the corresponding sampling time. These sub-meter time difference signals can reflect the working characteristics of each meter and are the basic data for subsequent judgment of whether the meter is interfered. Therefore, obtaining the time difference signals of all sub-meters over a period of time is the first step in subsequent interference detection.
[0075] Based on the above embodiment, as an optional embodiment, S103, performing anti-interference detection on all the sub-gas meters to determine the sub-gas meter that is interfered with, further includes the following steps:
[0076] S201, obtaining time difference signals of all sub-gas meters for a period of time;
[0077] S202, performing Fourier transform on the time difference signal to obtain a corresponding frequency spectrum time difference signal;
[0078] Specifically, after obtaining the time difference signal of the sub-gas meter, it is necessary to further perform Fourier transform on the time difference signal to obtain the corresponding spectrum signal. The reason for Fourier transform is to convert the time difference signal from the time domain to the frequency domain to obtain its spectrum information. The time domain waveform is not intuitive and sensitive enough to judge the abnormality of the signal, but by performing Fourier transform, the specific distribution of the signal on different frequency components can be obtained. The spectrum information can more clearly reflect the abnormal changes of the signal.
[0079] Specifically, the fast Fourier transform algorithm is used to perform Fourier transform on the time difference signal of each sub-meter to obtain the complex spectrum result on each frequency component. After processing, the amplitude spectrum corresponding to the time difference signal can be extracted, that is, the spectrum time difference signal. The spectrum time difference signal can intuitively represent the intensity distribution of the sub-meter signal at different frequencies. By analyzing the spectrum time difference signal, it can be determined whether the sub-meter is interfered with. The spectrum analysis of the time difference signal provides frequency domain information for detecting the abnormal state of the meter, making the anti-interference detection clearer and more reliable, and laying the foundation for the subsequent determination of the interfered sub-meter.
[0080] S203, performing amplitude analysis based on the frequency spectrum time difference signal, and when the amplitude exceeds a preset amplitude threshold, determining that the corresponding sub-gas meter is interfered.
[0081] Specifically, after obtaining the spectrum time difference signal of the sub-gas meter, it is necessary to perform amplitude analysis based on the spectrum signal to determine whether there is an abnormality. The reason for performing spectrum amplitude analysis is that when the meter is disturbed, abnormal amplitude changes will appear in the spectrum of its time difference signal, and this abnormality can be detected by analyzing the spectrum amplitude.
[0082] Specifically, it traverses all frequency components of the spectrum time difference signal and analyzes the amplitude of the signal at each frequency. It is compared with the standard amplitude range under normal working conditions of the meter to determine whether the current spectrum amplitude exceeds the normal threshold. When an abnormal amplitude exceeding the threshold is detected in the spectrum time difference signal, it can be determined that the corresponding sub-meter is interfered.
[0083] Spectrum amplitude analysis can intuitively reflect the abnormal changes of sub-meter signals. Interference can be detected through simple threshold comparison, avoiding the complex time domain analysis process, making anti-interference detection faster and more effective. Finally, all sub-gas meters affected by interference can be automatically determined. Time difference signal spectrum analysis provides a simple and reliable technical means for accurately identifying the affected sub-meters.
[0084] S104, filtering the interfered sub-gas meter to obtain a non-zero time error;
[0085] Specifically, after determining the interfered sub-gas meters, these interfered meters need to be filtered to eliminate the influence of interference on the signal and obtain the real non-zero time error of the meter. The reason for filtering is that the interfered time difference signal contains interference error, which needs to be removed by filtering to obtain the actual time error of the meter.
[0086] Specifically, when the user stops using gas, the time difference signal of the interfered meter is collected for a period of time. Then, according to the characteristics of the time difference signal, an adaptive filtering method is selected, such as smoothing filtering or frequency domain filtering, to process the signal. After filtering, the noise and interference components in the time difference signal can be filtered out, and the true time error of the meter, that is, the non-zero time error, can be extracted.
[0087] Appropriate filtering can effectively remove the noise in the interfered time difference signal and obtain the actual time error characteristics of the sub-meter. This provides an accurate basis for subsequent error compensation. Filtering the interfered table is one of the key steps to achieve accurate compensation and improve the accuracy of the table.
[0088] It should be noted that non-zero time error refers to the error that the sensor outputs a non-zero value due to its own reasons when the input value is zero under ideal calibration conditions. For the sub-meter in the gas meter, non-zero time error refers to the constant non-zero change in the time difference signal output by the sub-meter due to its own reasons when the gas flow rate is zero. This non-zero change will directly cause the sub-meter to measure the flow rate deviation, so it is necessary to extract the non-zero time error and compensate it to improve the measurement accuracy and anti-interference performance of the sub-meter.
[0089] Based on the above embodiment, as an optional embodiment, S104, filtering the interfered sub-gas meter to obtain a non-zero time error, further includes the following steps:
[0090] S301, when the user stops using gas, collecting the time difference signal of the interfered sub-gas meter for a period of time;
[0091] Specifically, before performing filtering processing on the interfered sub-meter, the embodiment needs to collect the time difference signal of the sub-meter. The time difference signal is collected during the period when the user stops using gas. This period is selected because there is no gas flow in the pipeline at this time. The time difference signal only contains the error of the sub-meter itself, which will not cause additional impact on the signal, and the actual time difference characteristics of the sub-meter can be obtained.
[0092] Specifically, after the pipeline network confirms that gas transmission has been stopped, the signal acquisition device of the disturbed sub-meter is turned on to collect the time difference signal of the sub-meter within a period of time, and obtain a time difference signal waveform containing multiple continuous sampling points. The collected time difference signal can fully reflect the working status and time difference change characteristics of the sub-meter. The purpose of collecting the no-flow time difference signal is to obtain the actual time error of the meter and provide the time difference signal data containing the error characteristics of the sub-meter itself for subsequent filtering processing. Only by collecting the time difference signal in the no-flow state can the true non-zero time error of the meter be extracted in the subsequent filtering.
[0093] S302, calculating the absolute value of the slope between the time difference signals of adjacent sampling points based on the time difference signal of the sub-gas meter for a period of time, and calculating the average value of the absolute value of the slope based on all the absolute values of the slope;
[0094] Specifically, after obtaining the flow-free time difference signal, it is necessary to calculate the slope between the sampling points based on the time difference signal. The reason for calculating the slope is to analyze the rate of change of the time difference signal as a criterion for selecting the filtering method. Specifically, traverse the time difference signal sampling point data and calculate the slope between two adjacent points, that is, △y / △x. Among them, △y is the difference between the time difference values of the two points, and △x is the corresponding time difference. In this way, the absolute value of the slope between all sampling points can be obtained. Then calculate the average of these slope absolute values as an evaluation indicator of the severity of the change of the time difference signal.
[0095] The average slope value can reflect the overall change of the time difference signal. The larger the absolute value of the slope, the more dramatic the change of the time difference signal; conversely, it means that the signal changes slowly. According to the change characteristics of the time difference signal, different filtering methods such as smoothing filtering or frequency domain filtering can be selected. Calculating the slope of the time difference signal and obtaining the average slope provides a basis for the subsequent adaptive selection of the filtering mode, which is a key step in realizing adaptive filtering.
[0096] S303, determining an adaptive threshold based on the average value of the absolute value of the slope;
[0097] Specifically, after calculating the average slope of the time difference signal, an adaptive threshold needs to be determined based on the average as a criterion for judging the severity of the signal change. The adaptive threshold is set to dynamically select the optimal threshold of the filtering method according to the specific change characteristics of the time difference signal.
[0098] Specifically, multiple candidate thresholds can be pre-set, and then the calculated average slope of the time difference signal is compared with each candidate threshold, and the best matching one is selected as the adaptive threshold. For example, when the average slope is below 0.5, 0.5 is selected as the threshold; when the average slope is between 0.5 and 1, 1 is selected as the threshold. The purpose of determining the adaptive threshold is to further set the optimal boundary for distinguishing the filtering method based on the average slope evaluation of the signal change characteristics.
[0099] Based on the above embodiment, as an optional embodiment, S303, determining the adaptive threshold based on the average value of the absolute value of the slope, further includes the following steps:
[0100] S401, if the average value of the absolute value of the slope is less than 1, the adaptive threshold is 1;
[0101] Specifically, when determining the adaptive threshold, it is necessary to first determine whether the average slope value of the time difference signal is less than 1. The reason for making this determination first is that the slope value of the time difference signal directly reflects the severity of the signal change. When the average slope value is small, it means that the time difference signal changes more slowly.
[0102] Specifically, if the calculated average value of the absolute value of the slope of the time difference signal is less than 1, it is determined that the signal change trend is relatively stable. At this time, in order to ensure the filtering effect, a lower value of 1 is directly taken as the adaptive threshold. This can avoid selecting too high a threshold to cause poor filtering effect.
[0103] S402, if the average value of the absolute value of the slope is greater than 5, the adaptive threshold is 5;
[0104] Specifically, when determining the adaptive threshold, in addition to determining whether the average slope of the time difference signal is less than 1, it is also necessary to determine whether the average slope of the time difference signal is greater than 5. The reason for this determination is that when the average slope is large, it means that the time difference signal changes more drastically.
[0105] Specifically, if the average absolute value of the slope of the time difference signal is greater than 5, it can be determined that the signal changes dramatically. At this time, if a lower threshold is still used for smoothing filtering, a good denoising effect cannot be achieved. In order to ensure the filtering quality, a higher value of 5 needs to be set as the adaptive threshold.
[0106] S403: If 1 is greater than or equal to the average value of the absolute value of the slope and is less than or equal to 5, adaptively adjust the adaptive threshold so that the non-zero time error is minimized.
[0107] Specifically, when determining the adaptive threshold, it is also necessary to consider the case where the average slope value of the time difference signal is between 1 and 5. The reason for this judgment is that when the average slope value is within the range of 1 to 5, a fixed threshold cannot be simply selected.
[0108] Specifically, if the average value of the absolute value of the slope of the time difference signal is between 1 and 5, 1 or 5 cannot be directly selected as the threshold, and adaptive adjustment is required to select a threshold that makes the final non-zero time error most accurate. The method for determining the adaptive threshold is: first determine multiple candidate thresholds, such as 2, 3, and 4, and then test different thresholds, compare the accuracy of the final non-zero time error, and select the candidate threshold that makes the non-zero time error most accurate as the adaptive threshold.
[0109] S304, if the average value is less than the adaptive threshold, filtering the time difference signal by an improved smoothing filter to obtain a filtered time difference signal;
[0110] Specifically, after determining the adaptive threshold, it is necessary to select a filtering method according to the threshold. Specifically, if the calculated average slope of the time difference signal is less than the adaptive threshold, the improved smoothing filter is used to process the time difference signal. The reason why smoothing filtering is selected when the signal changes relatively slowly is that in this case, smoothing filtering can achieve a good denoising effect, while the amount of calculation is small and the processing efficiency is high. The specific smoothing filtering method is to use an improved algorithm, consider the time correspondence of each sampling point, perform weighted calculation on the sampling points, and output the smoothed sampling points as the filtered signal.
[0111] In this way, when the time difference signal changes slowly, the use of improved smoothing filtering can effectively reduce noise and interference, improve the signal-to-noise ratio, and improve computational efficiency. Smoothing filtering will not cause excessive smoothing of the signal and can accurately retain the effective components of the time difference signal. Adopting an adaptive filtering mode based on the slope of the time difference signal is the key to achieving accurate filtering.
[0112] Based on the above embodiment, as an optional embodiment, S304, if the average value is less than the adaptive threshold, filtering the time difference signal by an improved smoothing filter to obtain a filtered time difference signal, further includes the following steps:
[0113] S501, performing discrete Fourier transform on the time difference signal to obtain a corresponding frequency spectrum time difference signal;
[0114] Specifically, in order to analyze the characteristics of the time difference signal in the frequency domain, it is necessary to first perform Fourier transform on the time difference signal to obtain the corresponding spectrum signal. The reason for Fourier transform is that the frequency domain characteristics of the time difference signal as a time domain signal cannot be directly observed. Frequency domain analysis can directly reflect the distribution of the signal frequency components and can intuitively determine whether the signal is interfered with. Specifically, the discrete Fourier transform algorithm is used to perform Fourier transform on the sampling points of the time difference signal to obtain the spectrum distribution corresponding to the time difference signal, that is, the spectrum time difference signal. The time difference signal can be converted from the time domain to the frequency domain through Fourier transform, and spectrum analysis can be performed to determine whether the time difference signal is abnormal and find out whether the sub-gas meter is interfered with. The conversion of time domain signals to frequency domain is the basis for subsequent spectrum analysis.
[0115] S502, constructing a filter based on the corresponding time difference signal spectrum;
[0116] Specifically, after obtaining the spectrum of the time difference signal, it is necessary to build a digital filter based on the spectrum to filter the noise in the time difference signal. The reason for building a filter is that the spectrum directly reflects the content of the signal in each frequency component. The parameters of the filter can be designed according to the spectrum conditions to perform customized filtering. Specifically, the spectrum time difference signal is analyzed to determine the frequency range where the noise and interference signals are located, and then the parameters of the digital filter are designed to have a lower pass rate within the target frequency range, thereby filtering out the specified frequency range. Constructing a filter for the spectrum of the time difference signal can effectively filter out the corresponding noise components in the spectrum, retain the useful time difference signal, and improve the filtering effect. Designing a filter according to the specific spectrum conditions of the time difference signal is the key to frequency domain filtering.
[0117] S503, filtering the spectrum time difference signal based on the filter to obtain a filtered spectrum time difference signal;
[0118] Specifically, after constructing a digital filter for the time difference signal spectrum, it is necessary to filter the spectrum time difference signal based on the filter to obtain the filtered time difference signal spectrum. The reason for spectrum filtering is that filtering in the frequency domain can directly process the amplitude value of the signal at each frequency point, which can effectively suppress or retain the components in a specific frequency range.
[0119] Specifically, the constructed digital filter and the time difference signal spectrum are used as inputs, and the frequency components corresponding to the noise are filtered out by performing spectrum multiplication operations, and the frequency components of the useful signal are retained, thereby obtaining the filtered time difference signal spectrum. Frequency domain filtering can make full use of the spectrum information for accurate and directional filtering, effectively remove the noise in the spectrum, retain useful information, and improve signal quality. The filtered time difference signal spectrum is the key to accurately restore the original time difference signal.
[0120] S504, performing discrete Fourier transform on the filtered spectrum time difference signal to obtain a filtered time difference signal.
[0121] Specifically, after the time difference signal is filtered in the frequency domain, the filtered spectrum signal needs to be inverse Fourier transformed to obtain the filtered time domain time difference signal. The reason for the inverse transform is that the time difference signal in the time domain needs to be analyzed and processed later, and the result after the frequency domain filtering is the spectrum signal, which must be converted back to the time domain representation.
[0122] Specifically, the inverse discrete Fourier transform algorithm is applied to the filtered spectrum time difference signal to convert the complex signal at each frequency point into the amplitude value of the time domain sampling point, and obtain the filtered time difference signal sampling point sequence, that is, the actual time domain waveform data. The inverse transformation is to convert the filtered result back to an analyzable time domain waveform, providing a processable data form for subsequent non-zero time error calculations. The inverse transformation of the spectrum signal into a time difference signal waveform is the last step in the frequency domain filtering implementation.
[0123] S305, if the average value is greater than the adaptive threshold, filtering all the time difference signals through frequency domain filtering to obtain time difference signals after filtering all the time difference signals;
[0124] Specifically, after determining the adaptive threshold, if the average slope of the time difference signal is greater than the adaptive threshold, it means that the time difference signal changes violently, and it is necessary to use frequency domain filtering to filter the signal. The reason why frequency domain filtering is selected when the signal changes violently is that simple smoothing filtering cannot achieve a good denoising effect in this case. Frequency domain filtering can process the characteristics of the signal in the frequency domain and can better retain the useful signal. The specific method is to first convert the time difference signal to the frequency domain through fast Fourier transform, then design a digital filter, filter the signal according to the predetermined frequency characteristics, and finally convert the filtered frequency domain signal back to the time domain through inverse Fourier transform to obtain the filtered time difference signal. In this way, the noise and interference in the time difference signal can be effectively suppressed by frequency domain filtering, the signal-to-noise ratio of the signal can be improved, and the purified time difference signal can be obtained. When the time difference signal changes violently, frequency domain filtering can process the signal more finely to avoid distortion and obtain a filtered signal reflecting the true non-zero time error of the sub-table.
[0125] Based on the above embodiment, as an optional embodiment, S305, if the average value is greater than the adaptive threshold, all the time difference signals are filtered by frequency domain filtering to obtain the time difference signals after filtering all the time difference signals, and the following steps are also included:
[0126] S601, performing discrete Fourier transform on the time difference signal to obtain a corresponding frequency spectrum time difference signal;
[0127] Specifically, in order to analyze the characteristics of the time difference signal in the frequency domain, it is necessary to first perform Fourier transform on the time difference signal to obtain the corresponding spectrum signal. The reason for Fourier transform is that the time difference signal is a time domain signal, and its frequency domain characteristics cannot be directly observed. Frequency domain analysis can directly reflect the distribution of the signal frequency components and can intuitively determine whether the signal is interfered.
[0128] Specifically, the discrete Fourier transform algorithm is used to perform Fourier transform on the sampling points of the time difference signal to obtain the spectrum distribution corresponding to the time difference signal, that is, the spectrum time difference signal. The Fourier transform can be used to convert the time difference signal from the time domain to the frequency domain, and perform spectrum analysis to determine whether the time difference signal is abnormal and find out whether the sub-gas meter is interfered. The conversion of the time domain signal to the frequency domain is the basis for subsequent spectrum analysis.
[0129] S602, constructing a filter based on the corresponding time difference signal spectrum;
[0130] Specifically, after obtaining the spectrum of the time difference signal, it is necessary to build a digital filter based on the spectrum to filter the noise in the time difference signal. The reason for building a filter is that the spectrum directly reflects the content of the signal in each frequency component. The parameters of the filter can be designed according to the spectrum conditions to perform customized filtering. Specifically, the spectrum time difference signal is analyzed to determine the frequency range where the noise and interference signals are located, and then the parameters of the digital filter are designed to have a lower pass rate within the target frequency range, thereby filtering out the specified frequency range. Constructing a filter for the spectrum of the time difference signal can effectively filter out the corresponding noise components in the spectrum, retain the useful time difference signal, and improve the filtering effect. Designing a filter according to the specific spectrum conditions of the time difference signal is the key to frequency domain filtering.
[0131] S603, filtering the spectrum time difference signal based on the filter to obtain a filtered spectrum time difference signal;
[0132] Specifically, after constructing a digital filter for the time difference signal spectrum, it is necessary to filter the spectrum time difference signal based on the filter to obtain the filtered time difference signal spectrum. The reason for spectrum filtering is that filtering in the frequency domain can directly process the amplitude value of the signal at each frequency point, which can effectively suppress or retain the components in a specific frequency range. Specifically, the constructed digital filter and the time difference signal spectrum are used as inputs, and the frequency components corresponding to the noise are filtered out by performing spectrum multiplication operations, and the frequency components of the useful signal are retained, thereby obtaining the filtered time difference signal spectrum. Frequency domain filtering can make full use of the spectrum information for accurate and directional filtering processing, effectively remove the noise in the spectrum, retain useful information, and improve the signal quality. The filtered time difference signal spectrum is the key to accurately restore the original time difference signal.
[0133] S604, performing discrete Fourier transform on the filtered spectrum time difference signal to obtain a filtered time difference signal.
[0134] Specifically, after the time difference signal is filtered in the frequency domain, the filtered spectrum signal needs to be inverse Fourier transformed to obtain the filtered time domain time difference signal. The reason for the inverse transform is that the time difference signal in the time domain needs to be analyzed and processed later, and the result after the frequency domain filtering is the spectrum signal, which must be converted back to the time domain representation.
[0135] Specifically, the inverse discrete Fourier transform algorithm is applied to the filtered spectrum time difference signal to convert the complex signal at each frequency point into the amplitude value of the time domain sampling point, and obtain the filtered time difference signal sampling point sequence, that is, the actual time domain waveform data. The inverse transformation is to convert the filtered result back to an analyzable time domain waveform, providing a processable data form for subsequent non-zero time error calculations. The inverse transformation of the spectrum signal into a time difference signal waveform is the last step in the frequency domain filtering implementation.
[0136] S306: Based on the filtered time difference signal, perform average value calculation to obtain a non-zero time error.
[0137] Specifically, after the time difference signal is adaptively filtered, the non-zero time error needs to be calculated based on the filtered time difference signal. This is because the filtered time difference signal has removed noise and interference components and can reflect the actual working state of the sub-meter.
[0138] Specifically, it is to traverse the sampling points of the time difference signal after filtering and calculate the arithmetic mean of these sampling points. This average value represents the non-zero time error of the sub-meter during this period of time. The average value calculation can eliminate the residual random error after filtering and obtain the true non-zero time error characteristics of the sub-meter. The final non-zero time error can accurately reflect the actual working state of the sub-meter, provide a reliable reference for subsequent compensation, and thus improve the accuracy of gas measurement.
[0139] S105, compensating the disturbed sub-gas meter based on the non-zero time error to obtain a correct gas flow rate.
[0140] See also Figure 2 , Figure 2 The gas meter anti-electromagnetic interference device architecture diagram provided in the embodiment of the present application may include:
[0141] Data acquisition module 1, used to obtain the average value of the main gas flow rate of the main gas meter over a period of time, and the average value of the sub-gas flow rates of other sub-gas meters over a period of time;
[0142] A state determination module 2, configured to determine that a gas meter among the sub-gas meters is in an abnormal state when the main gas flow rate is not equal to the sum of the average values of all the sub-gas flow rates;
[0143] Interference determination module 3, used for performing anti-interference detection on all the sub-gas meters to determine the sub-gas meters that are interfered with;
[0144] The error determination module 4 is used to filter the sub-gas meter that is disturbed to obtain a non-zero time error;
[0145] The error compensation module 5 is used to compensate the disturbed sub-gas meter based on the non-zero time error to obtain the correct gas flow rate.
[0146] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0147] Please refer to Figure 3 The application also discloses an electronic device. Figure 3The electronic device 300 may include: at least one processor 301 , at least one network interface 304 , a user interface 303 , a memory 305 , and at least one communication bus 302 .
[0148] The communication bus 302 is used to realize the connection and communication between these components.
[0149] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0150] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0151] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect the parts within the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field~Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 301 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 301, and it can be implemented separately through a chip.
[0152] Among them, the memory 305 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read~Only Memory). Optionally, the memory 305 includes a non-transitory computer~readable storage medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area may store data involved in the above-mentioned method embodiments, etc. The memory 305 may optionally also be at least one storage device located away from the aforementioned processor 301. Refer to Figure 3 The memory 305 as a computer storage medium may include an operating device, a network communication module, a user interface module, and an application program of a gas meter anti-electromagnetic interference method.
[0153] exist Figure 3 In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call the application program storing the gas meter anti-electromagnetic interference method in the memory 305. When executed by one or more processors 301, the electronic device 300 executes one or more methods in the above-mentioned embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application. In the above embodiments, the descriptions of the embodiments have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0154] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0155] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0156] The present application also provides a computer storage medium that can store multiple instructions, which are suitable for being loaded and executed by a processor as described above. Figure 1 The gas meter anti-electromagnetic interference method of the embodiment shown in the figure can be found in the specific implementation process. Figure 1 The specific description of the illustrated embodiment will not be repeated here.
[0157] In addition, each functional unit in the embodiment of the present application may be integrated into one processing unit, or the unit may exist physically alone, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0158] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method of the embodiment of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.
[0159] The above are only exemplary embodiments of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure.
[0160] This application is intended to cover any variation, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art not described in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A method for preventing electromagnetic interference of a gas meter, characterized in that: The method comprises: Obtain the average value of the main gas flow rate of the main gas meter over a period of time, and the average value of the sub-gas flow rates of other sub-gas meters over a period of time; When the main gas flow rate is not equal to the sum of the average values of all the sub-gas flow rates, it is determined that one of the sub-gas meters is in an abnormal state; When a gas meter among the sub-gas meters is in an abnormal state, obtaining time difference signals of all the sub-gas meters for a period of time; Performing Fourier transform on the time difference signal to obtain a corresponding frequency spectrum time difference signal; Performing amplitude analysis based on the spectrum time difference signal, and determining that the corresponding sub-gas meter is interfered when the amplitude exceeds a preset amplitude threshold; When the user stops using gas, the time difference signal of the disturbed sub-gas meter is collected for a period of time; Based on the time difference signal of the sub-gas meter for a period of time, the absolute value of the slope between the time difference signals of adjacent sampling points is calculated, and based on all the absolute values of the slope, the average value of the absolute values of the slope is calculated; determining an adaptive threshold based on an average of the absolute values of the slopes; If the average value is less than the adaptive threshold, filtering the time difference signal by an improved smoothing filter to obtain a filtered time difference signal; If the average values are all greater than the adaptive threshold, all the time difference signals are filtered by frequency domain filtering to obtain the filtered time difference signals of all the time difference signals; Based on the filtered time difference signal, average value calculation is performed to obtain a non-zero time error; The disturbed sub-gas meter is compensated based on the non-zero time error to obtain the correct gas flow rate.
2. The method for preventing electromagnetic interference of a gas meter according to claim 1, characterized in that: The step of determining the adaptive threshold based on the average value of the absolute value of the slope comprises: If the average value of the absolute value of the slope is less than 1, the adaptive threshold is 1; If the average value of the absolute value of the slope is greater than 5, the adaptive threshold is 5; If 1 is greater than or equal to the average value of the absolute value of the slope and is less than or equal to 5, the adaptive threshold is adaptively adjusted to minimize the non-zero time error.
3. The method for preventing electromagnetic interference of a gas meter according to claim 1, characterized in that: The filtering process of the time difference signal by using an improved smoothing filter to obtain a filtered time difference signal comprises: Determine the maximum and minimum values of the time difference signal in the time difference signal of the sub-gas meter within a period of time; Substituting the maximum value and the minimum value of the time difference signal into the improved smoothing filter formula, the filtered time difference signal is obtained.
4. The gas meter anti-electromagnetic interference method according to claim 1, wherein the filtering process of all the time difference signals by frequency domain filtering to obtain the filtered time difference signals of all the time difference signals comprises: Performing discrete Fourier transform on the time difference signal to obtain a corresponding frequency spectrum time difference signal; Constructing a filter based on the corresponding time difference signal spectrum; Filtering the spectrum time difference signal based on the filter to obtain a filtered spectrum time difference signal; Perform discrete Fourier transform on the filtered spectrum time difference signal to obtain a filtered time difference signal.
5. The method for preventing electromagnetic interference of a gas meter according to claim 1, characterized in that: Before obtaining the average value of the main gas flow rate of the main gas meter for a period of time and the average value of the sub-gas flow rates of other sub-gas meters for a period of time, the method further includes: The instantaneous large flow rate fluctuations in the main gas flow rate measured by the main gas meter over a period of time are eliminated.
6. A gas meter anti-electromagnetic interference device, characterized in that: include: A data acquisition module (1) is used to acquire an average value of the main gas flow rate of the main gas meter over a period of time, and an average value of the sub-gas flow rates of other sub-gas meters over a period of time; A state determination module (2), configured to determine that a gas meter among the sub-gas meters is in an abnormal state when the main gas flow rate is not equal to the sum of the average values of all the sub-gas flow rates; An interference determination module (3) is used to obtain time difference signals of all sub-gas meters for a period of time when one of the sub-gas meters is in an abnormal state; Performing Fourier transform on the time difference signal to obtain a corresponding frequency spectrum time difference signal; Performing amplitude analysis based on the spectrum time difference signal, and determining that the corresponding sub-gas meter is interfered when the amplitude exceeds a preset amplitude threshold; An error determination module (4) is used to collect the time difference signal of the disturbed sub-gas meter within a period of time when the user stops using gas; Based on the time difference signal of the sub-gas meter for a period of time, the absolute value of the slope between the time difference signals of adjacent sampling points is calculated, and based on all the absolute values of the slope, the average value of the absolute values of the slope is calculated; determining an adaptive threshold based on an average of the absolute values of the slopes; If the average value is less than the adaptive threshold, filtering the time difference signal by an improved smoothing filter to obtain a filtered time difference signal; If the average values are all greater than the adaptive threshold, all the time difference signals are filtered by frequency domain filtering to obtain the time difference signals after filtering of all the time difference signals; Based on the filtered time difference signal, average value calculation is performed to obtain a non-zero time error; The error compensation module (5) is used to compensate the disturbed sub-gas meter based on the non-zero time error to obtain a correct gas flow rate.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method according to any one of claims 1 to 5.
8. An electronic device, characterized in that: The invention comprises a processor, a memory and a transceiver, wherein the memory is used to store instructions, the transceiver is used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method according to any one of claims 1 to 5.
