blockLimPID

P, PI, PD, and PID controller with limited output, anti-windup compensation and setpoint weighting

Extends from Modelica.Blocks.Interfaces.SVcontrol (Single-Variable continuous controller).

Information

PID controller in the standard form

y = k   ( e(t) + 1 ⁄ Ti   ∫ e(s) ds + Td de(t)⁄dt ),

where y is the control signal, e(t) = us - um is the control error, with us being the set point and um being the measured quantity, k is the gain, Ti is the time constant of the integral term and Td is the time constant of the derivative term.

Note that the units of k are the inverse of the units of the control error, while the units of Ti and Td are seconds.

For detailed treatment of integrator anti-windup, set-point weights and output limitation, see Modelica.Blocks.Continuous.LimPID.

Options

This controller can be configured as follows.
P, PI, PD, or PID action

Through the parameter controllerType, the controller can be configured as P, PI, PD or PID controller. The default configuration is PI.

Direct or reverse acting

Through the parameter reverseActing, the controller can be configured to be reverse or direct acting. The above standard form is reverse acting, which is the default configuration. For a reverse acting controller, for a constant set point, an increase in measurement signal u_m decreases the control output signal y (Montgomery and McDowall, 2008). Thus,

  • for a heating coil with a two-way valve, leave reverseActing = true, but
  • for a cooling coil with a two-way valve, set reverseActing = false.
Reset of the controller output

The controller can be configured to enable an input port that allows resetting the controller output. The controller output can be reset as follows:

  • If reset = Buildings.Types.Reset.Disabled, which is the default, then the controller output is never reset.
  • If reset = Buildings.Types.Reset.Parameter, then a boolean input signal trigger is enabled. Whenever the value of this input changes from false to true, the controller output is reset by setting y to the value of the parameter y_reset.
  • If reset = Buildings.Types.Reset.Input, then a boolean input signal trigger and a real input signal y_reset_in are enabled. Whenever the value of trigger changes from false to true, the controller output is reset by setting the value of y to y_reset_in.

Note that this controller implements an integrator anti-windup. Therefore, for most applications, keeping the default setting of reset = Buildings.Types.Reset.Disabled is sufficient. However, if the controller is used in conjuction with equipment that is being switched on, better control performance may be achieved by resetting the controller output when the equipment is switched on. This is in particular the case in situations where the equipment control input should continuously increase as the equipment is switched on, such as a light dimmer that may slowly increase the luminance, or a variable speed drive of a motor that should continuously increase the speed.

References

R. Montgomery and R. McDowall (2008). "Fundamentals of HVAC Control Systems." American Society of Heating Refrigerating and Air-Conditioning Engineers Inc. Atlanta, GA.

Parameters

TypeNameDefaultDescription
Modelica.Blocks.Types.SimpleControllercontrollerTypeModelica.Blocks.Types.SimpleController.PIType of controller
Realk1Gain of controller
Modelica.Units.SI.TimeTi0.5Time constant of Integrator block
Modelica.Units.SI.TimeTd0.1Time constant of Derivative block
RealyMax1Upper limit of output
RealyMin0Lower limit of output
Realwp1Set-point weight for Proportional block (0..1)
Realwd0Set-point weight for Derivative block (0..1)
RealNi0.9Ni*Ti is time constant of anti-windup compensation
RealNd10The higher Nd, the more ideal the derivative block
BooleanreverseActingtrueSet to true for reverse acting, or false for direct acting control action
Initialization
Modelica.Blocks.Types.InitinitTypeModelica.Blocks.Types.Init.InitialStateType of initialization (1: no init, 2: steady state, 3: initial state, 4: initial output)
Realxi_start0Initial or guess value value for integrator output (= integrator state)
Realxd_start0Initial or guess value for state of derivative block
Realy_start0Initial value of output
Advanced
Booleanstricttrue= true, if strict limits with noEvent(..)
Integrator reset
Buildings.Types.ResetresetBuildings.Types.Reset.DisabledType of controller output reset
Realy_resetxi_startValue to which the controller output is reset if the boolean trigger has a rising edge, used if reset == Buildings.Types.Reset.Parameter

Connectors

TypeNameDefaultDescription
RealInputu_s (from SVcontrol)Connector of setpoint input signal
RealInputu_m (from SVcontrol)Connector of measurement input signal
RealOutputy (from SVcontrol)Connector of actuator output signal
Modelica.Blocks.Interfaces.BooleanInputtriggerResets the controller output when trigger becomes true
Modelica.Blocks.Interfaces.RealInputy_reset_inInput signal for state to which integrator is reset, enabled if reset = Buildings.Types.Reset.Input

Components

TypeNameDefaultDescription
RealcontrolErroru_s - u_mControl error (set point - measurement)
Modelica.Blocks.Math.AddaddPAdder for P gain
Modelica.Blocks.Math.AddaddDAdder for D gain
Modelica.Blocks.Math.GainPProportional term
Utilities.Math.IntegratorWithResetIIntegral term
Modelica.Blocks.Continuous.DerivativeDDerivative term
Modelica.Blocks.Math.Add3addPIDAdder for the gains

Contents

NameDescription
LimiterprotectedLimit the range of a signal

Revisions

  • June 1, 2020, by Michael Wetter:
    Corrected wrong convention of reverse and direct action.
    Changed default configuration from PID to PI.
    This is for issue 1365.
  • March 9, 2020, by Michael Wetter:
    Corrected wrong unit declaration for parameter k.
    This is for issue 1316.
  • October 19, 2019, by Filip Jorissen:
    Disabled homotopy to ensure bounded outputs by copying the implementation from MSL 3.2.3 and by hardcoding the implementation for homotopyType=NoHomotopy. See issue 1221.
  • September 29, 2016, by Michael Wetter:
    Refactored model.
  • August 25, 2016, by Michael Wetter:
    Removed parameter limitsAtInit because it was only propagated to the instance limiter, but this block no longer makes use of this parameter. This is a non-backward compatible change.
    Revised implemenentation, added comments, made some parameter in the instances final.
  • July 18, 2016, by Philipp Mehrfeld:
    Added integrator reset. This is for issue 494.
  • March 15, 2016, by Michael Wetter:
    Changed the default value to strict=true in order to avoid events when the controller saturates. This is for issue 433.
  • February 24, 2010, by Michael Wetter:
    First implementation.