In this step, we added the controller for the boiler return water temperature.
This model was built as follows:
First, we copied the controller Buildings.Examples.Tutorial.CDL.Controls.OpenLoopBoilerReturn to create the block Buildings.Examples.Tutorial.CDL.Controls.BoilerReturn.
In this new block, we used a constant output signal Buildings.Controls.OBC.CDL.Reals.Sources.Constant and a PID controller Buildings.Controls.OBC.CDL.Reals.PID, which we configured as a PI-controller.
We set the controller logic to reverse action. That is because the tracking error is conventionally computed as the difference between the set point value and the sensed value. In our example, if the return temperature is lower than the set point, i.e., if the tracking error is positive, the valve control signal must tend toward zero, i.e., the valve bypass port must open. That means that the unbounded control signal must tend toward negative values so that the bounded output signal tends toward its minimum value. Binding a positive tracking error to a negative unbounded control signal or to the minimum value of the output signal requires a reverse action logic.
Additionally we set the proportional gain to 0.1 as then, in absence of the integral action, a control error of 10 Kelvin changes the control output by 1. We set the time constant to 120 seconds, which is about the time it takes to open and close a valve. These values give typically good closed loop performance.
As the control error is in Kelvin, which is typically of the order of 1 to 10, there is no need to normalize the control input. (If pressure were used, it would make sense to divide the measured signal and the set point so that the control error is usually of the order of one, which makes tuning easier.)
To allow this controller to be tuned, we exposed at the top-level the parameters for the set point temperature and the control gains.
While the controller Buildings.Examples.Tutorial.CDL.Controls.BoilerReturn is very simple, for demonstration purposes we also implemented a validation model for this controller. This is done in Buildings.Examples.Tutorial.CDL.Controls.Validation.BoilerReturn. Such validation models help detect implementation errors which may be difficult to diagnose once the controller is used as part of a larger system model. In our experience, implementing small scale validation tests leads to better code and overall faster development as errors are detected early on when they can be corrected quickly. For more information about how to implement a validation model, see the Modelica Buildings Library User Guide.
Create a model, such as this model. To do so,
Implement the controller for the boiler return water temperature.
Make a small unit test to verify that the controller is implemented correctly.
Use this new controller instead of the open loop controller conBoiRet
.
Simulate the system to verify that the valve is controlled to maintain a return water temperature of at least 60°C as shown below.