Buildings.Controls.OBC.Utilities

Package with utility functions

Information

This package contains utility blocks, base classes and validation models for the OpenBuildingControl (OBC) library.

Package Content

Name Description
Buildings.Controls.OBC.Utilities.OptimalStart OptimalStart Block that outputs the optimal start time for an HVAC system before occupancy
Buildings.Controls.OBC.Utilities.SetPoints SetPoints Package with blocks for setpoint resets
Buildings.Controls.OBC.Utilities.Validation Validation Collection of validation models
Buildings.Controls.OBC.Utilities.BaseClasses BaseClasses Package with base classes

Buildings.Controls.OBC.Utilities.OptimalStart Buildings.Controls.OBC.Utilities.OptimalStart

Block that outputs the optimal start time for an HVAC system before occupancy

Buildings.Controls.OBC.Utilities.OptimalStart

Information

This block predicts the shortest time for an HVAC system to meet the occupied setpoint prior to the scheduled occupancy. The block requires inputs of zone temperature, occupied zone setpoint(s) and next occupancy. The two outputs are the optimal start duration tOpt and the optimal start on signal optOn for the HVAC system.

The block estimates the thermal mass of a zone using its measured air temperature gradient with respect to time. Once the temperature slope of a zone is known, the optimal start time can be calculated by the difference between the zone temperature and the occupied setpoint divided by the temperature slope, assuming the zone responds as if all thermal mass were concentrated in the room air.

The temperature slope is self-tuned based on past data. The moving average of the temperature slope of the past nDay days is calculated and used for the prediction of the optimal start time in the current day.

Parameters

The parameter nDay is used to compute the moving average of the temperature slope; the first n days of simulation is therefore used to initialize the block.

The parameter tOptMax is the maximum allowed optimal start time.

The block includes two hysteresis parameters uLow and uHigh. The parameter uLow is used to determine if the zone temperature reaches the setpoint. The algorithm assumes that the zone temperature has reached the setpoint if TSetZonHea-TZon ≤ uLow for a heating system, or TZon-TSetZonCoo ≤ uLow for a cooling system, where TSetZonHea denotes the zone heating setpoint during occupancy, TSetZonCoo denotes the zone cooling setpoint during occupancy, and TZon denotes the zone temperature. The parameter uHigh is used by the algorithm to determine if there is a need to start the HVAC system prior to occupancy. If TSetZonHea-TZon ≤ uHigh for heating case or TZon-TSetZonCoo ≤ uHigh for cooling case, then there is no need for the system to start before the occupancy.

The optimal start is only active (i.e., the optimal start on signal optOn becomes true) if the optimal start time is larger than the parameter thrOptOn.

Configuration for HVAC systems

The block can be used for heating system only or cooling system only or for both heating and cooling system. The two parameters computeHeating and computeCooling are used to configure the block for these three scenarios.

The block calculates the optimal start time separately for heating and cooling systems. The base class Buildings.Controls.OBC.Utilities.BaseClasses.OptimalStartCalculation is used for the calculation.

Algorithm

The algorithm is as follows:

Step 1: Calculate temeperature slope TSlo

Once the HVAC system is started, a timer records the time duration Δt for the zone temperature to reach the setpoint. At the time when the timer starts, the zone temperature TSam1 is sampled. The temperature slope is approximated using the equation TSlo = |TSetZonOcc-TSam1|/Δt, where TSetZonOcc is the occupied zone setpoint. Note that if Δt is greater than the maximum optimal start time tOptMax, then tOptMax is used instead of Δt. This is to avoid corner cases where the setpoint is never reached, e.g., the HVAC system is undersized, or there is a steady-state error associated with the HVAC control.

Step 2: Calculate temperature slope moving average TSloMa

After computing the temperature slope of each day, the moving average of the temperature slope TSloMa during the previous nDay days is calculated. Please refer to Buildings.Controls.OBC.CDL.Discrete.TriggeredMovingMean for details about the moving average algorithm.

Step 3: Calculate optimal start time tOpt

Each day at a certain time before the occupancy, the algorithm takes another sample of the zone temperature, denoted as TSam2. The sample takes place tOptMax prior to occupancy start time.

The optimal start time is then calculated as tOpt = |TSetZonOcc-TSam2|/TSloMa.

Validation

Validation models can be found in the package Buildings.Controls.OBC.Utilities.Validation.

Parameters

TypeNameDefaultDescription
RealtOptMax10800Maximum optimal start time [s]
IntegernDay3Number of previous days used to compute the optimal start up time
BooleancomputeHeatingfalseSet to true to compute optimal start for heating
BooleancomputeCoolingfalseSet to true to compute optimal start for cooling
RealuLow0Threshold to determine if the zone temperature reaches the occupied setpoint, must be a non-negative number [K]
RealuHigh0.5Threshold to determine the need to start the HVAC system before occupancy, must be greater than uLow [K]
RealthrOptOn60Threshold time, optimal start on signal becomes true when tOpt larger than thrOptOn [s]

Connectors

TypeNameDescription
input RealInputTSetZonHeaZone heating setpoint temperature during occupancy [K]
input RealInputTZonZone temperature [K]
input RealInputTSetZonCooZone cooling setpoint temperature during occupancy [K]
input RealInputtNexOccTime until next occupancy [s]
output RealOutputtOptOptimal start time duration of HVAC system [s]
output BooleanOutputoptOnOutputs true if the HVAC system remains in the optimal start period

Modelica definition

block OptimalStart "Block that outputs the optimal start time for an HVAC system before occupancy" parameter Real tOptMax( final quantity="Time", final unit="s", displayUnit="h", final min=0, max=21600)=10800 "Maximum optimal start time"; parameter Integer nDay( min=1)=3 "Number of previous days used to compute the optimal start up time"; parameter Boolean computeHeating=false "Set to true to compute optimal start for heating"; parameter Boolean computeCooling=false "Set to true to compute optimal start for cooling"; parameter Real uLow( final quantity="TemperatureDifference", final unit="K", final min=0)=0 "Threshold to determine if the zone temperature reaches the occupied setpoint, must be a non-negative number"; parameter Real uHigh( final quantity="TemperatureDifference", final unit="K", final min=0)=0.5 "Threshold to determine the need to start the HVAC system before occupancy, must be greater than uLow"; parameter Real thrOptOn( final quantity="Time", final unit="s", displayUnit="h", final min=0, max=10800)=60 "Threshold time, optimal start on signal becomes true when tOpt larger than thrOptOn"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TSetZonHea( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC", min=200) if computeHeating "Zone heating setpoint temperature during occupancy"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TZon( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC", min=200) "Zone temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TSetZonCoo( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC", min=200) if computeCooling "Zone cooling setpoint temperature during occupancy"; Buildings.Controls.OBC.CDL.Interfaces.RealInput tNexOcc( final quantity="Time", final unit="s", displayUnit="h") "Time until next occupancy"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput tOpt( final quantity="Time", final unit="s", displayUnit="h") "Optimal start time duration of HVAC system"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput optOn "Outputs true if the HVAC system remains in the optimal start period"; Buildings.Controls.OBC.Utilities.BaseClasses.OptimalStartCalculation optHea( final tOptMax=tOptMax, final thrOptOn=thrOptOn, final nDay=nDay, final uLow=uLow, final uHigh=uHigh) if computeHeating "Optimal start time for heating system"; Buildings.Controls.OBC.Utilities.BaseClasses.OptimalStartCalculation optCoo( final tOptMax=tOptMax, final thrOptOn=thrOptOn, final nDay=nDay, final uLow=uLow, final uHigh=uHigh) if computeCooling "Optimal start time for cooling system"; CDL.Continuous.GreaterThreshold hysSta( t=60, h=60) "Hysteresis to activate the optimal start boolean output"; protected Buildings.Controls.OBC.CDL.Continuous.Max max "Get the maximum optimal start time "; Buildings.Controls.OBC.CDL.Continuous.AddParameter addPar( p=-tOptMax, k=1) "Maximum optimal start time"; Buildings.Controls.OBC.CDL.Logical.Or or2 "Get the optimal start boolean output"; Buildings.Controls.OBC.CDL.Continuous.Add dTHea( final k1=+1, final k2=-1) if computeHeating "Temperature difference between heating setpoint and zone temperature"; Buildings.Controls.OBC.CDL.Continuous.Add dTCoo( final k1=+1, final k2=-1) if computeCooling "Temperature difference between zone temperature and cooling setpoint"; Buildings.Controls.OBC.CDL.Logical.FallingEdge falEdg "Stop calculation"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con2( final k=0) if not computeHeating "Becomes effective when optimal start is only for heating"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con1( final k=0) if not computeCooling "Becomes effective when optimal start is only for cooling"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant con( final k=false) if not computeHeating "Becomes effective when optimal start is only for heating"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant con3( final k=false) if not computeCooling "Becomes effective when optimal start is only for cooling"; equation connect(TSetZonCoo,dTCoo.u2); connect(TZon,dTCoo.u1); connect(TZon,dTHea.u2); connect(TSetZonHea,dTHea.u1); connect(max.y,tOpt); connect(con2.y,max.u1); connect(con1.y,max.u2); connect(dTCoo.y,optCoo.TDif); connect(dTHea.y,optHea.TDif); connect(tNexOcc,addPar.u); connect(tNexOcc,optHea.tNexOcc); connect(optCoo.tOpt,max.u2); connect(optHea.tOpt,max.u1); connect(tNexOcc,optCoo.tNexOcc); connect(falEdg.y,optHea.staCal); connect(falEdg.y,optCoo.staCal); connect(or2.y,optOn); connect(con.y,or2.u1); connect(con3.y,or2.u2); connect(optCoo.optOn,or2.u2); connect(optHea.optOn,or2.u1); connect(falEdg.u,hysSta.y); connect(addPar.y,hysSta.u); end OptimalStart;