Buildings.Controls.SetPoints

Package with models for control set points

Information

This package contains component models to compute set points of control systems. For additional models, see also Modelica.Blocks.Continuous.

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

Package Content

Name Description
Buildings.Controls.SetPoints.OccupancySchedule OccupancySchedule Occupancy schedule with look-ahead
Buildings.Controls.SetPoints.SupplyReturnTemperatureReset SupplyReturnTemperatureReset Block to compute the supply and return set point
Buildings.Controls.SetPoints.Table Table Model for a set point that is interpolated based on a user-specified table
Buildings.Controls.SetPoints.Examples Examples Collection of models that illustrate model use and test models
Buildings.Controls.SetPoints.Validation Validation Collection of validation models

Buildings.Controls.SetPoints.OccupancySchedule Buildings.Controls.SetPoints.OccupancySchedule

Occupancy schedule with look-ahead

Buildings.Controls.SetPoints.OccupancySchedule

Information

This model outputs whether the building is currently occupied, and how long it will take until the next time when the building will be occupied or non-occupied. The latter may be used, for example, to start a ventilation system half an hour before occupancy starts in order to ventilate the room.

The occupancy is defined by a time schedule of the form

  occupancy = 3600*{7, 12, 14, 19}

This indicates that the occupancy is from 7:00 until 12:00 and from 14:00 to 19:00. This will be repeated periodically. The parameter periodicity defines the periodicity. The period always starts at t=0 seconds.

Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).

Parameters

TypeNameDefaultDescription
Realoccupancy[:]3600*{7,19}Occupancy table, each entry switching occupancy on or off
BooleanfirstEntryOccupiedtrueSet to true if first entry in occupancy denotes a changed from unoccupied to occupied
Timeperiod86400End time of periodicity [s]

Connectors

TypeNameDescription
output RealOutputtNexNonOccTime until next non-occupancy
output RealOutputtNexOccTime until next occupancy
output BooleanOutputoccupiedOutputs true if occupied at current time

Modelica definition

block OccupancySchedule "Occupancy schedule with look-ahead" extends Modelica.Blocks.Icons.Block; parameter Real occupancy[:]=3600*{7, 19} "Occupancy table, each entry switching occupancy on or off"; parameter Boolean firstEntryOccupied = true "Set to true if first entry in occupancy denotes a changed from unoccupied to occupied"; parameter Modelica.Units.SI.Time period=86400 "End time of periodicity"; Modelica.Blocks.Interfaces.RealOutput tNexNonOcc "Time until next non-occupancy"; Modelica.Blocks.Interfaces.RealOutput tNexOcc "Time until next occupancy"; Modelica.Blocks.Interfaces.BooleanOutput occupied "Outputs true if occupied at current time"; protected final parameter Integer nRow = size(occupancy,1) "Number of rows in the schedule"; discrete Modelica.Units.SI.Time tOcc "Time when next occupancy starts"; discrete Modelica.Units.SI.Time tNonOcc "Time when next non-occupancy starts"; discrete Modelica.Units.SI.Time tNext "Time of next switch in schedule"; function getOutput "Get the next occupancy or non-occupancy outputs" extends Modelica.Icons.Function; input Modelica.Units.SI.Time t "Current model time"; input Modelica.Units.SI.Time period "Periodicity"; input Real occupancy[nRow] "Occupancy table, each entry switching occupancy on or off"; input Boolean firstEntryOccupied "Set to true if first entry in occupancy denotes a changed from unoccupied to occupied"; input Integer nRow "Number of rows in the schedule"; output Modelica.Units.SI.Time tOcc "Time when next occupancy starts"; output Modelica.Units.SI.Time tNonOcc "Time when next non-occupancy starts"; output Boolean occupied "Outputs true if occupied at current time"; output Modelica.Units.SI.Time tNext "Time of next switch in schedule"; protected Integer iPerSta "Counter for the period in which the next occupancy starts"; Integer iPerSto "Counter for the period in which the next occupancy stops"; Integer nexStaInd "Next index when occupancy starts"; Integer nexStoInd "Next index when occupancy stops"; algorithm // Initialize variables iPerSta := integer(t/period); iPerSto := iPerSta; // First, assume that the first entry is occupied nexStaInd := 1; nexStoInd := 2; // nRow is an even number for i in 1:2:nRow-1 loop if t >= occupancy[i] + iPerSta*period then nexStaInd := i+2; end if; end for; for i in 2:2:nRow loop if t >= occupancy[i] + iPerSto*period then nexStoInd := i+2; end if; end for; if nexStaInd > nRow then nexStaInd := 1; iPerSta :=iPerSta + 1; end if; if nexStoInd > nRow then nexStoInd := 2; iPerSto :=iPerSto + 1; end if; tOcc := occupancy[nexStaInd] + iPerSta*period; tNonOcc := occupancy[nexStoInd] + iPerSto*period; occupied := tNonOcc < tOcc; // Now, correct if the first entry is vaccant instead of occupied if not firstEntryOccupied then (nexStaInd, nexStoInd) := switchInteger(nexStaInd, nexStoInd); (iPerSta, iPerSto) := switchInteger(iPerSta, iPerSto); (tOcc, tNonOcc) := switchReal(tOcc, tNonOcc); occupied := not occupied; end if; tNext :=min(tOcc, tNonOcc); end getOutput; encapsulated function switchInteger "Switch two Integer arguments" import Modelica; extends Modelica.Icons.Function; input Integer x1 "First argument"; input Integer x2 "Second argument"; output Integer y1 "Output = x2"; output Integer y2 "Output = x1"; algorithm y1:=x2; y2:=x1; end switchInteger; encapsulated function switchReal "Switch two Real arguments" import Modelica; extends Modelica.Icons.Function; input Real x1 "First argument"; input Real x2 "Second argument"; output Real y1 "Output = x2"; output Real y2 "Output = x1"; algorithm y1:=x2; y2:=x1; end switchReal; initial equation // Check parameters for correctness assert(mod(nRow, 2) < 0.1, "The parameter \"occupancy\" must have an even number of elements.\n"); assert(0 <= occupancy[1], "The first element of \"occupancy\" must be bigger than or equal to zero." + "\n Received occupancy[1] = " + String(occupancy[1])); assert(period >= occupancy[nRow], "The parameter \"period\" must be greater than or equal to the last element of \"occupancy\"." + "\n Received period = " + String(period) + "\n occupancy[" + String(nRow) + "] = " + String(occupancy[nRow])); for i in 1:nRow-1 loop assert(occupancy[i] < occupancy[i+1], "The elements of the parameter \"occupancy\" must be strictly increasing."); end for; (tOcc, tNonOcc, occupied, tNext) = getOutput(t = time, period = period, occupancy= occupancy, firstEntryOccupied = firstEntryOccupied, nRow=nRow); equation when time >= pre(tNext) then (tOcc, tNonOcc, occupied, tNext) = getOutput(t = time, period = period, occupancy= occupancy, firstEntryOccupied = firstEntryOccupied, nRow=nRow); end when; tNexOcc = tOcc-time; tNexNonOcc = tNonOcc-time; end OccupancySchedule;

Buildings.Controls.SetPoints.SupplyReturnTemperatureReset Buildings.Controls.SetPoints.SupplyReturnTemperatureReset

Block to compute the supply and return set point

Buildings.Controls.SetPoints.SupplyReturnTemperatureReset

Information

This block computes the set point temperatures for the supply and return water temperature. The set point for the room air temperature can either be specified by a parameter, or it can be an input to the model. The latter allows to use this model with systems that have night set back.

If used to reset the temperature in a heating system, the parameter dTOutHeaBal can be used to shift the heating curve to take into account that heat gains from solar, equipment and people make up for some of the transmission losses. For example, in energy efficient houses, the heating may not be switched on if the outside air temperature is greater than 12°C, even if a room temperature of 20°C is required. In such a situation, set dTOutHeaBal=20-12=8 Kelvin to shift the heating curve.

Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).

Parameters

TypeNameDefaultDescription
Realm1.3Exponent for heat transfer
Booleanuse_TRoo_infalseGet the room temperature set point from the input connector
TemperatureTRoo293.15Fixed value of room temperature set point [K]
TemperatureDifferencedTOutHeaBal8Offset for heating curve [K]
Nominal conditions
TemperatureTSup_nominal Supply temperature [K]
TemperatureTRet_nominal Return temperature [K]
TemperatureTRoo_nominal293.15Room temperature [K]
TemperatureTOut_nominal Outside temperature [K]

Connectors

TypeNameDescription
input RealInputTRoo_inRoom air temperature set point [K]
input RealInputTOutOutside temperature [K]
output RealOutputTSupSetpoint for supply temperature [K]
output RealOutputTRetSetpoint for return temperature [K]

Modelica definition

block SupplyReturnTemperatureReset "Block to compute the supply and return set point" extends Modelica.Blocks.Icons.Block; parameter Real m = 1.3 "Exponent for heat transfer"; parameter Modelica.Units.SI.Temperature TSup_nominal "Supply temperature"; parameter Modelica.Units.SI.Temperature TRet_nominal "Return temperature"; parameter Modelica.Units.SI.Temperature TRoo_nominal=293.15 "Room temperature"; parameter Modelica.Units.SI.Temperature TOut_nominal "Outside temperature"; parameter Boolean use_TRoo_in = false "Get the room temperature set point from the input connector"; parameter Modelica.Units.SI.Temperature TRoo=293.15 "Fixed value of room temperature set point"; parameter Modelica.Units.SI.TemperatureDifference dTOutHeaBal(displayUnit="K")= 8 "Offset for heating curve"; Modelica.Blocks.Interfaces.RealInput TRoo_in(final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) if use_TRoo_in "Room air temperature set point"; Modelica.Blocks.Interfaces.RealInput TOut(final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) "Outside temperature"; Modelica.Blocks.Interfaces.RealOutput TSup(final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) "Setpoint for supply temperature"; Modelica.Blocks.Interfaces.RealOutput TRet(final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) "Setpoint for return temperature"; protected Modelica.Blocks.Interfaces.RealInput TRoo_in_internal(final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) "Needed to connect to conditional connector"; Real qRel "Relative heating load = Q_flow/Q_flow_nominal"; Modelica.Units.SI.Temperature TOutOffSet "Effective outside temperature for heat transfer (takes into account room heat gains)"; parameter Modelica.Units.SI.Temperature TOutOffSet_nominal=TOut_nominal + dTOutHeaBal "Effective outside temperature for heat transfer at nominal conditions (takes into account room heat gains)"; equation connect(TRoo_in, TRoo_in_internal); if not use_TRoo_in then TRoo_in_internal = TRoo; end if; TOutOffSet = TOut + dTOutHeaBal; // Relative heating load, compared to nominal conditions qRel = max(0, (TRoo_in_internal-TOutOffSet)/(TRoo_nominal-TOutOffSet_nominal)); TSup = TRoo_in_internal + ((TSup_nominal+TRet_nominal)/2-TRoo_nominal) * qRel^(1/m) + (TSup_nominal-TRet_nominal)/2 * qRel; TRet = TSup - qRel * (TSup_nominal-TRet_nominal); end SupplyReturnTemperatureReset;

Buildings.Controls.SetPoints.Table Buildings.Controls.SetPoints.Table

Model for a set point that is interpolated based on a user-specified table

Buildings.Controls.SetPoints.Table

Information

This block can be used to schedule a set-point by using piecewise linear functions. For example, the instances

Buildings.Controls.SetPoints.Table tabLinExt(constantExtrapolation=false,
                                             table=[20, 0.0;
                                                    22, 0.5;
                                                    25, 0.5;
                                                    26, 1.0]);
Buildings.Controls.SetPoints.Table tabConExt(constantExtrapolation=true,
                                             table=[20, 0.0;
                                                    22, 0.5;
                                                    25, 0.5;
                                                    26, 1.0]);

will cause the following output:

Table output.

For the default setting constantExtrapolation=true, the block outputs y=y1+offset for u ≤ u1, and y=yMax+offset for u ≥ uMax. Otherwise, the table is linearly extrapolated with a constant derivative.

Note that the first column must be strictly increasing.

Extends from Modelica.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).

Parameters

TypeNameDefaultDescription
Realtable[:, 2]fill(0.0, 1, 2)Table matrix ( e.g., table=[u1, y1; u2, y2; u3, y3])
Realoffset0Offset of output signal
BooleanconstantExtrapolationtrueIf true, then y=y1 for u<u1, and y=yMax for u>uMax

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputyConnector of Real output signal

Modelica definition

model Table "Model for a set point that is interpolated based on a user-specified table" extends Modelica.Blocks.Interfaces.SISO; parameter Real table[:,2]=fill(0.0, 1, 2) "Table matrix ( e.g., table=[u1, y1; u2, y2; u3, y3])"; parameter Real offset=0 "Offset of output signal"; parameter Boolean constantExtrapolation = true "If true, then y=y1 for u<u1, and y=yMax for u>uMax"; protected final parameter Integer nRow = if constantExtrapolation then size(table,1)+2 else size(table,1) "Number of rows"; final parameter Real[nRow,2] offsetVector = [zeros(nRow), offset*ones(nRow)] "Vector to take offset of output signal into account"; Modelica.Blocks.Tables.CombiTable1Dv tab(tableOnFile=false, final table=(if constantExtrapolation then cat( 1, [table[1, 1] - 1,table[1, 2]], table, [table[end, 1] + 1,table[end, 2]]) else table) + offsetVector) "Table used for interpolation"; equation connect(u, tab.u[1]); connect(tab.y[1], y); end Table;