Buildings.Examples.Tutorial.CDL.Controls

Package with the controllers used in the tutorial

Information

Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).

Package Content

Name Description
Buildings.Examples.Tutorial.CDL.Controls.BoilerReturn BoilerReturn Control for boiler return
Buildings.Examples.Tutorial.CDL.Controls.EquipmentOnOff EquipmentOnOff Controller for equipment on/off control
Buildings.Examples.Tutorial.CDL.Controls.OpenLoopBoilerReturn OpenLoopBoilerReturn Open loop controller for boiler return
Buildings.Examples.Tutorial.CDL.Controls.OpenLoopEquipmentOnOff OpenLoopEquipmentOnOff Open loop controller for equipment on/off control
Buildings.Examples.Tutorial.CDL.Controls.OpenLoopRadiatorSupply OpenLoopRadiatorSupply Open loop controller for mixing valve in radiator loop
Buildings.Examples.Tutorial.CDL.Controls.OpenLoopSystemOnOff OpenLoopSystemOnOff Open loop controller for system on/off
Buildings.Examples.Tutorial.CDL.Controls.RadiatorSupply RadiatorSupply Controller for mixing valve in radiator loop
Buildings.Examples.Tutorial.CDL.Controls.SystemOnOff SystemOnOff Controller for system on/off
Buildings.Examples.Tutorial.CDL.Controls.Validation Validation  

Buildings.Examples.Tutorial.CDL.Controls.BoilerReturn Buildings.Examples.Tutorial.CDL.Controls.BoilerReturn

Control for boiler return

Buildings.Examples.Tutorial.CDL.Controls.BoilerReturn

Information

Controller that takes as an input the boiler return water temperature TRet and outputs the valve control signal yVal. The valve control signal is computed using a PI-controller that tracks a constant set point of TSet.

Parameters

TypeNameDefaultDescription
RealTSet333.15Set point for boiler temperature [K]
Realk0.1Gain of controller
TimeTi120Time constant of integrator block [s]

Connectors

TypeNameDescription
input RealInputTRetReturn water temperature to boiler [K]
output RealOutputyValValve control signal [1]

Modelica definition

block BoilerReturn "Control for boiler return" parameter Real TSet( final unit="K", displayUnit="degC") = 333.15 "Set point for boiler temperature"; parameter Real k=0.1 "Gain of controller"; parameter Modelica.SIunits.Time Ti=120 "Time constant of integrator block"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TRet( final unit="K", displayUnit="degC") "Return water temperature to boiler"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yVal( final unit="1") "Valve control signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant T( final k=TSet) "Set point temperature"; Buildings.Controls.OBC.CDL.Continuous.PID conPID( final k=k, final Ti=Ti, reverseActing=false) "Controller for valve in boiler loop"; equation connect(conPID.y, yVal); connect(conPID.u_s, T.y); connect(TRet, conPID.u_m); end BoilerReturn;

Buildings.Examples.Tutorial.CDL.Controls.EquipmentOnOff Buildings.Examples.Tutorial.CDL.Controls.EquipmentOnOff

Controller for equipment on/off control

Buildings.Examples.Tutorial.CDL.Controls.EquipmentOnOff

Information

Controller that takes as an input the boiler water temperature TBoi and the system on command onSys, and outputs the on command for the pumps onPum and the boiler onBoi.

The pump on command is the same as the system on command. The boiler is switched on if the boiler temperature TBoi falls below 70°C and if onSys=true, and it switches off if either TBoi exceeds 90°C or if onSys=false.

Connectors

TypeNameDescription
input RealInputTBoiBoiler temperature [K]
input BooleanInputonSysSystem on command
output BooleanOutputonPumPump on command
output BooleanOutputonBoiBoiler on command

Modelica definition

block EquipmentOnOff "Controller for equipment on/off control" Buildings.Controls.OBC.CDL.Interfaces.RealInput TBoi( final unit="K", displayUnit="degC") "Boiler temperature"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput onSys "System on command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput onPum "Pump on command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput onBoi "Boiler on command"; Buildings.Controls.OBC.CDL.Logical.And and1 "And operator to switch boiler on based on temperature and system on command"; Buildings.Controls.OBC.CDL.Logical.Not not1 "Negation of output signal, because boiler should be off if temperature exceed uHigh"; Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys( uHigh=273.15 + 90, uLow=273.15 + 70) "Hysteresis for on/off of boiler"; equation connect(TBoi, hys.u); connect(hys.y, not1.u); connect(onSys, onPum); connect(and1.u1, not1.y); connect(and1.u2, onSys); connect(and1.y, onBoi); end EquipmentOnOff;

Buildings.Examples.Tutorial.CDL.Controls.OpenLoopBoilerReturn Buildings.Examples.Tutorial.CDL.Controls.OpenLoopBoilerReturn

Open loop controller for boiler return

Buildings.Examples.Tutorial.CDL.Controls.OpenLoopBoilerReturn

Information

Open loop controller that outputs a constant control signal for the valve of the boiler return.

Connectors

TypeNameDescription
input RealInputTRetReturn water temperature to boiler [K]
output RealOutputyValValve control signal [1]

Modelica definition

block OpenLoopBoilerReturn "Open loop controller for boiler return" Buildings.Controls.OBC.CDL.Interfaces.RealInput TRet( final unit="K", displayUnit="degC") "Return water temperature to boiler"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yVal( final unit="1") "Valve control signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con(k=1) "Constant valve control signal"; equation connect(con.y, yVal); end OpenLoopBoilerReturn;

Buildings.Examples.Tutorial.CDL.Controls.OpenLoopEquipmentOnOff Buildings.Examples.Tutorial.CDL.Controls.OpenLoopEquipmentOnOff

Open loop controller for equipment on/off control

Buildings.Examples.Tutorial.CDL.Controls.OpenLoopEquipmentOnOff

Information

Open loop controller that outputs a constant control signal for the system on command.

Connectors

TypeNameDescription
input RealInputTBoiBoiler temperature [K]
input BooleanInputonSysSystem on command
output BooleanOutputonPumPump on command
output BooleanOutputonBoiBoiler on command

Modelica definition

block OpenLoopEquipmentOnOff "Open loop controller for equipment on/off control" Buildings.Controls.OBC.CDL.Interfaces.RealInput TBoi( final unit="K", displayUnit="degC") "Boiler temperature"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput onSys "System on command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput onPum "Pump on command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput onBoi "Boiler on command"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant con(k=true) "Constant control signal"; equation connect(con.y, onBoi); connect(con.y, onPum); end OpenLoopEquipmentOnOff;

Buildings.Examples.Tutorial.CDL.Controls.OpenLoopRadiatorSupply Buildings.Examples.Tutorial.CDL.Controls.OpenLoopRadiatorSupply

Open loop controller for mixing valve in radiator loop

Buildings.Examples.Tutorial.CDL.Controls.OpenLoopRadiatorSupply

Information

Open loop controller that outputs a constant control signal for the mixing valve of the radiator loop.

Connectors

TypeNameDescription
input RealInputTRooRoom air temperature [K]
input RealInputTSupMeasured supply water temperature [K]
output RealOutputyValValve control signal [1]

Modelica definition

block OpenLoopRadiatorSupply "Open loop controller for mixing valve in radiator loop" Buildings.Controls.OBC.CDL.Interfaces.RealInput TRoo( final unit="K", displayUnit="degC") "Room air temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TSup( final unit="K", displayUnit="degC") "Measured supply water temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yVal( final unit="1") "Valve control signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con(k=1) "Constant valve control signal"; equation connect(con.y, yVal); end OpenLoopRadiatorSupply;

Buildings.Examples.Tutorial.CDL.Controls.OpenLoopSystemOnOff Buildings.Examples.Tutorial.CDL.Controls.OpenLoopSystemOnOff

Open loop controller for system on/off

Buildings.Examples.Tutorial.CDL.Controls.OpenLoopSystemOnOff

Information

Open loop controller that outputs a constant control signal for the system on command.

Connectors

TypeNameDescription
input RealInputTOutOutdoor air temperature [K]
input RealInputTRooRoom air temperature [K]
output BooleanOutputonSysSystem on command

Modelica definition

block OpenLoopSystemOnOff "Open loop controller for system on/off" Buildings.Controls.OBC.CDL.Interfaces.RealInput TOut( final unit="K", displayUnit="degC") "Outdoor air temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TRoo( final unit="K", displayUnit="degC") "Room air temperature"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput onSys "System on command"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant con(k=true) "Constant control signal"; equation connect(con.y, onSys); end OpenLoopSystemOnOff;

Buildings.Examples.Tutorial.CDL.Controls.RadiatorSupply Buildings.Examples.Tutorial.CDL.Controls.RadiatorSupply

Controller for mixing valve in radiator loop

Buildings.Examples.Tutorial.CDL.Controls.RadiatorSupply

Information

Controller that takes as an input the room air temperature TRoo and the supply water temperature TSup, and outputs the commanded mixing valve position yVal.

Based on the room air temperature TRoo, and the user adjustable parameters for the minimum supply water temperature TSupMin, the maximum supply water temperature TSupMax and the room air temperature TRooMin at which the supply water temperature is at TSupMax, the controller computes a set point for the supply water temperature. This set point is then used with the measured supply water temperature TSup as an input to a PI-controller that computes the commanded valve position yVal.

Parameters

TypeNameDefaultDescription
RealTSupMin294.15Minimum supply water temperature [K]
RealTSupMax323.15Maximum supply water temperature [K]
RealTRooMin292.15Room air temperature at which supply water temperature is at TSupMax [K]
Realk0.1Gain of controller
TimeTi120Time constant of integrator block [s]

Connectors

TypeNameDescription
input RealInputTRooRoom air temperature [K]
input RealInputTSupMeasured supply water temperature [K]
output RealOutputyValValve control signal [1]

Modelica definition

block RadiatorSupply "Controller for mixing valve in radiator loop" parameter Real TSupMin( final unit="K", displayUnit="degC") = 294.15 "Minimum supply water temperature"; parameter Real TSupMax( final unit="K", displayUnit="degC") = 323.15 "Maximum supply water temperature"; parameter Real TRooMin( final unit="K", displayUnit="degC") = 292.15 "Room air temperature at which supply water temperature is at TSupMax"; parameter Real k=0.1 "Gain of controller"; parameter Modelica.SIunits.Time Ti=120 "Time constant of integrator block"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TRoo( final unit="K", displayUnit="degC") "Room air temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TSup( final unit="K", displayUnit="degC") "Measured supply water temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yVal( final unit="1") "Valve control signal"; Buildings.Controls.OBC.CDL.Continuous.PID conPIDRad( final k=k, final Ti=Ti, final yMax=1, final yMin=0, controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI) "Controller for valve in radiator loop"; Buildings.Controls.OBC.CDL.Continuous.Line TSetSup "Setpoint for supply water temperature"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant TMinSup( final k=TSupMin) "Minimum heating supply temperature"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant TMaxSup( final k=TSupMax) "Maximum heating supply temperature"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant TMinRoo( final k=TRooMin) "Minimum room air temperature"; equation connect(TMinSup.y,TSetSup. x2); connect(TMinSup.y,TSetSup. f2); connect(TMaxSup.y,TSetSup. f1); connect(TSetSup.x1,TMinRoo. y); connect(conPIDRad.u_s,TSetSup. y); connect(TSetSup.u, TRoo); connect(TSup, conPIDRad.u_m); connect(conPIDRad.y, yVal); end RadiatorSupply;

Buildings.Examples.Tutorial.CDL.Controls.SystemOnOff Buildings.Examples.Tutorial.CDL.Controls.SystemOnOff

Controller for system on/off

Buildings.Examples.Tutorial.CDL.Controls.SystemOnOff

Information

Controller that takes as an input the outside air temperature TOut and the room air temperature TRoo, and outputs the system on command onSys.

The system on command is true if both conditions are satisfied: The outside air temperature is below a limit of TOutLow(=16°C, adjustable) and the room air temperature is below TRooSet-dTRoo/2, where TRooSet is the room air temperature setpoint (=20.5°C, adjustable) and dTRoo is the deadband (=1 Kelvin, adjustable). Otherwise, the system on command is false.

Parameters

TypeNameDefaultDescription
RealTRooSet293.65Room air temperature set point [K]
RealdTRoo1Room air temperature dead band [K]
RealTOutLow289.15Outdoor temperature below which system is allowed to switch on [K]

Connectors

TypeNameDescription
input RealInputTOutOutdoor air temperature [K]
input RealInputTRooRoom air temperature [K]
output BooleanOutputonSysSystem on command

Modelica definition

block SystemOnOff "Controller for system on/off" parameter Real TRooSet( final unit="K", displayUnit="degC") = 293.65 "Room air temperature set point"; parameter Real dTRoo( min=0.5, final unit="K") = 1 "Room air temperature dead band"; parameter Real TOutLow( final unit="K", displayUnit="degC") = 289.15 "Outdoor temperature below which system is allowed to switch on"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TOut( final unit="K", displayUnit="degC") "Outdoor air temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TRoo( final unit="K", displayUnit="degC") "Room air temperature"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput onSys "System on command"; Buildings.Controls.OBC.CDL.Logical.OnOffController onTOut(bandwidth=1) "On/off control based on outside air temperature"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant TSetOut(k=TOutLow + 0.5) "Set point for outdoor air temperature plus half the dead band"; Buildings.Controls.OBC.CDL.Logical.OnOffController onTRoo(bandwidth=1) "On/off control based on room air temperature"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant TSetRoo(k=TRooSet) "Set point for room air temperature plus half the dead band"; Buildings.Controls.OBC.CDL.Logical.And and1 "And operator to switch boiler on based on temperature and system on command"; equation connect(onTOut.u, TOut); connect(TSetOut.y, onTOut.reference); connect(onTRoo.u, TRoo); connect(TSetRoo.y, onTRoo.reference); connect(and1.u2, onTRoo.y); connect(and1.y, onSys); connect(onTOut.y, and1.u1); end SystemOnOff;