Method, System, Electronic Device and Storage Medium for Correcting Water Flow Rate
By analyzing the flow pulse width, distinguishing between normal and abnormal pulses, combining the buffer zone and standard deviation judgment, and calculating the correction value, the problem of inaccurate detection caused by magnetic interference by the washing machine water flow sensor is solved, and more accurate water flow detection is achieved.
Patent Information
- Application Number
- CN202210909529.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-29
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2042-07-29
AI Technical Summary
In the prior art, the water flow sensor of the cleaning machine is inaccurately detected due to the magnetic influence of the metal parts.
By analyzing the pulse width of the flow pulse, distinguishing between normal pulses and abnormal pulses, using the buffer area and standard deviation to determine whether the water flow detection result needs to be corrected, and the correction value is calculated based on the correspondence between the pulse width and the water flow, and the water flow detection result is corrected.
It improves the accuracy of water flow detection, can reflect the water flow situation more realistically, and reduces detection errors caused by magnetic field interference.
Smart Images

Figure CN116105811B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of water flow detection and correction, and particularly to a method, a system, an electronic device and a storage medium for correcting water flow. Background Art
[0002] Water flow sensors of cleaning machines generally detect water flow by using the Hall effect of Hall elements. When water passes through a turbine to drive the magnetic rotor to rotate, a rotating magnetic field with different magnetic poles is generated, which cuts the magnetic induction line to generate high and low pulse levels. The water flow is calculated by counting the number of pulses and combining the relationship between the nominal water volume of the sensor and the pulses.
[0003] Since there are many metal parts in the cleaning machine, the metal parts are likely to generate magnetism, resulting in inaccurate detection of pulses by the water flow sensor when detecting the water flow of the cleaning machine due to the influence of the magnetism of the metal parts. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to overcome the defect of inaccurate detection of water flow pulses in the prior art, and provide a method, a system, an electronic device and a storage medium for correcting water flow.
[0005] The present invention solves the above technical problem through the following technical solutions: [[ID=2l]]
[0006] In a first aspect, the present invention provides a method for correcting water flow, which is used to correct the water flow detection result represented by the flow pulses output by the water flow sensor; the method for correcting water flow includes:
[0007] Determine a first number of normal pulses and a second number of abnormal pulses in the flow pulses according to the pulse width of the flow pulses;
[0008] Judge whether it is necessary to correct the water flow detection result according to the first number and the second number;
[0009] If it is necessary to correct the water flow detection result, determine a water flow correction value, and correct the water flow detection result according to the water flow correction value.
[0010] Preferably, the step of determining a first number of normal pulses and a second number of abnormal pulses in the flow pulses according to the pulse width of the flow pulses includes:
[0011] Obtain the pulse width of the flow pulses. If the pulse width meets the comparison condition, the flow pulse is a normal pulse, otherwise the flow pulse is an abnormal pulse;
[0012] Determine the first number of normal pulses and the second number of abnormal pulses.
[0013] Preferably, the step of determining whether to correct the water flow detection result according to the first quantity and the second quantity includes:
[0014] Store the pulse width of the normal pulse into the normal buffer area, and store the pulse width of the abnormal pulse into the abnormal buffer area; the length of the normal buffer area is greater than the length of the abnormal buffer area;
[0015] If the abnormal buffer area is filled up before the normal buffer area, calculate the standard deviation of the pulse widths in the abnormal buffer area;
[0016] If the standard deviation is less than the preset standard deviation, determine that there is no need to correct the water flow detection result;
[0017] If the standard deviation is greater than or equal to the preset standard deviation, or the normal buffer area is filled up before the abnormal buffer area, determine that it is necessary to correct the water flow detection result.
[0018] Preferably, the step of determining the water flow correction value includes:
[0019] According to the corresponding relationship between the pulse width and the water flow, determine the average water flow corresponding to the average pulse width of the normal pulse, and the total water flow corresponding to the total pulse width of the abnormal pulse;
[0020] According to the ratio of the total pulse width of the abnormal pulse to the average pulse width, and the average water flow, determine the product value of the ratio and the average water flow;
[0021] Determine the difference between the product value and the total water flow as the water flow correction value.
[0022] Preferably, if the corrected water flow detection result is less than or equal to the preset total water flow, the water flow correction method further includes:
[0023] According to the corresponding relationship between the pulse width and the water flow, determine the average water flow corresponding to the average pulse width of the normal pulse, and the first water flow corresponding to the first pulse width stored in the abnormal buffer area first;
[0024] According to the ratio of the first pulse width to the average pulse width, and the average water flow, determine the product value of the ratio and the average water flow;
[0025] Determine the difference between the product value and the first water flow as the water flow correction value.
[0026] Preferably, the step of correcting the water flow detection result according to the water flow correction value includes:
[0027] Determine the corrected water flow detection result based on the sum of the water flow detection result and the water flow correction value.
[0028] Preferably, twice the length of the normal buffer is less than the length of the abnormal buffer, and the sum of three times the length of the abnormal buffer and the length of the normal buffer is less than the total number of flow pulses of the preset water flow.
[0029] In a second aspect, the present invention provides a water flow correction system for correcting the water flow detection result represented by the flow pulses output by the water flow sensor; the water flow correction system includes:
[0030] A determination module, configured to determine a first number of normal pulses and a second number of abnormal pulses in the flow pulses according to the pulse width of the flow pulses;
[0031] A judgment module, configured to judge whether the water flow detection result needs to be corrected according to the first number and the second number;
[0032] A correction module, configured to determine a water flow correction value if the water flow detection result needs to be corrected, and correct the water flow detection result according to the water flow correction value.
[0033] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the above-mentioned water flow correction method is implemented.
[0034] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned water flow correction method is implemented.
[0035] The positive and progressive effects of the present invention are as follows:
[0036] The present invention determines normal pulses and abnormal pulses through the pulse width, and then judges whether the water flow detection result needs to be corrected according to the number of normal pulses and the number of abnormal pulses. If correction is needed, the water flow detection result is corrected according to the water flow correction value, so as to obtain a more accurate water flow detection result that can better reflect the real water flow situation. Description of the Drawings
[0037] Figure 1 It is a schematic diagram of the flow pulses detected by the water flow sensor without interference;
[0038] Figure 2 It is a schematic diagram of the flow pulses detected by the water flow sensor under interference;
[0039] Figure 3 Flow chart of a method for correcting water flow rate provided in Embodiment 1 of the present invention;
[0040] Figure 4 Schematic diagram of the pulse width when the pulse is specifically the falling edge in Embodiment 1 of the present invention;
[0041] Figure 5 Structure diagram of a system for correcting water flow rate provided in Embodiment 2 of the present invention;
[0042] Figure 6 Schematic structural diagram of an electronic device provided in Embodiment 3 of the present invention. Detailed implementation manners
[0043] To better understand this embodiment, the general situation of this embodiment will be described first:
[0044] Figure 1 Schematically shows a schematic diagram of the flow rate pulses detected by the water flow rate sensor without other magnetic field interference, which is manifested as regular continuous high levels and continuous low levels.
[0045] Figure 2 Schematically shows a schematic diagram of the flow rate pulses detected by the water flow rate sensor under the condition of other magnetic field interference. The voltage pulses output by the water flow rate sensor will show the phenomenon of pulse loss, which is mainly manifested as irregular continuous high levels and continuous low levels.
[0046] In the existing calculation method of water flow pulses, the water flow rate is usually calculated by counting the pulse transition edges (such as rising edges or falling edges), that is, counting at the transition edge of each pulse and then converting it into the water flow rate. This calculation method Figure 2 In the case of abnormal flow rate pulses shown, due to the possible loss of pulses, there will be a deviation between the total water flow rate measured by the water flow rate sensor and the actual water flow rate. If the water intake is controlled by timing, due to the real-time fluctuation of the water pressure and the fluctuation of the water flow rate per unit time, it is impossible to accurately calculate the water flow rate.
[0047] In view of this, this embodiment proposes a method, system, electronic device and storage medium for correcting water flow rate. Specifically, the pulse width of the Hall sensor (i.e., the water flow rate sensor) is used to analyze whether the water flow rate detection result is affected by magnetic field interference. If the water flow rate detection result is affected, the water flow rate detection result is corrected.
[0048] The present invention will be further described below by way of embodiments, but the present invention is not limited to the scope of the embodiments hereby.
[0049] Embodiment 1
[0050] This embodiment provides a method for correcting water flow rate, which is used to correct the water flow rate detection result represented by the flow pulses output by a water flow sensor. Refer to Figure 3 , the method for correcting water flow rate includes:
[0051] S1. Determine the first quantity of normal pulses and the second quantity of abnormal pulses in the flow pulses according to the pulse width of the flow pulses;
[0052] S2. Judge whether it is necessary to correct the water flow rate detection result according to the first quantity and the second quantity;
[0053] S3. If it is necessary to correct the water flow rate detection result, determine the water flow rate correction value, and correct the water flow rate detection result according to the water flow rate correction value.
[0054] If it is not necessary to correct the water flow rate detection result, determine the water flow rate detection result according to the flow pulses output by the water flow sensor.
[0055] In this embodiment, the normal pulses and abnormal pulses are determined through the pulse width of the flow pulses, and then whether the water flow rate detection result needs to be corrected is judged according to the quantity of normal pulses and the quantity of abnormal pulses. If correction is needed, the water flow rate detection result is corrected according to the water flow rate correction value, so as to obtain a more accurate water flow rate detection result that can better reflect the actual water flow situation.
[0056] In one implementation manner, step S1 includes:
[0057] S11. Obtain the pulse width of the flow pulses. If the pulse width meets the comparison condition, the flow pulse is a normal pulse; otherwise, the flow pulse is an abnormal pulse;
[0058] Among them, the pulse width of the flow pulses can be read in real time by a controller; the comparison condition can be set according to actual requirements. It can compare the pulse width of the flow pulses with a value or with a range.
[0059] In this embodiment, each pulse is represented by a falling edge. It should be understood that in other embodiments, each pulse can also be represented by a rising edge.
[0060] Figure 4 t1, t2, t3, t4, t5, t6, t7 of
[0059] schematically show the pulse widths of each flow pulse when the pulse is specifically a falling edge.
[0061] Among them, the flow pulse state can be determined according to whether a continuous high level and a continuous low level are maintained within a corresponding preset time period. When a continuous high level and a continuous low level are maintained, the corresponding flow pulse is determined as a normal pulse. When a continuous high level and a continuous low level cannot be maintained, the corresponding flow pulse state is determined as an abnormal pulse.
[0062] For example: the pulse width t of the flow pulse read in real time by the controller α (α≥1, and α is an integer), if t α is less than or equal to the preset value, then t α the corresponding flow pulse is a normal pulse; if t α is greater than the preset value, then t α the corresponding flow pulse is an abnormal pulse, and the preset value can be set according to actual needs.
[0063] Another example: the pulse width t1 of the first flow pulse read in real time by the controller, and the pulse width t2 of the second flow pulse adjacent to it. When (preferably, ε>1.5), then the flow pulses corresponding to t1 and t2 are normal pulses; when or then the flow pulse corresponding to the smaller pulse width of t1 and t2 is a normal pulse, and the flow pulse corresponding to the larger pulse width of t1 and t2 is an abnormal pulse.
[0064] For the pulse width ti (i≥3, and i is an integer) of the nth flow pulse thereafter, by calculating the mean value X of the non-zero pulse widths of the normal pulses, when the next single pulse time interval ti satisfies then the flow pulse corresponding to ti is a normal pulse, otherwise it is an abnormal pulse.
[0065] S12. Determine the first quantity of normal pulses and the second quantity of abnormal pulses.
[0066] In this embodiment, by defining the comparison conditions of the pulse width, it is possible to quickly determine whether the flow pulse does not conform to the water flow law, and classify the flow pulses into normal pulses and abnormal pulses, thereby improving the efficiency of judging whether the water flow detection result needs to be corrected.
[0067] In one embodiment, step S2 includes:
[0068] S21. Store the pulse widths of the normal pulses into the normal buffer area, and store the pulse widths of the abnormal pulses into the abnormal buffer area;
[0069] Among them, the length of the normal buffer is greater than that of the abnormal buffer. For example, the length of the abnormal buffer can be more than twice the length of the normal buffer. The abnormal buffer is larger than the normal buffer to prevent the abnormal buffer from being filled up prematurely.
[0070] S22: If the abnormal buffer is filled up before the normal buffer, calculate the standard deviation of the pulse widths in the abnormal buffer;
[0071] S23: If the standard deviation is less than the preset standard deviation, determine that the water flow detection result does not need to be corrected;
[0072] Among them, the preset standard deviation is set according to the actual situation.
[0073] S24: If the standard deviation is greater than or equal to the preset standard deviation, or the normal buffer is filled up before the abnormal buffer, determine that the water flow detection result needs to be corrected.
[0074] Among them, the standard deviation is used to characterize the fluctuation of the pulse widths in the abnormal buffer. If the standard deviation is greater than or equal to the preset standard deviation, it indicates a large fluctuation. Then, if the water flow detection result is less than the actual water flow, it is caused by the environmental magnetic field, and the water flow detection result needs to be corrected. Otherwise, no correction is required.
[0075] In addition, if the normal buffer is filled up before the abnormal buffer, the water flow detection result also needs to be corrected to ensure the accuracy of the water flow detection result.
[0076] In this embodiment, first, it is judged which of the normal buffer and the abnormal buffer is filled up first. If the normal buffer is filled up first, it means that the pulse width data in the abnormal buffer is abnormal pulse widths generated under the influence of the environmental magnetic field, and the water flow detection result is corrected. If the abnormal buffer is filled up first, then it is judged whether the standard deviation of the pulse widths in the normal buffer exceeds the preset standard deviation. If it exceeds, it means that the fluctuation of the abnormal pulses is large and the water flow detection result needs to be corrected. If it does not exceed, it means that the fluctuation of the abnormal pulses is normal, and the difference in the pulse width data between the normal buffer and the abnormal buffer is not due to a fault in the environmental magnetic field, but due to the difference caused by the momentary opening and closing of the switching valve or a sudden change in the flow rate. Therefore, the water flow detection result is not corrected. Through the above method, this embodiment judges whether to correct the water flow detection result, which can prevent incorrect correction of the water flow detection result, so as to only correct the situation where the water flow detection result needs to be corrected, and improve the correction efficiency.
[0077] In one embodiment, twice the length of the normal buffer is less than the length of the abnormal buffer, and the sum of three times the length of the abnormal buffer and the length of the normal buffer is less than the total number of flow pulses of the preset water flow.
[0078] Wherein, the preset water flow rate is the total water flow rate corresponding to the minimum water flow velocity for water inlet or outlet. When the water flow velocity is less than the minimum water flow velocity, a water shortage alarm will be generated.
[0079] The length of the abnormal buffer area should be greater than that of the normal buffer area to avoid the abnormal buffer area being filled up earlier than the normal buffer area. In practice, in the case of frequent packet loss, there will be a ratio of one normal data to two abnormal data. Therefore, the length of the normal buffer area is set to be less than twice the length of the abnormal buffer area, mainly to avoid accurately identifying the water flow rate when there are more abnormal data.
[0080] However, if the length of the abnormal buffer area is too large, it will lead to a situation where the water flow rate has reached the set total water flow rate, but neither the abnormal buffer area nor the normal buffer area is filled up, and it is impossible to determine whether the water flow rate detection result needs to be corrected. Therefore, it is limited that the sum of three times the length of the abnormal buffer area and the length of the normal buffer area is less than the total number of flow pulses of the preset water flow rate.
[0081] In this embodiment, the lengths of the normal buffer area and the abnormal buffer area are restricted, so as to timely correct the water flow rate corresponding to the abnormal pulse generated by the influence of the environmental magnetic field within a reasonable time range.
[0082] In one embodiment, in step S3, the steps of determining the water flow rate correction value include:
[0083] S31. According to the correspondence between the pulse width and the water flow rate, determine the average water flow rate corresponding to the average pulse width of the normal pulses and the total water flow rate corresponding to the total pulse width of the abnormal pulses;
[0084] S32. According to the ratio of the total pulse width of the abnormal pulses to the average pulse width and the average water flow rate, determine the product value of the ratio and the average water flow rate;
[0085] S33. Determine the difference between the product value and the total water flow rate as the water flow rate correction value.
[0086] The following introduces a derivation process of the correspondence between the pulse width and the water flow rate:
[0087] In order to overcome the errors generated due to different water flow sensors, different application scenarios (such as using a water flow sensor to detect the water inlet volume of a cleaning machine), and different assembly conditions, under laboratory conditions, the water flow sensor used can be calibrated for water flow rate at different water flow velocities.
[0088] The specific calibration method is as follows: Under different water flow rates and set pulses, the controller calibrates the water flow rate. The range of the water flow rate (v) is [V1, V2], where V1 is the set minimum water flow rate, and a water shortage alarm will be generated if it is less than V1, and V2 is the water flow rate under the common maximum water pressure. Under the condition of the water flow rate (v), when the total water flow rate is M and the total pulse width is T at N pulses, the water flow rate represented by the unit flow pulse is Under the water flow rate (v), multiple (v, k) are obtained, and the following quadratic curve relationship is obtained after polynomial fitting, see Formula (1):
[0089] k = av 2 + bv + c (1).
[0090] Among them, a, b, and c are constant coefficients.
[0091] Furthermore, from the total water flow rate M = v * T = k * N, it can be deduced that (where T / N is the pulse width of the unit flow pulse, denoted as t in the following text), that is, as shown in the following Formula (2):
[0092] v * t = k (2).
[0093] From Formula (1) and Formula (2), the relationship between the water flow rate k represented by the unit pulse and the pulse width t of the single pulse can be deduced as follows:[[ID=2,22]]
[0094]
[0095] Combined with the experimental data, a unique solution can be obtained. Assuming the relationship between k and t is
[0096]
[0097] Furthermore, the following Formula (3) (hereinafter referred to as k(t)) characterizing the corresponding relationship between the pulse width and the water flow rate can be obtained:
[0098]
[0099] Combined with k(t), the following specific steps for determining the water flow rate correction value in this embodiment are introduced:
[0100] Determine that the mean value of the pulse widths of the normal pulses in the normal buffer area is X, and substitute X into k(t) to obtain k(X) (i.e., the mean water flow rate); determine that the total water flow rates corresponding to the pulse widths [t1, t2... tj] of the abnormal pulses are [k(t1), k(t2),..., k(tj)], where t1, t2... tj represent the pulse widths of all single pulses of the abnormal pulses, and j is an integer; calculate the sum of all pulse widths of the abnormal pulses as tΣ (i.e., the total pulse width of the abnormal pulses), then the water flow rate correction value is:
[0101] In this embodiment, the water flow rate of abnormal pulses is corrected by the average value of the water flow rate of normal pulses, so as to specifically correct the water flow rate corresponding to the abnormal pulses caused by the influence of the magnetic field, and improve the correction efficiency.
[0102] In one embodiment, if the corrected water flow rate detection result is less than or equal to the preset total water flow rate, that is, the corrected water flow rate detection result obtained after the above correction steps still does not reach the desired final water flow rate (i.e., the preset total water volume), where the preset total water volume is set according to actual needs, the water flow rate correction method further includes:
[0103] S34. According to the correspondence between the pulse width and the water flow rate, determine the average water flow rate corresponding to the average value of the pulse widths of normal pulses, and the first water flow rate corresponding to the first pulse width stored in the abnormal buffer area;
[0104] S35. According to the ratio of the first pulse width to the average value of the pulse widths and the average water flow rate, determine the product value of the ratio and the average water flow rate;
[0105] S36. Determine the difference between the product value and the first water flow rate as the water flow rate correction value.
[0106] Combined with k(t), the following introduces the specific steps for determining the water flow rate correction value in this embodiment:
[0107] Determine the average value of the pulse widths of normal pulses as X, substitute X into k(t) to obtain k(X) (i.e., the average water flow rate); determine the first water flow rate corresponding to the first pulse width t1 in the abnormal buffer area as k(t1); then the water flow rate correction value is:
[0108] In this embodiment, this is a method similar to sliding filtering. When the corrected water flow rate detection result has not reached the desired final water flow rate (preset total water flow rate), directly correct the first water flow rate of the abnormal pulse, because the water flow rate corresponding to the first abnormal pulse can better reflect the current water flow rate trend, rather than being affected by the previous water flow rate trend, so as to more specifically correct the water flow rate corresponding to the abnormal pulse caused by the magnetic field influence and improve the correction efficiency.
[0109] In one embodiment, in step S3, the step of correcting the water flow rate detection result according to the water flow rate correction value includes:
[0110] S37. Determine the corrected water flow rate detection result according to the sum of the water flow rate detection result and the water flow rate correction value.
[0111] If the water flow detection result before correction is K, the water flow detection result after correction is Ktmp, and the water flow correction value is K 修正 , then Ktmp = K + K 修正 .
[0112] In this embodiment, the water flow detection result after correction can be determined by the water flow correction value and the water flow detection result before correction, so as to reduce the water flow corresponding to the abnormal pulse affected by the magnetic field and improve the accuracy of the water flow detection result.
[0113] The following takes the example of correcting the water inflow of the cleaning machine to specifically describe the method for correcting the water flow in Embodiment 1.
[0114] S401. Under laboratory conditions, determine the following corresponding relationship between the pulse width and the water flow (hereinafter referred to as k(t)):
[0115]
[0116] where a, b, and c are constant coefficients; k is the water flow represented by a unit flow pulse; and t is the pulse width of a unit flow pulse.
[0117] S402. Select a normal buffer with a length of n and an abnormal buffer with a length of m, where m > 2n and 3m + n is less than the total number of pulses required for the water inflow of the cleaning machine under the minimum flow rate (that is, twice the length of the normal buffer is less than the length of the abnormal buffer, and the sum of three times the length of the abnormal buffer and the length of the normal buffer is less than the total number of flow pulses of the preset water flow rate). The minimum flow rate is the water flow corresponding to the minimum water flow velocity. When the water flow velocity is less than the minimum water flow velocity, the cleaning machine will send out a water shortage alarm signal.
[0118] The length of the abnormal buffer is greater than the length of the normal buffer to avoid the abnormal buffer being filled up prematurely; in practice, it is found that in the case of frequent packet loss, there will be a ratio of one normal pulse width to two abnormal pulse widths, so m > 2n, mainly to avoid accurately identifying the water volume even when there are more abnormal pulse widths; however, if the length of the abnormal buffer is too large, it will lead to the situation where the water inflow has reached the set value, but neither the abnormal buffer nor the normal buffer is filled up, and it is impossible to judge whether it is necessary to correct the water flow detection result. Therefore, it is ensured that at least n rounds of calculations can be performed under the minimum flow rate, so the condition should be that 3n + m is less than the total number of pulses required for the water inflow of the cleaning machine under the minimum flow rate.
[0119] S403. Store the pulse width of the unit flow pulse in the normal buffer and the abnormal buffer. Specifically:
[0120] First, for the pulse widths t1 of the first unit flow pulse and t2 of the second unit flow pulse read in real time by the controller, t1 and t2 are the pulse widths corresponding to adjacent unit flow pulses. When (where ε > 1.5), then store t1 and t2 in the normal buffer in sequence; when or then take the smaller number of t1 and t2 as the first number in the normal buffer, and the larger number of t1 and t2 as the first number in the abnormal buffer. Substitute t1 and t2 into k(t) to calculate k(t1) (i.e., the water flow corresponding to t1) and k(t2) (i.e., the water flow corresponding to t2). At this time, the accumulated total water volume K = k(t1) + k(t2).
[0121] Secondly, for the pulse width ti (i ≥ 3 and i is an integer) of the third and subsequent unit flow pulses, calculate the average value X of the pulse widths with non-zero values in the normal buffer. Then, when store ti in the normal buffer, otherwise store ti in the abnormal buffer. At this time, the accumulated total water volume (i.e., the water flow detection result to be corrected) K = k(t1) + k(t2) + ··· + k(ti), and so on until the normal buffer or the abnormal buffer is full.
[0122] S404. Determine whether it is necessary to correct the accumulated total water volume K (i.e., the water flow detection result). Specifically:
[0123] If the normal buffer is filled before the abnormal buffer, it is determined that there is an influence of the ambient magnetic field resulting in abnormal pulse widths in the abnormal buffer, and it is determined that the water flow detection result needs to be corrected.
[0124] If the abnormal buffer is filled before the normal buffer, calculate the standard deviation of all pulse widths in the abnormal buffer where t1, t2... tw represent the pulse widths in the abnormal buffer, w is an integer, and X′ represents the average value of the pulse widths in the abnormal buffer.
[0125] When σ is greater than the preset standard deviation, it is considered that there are more abnormal pulses in the water inlet of the cleaning machine this time, and it is determined that the water flow detection result needs to be corrected.
[0126] When σ is less than or equal to the preset standard deviation, it is considered that the difference in pulse widths between the normal buffer and the abnormal buffer is caused by an instantaneous or actual sudden change in water flow velocity of the switching valve, and it is determined not to correct the water flow detection result. If the water flow detection result is greater than the set total water intake, the cleaning machine controller completes and ends the water intake; if the water flow detection result is less than or equal to the set total water intake at this time, the first pulse width in the normal buffer is removed, and the other normal pulse widths are shifted forward by one position, and the pulse widths in the abnormal buffer remain unchanged, and return to step S403.
[0127] S405. If it is necessary to correct the accumulated total water volume K, determine the water flow correction value, specifically:
[0128] If the normal buffer is filled before the abnormal buffer, at this time, the average value of the pulse widths with non-zero values in the normal buffer is X, and the corresponding average water flow is k(X). The pulse widths with non-zero values in the abnormal buffer are [tp, tp+1... tp+q] (both p and q are integers), and the corresponding water flows are [k(tp), k(tp+1)..., k(tp+q)]; calculate the sum of the data of all pulse widths in the abnormal buffer as tΣ (that is, the total pulse width of the abnormal pulses).
[0129] The water flow correction value is:
[0130]
[0131] The corrected water flow detection result is:
[0132]
[0133] Where Ktmp is the corrected water flow detection result, and K is the accumulated total water volume (the water flow detection result before correction).
[0134] If the abnormal buffer is filled before the normal buffer and σ is greater than the preset standard deviation, at this time, calculate the sum of all pulse widths tΣ in the abnormal buffer (that is, the total pulse width of the abnormal pulses). At this time, the average value of the pulse widths with non-zero values in the normal buffer is X, and the corresponding average water flow is k(X). All the pulse widths in the abnormal buffer are [t1, t2... ts] (s is an integer), and the corresponding water flows are [k(t1), k(t2),..., k(ts)].
[0135] The water flow correction value is:
[0136]
[0137] The corrected water flow detection result is:
[0138]
[0139] Among them, Ktmp is the corrected water flow detection result, and K is the total accumulated water volume (the water flow detection result before correction).
[0140] S406. If Ktmp is greater than the set total water intake, the cleaning machine controller completes and ends the water intake. If Ktmp is less than or equal to the set total water intake, the first water flow (k(t1)) corresponding to the first pulse width (t1) in the abnormal buffer at this time is used to correct the accumulated water flow detection result K before correction.
[0141] The water flow correction value is:
[0142]
[0143] The corrected water flow detection result is:
[0144]
[0145] And remove the first pulse width in the abnormal buffer, move the other abnormal pulse widths forward by one position, keep the pulse widths in the normal buffer unchanged, and return to step S403.
[0146] When the normal buffer is full, remove the first pulse width in the normal buffer, move the other pulse widths forward by one position, store the pulse width of the newly obtained normal pulse at the last position of the normal buffer, and perform the above steps using the pulse width data in the new normal buffer.
[0147] When the abnormal buffer is full, remove the first pulse width in the abnormal buffer, move the other pulse widths forward by one position, store the pulse width of the newly obtained abnormal pulse at the last position of the abnormal buffer, and perform the above steps using the pulse width data in the new abnormal buffer.
[0148] Embodiment 2
[0149] This embodiment provides a water flow correction system for implementing the water flow correction method in Embodiment 1. Refer to Figure 5 , the water flow correction system includes:
[0150] Determination module 1, configured to determine the first quantity of normal pulses and the second quantity of abnormal pulses in the flow pulses according to the pulse widths of the flow pulses;
[0151] Judgment module 2, configured to judge whether it is necessary to correct the water flow detection result according to the first quantity and the second quantity;
[0152] Correction module 3, configured to determine a water flow correction value if the water flow detection result needs to be corrected, and correct the water flow detection result according to the water flow correction value.
[0153] In one embodiment, the determination module 1 is further configured to obtain the pulse width of the flow pulse. If the pulse width meets the comparison condition, the flow pulse is a normal pulse; otherwise, the flow pulse is an abnormal pulse. The determination module 1 is also configured to determine the first quantity of normal pulses and the second quantity of abnormal pulses.
[0154] In one embodiment, the water flow correction system further includes:
[0155] Storage module, configured to store the pulse width of the normal pulse into the normal buffer area and store the pulse width of the abnormal pulse into the abnormal buffer area. The length of the normal buffer area is greater than the length of the abnormal buffer area.
[0156] Calculation module, configured to calculate the standard deviation of the pulse widths in the abnormal buffer area if the abnormal buffer area is filled before the normal buffer area.
[0157] Judgment module 2 is further configured to determine that the water flow detection result does not need to be corrected if the standard deviation is less than the preset standard deviation. Judgment module 2 is also configured to determine that the water flow detection result needs to be corrected if the standard deviation is greater than or equal to the preset standard deviation, or the normal buffer area is filled before the abnormal buffer area.
[0158] In one embodiment, twice the length of the normal buffer area is less than the length of the abnormal buffer area, and the sum of three times the length of the abnormal buffer area and the length of the normal buffer area is less than the total number of flow pulses of the preset water flow.
[0159] In one embodiment, the determination module 1 is further configured to determine the water flow mean value corresponding to the mean pulse width of the normal pulse and the total water flow corresponding to the total pulse width of the abnormal pulse according to the correspondence between the pulse width and the water flow.
[0160] Calculation module is further configured to determine the product value of the ratio and the water flow mean value according to the ratio of the total pulse width of the abnormal pulse to the mean pulse width and the water flow mean value.
[0161] Determination module 1 is further configured to determine the difference between the product value and the total water flow as the water flow correction value.
[0162] In one embodiment, the determination module 1 is further configured to determine the water flow mean value corresponding to the mean pulse width of the normal pulse and the first water flow corresponding to the first pulse width of the first one stored in the abnormal buffer area according to the correspondence between the pulse width and the water flow.
[0163] Calculation module is further configured to determine the product value of the ratio and the water flow mean value according to the ratio of the first pulse width to the mean pulse width and the water flow mean value.
[0164] The determination module 1 is further configured to determine the difference between the product value and the first water flow rate as the water flow rate correction value.
[0165] In one embodiment, the determination module 1 is further configured to determine the corrected water flow rate detection result according to the sum of the water flow rate detection result and the water flow rate correction value.
[0166] It should be noted that the implementation manners and technical effects of the various modules of the water flow rate correction system in this embodiment can refer to the corresponding parts of Embodiment 1, and will not be elaborated here.
[0167] Embodiment 3
[0168] This embodiment provides an electronic device. Figure 6 It is a schematic diagram of the modules of the electronic device. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the water flow rate correction method of Embodiment 1. Figure 6 The displayed electronic device 30 is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present invention.
[0169] Such as Figure 6 As shown, the electronic device 30 can be presented in the form of a general computing device, for example, it can be a server device. The components of the electronic device 30 may include, but are not limited to: at least one of the above-mentioned processors 31, at least one of the above-mentioned memories 32, and a bus 33 connecting different system components (including the memory 32 and the processor 31).
[0170] The bus 33 includes a data bus, an address bus, and a control bus.
[0171] The memory 32 may include volatile memory, such as a random access memory (RAM) 321 and / or a cache memory 322, and may further include a read-only memory (ROM) 323.
[0172] The memory 32 may further include a program / utilities 325 having a set (at least one) of program modules 324. Such program modules 324 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include the implementation of a network environment.
[0173] The processor 31 executes various functional applications and data processing by running the computer program stored in the memory 32, such as the water flow rate correction method of Embodiment 1 of the present invention.
[0174] The electronic device 30 can also communicate with one or more external devices 34 (such as a keyboard, a pointing device, etc.). Such communication can be carried out through the input / output (I / O) interface 35. Moreover, the model generation device 30 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 36. As Figure 6 shown, the network adapter 36 communicates with other modules of the model generation device 30 through the bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in combination with the model generation device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (redundant array of independent disks) systems, tape drives, and data backup storage systems, etc.
[0175] It should be noted that, although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present invention, the features and functions of two or more of the above-described units / modules can be embodied in one unit / modules. Conversely, the features and functions of one unit / modules described above can be further divided and embodied by multiple units / modules.
[0176] Embodiment 4
[0177] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the water flow correction method of Embodiment 1.
[0178] Among them, the more specific computer-readable storage medium can include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0179] In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to enable the terminal device to execute the water flow correction method implementing Embodiment 1.
[0180] Among them, the program code for executing the present invention can be written in any combination of one or more programming languages. The program code can be executed entirely on the user device, partially on the user device, executed as an independent software package, partially on the user device and partially on a remote device, or entirely on a remote device.
[0181] Although the specific embodiments of the present invention have been described above, those skilled in the art should understand that this is only an example, and the protection scope of the present invention is defined by the appended claims. Without departing from the principles and essence of the present invention, those skilled in the art can make various changes or modifications to these embodiments, but these changes and modifications all fall within the protection scope of the present invention.
Claims
1. A method for correcting water flow, characterized in that: Used to correct the water flow detection result represented by the flow pulse output by the water flow sensor; The water flow correction method includes: determining a first number of normal pulses and a second number of abnormal pulses in the flow pulses according to the pulse widths of the flow pulses; determining whether it is necessary to correct the water flow detection result based on the first number and the second number; If the water flow detection result needs to be corrected, a water flow correction value is determined, and the water flow detection result is corrected according to the water flow correction value; The step of determining whether the water flow detection result needs to be corrected based on the first quantity and the second quantity includes: storing the pulse width of the normal pulse in a normal buffer area, and storing the pulse width of the abnormal pulse in an abnormal buffer area; the length of the normal buffer area is greater than the length of the abnormal buffer area; If the abnormal buffer area is full before the normal buffer area, calculating the standard deviation of the pulse width in the abnormal buffer area; If the standard deviation is less than the preset standard deviation, it is determined that there is no need to correct the water flow detection result; If the standard deviation is greater than or equal to a preset standard deviation, or the normal buffer area is full before the abnormal buffer area, it is determined that the water flow detection result needs to be corrected.
2. The water flow correction method according to claim 1, characterized in that: The step of determining a first number of normal pulses and a second number of abnormal pulses in the flow pulses according to the pulse width of the flow pulses comprises: Acquiring the pulse width of the flow pulse; if the pulse width meets a comparison condition, the flow pulse is a normal pulse; otherwise, the flow pulse is an abnormal pulse; A first number of the normal pulses and a second number of the abnormal pulses are determined.
3. The water flow correction method according to claim 1, characterized in that: The step of determining the water flow correction value comprises: Determine, based on the correspondence between the pulse width and the water flow rate, the average water flow rate corresponding to the average pulse width of the normal pulses and the total water flow rate corresponding to the total pulse width of the abnormal pulses; According to the ratio of the total pulse width of the abnormal pulses to the pulse width mean, and the water flow mean, determining a product value of the ratio and the water flow mean; The difference between the product value and the total water flow is determined as a water flow correction value.
4. The water flow correction method according to claim 1, wherein: If the corrected water flow detection result is less than or equal to the preset total water flow, the water flow correction method further includes: Determining, based on the correspondence between the pulse width and the water flow rate, an average water flow rate corresponding to the average pulse width of the normal pulse and a first water flow rate corresponding to the first pulse width first stored in the abnormality buffer area; Determining, based on a ratio of the first pulse width to the average pulse width and the average water flow rate, a product value of the ratio and the average water flow rate; The difference between the product value and the first water flow rate is determined as a water flow rate correction value.
5. The method for correcting water flow according to any one of claims 3 and 4, characterized in that: The step of correcting the water flow detection result according to the water flow correction value includes: The corrected water flow detection result is determined according to the sum of the water flow detection result and the water flow correction value.
6. The water flow correction method according to claim 1, wherein: Twice the length of the normal buffer zone is less than the length of the abnormal buffer zone, and the sum of three times the length of the abnormal buffer zone and the length of the normal buffer zone is less than the total number of flow pulses of a preset water flow rate.
7. A water flow correction system, characterized in that: Used to correct the water flow detection result represented by the flow pulse output by the water flow sensor; The water flow correction system includes: a determining module, configured to determine a first number of normal pulses and a second number of abnormal pulses in the flow pulses according to the pulse width of the flow pulses; a judgment module, configured to judge whether the water flow detection result needs to be corrected according to the first quantity and the second quantity; a correction module, configured to determine a water flow correction value if correction of the water flow detection result is required, and correct the water flow detection result according to the water flow correction value; A storage module is used to store the pulse width of the normal pulse in a normal buffer area and the pulse width of the abnormal pulse in an abnormal buffer area; the length of the normal buffer area is greater than the length of the abnormal buffer area; a calculation module, configured to calculate a standard deviation of the pulse width in the abnormal buffer area if the abnormal buffer area is filled before the normal buffer area; The judgment module is also used to determine that the water flow detection result does not need to be corrected if the standard deviation is less than the preset standard deviation; it is also used to determine that the water flow detection result needs to be corrected if the standard deviation is greater than or equal to the preset standard deviation, or the normal buffer area is full before the abnormal buffer area.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the water flow correction method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the water flow correction method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Interference pulse identification method and device, storage medium and cell counting equipment
CN111060443A
Water heater, control method thereof and computer readable storage medium
CN111174438A