blockFirstOrderAMIGO

Autotuning PID controller with an AMIGO tuner that employs a first-order system model

Information

This block implements a PI or PID controller with the control gains being tuned by a rule-based method. This rule-based method automatically conducts tuning through the following steps:

Step 1: Introduce a relay disturbance

Step 2: Extract parameters of a first-order plus time-delay (FOPTD) model

Step 3: Calculate the PID gains

This block is implemented using Buildings.Controls.OBC.Utilities.PIDWithInputGains and inherits most of its configuration. However, through the parameter controllerType, the controller can only be configured as PI or PID controller.

Autotuning process

Before the tuning process starts, this block has output from Buildings.Controls.OBC.Utilities.PIDWithInputGains. The PID tuning process starts when a request for performing autotuning occurs, i.e., when the value of the boolean input signal triTun changes from false to true. During the tuning process, the block has the output from a relay controller (see Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.Controller). The PID tuning process ends automatically (see details in Buildings.Controls.OBC.Utilities.PIDWithAutotuning.BaseClasses.Relay.TunMonitor), at which point this block reverts the output from the PID controller that uses the tuned PID parameters.

Note:

  • If an autotuning is ongoing, i.e., inTunPro.y = true, a new request for performing autotuning will be ignored and a warning will be generated.
  • If the set point is changed during an autotuning process, a warning will be generated. The ongoing tuning process will be halted, and no adjustments will be made to the PID parameters.
  • The autotuning must be conducted when the process is in a stable state. The user should monitor changes in the disturbances affecting the system that is controlled by the controller, e.g.,outdoor drybulb temperature, and the controller output y over time. When the changes in those disturbances are small (e.g., less than 10%) and the change in y is either small or exhibits regular oscillations, the process can be considered in a stable state.

Guidance for setting the parameters

The performance of the autotuning is determined by several parameters, including the typical range of the control error r, the reference output for the tuning process yRef, the higher and lower values for the relay output yHig and yLow, and the deadband deaBan. These parameters must be specified on a case-by-case basis. To set them, the user should conduct the following steps.

Step 1: Conduct a "test run"

  • In the test run, disable the autotuning and keep the disturbances and the set point constant.
  • During the test run, adjust r so that the output of the relay controller, rel.yDif, stays between 0 and 1.
  • The test run must begin once the simulation reaches a stable state and end when it reaches another stable state.
  • The set point value must lie within the range defined by the minimum and maximum value of u_m.

Step 2: Calculate yRef and deaBan

  • Set yRef to be the ratio of the difference between the set point and the minimum value of u_m to the range of u_m, (i.e., the difference between its maximum and minimum values), during the test run.
  • For the deaBan, first divide the maximum and the minimum control errors during the test run by r. Then set the deaBan to be half of the smaller absolute value of those two deviations.

Step 3: Determine yHig and yLow

  • Adjust yHig and yLow so that the relay output is asymmetric, i.e., yHig - yRef ≠ yRef - yLow.
  • yHig must be greater than yRef but cannot be greater than 1.
  • yLow must be less than yRef but cannot be less than 0.

References

J. Berner (2017). "Automatic Controller Tuning using Relay-based Model Identification." Department of Automatic Control, Lund University.

Parameters

TypeNameDefaultDescription
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Types.SimpleControllercontrollerTypeBuildings.Controls.OBC.Utilities.PIDWithAutotuning.Types.SimpleController.PIType of controller
Realr1Typical range of control error, used for scaling the control error
RealyHigHigher value for the relay output
RealyLowLower value for the relay output
RealdeaBanDeadband for holding the relay output
RealyRefReference output for the tuning process. It must be between yLow and yHig
BooleanreverseActingtrueSet to true for reverse acting, or false for direct acting control action
RealsetHys0.05*rHysteresis for checking set point
Initial control gains, used prior to first tuning
Realk_start1Gain of controller used before the first tuning
RealTi_start0.5Time constant of integrator block used before the first tuning
RealTd_start0.1Time constant of derivative block used before the first tuning
Limits
RealyMax1Upper limit of output
RealyMin0Lower limit of output
Advanced › Integrator anti-windup
RealNi0.9Ni*Ti is time constant of anti-windup compensation
Advanced › Derivative block
RealNd10The higher the Nd, the more ideal the derivative block
Advanced › Initialization
Realxi_start0Initial value of integrator state
Realyd_start0Initial value of derivative output
Integrator reset
Realy_resetxi_startValue to which the controller output is reset if the boolean trigger has a rising edge

Connectors

TypeNameDefaultDescription
Buildings.Controls.OBC.CDL.Interfaces.RealInputu_sConnector of set point input signal
Buildings.Controls.OBC.CDL.Interfaces.RealInputu_mConnector of measurement input signal
Buildings.Controls.OBC.CDL.Interfaces.BooleanInputtriResConnector for resetting the controller output
Buildings.Controls.OBC.CDL.Interfaces.BooleanInputtriTunConnector for starting the autotuning
Buildings.Controls.OBC.CDL.Interfaces.RealOutputyConnector for actuator output signal

Components

TypeNameDefaultDescription
Buildings.Controls.OBC.Utilities.PIDWithInputGainsconPI or P controller with the gains as inputs
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.AutoTuner.AMIGO.PIDPIDParAutotuner of gains for a PID controller
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.AutoTuner.AMIGO.PIPIParAutotuner of gains for a PI controller
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.ControllerrelRelay controller
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.ResponseProcessresProIdentify the on and off period length, the half period ratio, and the moments when the tuning starts and ends
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.SystemIdentification.FirstOrderTimeDelay.ControlProcessModelconProModCalculates the parameters of a first-order time delayed model
Buildings.Controls.OBC.CDL.Logical.LatchinTunProOutputs true if the controller is conducting the autotuning process

Revisions

  • February 10, 2025, by Michael Wetter:
    Removed parameter u_s_start as it does not influence the auto-tuning.
  • March 8, 2024, by Michael Wetter:
    Propagated range of control error r to relay controller.
  • October 23, 2023, by Michael Wetter:
    Revised implmenentation. Made initial control gains public so that a stable operation can be made prior to the first tuning.
  • June 1, 2022, by Sen Huang:
    First implementation.