PID

From SweepMe! Wiki
Jump to navigation Jump to search

The PID (Proportional, Integral, Differential) Module allows for the implementation of a PID control loop to adjust process variables automatically. This module is essential for maintaining a desired set point in automated control systems.

Usage

The PID module must always be used in conjunction with another module that creates a repetition as the PID module is just calculating one next value for the output. Typically, the repetition is done via a Loop module that runs infinitely and is only stopped by a Condition module.

Therefore the following modules are typically needed in one branch:

  1. A module that creates a repetition, e.g. Loop
  2. A module that is returning a measurement value, e.g. a Logger module with a driver for a temperature sensor
  3. A module that applies the output value of the PID modules, e.g. an SMU module with a driver for power supply
  4. the PID module itself
  5. A Delay module to create equidistant time distance between the points.
  6. A Condition module to stop or skip the Loop module in case it is running endlessly.

GUI options

Set value (target)

Please, enter a value for the set value. It can be a fixed value or a parameter from another module. It is also possible to sweep over different set values, for example, to do measurements at different temperatures which are stabilized by the PID module.

Actual value

This value must be a parameter from another module. The PID module will try to change the output so that the actual value coincides with the given set value.

kP, kI, kD

The parameters kP, kI, and kD are the three prefactors of the proportional, the integral, and the differential part of a PID controller. They can be set to 0 if you like to switch off one part of the PID controller. For example, PI controller can be achieved by using kD = 0. The unit of each prefactor depends on the unit of the actual value and the unit of how the output value is used and thus depends on each scenario.

  • The unit of kP is the unit of the output parameter divided by the unit of the actual value.
  • The unit of kI is the unit of the output parameter divided by the unit of the actual value times seconds.
  • The unit of kD is the unit of the output parameter divided by the unit of the actual value per second.

Output, min. and Output, max.

Output, min. and Output, max. are the limits that the output value of the PID module can be. The unit of both parameters is in units of how the output value of the PID module is later on used in another module. For example, if the output value of the PID module is used to set a current in A of a power supply, and the current should be between 0 A and 10 A, then the Output min and Output max must be set to 0 and 10, respectively.

Output, initial

An output initial value is optional and can be used to enter the start output value for the PID controller. If the field is not filled, the first output will start from the value given in the field Output, min.

Low pass output filter

The low pass output filter is optional and given in seconds. It can be used to smooth output values if the measured signal is very noisy. It leads to a stepwise transition from the old to the new output value. A too-large value for the low pass output filter, however, can introduce new time constants that can falsify the previously found PID parameters and can slow down the reaction. We therefore recommend using just times that are 2-5 times larger than the the time of a single step in your loop.

Reach

The PID module returns parameters that can be used to decide whether a set value is accepted as reached or as a table. Therefore, the user can define a time span for which the actual value must be in a certain tolerance range to the set value. Once the actual value is in this range, the parameter 'in range' becomes True. If the parameter 'in range' is True for the given stability time, the parameter 'stable' becomes True as well. The parameter 'stable' goes back to False if 'in range' gets False. These return values can be used to trigger further actions. The tolerance range can be given in absolute or relative values.

Return values

The PID returns a couple of parameters:

Output

The Output value is the most important parameter. It must be used as the Sweep value in another module. The unit of the Output has the unit of the Sweep mode that is used in the module where the Output value is used as Sweep value.

in range

If the process has an actual value that in the tolerance range with respect to the set value, the parameter 'in range' gets True. It gets 'False' if the tolerance range is left.

stable

If the parameter 'in range' is True for the given tolerance time, 'stable' becomes True, but goes back to False if 'in range' is False as well.

stable change

The parameter 'stable change' has three states:

  • 0 when stable has not changed
  • 1 when stable changed from False to True
  • -1 when stable changed from True to False

Examples

  • A power supply is controlled by the PID modules to achieve a certain temperature at a temperature sensor. A variation of the temperatures is done and each temperature is reached by the PID module to do a measurement there.
  • In the field of thermal vapor deposition an ouput power applied to an evaporation crucible is controlled to achieve a stable evaporation rate for reproducible thin film production.

Manual control

The module allows to create a manual control widget based on a slider that has limits according to Output min and Output max. This widget pops up if you select manual control in the PID module. The widget can then be added to the Dashboard. The manual mode can be selected in the widget. Once enabled the slider value will be used to define the output value. This can be helpful to take over control if the PID control loop has problems to achieve stability or to reach a nearly stable state manually and then switch to the PID control.

To switch off the manual control, just uncheck the manual mode in the slide widget of the PID module or remove the manual slider widget by unchecking manual control mode in the PID module. To let the PID control loop continue at the last manually set output, the integral term is set to the last output power. This ensure that a stablized system can immediately maintain its state and does not start again from Output min.

Autotuning

A PID controller is nothing without good PID parameters. Therefore, the PID module provides a built-in autotuning algorithm that estimates parameter online. Just record the response of your system on an arbitrary change of the output and possible paraemeters kD, kI, and kD are suggested.

The autotuning dialog can be opened by clicking on the button "Show autotune dialog". A dialog will popup that is on top of the left mainwindow of SweepMe!. To record data, just click the button 'Record' and data is collected. At least 100 points are needed to start a first calculation. Then, further parameter sets are calculated if further data is collected and the table fills. In the top section of the dialog you can find 'Best parameters' that present the PID paraemters with the highest final quality.

Quality

Quality is a factor that described how well the model matches the experimental data. 100% means perfect agreement. Typically, 80%-90% already indicate a good PID parameter set because noisy data, measurement resolution or nonlinear behavior do not allow to reach perfect agreement. Everything below 50% should be put into question.

The table shows two values per parameter set: initial quality and final quality. The initial quality is calculated for the agreement between the model and the initial data set that was used to fit the model. The final quality is calculated by re-evaluating a found model regarding the entire data, including data points that have been collected after the creation of the model. Thus, the final quality typically shrinks the more data is collected as more and more data must be matched by the model.

Handling

  • Important: Before starting to record, a steady-state must be achieve. It means that you have a constant measured value a constant output. This is needed to "calibrate" the PID autotune algorithm and all calculations are based on changes to this steady state. So, we recommend to achieve a good steady state before starting recording.
  • After starting the recording, first data is collected whenever the output changes. As long as the output does not change, nothing will happen.
  • The output is changed manually by adding the manual slider widget of the PID module
  • To create a good data quality, do output changes up and down as the fitted model must agree with both. If you only change the output up or only down, it might be that a model is found that has a good quality to describe the increase or decrease of the measured value but it would fail describing the data if the output changes into the other direction. A lower final quality is better if therefore more data is involved that is significant.
  • In general, arbitrary output changes can be used, but we recommend to use clear steps in output.
  • The autotuning should be done in a range of measured values at which the PID controller should be used later on. Make output changes that are large enough to achieve a clear response of the measured values. However, keep the output changes small enough to have a, in the best case, linear response of the system.
  • An important adjustment is the 'strength' of the PID controller. The field "Strength scaling" allows you to increase or descrease all PID parameters. The proposed PID parameters at a strength 1.0 should already yield good values, but it can be necessary to do an adjustment. The higher the strength the faster the PID controller can reach the new set value. However, the output limits can prevent a proper control and noise of the measured value can destabilize the control loop. To achieve a slower but more robust and stable control, the strength must be descreased.
  • We recommend to decrease the strength until the output noise, related to the noise of the measured values, fluctuates only in a small part of the possible output range. Further, the output limits should only be reached if larger changes of the set value are done.
  • To immediatetely test the found PID parameters, you can use the module Form where you create fields for the setpoint, kP, kI, and kD. These parameters can be handed over to the PID module using the parameter syntax {...}. Switch off the manual control slider to let the PID controller take over.
  • If you have noisy measurement data or digital noise because of the measurement resolution, you can use the Output lowpass filter of the PID module. It will smooth data approximately over the given low pass filter time. Thus, output changes are reduced. This way, you can increase also the strength of the PID controller again. However, using a too high low pass filter time can lead to a new time constant in the response of the system that was not used to find the PID parameters and therefore can destabilize the control loop. We recommend to use a low pass filter time that includes a few measurement points (2-5). This is typically enough to achieve a smoothing without making the output change too slow.

Special use cases

Vacuum deposition

  • Typically, a repetition rate of 1 point per second is sufficient.
  • A strength of 0.1 is often found to be adequate.
  • A low pass filter time of 2s - 5s can help to reduce the noise of the measured evaporation rate.
  • Older QCM monitors have a low digital resolution which can lead to noisy output changes and destabilization of the rate. It can be helpful to use equipment with stable and accurately measured rates.
  • It is recommended to use fresh QCM crystals to have an accurate and less noisy rate.
  • Larger output changes should be avoided to not stress the crucibles as they would quickly heat up and cool down.
  • Evaporation processes can be very non-linear. A rate of 0.5 A/s achieved for example at 40 W will not lead to 1.0 A/s at 80 W. Instead a rate of 1.0 A/s can often be achieved by only a few percentage higher power. Therefore, it is very important to achieve a stable steady state before using autotuning.
  • We recommend to evaporate materials for a certain while before starting autotuning to achieve stable conditions and let the material thermalize.
  • Suggested PID parameters can lead to a slight overshoot. This typically helps to achieve a new set rate quicker and to overheat the material a bit so that it is more stable once the rate decreases to the final set rate.
  • Often found PID parameter ratios are kP:kI:kD = 100:1:1000
  • If you often use PID autotuning for thermal vapor deposition, you might have a PID parameter set for other similar materials that can be used a first guess to help you to achieve a stable steady state before performing autotuning.
  • Some materials react highly nonlinear and untypical, e.g. materials that have a liquid phase before they evaporate. It might be that no good PID parameter set will be found as these materials are very difficult to control.
  • When heating up, rates can quickly increase while it often takes some time before a crucibles cools down and the rate decreases. Therefore, we saw that achieving a higher rate is often very fast but going back to a lower rate can take some time. If this is the case, one can optimize the later production procedure accordingly.
  • When using a tooling factor enhancement, e.g. to measure very low rates, you must define a standard and use this standard also during later fabrication. For example, if you use PID-autotuning with 10 times higher tooling factor, you must also use a 10 times higher set rate later when using the PID controller.

User feedback

The PID autotuning algorithm will constantly improved based on user feedback. If you have problems to achieve good PID parameters or no PID parameter set is found at all, feel free to send us your data and we will have a look at it. Just send us the file of meausurement data that is created just as normal during a meausrement procedure and we will try to analyze how to improve the autotuning or whether there are other issues.