From SweepMe! Wiki
Jump to: navigation, search

This module is used to create a PID control loop in order to reach a measured value at one module by changing the sweep value (set value) of another module.


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 thar runs infinitely and is only stopped by a Condition module.

Therefore the following modules are typically needed in on 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 equi-distant 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 modules. It 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 paraemter from another module. The PID module will try to change the output so that the actual value conincided 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 seconds.

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 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.


The PID module return parameters that can be used to decide whether a set value is accepted as reached or as 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 parameters returns a couple of parameters:


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' get True. It get 'False' if the tolerance range is left.


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


  • 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.