Temperature control method, device and equipment of gas sensor and medium
Through the fuzzy PID control method, the fuzzy set is generated and processed, and the precise control of the temperature of the MEMS gas sensor is achieved, which solves the problem of inaccurate detection results under the influence of ambient temperature, and improves the detection accuracy and anti-interference ability.
Patent Information
- Application Number
- CN202411411879.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-10-10
AI Technical Summary
When detecting harmful gases, MEMS gas sensors are easily affected by ambient temperature, resulting in inaccurate detection results.
The fuzzy PID control method is adopted to generate a fuzzy set by obtaining the current temperature and target temperature range of the gas sensor, generate a fuzzy PID control action, and perform defuzzy processing to obtain the target PID control action, thereby controlling the current temperature of the sensor.
The gas sensor detects gas concentration at a stable working temperature, improves the accuracy of the detection results, and has strong anti-interference ability and high applicability.
Smart Images

Figure CN119472871A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of gas sensors, and in particular to a temperature control method, device, equipment and medium for a gas sensor. Background Art
[0002] As a small, highly sensitive sensor, MEMS gas sensors can provide accurate environmental detection and monitoring data in a limited space. However, due to the non-uniform environmental conditions when detecting harmful gases inside the car, the MEMS detection chip cannot maintain a stable operating temperature, resulting in a certain deviation between the detection results and the actual results.
[0003] In the related art, the operating temperature of the sensor is controlled by balancing the bridge of an analog circuit. However, the analog circuit is easily affected by environmental factors, is unstable, cannot meet actual detection needs, and has low detection result accuracy. Summary of the invention
[0004] The present application provides a temperature control method, device, equipment and medium for a gas sensor to solve the problem that the detection of the gas sensor in the related art is easily affected by the ambient temperature, resulting in inaccurate detection results.
[0005] The first aspect of the present application provides a temperature control method for a gas sensor, comprising the following steps: acquiring the current temperature of the gas sensor; generating a fuzzy set based on the current temperature of the gas sensor and a target temperature range; generating a fuzzy PID control action based on the fuzzy set, and defuzzifying the fuzzy PID control action to obtain a target PID control action; and controlling the current temperature of the gas sensor based on the target PID control action.
[0006] Optionally, generating a fuzzy set based on the current temperature and target temperature range of the gas sensor includes: calculating the error and error change rate of the current temperature and the target temperature range; inputting the error and error change rate into a Gaussian membership function to determine the corresponding membership degree; and generating a fuzzy set based on the membership degree.
[0007] Optionally, generating a fuzzy PID control action according to the fuzzy set includes: if the fuzzy set is a first set, the fuzzy PID control action includes reducing a proportional parameter, maintaining an integral parameter unchanged, and increasing a differential parameter; if the fuzzy set is a second set, the fuzzy PID control action includes maintaining a proportional parameter, an integral parameter, and a differential parameter unchanged; if the fuzzy set is a third set, the fuzzy PID control action includes increasing a proportional parameter, maintaining an integral parameter unchanged, and reducing a differential parameter.
[0008] Optionally, the defuzzifying the fuzzy PID control action to obtain a target PID control action comprises: inferring the membership of a fuzzy output variable according to the output value of the fuzzy PID control action; and obtaining the target PID control action by weighted averaging the membership.
[0009] Optionally, controlling the current temperature of the gas sensor based on the target PID control action includes: identifying a voltage value output by the target PID control action; and controlling the current temperature of the gas sensor according to the voltage value.
[0010] Optionally, acquiring the current temperature of the gas sensor includes: identifying a voltage value of a heating end of the gas sensor; and determining the current temperature of the gas sensor according to the voltage value of the heating end.
[0011] Optionally, before determining the current temperature of the gas sensor according to the voltage value of the heating end, the method includes: performing a median filter on the voltage value of the heating end to obtain a voltage measurement value at a current moment; performing a one-dimensional Kalman filter on the voltage measurement value at a previous moment to obtain a voltage prediction value at a current moment; and fusing the voltage measurement value at the current moment and the voltage prediction value to generate a final voltage value of the heating end.
[0012] The second aspect of the present application provides a temperature control device for a gas sensor, comprising: an acquisition module for acquiring the current temperature of the gas sensor; a generation module for generating a fuzzy set according to the current temperature of the gas sensor and a target temperature range; a processing module for generating a fuzzy PID control action according to the fuzzy set, and defuzzifying the fuzzy PID control action to obtain a target PID control action; and a control module for controlling the current temperature of the gas sensor based on the target PID control action.
[0013] A third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to perform the temperature control method for the gas sensor as described in the above embodiment.
[0014] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, the program being executed by a processor to perform the temperature control method for a gas sensor as described in the above embodiment.
[0015] Therefore, this application has at least the following beneficial effects:
[0016] The embodiment of the present application obtains the current temperature of the gas sensor through an acquisition sensor, generates a fuzzy set according to the current temperature of the gas sensor and a target temperature range; generates a fuzzy PID control action according to the fuzzy set, and obtains a target PID control action after defuzzification of the fuzzy PID control action; controls the current temperature of the gas sensor based on the target PID control action to ensure that the gas sensor detects the gas concentration at a stable operating temperature, improves the accuracy of the detection result, and has strong anti-interference ability and high applicability.
[0017] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0019] Figure 1 A flow chart of a temperature control method for a gas sensor provided according to an embodiment of the present application;
[0020] Figure 2 This is a median filtering effect diagram of the first set of data provided according to an embodiment of the present application;
[0021] Figure 3 This is a median filtering effect diagram of the second set of data provided according to an embodiment of the present application;
[0022] Figure 4 This is a median filtering effect diagram of the third set of data provided according to an embodiment of the present application;
[0023] Figure 5 This is a median filtering effect diagram of the fourth set of data provided according to an embodiment of the present application;
[0024] Figure 6 A fuzzy PID flow chart provided according to an embodiment of the present application;
[0025] Figure 7 It is a PID control process curve provided according to an embodiment of the present application;
[0026] Figure 8 A block diagram of a temperature control device for a gas sensor according to an embodiment of the present application;
[0027] Fig. 9 It is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0028] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0029] In the related technology, a temperature-adaptive semiconductor combustible gas sensor is mentioned, which includes a sensor body, a temperature feedback circuit, a heating power control circuit and a PID calculation module. The PID calculation module is respectively connected to the temperature feedback circuit and the heating power control circuit, and outputs a control signal to the heating power control circuit according to the temperature signal to control the operation of the heater of the semiconductor combustible gas sensor.
[0030] Compared with the related art, the present application introduces fuzzy logic into the PID controller, which can automatically adjust the three parameters Kp, Ki, and Kd of the PID, making the control system more adaptable to complex and nonlinear systems, while also simplifying the process of PID parameter debugging.
[0031] The components involved in this application include an stm32 single-chip microcomputer core board and a MEMS gas sensor control board, wherein the stm32 single-chip microcomputer core board includes an stm32 chip and a single-chip microcomputer peripheral basic circuit, and the chip, resistors, and capacitors are square or circular patch components; the MEMS gas sensor control board includes a MEMS gas sensor chip, an LM358DRG operational amplifier chip, a number of resistors, capacitors, and two 4-pin headers, wherein the MEMS gas sensor chip, the LM358DRG operational amplifier chip, resistors, and capacitors are square patch components, and the 4-pin headers are plug-in components.
[0032] Specifically, the components are soldered on the bottom PCB circuit board by patch or direct insertion, and the circuit is connected by copper wire inside the PCB board. The microcontroller core board and the MEMS gas sensor control board are directly connected to the corresponding circuit through pin headers and DuPont wires. The microcontroller collects the voltage signal of the MEMS gas sensor through ADC and outputs the control voltage signal through DAC.
[0033] The temperature control method, device, electronic device and storage medium of the gas sensor according to the embodiments of the present application are described below with reference to the accompanying drawings.
[0034] Specifically, Figure 1 A schematic flow chart of a temperature control method for a gas sensor provided in an embodiment of the present application.
[0035] like Figure 1 As shown, the temperature control method of the gas sensor includes the following steps:
[0036] In step S101 , the current temperature of the gas sensor is acquired.
[0037] It can be understood that the embodiment of the present application can obtain the current temperature of the gas sensor so as to subsequently generate a fuzzy set according to the current temperature of the gas sensor and the target temperature range.
[0038] In an embodiment of the present application, obtaining the current temperature of the gas sensor includes: identifying a voltage value at a heating end of the gas sensor; and determining the current temperature of the gas sensor according to the voltage value at the heating end.
[0039] It can be understood that the embodiment of the present application can identify the voltage value of the heating end of the gas sensor; determine the current temperature of the gas sensor based on the voltage value of the heating end, so as to subsequently generate a fuzzy set based on the current temperature of the gas sensor and the target temperature range.
[0040] In an embodiment of the present application, before determining the current temperature of the gas sensor based on the voltage value of the heating end, it includes: performing a median filter on the voltage value of the heating end to obtain the voltage measurement value at the current moment; performing a one-dimensional Kalman filter on the voltage measurement value at the previous moment to obtain the voltage prediction value at the current moment; and fusing the voltage measurement value at the current moment and the voltage prediction value to generate the final voltage value of the heating end.
[0041] It can be understood that the embodiment of the present application can perform median filtering on the voltage value of the heating end to obtain the voltage measurement value at the current moment; perform one-dimensional Kalman filtering on the voltage measurement value at the previous moment to obtain the voltage prediction value at the current moment; and fuse the voltage measurement value at the current moment and the voltage prediction value to generate the final voltage value of the heating end, thereby improving the stability and accuracy of the detection results.
[0042] Specifically, the MCU uses its ADC module to sample and detect the voltage at the heating and measuring ends of the MEMS gas sensor chip, and uses the Kalman filter algorithm to process the data, which improves the stability of the detection results. Through the collected voltage signal, the MCU calculates the resistance of the current heating resistor according to the pre-set algorithm and formula. Different resistance values correspond to different temperatures at the heating end. For example: use the current resistance value to query the resistance-temperature relationship table to find the current temperature of the gas sensor.
[0043] It should be noted that before identifying the voltage value of the heating end of the gas sensor, the ADC sampling voltage data will have severe jitter in the actual test, and the external temperature change of the sensor will also affect the stability of the ADC sampling result. The ADC sampling data jitter cannot be used for subsequent precise temperature control; therefore, double filtering data processing is required, that is, combining median filtering with one-dimensional Kalman filtering algorithm, specifically:
[0044] (1) First, use the median filter to preliminarily process the ADC sampling results, collect 31 data as a group, use the sorting algorithm to re-sort the data by size, and take the middle value after sorting as the result output of this group of data. After data comparison, it can be found that the data jitter of ADC sampling is effectively reduced. This application selects four groups of data to generate corresponding effect diagrams, such as Figure 2-Figure 5 As shown, the curve with larger fluctuations is the original data sampled by ADC, and the curve with smaller fluctuations is the data after median filtering. The data jitter still exists but the amplitude and frequency are effectively reduced.
[0045] (2) In order to further maintain the stability of ADC sampling data and reduce the impact of external environmental changes on the sampling results, such as sudden changes in sampling results caused by external temperature changes or collisions, the present application uses the first-order Kalman filter algorithm again on the basis of median filtering. Among them, the one-dimensional Kalman filter is a filter used to estimate the system state. It is based on the Bayesian filtering theory and continuously updates the estimated value of the state by fusing the dynamic model of the system and the observation data.
[0046] 1) The system state estimate and state covariance need to be initialized. Usually, these initializations can be set by manually measuring ADC data.
[0047] 2) Using the dynamic model of the system, the predicted value and the variance of the predicted value at the current moment are obtained based on the estimated value at the previous moment.
[0048] 3) Calculate the Kalman gain based on the measurement matrix, the predicted value variance and the measurement noise variance; and fuse the measured value and the predicted value at the current moment under the influence of the Kalman gain.
[0049] 4) Obtain a new estimate and update the system state, and repeat the above cycle for iteration.
[0050] In this design, since Kalman filtering is used on the basis of median filtering, the variance of the Kalman filtering measurement value can be set smaller. The measurement value variance is the variance of the ADC sampling value after median filtering. The median filtering has reduced the amplitude of the sampling data jitter. The reduction of the measurement value variance can make the Kalman filtering result smoother and can effectively reduce data mutations.
[0051] As shown in Table 1 below, “R_Raw” represents the data before Kalman filtering, “R” represents the data after Kalman filtering, and “Kalman Filter” is the difference between the data before and after filtering. The larger the “Kalman Filter” is, the greater the data jitter.
[0052] Table 1 Dual filter data comparison
[0053]
[0054]
[0055] After comparison, it was found that the use of dual filtering using median filtering and Kalman filtering algorithms can effectively reduce the jitter problem of sensor data.
[0056] Changes in ambient temperature will affect the stability of ADC sampling results. At the same time, if the controller MCU works at a high temperature for a long time, the stability of the system will decrease. External collisions with the sensor will cause signal instability. All of the above problems may cause sensor data fluctuations and affect the normal use of the sensor. Therefore, double filtering is used to better filter out abnormal data jitter, thereby improving the anti-interference ability of the entire system from the software level.
[0057] In step S102 , a fuzzy set is generated according to the current temperature of the gas sensor and the target temperature range.
[0058] It can be understood that the embodiment of the present application can generate a fuzzy set according to the current temperature of the gas sensor and the target temperature range, so as to subsequently generate a fuzzy PID control action according to the fuzzy set.
[0059] In an embodiment of the present application, a fuzzy set is generated based on the current temperature and target temperature range of the gas sensor, including: calculating the error and error change rate of the current temperature and the target temperature range; inputting the error and error change rate into a Gaussian membership function to determine the corresponding membership degree; and generating a fuzzy set based on the membership degree.
[0060] It can be understood that the embodiments of the present application can calculate the error and error change rate between the current temperature and the target temperature range; input the error and error change rate into the Gaussian membership function to determine the corresponding membership degree; generate a fuzzy set based on the membership degree so that subsequent related data can be processed in fuzzy logic.
[0061] It should be noted that fuzzy PID requires the input and output to be converted into fuzzy sets in order to be processed in fuzzy logic.
[0062] Specifically, fuzzification is the process of converting the precise temperature data measured by the sensor into fuzzy sets such as "low", "moderate", and "high" according to the range. This fuzzification helps improve the system's ability to handle fuzzy inputs, especially in traditional PID control, and can better handle nonlinear and complex control problems. The specific steps include:
[0063] Define input variables: The variables are the error between the current temperature and the target temperature and the error change rate.
[0064] Define fuzzy sets: define fuzzy linguistic variables for input variables, that is, divide the variables into fuzzy variables such as "negative large", "negative middle", "zero", "positive middle", "positive large" according to the range of the variables.
[0065] Design membership function: Design a membership function for each fuzzy linguistic variable. The selection of membership function is quite diverse, and the Gaussian membership function with wide applicability is used in the design.
[0066] In step S103, a fuzzy PID control action is generated according to the fuzzy set, and the fuzzy PID control action is defuzzified to obtain a target PID control action.
[0067] It can be understood that the embodiment of the present application can generate a fuzzy PID control action based on a fuzzy set, and obtain a target PID control action after defuzzification of the fuzzy PID control action, so as to perform constant temperature control on the gas sensor chip by controlling the digital circuit and using the PID algorithm to adjust the three parameters of proportion, integration and differentiation, so as to enable the system to stabilize at the operating temperature more quickly and have strong anti-interference ability.
[0068] It should be noted that the biggest feature of introducing fuzzy logic into the traditional PID controller is that it can automatically adjust the three PID parameters Kp, Ki, and Kd, making the control system more suitable for complex and nonlinear systems, while also simplifying the process of PID parameter debugging. Figure 6 As shown, fuzzy PID requires the input and output to be converted into fuzzy sets for processing in fuzzy logic. This usually involves mapping continuous input and output values to column fuzzy sets; formulating a set of fuzzy rules that describe the control actions that should be taken under given input conditions; reasoning based on the current input fuzzy value and fuzzy rules to determine what fuzzy set the output should be; converting the fuzzy output back to the actual control signal, which is usually done through a weighted average defuzzification method to obtain an accurate control output value; combining the fuzzy control output with the proportional, integral, and derivative terms in traditional PID control to produce the final control output.
[0069] Specifically, by using digital circuit control and using the PID algorithm to adjust the three parameters of proportion, integration and differentiation to perform constant temperature control on the MEMS gas sensor chip, the system can stabilize at the operating temperature more quickly and has strong anti-interference ability. Within the ambient temperature range of 0 to 85 degrees Celsius, the sensor can work for a long time at any ambient temperature. If the ambient temperature changes rapidly, the PID controller will also quickly adjust the heating power at the first time.
[0070] Among them, the calculation formula of PID controller is:
[0071] ΔU(k)=K p [err(k)-err(k-1)]+K i err(k)+K d [err(k)-2err(k-1)+err(k-2)],
[0072] U(k)=U(k-1)+ΔU(k),
[0073] Kp adjusts the control output in proportion to the deviation between the current temperature and the target temperature. When the deviation is large, the control output will increase accordingly; when the deviation is small, the control output will decrease.
[0074] Ki integrates the deviation between the current temperature and the target temperature to eliminate persistent static errors. The integral term is very effective for correcting long-term steady-state errors. If there is a static error in the temperature, the integral term accumulates over time, increasing the control output until the error is eliminated.
[0075] Kd adjusts the voltage output based on the rate of change of the current temperature versus the target temperature. The derivative term is able to predict the temperature trend and adjust the control output accordingly to reduce overshoot and oscillation. The derivative term can slow down the system's response to rapid changes and help stabilize the system.
[0076] In an embodiment of the present application, a fuzzy PID control action is generated according to a fuzzy set, including: if the fuzzy set is a first set, the fuzzy PID control action includes reducing a proportional parameter, maintaining an integral parameter unchanged, and increasing a differential parameter; if the fuzzy set is a second set, the fuzzy PID control action includes maintaining a proportional parameter, an integral parameter, and a differential parameter unchanged; if the fuzzy set is a third set, the fuzzy PID control action includes increasing a proportional parameter, maintaining an integral parameter unchanged, and reducing a differential parameter.
[0077] Among them, the first set can be "positive large", the second set can be "zero", and the third set can be "negative large", without specific limitation.
[0078] It can be understood that, in the embodiment of the present application, if the fuzzy set is the first set, the fuzzy PID control action includes reducing the proportional parameter, maintaining the integral parameter unchanged, and increasing the differential parameter; if the fuzzy set is the second set, the fuzzy PID control action includes maintaining the proportional parameter, the integral parameter, and the differential parameter unchanged; if the fuzzy set is the third set, the fuzzy PID control action includes increasing the proportional parameter, maintaining the integral parameter unchanged, and reducing the differential parameter, which can more flexibly handle the complexity of temperature changes in different environments, and avoid the situation where the temperature is too low or too high due to the fixed threshold setting in traditional PID control.
[0079] Specifically, the application of fuzzy rules means that in a fuzzy control system, according to the fuzzy sets obtained by fuzzification processing, a series of pre-defined fuzzy rules are used to determine the control actions of the system. These fuzzy rules are usually based on expert experience or system modeling to convert fuzzy input into fuzzy output; the specific steps include:
[0080] (1) Establish a fuzzy rule base: define a series of if-then rules, which can be set based on existing expert experience.
[0081] (2) The specific fuzzy rules can be expressed in natural language as follows:
[0082] Rule 1: If the error is "positive", that is, the current temperature is much lower than the set temperature, and the error change rate is "positive", that is, the temperature is rising rapidly, then: the proportional parameter Kp should be "reduced a lot" to avoid excessive adjustments; the integral parameter Ki should be "unchanged" because the integral term is not expected to have too much impact on the system; the differential parameter Kd should be "increased a lot" to enhance the stability of the system.
[0083] Rule 2: If the error is "zero" and the error change rate is "zero", then: the proportional parameter Kp should be "unchanged" because the system is close to the target; the integral parameter Ki should be "unchanged" because the error is small; the differential parameter should be "unchanged" because the temperature changes slowly.
[0084] Rule 3: If the error is "negative and large" and the error rate of change is "negative and large", then: the proportional parameter should be "increased a lot" to quickly correct large errors; the integral parameter should be "unchanged" to avoid excessive integral accumulation; the differential parameter should be "decreased a lot" to prevent the system from overreacting.
[0085] In an embodiment of the present application, a target PID control action is obtained after defuzzification processing is performed on the fuzzy PID control action, including: inferring the membership of the fuzzy output variable according to the output value of the fuzzy PID control action; and obtaining the target PID control action after weighted averaging processing of the membership.
[0086] It can be understood that the embodiments of the present application can infer the membership of the fuzzy output variable based on the output value of the fuzzy PID control action; the target PID control action is obtained after weighted averaging the membership, which can handle fuzzy and uncertain inputs to adjust the control behavior through simple rules and has good applicability.
[0087] Specifically, defuzzification is the process of converting the fuzzy set results output by the fuzzy control system into precise control actions or output values; the purpose of defuzzification is to convert the fuzzy output of the fuzzy controller into actual actionable values and adjust the three parameters Kp, Ki, and Kd of PID.
[0088] The specific steps include:
[0089] (1) Collect fuzzy output: obtain the membership degree of fuzzy output variables from the fuzzy inference results.
[0090] (2) Defuzzification operation: The aggregated fuzzy output is converted into an accurate control action or output value by taking the average value through the defuzzification method.
[0091] Since the fuzzy controller can handle fuzzy and uncertain inputs, it is usually more robust than the traditional PID controller. Compared with the traditional PID, the adjustment process of fuzzy PID is more intuitive because it can adjust the control behavior through simple rules without in-depth understanding of the mathematical model of the system. Fuzzy PID has better applicability when the system transfer function is unknown.
[0092] like Figure 7 As shown, fuzzy PID is used to control the sensor in real time. The non-fluctuation curve Set_R is the target operating temperature of the sensor, the yellow fluctuation curve R_heat is the current temperature of the sensor, and the green fluctuation curve R_heat_R is the data of the sensor without filtering. The process from the sensor starting to stabilizing at the target temperature is relatively fast, and the sensor can be maintained at the target temperature for a long time without being disturbed by changes in the external ambient temperature.
[0093] From the data, see Table 2, the overshoot of the PID adjustment process is only 0.89%, which is 2 degrees different from the target temperature. After stabilization, it can be kept equal to the target temperature.
[0094] Table 2 PID control process data
[0095]
[0096]
[0097] In actual applications, the resistance values of sensor chips from different batches vary to a certain extent. Traditional PID needs to adjust the control parameters according to the actual response conditions. Different batches of sensors need to be debugged accordingly, which will generate a huge workload. However, by adopting fuzzy PID control and formulating a unified fuzzy rule, the controller automatically adjusts the three parameters Kp, Ki, and Kd according to the current temperature, and then calculates the output control voltage by PID. There is no need for manual adjustment, and it has better response speed and control accuracy, which greatly increases the applicability of the sensor.
[0098] In step S104, the current temperature of the gas sensor is controlled based on the target PID control action.
[0099] It can be understood that the embodiment of the present application can control the current temperature of the gas sensor based on the target PID control action to ensure that the gas sensor detects the gas concentration at a stable operating temperature, improves the accuracy of the detection results, and has strong anti-interference ability and high applicability.
[0100] In an embodiment of the present application, controlling the current temperature of the gas sensor based on a target PID control action includes: identifying a voltage value output by the target PID control action; and controlling the current temperature of the gas sensor according to the voltage value.
[0101] It is understandable that the embodiment of the present application can identify the voltage value output by the target PID control action; control the current temperature of the gas sensor according to the voltage value to accurately control the voltage across the gas sensor chip, thereby maintaining the stability of its operating temperature.
[0102] Specifically, the microcontroller will use the fuzzy PID algorithm to compare the temperature of the heating end with the target temperature and calculate the difference, and then comprehensively consider the proportional, integral and differential parts of the error to adjust the output voltage of the DAC module. By adjusting the voltage output by the DAC, the voltage across the MEMS gas sensor chip can be accurately controlled, thereby maintaining its operating temperature stable.
[0103] In summary, this application adopts a constant temperature anti-interference design. Within the ambient temperature range of 0 to 85 degrees Celsius, the sensor can automatically adapt to different ambient temperatures. By applying Kalman filtering and fuzzy PID algorithm, the sensor can quickly adjust the operating temperature to ensure that it can respond quickly under different conditions, provide accurate gas detection data, and there is no need to repeatedly adjust parameters for the same gas chip. It has high applicability to meet the growing demand for accurate and reliable gas monitoring.
[0104] According to the temperature control method of the gas sensor proposed in the embodiment of the present application, the current temperature of the gas sensor is obtained by collecting the sensor, and a fuzzy set is generated according to the current temperature of the gas sensor and the target temperature range; a fuzzy PID control action is generated according to the fuzzy set, and the fuzzy PID control action is defuzzified to obtain the target PID control action; the current temperature of the gas sensor is controlled based on the target PID control action to ensure that the gas sensor detects the gas concentration at a stable operating temperature, improves the accuracy of the detection result, and has strong anti-interference ability and high applicability.
[0105] Next, the temperature control device of the gas sensor proposed in the embodiment of the present application is described with reference to the accompanying drawings.
[0106] Figure 8 4 is a block diagram of a temperature control device for a gas sensor according to an embodiment of the present application.
[0107] like Figure 8 As shown, the temperature control device 10 of the gas sensor includes: an acquisition module 100 , a generation module 200 , a processing module 300 and a control module 400 .
[0108] Among them, the acquisition module 100 is used to obtain the current temperature of the gas sensor; the generation module 200 is used to generate a fuzzy set according to the current temperature of the gas sensor and the target temperature range; the processing module 300 is used to generate a fuzzy PID control action according to the fuzzy set, and defuzzify the fuzzy PID control action to obtain the target PID control action; the control module 400 is used to control the current temperature of the gas sensor based on the target PID control action.
[0109] It should be noted that the above explanation of the embodiment of the temperature control method of the gas sensor is also applicable to the temperature control device of the gas sensor of this embodiment, and will not be repeated here.
[0110] According to the temperature control device of the gas sensor proposed in the embodiment of the present application, the current temperature of the gas sensor is obtained by collecting the sensor, and a fuzzy set is generated according to the current temperature of the gas sensor and the target temperature range; a fuzzy PID control action is generated according to the fuzzy set, and the fuzzy PID control action is defuzzified to obtain the target PID control action; the current temperature of the gas sensor is controlled based on the target PID control action to ensure that the gas sensor detects the gas concentration at a stable operating temperature, improves the accuracy of the detection result, and has strong anti-interference ability and high applicability.
[0111] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:
[0112] A memory 901 , a processor 902 , and a computer program stored in the memory 901 and executable on the processor 902 .
[0113] When the processor 902 executes the program, the temperature control method of the gas sensor provided in the above embodiment is implemented.
[0114] Furthermore, the electronic device further comprises:
[0115] The communication interface 903 is used for communication between the memory 901 and the processor 902 .
[0116] The memory 901 is used to store computer programs that can be executed on the processor 902 .
[0117] The memory 901 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0118] If the memory 901, the processor 902 and the communication interface 903 are implemented independently, the communication interface 903, the memory 901 and the processor 902 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0119] Optionally, in a specific implementation, if the memory 901, the processor 902 and the communication interface 903 are integrated on a chip, the memory 901, the processor 902 and the communication interface 903 can communicate with each other through an internal interface.
[0120] The processor 902 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0121] An embodiment of the present application further provides a computer-readable storage medium having a computer program or instruction stored thereon. When the computer program or instruction is executed by a processor, the temperature control method of the gas sensor as described above is implemented.
[0122] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0123] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0124] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0125] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one or a combination of multiple of the following technologies known in the art: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0126] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
Claims
1. A temperature control method for a gas sensor, characterized in that: The following steps are involved: Get the current temperature of the gas sensor; generating a fuzzy set according to a current temperature of the gas sensor and a target temperature range; Generate a fuzzy PID control action according to the fuzzy set, and obtain a target PID control action after defuzzification processing of the fuzzy PID control action; The current temperature of the gas sensor is controlled based on the target PID control action.
2. The temperature control method of the gas sensor according to claim 1, characterized in that: The generating a fuzzy set according to the current temperature of the gas sensor and the target temperature range includes: Calculating the error and error change rate between the current temperature and the target temperature range; Inputting the error and error change rate into a Gaussian membership function to determine the corresponding membership degree; A fuzzy set is generated according to the membership degree.
3. The temperature control method of a gas sensor according to claim 1, characterized in that: The generating of the fuzzy PID control action according to the fuzzy set comprises: If the fuzzy set is the first set, the fuzzy PID control action includes reducing the proportional parameter, maintaining the integral parameter unchanged, and increasing the differential parameter; If the fuzzy set is the second set, the fuzzy PID control action includes maintaining the proportional parameter, the integral parameter and the differential parameter unchanged; If the fuzzy set is the third set, the fuzzy PID control action includes increasing the proportional parameter, maintaining the integral parameter unchanged, and reducing the derivative parameter.
4. The temperature control method of a gas sensor according to claim 1, characterized in that: The step of obtaining a target PID control action after defuzzifying the fuzzy PID control action comprises: Inferring the membership degree of the fuzzy output variable according to the fuzzy PID control action output value; The target PID control action is obtained by performing weighted averaging processing on the membership degrees.
5. The temperature control method of a gas sensor according to claim 1, characterized in that: The controlling the current temperature of the gas sensor based on the target PID control action includes: Identifying a voltage value output by the target PID control action; The current temperature of the gas sensor is controlled according to the voltage value.
6. The temperature control method of a gas sensor according to claim 1, characterized in that: The obtaining of the current temperature of the gas sensor comprises: Identify the voltage value at the heating end of the gas sensor; The current temperature of the gas sensor is determined according to the voltage value of the heating end.
7. The temperature control method of a gas sensor according to claim 6, characterized in that: Before determining the current temperature of the gas sensor according to the voltage value of the heating end, the method includes: Performing median filtering on the voltage value of the heating end to obtain a voltage measurement value at the current moment; Perform one-dimensional Kalman filtering on the voltage measurement value at the previous moment to obtain the voltage prediction value at the current moment; The voltage measurement value and the voltage prediction value at the current moment are integrated to generate the final voltage value of the heating end.
8. A temperature control device for a gas sensor, characterized in that: include: An acquisition module is used to obtain the current temperature of the gas sensor; A generating module, used for generating a fuzzy set according to a current temperature of the gas sensor and a target temperature range; A processing module, used for generating a fuzzy PID control action according to the fuzzy set, and obtaining a target PID control action after defuzzification processing of the fuzzy PID control action; A control module is used to control the current temperature of the gas sensor based on the target PID control action.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the temperature control method for the gas sensor according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, it is used to implement the temperature control method of the gas sensor according to any one of claims 1 to 7.
Citation Information
Patent Citations
Gas sensor, air-fuel ratio controller, and transportation apparatus
CN101363809A
Gas sensor, control method and storage medium
CN109696459A
Gas-sensitive material characterization micro-cantilever temperature control device and system
CN113190058A
Method, device and equipment for correcting degree of freedom of hand and storage medium
CN116263617A
PID temperature control method and device, equipment and storage medium
CN118034023A
Cited By
Feedback control circuit for improving stability of gas sensor at wide environment temperature
CN120891863A