Portal for car enthusiasts

proportional coefficient. What is a pid controller

Since the number of combinations of the three parameters provided for adjusting the controls is quite large, over time many techniques have been developed to facilitate their correct setting. Some of them require a certain destabilization of the technological process, which is often unacceptable in practice. The purpose of this article is to offer a number of simple rules for adjusting regulators that allow you to perform this work with minimal deviations from the regime parameters.
The basic rule is that the controller should be set according to the process. If the process is very fast (eg in a flow circuit), the controller should also be set to respond quickly. The response speed of the controller is determined by the integral time (integral term) and not by the proportional band (gain). Incorrect use of these parameters greatly reduces the effectiveness of the tuning controls. When the process speed is slow (for example, when controlling the temperature on the plate at the top of the distillation column), the regulator should be set to respond slowly ACCORDING TO THE PROCESS. If you do not have information about the characteristics of the process and there is no one to turn to for clarification, you should entrust the adjustment of the regulators to a specialist who can obtain the necessary information.

General rules for standard control loops

Consumption

Typically, more than half of the control loops in a plant are flow control loops. Set the integral term (I) to 0.1 minutes. Adjust the proportional band to prevent excessive noise in the measurement results (usually about 300%, although in some cases, if the flowmeter assembly is not installed correctly, the required value can reach 1000%). The proportional band setting for a circuit that uses a valve positioner is two to three times the value for a circuit without a valve positioner. Slow-acting or sticking control valves may require a setting of 0.2 or 0.3 minutes, but these are usually the exception. If these settings do not work, check the installation of the valve and primary element to determine if there is a problem. Troubleshoot. Do not set the controller to an unacceptable integral value, such as 10 minutes. If you think 10 minutes of integral time is required, use a manual regulator or manual valve.
Note: Regulators will not function properly if the valve or other final control element is nearly fully closed or nearly fully open. You should not adjust the regulators under these conditions. Have the operator open or close the bypass (if there is a bypass), or wait until the process changes enough to bring the valve back within operating range. Operating range limits are 5 to 95% of travel, with a safer range of 10 to 90%. Derivative action should not be used for flow control loops.

Level

Next to the flow loop, the most common control loop is the level loop. do not use small values ​​of the integral component in the level control loop. Using this value, the circuit will cycle non-stop, often with a period (peak of one cycle to peak of the next cycle) of 10 to 15 minutes. This period is inversely proportional to the integral time. Set the integral time to 10 minutes. This setting will be acceptable for 80 - 90% level controls. If the device time constant (volume/flow rate) is between 1 and 2 minutes, a shorter integral time can be used, but remember that a longer time is more reliable. With a large volume of apparatus and low flow, a longer integral time should be used.
If level accuracy is important, use the smallest proportional band (10% - 50%) that does not cycle. If smooth downstream flow is more important than tight level control, use a wider proportional band (100 - 200%). Do not use the effect of the differential component in the level control loop. However, there are few exceptions. In very rare cases, a small differential term is used to compensate for level control valves with significant hysteresis. Level noise causes valve judder, which can result in smoother control. A better solution is to install a positioner or, even better, a flow controller in cascade with a level controller.
In level circuits, if a regulator controls a valve without a positioner, there is often a limit cycle. The limit cycle chart has a sawtooth shape, sometimes with flat bottoms and/or tops. Monitoring the output signal during the limit cycle shows a change of approximately 5%. It is almost impossible to eliminate such a limit cycle by tuning. The setting leads to a change in the frequency of the cycle, but does not affect its amplitude. If the valve is controlled within the operating range, then this problem can only be eliminated by installing a positioner or by cascading the level with the flow.
If the level is controlled by the flow rate of the product sent to the storage park, then, as a rule, cycling does not matter. If we are talking about irrigation in a distillation column, cycling, as a rule, is unacceptable. It should be noted that cycling the valve in an almost fully closed or almost fully open position results in a limit cycle, typically with a flat bottom if the valve is almost closed or a flat top if the valve is almost fully open.

Fluid pressure

The setting is carried out in the same way as the flow circuits. Noise may not be as intense as with flow control, and proportional band values ​​will generally be smaller.

Gas pressure

Tuning is done in the same way as the level loops, using a high integral value. A proportional-only controller provides adequate control, but with a certain change in the setpoint depending on the process condition due to the proportional deviation. Since the proportional band can typically be very small (less than 100% and often around 5 to 20%), this deviation will be negligible.
Having adjusted more than 80% of the circuits of a standard installation, we move on to more difficult to regulate circuits, namely: temperature, vapor pressure and composition. This also includes the temperature, on the basis of which the composition of the medium in many distillation columns is determined.

Hard-to-adjust contours

There are two ways to tune hard-to-adjust loops. The first way is to use safe initial settings: proportional band 100%, integral time 5 - 10 minutes, no derivative. Switch the controller to automatic mode when the measurement is close to the required set point.
When cyclic fluctuations occur, determine the time from one peak to the next (high to high or low to low). This is the period of the control loop. If the deviation of each peak from the setpoint is greater than the deviation of the previous peak, increase the proportional band (two, three or more times) until the amplitude increase in the cycle stops.
If the original integral time is less than half a cycle, it is too short, possibly causing cycling. Increase the integral time. As the integral time increases, the period should decrease. If the period is approximately twice the integral time and the oscillations are damped, this means that the work is almost completely finished. In the absence of measurement interference, the differential term should be set to a quarter of the integral time. Wait for the parameters to change or ask the operator to slightly adjust the setpoint in a safe direction. Re-tune the proportional band to provide acceptable damping after exiting the mode. Repeat these steps until you get a normal loop response.
Check the circuit for several hours to make sure it is working properly. Some circuits are stable with small changes in parameters, but begin to oscillate with large changes. Increase the proportional band, if necessary, to keep the loop stable when there are large deviations from the setpoint.
If this quick fix doesn't work for you, or if you want to be more methodical, follow the steps below. It works in all cases and leaves no doubt about the characteristics of the control loop.

Standard Method for Adjusting Knobs

1. Switch the regulator to manual operation when the process is sufficiently stable and no sudden deviations from the setpoint are expected on the installation. Set D (Deviation Derivative or Derivative for some controllers) to minimum and I (Integral Time or Integral for some controllers) to maximum.
2. First, select a setpoint equal to the measured value and set the proportional band (P) to 100% (or gain to 1.0 for some controls). Slightly change the output signal and switch the regulator to automatic mode. Record the original valve position in case you need to return to it during setup.
3. If there are no fluctuations, repeat step 2, reducing the proportional band (perhaps to half the original value). Keep decreasing the proportional band until oscillation begins. If oscillations with increasing amplitude occur on the first attempt, return the regulator to manual mode and set the valve to the original position recorded in step 2. Double the proportional band and repeat attempts until you get uniform or almost uniform oscillations. Measure the period (defined as the time to complete one complete cycle)
4. For PI controller:
Set I = period x 0.82.

The period will increase by approximately 43%. Each peak should be about half the amplitude of the previous peak. This is called a quarter-amplitude damping.

5. For PID controller:
Set I = period x 0.5.
Set D = period x 0.125.
Double the proportional band.
The period will decrease by about 15%.
Re-tune the proportional band if more or less damping is needed.
6. Remember that high I values ​​and small D values ​​are safe. These instructions are for regulators set in minutes per repeat. Some manufacturers use the inverse relationship of I and D, with the largest value corresponding to the smallest and vice versa.
7. With noisy measurement results (this applies in particular to Ph circuits), the use of a differential component is usually not possible. Never set the derivative term to be larger than the integral term.

Cascading and other types of interaction of control loops

First tune the secondary circuit (i.e. flow) in local setpoint mode. Reduce the integral term to the minimum allowed value. Switch the secondary circuit to remote setpoint operation and perform the primary circuit (i.e. level) adjustment. The value of the integral component of the primary regulator must not be less than the value of the integral component of the secondary regulator multiplied by 4. The same rules apply to circuits interacting through the process.
An example of such interaction through the process is a column pressure loop and a pressure compensated temperature loop used to control a distillation column. Set the pressure loop (which is the fastest loop in this example) to the minimum integral time and then set the temperature controller integral time to at least 4 times the integral time of the pressure loop. To check the interaction of these two circuits when they are cycled with the same period, transfer one of the circuits to manual mode. The termination of the cycle indicates the possible presence of a problem caused by the interaction. Move the contours or use the technique described above to minimize oscillations.

You can familiarize yourself with additional materials on tuning PID controllers.

You can learn more about regulators and algorithms for the operation of regulators.

To consolidate the acquired knowledge, we suggest you use the program for simulating control loops

Simple Discrete PID Controller Algorithm

Supported by all AVR microcontrollers

PID function uses 534 bytes of flash memory and 877 processor cycles (IAR - low size optimization)

1. Introduction

This manual describes a simple implementation of a discrete proportional-integral-derivative (PID) controller.

When working with applications where the output signal of the system must change in accordance with the reference value, a control algorithm is required. Examples of such applications are an engine control unit, a control unit for temperature, pressure, fluid flow, speed, force, or other variables. The PID controller can be used to control any measured variable.


Many solutions have been used in the field of control for a long time, but PID controllers can become the "industry standard" due to their simplicity and good performance.

For more information on PID controllers and their applications, the reader should refer to other sources such as PID Controllers by K. J. Astrom & T. Hagglund (1995)

Figure 1-1. Typical responses of a PID controller to a step change in the reference signal

2. PID controller

Figure 2-1 shows a diagram of a system with a PID controller. The PID controller compares the measured process value Y with a given reference value Y0. The difference, or error, E, is then processed to calculate a new input process, U. This new input process will attempt to bring the value of the measured process closer to the specified value.

An alternative to a closed loop control system is an open loop control system. An open control loop (without feedback) is not satisfactory in many cases, and its application is often impossible due to the properties of the system.

Figure 2-1. PID closed loop control system

Unlike simple control algorithms, a PID controller is able to control a process based on its history and rate of change. This gives a more accurate and stable control method.

The main idea is that the controller receives information about the state of the system using a sensor. It then subtracts the measured value from the reference value to calculate the error. The error will be handled in three ways: handle the present time by the proportional term, go back to the past using the integral term, and anticipate the future using the differential term.

Figure 2-2 shows the circuit diagram of a PID controller, where Tp, Ti, and Td are the proportional, integral, and derivative time constants, respectively.

Figure 2-2. PID Controller Diagram

2.1 Proportional

The proportional term (P) gives a control signal proportional to the calculated error. Using only one proportional control always gives a stationary error, except when the control signal is zero and the value of the system process is equal to the required value. On fig. 2-3, a stationary error in the value of the system process appears after a change in the reference signal (ref). Using too large a P-term will give an unstable system.

Figure 2-3. P controller response to a step change in the reference signal

2.2 Integral term

The integral component (I) represents the previous errors. The summation of the error will continue until the value of the system process becomes equal to the desired value. Usually, the integral component is used together with the proportional component, in the so-called PI controllers. Using only the integral component gives a slow response and often an oscillating system. Figure 2-4 shows the step response of the I and PI controllers. As you can see, the response of the PI controller has no stationary error, and the response of the I controller is very slow.

Figure 2-4. The response of the I- and PI controller to a step change in the controlled value

2.3 Derivative term

The differential term (D) is the rate of change of the error. The addition of this component improves the response of the system to a sudden change in its state. The differential term D is usually used with P or PI algorithms, like PD or PID controllers. A large differential component D usually gives an unstable system. Figure 2-5 shows the responses of the D and PD controller. The response of the PD controller gives a faster increase in process value than the P controller. Note that the differential term D behaves essentially like a high-pass filter for the error signal and thus easily makes the system unstable and more susceptible to noise.

Figure 2-5. Response of the D- and PD-controller to a step change in the reference signal

The PID controller gives the best performance because it uses all the components together. Figure 2-6 compares P, PI, and PID controllers. PI improves P by removing the stationary error, and PID improves PI with faster response.

Figure 2-6. P-, PI-, and PID controller response to a step change in the reference signal

2.4. Settings

The best way to find the required parameters of the PID algorithm is to use a mathematical model of the system. However, often there is no detailed mathematical description of the system and the settings of the PID controller parameters can only be made experimentally. Finding parameters for a PID controller can be a daunting task. Here, data on the properties of the system and various conditions of its operation are of great importance. Some processes should not allow the process variable to overshoot from the setpoint. Other processes should minimize energy consumption. Also the most important requirement is stability. The process should not fluctuate under any circumstances. In addition, stabilization must occur within a certain time.

There are some methods for tuning the PID controller. The choice of method will depend largely on whether the process can be offline for tuning or not. The Ziegler-Nichols method is a well-known non-offline tuning method. The first step in this method is to set the I and D gains to zero, increasing the P gain to a steady and stable oscillation (as close as possible). Then the critical gain Kc and the oscillation period Pc are recorded and the P, I and D values ​​are corrected using Table 2-1.

Table 2-1. Calculation of parameters according to the Ziegler-Nichols method

Further parameter tuning is often necessary to optimize the performance of a PID controller. The reader should note that there are systems where a PID controller will not work. These can be non-linear systems, but in general, problems often arise with PID control when the systems are unstable and the effect of the input signal depends on the state of the system.

2.5. Discrete PID controller

The discrete PID controller will read the error, calculate and output the control signal for the sampling time T. The sampling time must be less than the smallest time constant in the system.

2.5.1. Description of the algorithm

Unlike simple control algorithms, the PID controller is able to manipulate the control signal based on the history and rate of change of the measured signal. This gives a more accurate and stable control method.

Figure 2-2 shows the circuit design of the PID controller, where Tp, Ti, and Td are the proportional, integral, and derivative time constants, respectively.

The transfer function of the system shown in Figure 2-2 is:

We approximate the integral and differential components to obtain a discrete form

To avoid this change in the reference process value making any unwanted fast change on the control input, the controller improve based on the derived term on the process values ​​only:


3. Implementation of a PID controller in C

A working C application is attached to this document. A full description of the source code and compilation information can be found in the "readme.html" file.

Figure 3-1. Demo Application Flowchart

Figure 3-1 shows a simplified diagram of the demo application.

The PID controller uses a structure to store its status and parameters. This structure is initialized by the main function, and only a pointer to it is passed to the Init_PID() and PID() functions.

The PID() function must be called for every time interval T, this is set by a timer that sets the PID_timer flag when the sample time has passed. When the PID_timer flag is set, the main program reads the process reference value and the process system value, calls the PID() function, and outputs the result to the control input.

To increase the accuracy, p_factor, i_factor and d_factor are increased by 128 times. The result of the PID algorithm is later reduced by dividing by 128. The value of 128 is used to provide a compilation optimization.

In addition, the influence of Ifactor and Dfactor will depend on the time T.

3.1. Integral windup

When the input process, U, reaches a high enough value, it becomes bounded. Either by the internal numerical range of the PID controller, or by the output range of the controller, or suppressed in the amplifiers. This will happen if there is a big enough difference between the measured value and the reference value, usually because the process has more disturbances than the system is able to handle.

If the controller uses an integral term, this situation can be problematic. In such a situation, the integral term will constantly add up, but in the absence of large violations, the PID controller will begin to compensate the process until the integral sum returns to normal.

This problem can be solved in several ways. In this example, the maximum integral sum is limited and cannot be greater than MAX_I_TERM. The correct size of MAX_I_TERM will depend on the system.

4. Further development

The PID controller presented here is a simplified example. The controller should work well, but some applications may require the controller to be even more reliable. It may be necessary to add a saturation correction in the integral term, based on the proportional term on the process value only.

In the calculation of Ifactor and Dfactor, the sampling time T is part of the equation. If the sampling time T used is much less than or greater than 1 second, the accuracy of either Ifactor or Dfactor will be insufficient. It is possible to rewrite the PID and scaling algorithm so that the accuracy of the integral and differential terms is preserved.

5. Reference literature

K. J. Astrom & T. Hagglund, 1995: PID Controllers: Theory, Design, and Tuning.
International Society for Measurement and Con.

6. Files

AVR221.rar

Translated by Kirill Vladimirov at the request

You can significantly improve the accuracy of regulation by applying the PID law (Proportional-Integral-Differential regulation law).
To implement the PID law, three main variables are used:
P – proportional band, %;
I – integration time, s;
D is the differentiation time, s.
Manual tuning of the PID controller (determining the values ​​of the parameters P, I, D), which provides the required quality of regulation, is rather complicated and is rarely used in practice. The UT/UP series PID controllers provide automatic tuning of PID parameters for a specific control process, while maintaining the possibility of manual adjustment.

Proportional
In the proportional band, determined by the coefficient P, the control signal will change in proportion to the difference between the setpoint and the actual value of the parameter (mismatch):

control signal = 100/P E,

where E is the mismatch.
The coefficient of proportionality (gain) K is inversely proportional to P:

The proportional band is defined with respect to the set control setpoint, and within this band the control signal changes from 0 to 100%, i.e. if the actual value and the setpoint are equal, the output signal will have a value of 50%.

where P is the proportional band;
ST - regulation set point.
For example:
measurement range 0…1000 °С;
control set point ST = 500 °С;
proportional band P = 5%, which is 50 °C (5% of 1000 °C);
at a temperature value of 475 °C and below, the control signal will have a value of 100%; at 525 °C and above - 0%. In the range of 475…525 °C (in the proportional band), the control signal will change in proportion to the mismatch value with a gain K = 100/P = 20.
Reducing the value of the proportional band P increases the controller's response to mismatch, i.e., a small mismatch will correspond to a larger value of the control signal. But at the same time, due to the large gain, the process takes on an oscillatory character around the setpoint value, and precise control cannot be achieved. With an excessive increase in the proportional band, the controller will react too slowly to the resulting mismatch and will not be able to keep track of the process dynamics. In order to compensate for these disadvantages of proportional control, an additional time characteristic is introduced - the integral component.

integral component
It is determined by the integration time constant I, is a function of time and provides a change in the gain (shift of the proportional band) over a given period of time.


control signal = 100/P E + 1/I ∫ E dt.

As can be seen from the figure, if the proportional component of the control law does not provide a decrease in the mismatch, then the integral component begins to gradually increase the gain over the time period I. After a period of time I, this process is repeated. If the mismatch is small (or rapidly decreases), then the gain does not increase and, if the value of the parameter is equal to the specified setting, takes some minimum value. In this regard, the integral component is referred to as the automatic control shutdown function. In the case of PID control, the step response of the process will be fluctuations that gradually decay towards the setpoint.

Derivative term
Many control objects are sufficiently inertial, i.e. they have a delay in response to the applied action (dead time) and continue to respond after the control action is removed (delay time). PID controllers on such objects will always be late with turning on/off the control signal. To eliminate this effect, a differential component is introduced, which is determined by the differentiation time constant D, and full implementation of the PID control law is provided. The differential component is the time derivative of the mismatch, i.e. it is a function of the rate of change of the control parameter. In the case when the mismatch becomes a constant value, the differential component ceases to affect the control signal.

control signal = 100/P E + 1/I ∫ E dt + D d/dt E.

With the introduction of the differential component, the controller begins to take into account dead time and delay time, changing the control signal in advance. This makes it possible to significantly reduce fluctuations of the process around the setpoint value and to achieve a faster completion of the transient.
Thus, when generating a control signal, PID controllers take into account the characteristics of the control object itself, i.e. analyze the mismatch for the magnitude, duration and rate of change. In other words, the PID controller "anticipates" the reaction of the regulated object to the control signal and begins to change the control action not when the setpoint value is reached, but in advance.

5. The transfer function of which link is represented: K (p) \u003d K / Tr

Before calculating the parameters of the controller, it is necessary to formulate the goal and criteria for the quality of regulation, as well as restrictions on the magnitude and rate of change of variables in the system. Traditionally, the main quality indicators are formulated based on the requirements for the form of the response of a closed system to a step change in the setpoint. However, this criterion is very limited. In particular, it does not say anything about the amount of attenuation of measurement noise or the influence of external disturbances; it can give an erroneous idea of ​​the robustness of the system.

Therefore, to fully describe or test a system with a PID controller, a number of additional quality indicators are needed, which will be discussed below.

In the general case, the choice of quality indicators cannot be completely formalized and must be carried out based on the meaning of the problem being solved.

5.5.1. Regulatory quality

The choice of control quality criterion depends on the purpose for which the regulator is used. Such a goal could be:

  • maintaining a constant value of a parameter (for example, temperature);
  • setpoint change tracking or software control;
  • damper control in a liquid tank, etc.

For a particular task, the following factors may be most important:

  • form of response to an external disturbance (settling time, overshoot, attenuation coefficient, etc.);
  • form of response to measurement noise;
  • form of response to the setpoint signal;
  • robustness with respect to the spread of the parameters of the control object;
  • requirements for energy savings in a controlled system;
  • minimum measurement noise, etc.

For a classic PID controller, the parameters that are best for monitoring the setpoint are generally different from the parameters that are best for attenuating the influence of external disturbances. In order for both parameters to be optimal at the same time, it is necessary to use PID controllers with two degrees of freedom (see section "Open loop control principle").

For example, accurate tracking of setpoint changes is necessary in motion control systems, in robotics. In process control systems, where the setpoint usually remains unchanged for a long time, maximum attenuation of the influence of the load (external disturbances) is required. Liquid reservoir control systems require laminar flow (minimizing the dispersion of the controller output variable).

Weakening the influence of external disturbances

As was shown in the "Stability margin and robustness" section, feedback weakens the influence of external disturbances by a factor of 1, except for those frequencies at which . External perturbations can be applied to an object in many different parts of it, however, when the specific location is unknown, the perturbation is considered to act on the input of the object. In this case, the response of the system to external disturbances is determined by the transfer function (see (5.42))

Thus, to weaken the influence of external disturbances (in particular, the influence of the load), it is possible to reduce the integration constant .

In the time domain, the response to external disturbances is estimated from the response to a single jump (see Fig. 5.56).

Reducing the effect of measurement noise

The transfer function from the noise application point (Fig. 5.35) to the system output has the form (see (5.42)):

.

Due to the decrease in the frequency response of the object at high frequencies, the sensitivity function tends to 1 (see Fig. 5.81). Therefore, it is impossible to reduce the effect of measurement noise using feedback. However, these noises are easily eliminated by using low-pass filters, as well as proper shielding and grounding [Denisenko, Denisenko].

Robustness to variation of object parameters

The closed system remains stable when the object parameters change by the value , if the condition (5.100) is satisfied.

Quality criteria in the time domain

To assess the quality of regulation in a closed system with a PID controller, a stepwise input action and a number of criteria are usually used to describe the form of the transient process (Fig. 5.84):

For motion control systems, the ramp function is more often used as a test signal than the jump function, since electromechanical systems usually have a limited slew rate of the output value.

The above criteria are used both to assess the quality of the response to a change in the setpoint, and to the influence of external disturbances and measurement noise.

Frequency quality criteria

In the frequency domain, the following criteria are commonly used, derived from the closed-loop frequency response plot (see Figure 5.85):

The frequency criteria for real controllers cannot be unambiguously related to the time criteria due to non-linearities (usually these are constraint-type non-linearities) and algorithms for eliminating the integral saturation effect. However, approximately the following relationships between the criteria in the frequency and time domains can be established:

5.5.2. Selection of controller parameters

In the general theory of automatic control, the structure of the controller is selected based on the model of the control object. In this case, more complex control objects correspond to more complex controllers. In our case, the controller structure is already set - we are considering a PID controller, and this structure is very simple. Therefore, a PID controller may not always give good control quality, although PID controllers are used in the vast majority of applications in industry.

For the first time, a method for calculating the parameters of PID controllers was proposed by Ziegler and Nichols in 1942 [Ziegler]. This technique is very simple and does not give very good results. However, it is still often used in practice, although since then many more accurate methods have appeared.

After calculating the parameters of the controller, it usually requires manual adjustment to improve the quality of regulation. For this, a number of rules are used that are well substantiated theoretically.

General methods of automatic control theory, such as the pole assignment method and algebraic methods, can also be used to tune PID controllers. Numerous other methods have been published in the literature that have advantages in specific applications. We list below only the most common of them.

The CHR method uses an object approximation by a first order model with a delay (5.5).

  • an increase in the proportional coefficient increases the speed and reduces the margin of stability;
  • with a decrease in the integral component, the control error decreases faster over time;
  • decrease in the constant of integration reduces the margin of stability;
  • an increase in the differential component increases the margin of stability and speed.

The listed rules also apply to regulators using expert systems and fuzzy logic methods.

Manual tuning using rules is conveniently performed using interactive software on a computer temporarily included in the control loop. To assess the response of the system to a change in the setpoint, external influences or measurement noise, artificial influences are applied and the response to them is observed. After tuning, the values ​​of the coefficients of the controller are recorded in the memory of the PID controller, and the computer is removed.

Note that the application of the rules is possible only after preliminary adjustment of the controller by formulas. Attempts to tune the controller without an initial approximation of the coefficients may be unsuccessful. The rules formulated above are valid only in the vicinity of the optimal controller setting. Away from it, the effects may be different, see section "Classic PID controller"

When adjusting thermal processes, setting according to the rules can take an unacceptably long time.

5.5.4. Optimization methods

Optimization methods for finding controller parameters are conceptually very simple and similar to numerical methods for identifying object parameters (see the section "Methods for minimizing the criterion function"). A minimization criterion is selected, which can be one of the quality indicators or a complex criterion composed of several indicators with different weight coefficients. Restrictions imposed by the robustness requirements are added to the criterion. In this way, a criterion function is obtained that depends on the parameters of the PID controller. Further, numerical methods are used to minimize the criterion function with given constraints, which allow us to find the desired parameters of the PID controller.

Optimization-based methods have the following advantages:

  • allow to obtain the optimal values ​​of the parameters that do not require further adjustment;
  • do not require simplification of the object model, the model can be arbitrarily complex;
  • allow you to quickly achieve the final result (to avoid the procedure of lengthy adjustment of parameters).

However, the implementation of this approach is associated with big problems, which have been the subjects of scientific research for decades. These issues include:

  • low reliability of the method (in many cases, the computational process may diverge and the required coefficients will not be found);
  • low minimum search speed for gully functions and functions with several minima.

Nevertheless, optimization methods are a powerful tool for tuning PID controllers using specially designed computer programs (see section

I took a year ago from another link for more than 50 dollars, but there is a kit with another, more sophisticated thermal controller. Therefore, I give a link to another lot with a seemingly normal seller and a lot of orders.
It was taken for completely different purposes, but it turned out to be attached to a kitchen electric oven :) It works great in this application :)
More details under the cut.

A year ago, I ordered a set of two thermal controllers for my soldering oven - one overlooked and the second much more functional. For some reason, I had a stupid idea to use them together, but when I already received the order, I sharply wised up and this relatively simple thermal controller was no longer my destiny.
So what can this thermostat do? The most important thing, of course, is to maintain the set temperature by controlling the heater. But how is it better than any thermal controller for 1.5-2 bucks, which is full on Ali? The most important thing is that it provides temperature control with a PID controller.

I will try to explain in a simpler way what PID regulation is :)

In Russian, this concept, by the way, is abbreviated into the same letters - PID, Proportional-Integrating-Differentiating regulation.
There are many articles on the Internet on PID, but very few talk about it in understandable words. I am not a popularizer, but I will try to state the principle of operation of PID controllers as clearly as possible :)

PS: specific numbers on the graphs may not match the numbers in the examples, but the principle is preserved :)

Imagine that we have a jar of water, the temperature of which needs to be maintained at 70 degrees with the help of a 100-watt heater inserted into this jar. A thermometer is lowered into the water to measure the temperature.
The easiest way to do this is just used in one-buck thermostats: turn on the heater, the temperature reaches the set point, turn off the heater, the temperature drops below the set point - turn on the heater, etc.
The most elementary and cheapest method that does not require any computing resources. On this principle, both digital controllers and analog, and even mechanical ones are made. However, it has a big drawback - it does not maintain a more or less accurately set temperature. With such a regulator, the temperature of the water in our bank will walk around the set one, then exceeding it, then falling below it. The temperature graph will resemble a saw. This is called a threshold controller, that is, which turns the heater on or off when the specified thresholds are reached:

But what if you don’t just turn the heater on and off, but regulate its power - the lower the water temperature is below the set value, the more power is supplied to the heater? It sounds logical, and this is how PID begins to appear in our country :) More precisely, its first component appeared Ps - proportional, the value of which is directly proportional to the difference between the set and current temperatures. So, we will issue a value to the heater Ps : at the current water temperature of 20 degrees, it will output 70-20=50 watts to the heater. When the water heats up to 40 degrees, it will already give out 70-40 \u003d 30 watts. At a water temperature of 60 degrees, it will produce 70-60 \u003d 10 watts. Great, no jumps around the set temperature, everything is smooth :) However, there is one hitch: with a power of 10 watts on the heater, it can no longer heat water any more, but can only keep these reached 60 degrees. So water is 60 degrees, Ps accordingly, it produces 10 watts and the water temperature stands still, it cannot reach 70 degrees with such a regulator:

It is necessary to add something to the proportional component, some value, and not a constant one. Help comes Is - integrating component. This is a bug store. With each measurement, the difference between the set and current temperatures is added to it. If the set temperature is greater, then a positive number is added, if less, then a negative number. This component has a predetermined maximum value, which it cannot exceed, that is, if at the next addition it turns out that the sum exceeds the maximum, then Is becomes equal to the maximum, but not more. The same applies to zero - it cannot become a negative number either. Let this maximum be equal to the heater power - 100. Now the total power value will be output to the heater Ps +Is . For example, the sequence of temperatures and what happens in this case:
1. Temperature 20 degrees, Is initially equal to zero, Ps \u003d 70-20 \u003d 50, the heater is given Is +Ps \u003d 0 + 50 \u003d 50 watts.
2. Water heated up to 30 degrees, Is =0(its previous value)+(70-30)=40, Ps =70-30=40, Is +Ps \u003d 40 + 40 \u003d 80 watts.
3. Water heated up to 40 degrees, Is =40(her previous value)+(70-40)=70, Ps =70-40=30, Is +Ps \u003d 70 + 30 \u003d 100 watts.
4. Water heated up to 60 degrees, Is =70(her previous value)+(70-60)=80, Ps =70-60=10, the heater is given Is +Ps \u003d 80 + 10 \u003d 90 watts.
Look, so far everything looks good, the water is already 60 degrees, and the heater is still heating the water, although it has begun to reduce power :)
5. Water heated up to 70 degrees, Is =80(her previous value)+(70-70)=80, Ps =70-70=0, Is +Ps \u003d 80 + 0 \u003d 80 watts.
6. Water heated up to 80 degrees, Is =80(her previous value)+(70-80)=70, Ps =70-80=-10, Is +Ps \u003d 70 + (-10) \u003d 60 watts.
The water has overheated. And although, as you can see, the power has gone down, the temperature will still fluctuate for some time until it settles down at the set value:


This is called overshoot. It happens due to the fact that both the heater and the thermometer and, most importantly, the water have some kind of inertia, the controller receives feedback (temperature readings) with a certain delay. When full power is applied to the heater, the water will not instantly heat up to 100 degrees, and in the same way it will not cool down instantly when the heater is turned off. The regulator looked at the temperature - cold water, added power. After 2 seconds, I looked - still cold - added again. And when once again he discovers that the water has already reached the desired temperature, he begins to give out the power accumulated in Is , assuming that this is just the power value needed to maintain the temperature (in fact, the integrating component, after settling of all perturbations, really contains the value necessary to evenly maintain the controlled variable, and the proportional component is designed only to compensate for random deviations). But for water, this is a lot and it continues to heat up. And only after exceeding the set temperature, the regulator starts to reduce power. And this pitching continues for a while until the value Is will not reach the required value.
What can be done in this case? Well, for example, you can reduce the effect on output power Is . This is called a coefficient, each PID component can have its own coefficient, which can increase or decrease the influence of this component on the output result. Let's reduce the impact Is up to 0.3 of its value - Is *0.3:

Already better, but still there is hesitation at the beginning. This is due to too much influence of the proportional component, let's reduce its influence by 2 times - Ps *0.5:


Perfect, right? :)
Well... almost. There are no fluctuations, but the heating time has increased. It came to the set temperature only by the 25th reading.
In fact, a PI controller is often used, without its differentiating part, and this works quite well, as you can see. However, it is often possible to achieve an even better result using the third component - differentiating, Ds .
It is a "damper" that prevents the controlled device from changing its state too quickly. In our example Ds the faster the water heats up, in other words, it will not allow the temperature growth graph to “accelerate” so much that it overshoots the set temperature :) At the same time, while the influence is far from the set temperature Ds not very significant against the background of other components, the temperature can rise quickly. But the closer it is to the given one, the stronger the influence becomes. Ds against the backdrop of ever-decreasing Is And Ps .
Ds Unlike Ps And Is is not added to the output signal (in our example, power), but subtracted from it. It is equal to the rate of change of the controlled variable (in our example, temperature). For example, if in the last measurement the temperature was 28 degrees, and in the current measurement it is already 31 degrees, then Ds will be equal to 3 - how much the temperature has increased since the last measurement, this is the rate of temperature increase. And this value, possibly multiplied by its coefficient, is subtracted from the output power, which is why this component is called differentiating :)
Here's what happens when you add Ds :


As you can see, the temperature reached the regime much faster and at the same time without bursts and fluctuations. The regulator's attempt to jump the temperature up was extinguished just by the differentiating component.
Here, if you are interested, is a graph of the change in values Ps , Is And Ds in this controller on the same time scale:

But what would happen without the differentiating component under the same conditions:

And again in a short summary :)
PID is a controller that generates a signal of influence on the controlled value from three components: proportional, integrating and differentiating.
The proportional component adds to the output signal the momentary difference between the setpoint and the current measured value (the so-called error). The integrator accumulates (integrates) the differences of all measurements and adds the accumulated value (but not exceeding the specified maximum) to the output signal. The differentiator determines the rate of change of the controlled variable (how much it has changed since the last measurement) and subtracts this value from the output signal. All three components can have their own coefficients that enhance or weaken their effect on the output signal.

Phew… :) Well, I said that I am not a popularizer, so I am not responsible for the clarity of my presentation. But I tried :)

PS: the most fun is in the selection of the coefficients of these components, because without the correct (at least approximately) values ​​of these coefficients, the PID controller will either not regulate at all or will regulate very poorly. The selection of ideal coefficients, as I understand it, is a very non-trivial matter. While I have not seen an accessible explanation on the Internet on how to calculate them, the methods of their experimental selection are mainly given. Which, however, is quite logical, because. for the calculation, you need to know so much about the adjustable mechanism that even its creators do not always know about it :))

The main parameters of this regulator (this particular model - REX-C100FK02-V * AN):

  • power supply - 24 volts DC / 24 volts AC / 85-264 volts AC
  • consumption - no more than 9 VA when powered by 240 volts
  • output - voltage, 12 volts, load resistance 600 ohms and higher
  • type of connected thermocouple - K (you can select a whole bunch of types in the settings, but I'm not sure that the hardware is universal and supports all this bunch)
  • temperature control range - 0-400 degrees Celsius (depending on the type of thermocouple)
  • alarm output - one output, close relay
  • regulation cycle period - 0.5 sec
  • regulation method - PID, on/off (discrete), P, PI, PD (adjustable)
  • weight - about 170 grams
  • fastening - in the panel hole
Here is the Russian-language manual for this controller (found somewhere on the net) -
And here is a high-quality English-language one, a little more complete, but it doesn’t match the settings a bit -

And I wouldn’t know how long he would have lain with me if my wife hadn’t complained that she couldn’t bake polymer clay in our electric oven - the temperature couldn’t be set there normally. Yes, and sometimes pies burn :) The oven is one of the cheapest, alas :) And I remembered this controller. I didn’t need it, it’s too primitive, but for the oven it’s just right. But I decided not to smoke the oven, but to make a separate box with this regulator and a 40 amp solid state relay. Exactly the same relay has been working for me for a year on almost the same oven (converted into a soldering oven) and does not buzz.

The controller is mounted very simply - it is inserted into the panel and is pressed from the back side with a frame with latches. The frame is equipped with spring levers that tighten the regulator:


All connections are made via screw terminals on the rear wall:

The connection is very clearly described both on the sticker on the controller case and in the manual.


I'm interested in: power supply (220 volts), control voltage output (straight to the solid state relay), thermocouple input.
If desired, you can also connect an alarm output. It can be disabled or configured to one of the modes:

  • exceeding the set temperature
  • drop below the set temperature
  • falling within a predetermined temperature range
  • going beyond a given temperature range
This can be useful, for example, for emergency power off of the heater, in case the key that controls the heater (mosfet, solid state relay) is broken and uncontrolled heating starts.

viscera

The controller is disassembled very easily and even without the use of tools. To do this, you need to press the latch on the case (it even has protrusions for pressing with your finger):


and pull the case while holding the front panel frame with the other hand:

The controller consists of three boards: the control board itself, the power supply and the display with buttons. The control boards and power supply are connected by a rather rigid cable, the display board is soldered to the control board:





The boards are connected to the terminal blocks through sliding contacts:

Larger fees:







The general plan was this - a separate box with a controller and a solid-state relay on the radiator, two power wires with a plug and a socket (yes, a socket on the wire) and a thermocouple come out of it. The thermocouple is inserted into the oven and clamped by its door, the insulation of the thermocouple is heat-resistant, nothing will happen to her :)
At first, the thought flashed through to print the case on a 3D printer, but printing such a size from ABS on my Anet A8 open to all drafts is hemorrhoids, and PLA, which softens already at 55-60 degrees next to the oven, will not live long. I decided to cut from cast polycarbonate 6 mm thick, I have several sheets of them 50x50 cm :)

First, I drew a model (a glass for scale):

This is how it will assemble:

The top cover and one wall are removable, with screws, the rest is glued. True, only later, when everything was done, it dawned on me that it would be better to make the bottom removable, and not the lid, but I didn’t redo it :)
I cut it out on a milling machine, so the dimensions fit perfectly. Only the thickness converged imperfectly, which turned out to be 5.9 mm instead of 6. For stronger gluing (or to think that it is more durable), I made grooves along the edges of the walls, so that the walls are connected by half-grooves:


And here is a bunch of parts ready for further work:

At first I thought to glue it with self-adhesive, but firstly, in the store I didn’t come across a film of a normal color, only flowers and fabric patterns, and secondly, I wasn’t sure that I could glue it without wrinkles and cracks, so I decided to paint.
A preliminary fitting showed that everything fits together, so I fixed the walls with masking tape and glued all the joints. Glued with dichloromethane, holds iron. I typed it into a syringe with a needle, from which I cut off the beveled nose, and walked the needle along all the joints from the inside (even along one joint that did not have to be glued, I got carried away :)). Dichloromethane is very fluid - instantly fills the smallest gaps, and evaporates very intensively, so that you didn’t even have to press the plunger, the heat of the hands heated the dichloromethane enough so that its evaporation created excess pressure inside the syringe.
Dries:

In the meantime, the case was drying up, I dug out a piece of a radiator, which I once ordered for some reason on Ali (I don’t even remember why). It fit perfectly in size, except that I had to saw off the right piece along the length.

I printed out a hole template, grabbed it with pieces of double-sided tape to the radiator and drilled holes:

Then I discovered that I had slightly incorrectly drawn the model of the solid state relay, and the holes on the radiator now do not exactly match the holes in the relay. Fortunately, I made a very successful mistake - firstly, only one hole didn’t match, and secondly, it didn’t match so much that it didn’t interfere with drilling the right one at all :) So everything was just an extra hole :)

An hour later, the case was already strong enough to be able to twist and try on it safely. And here I discovered my second puncture in the model: I drew the controller itself correctly in terms of dimensions, but I did not draw the mounting frame with latches. And it turned out that it now prevents the lid from closing by about 3 mm. I had to put the cover in the machine and mill a notch on its inside.
Another mistake I made was that I cut out the narrow strips that I glued to the walls and to which the covers were to be screwed without holes for the bolts. I decided that I would glue it, and then I would drill it in place. Drilling straight and exactly where I marked has never been my forte. In short, almost all the holes in these slats are gone. Because of this, I had to break holes in the covers with a drill and try to mill the bevels for the hats in the same direction with a countersink :) It turned out to be a slightly collective farm ...
By the way, the polycarbonate thread holds the bolts very well, no nuts are needed.
Before painting, I slightly rounded the edges with a file and sandpaper, the process is very quick and easy.
In the process of painting, I did not take a photo, I somehow forgot about it, but there is nothing interesting there, in general, there is nothing. I sanded the surfaces, degreased them, covered them with two layers of primer and then two layers of paint.

Why such a color? Who knows :) It’s just that apart from that I only had black, blue, red and green, but I didn’t like them in this case :) Well, why not :)

I inserted special rubber washers into the holes for the wires for such cases, I also took them on Ali:


(Kotska is the result of my impatience, I climbed to pick the body when the paint had not completely dried yet)
Since they are not intended for panels with a thickness of 6 mm, I had to make recesses for them on the inside, leaving walls with a thickness of 1 mm:


I tightened the power wires into the holes, connected the ground and one of the cores, from which I made a tap to power the controller, as well as from one of the second cores coming from the plug, screwed the relay to the thermal paste to the radiator, and the radiator to the case:

Then everything is simple - wires to the relay, measure the length of the wires to the controller, cut off, strip, tin, screw ...
I covered all the wires coming out of the case with ties from the inside so that they would not be accidentally pulled out. Standard practice.

I connected everything and turned it on to see if something would bang with fireworks. Didn't bang:


There, in the depths of the case, you can see a glowing relay indicator, so everything is fine, you can assemble :)

To begin with, I decided to arrange a stress test for him and connected to him such a 3 kW fan heater:


At the same time, I put the thermocouple on the relay radiator and secured it with a piece of Kapton to control the temperature not only by touch.

I turned it on, the fan heater buzzed, and I went to write a spoiler about the PID controller, being distracted from time to time and checking the temperature of the radiator. 15 minutes after the start, the temperature reached 50 degrees. After another 20 minutes, it was already 67 degrees and stayed at this value for the next 30 minutes until I turned it all off - it got hot in the office :) Verdict - it can handle a 1.5-2 kW oven without problems :)

Everyday (when you do not need to change any deep settings) control of this controller is very simple. Immediately after the power is turned on, it starts trying to regulate the temperature; there is no separate inclusion for this.
In general, the front panel is minimalistic:


Upper, red display - measured (current) temperature
Lower, green display - set temperature
Indicators on the left in order from top to bottom:
1. Alarm 1
2. Output signal
3. Alarm 2
4. PID auto-tuning indicator
Buttons from left to right: "adjust", "shift", "up", "down".
To set the set temperature, press “setting”, all digits of the lower display, except for the youngest one, begin to flicker. Use the "up" and "down" buttons to set the desired number in the least significant digit and press "shift", now all digits except tens flicker, the setting is shifted one digit to the left. And so we set the desired numbers in all digits. To complete the setup, click "Setup" again.

More detailed settings in short

As I wrote in the spoiler about the PID controller, the coefficients of such a controller are a delicate matter and you need to select them for each case. The initial settings of the coefficients in this regulator most likely will not suit your application, you need to select your own. These coefficients and other parameters in the controller can be changed in deeper settings. To enter this mode, press and hold the "setting" button for 3-4 seconds.
The upper display shows the name of the parameter and the lower display shows the current value of that parameter. Setting the value is done in the same way as setting the temperature - use the up and down buttons to change the current digit, then use the shift button to move to the next one, etc. To go to the next parameter, click "setting". To save all settings and exit this mode, press and hold the "settings" button for 3-4 seconds.
List of parameters in the order in which they are passed:

  • AL1 - setting the output of the first alarm (in this model it is one, the second is not).
  • AGU - PID autotuning

  • P - Ps coefficient (proportional component of PID), when set to 0, the controller operates in discrete control mode
  • I - Ic coefficient (PID integrating component), when set to 0 the controller operates in PD mode
  • d is the coefficient of Ds (PID derivative), when set to 0 the controller operates in PI mode
  • Ar - as far as I understand, this parameter sets the maximum Is, but I'm not sure that I understood correctly.
  • G - also did not quite understand this parameter, but it seems that this is the period with which the current temperature is measured and the corresponding change in the output signal
  • SC - here you can correct the thermocouple readings, this value is added to them. It can be either positive or negative number.
  • LCK - settings lock, 0000 - all settings are available, 0001 - only the set temperature can be changed and AL1, 0011 - only the set temperature can be changed, 0111 - nothing can be changed.
and then again in a circle, starting with AL1.
And in these settings, you can change the PID coefficients to the required ones. However, in order to know what to change them to, you need to understand very well what you are doing and how it will affect the operation of the controller, or you can go through them for a long and tedious time in the hope of stumbling upon the correct values. And to make life easier for mere mortals, the controller provides automatic adjustment of these coefficients.
Autotuning procedure:
All conditions must be close to real. That is, if you are setting up for use with an oven, then the oven must be connected, closed and the temperature on the controller must be set to the maximum (10 percent less) from the range that is supposed to be used in the oven. During the setting process, the controller will heat the oven to this temperature and hold it for a while.
So, we connected the oven (but we don’t turn on its heaters yet), set the temperature (I set it to 180 degrees), go into the settings, go through the items until the AGU appears, set it to 1 low order and exit the settings. The AT indicator starts flashing. Now turn on the oven heaters and wait until the flashing AT stops. The controller heats the oven by constant heating to the set temperature, turns off the heating and monitors how much and how quickly the temperature will exceed the set temperature after turning off the heating. Based on the heating rate, the temperature "jump" and the rate of further cooling, he calculates the PID coefficients. He can repeat this process 2-3 times for clarification.

The auto-tuning process is strongly recommended after purchase or after a change in operating conditions (a different heater, something has been changed in the current heater, etc., that is, everything that affects the heating process). Before auto-tuning, the controller could not bring the oven temperature to the set 180 degrees at all. Carried out auto-tuning (video sped up 10 times):

And the operation of the controller after that (also accelerated by 10 times):

As you can see, the PID remained tuned not quite optimally (and no one promised an ideal :)), the temperature jumps by inertia as much as 10 degrees. In the future, if desired, you can correct the coefficients calculated by him (which I will do on a home oven), but at the same time you need to understand what and why to change.
By the way, that second, more advanced controller (he saw it on the left in the video) coped with auto-tuning much better, I didn’t have to adjust anything, the temperature jump at 200 degrees does not exceed 2-3 degrees.

There is another level of settings, the entrance to it is carried out by pressing and holding for 3-4 seconds at the same time the "setting" and "shift" buttons. But it’s better not to climb there unnecessarily, and if necessary, carefully check the manual :)

The result of all this fuss :)





Outcome:
The controller is worth the money and does the job very well, especially if you tune it a little more finely than the auto-tune suggests. A solid state relay also handles a fairly large load, although I have very big doubts about the declared 40 amps. Maximum 20, and even then with a good radiator and its active cooling.

I plan to buy +53 Add to favorites Liked the review +79 +139