.Buildings.Controls.OBC.Utilities.PIDWithInputGains

Information

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

This block is identical to Buildings.Controls.OBC.CDL.Reals.PIDWithReset, except that the controller gains k, Ti and Td are inputs rather than parameters.

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.

Reverse or direct action

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,

If reverseAction=false, then the error e above is multiplied by -1.

Anti-windup compensation

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.

Reset of the controller output

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.

Approximation of the derivative term

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.

Guidance for tuning the control gains

The parameters of the controller can be manually adjusted by performing closed loop tests (= controller + plant connected together) and using the following strategy:

  1. Set very large limits, e.g., set ymax = 1000.
  2. Select a P-controller and manually enlarge the parameter k (the total gain of the controller) until the closed-loop response cannot be improved any more.
  3. Select a PI-controller and manually adjust the parameters 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.
  4. If you want to make the reaction of the control loop faster (but probably less robust against disturbances and measurement noise) select a PID-controller and manually adjust parameters k, Ti, Td (time constant of derivative block).
  5. Set the limits yMax and yMin according to your specification.
  6. Perform simulations such that the output of the PID controller goes in its limits. Tune 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.

References

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

Revisions


Generated at 2024-12-27T19:26:12Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos