Buildings.Controls.Continuous
Package with models for discrete time controls
Information
This package contains component models for continuous time controls. For additional models, see also Modelica.Blocks.Discrete.Extends from Modelica.Icons.Package (Icon for standard packages).
Package Content
Name | Description |
---|---|
LimPID | P, PI, PD, and PID controller with limited output, anti-windup compensation and setpoint weighting |
NumberOfRequests | Outputs the number of signals that are above/below a certain threshold |
OffTimer | Records the time since the input changed to false |
PIDHysteresis | PID controller with anti-windup, output limiter and output hysteresis |
PIDHysteresisTimer | PID controller with anti-windup, hysteresis and timer to prevent short cycling |
SignalRanker | Ranks output signals such that y[i] >= y[i+1] |
Examples | Collection of models that illustrate model use and test models |
Validation | Collection of validation models |
Buildings.Controls.Continuous.LimPID
P, PI, PD, and PID controller with limited output, anti-windup compensation and setpoint weighting
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 signaltrigger
is enabled. Whenever the value of this input changes fromfalse
totrue
, the controller output is reset by settingy
to the value of the parametery_reset
. -
If
reset = Buildings.Types.Reset.Input
, then a boolean input signaltrigger
and a real input signaly_reset_in
are enabled. Whenever the value oftrigger
changes fromfalse
totrue
, the controller output is reset by setting the value ofy
toy_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.
Extends from Modelica.Blocks.Interfaces.SVcontrol (Single-Variable continuous controller).
Parameters
Type | Name | Default | Description |
---|---|---|---|
SimpleController | controllerType | Modelica.Blocks.Types.Simple... | Type of controller |
Real | k | 1 | Gain of controller |
Time | Ti | 0.5 | Time constant of Integrator block [s] |
Time | Td | 0.1 | Time constant of Derivative block [s] |
Real | yMax | 1 | Upper limit of output |
Real | yMin | 0 | Lower limit of output |
Real | wp | 1 | Set-point weight for Proportional block (0..1) |
Real | wd | 0 | Set-point weight for Derivative block (0..1) |
Real | Ni | 0.9 | Ni*Ti is time constant of anti-windup compensation |
Real | Nd | 10 | The higher Nd, the more ideal the derivative block |
Boolean | reverseActing | true | Set to true for reverse acting, or false for direct acting control action |
Initialization | |||
InitPID | initType | Modelica.Blocks.Types.InitPI... | Type of initialization (1: no init, 2: steady state, 3: initial state, 4: initial output) |
Real | xi_start | 0 | Initial or guess value value for integrator output (= integrator state) |
Real | xd_start | 0 | Initial or guess value for state of derivative block |
Real | y_start | 0 | Initial value of output |
Integrator reset | |||
Reset | reset | Buildings.Types.Reset.Disabled | Type of controller output reset |
Real | y_reset | xi_start | Value to which the controller output is reset if the boolean trigger has a rising edge, used if reset == Buildings.Types.Reset.Parameter |
Advanced | |||
Boolean | strict | true | = true, if strict limits with noEvent(..) |
Connectors
Type | Name | Description |
---|---|---|
input RealInput | u_s | Connector of setpoint input signal |
input RealInput | u_m | Connector of measurement input signal |
output RealOutput | y | Connector of actuator output signal |
input BooleanInput | trigger | Resets the controller output when trigger becomes true |
input RealInput | y_reset_in | Input signal for state to which integrator is reset, enabled if reset = Buildings.Types.Reset.Input |
Modelica definition
Buildings.Controls.Continuous.NumberOfRequests
Outputs the number of signals that are above/below a certain threshold
Information
Block that outputs the number of inputs that exceed a threshold.
The parameter kind
is used to determine the kind of the
inequality. The table below shows the allowed settings.
Value of parameter kind |
Output signal incremented by 1 for each i ∈ {1, ..., nin} if |
---|---|
0 | u[i] > threShold |
1 | u[i] ≥ threShold |
2 | u[i] ≤ threShold |
3 | u[i] < threShold |
This model may be used to check how many rooms exceed a temperature threshold.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Parameters
Type | Name | Default | Description |
---|---|---|---|
Integer | nin | Number of inputs | |
Real | threShold | 0 | Threshold |
Integer | kind | Set to 0 for u>threShold, to 1 for >=, to 2 for <= or to 3 for < |
Connectors
Type | Name | Description |
---|---|---|
output IntegerOutput | y | Number of input signals that violate the threshold |
input RealInput | u[nin] | Input signals |
Modelica definition
Buildings.Controls.Continuous.OffTimer
Records the time since the input changed to false
Information
Timer that starts at the initial time with a value of 0,
and gets reset each time the input signal switches to false
.
For example, if the simulation starts at t = 10 and at t=11,
the input becomes false
, then the timer outputs
y=t-10 for t < 11, and y=t-11 afterwards, unless
the input becomes false again.
Extends from Modelica.Blocks.Icons.PartialBooleanBlock (Basic graphical layout of logical block).
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u | Connector of Boolean input signal |
output RealOutput | y | Connector of Real output signal |
Modelica definition
Buildings.Controls.Continuous.PIDHysteresis
PID controller with anti-windup, output limiter and output hysteresis
Information
Block of a controller for set point tracking with a hysteresis element that switches the controller on and off.
If the controller is off, and the control error becomes larger than eOn
, then
the controller switches to on and remains on until the control error is smaller than eOff
.
When the controller is on, the set point tracking can be done using a P-, PI-, or PID-controller.
In its off-mode, the control output is zero. Thus, the parameters yMin
and yMax
are
used to constrain the output of the controller during its on mode only. This can be used, for
example, to modulate a device between 0.3 and 1.0, and switch it to off when the control error
is small enough.
Extends from Modelica.Blocks.Interfaces.SVcontrol (Single-Variable continuous controller).
Parameters
Type | Name | Default | Description |
---|---|---|---|
Hysteresis | |||
Real | eOn | 1 | if off and control error > eOn, switch to set point tracking |
Real | eOff | -eOn | if on and control error < eOff, set y=0 |
Boolean | pre_y_start | false | Value of hysteresis output at initial time |
Set point tracking | |||
SimpleController | controllerType | Modelica.Blocks.Types.Simple... | Type of controller |
Real | k | 1 | Gain of controller |
Time | Ti | Time constant of Integrator block [s] | |
Time | Td | Time constant of Derivative block [s] | |
Real | yMax | 1 | Upper limit of output |
Real | yMin | 0 | Lower limit of output |
Real | wp | 1 | Set-point weight for Proportional block (0..1) |
Real | wd | 0 | Set-point weight for Derivative block (0..1) |
Real | Ni | 0.9 | Ni*Ti is time constant of anti-windup compensation |
Real | Nd | 10 | The higher Nd, the more ideal the derivative block |
Boolean | reverseActing | true | Set to true for reverse acting, or false for direct acting control action |
Initialization | |||
InitPID | initType | Modelica.Blocks.Types.InitPI... | Type of initialization (1: no init, 2: steady state, 3: initial state, 4: initial output) |
Real | xi_start | 0 | Initial or guess value value for integrator output (= integrator state) |
Real | xd_start | 0 | Initial or guess value for state of derivative block |
Real | y_start | 0 | Initial value of output |
Advanced | |||
Boolean | strict | true | = true, if strict limits with noEvent(..) |
Connectors
Type | Name | Description |
---|---|---|
input RealInput | u_s | Connector of setpoint input signal |
input RealInput | u_m | Connector of measurement input signal |
output RealOutput | y | Connector of actuator output signal |
Modelica definition
Buildings.Controls.Continuous.PIDHysteresisTimer
PID controller with anti-windup, hysteresis and timer to prevent short cycling
Information
Block of a controller for set point tracking with a hysteresis element that switches the controller on and off, and a timer that prevents the controller to short cycle.
The controller is similar to
Buildings.Controls.Continuous.PIDHysteresis but in addition,
it has a timer that prevents the controller from switching to on
too fast. When the controller switches off, the timer starts and
avoids the controller from switching on until minOffTime
seconds elapsed.
Extends from Modelica.Blocks.Interfaces.SVcontrol (Single-Variable continuous controller).
Parameters
Type | Name | Default | Description |
---|---|---|---|
On/off controller | |||
Real | minOffTime | 600 | Minimum time that devices needs to be off before it can run again |
Real | eOn | 1 | if off and control error > eOn, switch to set point tracking |
Real | eOff | -eOn | if on and control error < eOff, set y=0 |
Boolean | pre_y_start | false | Value of hysteresis output at initial time |
Set point tracking | |||
SimpleController | controllerType | Modelica.Blocks.Types.Simple... | Type of controller |
Real | k | 1 | Gain of controller |
Time | Ti | Time constant of Integrator block [s] | |
Time | Td | Time constant of Derivative block [s] | |
Real | yMax | 1 | Upper limit of modulating output |
Real | yMin | 0.3 | Lower limit of modulating output (before switch to 0) |
Real | wp | 1 | Set-point weight for Proportional block (0..1) |
Real | wd | 0 | Set-point weight for Derivative block (0..1) |
Real | Ni | 0.9 | Ni*Ti is time constant of anti-windup compensation |
Real | Nd | 10 | The higher Nd, the more ideal the derivative block |
Boolean | reverseActing | true | Set to true for reverse acting, or false for direct acting control action |
Initialization | |||
InitPID | initType | Modelica.Blocks.Types.InitPI... | Type of initialization (1: no init, 2: steady state, 3: initial state, 4: initial output) |
Real | xi_start | 0 | Initial or guess value value for integrator output (= integrator state) |
Real | xd_start | 0 | Initial or guess value for state of derivative block |
Real | y_start | 0 | Initial value of output |
Advanced | |||
Boolean | strict | true | = true, if strict limits with noEvent(..) |
Connectors
Type | Name | Description |
---|---|---|
input RealInput | u_s | Connector of setpoint input signal |
input RealInput | u_m | Connector of measurement input signal |
output RealOutput | y | Connector of actuator output signal |
output RealOutput | tOn | Time since boiler switched on |
output RealOutput | tOff | Time since boiler switched off |
output BooleanOutput | on | Outputs true if boiler is on |
Modelica definition
Buildings.Controls.Continuous.SignalRanker
Ranks output signals such that y[i] >= y[i+1]
Information
Block that sorts the input signal u[:]
such that the output
signal satisfies y[i] >= y[i+1]
for all i=1, ..., nin-1
.
This block may for example be used in a variable air volume flow controller to access the position of the dampers that are most open.
Extends from Modelica.Blocks.Interfaces.MIMO (Multiple Input Multiple Output continuous control block).
Parameters
Type | Name | Default | Description |
---|---|---|---|
Integer | nin | 1 | Number of inputs |
Integer | nout | nin | Number of outputs |
Connectors
Type | Name | Description |
---|---|---|
input RealInput | u[nin] | Connector of Real input signals |
output RealOutput | y[nout] | Connector of Real output signals |
Modelica definition
Buildings.Controls.Continuous.LimPID.Limiter
Limit the range of a signal
Information
Extends from Modelica.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).
Parameters
Type | Name | Default | Description |
---|---|---|---|
Real | uMax | Upper limits of input signals | |
Real | uMin | -uMax | Lower limits of input signals |
Advanced | |||
Boolean | strict | false | = true, if strict limits with noEvent(..) |
Dummy | |||
Boolean | limitsAtInit | true | Has no longer an effect and is only kept for backwards compatibility (the implementation uses now the homotopy operator) |
Connectors
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
output RealOutput | y | Connector of Real output signal |