PID controller in the standard form
yu = k/r (e(t) + 1 ⁄ Ti ∫ e(τ) dτ + Td d⁄dt e(t)),
with output reset, where yu is the control signal before output limitation, e(t) = us(t) - um(t) 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, Td is the time constant of the derivative term, and r is a scaling factor, with default r=1. The scaling factor should be set to the typical order of magnitude of the range of the error e. For example, you may set r=100 to r=1000 if the control input is a pressure of a heating water circulation pump in units of Pascal, or leave r=1 if the control input is a room temperature.
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.
The actual control output is
y = min( ymax, max( ymin, y)),
where ymin and ymax are limits for the control signal.
Through the parameter controllerType
, the controller can be configured
as P, PI, PD or PID controller. The default configuration is PI.
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,
reverseActing = true
, but
reverseActing = false
.
If reverseAction=false
, then the error e above is multiplied by -1.
The controller anti-windup compensation is as follows: Instead of the above basic control law, the implementation is
yu = k (e(t) ⁄ r + 1 ⁄ Ti ∫ (-Δy + e(τ) ⁄ r) dτ + Td ⁄ r d⁄dt e(t)),
where the anti-windup compensation Δy is
Δy = (yu - y) ⁄ (k Ni),
where Ni > 0 is the time constant for the anti-windup compensation. To accelerate the anti-windup, decrease Ni.
Note that the anti-windup term (-Δy + e(τ) ⁄ r) shows that the range of the typical control error r should be set to a reasonable value so that
e(τ) ⁄ r = (us(τ) - um(τ)) ⁄ r
has order of magnitude one, and hence the anti-windup compensation should work well.
Whenever the value of boolean input signal trigger
changes from
false
to true
, the controller output is reset by setting
y
to the value of the parameter y_reset
.
The derivative of the control error d ⁄ dt e(t) is approximated using
d⁄dt x(t) = (e(t)-x(t)) Nd ⁄ Td,
and
d⁄dt e(t) ≈ Nd (e(t)-x(t)),
where x(t) is an internal state.
The parameters of the controller can be manually adjusted by performing closed loop tests (= controller + plant connected together) and using the following strategy:
k
(the total gain of the controller) until the closed-loop response
cannot be improved any more.
k
and Ti
(the time constant of the integrator).
The first value of Ti
can be selected such that it is in the
order of the time constant of the oscillations occurring with
the P-controller. If, e.g., oscillations in the order of 100 seconds
occur in the previous step, start with Ti=1/100
seconds.
k
, Ti
, Td
(time constant of derivative block).
yMax
and yMin
according to your specification.
Ni
(Ni Ti is the time constant of
the anti-windup compensation) such that the input to the limiter
block (= lim.u
) goes quickly enough back to its limits.
If Ni
is decreased, this happens faster. If Ni
is very large, the
anti-windup compensation is not effective and the controller works bad.
R. Montgomery and R. McDowall (2008). "Fundamentals of HVAC Control Systems." American Society of Heating Refrigerating and Air-Conditioning Engineers Inc. Atlanta, GA.
true
.Modelica.Units.SI
.r
, removed set point weights wp
and wd
.
Revised documentation.y_reset_in
.
Refactored to internally implement the derivative block.yMax
from unspecified to 1
and yMin
from -yMax
to 0
.xd_start
that was
used to initialize the state of the derivative term. This state is now initialized
based on the requested initial output yd_start
which is a new parameter
with a default of 0
.
Also, removed the parameters y_start
and initType
because
the initial output of the controller can be set by using xi_start
and yd_start
.
This is a non-backward compatible change, made to simplify the controller through
the removal of options that can be realized differently and are hardly ever used.
This refactoring also removes the parameter strict
that
was used in the output limiter. The new implementation enforces a strict check by default.k
.homotopyType=NoHomotopy
.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.strict=true
in order to avoid events
when the controller saturates.
This is for issue 433.