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 | Maximum optimal start time [s] | |
Real | thrOptOn | Threshold time for the output optOn to become true [s] | |
Integer | nDay | Number of previous days for averaging the temperature slope | |
Real | uLow | Threshold to determine if the zone temperature reaches the occupied setpoint, should be a non-negative number [K] | |
Real | uHigh | 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 | Difference between zone setpoint and measured temperature, must be bigger than zero for heating and cooling if setpoint is not yet reached [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 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")
"Difference between zone setpoint and measured temperature, must be bigger than zero for heating and cooling if setpoint is not yet reached";
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
constant Real tReaMin(
final quantity="Time",
final unit="s",
displayUnit="h")=120
"Minimum value for optimal start time if the system reached the set point almost immediately (used to avoid division by zero)";
constant Real temSloDef(
final quantity="TemperatureSlope",
final unit="K/s")=1/3600
"Minimum value for temperature slope (used to avoid division by zero)";
Buildings.Controls.OBC.CDL.Logical.Sources.SampleTrigger samTri(
final period=86400,
final shift=0)
"Trigger that triggers each midnight";
Buildings.Controls.OBC.CDL.Discrete.TriggeredMovingMean samTemSloAve(
final n=nDay)
"Calculate the averaged temperature slope over the past n days";
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler dTCalOn
"Get the sampled temperature difference at the same time each day";
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler dTHVACOn
"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 timReaMin(
final k=tReaMin)
"Minimum time to reach set point (used to avoid division by zero)";
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.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.Divide temSlo
"Calculate temperature slope";
Buildings.Controls.OBC.CDL.Logical.Pre pre
"Break algebraic loops";
Buildings.Controls.OBC.CDL.Continuous.Subtract sub1
"Calculate the time duration to reach the setpoint";
Buildings.Controls.OBC.CDL.Continuous.Subtract sub2
"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.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
"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.Divide tOptCal
"Calculate optimal start time using the averaged previous temperature slope";
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler samTimOpt
"Get the sampled optimal start time at the same time each day";
Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greThr(
final t=thrOptOn)
"The threshold for optOn signal becomes true";
Buildings.Controls.OBC.CDL.Logical.And and2
"Logical and";
Buildings.Controls.OBC.CDL.Continuous.Max timRea
"Time required to reach the set point";
Buildings.Controls.OBC.CDL.Continuous.Max temSloAve
"Temperature slope during heat up or cool down over the past sampled days";
Buildings.Controls.OBC.CDL.Continuous.Switch dTUse
"dT used in the calculations (to avoid negative dT)";
Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold reqStaUp(
final t=0,
final h=0)
"Output true if optimal startup is needed";
Buildings.Controls.OBC.CDL.Logical.And triAve
"Trigger sampling but only if optimal start up is needed";
equation
connect(tim.y,triSam.u);
connect(falEdg.y,triSam.trigger);
connect(not1.y,lat.clr);
connect(temSlo.y,samTemSloAve.u);
connect(TDif,hys.u);
connect(staCal,dTCalOn.trigger);
connect(TDif,dTHVACOn.u);
connect(pre.y,dTHVACOn.trigger);
connect(pre.y,lat.u);
connect(edg.y,triSam1.trigger);
connect(triSam1.y,sub1.u2);
connect(triSam.y,sub1.u1);
connect(TDif,dTCalOn.u);
connect(tNexOcc,sub2.u2);
connect(sub2.y,hysOpt.u);
connect(min.y,sub2.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(tOptCal.y,samTimOpt.u);
connect(staCal,samTimOpt.trigger);
connect(dTHVACOn.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);
connect(timRea.y,temSlo.u2);
connect(timRea.u1,sub1.y);
connect(temSloAve.y,tOptCal.u2);
connect(temSloAve.u1,samTemSloAve.y);
connect(defTemSlo.y,temSloAve.u2);
connect(min.u1,samTimOpt.y);
connect(maxStaTim.y,min.u2);
connect(reqStaUp.u,dTCalOn.y);
connect(dTUse.u2,reqStaUp.y);
connect(dTCalOn.y,dTUse.u1);
connect(con.y,dTUse.u3);
connect(dTUse.y,tOptCal.u1);
connect(triAve.u2,samTri.y);
connect(reqStaUp.y,triAve.u1);
connect(triAve.y,samTemSloAve.trigger);
connect(timReaMin.y, timRea.u2);
end OptimalStartCalculation;