Buildings.Controls.OBC.Utilities.BaseClasses
Package with base classes
Information
This package contains base classes to construct blocks in Buildings.Controls.OBC.Utilities.
Package Content
Name | Description |
---|---|
OptimalStartCalculation | Base class for the block OptimalStart |
Buildings.Controls.OBC.Utilities.BaseClasses.OptimalStartCalculation
Base class for the block OptimalStart
Information
This base class contains the algorithm for the optimal start calculation. For the description of the algorithm, please refer to the documentation for the block Buildings.Controls.OBC.Utilities.OptimalStart.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Real | tOptMax | tOptMax(final quantity="Time... | Maximum optimal start time [s] |
Real | thrOptOn | thrOptOn(final quantity="Tim... | Threshold time for the output optOn to become true [s] |
Real | tOptDef | tOptDef(final quantity="Time... | Default optimal start time [s] |
Integer | nDay | Number of previous days for averaging the temperature slope | |
Real | uLow | uLow(final quantity="Tempera... | Threshold to determine if the zone temperature reaches the occupied setpoint, should be a non-negative number [K] |
Real | uHigh | uHigh(final quantity="Temper... | Threshold to determine the need to start the HVAC system before occupancy, should be greater than uLow [K] |
Connectors
Type | Name | Description |
---|---|---|
input RealInput | TDif | Zone setpoint temperature during occupancy [K] |
input BooleanInput | staCal | Start calculation |
input RealInput | tNexOcc | Time until next occupancy [s] |
output RealOutput | tOpt | Optimal start time of HVAC system [s] |
output BooleanOutput | optOn | Optimal start boolean output |
Modelica definition
block OptimalStartCalculation
"Base class for the block OptimalStart"
parameter Real tOptMax(
final quantity="Time",
final unit="s") "Maximum optimal start time";
parameter Real thrOptOn(
final quantity="Time",
final unit="s")
"Threshold time for the output optOn to become true";
parameter Real tOptDef(
final quantity="Time",
final unit="s")
"Default optimal start time";
parameter Integer nDay "Number of previous days for averaging the temperature slope";
parameter Real uLow(
final quantity="TemperatureDifference",
final unit="K")
"Threshold to determine if the zone temperature reaches the occupied setpoint,
should be a non-negative number";
parameter Real uHigh(
final quantity="TemperatureDifference",
final unit="K")
"Threshold to determine the need to start the HVAC system before occupancy,
should be greater than uLow";
Buildings.Controls.OBC.CDL.Interfaces.RealInput TDif(
final quantity="TemperatureDifference",
final unit="K")
"Zone setpoint temperature during occupancy";
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput staCal
"Start calculation";
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 of HVAC system";
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput optOn
"Optimal start boolean output";
protected
parameter Real temSloDef(
final quantity="TemperatureSlope",
final unit="K/s") = 1/3600
"Default temperature slope in case of zero division";
Buildings.Controls.OBC.CDL.Discrete.TriggeredMovingMean triMovMea(
final n=nDay)
"Calculate the averaged temperature slope over the past n days";
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler triSam2
"Get the sampled temperature difference at the same time each day";
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler triSam3
"Get the temperature difference when the HVAC system starts";
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con(final k=0)
"Deadband case";
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant defOptTim(
final k=tOptDef)
"Default optimal start time in case of zero division";
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant defTemSlo(
final k=temSloDef)
"Default temperature slope in case of zero division";
Buildings.Controls.OBC.CDL.Logical.Edge edg "HVAC start time";
Buildings.Controls.OBC.CDL.Logical.FallingEdge falEdg
"The instant when the zone temperature reaches setpoint";
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys(
final uLow=uLow,
final uHigh=uHigh)
"Comparing zone temperature with zone setpoint";
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hysOpt(
final pre_y_start=false,
final uHigh=0,
final uLow=-60) "Hysteresis to activate the optimal start";
Buildings.Controls.OBC.CDL.Continuous.LessEqualThreshold lesEquThr(
final threshold=1E-15)
"Avoid zero division";
Buildings.Controls.OBC.CDL.Continuous.LessEqualThreshold lesEquThr1(
final threshold=1E-15)
"Avoid zero division";
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant maxStaTim(
final k=tOptMax)
"Maximum optimal start time";
Buildings.Controls.OBC.CDL.Logical.TrueHoldWithReset truHol(
final duration=tOptMax + 11*3600)
"Hold the start time for timer";
Buildings.Controls.OBC.CDL.Continuous.Division temSlo
"Calculate temperature slope";
Buildings.Controls.OBC.CDL.Logical.Switch swi
"Switch to default optimal start time when time duration is 0";
Buildings.Controls.OBC.CDL.Logical.Switch swi1
"Switch to default value when the calculated temperature slope is 0";
Buildings.Controls.OBC.CDL.Logical.Pre pre
"Break algebraic loops";
Buildings.Controls.OBC.CDL.Continuous.Add add1(final k1=+1, final k2=-1)
"Calculate the time duration to reach the setpoint";
Buildings.Controls.OBC.CDL.Continuous.Add add2(final k1=+1, final k2=-1)
"Calculate differential between time-to-next-occupancy and the cool-down time";
Buildings.Controls.OBC.CDL.Continuous.Min min
"Get the final optimal start time";
Buildings.Controls.OBC.CDL.Continuous.Max max
"Consider the deadband case";
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler triSam
"The instant when the zone temperature reaches setpoint with maximum time cutoff";
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler triSam1
"Record the start time when the HVAC system is turned on";
Buildings.Controls.OBC.CDL.Logical.Latch lat
"Stop calculation when the zone temperature reaches setpoint";
Buildings.Controls.OBC.CDL.Logical.Timer tim(final reset=true)
"Record time duration for the zone temperature to reach setpoint";
Buildings.Controls.OBC.CDL.Logical.Not not1
"Becomes true when the setpoint is reached";
Buildings.Controls.OBC.CDL.Continuous.Division tOptCal
"Calculate optimal start time using the averaged previous temperature slope";
Buildings.Controls.OBC.CDL.Continuous.Sources.ModelTime modTim "Model time";
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con1(final k=86400)
"Daily period";
Buildings.Controls.OBC.CDL.Continuous.Modulo mod "Get the modulo";
Buildings.Controls.OBC.CDL.Continuous.LessEqualThreshold lesEquThr2(
final threshold=1E-06)
"Get the instant when the simulation time arrives at midnight";
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler triSam4
"Get the sampled optimal start time at the same time each day";
Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greThr(
final threshold=thrOptOn)
"The threshold for optOn signal becomes true";
Buildings.Controls.OBC.CDL.Logical.And and2 "Logical and";
equation
connect(tim.y, triSam.u);
connect(falEdg.y, triSam.trigger);
connect(not1.y, lat.clr);
connect(swi1.y, tOptCal.u2);
connect(temSlo.y, triMovMea.u);
connect(lesEquThr.y, swi.u2);
connect(lesEquThr1.y, swi1.u2);
connect(TDif, hys.u);
connect(triMovMea.y, lesEquThr1.u);
connect(staCal, triSam2.trigger);
connect(TDif,triSam3. u);
connect(pre.y,triSam3. trigger);
connect(pre.y, lat.u);
connect(edg.y, triSam1.trigger);
connect(triSam1.y, add1.u2);
connect(triSam.y, add1.u1);
connect(swi.y, temSlo.u2);
connect(add1.y, lesEquThr.u);
connect(add1.y, swi.u3);
connect(triMovMea.y, swi1.u3);
connect(TDif, triSam2.u);
connect(tNexOcc, add2.u2);
connect(add2.y, hysOpt.u);
connect(min.y, add2.u1);
connect(con.y, max.u2);
connect(triSam2.y, max.u1);
connect(staCal, truHol.u);
connect(truHol.y, tim.u);
connect(tim.y, triSam1.u);
connect(min.y, tOpt);
connect(not1.u, hys.y);
connect(lat.y, edg.u);
connect(lat.y, falEdg.u);
connect(modTim.y, mod.u1);
connect(con1.y, mod.u2);
connect(mod.y, lesEquThr2.u);
connect(lesEquThr2.y, triMovMea.trigger);
connect(tOptCal.y, triSam4.u);
connect(staCal, triSam4.trigger);
connect(triSam4.y, min.u2);
connect(maxStaTim.y, min.u1);
connect(defOptTim.y, swi.u1);
connect(defTemSlo.y, swi1.u1);
connect(max.y, tOptCal.u1);
connect(triSam3.y, temSlo.u1);
connect(min.y, greThr.u);
connect(hysOpt.y, and2.u2);
connect(greThr.y, and2.u1);
connect(and2.y, pre.u);
connect(pre.y, optOn);
end OptimalStartCalculation;