CN113156806B - Temperature control method, device, equipment and medium based on PID algorithm - Google Patents

Temperature control method, device, equipment and medium based on PID algorithm Download PDF

Info

Publication number
CN113156806B
CN113156806B CN202110290467.4A CN202110290467A CN113156806B CN 113156806 B CN113156806 B CN 113156806B CN 202110290467 A CN202110290467 A CN 202110290467A CN 113156806 B CN113156806 B CN 113156806B
Authority
CN
China
Prior art keywords
temperature
value
temperature control
control
pid
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110290467.4A
Other languages
Chinese (zh)
Other versions
CN113156806A (en
Inventor
李泽雄
黎培聪
黄浩涛
张炎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Excbio Biotechnology Co ltd
Original Assignee
Guangzhou Excbio Biotechnology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Excbio Biotechnology Co ltd filed Critical Guangzhou Excbio Biotechnology Co ltd
Priority to CN202110290467.4A priority Critical patent/CN113156806B/en
Publication of CN113156806A publication Critical patent/CN113156806A/en
Application granted granted Critical
Publication of CN113156806B publication Critical patent/CN113156806B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B11/00Automatic controllers
    • G05B11/01Automatic controllers electric
    • G05B11/36Automatic controllers electric with provision for obtaining particular characteristics, e.g. proportional, integral, differential
    • G05B11/42Automatic controllers electric with provision for obtaining particular characteristics, e.g. proportional, integral, differential for obtaining a characteristic which is both proportional and time-dependent, e.g. P. I., P. I. D.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Feedback Control In General (AREA)

Abstract

The invention discloses a temperature control method, a device, equipment and a medium based on a PI D algorithm, wherein the method comprises the following steps: acquiring a time mark, and executing the next step when the time mark meets a first preset condition; acquiring a temperature control mark, and executing the next step when the temperature control mark meets a second preset condition; performing improved position PI D algorithm operation to obtain a PI D control value; wherein the improved position PI D algorithm comprises a preset constant value; and taking the PI D control value as a new input temperature, and returning to the step of executing the acquisition time mark and the temperature control mark to realize temperature control. The invention can improve the accuracy and stability of temperature control and can be widely applied to the technical field of temperature control.

Description

Temperature control method, device, equipment and medium based on PID algorithm
Technical Field
The invention relates to the technical field of temperature control, in particular to a temperature control method, device, equipment and medium based on a PID algorithm.
Background
The control of constant temperature is always the key of medical examination instrument equipment, but the temperature has the characteristics of strong hysteresis and large inertia, and the temperature control often has the phenomena of high temperature overshoot, frequent temperature fluctuation and large temperature error. The adopted control algorithm is mostly an incremental PID algorithm aiming at the temperature characteristics and the temperature control phenomenon in the market at present.
Although the temperature control is performed by adopting an incremental PID algorithm aiming at the temperature characteristics and the temperature control phenomenon in the prior art, the prior art has some defects or disadvantages:
1. the precision of constant temperature control in the prior art scheme is +/-0.5 ℃, and in some constant temperature instruments with more strict requirements, the precision requirement cannot meet the requirements.
2. In the prior art, an incremental PID algorithm is used, and the incremental PID algorithm has the defects of slower constant temperature speed, more complex operation process and weaker temperature stability.
3. The problem of the incremental PID algorithm is that the incremental PID algorithm has no steady-state control because of no integration effect, the temperature is not controlled by the algorithm when reaching the set temperature, the temperature is easy to change, and the temperature frequently oscillates because of the hysteresis of the temperature. Compared with the position type PID algorithm, the operation complexity of the incremental type PID algorithm is doubled.
Disclosure of Invention
In view of the above, the embodiments of the present invention provide a temperature control method, apparatus, device and medium based on PID algorithm, so as to improve accuracy and stability of temperature control.
One aspect of the present invention provides a temperature control method based on a PID algorithm, including:
acquiring a time mark, and executing the next step when the time mark meets a first preset condition;
acquiring a temperature control mark, and executing the next step when the temperature control mark meets a second preset condition;
performing improved position type PID algorithm operation to obtain a PID control value; wherein the improved position PID algorithm comprises a preset constant value;
and taking the PID control value as a new input temperature, and returning to the step of executing the acquisition time mark and the temperature control mark to realize temperature control.
Optionally, a time stamp is acquired, and when the time stamp meets a first preset condition, a next step is executed, including:
judging whether the time mark meets the calculation period of temperature acquisition, if so, executing the step of acquiring a temperature control mark, and when the temperature control mark meets a second preset condition, acquiring an input temperature value; otherwise, the step of acquiring the time stamp is returned to be executed.
Optionally, the acquiring the temperature control flag, when the temperature control flag meets a second preset condition, executes the following steps, including:
acquiring an address value of a temperature memory;
acquiring a temperature control mark according to the address value of the temperature content;
judging whether the temperature value corresponding to the temperature control mark is in the temperature range of normal operation of the equipment, if so, executing the next step; otherwise, the temperature control process is ended.
Optionally, the performing the improved position PID algorithm operation to obtain a PID control value includes:
detecting a temperature deviation signal;
calculating to obtain a PID control value according to the temperature deviation signal; the PID control value is used for controlling the controlled unit;
the calculation formula of the PID control value is as follows:
wherein K is P Representing a scaling factor; t is the temperature calculation period; ti is an integration constant; td is a differential constant; e (E) k The difference between the collected temperature and the set temperature; e (E) k-1 The difference value between the last acquired temperature and the set temperature; c is a preset constant value.
Optionally, the method further comprises a hardware control step, which comprises:
collecting a temperature value of the heat conduction module through a temperature sensor;
outputting a control value to the relay through a position type PID algorithm;
the relay is used for controlling the heating rod or the Peltier to work;
controlling the temperature of the heat conduction module according to the work of the heating rod or the Peltier;
when the control value is a positive value, the output end of the relay is connected with the forward current input end of the Peltier; and when the control value is a negative value, the output end of the relay is connected with the reverse current input end of the Peltier.
Optionally, the performing the improved position PID algorithm operation to obtain a PID control value includes:
subtracting the current collected temperature from the preset temperature to obtain a temperature difference value;
accumulating the obtained temperature difference values to obtain a temperature deviation sum;
multiplying the temperature difference value by a proportional coefficient to obtain a proportional output value;
determining the ratio of the calculation period to the integration constant as a first value, determining the value of multiplying the proportional coefficient by the first value as a second value, and multiplying the second value by the temperature deviation to obtain an integration output value;
determining the ratio of the differential constant to the calculation period as a third value, determining the value of multiplying the proportional coefficient by the third value as a fourth value, taking the difference of the last two temperature difference values as a fifth value, and multiplying the fourth value by the fifth value to obtain a differential output value;
adding the proportional output value, the integral output value, the differential output value and a preset constant value to obtain a PID output value;
wherein the maximum duration of the PID output value does not exceed the operating time of the heating element.
Another aspect of the embodiments of the present invention provides a temperature control device based on a PID algorithm, including:
the first acquisition module is used for acquiring a time mark, and executing the second acquisition module when the time mark meets a first preset condition;
the second acquisition module is used for acquiring a temperature control mark, and executing the calculation module when the temperature control mark meets a second preset condition;
the calculation module is used for executing the improved position type PID algorithm operation to obtain a PID control value; wherein the improved position PID algorithm comprises a preset constant value;
and the circulation control module is used for taking the PID control value as a new input temperature, and returning to the step of executing the acquisition time mark and the temperature control mark to realize temperature control.
Another aspect of an embodiment of the present invention provides an electronic device, including a processor and a memory;
the memory is used for storing programs;
the processor executes the program to implement the method as described above.
Another aspect of the embodiments of the present invention provides a computer-readable storage medium storing a program that is executed by a processor to implement a method as described above.
Embodiments of the present invention also disclose a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions may be read from a computer-readable storage medium by a processor of a computer device, and executed by the processor, to cause the computer device to perform the foregoing method.
The embodiment of the invention firstly acquires a time mark, and when the time mark meets a first preset condition, the next step is executed; acquiring a temperature control mark, and executing the next step when the temperature control mark meets a second preset condition; performing improved position type PID algorithm operation to obtain a PID control value; wherein the improved position PID algorithm comprises a preset constant value; and taking the PID control value as a new input temperature, and returning to the step of executing the acquisition time mark and the temperature control mark to realize temperature control. The embodiment of the invention can improve the accuracy and stability of temperature control.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart illustrating the overall steps of a temperature control method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of a PID calculation process according to an embodiment of the invention;
fig. 3 is a block diagram of a hardware structure according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
Aiming at the problems existing in the prior art, the embodiment of the invention provides a temperature control method based on a PID algorithm, which comprises the following steps:
acquiring a time mark, and executing the next step when the time mark meets a first preset condition;
acquiring a temperature control mark, and executing the next step when the temperature control mark meets a second preset condition;
performing improved position type PID algorithm operation to obtain a PID control value; wherein the improved position PID algorithm comprises a preset constant value;
and taking the PID control value as a new input temperature, and returning to the step of executing the acquisition time mark and the temperature control mark to realize temperature control.
Optionally, a time stamp is acquired, and when the time stamp meets a first preset condition, a next step is executed, including:
judging whether the time mark meets the calculation period of temperature acquisition, if so, executing the step of acquiring a temperature control mark, and when the temperature control mark meets a second preset condition, acquiring an input temperature value; otherwise, the step of acquiring the time stamp is returned to be executed.
It should be noted that the time mark specifically refers to a period time of temperature control, and is also a period time of acquiring a primary temperature by the temperature control algorithm, so as to determine whether a temperature control period is satisfied, that is, 1000ms is used for performing primary temperature acquisition and formula calculation of the temperature control algorithm; the temperature control mark specifically refers to a switching value of temperature control, and is used for judging whether temperature control is performed, namely, if 0 is the on temperature control, the temperature control is turned off if not 0.
In addition, the time stamp obtaining step comprises the following steps:
1. setting a variable NumFlag to be equal to 0, and adding 1 to the variable NumFlag every 1 ms;
2. setting a variable TempTimeFlag to be equal to 1000, and judging whether the variable NumFlag is greater than or equal to the variable TempTimeFlag;
3. when the variable NumFlag is greater than or equal to the variable TempTimeFlag, the time of a temperature control period is up, so that the variable NumFlag is equal to 0, and the time of each time to 1ms is added with 1; when the variable NumFlag is smaller than the variable TempTimeFlag, the temperature algorithm calculation is not performed;
the temperature control mark is obtained by the following steps:
1. default startup opens temperature control, and a variable TempOpenClose is set to be equal to 0;
2. judging whether the variable TempOpenClose is equal to 0, if so, performing temperature control algorithm calculation and temperature control, and if not, performing temperature control algorithm calculation and temperature control;
3. the value of the variable TempOpenClose may be changed by a key or communication.
Optionally, the acquiring the temperature control flag, when the temperature control flag meets a second preset condition, executes the following steps, including:
acquiring an address value of a temperature memory;
acquiring a temperature control mark according to the address value of the temperature content;
judging whether the temperature value corresponding to the temperature control mark is in the temperature range of normal operation of the equipment, if so, executing the next step; otherwise, the temperature control process is ended.
Optionally, the performing the improved position PID algorithm operation to obtain a PID control value includes:
detecting a temperature deviation signal;
calculating to obtain a PID control value according to the temperature deviation signal; the PID control value is used for controlling the controlled unit;
the calculation formula of the PID control value is as follows:
wherein K is P Representing a scaling factor; t is the temperature calculation period; ti is an integration constant; td is a differential constant; e (E) k The difference between the collected temperature and the set temperature; e (E) k-1 The difference value between the last acquired temperature and the set temperature; c is a preset constant value.
Optionally, the method further comprises a hardware control step, which comprises:
collecting a temperature value of the heat conduction module through a temperature sensor;
outputting a control value to the relay through a position type PID algorithm;
the relay is used for controlling the heating rod or the Peltier to work;
controlling the temperature of the heat conduction module according to the work of the heating rod or the Peltier;
when the control value is a positive value, the output end of the relay is connected with the forward current input end of the Peltier; and when the control value is a negative value, the output end of the relay is connected with the reverse current input end of the Peltier.
Optionally, the performing the improved position PID algorithm operation to obtain a PID control value includes:
subtracting the current collected temperature from the preset temperature to obtain a temperature difference value;
accumulating the obtained temperature difference values to obtain a temperature deviation sum;
multiplying the temperature difference value by a proportional coefficient to obtain a proportional output value;
determining the ratio of the calculation period to the integration constant as a first value, determining the value of multiplying the proportional coefficient by the first value as a second value, and multiplying the second value by the temperature deviation to obtain an integration output value;
determining the ratio of the differential constant to the calculation period as a third value, determining the value of multiplying the proportional coefficient by the third value as a fourth value, taking the difference of the last two temperature difference values as a fifth value, and multiplying the fourth value by the fifth value to obtain a differential output value;
adding the proportional output value, the integral output value, the differential output value and a preset constant value to obtain a PID output value;
wherein the maximum duration of the PID output value does not exceed the operating time of the heating element.
Another aspect of the embodiments of the present invention provides a temperature control device based on a PID algorithm, including:
the first acquisition module is used for acquiring a time mark, and executing the second acquisition module when the time mark meets a first preset condition;
the second acquisition module is used for acquiring a temperature control mark, and executing the calculation module when the temperature control mark meets a second preset condition;
the calculation module is used for executing the improved position type PID algorithm operation to obtain a PID control value; wherein the improved position PID algorithm comprises a preset constant value;
and the circulation control module is used for taking the PID control value as a new input temperature, and returning to the step of executing the acquisition time mark and the temperature control mark to realize temperature control.
Another aspect of an embodiment of the present invention provides an electronic device, including a processor and a memory;
the memory is used for storing programs;
the processor executes the program to implement the method as described above.
Another aspect of the embodiments of the present invention provides a computer-readable storage medium storing a program that is executed by a processor to implement a method as described above.
Embodiments of the present invention also disclose a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions may be read from a computer-readable storage medium by a processor of a computer device, and executed by the processor, to cause the computer device to perform the foregoing method.
The implementation process of the temperature control method of the invention is described in detail below with reference to the accompanying drawings:
aiming at the characteristics of temperature and the temperature control phenomenon, the problems of over-high temperature overshoot, frequent temperature fluctuation, large constant temperature error and the like are prevented, the temperature can be controlled rapidly and stably, the complexity of an algorithm is reduced, and the invention designs an improved position type PID algorithm constant temperature control method; the method takes the STM32 chip module as the core, collects the temperature of the heat conduction module, outputs a control value through an improved position PID algorithm, controls the working time of a heating rod or a Peltier, enables the heat conduction module to achieve the effect of quickly keeping the constant temperature, and has the characteristics of simplicity, rapidness and wide application range.
The invention uses an improved position PID algorithm, the arithmetic operation process can save integral output, and after the temperature of the heat conduction module reaches the set temperature, the temperature can be always acted by the PID algorithm, so that the temperature is kept stable. Meanwhile, the integral output and the proportional output can jointly act, the temperature can reach a constant temperature quickly, and the longer the working time of the instrument is, the more stable the temperature control is.
It should be noted that, the execution flow of the PID algorithm is to detect a deviation signal by feedback, calculate a control amount by the deviation signal, and further control the controlled unit; the PID algorithm is a control algorithm combining three functions of proportion, integration and differentiation, and is the most widely applied control algorithm in control.
Wherein the mathematical ideal model of the PID algorithm is as follows:
the simplified model is PID (output) =p (proportional output) +i (integral output) +d (derivative output); the model is developed as follows:
u (t) in the formula is PID output, K P Is a proportionality coefficient, K I Is an integral coefficient, K D Is a differential coefficient.
The mathematical ideal model of the PID algorithm is that the control unit has an output value under the condition of error, and the output value is 0 when no error exists, and the control unit is uncontrolled, so the improved PID algorithm is that a specific constant value C is added to the control unit, and the improved model is PID (output) =P (proportional output) +I (integral output) +D (differential output) +C (constant); the improved PID algorithm still has an output value which is not zero under the condition that the control unit has no error, so that the control unit is always controlled by the output of the algorithm.
STM 32-based position PID algorithm is discretized by a digital model, and the discretized formula model is as follows:
t is the temperature acquisition period (or calculation period), ti is the integration constant, td is the differentiation constant, ek is the difference between the acquired temperature and the set temperature, ek-1 is the difference between the last acquired temperature and the set temperature.
In addition, the implementation of the algorithm requires the support of hardware, and in the hardware block diagram provided by the embodiment of the invention, an STM32 chip module is connected with a temperature sensor to collect the temperature value of a heat conduction module, then the control value is output to a relay through a position type PID algorithm, and the relay controls a heating rod or Peltier to work so as to control the temperature of the heat conduction module. The output value of the PID is divided into positive and negative values, the experiment sets that the PID controls the relay to connect the forward current of the Peltier (heating) when outputting positive values, and controls the relay to connect the reverse current of the Peltier (refrigerating) when outputting negative values; the heating rod has no refrigeration function, only has the heating function, and can be connected positively and negatively.
Fig. 1 is a flow chart of a position type PID algorithm output control, in which, first, the PID calculation needs to be performed to determine whether the time satisfies the calculation period, the temperature control mark is determined when the time satisfies the calculation period, so as to control whether the PID algorithm is to be calculated, then the temperature value of the temperature sensor collected by the STM32 is obtained, whether the temperature value is within the temperature range of normal operation of the device is determined, if the operating temperature is satisfied, the position type PID calculation process is performed, then the PID control value is output to control the relay, and then the relay controls the operating time of the heating rod or peltier, so as to achieve the effect of controlling the temperature of the heat conduction module. The position PID algorithm mainly works on steady-state control of temperature by integrating the output value, so the more the control flow loops, the more stable the temperature remains in a constant state. The resource optimization point in the control process is that the temperature acquisition period time mark judgment is carried out in the control process, namely, the timer resource of STM32 is not required to be occupied, the expenditure of a chip timer is effectively saved, and the interrupt scheduling is reduced; the temperature judgment mark is arranged in the control process, namely, whether a temperature control algorithm is used or not can be controlled by a program through external communication or keys; in the control process, the temperature is obtained by the memory address value instead of the data signal of the temperature sensor, so that the data parameter transmission time is effectively shortened, and the time consumption of a temperature control algorithm is reduced.
FIG. 2 is a diagram showing the calculation process of the improved position PID algorithm, wherein constant values such as Kp, ti, td, T, C and the like are required to be defined and constant temperature values are required to be set before calculation starts; when the calculation is started, firstly calculating the difference value between the constant temperature and the temperature acquired by the current STM32, then accumulating the calculated difference value, storing the accumulated sum SK for calculating an integral output value, then calculating a proportional output value, and calculating an integral output value and a differential output value; and then adding the proportional, integral, differential and constant C to obtain an output value of the PID, and finally limiting the output value range of the PID, wherein the absolute value of the output value of the PID is equal to the T value when exceeding the T value. The output value of the PID is limited, so that the pulse width modulation mode of the STM32 timer is simulated, and when the relay is controlled by the output value of the PID, the relay can adjust the working time of the heating rod or the Peltier, further adjust the temperature and control the temperature to be constant. Compared with the traditional position type PID algorithm, the innovation of the improved position type PID algorithm is that a constant C value is added, so that the position type PID algorithm can always keep effective control value output. When the equipment reaches a constant temperature target value and is stable in an experiment, the temperature error is within +/-0.2 ℃, and the error value is reduced to the precision value of the temperature sensor along with the increase of the number of operation cycles of the position type PID algorithm.
In summary, compared with the prior art, the present invention has the following advantages:
1. the invention uses an improved position type PID algorithm, the arithmetic operation process of the algorithm can save integral output, and when the arithmetic output is 0, a constant C is added, so that the position type PID algorithm can always keep effective control value output, and a controlled unit is always effectively controlled by the algorithm.
2. And after the temperature of the heat conduction module reaches a constant temperature, a sufficient error signal can be accumulated by using a position PID algorithm, so that the integral output value effectively controls the stable state of the temperature, and the temperature is stably kept at the constant temperature value.
3. The accumulation of error signals can increase the integral output value, and the integral output value and the proportional output value act together to enable the output value of the position PID to be increased rapidly, so that the relay is controlled to work by a heating rod or a Peltier for a long time, the working efficiency is improved, and the time that the temperature reaches a constant temperature is shortened.
4. The time mark judgment is carried out in the control process of the position type PID algorithm, so that the timer resource of the STM32 is not required to be occupied, the cost of a chip timer is effectively saved, the interrupt scheduling is reduced, and the development difficulty is reduced in a stealth manner.
5. The temperature judgment mark is arranged in the control process of the position type PID algorithm, so that the program can control whether to use the temperature control algorithm or not through external communication or keys, and the flexibility of the program is improved.
6. The memory address value is obtained by the temperature in the control process of the position PID algorithm instead of the data signal of the temperature sensor, so that the data transmission time is effectively reduced, and the time consumption of the temperature control algorithm is reduced.
7. The improved position PID algorithm makes the temperature control accuracy smaller.
In some alternative embodiments, the functions/acts noted in the block diagrams may occur out of the order noted in the operational illustrations. For example, two blocks shown in succession may in fact be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved. Furthermore, the embodiments presented and described in the flowcharts of the present invention are provided by way of example in order to provide a more thorough understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed, and in which sub-operations described as part of a larger operation are performed independently.
Furthermore, while the invention is described in the context of functional modules, it should be appreciated that, unless otherwise indicated, one or more of the described functions and/or features may be integrated in a single physical device and/or software module or one or more functions and/or features may be implemented in separate physical devices or software modules. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary to an understanding of the present invention. Rather, the actual implementation of the various functional modules in the apparatus disclosed herein will be apparent to those skilled in the art from consideration of their attributes, functions and internal relationships. Accordingly, one of ordinary skill in the art can implement the invention as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are merely illustrative and are not intended to be limiting upon the scope of the invention, which is to be defined in the appended claims and their full scope of equivalents.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: many changes, modifications, substitutions and variations may be made to the embodiments without departing from the spirit and principles of the invention, the scope of which is defined by the claims and their equivalents.
While the preferred embodiment of the present invention has been described in detail, the present invention is not limited to the embodiments described above, and those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and these equivalent modifications or substitutions are included in the scope of the present invention as defined in the appended claims.

Claims (8)

1. The temperature control method based on the PID algorithm is characterized by comprising the following steps of:
acquiring a time mark, and executing the next step when the time mark meets a first preset condition;
acquiring a temperature control mark, and executing the next step when the temperature control mark meets a second preset condition;
performing improved position type PID algorithm operation to obtain a PID control value; the improved position type PID algorithm comprises a preset constant value, and the PID control value is used for controlling a controlled unit;
taking the PID control value as a new input temperature, and returning to the step of executing the acquisition time mark and the temperature control mark to realize temperature control;
the step of obtaining the temperature control mark, when the temperature control mark meets a second preset condition, executing the next step, including:
acquiring an address value of a temperature memory;
acquiring a temperature control mark according to the address value of the temperature memory;
judging whether the temperature value corresponding to the temperature control mark is in the temperature range of normal operation of the equipment, if so, executing the next step; otherwise, ending the temperature control process; wherein the temperature control process is a constant temperature control process;
the method further comprises a hardware control step comprising:
collecting a temperature value of the heat conduction module through a temperature sensor;
outputting a control value to the relay through a position type PID algorithm;
the relay is used for controlling the heating rod or the Peltier to work;
and controlling the temperature of the heat conduction module according to the work of the heating rod or the Peltier.
2. The method according to claim 1, wherein the step of obtaining a time stamp, when the time stamp satisfies a first preset condition, comprises the steps of:
judging whether the time mark meets the calculation period of temperature acquisition, if so, executing the step of acquiring a temperature control mark, and when the temperature control mark meets a second preset condition, acquiring an input temperature value; otherwise, the step of acquiring the time stamp is returned to be executed.
3. The method according to claim 1, wherein the performing the improved position PID algorithm operation to obtain the PID control value comprises:
detecting a temperature deviation signal;
calculating to obtain a PID control value according to the temperature deviation signal;
the calculation formula of the PID control value is as follows:
wherein K is P Representing a scaling factor; t is the temperature calculation period; ti is an integration constant; td is a differential constant; e (E) k The difference between the collected temperature and the set temperature; e (E) k-1 The difference value between the last acquired temperature and the set temperature; c is a preset constant value.
4. A temperature control method based on a PID algorithm as claimed in claim 1, wherein,
when the control value is positive, the output end of the relay is connected with the forward current input end of the Peltier; and when the control value is a negative value, the output end of the relay is connected with the reverse current input end of the Peltier.
5. The method according to claim 1, wherein the performing the improved position PID algorithm operation to obtain the PID control value comprises:
subtracting the current collected temperature from the preset temperature to obtain a temperature difference value;
accumulating the obtained temperature difference values to obtain a temperature deviation sum;
multiplying the temperature difference value by a proportional coefficient to obtain a proportional output value;
determining the ratio of the calculation period to the integration constant as a first value, determining the value of multiplying the proportional coefficient by the first value as a second value, and multiplying the second value by the temperature deviation to obtain an integration output value;
determining the ratio of the differential constant to the calculation period as a third value, determining the value of multiplying the proportional coefficient by the third value as a fourth value, taking the difference of the last two temperature difference values as a fifth value, and multiplying the fourth value by the fifth value to obtain a differential output value;
adding the proportional output value, the integral output value, the differential output value and a preset constant value to obtain a PID output value;
wherein the maximum duration of the PID output value does not exceed the operating time of the heating element.
6. A PID algorithm-based temperature control apparatus, comprising:
the first acquisition module is used for acquiring a time mark, and executing the second acquisition module when the time mark meets a first preset condition;
the second acquisition module is used for acquiring a temperature control mark, and executing the calculation module when the temperature control mark meets a second preset condition;
the calculation module is used for executing the improved position type PID algorithm operation to obtain a PID control value; the improved position type PID algorithm comprises a preset constant value, and the PID control value is used for controlling a controlled unit;
the circulation control module is used for taking the PID control value as a new input temperature, and returning to the step of executing the acquisition time mark and the temperature control mark to realize temperature control;
the second obtaining module is specifically configured to: acquiring an address value of a temperature memory; acquiring a temperature control mark according to the address value of the temperature memory; judging whether the temperature value corresponding to the temperature control mark is in the temperature range of normal operation of the equipment, if so, executing the next step; otherwise, ending the temperature control process; wherein the temperature control process is a constant temperature control process;
the device is also for: collecting a temperature value of the heat conduction module through a temperature sensor; outputting a control value to the relay through a position type PID algorithm; the relay is used for controlling the heating rod or the Peltier to work; and controlling the temperature of the heat conduction module according to the work of the heating rod or the Peltier.
7. An electronic device comprising a processor and a memory;
the memory is used for storing programs;
the processor executing the program to implement the method of any one of claims 1-5.
8. A computer readable storage medium, characterized in that the storage medium stores a program, which is executed by a processor to implement the method of any one of claims 1-5.
CN202110290467.4A 2021-03-18 2021-03-18 Temperature control method, device, equipment and medium based on PID algorithm Active CN113156806B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110290467.4A CN113156806B (en) 2021-03-18 2021-03-18 Temperature control method, device, equipment and medium based on PID algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110290467.4A CN113156806B (en) 2021-03-18 2021-03-18 Temperature control method, device, equipment and medium based on PID algorithm

Publications (2)

Publication Number Publication Date
CN113156806A CN113156806A (en) 2021-07-23
CN113156806B true CN113156806B (en) 2024-03-22

Family

ID=76887654

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110290467.4A Active CN113156806B (en) 2021-03-18 2021-03-18 Temperature control method, device, equipment and medium based on PID algorithm

Country Status (1)

Country Link
CN (1) CN113156806B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117193430B (en) * 2023-10-11 2024-05-24 深圳市顾美科技有限公司 PID temperature control method, equipment and storage medium based on PLC

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2029611A1 (en) * 1989-12-04 1991-06-05 Bruce A. Flora Heating device with a phase change temperature controller
CN101254063A (en) * 2008-01-23 2008-09-03 王洪波 Electrothermal blanket
CN101295186A (en) * 2007-04-27 2008-10-29 东京毅力科创株式会社 Temperature control device
CN101380601A (en) * 2007-09-05 2009-03-11 中国科学院半导体研究所 Thermostatic device and control method thereof
CN103576711A (en) * 2013-11-14 2014-02-12 上海交通大学 Chemical reactor temperature control method based on quantification single-parameter PID control
CN105115020A (en) * 2015-09-14 2015-12-02 中山市科力高自动化设备有限公司 Heating floor
CN105494681A (en) * 2015-12-16 2016-04-20 西北农林科技大学 Domestic ohmic heating bean curd making machine with controllable heating speed and heat preservation
CN105799457A (en) * 2016-04-29 2016-07-27 安徽江淮汽车股份有限公司 Control method and system for electric heater
CN106225363A (en) * 2016-08-23 2016-12-14 烟台荏原空调设备有限公司 The control method of fridge cold water outlet temperature and device
CN109430154A (en) * 2018-12-05 2019-03-08 航之境电子产品(天津)有限公司 A kind of temperature control device for aquarium heating
CN110209217A (en) * 2018-09-28 2019-09-06 华帝股份有限公司 Method for controlling temperature of steam box based on irregular period PID

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2029611A1 (en) * 1989-12-04 1991-06-05 Bruce A. Flora Heating device with a phase change temperature controller
CN101295186A (en) * 2007-04-27 2008-10-29 东京毅力科创株式会社 Temperature control device
CN101380601A (en) * 2007-09-05 2009-03-11 中国科学院半导体研究所 Thermostatic device and control method thereof
CN101254063A (en) * 2008-01-23 2008-09-03 王洪波 Electrothermal blanket
CN103576711A (en) * 2013-11-14 2014-02-12 上海交通大学 Chemical reactor temperature control method based on quantification single-parameter PID control
CN105115020A (en) * 2015-09-14 2015-12-02 中山市科力高自动化设备有限公司 Heating floor
CN105494681A (en) * 2015-12-16 2016-04-20 西北农林科技大学 Domestic ohmic heating bean curd making machine with controllable heating speed and heat preservation
CN105799457A (en) * 2016-04-29 2016-07-27 安徽江淮汽车股份有限公司 Control method and system for electric heater
CN106225363A (en) * 2016-08-23 2016-12-14 烟台荏原空调设备有限公司 The control method of fridge cold water outlet temperature and device
CN110209217A (en) * 2018-09-28 2019-09-06 华帝股份有限公司 Method for controlling temperature of steam box based on irregular period PID
CN109430154A (en) * 2018-12-05 2019-03-08 航之境电子产品(天津)有限公司 A kind of temperature control device for aquarium heating

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
龙顺宇等. 单片机原理及实践应用.北京工业出版社,2019,24-25. *

Also Published As

Publication number Publication date
CN113156806A (en) 2021-07-23

Similar Documents

Publication Publication Date Title
Berner et al. Asymmetric relay autotuning–Practical features for industrial use
CN113156806B (en) Temperature control method, device, equipment and medium based on PID algorithm
Hackl High-gain adaptive position control
CN106169897B (en) A kind of real-time anti-saturation PID control method of motor speed and device
BR102013010981B1 (en) METHOD AND MODULE FOR MEASURING THE CHANGE RATE OF FREQUENCY FROM A WAVE FORM AND METHOD OF CONTROL OF AN AEROGENERATOR CONVERTER UNIT
CN105008936B (en) Low-power and dynamic divider and monitoring circuit
JP6523854B2 (en) Optimal control device, optimal control method, computer program and optimal control system
CN101551595A (en) Temperature control method for projection objective of photoetching machine
CN101769800A (en) High-precision temperature checking method and instrument based on ARM
CN103454915B (en) The method and apparatus that adaptive location for the adjusting apparatus of execution position transmitter is adjusted
TW202013134A (en) Load line compensation in power monitoring
CN104422499A (en) Calibration method and device for flow sensor of medical instrument
CN106773652A (en) A kind of PID systems and its parameter automatic adjusting method
EP2633379B1 (en) Control circuit and method for controlling rotary speed, data processing device, and program code
US20160266819A1 (en) Method for determining operation coniditions for a selected lifetime of a semiconductor device
Somasundaram et al. CDM-based two degree of freedom PI controller tuning rules for stable and unstable FOPTD processes and pure integrating processes with time delay
CN116611254A (en) Wall thermal resistance determination method and device based on reaction coefficient and electronic equipment
CN116539999A (en) Online measurement method and device for electromagnetic bearing electromagnet electrical parameters of main helium blower
CN106774745A (en) Server fan rotating property test rotation speed of the fan changing method and control system
US9797762B2 (en) Controlling device
CN111835250B (en) 1/2 power finite value attraction repetitive control method for servo motor driving system
CN109870311A (en) The step steering angle input test method and system of automobile turning wheel
CN203366157U (en) Fuzzy PID (Proportion Integration Differentiation) control water temperature adjustment system
US7930147B2 (en) Sensor response time accelerator
CN113126679A (en) Electric energy metering verification environment control method and system based on reinforcement learning

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant