Thermal flow sensor temperature compensation method and system
By using a PID calculation algorithm with dead-zone control in the thermal flow sensor to adjust the voltage value of the heating resistor, the problem of low measurement accuracy under different gas temperatures is solved, achieving high-precision measurement, simplifying hardware design, and improving product consistency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-03-03
AI Technical Summary
Existing thermal flow sensors have low measurement accuracy under different gas temperatures, and existing temperature compensation methods have low production efficiency and poor product consistency.
The system employs a dead-zone control expert PID calculation algorithm to compensate for the heating power by adjusting the voltage value of the heating resistor in real time to maintain a constant voltage difference.
This improves the measurement accuracy of thermal flow sensors at different gas temperatures, simplifies hardware circuit design, reduces material costs, and enhances product consistency.
Smart Images

Figure CN116124254B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of sensing and measurement technology, specifically relating to a thermal flow sensor, and more specifically to a thermal flow sensor temperature compensation method and system. Background Technology
[0002] A thermal flow sensor is a common industrial sensor used to detect the flow rate of gas in a specific container. It works based on the principle that the flow of fluid transfers heat, thereby changing the temperature distribution of two temperature sensing elements along the gas flow direction.
[0003] The sensor consists of a heating element and two temperature sensing elements. The heating element is positioned in the middle of the pipe and provides constant power heating. The two temperature sensing elements are symmetrically arranged upstream and downstream of the heating element to measure the temperature at corresponding locations. When the airflow is still, its velocity is theoretically zero, and the temperature distribution across the heating element is uniform. When the gas flows at a certain velocity, it transfers heat from the upstream pipe wall to the downstream pipe wall, thus altering the temperature distribution. Within a certain flow range, the temperature difference between the sensing elements is linearly related to the measured flow rate. Therefore, the flow rate can be directly calculated by measuring the temperature difference between the two sensing elements. Specifically, the temperature sensing elements are typically thermistors. When the gas flows, the temperature distribution of the thermistor changes, thus changing its resistance. Correspondingly, the voltage applied across the thermistor also changes. By measuring this voltage change and performing calculations, the gas flow rate (velocity) can be obtained.
[0004] Different gas temperatures affect the power of the heating resistor. In other words, when a thermal flow sensor is working, the gas temperature itself will cause the heating element to lose heat as the gas flows, resulting in inaccurate gas flow data. Therefore, it is necessary to keep the heating power of the heating element constant as much as possible. This requires compensation for the heating power of the heating resistor, also known as temperature compensation, to eliminate the power change caused by the gas temperature and thus accurately measure the gas flow.
[0005] Existing thermal flow sensors, after calibration at room temperature, typically undergo temperature compensation by employing a linear sensing chip (heating resistor) to reduce the impact of gas temperature changes on heating power. In other words, current technology mainly achieves differential pressure compensation at different temperatures through high-quality hardware circuitry. This temperature compensation method places high demands on the temperature linearity of both the gas temperature measuring resistor and the heating resistor. Furthermore, this method introduces several drawbacks, such as requiring high internal linearity of the flow chip (measuring resistor and heating resistor) and high consistency between different chips; otherwise, perfect matching cannot be achieved, necessitating adjustments to hardware circuit parameters for adaptation. This approach also results in low production efficiency, poor consistency in the produced thermal flow sensors, difficulty meeting accuracy requirements, and inconsistent compensation effects depending on the specific components.
[0006] Therefore, the industry urgently needs a simple, effective, and consistent method and system for temperature compensation of thermal flow sensors. Summary of the Invention
[0007] The purpose of this invention is to provide a temperature compensation method for a thermal flow sensor, which has high efficiency in compensating for the heating power of the heating resistor, low requirements for the linearity of the heating resistor, and good consistency of the resulting product.
[0008] To suit the purposes of this invention, the following technical solution is adopted:
[0009] A method for temperature compensation of a thermal flow sensor is provided to suit the purposes of this invention, comprising the following steps:
[0010] Collect the voltage values of the heating resistor and the gas temperature measuring resistor;
[0011] Calculate the voltage difference between the heating resistor and the gas temperature measuring resistor; and
[0012] Using the voltage difference as input parameter, the expert PID calculation algorithm with dead zone is executed to obtain the voltage value of the heating resistor after the algorithm is executed.
[0013] Preferably, using the voltage difference as an input parameter, an expert PID calculation algorithm with dead-zone control is executed to obtain the voltage value of the heating resistor after the algorithm is executed, including:
[0014] Determine whether the voltage difference is less than or equal to the dead zone voltage. If yes, do not adjust the voltage value of the heating resistor; otherwise, perform proportional-integral-differential calculations on the voltage value of the heating resistor.
[0015] The increase in voltage across the heating resistor = proportionality coefficient * (current deviation - previous deviation) + differential coefficient * current deviation + differential coefficient * (current deviation - 2 * previous deviation + previous deviation),
[0016] The voltage value of the heating resistor = the voltage value of the heating resistor in the previous heating cycle + the increase in the voltage value of the heating resistor, where,
[0017] Deviation = Target voltage difference - Measured voltage difference
[0018] The previous deviation refers to the deviation in the current calculation formed after the previous proportional-integral-differential operation.
[0019] The previous deviation refers to the deviation from the period before last.
[0020] Preferably, the time interval for performing proportional-integral-differential operations is 1ms.
[0021] Preferably, in the above steps, the voltage values of the heating resistor and the gas temperature measuring resistor can be acquired through various methods and acquisition devices. For example, in one embodiment of the present invention, voltage value acquisition can be achieved using a general voltage acquisition chip, such as a 16-bit ADC chip like the TM7705, or a 24-bit ADC chip, such as the AD7793 or ADS1271.
[0022] In addition, in the above steps, the calculation of the voltage difference between the heating resistor and the gas temperature measuring resistor can be achieved by, for example, a microcontroller unit, and the microcontroller unit can be, for example, an STM32F103 or a GD32F303.
[0023] Furthermore, in the above steps, the voltage value of the voltage V0 that should be applied to the heating resistor Rh after the execution of the voltage difference is obtained by executing the expert PID calculation algorithm with dead zone control using the voltage difference as a parameter can also be executed by a similar microcontroller unit.
[0024] Preferably, the voltage value to be applied to the heating resistor after executing the expert PID calculation algorithm with dead zone control is calculated by the microcontroller unit.
[0025] A thermal flow sensor temperature compensation system is provided to suit the purposes of this invention, comprising:
[0026] The data acquisition module is used to acquire the voltage values of the heating resistor and the gas temperature measuring resistor;
[0027] The calculation module is used to calculate the voltage difference between the heating resistor and the gas temperature measuring resistor; and
[0028] The algorithm execution module is used to execute the expert PID calculation algorithm with dead zone control using the voltage difference as input parameter, and obtain the voltage value of the heating resistor after the algorithm is executed.
[0029] Preferably, the algorithm execution module is configured to further perform the following actions:
[0030] Determine whether the voltage difference is less than or equal to the dead zone voltage. If yes, do not adjust the voltage value of the heating resistor; otherwise, perform proportional-integral-differential calculations on the voltage value of the heating resistor.
[0031] More preferably, the proportional-integral-differential calculation method for the voltage value of the heating resistor is as follows:
[0032] The increase in voltage across the heating resistor = proportionality coefficient * (current deviation - previous deviation) + differential coefficient * current deviation + differential coefficient * (current deviation - 2 * previous deviation + previous deviation),
[0033] The voltage value of the heating resistor = the voltage value of the heating resistor in the previous heating cycle + the increase in the voltage value of the heating resistor, where,
[0034] Deviation = Target voltage difference - Measured voltage difference
[0035] The previous deviation refers to the deviation formed after the previous proportional-integral-differential operation, while the previous deviation refers to the deviation from the previous one.
[0036] Compared with the prior art, the advantages of the present invention are as follows:
[0037] The heating power of the heating resistor Rh in the thermal flow sensor is adjusted using a dead-zone control expert PID calculation algorithm, enabling the flow chip to achieve high-precision flow measurement under different gas temperatures and reducing the impact of gas temperature on the sensor. In the thermal flow sensor temperature compensation method of this invention, the heating power compensation of the heating resistor is achieved using a dead-zone control expert PID calculation algorithm. This simplifies the hardware circuit design, eliminates the need for complex precision operational amplifier circuits, reduces material costs, improves the adaptability of the flow chip, and reduces circuit parameter debugging time.
[0038] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and will become apparent from the description or may be learned by practice of the invention. Attached Figure Description
[0039] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0040] Figure 1 This is a schematic diagram of the thermal flow sensor temperature compensation method of the present invention.
[0041] Figure 2 This is a control circuit diagram of the thermal flow sensor temperature compensation method of the present invention.
[0042] Figure 3 This is a flowchart of the thermal flow sensor temperature compensation method of the present invention. Detailed Implementation
[0043] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention and should not be construed as limiting the present invention.
[0044] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, and / or components, nor does it exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein includes all or any unit and all combinations of one or more associated listed items.
[0045] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0046] refer to Figure 1 According to one embodiment of the present invention, such as Figure 1 As shown, a thermal flow sensor 100 typically includes a gas temperature measuring resistor Rr, a heating resistor Rh, and temperature sensing elements 20 symmetrically distributed on both sides of the heating resistor Rh (upstream and downstream of the gas flow direction). The heating resistor Rh needs to maintain a constant heating power so that when the gas to be measured flows, for example in… Figure 1In the diagram, when gas flows from left to right, the flowing gas, with a certain temperature, carries away some of the heat generated by the heating resistor Rh. This manifests as a lower temperature measured by the temperature sensing element 20 on the left compared to the temperature measured by the temperature sensing element 20 on the right, because the heat is blown to the right by the flowing gas. However, this temperature measurement becomes inaccurate when the heating power of the heating resistor Rh changes. In this diagram, under different airflow temperatures, the power of the heating resistor Rh can be adjusted via software algorithms to ensure that the power remains constant over time. As shown above, if the heating power of the heating resistor Rh is not adjusted in real time, a lower airflow temperature will carry away the heat from the heating resistor Rh. In this invention, as... Figure 2 As shown, the heating power of the heating resistor Rh is compensated in the following way:
[0047] like Figure 2 As shown, the MCU (hereinafter referred to as the microcontroller unit) 200 provides a voltage V0 to the heating resistor Rh so that current flows through the heating resistor Rh and heat is generated; the external standard voltage VCC provides a standard voltage to the gas temperature measuring resistor Rr; let ΔV represent the voltage difference between voltage V0 and external standard voltage VCC. The microcontroller unit 200 measures the magnitude of ΔV in real time. When the temperature of the gas flowing through the thermal flow sensor 100 changes, the resistance of the gas temperature measuring resistor Rr changes, so the voltage V1 applied to the gas temperature measuring resistor Rr also changes. Since ΔV = V0 - V1, in order to keep ΔV constant, the microcontroller unit adjusts the voltage output in real time to achieve the effect of changing the voltage V0. That is to say, by adjusting the voltage value of voltage V0 in real time, the voltage difference ΔV is ultimately kept constant in real time. Specifically, to maintain a constant gas temperature and intermediate heat source (heating resistor Rh) temperature, when the gas temperature decreases, the resistance of the gas temperature measuring resistor Rr decreases, and the voltage V1 decreases. At this time, the microcontroller calculates the magnitude of ΔV = V0 - V1 and executes the PID algorithm to reduce the output voltage V2 of the microcontroller. Correspondingly, the voltage V0 applied to the heating resistor Rh decreases. When the magnitude of the decrease in voltage V0 is the same as the magnitude of the decrease in V1, the value of ΔV remains unchanged because of the formula ΔV = V0 - V1.
[0048] The following is combined Figure 3 The specific operation steps of the thermal flow sensor temperature compensation method of the present invention are described in detail. For example... Figure 3As shown, firstly, in step S102, the voltage values V0 and V1 of the heating resistor Rh and the gas temperature measuring resistor Rr are acquired; secondly, in step S104, the voltage difference ΔV between the heating resistor Rh and the gas temperature measuring resistor Rr is calculated; next, in step S106, the expert PID calculation algorithm with dead zone control is executed using the voltage difference ΔV as a parameter to obtain the voltage value V0 that should be applied to the heating resistor Rh after the algorithm is executed.
[0049] In step S106 above, using the voltage difference ΔV as a parameter, the expert PID calculation algorithm with dead zone control is executed to obtain the voltage value V0 that should be applied to the heating resistor Rh after the algorithm is executed. Specifically, this includes:
[0050] Determine whether the voltage difference ΔV is less than or equal to the dead zone voltage Verr. If yes, do not adjust the voltage V0; otherwise, perform proportional-integral-differential calculations on the voltage V0.
[0051] The increase in voltage V0 = proportional coefficient * (current deviation - previous deviation) + differential coefficient * current deviation + differential coefficient * (current deviation - 2 * previous deviation + previous deviation).
[0052] Voltage V0 = Previous voltage V0 + Increase in voltage V0, where
[0053] Deviation = Target ΔV - Measured ΔV
[0054] The previous deviation refers to the deviation in the current calculation formed after the previous proportional-integral-differential operation.
[0055] The previous deviation refers to the deviation from the period before last.
[0056] In other words, each time a proportional-integral-differential operation is performed on the voltage V0, there will be three deviations: the current deviation, the previous deviation, and the deviation before that.
[0057] In the aforementioned thermal flow sensor temperature compensation method, the heating power of the heating resistor Rh of the thermal flow sensor is adjusted using a dead-zone control expert PID calculation algorithm. This enables the flow chip to achieve high-precision flow measurement under different gas temperatures, reducing the impact of gas temperature on the sensor. In this invention's thermal flow sensor temperature compensation method, the heating power (temperature) compensation of the heating resistor is achieved using a dead-zone control expert PID calculation algorithm. This greatly simplifies the hardware circuit design, eliminating the need for complex precision operational amplifier circuits, reducing material costs, improving the adaptability of the flow chip, and reducing circuit parameter debugging time.
[0058] The main explanation of the expert PID calculation algorithm with dead-zone control is as follows: The PID control algorithm is a control algorithm that combines proportional, integral, and derivative functions. It is the most mature and widely used control algorithm in continuous systems. This control algorithm is suitable for situations where the model of the controlled object is not well understood. Practical experience and theoretical analysis both show that satisfactory control results can be obtained when using this control law to control many industrial processes. The essence of PID control is to perform real-time calculations based on the input deviation value according to the proportional, integral, and derivative functional relationships, and then control the output of the calculation result. Applied to this invention, the expert PID calculation algorithm with dead-zone control analyzes the voltage difference in real time. This algorithm uses proportional, integral, and derivative functions to analyze and adjust the voltage difference, so as to adjust and compensate the voltage V0 of the heating resistor Rh in a stable, continuous, and rapid manner, and ultimately maintain the voltage difference between the heating resistor Rh and the gas temperature measuring resistor in real time.
[0059] Preferably, in step S106 above, the time interval for performing proportional-integral-differential operations is 1ms.
[0060] In step S102 above, the voltage values V0 and V1 of the heating resistor Rh and the gas temperature measuring resistor Rr can be acquired through various methods and acquisition devices. For example, in one embodiment of the present invention, the voltage values can be acquired using a general voltage acquisition chip, such as a 16-bit ADC chip like the TM7705, or a 24-bit ADC chip, such as the AD7793 or ADS1271.
[0061] In addition, in step S104 above, the voltage difference ΔV between the heating resistor Rh and the gas temperature measuring resistor Rr can be calculated by, for example, a microcontroller unit, such as an STM32F103 or a GD32F303.
[0062] Furthermore, in step S106 above, the voltage value of the voltage V0 that should be applied to the heating resistor Rh after the execution of the voltage difference ΔV is obtained by executing the expert PID calculation algorithm with dead zone control. This can also be executed by a similar microcontroller unit.
[0063] In addition, the voltage value that should be applied to the heating resistor after executing the expert PID calculation algorithm with dead zone control is calculated by the microcontroller unit.
[0064] According to another embodiment of the present invention, a thermal flow sensor temperature compensation system is provided, comprising:
[0065] The data acquisition module is used to acquire the voltage values of the heating resistor and the gas temperature measuring resistor;
[0066] The calculation module is used to calculate the voltage difference between the heating resistor and the gas temperature measuring resistor; and
[0067] The algorithm execution module is used to execute the expert PID calculation algorithm with dead zone control using the voltage difference as input parameter, and obtain the voltage value of the heating resistor after the algorithm is executed.
[0068] Preferably, the algorithm execution module is configured to further perform the following actions:
[0069] Determine whether the voltage difference is less than or equal to the dead zone voltage. If yes, do not adjust the voltage value of the heating resistor; otherwise, perform proportional-integral-differential calculations on the voltage value of the heating resistor.
[0070] More preferably, the proportional-integral-differential calculation method for the voltage value of the heating resistor is as follows:
[0071] The increase in voltage across the heating resistor = proportionality coefficient * (current deviation - previous deviation) + differential coefficient * current deviation + differential coefficient * (current deviation - 2 * previous deviation + previous deviation),
[0072] The voltage value of the heating resistor = the voltage value of the heating resistor in the previous heating cycle + the increase in the voltage value of the heating resistor, where,
[0073] Deviation = Target voltage difference - Measured voltage difference
[0074] The previous deviation refers to the deviation formed after the previous proportional-integral-differential operation, while the previous deviation refers to the deviation from the previous one.
[0075] The above description is merely a preferred embodiment of the present invention and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention is not limited to the specific combination of the above-described technical features, but also includes other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions as those in the present invention.
[0076] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for temperature compensation of a thermal flow sensor, characterized in that... Includes the following steps: Collect the voltage values of the heating resistor and the gas temperature measuring resistor; Calculate the voltage difference between the heating resistor and the gas temperature measuring resistor; and Using the voltage difference as input parameter, execute the expert PID calculation algorithm with dead zone control to obtain the voltage value of the heating resistor after the algorithm is executed; The voltage values of the heating resistor obtained after executing the algorithm include: Determine whether the voltage difference is less than or equal to the dead zone voltage. If yes, do not adjust the voltage value of the heating resistor; otherwise, perform proportional-integral-differential calculations on the voltage value of the heating resistor. The proportional-integral-differential (PI-DI) calculation method for the voltage value of the heating resistor is as follows: The increase in voltage of the heating resistor = proportional coefficient * (current deviation - previous deviation) + differential coefficient * current deviation + differential coefficient * (current deviation - 2 * previous deviation + previous deviation). The voltage value of the heating resistor = the voltage value of the heating resistor in the previous heating cycle + the increase in the voltage value of the heating resistor, where, This deviation = target voltage difference - measured voltage difference The previous deviation refers to the deviation in the current calculation formed after the previous proportional-integral-differential operation. The previous deviation refers to the deviation from the period before last.
2. The temperature compensation method for a thermal flow sensor as described in claim 1, characterized in that: The time interval for performing proportional-integral-differential operations is 1ms.
3. The temperature compensation method for a thermal flow sensor as described in claim 1, characterized in that: The voltage values of the heating resistor and the gas temperature measuring resistor are acquired through a voltage acquisition chip.
4. The temperature compensation method for a thermal flow sensor as described in claim 1, characterized in that: The voltage acquisition chip is a 16-bit ADC chip.
5. The temperature compensation method for a thermal flow sensor as described in claim 1, characterized in that: The voltage value that should be applied to the heating resistor after executing the expert PID calculation algorithm with dead zone control is calculated by the microcontroller unit.
6. A system applying the thermal flow sensor temperature compensation method according to any one of claims 1-5, characterized in that... include: The data acquisition module is used to acquire the voltage values of the heating resistor and the gas temperature measuring resistor; A calculation module is used to calculate the voltage difference between the heating resistor and the gas temperature measuring resistor; and The algorithm execution module is used to execute the expert PID calculation algorithm with dead zone control using the voltage difference as input parameter, and obtain the voltage value of the heating resistor after the algorithm is executed.
7. The system as described in claim 6, characterized in that: The algorithm execution module is configured to further perform the following actions: Determine whether the voltage difference is less than or equal to the dead zone voltage. If yes, do not adjust the voltage value of the heating resistor; otherwise, perform proportional-integral-differential calculations on the voltage value of the heating resistor.
8. The system as described in claim 7, characterized in that: The proportional-integral-differential (PI-DI) calculation method for the voltage value of the heating resistor is as follows: The increase in voltage of the heating resistor = proportional coefficient * (current deviation - previous deviation) + differential coefficient * current deviation + differential coefficient * (current deviation - 2 * previous deviation + previous deviation). The voltage value of the heating resistor = the voltage value of the heating resistor in the previous heating cycle + the increase in the voltage value of the heating resistor, where, This deviation = target voltage difference - measured voltage difference The previous deviation refers to the deviation in the current calculation formed after the previous proportional-integral-differential operation. The previous deviation refers to the deviation from the period before last.
Citation Information
Patent Citations
Gas flow calibration method of thermal MEMS gas sensor
CN111637954A
Thermal flowmeter and flow rate compensation method
US20190033110A1