A filtering algorithm for electromagnetic flow meters

CN117171501BActive Publication Date: 2026-10-20SHANGHAI KENT INSTR CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311290720.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-07
Publication Date
2026-10-20
Estimated Expiration
2043-10-07

AI Technical Summary

Technical Problem

[0004]为了解决在高干扰场合中电磁流量计难以达到高精度快速响应测量的问题,本申请提供一种电磁流量计滤波算法,采取引入权重系数对测量值进行修正,引入限制系数对响应速度和流速稳定性进行平衡,从而实现高精度快速响应测量

Benefits of technology

1.采取引入权重系数对测量值进行修正,引入限制系数对响应速度和流速稳定性进行平衡,从而实现高精度快速响应测量;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117171501B_ABST
    Figure CN117171501B_ABST
Patent Text Reader

Abstract

The application relates to a filtering algorithm for an electromagnetic flowmeter, which comprises the following steps: acquiring a forward sampling data array PS[N] and a reverse sampling data array NS[N] in one excitation period; calculating fluctuation coefficients BND[K] and BPD[K]; acquiring an internal conversion coefficient of the electromagnetic flowmeter, and calculating a raw flow rate value LS1[n]; analyzing the fluctuation coefficients BND[K] and BPD[K] to make trend judgment, and obtaining a flow rate weight QZ[n] corresponding to the raw flow rate value LS1[n] of the excitation period; calculating a rough screening flow rate LS2[l]; acquiring the results of flow rate quick response judgment and alarm quick response judgment, generating a limiting coefficient, and dynamically adjusting the rough screening flow rate LS2[l] based on the limiting coefficient; and outputting a filtered flow rate. The application reduces the influence of abnormal data by making trend judgment on the fluctuation coefficients and adjusting the flow rate weight QZ[n] in real time; the limiting coefficient is reserved as a means for dynamically adjusting the response speed, so that the flow rate can be stably output when the flow rate is stable, and the flow rate can be quickly responded when the flow rate rises or falls.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of metrology instrument technology, and in particular to a filtering algorithm for an electromagnetic flowmeter. Background Technology

[0002] An electromagnetic flowmeter is an instrument that measures the volumetric flow rate of conductive liquids using Faraday's law of electromagnetic induction. It mainly consists of a signal converter, measuring electrodes, and an excitation coil. The excitation coil generates a constant alternating magnetic field. When the conductive liquid flows in the pipe, it perpendicularly cuts the magnetic field lines generated by the excitation coil, inducing an electromotive force (EMF) on the measuring electrodes. This induced EMF is proportional to the flow velocity of the conductive liquid. Therefore, by measuring the voltage across the measuring electrodes, the flow velocity of the conductive liquid can be obtained, and thus the volumetric flow rate can be calculated.

[0003] As is known from the working principle of electromagnetic flowmeters, they are highly sensitive to magnetic fields. They are widely used in various high-interference environments, where they encounter complex interference conditions, including various chemical reactions, ultra-low conductivity, interference from conductive media, and various power frequency or frequency conversion interferences. Achieving high-precision, rapid response measurement with electromagnetic flowmeters in such environments is difficult, highlighting the urgent need to address the flow control feedback problem in high-interference situations. Summary of the Invention

[0004] To address the challenge of achieving high-precision, rapid-response measurement using electromagnetic flowmeters in high-interference environments, this application provides an electromagnetic flowmeter filtering algorithm. This algorithm introduces weighting coefficients to correct the measured values ​​and introduces limiting coefficients to balance response speed and flow velocity stability, thereby achieving high-precision, rapid-response measurement.

[0005] An electromagnetic flowmeter filtering algorithm specifically includes the following steps: Obtain the forward sampled data array PS[N] and the reverse sampled data array NS[N] within one excitation cycle; The volatility coefficient BND[K] is calculated based on the forward sampled data array PS[N], and the volatility coefficient BPD[K] is calculated based on the reverse sampled data array NS[N]. The internal conversion coefficient of the electromagnetic flowmeter is obtained, and the original flow velocity value LS1[n] is calculated. The calculation formula is: LS1[n] = BND[K] - BPD[K] * internal conversion coefficient of electromagnetic flowmeter; The fluctuation coefficients BND[K] and BPD[K] are analyzed to determine the trend, and the flow velocity weight QZ[n] corresponding to the original flow velocity value LS1[n] of the excitation cycle is obtained. The larger the fluctuation trend, the smaller the flow velocity weight QZ[n]. Calculate the coarse screening flow velocity LS2[l] based on the original flow velocity value LS1[n] and the flow velocity weight QZ[n], and the calculation formula is: LS2[l]=∑(LS1[n]*QZ[n]) / n; Obtain the results of the flow velocity fast response judgment and the alarm fast response judgment, generate a limiting coefficient, and dynamically adjust the coarse screening flow velocity LS2[l] based on the limiting coefficient to obtain the filtered flow velocity; Output the filtered flow velocity.

[0006] By adopting the above technical solution, first calculate the fluctuation coefficient of the flow data group sampled within one excitation cycle to obtain the original flow velocity value LS1[n]; at the same time, perform trend judgment on the fluctuation coefficient, and adjust the flow velocity weight QZ[n] in real time according to the change trend, and perform weighted averaging on several original flow velocity values LS1[n] to obtain the coarse screening flow velocity LS2[l]. The abnormal fluctuation of flow velocity can be effectively found through the change of the fluctuation coefficient, and the flow velocity weight QZ[n] can be adjusted in real time to reduce the influence of abnormal data on the flow rate; finally, in order to realize the smooth filtering of the flow velocity, the limiting coefficient is reserved as a means of dynamically adjusting the response speed, so as to further intervene in the flow velocity signal, and finally realize stable filtering when the flow velocity is stable, with the filtered flow velocity output being stable; and when the flow velocity rises or falls, the filtered flow velocity responds quickly.

[0007] Preferably, the obtaining of the forward sampling data array PS[N] and the reverse sampling data array NS[N] specifically includes the following steps: Obtain the time T1 when the excitation reaches the constant current source and the ADC sampling time TN1; Determine whether T1>1000ms; if yes, output an excitation alarm signal; if no, obtain the time T2 of half an excitation cycle; Determine whether T1<T2 / 2; if not, output T2 as a value greater than 2 times T1; Calculate the excitation sampling start time T3=T1+5; Calculate the number of excitation samples N1=(T2-T3-1) / TN1, and perform a floor operation on N1; Sample the flow data according to T3 and N1, and store each sampling data into PS[N] or NS[N] respectively according to the positive and negative excitation cycles.

[0008] By adopting the above technical solution, the time T1 for the excitation to reach the constant current source is monitored, the excitation cycle is judged and adjusted, and the situation where the flow signal is measured before the excitation reaches the constant current source is avoided in the case of very large inductance. It is ensured that the measurement time of the forward excitation cycle and the reverse excitation cycle within one excitation cycle accounts for more than half, thereby improving the data density of excitation sampling. In addition, it can automatically detect excitation timing faults and provide timely alarm reminders to avoid outputting incorrect flow rate data.

[0009] Preferably, the step of calculating the positive periodic fluctuation coefficient BND[K] and negative periodic fluctuation coefficient BPD[K] of the data set from the positive sampled data array PS[N] and the negative sampled data array NS[N] specifically includes the following steps: Sort the data in PS[N] or NS[N] by size and remove some data from both ends; Calculate the average of the remaining PS[N] data to obtain the forward sampling average PVA; calculate the average of the remaining NS[N] data to obtain the backward sampling average NVA; Calculate the positive periodic volatility coefficient BPD[K]=∑(PS[N]-PVA)² / N and the negative periodic volatility coefficient BND[K]=∑(NS[N]-NVA)² / N for this set of data.

[0010] By adopting the above technical solution, the sampling data is sorted and the end value is removed, excitation abnormal data is eliminated, and subsequent calculation interference is reduced. As a result, the obtained fluctuation coefficient is more representative, and the changes in each fluctuation coefficient can effectively detect abnormal flow velocity fluctuations.

[0011] Preferably, the step of obtaining the flow velocity weight QZ[n] corresponding to LS1[n] of the excitation cycle by judging the trend of the fluctuation coefficients BND[K] and BPD[K] specifically includes the following steps: Calculate the average value of BND[K] and BPD[K] for the latest excitation cycles to obtain the average fluctuation coefficient BDA; Based on the ratio of BND[K] to BDA in the current excitation cycle and the ratio of BND[K-1] to BDA in the previous excitation cycle, the flow velocity weight QZ[n] is output.

[0012] By adopting the above technical solution, the weights affecting the flow rate are obtained based on the fluctuation coefficient, thereby reducing the impact of abnormal data on the flow rate and improving the stability of the flow rate.

[0013] Preferably, before performing a weighted calculation on the consecutive original flow velocity values ​​LS1[n], the method further includes the following steps: Determine whether the current PVA or NVA is greater than 5% of the average value of the previous PVA or NVA. If so, adjust the flow rate weight QZ[n] corresponding to LS1[n] of the current excitation cycle to 90%.

[0014] Polarization voltage is the ionization process of the conductive medium during electromagnetic flowmeter measurement. The signal is a DC signal variable, and the amplitude of polarization voltage is generally tens to hundreds of millivolts, while the actual flow velocity signal is generally less than 100uV. Based on this characteristic of electromagnetic flowmeter, we process the electromagnetic flowmeter, and by default, the value of PVA or NVA represents the polarization voltage signal. By adopting the above technical solution, the flow velocity weight QZ[n] is adjusted according to the change of polarization voltage, thereby reducing the influence of the change of polarization voltage of electromagnetic flowmeter on the coarse screen flow velocity LS2[l].

[0015] Preferably, before performing a weighted calculation on the consecutive original flow velocity values ​​LS1[n], the method further includes the following steps: Based on the measurement range of the electromagnetic flowmeter, determine whether LS1[n] exceeds the measurement range. For LS1[n] that exceeds the measurement range, take the average flow velocity value of the latest several LS1[n] to replace it. Compare the difference between each LS1[n] and the average flow velocity, and adjust the flow velocity weight QZ[n] accordingly: When LS1[n] exceeds the average flow velocity of 0.5 m / s, the flow velocity weight QZ[n] is multiplied by 0.9; When LS1[n] exceeds the average flow velocity of 1 m / s, the flow velocity weight QZ[n] is multiplied by 0.1.

[0016] Traditional electromagnetic flowmeters only determine whether the flow rate exceeds the flow rate range after obtaining the final filtered flow rate. By adopting the above technical solution, the original flow rate value LS1[n] is initially judged, and some flow rates that exceed the measurement range are eliminated to remove interference. In addition, the judgment of the change amplitude of LS1[n] is added, and the weighting coefficient is further adjusted according to the judgment result to reduce the impact of flow rate value fluctuation.

[0017] Preferably, the formula for calculating the filter flow rate is: filter flow rate [l] = LS2[l] * limit coefficient + filter flow rate [l-1] * (1 - limit coefficient), where the limit coefficient is greater than or equal to 0 and less than or equal to 1.

[0018] By adopting the above technical solution, under the influence of the limiting coefficient, the filtering flow rate [l] is affected by the previous filtering flow rate [l-1]. The previous filtering flow rate [l-1] and the current coarse screening flow rate LS2 [l] increase and decrease in opposite directions. When the limiting coefficient approaches 0, the filtering flow rate [l] inherits more from the previous filtering flow rate [l-1] and maintains a stable display. When the limiting coefficient approaches 1, the filtering flow rate [l] is more based on the current coarse screening flow rate LS2 [l], thus achieving a fast response.

[0019] Preferably, the step of obtaining the flow rate fast response to determine and generate the limiting coefficient specifically includes the following steps: Determine whether the coarse screen flow rate LS2[l] has an upward or downward trend: if yes, adjust the limiting coefficient to tend to 1; if no, adjust the limiting coefficient to tend to 0.

[0020] By adopting the above technical solution, the dynamic adjustment of the filter flow rate [l] can be achieved by monitoring the upward and downward trend of the coarse screen flow rate LS2[l] and the influence of the limiting coefficient on the return to a stable state. This allows for stable filtering when the conductor flow rate is stable and rapid response when the conductor flow rate increases or decreases.

[0021] Preferably, determining whether the coarse screen flow rate LS2[l] has an increasing or decreasing trend specifically includes the following steps: Take the latest LS2 data. If more than 80% of the data in the LS2 data are continuously increasing or decreasing, output the first judgment information as true. Take the latest number of LS2[l] and their filtering flow rate[l]. The first coefficient is ∑(LS2[l]-filtering flow rate[l])² / array number. If the first coefficient exceeds the first preset value, output the second judgment information as true. Take the latest several empty pipe data points. The second coefficient is calculated as ∑(empty pipe data array - average empty pipe data)² / array size. If the second coefficient exceeds the second preset value, output the third judgment information as true. If the first judgment information is true, and the second and / or third judgment information is true, then it is determined that the flow rate has an upward or downward trend.

[0022] By adopting the above technical solution, the monitoring of the first and second coefficients verifies the upward and downward trend of the coarse screen flow rate LS2[l], ensuring the correct change of the limit coefficient and further accurately adjusting the dynamic adjustment of the filter flow rate [l]. This enables stable filtering when the conductor flow rate is stable and rapid response when the conductor flow rate increases or decreases.

[0023] Preferably, the step of obtaining the alarm fast response judgment to generate the limitation coefficient specifically includes the following steps: The traffic alarm includes trusted alarm signals and untrusted alarm signals; When the trusted alarm signal is received, the restriction coefficient is forcibly set to 1; when the untrusted alarm signal is received, the restriction coefficient is forcibly set to 0. The excitation alarm signal belongs to the category of untrusted alarm signals.

[0024] By adopting the above technical solution, external sensors are installed to monitor the measurement environment or pipeline status. When an anomaly occurs, the limiting coefficient is adjusted first to avoid abnormal filtering flow velocity [l]. For example, in the case of an empty pipe alarm, if it is detected that there is indeed a sudden lack of conductor flow in the pipeline, the limiting coefficient is forcibly set to 1, and the filtering flow velocity [l] responds quickly to the sudden change in flow velocity. In the case of an excitation alarm, magnetic field alarm, or other interference alarm, the limiting coefficient is forcibly set to 0, and the filtering flow velocity [l] will inherit the value of the previous filtering flow velocity [l-1] and will not respond to the change of LS2 [l]. The filtering flow velocity [l] remains stable, reducing the impact of external interference on the flow velocity.

[0025] In summary, this application includes at least one of the following beneficial technical effects: 1. By introducing weighting coefficients to correct the measured values ​​and introducing limiting coefficients to balance the response speed and flow velocity stability, high-precision and fast-response measurement can be achieved; 2. The first-stage combined filtering scheme employs automatic adjustment measurement and filtering of individual flow data, combined with judgment of fluctuations and trends in single sets of flow data, and judgment of polarization voltage and trends. The second-stage combined filtering scheme combines flow velocity range control, coarse screening of flow data, and automatic transformation of flow weights. The third-stage combined filtering scheme combines trend judgment of coarse screening flow velocity, dynamic adjustment of response speed, and electromagnetic flow alarm. Each level of filtering is combined with the others, and they participate in calculation and control through data exchange. Attached Figure Description

[0026] Figure 1 This is a block diagram of an electromagnetic flowmeter filtering algorithm provided in an embodiment of this application; Figure 2 This is a block diagram illustrating the acquisition of a forward sampled data array PS[N] and a reverse sampled data array NS[N] within one excitation cycle, as provided in an embodiment of this application. Figure 3 This is a block diagram provided in this application embodiment for calculating the volatility coefficient BND[K] based on the forward sampled data array PS[N] and the volatility coefficient BPD[K] based on the reverse sampled data array NS[N]. Figure 4 This application provides a block diagram of the flow velocity weight QZ[n] corresponding to the original flow velocity value LS1[n] of the excitation cycle, obtained by analyzing the fluctuation coefficients BND[K] and BPD[K] to determine the trend. Detailed Implementation

[0027] To better understand the purpose, technical solutions, and advantages of this application, it has been described and illustrated below with reference to the accompanying drawings and embodiments. However, those skilled in the art should understand that this application can be implemented without these details. In some cases, to avoid obscuring various aspects of this application due to unnecessary description, well-known methods, processes, systems, components, and / or circuits already described at a higher level will not be elaborated upon. It will be apparent to those skilled in the art that various modifications can be made to the embodiments disclosed in this application, and the general principles defined in this application can be applied to other embodiments and application scenarios without departing from the principles and scope of this application. Therefore, this application is not limited to the illustrated embodiments, but conforms to the broadest scope consistent with the scope of protection claimed in this application.

[0028] It should be noted that the descriptions of these embodiments are for the purpose of aiding understanding the present invention, but do not constitute a limitation thereof. Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0029] The present application will be further described in detail below with reference to the accompanying drawings.

[0030] This application discloses an electromagnetic flowmeter filtering algorithm.

[0031] like Figure 1 As shown, an electromagnetic flowmeter filtering algorithm includes the following steps: Step S1: Obtain the forward sampling data array PS[N] and the reverse sampling data array NS[N] within one excitation cycle.

[0032] like Figure 2 As shown, obtaining the forward sampled data array PS[N] and the reverse sampled data array NS[N] within one excitation cycle includes the following steps: Step S11: Obtain the time T1 when the excitation reaches the constant current source and the ADC sampling time TN1.

[0033] The time T1 for the excitation to reach the constant current source is periodically monitored by the excitation constant current source time monitoring circuit. The ADC sampling time TN1 refers to the time elapsed from the start of sampling to the completion of conversion.

[0034] Step S12: Determine if T1 > 1000ms; if yes, output an excitation alarm signal; if no, obtain the time T2 of half an excitation cycle.

[0035] When the detection circuit detects that T1 is greater than 1000ms, it indicates that the excitation timing is not appropriate and a fault has occurred. An excitation alarm signal is issued to help repair the fault in a timely manner.

[0036] Step S13: Determine whether T1 is less than T2 / 2; if not, output T2 as a value greater than 2 times T1.

[0037] An electromagnetic flowmeter can generate a constant magnetic field signal only after reaching a constant current source by overcoming inductance. T1 will change due to different types of sensors, different cable lengths and on-site temperature variations. One excitation cycle is divided into a forward excitation cycle and a reverse excitation cycle. Within each half excitation cycle, the constant current source goes through two states: an excitation state and a holding state. The excitation state refers to the process in which the constant current source starts to adjust the output current during this period, and the holding state refers to the state in which the constant current source keeps the output current unchanged during this period. The time of T1 needs to be short enough to ensure that the constant current source can respond to circuit changes quickly, and the time of T2 needs to be long enough to ensure the duration of the constant current source in the holding state. It is determined whether T1 is less than T2 / 2. If yes, no adjustment is needed and the current state is maintained for measurement; if not, the output current is adjusted to ensure that T2 is greater than 2 times T1. In this way, after reaching the constant current source, there is at least a time longer than T2 / 2 for sampling. Under the condition that the ADC sampling time TN1 is fixed, the density of excitation sampling data is higher.

[0038] Step S14: Calculate the excitation sampling start time T3 = T1 + 5.

[0039] Wherein 5ms is the reserved stabilization time after the excitation coil enters the constant current source state.

[0040] Step S15: Calculate the number of excitation samples N1 = (T2 - T3 - 1) / TN1, and perform a floor operation on N1.

[0041] Wherein 1ms is the reserved time for sampling in a single excitation cycle. Since N1, as the number of samples, can only be an integer, the result of N1 needs to be rounded down to retain an integer. For example, if the calculated result N1=15.512, N1 is taken as 15.

[0042] Step S16: Sample the flow data according to T3 and N1, and store each sampled data in PS[N] or NS[N] respectively according to the positive and negative excitation cycles.

[0043] Data sampling starts at the T3 moment after the start of each half excitation cycle, and the sampling ends after N1 pieces of data are collected.

[0044] Step S2: Calculate the fluctuation coefficient BND[K] based on the forward sampling data array PS[N], and calculate the fluctuation coefficient BPD[K] based on the reverse sampling data array NS[N].

[0045] Such as Figure 3As shown, the calculation of volatility coefficient BND[K] based on the forward sampled data array PS[N] and the calculation of volatility coefficient BPD[K] based on the reverse sampled data array NS[N] include the following steps: Step S21: Sort the data of PS[N] or NS[N] by size and remove some data from both ends.

[0046] By sorting the sampled points of PS[N] or NS[N] in ascending or descending order, and then removing the first and last points from each group of data to eliminate points with significant interference, the data can be made more concentrated and representative. For example, the first and last quarters of the points are removed.

[0047] Step S22: Calculate the average value of the remaining PS[N] data to obtain the forward sampling average PVA; calculate the average value of the remaining NS[N] data to obtain the reverse sampling average NVA.

[0048] The average value PVA is obtained by averaging the values ​​of the middle half of PS[N], and the average value NVA is obtained by averaging the values ​​of the middle half of NS[N].

[0049] Step S23: Calculate the positive periodic fluctuation coefficient BPD[K]=∑(PS[N]-PVA)² / N and the negative periodic fluctuation coefficient BND[K]=∑(NS[N]-NVA)² / N for this set of data.

[0050] The above formula calculates the average sum of squared differences between the forward-sampled data array PS[N] and the forward-sampled mean PVA to obtain the positive periodic fluctuation coefficient BPD[K], and calculates the average sum of squared differences between the backward-sampled data array NS[N] and the backward-sampled mean NVA to obtain the negative periodic fluctuation coefficient BND[K]. The deviation of each sampling point is the difference between its measured value and the mean. Squaring is used to ensure that all deviations are positive to eliminate the influence of positive and negative differences. Finally, the average value is taken to obtain the overall degree of deviation. BPD[K] and BND[K] are used to evaluate the goodness of fit between the entire collected sample and the mean. The smaller the value, the smaller the fluctuation; conversely, the larger the value, the greater the fluctuation.

[0051] Step S3: Obtain the internal conversion coefficient of the electromagnetic flowmeter and calculate the original flow velocity value LS1[n]. The calculation formula is: LS1[n] = BND[K] - BPD[K] * internal conversion coefficient of electromagnetic flowmeter.

[0052] The internal conversion coefficient of the electromagnetic flowmeter is the relevant conversion coefficient obtained by measuring and calibrating the electromagnetic flowmeter. The specific coefficient value needs to be determined according to the specific application and equipment. An excitation cycle is divided into a positive excitation cycle and a reverse excitation cycle. The internal conversion coefficient of the electromagnetic flowmeter adjusts and calibrates the output of the electromagnetic flowmeter in the two excitation directions. The positive excitation cycle is before the reverse excitation cycle. The negative cycle fluctuation coefficient BND[K] is subtracted from the calibrated positive cycle fluctuation coefficient BPD[K] to obtain the original flow velocity value LS1[n].

[0053] Step S4: Analyze the fluctuation coefficients BND[K] and BPD[K] to determine the trend and obtain the flow velocity weight QZ[n] corresponding to the original flow velocity value LS1[n] of the excitation cycle. The larger the fluctuation trend, the smaller the flow velocity weight QZ[n].

[0054] like Figure 4 As shown, the process of analyzing the fluctuation coefficients BND[K] and BPD[K] to determine the trend and obtaining the flow velocity weight QZ[n] corresponding to the original flow velocity value LS1[n] for this excitation cycle includes the following steps: Step S41: Calculate the average value of BND[K] and BPD[K] for the latest several excitation cycles to obtain the average fluctuation coefficient BDA.

[0055] For example, the BND[K] and BPD[K] of the latest 100 excitation cycles are taken, and the average value is calculated after they are added together. BDA represents the average fluctuation level of the latest 100 excitation cycles.

[0056] Step S42: Based on the ratio of BND[K] to BDA in the current excitation cycle and the ratio of BND[K-1] to BDA in the previous excitation cycle, output the flow velocity weight QZ[n].

[0057] The results of the above comparison are divided into intervals based on magnitude and assigned different flow velocity weights QZ[n]. If the data of BND[K] suddenly increases compared to the previous one, a weight coefficient less than 1 is assigned to that group of data; if the data of BND[K] suddenly decreases compared to the previous one, a weight coefficient greater than 1 is assigned to that group of data. For example: When BPD[K] / BDA-BPD[K-1] / BDA>50%, QZ[n]=0.01; When 50%>BPD[K] / BDA-BPD[K-1] / BDA>30%, QZ[n]=0.1; When 30%>BPD[K] / BDA-BPD[K-1] / BDA>10%, QZ[n]=0.5; When 10%>BPD[K] / BDA-BPD[K-1] / BDA>-10%, QZ[n]=1; When -10%>BPD[K] / BDA-BPD[K-1] / BDA>-30%, QZ[n]=2; When -30%>BPD[K] / BDA-BPD[K-1] / BDA, QZ[n]=5.

[0058] Before step S5, i.e. before step S5, before performing weighted calculation on the consecutive original flow velocity values ​​LS1[n], it is determined whether the current PVA or NVA is greater than 5% of the average value of the previous PVA or NVA. If so, the flow velocity weight QZ[n] corresponding to the current excitation cycle LS1[n] is adjusted to 90%.

[0059] For example, the PVA of the latest 100 excitation cycles is taken, summed together, and averaged. The PVA of the current excitation cycle is then compared with this average value.

[0060] Polarization voltage is a DC signal variable generated by the ionization of the conductive medium during the measurement process of an electromagnetic flowmeter. The amplitude of polarization voltage typically ranges from tens to hundreds of millivolts, while the actual flow velocity signal is generally less than 100µV. Based on this characteristic of electromagnetic flowmeters, the default value of PVA or NVA represents the polarization voltage signal. This value serves two purposes: first, it allows for monitoring of the polarization voltage signal; second, by controlling the magnitude of changes in the PVA or NVA value and applying secondary weighting constraints, it further facilitates smoothing and filtering of the flow velocity.

[0061] Steps S5~B, that is, before step S5, before performing a weighted calculation on the consecutive original flow velocity values ​​LS1[n], include the following steps: S5~B1, based on the measurement range of the electromagnetic flowmeter, determine whether LS1[n] exceeds the measurement range. For LS1[n] that exceeds the measurement range, take the average flow velocity value of the latest several LS1[n] to replace it.

[0062] The average flow velocity is the average value of LS1[n] over several excitation cycles within the display refresh cycle of the electromagnetic flowmeter. For example, if the electromagnetic flowmeter's flow velocity measurement range is -15 to 15 m / s, LS1[n] values ​​greater than 15 or less than -15 are directly assigned as the average flow velocity. A preliminary judgment is made as to whether LS1[n] is within the measurement range, and some out-of-range flow velocities are eliminated. The traditional flow velocity range is further determined after obtaining the final filtered flow velocity.

[0063] S5~B2, compare the difference between each LS1[n] and the average flow velocity, and adjust the flow velocity weight QZ[n]: When LS1[n] exceeds the average flow velocity of 0.5 m / s, the flow velocity weight QZ[n] is multiplied by 0.9; When LS1[n] exceeds the average flow velocity of 1 m / s, the flow velocity weight QZ[n] is multiplied by 0.1.

[0064] The above steps impose weights on the original flow velocity value LS1[n] three times, further achieving smooth filtering of the flow velocity.

[0065] Step S5: Based on the original flow velocity value LS1[n] and the flow velocity weight QZ[n], the coarse screening flow velocity LS2[l] is calculated. The calculation formula is: LS2[l] = ∑(LS1[n] * QZ[n]) / n.

[0066] The above steps involve weighted averaging of LS1[n] for several excitation cycles within the display refresh cycle of the electromagnetic flowmeter. This is significant because it can better handle LS1[n] with different differences and obtain smooth filtering.

[0067] Step S6: Obtain the results of the flow rate fast response judgment and the alarm fast response judgment, generate a limit coefficient, and dynamically adjust the coarse screening flow rate LS2[l] based on the limit coefficient to obtain the filtered flow rate.

[0068] The formula for calculating the filter flow rate is: Filter flow rate [l] = LS2[l] * limit coefficient + Filter flow rate [l-1] * (1 - limit coefficient), where the limit coefficient is greater than or equal to 0 and less than or equal to 1.

[0069] In the above formula, under the influence of the limiting coefficient, the filtered flow rate [l] is affected by the previous filtered flow rate [l-1]. The previous filtered flow rate [l-1] and the current coarse screening flow rate LS2 [l] are inversely related. When the limiting coefficient approaches 0, the filtered flow rate [l] inherits more from the previous filtered flow rate [l-1], maintaining a stable display; when the limiting coefficient approaches 1, the filtered flow rate [l] is more based on the current coarse screening flow rate LS2 [l], achieving a fast response. The limiting coefficient, as a means of dynamically adjusting the response speed, further intervenes in the flow rate signal.

[0070] The process of obtaining flow rate and quickly responding to determine the generation of constraint coefficients specifically includes the following steps: To determine whether the coarse screening flow rate LS2[l] has an upward or downward trend: take the latest several LS2[l] values, and if more than 80% of the data are continuously increasing or decreasing, output the first judgment information as true.

[0071] For example, take the latest 10 LS2[l], add them together and calculate the average. If at least 8 of them show an increasing or decreasing trend, then LS2[l] is considered to have an upward or downward trend.

[0072] Take the latest number of LS2[l] and their filtering flow rate[l]. The first coefficient is ∑(LS2[l]-filtering flow rate[l])² / array number. If the first coefficient exceeds the first preset value, output the second judgment information as true.

[0073] The first preset value is a pre-set threshold value. For example, the latest 10 LS2[l] values ​​and their corresponding 10 filter flow rates[l] are taken, and the average difference summation is calculated. If it exceeds the first preset value, it is considered that LS2[l] does have a changing trend.

[0074] Take the latest number of empty pipe data points. The second coefficient is calculated as ∑(empty pipe data array - average empty pipe data)² / number of arrays. If the second coefficient exceeds the second preset value, the third judgment information is output as true.

[0075] The second preset value is a pre-set threshold value. For example, the latest 10 air traffic control data are taken, summed together and averaged. Then, the average difference between each air traffic control data and the average value is calculated. If it exceeds the second preset value, it is considered that LS2[l] does have a changing trend.

[0076] If the first judgment information is true, and the second and / or third judgment information is true, then it is determined that the flow rate has an upward or downward trend.

[0077] Monitoring the first and second coefficients verifies the upward and downward trend of the coarse screening flow rate LS2[l], ensuring the correct change of the limit coefficient and further accurately adjusting the dynamic adjustment of the filter flow rate [l]. This achieves a correct and rapid response effect when the conductor flow rate increases or decreases.

[0078] If yes, adjust the limiting coefficient to tend towards 1; if no, adjust the limiting coefficient to tend towards 0.

[0079] The process of obtaining alarm quick response judgment and generating limit coefficients specifically includes the following steps: The traffic alarm includes trusted alarm signals and untrusted alarm signals; When the trusted alarm signal is received, the restriction coefficient is forcibly set to 1; when the untrusted alarm signal is received, the restriction coefficient is forcibly set to 0. The excitation alarm signal belongs to the category of untrusted alarm signals.

[0080] In the above steps, an external empty pipe sensor is installed as an example. If the pipe is found to suddenly have no conductor flow, the limit coefficient is forcibly set to 1, and the filtered flow rate [l] responds quickly to the sudden change in flow rate. An excitation sensor, magnetic field sensor or other interference sensor is installed as an example. The limit coefficient is forcibly set to 0, and the filtered flow rate [l] will inherit the value of the previous filtered flow rate [l-1] and will not respond to the change of LS2 [l]. The filtered flow rate [l] remains stable, reducing the impact of external interference on the flow rate.

[0081] Step S7: Output the filtered flow rate.

[0082] The filtered flow rate mentioned above is the final value displayed on the electromagnetic flowmeter.

[0083] It should be understood that although the steps in the flowcharts in the accompanying drawings are shown sequentially as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise expressly stated herein, there is no strict order in which these steps are performed, and they may be performed in other orders.

[0084] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.

Claims

1. An electromagnetic flowmeter filtering algorithm, characterized in that: Specifically, the following steps are included: Acquire a forward sampling data array PS[N] and a reverse sampling data array NS[N] within one excitation cycle; Calculate a positive cycle fluctuation coefficient BND[K] based on the forward sampling data array PS[N], and calculate a negative cycle fluctuation coefficient BPD[K] based on the reverse sampling data array NS[N]; The step of calculating the positive cycle fluctuation coefficient BND[K] based on the forward sampling data array PS[N] and calculating the negative cycle fluctuation coefficient BPD[K] based on the reverse sampling data array NS[N] specifically includes the following steps: Sort the data of PS[N] or NS[N] by size respectively, and remove a number of data at both ends; Calculate the average value of the remaining PS[N] data to obtain the forward sampling average PVA; calculate the average value of the remaining NS[N] data to obtain the reverse sampling average NVA; Calculate the positive cycle fluctuation coefficient BND[K]=∑(PS[N]-PVA)² / N and the negative cycle fluctuation coefficient BPD[K]=∑(NS[N]-NVA)² / N of the data; Acquire the internal conversion coefficient of the electromagnetic flowmeter, and calculate to obtain the original flow velocity value LS1[n]; Analyze the fluctuation coefficients BND[K] and BPD[K] to perform trend judgment, and obtain the flow velocity weight QZ[n] corresponding to the original flow velocity value LS1[n] of this excitation cycle, where the larger the fluctuation trend, the smaller the flow velocity weight QZ[n]; Based on the original flow velocity value LS1[n] and the flow velocity weight QZ[n], perform weighted averaging on the original flow velocity value LS1[n] to obtain the coarsely screened flow velocity LS2[l]; Acquire the results of flow velocity fast response judgment and alarm fast response judgment, generate a restriction coefficient, and dynamically adjust the coarsely screened flow velocity LS2[l] based on the restriction coefficient to obtain a filtered flow velocity; Output the filtered flow velocity.

2. The electromagnetic flowmeter filtering algorithm according to claim 1, characterized in that: The step of acquiring the forward sampling data array PS[N] and the reverse sampling data array NS[N] within one excitation cycle specifically includes the following steps: Acquire the time T1 when the excitation reaches the constant current source and the ADC sampling time TN1; Judge whether T1>1000ms; if yes, output an excitation alarm signal; if no, acquire the time T2 of half an excitation cycle; Judge whether T1<T2 / 2; if not, output T2 as a value greater than 2 times T1; Calculate the excitation sampling start time T3=T1+5; Calculate the number of excitation samples N1=(T2-T3-1) / TN1, and perform a floor operation on N1; Sample the flow data according to T3 and N1, and store each sampling data in PS[N] or NS[N] respectively according to the positive and negative excitation cycles.

3. The electromagnetic flowmeter filtering algorithm according to claim 1, characterized in that: The step of analyzing the fluctuation coefficients BND[K] and BPD[K] to perform trend judgment, and obtaining the flow velocity weight QZ[n] corresponding to the original flow velocity value LS1[n] of this excitation cycle, where the larger the fluctuation trend, the smaller the flow velocity weight QZ[n], specifically includes the following steps: Calculate the average value of BND[K] and BPD[K] of the latest several excitation cycles to obtain the average fluctuation coefficient BDA; Based on the ratio of BND[K] to BDA in the current excitation cycle and the ratio of BND[K-1] to BDA in the previous excitation cycle, the flow velocity weight QZ[n] is output.

4. The electromagnetic flowmeter filtering algorithm according to claim 1 or 3, characterized in that: Before obtaining the coarse screen flow rate LS2[l] by weighted averaging the original flow rate value LS1[n], the following steps are also included: Determine whether the current PVA or NVA is greater than 5% of the average value of the previous PVA or NVA. If so, adjust the flow rate weight QZ[n] corresponding to LS1[n] of the current excitation cycle to 90%.

5. An electromagnetic flowmeter filtering algorithm according to claim 1 or 3, characterized in that: Before obtaining the coarse screen flow rate LS2[l] by weighted averaging the original flow rate value LS1[n], the following steps are also included: Based on the measurement range of the electromagnetic flowmeter, determine whether LS1[n] exceeds the measurement range. For LS1[n] that exceeds the measurement range, take the average flow velocity value of the latest several LS1[n] to replace it. Compare the difference between each LS1[n] and the average flow velocity, and adjust the flow velocity weight QZ[n] accordingly: When LS1[n] exceeds the average flow velocity of 0.5 m / s, the flow velocity weight QZ[n] is multiplied by 0.9; When LS1[n] exceeds the average flow velocity of 1 m / s, the flow velocity weight QZ[n] is multiplied by 0.

1.

6. The electromagnetic flowmeter filtering algorithm according to claim 1, characterized in that: The formula for calculating the filter flow rate is: Filter flow rate [l] = LS2[l] * limit coefficient + Filter flow rate [l-1] * (1 - limit coefficient), where the limit coefficient is greater than or equal to 0 and less than or equal to 1.

7. The electromagnetic flowmeter filtering algorithm according to claim 2, characterized in that: The process of obtaining the flow rate fast response and generating the limiting coefficient specifically includes the following steps: Determine whether the coarse screen flow rate LS2[l] has an upward or downward trend: if yes, adjust the limiting coefficient to tend to 1; if no, adjust the limiting coefficient to tend to 0.

8. The electromagnetic flowmeter filtering algorithm according to claim 7, characterized in that: The determination of whether the coarse screen flow rate LS2[l] has an increasing or decreasing trend specifically includes the following steps: Take the latest LS2 data. If more than 80% of the data in the LS2 data are continuously increasing or decreasing, output the first judgment information as true. Take the latest number of LS2[l] and their filtering flow rate[l]. The first coefficient is ∑(LS2[l]-filtering flow rate[l])² / array number. If the first coefficient exceeds the first preset value, output the second judgment information as true. Take the latest several empty pipe data points. The second coefficient is calculated as ∑(empty pipe data array - average empty pipe data)² / array size. If the second coefficient exceeds the second preset value, output the third judgment information as true. If the first judgment information is true, and the second judgment information and / or the third judgment information is true, then it is determined that the flow rate has an upward or downward trend.

9. The electromagnetic flowmeter filtering algorithm according to claim 2, characterized in that: The process of obtaining the results of the flow rate fast response judgment and the alarm fast response judgment, and generating the limitation coefficient, specifically includes the following steps: Traffic alarms include trusted alarm signals and untrusted alarm signals; When the trusted alarm signal is received, the restriction coefficient is forcibly set to 1; when the untrusted alarm signal is received, the restriction coefficient is forcibly set to 0. The excitation alarm signal belongs to the category of untrusted alarm signals.

Citation Information

Patent Citations

  • Signal processing method of high-frequency sine wave excitation electromagnetic flowmeter

    CN111351535A

  • System stabilization apparatus

    JP1997252538A