Disclosure of Invention
The invention aims to provide a constant temperature control method and a constant temperature control system, which can adjust in time according to real-time water temperature and improve the stability of temperature adjustment.
In order to solve the technical problem, the invention provides a constant temperature control method, which comprises the following steps: s101, acquiring a preset constant temperature set by a user and a detection voltage detected by a temperature sensor; s102, calculating a temperature error according to a preset constant temperature and a detection voltage; s103, calculating error accumulation sum according to the temperature error; s104, calculating temperature control output according to the temperature error and the error accumulation; s105, judging whether the temperature control output is larger than a first preset threshold value or not, S106, if so, adjusting the power of the heater according to the first preset threshold value to obtain preset constant temperature and detection voltage, calculating a temperature error according to the preset constant temperature and the detection voltage, judging whether the temperature error is smaller than zero or not, if so, returning to S103, if not, returning to S104, if not, judging whether the temperature control output is smaller than a second preset threshold value or not, judging whether the temperature control output is smaller than the second preset threshold value or not, returning to S101, if so, adjusting the power of the heater according to the second preset threshold value to obtain the preset constant temperature and the detection voltage, calculating the temperature error according to the preset constant temperature and the detection voltage, judging whether the temperature error is larger than zero or not, returning to S103, if not, and returning to S104.
As an improvement of the above scheme, the first preset threshold is greater than the second preset threshold, the thermostatic control method further includes setting the first preset threshold and the second preset threshold in a debugging manner, and the specific steps include: s201, acquiring preset constant temperature precision; s202, acquiring an initial value of a first preset threshold and an initial value of a second preset threshold; s203, carrying out constant temperature adjustment according to the steps from S101 to S107, and detecting the maximum temperature deviation; s204, judging whether the maximum temperature deviation is larger than the preset constant temperature precision or not, if so, S205, lowering the first preset threshold value according to the preset proportion, raising the second preset threshold value according to the preset proportion, returning to the step S203, and if not, finishing debugging.
As an improvement of the above scheme, the step of calculating the temperature error according to the preset constant temperature and the detection voltage includes: acquiring a reference temperature voltage set by a user, and calculating a real-time detection temperature T:
T=(Ui-Uc)×K
wherein K is the temperature coefficient of the thermistor, UiFor reference to temperature voltage, UcT is the real-time detection temperature for detecting the voltage; calculating the temperature error er:
er=Ts-T
where er is the temperature error, TsT is the real-time detection temperature.
As an improvement of the above scheme, the formula for calculating the error accumulated sum according to the temperature error is as follows:
ersum=ersum-pre+er
wherein, ersumFor error cumulative sum, ersum-preThe error accumulated sum is calculated last time, and er is the temperature error.
As an improvement of the scheme, a formula for calculating the temperature control output according to the temperature error and the error accumulation is as follows:
O=p·er+i·ersum+d·(er-erpre)
wherein O is the temperature control output, p is the proportionality coefficient, i is the integral coefficient, d is the differential coefficient, er is the temperature error, erpreIs the temperature error calculated last time.
Correspondingly, the invention also discloses a constant temperature control system, which comprises: the acquisition module is used for acquiring preset constant temperature set by a user and detection voltage detected by the temperature sensor; the temperature difference calculation module is used for calculating a temperature error according to a preset constant temperature and the detection voltage; the error sum calculating module is used for calculating the error accumulated sum according to the temperature error; the temperature control computing module is used for computing temperature control output according to the temperature error and the error accumulation sum; the temperature control output judging module is used for judging whether the temperature control output is greater than a first preset threshold value or not; the temperature reduction control module is used for adjusting the power of the heater according to a first preset threshold value when the judgment result is yes, acquiring preset constant temperature and detection voltage, calculating a temperature error according to the preset constant temperature and the detection voltage, judging whether the temperature error is smaller than zero or not, calling the error and calculation module if the judgment result is yes, and calling the temperature control calculation module if the judgment result is not; and the heating control module is used for judging whether the temperature control output is smaller than a second preset threshold value or not when judging not, judging whether the temperature control output is smaller than the second preset threshold value or not, adjusting the heater power according to the temperature control output and calling the acquisition module, judging whether the temperature control output is larger than the second preset threshold value or not, adjusting the heater power according to the second preset threshold value, acquiring preset constant temperature and detection voltage, calculating a temperature error according to the preset constant temperature and the detection voltage, judging whether the temperature error is larger than zero or not, calling the error and calculation module if the temperature control output is larger than the second preset threshold value.
As an improvement of the above scheme, the first preset threshold is greater than the second preset threshold, the thermostatic control system further includes a threshold setting module, and the threshold setting module is configured to perform debugging setting on the first preset threshold and the second preset threshold, and includes: the constant temperature precision acquisition module is used for acquiring preset constant temperature precision; the initial value acquisition module is used for acquiring an initial value of a first preset threshold value and an initial value of a second preset threshold value; the maximum temperature difference measuring module is used for calling the acquisition module, the temperature difference calculating module, the error and calculating module, the temperature control output judging module, the cooling control module and the heating control module to perform constant temperature regulation and detecting the maximum temperature deviation; the temperature difference precision judging module is used for judging whether the maximum temperature deviation is greater than the preset constant temperature precision or not; the threshold value adjusting module is used for reducing a first preset threshold value according to a preset proportion, increasing a second preset threshold value according to the preset proportion and calling the maximum temperature difference measuring module if the judgment is yes; and the debugging ending module is used for judging whether the debugging is ended or not.
As an improvement of the above scheme, the temperature difference calculation module includes: and the detection temperature calculation unit is used for acquiring the reference temperature voltage set by the user and calculating the real-time detection temperature T:
T=(Ui-Uc)×K
wherein K is the temperature coefficient of the thermistor, UiFor reference to temperature voltage, UcT is the real-time detection temperature for detecting the voltage; a temperature error calculation unit for calculating a temperature error er according to the following formula:
er=Ts-T
where er is the temperature error, TsT is the real-time detection temperature.
As an improvement of the above scheme, the error sum calculation module calculates the error accumulated sum according to the temperature error by the following formula:
ersum=ersum-pre+er
wherein, ersumFor error cumulative sum, ersum-preThe error accumulated sum is calculated last time, and er is the temperature error.
As an improvement of the above scheme, the formula for the temperature control calculation module to calculate the temperature control output according to the temperature error and the error accumulation is as follows:
O=p·er+i·ersum+d·(er-erpre)
wherein O is the temperature control output, p is the proportionality coefficient, i is the integral coefficient, d is the differential coefficient, er is the temperature error, erpreIs the temperature error calculated last time.
The implementation of the invention has the following beneficial effects:
the constant temperature control method and the system can adjust in time according to the real-time water temperature, and improve the stability of temperature adjustment.
Specifically, firstly, the water temperature is detected in real time, then a temperature error is calculated according to the real-time detected temperature and a preset constant temperature, and then temperature control output is calculated according to the temperature error, so that the power of the heater is controlled. When the temperature is detected in real time, the error between the temperature and the preset constant temperature is changed, so that the temperature control output and the power of the heater are changed, the power of the heater is adjusted in time, and the stability of temperature adjustment is improved. Secondly, when the temperature control output is larger than a first preset threshold value, the power is adjusted according to the first preset threshold value to prevent the temperature control output from exceeding the upper power adjustment limit to cause processing errors, and similarly, when the temperature control output is smaller than a second preset threshold value, the power is adjusted according to the second preset threshold value to prevent the temperature control output from exceeding the lower power adjustment limit to cause processing errors. Thirdly, when the temperature control output is greater than the first preset threshold, the error accumulation sum is calculated only when the temperature error is less than 0, so that the temperature control output is prevented from being too large and cannot be adjusted in time when the power is reversely adjusted.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings. It is only noted that the invention is intended to be limited to the specific forms set forth herein, including any reference to the drawings, as well as any other specific forms of embodiments of the invention.
Fig. 1 shows a general flow chart of the thermostatic control method of the present invention, which includes:
s101, acquiring preset constant temperature set by a user and detection voltage detected by a temperature sensor.
And S102, calculating a temperature error according to the preset constant temperature and the detection voltage.
The temperature error is an index for measuring the difference between the real-time detection temperature and the preset constant temperature, and is a basic parameter for adjusting the power of the heater.
And S103, calculating error accumulation sum according to the temperature error.
It should be noted that, the heater is controlled to be turned off when the current hysteresis control reaches the upper limit, and the heater is controlled to be turned on and heated when the current hysteresis control reaches the lower limit, and the on-off control cannot achieve a good constant temperature effect when the upper limit and the lower limit are large, and the heater is frequently turned on and off when the upper limit and the lower limit are small, so that the service life of the heater is damaged for a long time. The power can be continuously adjusted through the error accumulation sum, so that the technical problem is solved. The error accumulation sum is an index for measuring all errors, and cannot change along with the change of one error, so that frequent change is prevented. For example, when the error sum is 3 ℃, when the newly calculated temperature error is-0.5 ℃, the two are added, the new error sum is 2.5 ℃, which does not turn off the heater at once but reduces the power of the heater, and if the calculated error is still negative, the error sum is reduced all the time, which also reduces the power of the heater until the power is reduced to zero and finally stops heating, so that the adjustment makes the adjustment more stable and protects the heater.
S104, calculating temperature control output according to the temperature error and the error accumulation;
the temperature control output is calculated by temperature error and error accumulation, and the proportion of the temperature error can prevent the error accumulation and adjustment from being too slow.
S105, judging whether the temperature control output is larger than a first preset threshold value,
s106, when the judgment is yes, adjusting the heater power according to the first preset threshold value, obtaining the preset constant temperature and the detection voltage, calculating the temperature error according to the preset constant temperature and the detection voltage, judging whether the temperature error is less than zero, if so, returning to S103, if not, returning to S104,
it should be noted that both the temperature control output and the first preset threshold are pulse width values, the pulse width refers to the time for turning on the circuit in the preset period, and the ratio of the pulse width to the preset period can be used for adjusting the heater power, thereby realizing the continuous adjustment of the heater power. This ratio is the duty cycle.
When the temperature control output is larger than a first preset threshold value, the power of the heater is adjusted according to the first preset threshold value, and data overflow caused by the fact that the power proportion of the heater is too high and even exceeds the upper limit of the duty ratio is effectively prevented.
After the power of the heater is adjusted, the latest preset constant temperature and the latest detection voltage are obtained again, and the latest temperature error is calculated.
When the temperature error is less than zero, the process returns to S103 to calculate the error accumulation sum, so that the temperature control output calculated according to the error accumulation sum can be reduced below a first preset threshold, and the power of the heater is reduced at a lower duty ratio, thereby reducing the overhigh water temperature in time.
And when the temperature error is larger than or equal to zero, skipping the calculation of calculating the error accumulated sum, directly returning to S104, calculating the next temperature control output according to the original error accumulated sum and the newly calculated temperature error, and performing subsequent control on the power of the heater according to the next temperature control output, thereby preventing the situation that the calculated temperature control output is farther away from the first preset threshold value due to the fact that the value of the error accumulated sum is larger and larger, and the power of the heater cannot be effectively reduced.
S107, when the judgment result is no, judging whether the temperature control output is smaller than a second preset threshold value, judging whether the judgment result is no, adjusting the heater power according to the temperature control output and returning to S101, judging whether the judgment result is yes, adjusting the heater power according to the second preset threshold value, obtaining a preset constant temperature and a detection voltage, calculating a temperature error according to the preset constant temperature and the detection voltage, judging whether the temperature error is larger than zero, returning to S103 if the judgment result is yes, and returning to S104 if the judgment result is no.
It should be noted that the second preset threshold is also a pulse width value, and the function of the second preset threshold is similar to that of the first preset threshold.
When the temperature control output is smaller than a second preset threshold value, the power of the heater is adjusted according to the second preset threshold value, and the phenomenon that the power of the heater is reduced to a lower limit of a duty ratio to cause data overflow is effectively prevented.
After the power of the heater is adjusted, the latest preset constant temperature and the latest detection voltage are obtained again, the latest temperature error is calculated,
when the temperature error is greater than zero, the step S103 is switched back to calculate the error accumulation sum, so that the temperature control output calculated according to the error accumulation sum can be increased to be higher than a second preset threshold value, and the power of the heater is increased at a higher duty ratio, thereby increasing the over-low water temperature in time.
And when the temperature error is less than or equal to zero, skipping the calculation of calculating the error accumulated sum, directly returning to S104, calculating the next temperature control output according to the original error accumulated sum and the newly calculated temperature error, and performing subsequent control on the power of the heater according to the next temperature control output, so that the situation that the calculated temperature control output is farther away from a second preset threshold value and the power of the heater cannot be effectively improved due to the fact that the value of the error accumulated sum is smaller and smaller is avoided.
Further, the first preset threshold is greater than the second preset threshold, as shown in fig. 2, the thermostatic control method further includes:
s201, acquiring preset constant temperature precision;
the preset constant temperature precision is not the only unchangeable value, and different preset constant temperature precisions can be set according to different precision requirements and used as debugging critical conditions of the first preset threshold and the second preset threshold.
S202, acquiring an initial value of a first preset threshold and an initial value of a second preset threshold.
Preferably, the initial value of the first preset threshold is a pulse width corresponding to a 100% duty cycle, and the initial value of the second preset threshold is a pulse width corresponding to a 0% duty cycle, so that the debugging range is the maximum.
And S203, carrying out constant temperature adjustment according to the steps S101 to S107, and detecting the maximum temperature deviation.
When the temperature is adjusted to a constant temperature, the temperature curve may be detected by a temperature sensor, and after the temperature is kept constant, the temperature deviation may be further measured. For example, if the constant temperature is set to 40 ℃, the deviation of the detected temperature from 40 ℃ is observed after the constant temperature state is entered, and the maximum temperature deviation is ± 0.5 ℃ if the detected temperature is 39.5 ℃ to 40.5 ℃.
S204, judging whether the maximum temperature deviation is greater than the preset constant temperature precision or not,
s205, if yes, the first preset threshold is decreased according to the preset proportion, the second preset threshold is increased according to the preset proportion, and the step S203 is returned,
the maximum temperature deviation is larger than the preset constant temperature precision, which shows that the first preset threshold value needs to be adjusted down, so that the adjusting process of reducing power is started earlier, and the positive deviation value is reduced. Meanwhile, the second preset threshold value needs to be increased, so that the adjusting process of increasing the power is started earlier, and the negative deviation value is improved.
S206, judging no, and finishing debugging.
And when the maximum temperature deviation is less than or equal to the preset constant temperature precision, the constant temperature precision meets the requirement, and the debugging is finished at the moment.
Further, as shown in fig. 3, the step of calculating the temperature error according to the preset constant temperature and the detected voltage includes:
s301, acquiring a reference temperature voltage set by a user, and calculating a real-time detection temperature T:
T=(Ui-Uc)×K
wherein K is the temperature coefficient of the thermistor, UiFor reference to temperature voltage, UcTo detect voltage, T is the real-time detected temperature.
A positive thermistor temperature coefficient K indicates that the voltage increases with increasing temperature, whereas a negative thermistor temperature coefficient K indicates that the voltage decreases with increasing temperature.
S302, calculating a temperature error er:
er=Ts-T
where er is the temperature error, TsT is the real-time detection temperature.
The temperature error is a negative value and indicates that the preset constant temperature is lower than the real-time detection temperature, and the temperature error is a positive value and indicates that the preset constant temperature is higher than the real-time detection temperature.
Further, the formula for calculating the error accumulated sum according to the temperature error is:
ersum=ersum-pre+er
wherein, ersumFor error cumulative sum, ersum-preThe error accumulated sum is calculated last time, and er is the temperature error.
It should be noted that, when the error accumulation sum is calculated for the first time, the error accumulation sum er calculated for the last time issum-preIs 0, the first error accumulation sum is the first calculated temperature error. And adding the temperature error accumulated sum calculated last time and the temperature error calculated this time to obtain the temperature error accumulated sum calculated this time from the second time of calculation.
Further, the formula for calculating the temperature control output according to the temperature error and the error accumulation sum is as follows:
O=p·er+i·ersum+d·(er-erpre)
wherein O is the temperature control output, p is the proportionality coefficient, i is the integral coefficient, d is the differential coefficient, er is the temperature error, erpreIs the temperature error calculated last time.
It should be noted that, when the error accumulation sum is calculated for the first time, the error accumulation sum er calculated for the last time ispreThe value of (d) is 0, and the first temperature control output is (p + i + d) · er. And starting from the second calculation, calculating the temperature control output according to the temperature error calculated last time, the temperature error calculated this time and the error accumulation sum calculated this time.
In conclusion, the temperature control output is calculated through temperature error and error accumulation, and the temperature of the heater is adjusted in a duty ratio mode, so that the continuous and stable adjustment of the heater is realized, and the damage of the heater caused by frequent switching on and off of the heater is effectively prevented.
Accordingly, as shown in fig. 4, the present invention also discloses a thermostatic control system 100, comprising:
the acquisition module 1 is used for acquiring preset constant temperature set by a user and detection voltage detected by the temperature sensor.
And the temperature difference calculation module 2 is used for calculating a temperature error according to a preset constant temperature and the detection voltage.
The temperature error is an index for measuring the difference between the real-time detection temperature and the preset constant temperature, and is a basic parameter for adjusting the power of the heater.
And the error sum calculating module 3 is used for calculating the error accumulated sum according to the temperature error.
It should be noted that, the heater is controlled to be turned off when the current hysteresis control reaches the upper limit, and the heater is controlled to be turned on and heated when the current hysteresis control reaches the lower limit, and the on-off control cannot achieve a good constant temperature effect when the upper limit and the lower limit are large, and the heater is frequently turned on and off when the upper limit and the lower limit are small, so that the service life of the heater is damaged for a long time. The error sum calculation module 3 can continuously adjust the power through the error accumulation sum, thereby solving the technical problem. The error accumulation sum is an index for measuring all errors, and cannot change along with the change of one error, so that frequent change is prevented. For example, when the error sum is 3 ℃, when the newly calculated temperature error is-0.5 ℃, the error sum calculating module 3 will add the two, the new error sum is 2.5 ℃, which will not turn off the heater at once but reduce the power of the heater, if the calculated error is still negative, the error sum will be reduced all the time, and the power of the heater will be reduced until the power is reduced to zero and finally the heating is stopped, so that the adjustment will make the adjustment more stable and protect the heater.
And the temperature control computing module 4 is used for accumulating and computing temperature control output according to the temperature error and the error.
The temperature control output is calculated by temperature error and error accumulation, and the proportion of the temperature error can prevent the error accumulation and adjustment from being too slow.
And the temperature control output judging module 5 is used for judging whether the temperature control output is greater than a first preset threshold value.
And the cooling control module 6 is used for adjusting the power of the heater according to a first preset threshold value when the judgment result is yes, acquiring preset constant temperature and detection voltage, calculating a temperature error according to the preset constant temperature and the detection voltage, judging whether the temperature error is smaller than zero or not, calling the error and calculation module if the judgment result is yes, and calling the temperature control calculation module if the judgment result is no.
It should be noted that both the temperature control output and the first preset threshold are pulse width values, the pulse width refers to the time for turning on the circuit in the preset period, and the ratio of the pulse width to the preset period can be used for adjusting the heater power, thereby realizing the continuous adjustment of the heater power. This ratio is the duty cycle.
When the temperature control output is greater than a first preset threshold, the cooling control module 6 adjusts the heater power according to the first preset threshold, and effectively prevents the data overflow caused by the fact that the heater power proportion is too high and even exceeds the upper limit of the duty ratio.
After the heater power is adjusted, the cooling control module 6 needs to obtain the latest preset constant temperature and the latest detection voltage again, and calculate the latest temperature error.
When the temperature error is less than zero, the cooling control module 6 returns to S103 to calculate the error accumulation sum, so that the temperature control output calculated according to the error accumulation sum can be reduced below the first preset threshold, and the power of the heater is reduced at a lower duty ratio, thereby reducing the excessively high water temperature in time.
When the temperature error is greater than or equal to zero, the cooling control module 6 skips the calculation of the error accumulation sum, directly returns to S104, calculates the next temperature control output according to the original error accumulation sum and the newly calculated temperature error, and performs subsequent control on the power of the heater according to the next temperature control output, thereby preventing the power of the heater from being effectively reduced because the calculated temperature control output is farther from the first preset threshold value due to the fact that the value of the error accumulation sum is larger and larger.
And the heating control module 7 is used for judging whether the temperature control output is smaller than a second preset threshold value or not when judging not, judging whether the temperature control output is smaller than the second preset threshold value or not, adjusting the heater power according to the temperature control output and calling the acquisition module, judging whether the temperature control output is larger than the second preset threshold value or not, adjusting the heater power according to the second preset threshold value, acquiring preset constant temperature and detection voltage, calculating a temperature error according to the preset constant temperature and the detection voltage, judging whether the temperature error is larger than zero or not, calling the error and calculation module if the temperature error is larger than zero, and calling the temperature control.
It should be noted that the second preset threshold is also a pulse width value, and the function of the second preset threshold is similar to that of the first preset threshold.
When the temperature control output is smaller than a second preset threshold, the heating control module 7 adjusts the heater power according to the second preset threshold, and data overflow caused by the fact that the heater power is reduced to a lower limit of a duty ratio is effectively prevented.
After the power of the heater is adjusted, the heating control module 7 needs to obtain the latest preset constant temperature and the latest detection voltage again, calculate the latest temperature error,
when the temperature error is greater than zero, the heating control module 7 returns to S103 to calculate the error accumulation sum, so that the temperature control output calculated according to the error accumulation sum can be increased to above the second preset threshold, and the power of the heater is increased with a higher duty ratio, thereby increasing the excessively low water temperature in time.
When the temperature error is less than or equal to zero, the heating control module 7 skips the calculation of the error accumulation sum, directly returns to S104, calculates the next temperature control output according to the original error accumulation sum and the newly calculated temperature error, and performs subsequent control on the power of the heater according to the next temperature control output, thereby preventing the power of the heater from being effectively increased due to the fact that the calculated temperature control output is farther from a second preset threshold value as the value of the error accumulation sum is smaller.
Further, the first preset threshold is greater than the second preset threshold, the thermostatic control system further includes a threshold setting module 8, the threshold setting module 8 is configured to debug and set the first preset threshold and the second preset threshold, as shown in fig. 5, the thermostatic control system includes:
and the constant temperature precision obtaining module 81 is used for obtaining preset constant temperature precision.
The preset constant temperature precision is not the only unchangeable value, and different preset constant temperature precisions can be set according to different precision requirements and used as debugging critical conditions of the first preset threshold and the second preset threshold.
The initial value obtaining module 82 is configured to obtain an initial value of a first preset threshold and an initial value of a second preset threshold.
Preferably, the initial value of the first preset threshold is a pulse width corresponding to a 100% duty cycle, and the initial value of the second preset threshold is a pulse width corresponding to a 0% duty cycle, so that the debugging range is the maximum.
And a maximum temperature difference measurement module 83, configured to invoke the obtaining module, the temperature difference calculation module, the error and calculation module, the temperature control output determination module, the cooling control module, and the heating control module to perform constant temperature adjustment, and detect a maximum temperature deviation.
The maximum temperature difference measuring module 83 may detect a temperature curve through a temperature sensor when the temperature is adjusted at a constant temperature, and the maximum temperature difference measuring module 83 further measures a temperature deviation after the temperature is kept at the constant temperature. For example, if the constant temperature is set to 40 ℃, the deviation of the detected temperature from 40 ℃ is observed after the constant temperature state is entered, and the maximum temperature deviation is ± 0.5 ℃ if the detected temperature is 39.5 ℃ to 40.5 ℃.
And a temperature difference precision judging module 84, configured to judge whether the maximum temperature deviation is greater than a preset constant temperature precision.
And the threshold adjusting module 85 is used for decreasing the first preset threshold according to the preset proportion, increasing the second preset threshold according to the preset proportion and calling the maximum temperature difference measuring module if the judgment is yes.
The maximum temperature deviation is larger than the preset constant temperature precision, which shows that the first preset threshold value needs to be adjusted down, so that the adjusting process of reducing power is started earlier, and the positive deviation value is reduced. Meanwhile, the second preset threshold value needs to be increased, so that the adjusting process of increasing the power is started earlier, and the negative deviation value is improved.
And a debugging ending module 86, configured to judge that the debugging is ended if the debugging is not ended.
When the maximum temperature deviation is less than or equal to the preset constant temperature precision, which indicates that the constant temperature precision meets the requirement, the debugging ending module 86 ends the debugging at this time.
Further, as shown in fig. 6, the temperature difference calculation module 2 includes:
a detection temperature calculation unit 21, configured to obtain a reference temperature voltage set by a user, and calculate a real-time detection temperature T:
T=(Ui-Uc)×K
wherein K is the temperature coefficient of the thermistor, UiFor reference to temperature voltage, UcTo detect voltage, T is the real-time detected temperature.
A positive thermistor temperature coefficient K indicates that the voltage increases with increasing temperature, whereas a negative thermistor temperature coefficient K indicates that the voltage decreases with increasing temperature.
A temperature error calculation unit 22 for calculating a temperature error er according to the following formula:
er=Ts-T
where er is the temperature error, TsT is the real-time detection temperature.
The temperature error is a negative value and indicates that the preset constant temperature is lower than the real-time detection temperature, and the temperature error is a positive value and indicates that the preset constant temperature is higher than the real-time detection temperature.
Further, the error sum calculating module 3 calculates the error accumulated sum according to the temperature error by the following formula:
ersum=ersum-pre+er
wherein, ersumFor error addition and,ersum-prethe error accumulated sum is calculated last time, and er is the temperature error.
It should be noted that, when the error sum calculating module 3 calculates the error sum for the first time, the error sum er calculated last timesum-preIs 0, the first error accumulation sum is the first calculated temperature error. From the second calculation, the error sum calculation module 3 adds the temperature error accumulated sum calculated last time and the temperature error calculated this time to obtain the temperature error accumulated sum calculated this time.
Further, the formula for the temperature control calculation module 4 to calculate the temperature control output according to the temperature error and the error accumulation sum is as follows:
O=p·er+i·ersum+d·(er-erpre)
wherein O is the temperature control output, p is the proportionality coefficient, i is the integral coefficient, d is the differential coefficient, er is the temperature error, erpreIs the temperature error calculated last time.
It should be noted that, when the temperature control calculation module 4 calculates the error accumulation sum for the first time, the error accumulation sum er calculated last timepreThe value of (d) is 0, and the first temperature control output is (p + i + d) · er. From the second calculation, the temperature control calculation module 4 calculates the temperature control output according to the temperature error calculated last time, the temperature error calculated this time and the error accumulation sum calculated this time.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.