Temperature control method, device, equipment and medium of gas sensor
By using the fuzzy PID control method, a fuzzy set is generated and defuzzified, which solves the problem of detection accuracy of MEMS gas sensors under unstable ambient temperature, and achieves stable detection and high accuracy in complex environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2026-03-20
AI Technical Summary
When MEMS gas sensors detect harmful gases inside automobiles, the unstable ambient temperature leads to inaccurate detection results.
The fuzzy PID control method is adopted. By obtaining the current temperature and target temperature range of the gas sensor, a fuzzy set is generated, and a fuzzy PID control action is generated. After defuzzification, the target PID control action is obtained, and the current temperature of the gas sensor is controlled based on the target PID control action.
It improves the accuracy and anti-interference ability of gas sensors, enabling them to work stably in complex environments and adapt to different temperature changes.
Smart Images

Figure CN119472871B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of gas sensor, and particularly relates to a temperature control method, device and equipment of a gas sensor and a medium. BACKGROUND
[0002] The MEMS gas sensor is a small and high-sensitivity sensor, which can provide accurate environmental detection and monitoring data in a limited space. However, when detecting harmful gases in a car, the environmental conditions are not uniform, and the MEMS detection chip cannot be maintained at a stable working temperature, thereby causing a certain deviation between the detection result and the actual result.
[0003] In the related art, the working temperature of the sensor is controlled by means of analog circuit bridge balance, but the analog circuit is easily affected by environmental factors and is unstable, and cannot adapt to actual detection needs, so that the detection result is low in precision. SUMMARY
[0004] The present application provides a temperature control method, device and equipment of a gas sensor and a medium to solve the problem that the detection of the gas sensor is easily affected by the environmental temperature in the related art, thereby causing inaccurate detection results.
[0005] The first aspect of the present application provides a temperature control method of a gas sensor, comprising the following steps: obtaining a current temperature of the gas sensor; generating a fuzzy set according to the current temperature of the gas sensor and a target temperature range; generating a fuzzy PID control action according to the fuzzy set, and obtaining a target PID control action after de-fuzzification processing of the fuzzy PID control action; and controlling the current temperature of the gas sensor based on the target PID control action.
[0006] Optionally, the generating of the fuzzy set according to the current temperature of the gas sensor and the target temperature range comprises: calculating an error and an error change rate of the current temperature and the target temperature range; inputting the error and the error change rate into a Gaussian membership function to determine a corresponding membership degree; and generating the fuzzy set according to the membership degree.
[0007] Optionally, the generating of the fuzzy PID control action according to the fuzzy set comprises: if the fuzzy set is a first set, the fuzzy PID control action comprises 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 comprises maintaining the proportional parameter, the integral parameter and the differential parameter unchanged; and if the fuzzy set is a third set, the fuzzy PID control action comprises increasing the proportional parameter, maintaining the integral parameter unchanged and reducing the differential parameter.
[0008] Optionally, the de-fuzzification processing of the fuzzy PID control action to obtain the target PID control action comprises: inferring the membership of the fuzzy output variable according to the fuzzy PID control action output value; and performing weighted average processing on the membership to obtain the target PID control action.
[0009] Optionally, the controlling of the current temperature of the gas sensor based on the target PID control action comprises: identifying the 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, the obtaining of the current temperature of the gas sensor comprises: identifying the voltage value of the 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 the determining of the current temperature of the gas sensor according to the voltage value of the heating end, the method further comprises: performing median filtering on the voltage value of the heating end to obtain a voltage measurement value at the current time; performing one-dimensional Kalman filtering on a voltage measurement value at a previous time to obtain a voltage prediction value at the current time; and fusing the voltage measurement value and the voltage prediction value at the current time to generate a final voltage value of the heating end.
[0012] The second aspect embodiment of the present application provides a temperature control device of a gas sensor, comprising: an obtaining module configured to obtain a current temperature of a gas sensor; a generating module configured to generate a fuzzy set according to the current temperature of the gas sensor and a target temperature range; a processing module configured to generate a fuzzy PID control action according to the fuzzy set, and to perform de-fuzzification processing on the fuzzy PID control action to obtain a target PID control action; and a controlling module configured to control the current temperature of the gas sensor based on the target PID control action.
[0013] The third aspect embodiment 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 of the gas sensor as described in the above embodiments.
[0014] The fourth aspect embodiment of the present application provides a computer readable storage medium having a computer program stored thereon, wherein the program is executed by a processor to perform the temperature control method of the gas sensor as described in the above embodiments.
[0015] Therefore, the present application has at least the following beneficial effects:
[0016] The embodiment of the present application acquires the current temperature of the gas sensor through the acquisition sensor, generates a fuzzy set according to the current temperature of the gas sensor and the target temperature range; generates a fuzzy PID control action according to the fuzzy set, and obtains a target PID control action after de-fuzzification processing of the fuzzy PID control action; controls the current temperature of the gas sensor based on the target PID control action, so as to ensure that the gas sensor detects the gas concentration at a stable working temperature, improve 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 made apparent by the following description and the appended claims. BRIEF DESCRIPTION OF DRAWINGS
[0018] The above and / or additional aspects and advantages of the present application will become apparent and be readily appreciated from the following description, including the accompanying drawings, wherein:
[0019] Figure 1 A flow chart of a temperature control method of a gas sensor according to an embodiment of the present application is provided;
[0020] Figure 2 A median filtering effect diagram of a first group of data according to an embodiment of the present application is provided;
[0021] Figure 3 A median filtering effect diagram of a second group of data according to an embodiment of the present application is provided;
[0022] Figure 4 A median filtering effect diagram of a third group of data according to an embodiment of the present application is provided;
[0023] Figure 5 A median filtering effect diagram of a fourth group of data according to an embodiment of the present application is provided;
[0024] Figure 6 A fuzzy PID flow chart according to an embodiment of the present application is provided;
[0025] Figure 7 A PID control process curve according to an embodiment of the present application is provided;
[0026] Figure 8 A block diagram of a temperature control device of a gas sensor according to an embodiment of the present application is provided;
[0027] Figure 9 A structural schematic diagram of an electronic device according to an embodiment of the present application is provided. DETAILED DESCRIPTION
[0028] Embodiments of the present application are described below in detail, examples of which are shown in the drawings, wherein the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by reference to the drawings are exemplary and are intended to explain the present application, and cannot be understood as a limitation of the present application.
[0029] In the related art, a temperature adaptive semiconductor combustible gas sensor is mentioned, which comprises a sensor body, a temperature feedback circuit, a heating power control circuit and a PID calculation module, the PID calculation module is connected with the temperature feedback circuit and the heating power control circuit respectively, and a control signal is output to the heating power control circuit according to a temperature signal to control the heater of the semiconductor combustible gas sensor to work.
[0030] Compared with the related art, the present application introduces fuzzy logic in the PID controller, which can automatically adjust the three parameters Kp, Ki and Kd of the PID, so that the control system is more suitable for complex and nonlinear systems, and also simplifies the process of PID parameter debugging.
[0031] The elements involved in the present 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, the chip, the resistor and the capacitor are square or circular patch elements; the MEMS gas sensor control board includes a MEMS gas sensor chip, an LM358DRG operational amplifier chip, a plurality of resistors, capacitors and two 4Pin pin headers, wherein the MEMS gas sensor chip, the LM358DRG operational amplifier chip, the resistors and the capacitors are square patch elements, and the 4Pin pin headers are straight insertion elements.
[0032] Specifically, the components are welded on the bottom PCB circuit board by patching or straight insertion, and the circuits are connected inside the PCB by copper wires. The single-chip microcomputer core board and the MEMS gas sensor control board are connected to the corresponding circuits by pin headers and Dupont wires, the single-chip microcomputer collects the voltage signal of the MEMS gas sensor by the ADC mode, and outputs the control voltage signal by the DAC mode.
[0033] The temperature control method, device, electronic equipment and storage medium of the gas sensor of the embodiments of the present application are described below with reference to the drawings.
[0034] Specifically, Figure 1 A flowchart of a temperature control method of a gas sensor provided by the embodiments of the present application is shown.
[0035] As Figure 1 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 current temperature of the gas sensor can be acquired in the embodiment of the application, so as to generate a fuzzy set according to the current temperature of the gas sensor and a target temperature range subsequently.
[0038] In the embodiment of the application, the current temperature of the gas sensor is acquired, including: 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.
[0039] It can be understood that the voltage value of the heating end of the gas sensor can be identified in the embodiment of the application, and the current temperature of the gas sensor is determined according to the voltage value of the heating end, so as to generate a fuzzy set according to the current temperature of the gas sensor and a target temperature range subsequently.
[0040] In the embodiment of the application, before the current temperature of the gas sensor is determined according to the voltage value of the heating end, the voltage value of the heating end is subjected to median filtering to obtain a voltage measurement value at the current moment, the voltage measurement value at the previous moment is subjected to one-dimensional Kalman filtering to obtain a voltage prediction value at the current moment, and the voltage measurement value at the current moment and the voltage prediction value are fused to generate a final voltage value of the heating end.
[0041] It can be understood that the voltage value of the heating end can be subjected to median filtering to obtain a voltage measurement value at the current moment in the embodiment of the application, the voltage measurement value at the previous moment is subjected to one-dimensional Kalman filtering to obtain a voltage prediction value at the current moment, and the voltage measurement value at the current moment and the voltage prediction value are fused to generate a final voltage value of the heating end, thereby improving the stability and accuracy of the detection result.
[0042] Specifically, the single-chip microcomputer samples and detects the voltage of the heating end and the measurement end of the MEMS gas sensor chip by using the ADC module carried thereby, and processes data by using the Kalman filtering algorithm, thereby improving the stability of the detection result. According to the voltage signal collected, the single-chip microcomputer calculates the resistance value of the current heating resistor according to a pre-set algorithm and formula, and different resistance values correspond to different temperatures of the heating end. For example, the current temperature of the gas sensor is obtained by querying a resistance value-temperature relationship table by using the current resistance value.
[0043] It should be noted that, before the voltage value of the heating end of the gas sensor is identified, the data of the ADC sampled voltage will have relatively severe jitter in actual testing, and the change of the external temperature of the sensor will also affect the stability of the ADC sampling result, and the data jitter of the ADC sampling cannot be used for subsequent accurate temperature control; therefore, double filtering data processing is required, that is, the median filtering is combined with the one-dimensional Kalman filtering algorithm, and specifically:
[0044] (1) First, use median filtering to ADC sampling results preliminary processing, collect 31 data as a group, using sorting algorithm to data by size reordering, take the middle value as the result output of this group of data, through data comparison can be found that the ADC sampling data jitter is effectively reduced. The application selects four groups of data to generate the corresponding effect diagram, as shown in Figures 2-5 The larger fluctuation curve is the original data of ADC sampling, and the smaller fluctuation curve is the data after median filtering. The data jitter still exists but is effectively reduced in amplitude and frequency.
[0045] (2) In order to further maintain the stability of ADC sampling data and reduce the influence of external environment changes on the sampling results, such as external temperature changes or collision caused sampling result mutation, the application uses a first-order Kalman filter algorithm based on median filtering. One-dimensional Kalman filter is a filter used to estimate the state of the system, which is based on Bayesian filtering theory and constantly updates the estimated value of the state by fusing the dynamic model of the system and the observation data.
[0046] 1) The state estimate and state covariance of the system need to be initialized. Usually, these initializations can be set by manually measuring the ADC data.
[0047] 2) Using the dynamic model of the system, the prediction value and the variance of the prediction value at the current time are derived from the estimated value at the last time.
[0048] 3) According to the measurement matrix, the prediction value variance and the measurement noise variance, the Kalman gain is calculated; under the influence of the Kalman gain, the measurement value and the prediction value at the current time are fused.
[0049] 4) The new estimated value is obtained and the system state is updated, and the above loop is repeated for iteration.
[0050] In this design, since Kalman filtering is used on the basis of median filtering, the measurement value variance of Kalman filtering can be set smaller. The measurement value variance is the variance of the ADC sampling value after median filtering, and the amplitude of the sampling data jitter has been reduced by median filtering. The reduction of the measurement value variance can make the Kalman filtering result smoother and can effectively reduce the data mutation.
[0051] As shown in Table 1, "R_Raw" represents the data before Kalman filtering, "R" represents the data after Kalman filtering, "Kalman Filter" is the difference between the data before and after filtering, and the larger "Kalman Filter" indicates the larger data jitter.
[0052] Table 1 Comparison of double filtering data
[0053]
[0054]
[0055] It is found through comparison that the use of median filtering and Kalman filtering algorithm double filtering can effectively reduce the jitter problem of sensor data.
[0056] The stability of the ADC sampling result will be affected by the change of the ambient temperature; at the same time, if the controller MCU works at a high temperature for a long time, the stability of the system will decrease; the signal instability caused by external collision of the sensor; the above problems may cause the fluctuation of the sensor data, and affect the normal use of the sensor, therefore, the use of double filtering can better filter out the abnormal jitter of the data, and improve the anti-interference of the whole 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 embodiments of the application can generate a fuzzy set according to the current temperature of the gas sensor and the target temperature range, so as to generate a fuzzy PID control action according to the fuzzy set subsequently.
[0059] In the embodiments of the application, generating a fuzzy set according to the current temperature of the gas sensor and the target temperature range includes: calculating the error and error rate of change of the current temperature and the target temperature range; inputting the error and error rate of change into a Gaussian membership function to determine the corresponding membership degree; and generating the fuzzy set according to the membership degree.
[0060] It can be understood that the embodiments of the application can calculate the error and error rate of change of the current temperature and the target temperature range; input the error and error rate of change into a Gaussian membership function to determine the corresponding membership degree; and generate the fuzzy set according to the membership degree, so as to process the subsequent related data in the fuzzy logic.
[0061] It should be noted that the fuzzy PID needs to convert the input and output into a fuzzy set, so as to be processed in the fuzzy logic.
[0062] Specifically, the fuzzification process is to convert the accurate temperature data measured by the sensor into a fuzzy set such as "low", "moderate" and "high" according to the range. Such fuzzification process helps to improve the processing capability of the system for fuzzy input, especially in traditional PID control, which can better handle nonlinear and complex control problems. The specific steps include:
[0063] Define the input variable: the variable is the error and error rate of change of the current temperature and the target temperature.
[0064] Defining fuzzy sets: define fuzzy linguistic variables for input variables, that is, divide variables into fuzzy variables such as "negative large", "negative medium", "zero", "positive medium", "positive large" according to the range of the variables.
[0065] Designing membership functions: design membership functions for each fuzzy linguistic variable, and the selection of membership functions is relatively diverse. In the design, the widely applicable Gaussian membership function is used.
[0066] In step S103, a fuzzy PID control action is generated according to the fuzzy set, and a target PID control action is obtained after the fuzzy PID control action is defuzzified.
[0067] It can be understood that the embodiment of the application can generate a fuzzy PID control action according to the fuzzy set, and obtain a target PID control action after defuzzifying the fuzzy PID control action, so as to control the gas sensor chip in a constant temperature mode by using a digital circuit control and adjusting the three parameters of proportion, integral and differential by using a PID algorithm, which can make the system more quickly stabilize at the working temperature and has strong anti-interference performance.
[0068] It should be noted that the biggest feature of introducing fuzzy logic into the traditional PID controller is that the three parameters Kp, Ki and Kd of the PID can be automatically adjusted, so that the control system is more suitable for complex and nonlinear systems, and the process of PID parameter debugging is also simplified. As shown in Figure 6 As shown in the figure, the fuzzy PID needs to convert the input and output into fuzzy sets for processing in the fuzzy logic. This usually involves mapping continuous input and output values to column fuzzy sets; a set of fuzzy rules is developed, which describes the control action that should be taken under given input conditions; reasoning is performed to determine what fuzzy set the output should be according to the fuzzy values of the current input and the fuzzy rules; fuzzy output is converted back to an actual control signal, which is usually done through a weighted average defuzzification method to obtain an accurate control output value; combine the fuzzy control output with the proportional, integral and differential terms in the traditional PID control to produce the final control output.
[0069] Specifically, the MEMS gas sensor chip is controlled in a constant temperature mode by using a digital circuit control and adjusting the three parameters of proportion, integral and differential by using a PID algorithm, which can make the system more quickly stabilize at the working temperature and has strong anti-interference performance. Within the range of 0 to 85 degrees Celsius of ambient temperature, the sensor can work at any ambient temperature for a long time. If the ambient temperature changes rapidly, the PID controller will also quickly adjust the heating power in the first time.
[0070] The calculation formula of the 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] Where Kp adjusts the control output in proportion to the size of the deviation between the current temperature and the target temperature. When the deviation is large, the control output will also increase accordingly; when the deviation is small, the control output will also 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 in correcting long-term steady-state errors. If there is a static error in temperature, the integral term will accumulate over time, increasing the control output until the error is eliminated.
[0075] Kd adjusts the voltage output according to the rate of change of the deviation between the current temperature and the target temperature. The derivative term can predict the trend of temperature change and adjust the control output accordingly to reduce overshoot and oscillation. The derivative term can slow down the system's response to rapid changes, helping to stabilize the system.
[0076] In the embodiments of the present application, the fuzzy PID control action is generated according to the fuzzy set, including: 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.
[0077] Where 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 embodiments 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, avoiding the situation of too low or too high temperature caused by fixed threshold setting in traditional PID control.
[0079] Specifically, applying fuzzy rules refers to, in a fuzzy control system, determining the control action of the system through a series of predefined fuzzy rules according to the fuzzy sets obtained through fuzzy processing. These fuzzy rules are usually based on expert experience or system modeling, and are used to convert fuzzy inputs into fuzzy outputs; the specific steps include:
[0080] (1) Establish a fuzzy rule base: define a series of if-then rules, which can be set according to 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 large", that is, the current temperature is much lower than the set temperature, and the error rate of change is "positive medium", that is, the temperature is rising rapidly, then: the adjustment proportion parameter Kp should be "reduced a lot" to avoid excessive adjustment; the adjustment integral parameter Ki should be "unchanged" because it is not desirable for the integral term to have too much impact on the system; the adjustment 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 rate of change is "zero", then: the adjustment proportion parameter Kp should be "unchanged" because the system is close to the target; the adjustment integral parameter Ki should be "unchanged" because the error is small; the adjustment differential parameter should be "unchanged" because the temperature change is slow.
[0084] Rule 3: If the error is "negative large" and the error rate of change is "negative large", then: the adjustment proportion parameter should be "increased a lot" to quickly correct the large error; the adjustment integral parameter should be "unchanged" to avoid excessive accumulation of the integral; the adjustment differential parameter should be "reduced a lot" to prevent the system from overreacting.
[0085] In the embodiments of the present application, the fuzzy PID control action is de-fuzzified to obtain a target PID control action, including: inferring the membership degree of the fuzzy output variable according to the fuzzy PID control action output value; and obtaining the target PID control action through weighted average processing of the membership degree.
[0086] It can be understood that the embodiments of the present application can infer the membership degree of the fuzzy output variable according to the fuzzy PID control action output value; and obtain the target PID control action through weighted average processing of the membership degree, which can process fuzzy and uncertain inputs to adjust the control behavior through simple rules, and has good applicability.
[0087] Specifically, the defuzzification process is to convert 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 operational values, adjust the Kp, Ki, Kd three parameters of PID.
[0088] The specific steps include:
[0089] (1) Collect fuzzy output: get the membership degree of fuzzy output variable from fuzzy reasoning results.
[0090] (2) Defuzzification operation: convert the aggregated fuzzy output into a precise control action or output value by taking the average value through the defuzzification method.
[0091] Because the fuzzy controller can handle fuzzy and uncertain inputs, it is usually more robust than traditional PID controllers. Compared with traditional PID, the adjustment process of fuzzy PID is more intuitive, because it can adjust the control behavior through simple rules without deep understanding of the mathematical model of the system, and fuzzy PID has better applicability for the case where the system transfer function is unknown.
[0092] As shown in Figure 7 , the sensor is controlled by fuzzy PID, the waveless curve Set_R is the target working temperature of the sensor, the yellow wave curve R_heat is the current temperature of the sensor, and the green wave curve R_heat_R is the data of the sensor without filtering processing. The process of the sensor from starting to stabilizing at the target temperature is relatively rapid, and it can be kept at the target temperature for a long time without being disturbed by the change of external environment temperature.
[0093] From the data, see Table 2, the overshoot of the PID adjustment process is only 0.89%, which is 2 degrees away from the target temperature, and after stabilization, it can be kept equal to the target temperature.
[0094] Table 2 PID control process data
[0095]
[0096]
[0097] In practical applications, the resistance of different batches of sensor chips has certain differences, and the traditional PID needs to adjust the control parameters according to the actual response, and different batches of sensors need to be debugged, which will produce a huge workload, but by using fuzzy PID control, a unified fuzzy rule is formulated, and the controller automatically adjusts the Kp, Ki and Kd parameters according to the current temperature, and then the PID calculates the output control voltage, without manual adjustment, with good response speed and control accuracy, greatly increasing 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 embodiments 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 working temperature, improve the accuracy of the detection result, and have strong anti-interference ability and high applicability.
[0100] In the embodiments of the present application, the current temperature of the gas sensor is controlled based on the target PID control action, including: identifying the 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 can be understood that the embodiments of the present application can identify the voltage value output by the target PID control action, and control the current temperature of the gas sensor according to the voltage value, to accurately control the voltage across the gas sensor chip, and thereby maintain the stability of its working temperature
[0102] Specifically, the single-chip microcomputer will use the fuzzy PID algorithm for calculation, compare the heating end temperature with the target temperature and calculate the difference, and then consider the proportion, 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, and thereby the stability of its working temperature can be maintained.
[0103] In summary, the present application adopts a constant temperature anti-interference design, and in the range of 0 to 85 degrees Celsius of ambient temperature, the sensor can automatically adapt to different ambient temperatures. By applying Kalman filtering and fuzzy PID algorithm, the sensor can quickly adjust the working temperature to ensure that it can quickly respond under different conditions, provide accurate gas detection data, and for the same gas chip, there is no need to repeatedly adjust the parameters, which has high applicability to meet the growing demand for accurate and reliable gas monitoring.
[0104] The temperature control method of the gas sensor provided in the embodiment of the present application comprises the following steps: acquiring the current temperature of the gas sensor through a collection sensor; generating a fuzzy set according to the current temperature of the gas sensor and a target temperature range; 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; and controlling the current temperature of the gas sensor based on the target PID control action, so as to ensure that the gas sensor detects the gas concentration at a stable working temperature, improve the accuracy of the detection result, and have strong anti-interference ability and high applicability.
[0105] Next, the temperature control device of the gas sensor provided in the embodiment of the present application is described with reference to the accompanying drawings.
[0106] Figure 8 is a block schematic diagram of the temperature control device of the gas sensor in the embodiment of the present application.
[0107] As shown in Figure 8 , the temperature control device 10 of the gas sensor comprises an acquisition module 100, a generation module 200, a processing module 300 and a control module 400.
[0108] The acquisition module 100 is configured to acquire the current temperature of the gas sensor; the generation module 200 is configured to generate a fuzzy set according to the current temperature of the gas sensor and a target temperature range; the processing module 300 is configured to 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; and the control module 400 is configured 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 and description of the temperature control method of the gas sensor also apply to the temperature control device of the gas sensor in this embodiment, which will not be described here.
[0110] The temperature control device of the gas sensor provided in the embodiment of the present application comprises the following steps: acquiring the current temperature of the gas sensor through a collection sensor; generating a fuzzy set according to the current temperature of the gas sensor and a target temperature range; 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; and controlling the current temperature of the gas sensor based on the target PID control action, so as to ensure that the gas sensor detects the gas concentration at a stable working temperature, improve the accuracy of the detection result, and have strong anti-interference ability and high applicability.
[0111] Figure 9 The structure schematic diagram of the electronic device provided in the embodiment of the present application is shown in
[0112] The memory 901, the processor 902 and the computer program stored in the memory 901 and executable on the processor 902.
[0113] The processor 902 implements the temperature control method of the gas sensor provided in the above embodiments when executing the program.
[0114] Further, 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 for storing the computer program executable on the processor 902.
[0117] The memory 901 can include a high-speed RAM memory, and can also include a non-volatile memory, for example, at least one disk memory.
[0118] If the memory 901, the processor 902 and the communication interface 903 are independently implemented, the communication interface 903, the memory 901 and the processor 902 can be connected to each other through a bus and complete communication between 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, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 9 In the figure, only one thick line is used to represent, but it does not mean that there is only one bus or only one type of bus.
[0119] Optionally, in 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 complete communication between each other through an internal interface.
[0120] The processor 902 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement one or more embodiments of the present application.
[0121] The embodiment of the present application further provides a computer readable storage medium, which has stored thereon a computer program or instructions, and the computer program or instructions are executed by a processor to implement the temperature control method of the gas sensor.
[0122] In the description of the present specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, the person skilled in the art can combine and combine the different embodiments or examples described in the present specification and the features of the different embodiments or examples without contradiction.
[0123] In addition, the terms "first", "second" are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "N" is at least two, for example, two, three, etc., unless otherwise explicitly specified.
[0124] Any process or method descriptions in flow charts or described herein in other ways can be understood as representing code modules, segments, or portions of code that include one or N executable instructions for implementing the specified logic functions (or steps), and the preferred embodiments of the present application include additional implementations in which the functions can be performed in different orders, including substantially simultaneously, or in reverse order, depending on the functionality involved, which should be understood by those skilled in the art of the technical field to which the embodiments of the present application belong.
[0125] It should be understood that parts of the present application can be implemented in hardware, software, firmware or a combination thereof. In the above-described embodiments, N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. As in another embodiment, if implemented in hardware, any one or a combination of the following technologies known in the art can be used: discrete logic circuit with logic gate circuit for implementing logic functions on data signals, application specific integrated circuit with suitable combination logic gate circuit, programmable gate array (PGA), field programmable gate array (FPGA), etc.
[0126] Those skilled in the art can understand that all or part of the steps of the foregoing method embodiments can be completed by programs instructing relevant hardware, and the programs can be stored in a computer readable storage medium. When the programs are executed, the steps of the method embodiments or a combination thereof are included.
Claims
1. A temperature control method for a gas sensor, characterized in that, Includes the following steps: Obtain the current temperature of the gas sensor; A fuzzy set is generated based on the current temperature of the gas sensor and the target temperature range; The fuzzy PID control action is generated based on the fuzzy set, and the target PID control action is obtained after defuzzification of the fuzzy PID control action. The gas sensor's current temperature is controlled based on the target PID control action; The process of obtaining the current temperature of the gas sensor includes: Identify the voltage value at the heating end of the gas sensor; The current temperature of the gas sensor is determined based on the voltage value at the heating end; Before determining the current temperature of the gas sensor based on the voltage value at the heating end, the process includes: The voltage value at the heating end is filtered by median to obtain the voltage measurement value at the current moment; The voltage measurement value at the previous moment is subjected to a one-dimensional Kalman filter to obtain the voltage prediction value at the current moment; The final voltage value of the heating end is generated by combining the current voltage measurement value and the voltage prediction value.
2. The temperature control method for a gas sensor according to claim 1, characterized in that, The step of generating a fuzzy set based on the current temperature of the gas sensor and the target temperature range includes: Calculate the error between the current temperature and the target temperature range, and the rate of change of the error; The error and the rate of change of error are input into the Gaussian membership function to determine the corresponding membership degree; A fuzzy set is generated based on the membership degree.
3. The temperature control method for a gas sensor according to claim 1, characterized in that, The step of generating fuzzy PID control actions based on the fuzzy set includes: If the fuzzy set is the first set, then the fuzzy PID control actions include reducing the proportional parameter, keeping the integral parameter unchanged, and increasing the derivative parameter; If the fuzzy set is the second set, then the fuzzy PID control action includes keeping the proportional parameter, integral parameter, and derivative parameter unchanged; If the fuzzy set is a third set, then the fuzzy PID control actions include increasing the proportional parameter, keeping the integral parameter unchanged, and decreasing the derivative parameter.
4. The temperature control method for a gas sensor according to claim 1, characterized in that, The process of defuzzifying the fuzzy PID control action to obtain the target PID control action includes: The membership degree of the fuzzy output variable is inferred based on the output value of the fuzzy PID control action; The target PID control action is obtained by performing a weighted average on the membership degree.
5. The temperature control method for a gas sensor according to claim 1, characterized in that, The control of the current temperature of the gas sensor based on the target PID control action includes: Identify the voltage value output by the target PID control action; The current temperature of the gas sensor is controlled based on the voltage value.
6. A temperature control device for a gas sensor, characterized in that, A method for implementing the temperature control of a gas sensor as described in any one of claims 1-5, comprising: The acquisition module is used to acquire the current temperature of the gas sensor; A generation module is used to generate a fuzzy set based on the current temperature of the gas sensor and the target temperature range; The processing module is used to generate fuzzy PID control actions based on the fuzzy set, and to obtain the target PID control action by defuzzifying the fuzzy PID control actions. The control module is used to control the current temperature of the gas sensor based on the target PID control action.
7. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the temperature control method for a gas sensor as described in any one of claims 1-5.
8. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by the processor, they are used to implement the temperature control method of the gas sensor as described in any one of claims 1-5.
Citation Information
Patent Citations
PID temperature control method and device, equipment and storage medium
CN118034023A
A temperature-adaptive semiconductor combustible gas sensor
CN220961500U