.Buildings.Examples.Tutorial.CDL.System2

Information

In this step, we added the control architecture. How the control is partitioned into various subcontrollers depends usually on the need to avoid communication over the network and on how control is distributed to different field controllers. Here, we used the four controllers indicated by the shaded background in the figure of Buildings.Examples.Tutorial.CDL. One controller switches the overall system on and off, one switches the boiler on and off, one tracks the supply water temperature to the room and one tracks the return water temperature that is fed to the boiler.

Implementation

This model was built as follows:

  1. First, we determined what functionality should be implemented in which controller, and what the inputs and outputs of the controllers are. In this example, we used these controllers:

  2. To organize our code, we created package that we called Controls.

  3. Next, we added the open loop controller for the boiler return water temperature. This controller is implemented in Buildings.Examples.Tutorial.CDL.Controls.OpenLoopBoilerReturn. To implement it, we created a Modelica block, and added an input, using a Buildings.Controls.OBC.CDL.Interfaces.RealInput, called it TRet for the measured return water temperature, and a Buildings.Controls.OBC.CDL.Interfaces.RealOutput for the valve control signal, which we called yVal.

    To output the valve control signal, which we set for now to a constant value of 1, we used an instance of Buildings.Controls.OBC.CDL.Reals.Sources.Constant, set its parameter to 1, and connected it to the output.

    At this stage, because the control is open loop, we leave the input of the controller unconnected.

    Looking at the Modelica file shows that we also added documentation in an info section, a defaultComponentName, as well as graphical elements so that it is easily distinguishable in a schematic diagram. We also added the unit and displayUnit attributes.

    In the next step of this tutorial, we will provide an actual implementation of the controller. To better distinguish the open loop controller from the closed loop controller, we color the icon of open loop controllers grey, and will change this color to white when we implement the actual control logic.

  4. We did a similar process to add the other three open loop controllers. As before, we added all inputs and outputs, and set the outputs to a constant.

  5. Lastly, we instantiated these four controllers in the system model. Because the pumps and the boiler take as a control input a real-valued signal, we used Buildings.Controls.OBC.CDL.Conversions.BooleanToReal to convert between the boolean-valued signal and the real-valued inputs of these components. Whether this conversion is part of the controller or done outside the controller is an individual design decision.

Exercise

Create a model, such as this model. To do so,

  1. Copy Buildings.Examples.Tutorial.CDL.System1.

  2. Implement all four open loop controllers.

  3. Delete the constant control inputs, instantiate the open loop controllers, convert the signal as needed from Boolean to Real, and connect the control inputs and outputs.

Simulate the system to verify that you get the response shown below. As we have not changed any of the control logic, simulating the system should give the same response as for Buildings.Examples.Tutorial.CDL.System1.

Open loop temperatures.

Revisions


Generated at 2024-04-28T18:16:21Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos