Buildings.Examples.VAVReheat.Controls

Package with controller models

Information

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

Package Content

Name Description
Buildings.Examples.VAVReheat.Controls.ControlBus ControlBus Empty control bus that is adapted to the signals connected to it
Buildings.Examples.VAVReheat.Controls.CoolingCoilTemperatureSetpoint CoolingCoilTemperatureSetpoint Set point scheduler for cooling coil
Buildings.Examples.VAVReheat.Controls.DuctStaticPressureSetpoint DuctStaticPressureSetpoint Computes the duct static pressure setpoint
Buildings.Examples.VAVReheat.Controls.Economizer Economizer Controller for economizer
Buildings.Examples.VAVReheat.Controls.EconomizerTemperatureControl EconomizerTemperatureControl Controller for economizer mixed air temperature
Buildings.Examples.VAVReheat.Controls.FanVFD FanVFD Controller for fan revolution
Buildings.Examples.VAVReheat.Controls.MixedAirTemperatureSetpoint MixedAirTemperatureSetpoint Mixed air temperature setpoint for economizer
Buildings.Examples.VAVReheat.Controls.ModeSelector ModeSelector Finite State Machine for the operational modes
Buildings.Examples.VAVReheat.Controls.OperationModes OperationModes Enumeration for modes of operation
Buildings.Examples.VAVReheat.Controls.PreCoolingStarter PreCoolingStarter Outputs true when precooling should start
Buildings.Examples.VAVReheat.Controls.RoomTemperatureSetpoint RoomTemperatureSetpoint Set point scheduler for room temperature
Buildings.Examples.VAVReheat.Controls.RoomVAV RoomVAV Controller for room VAV box
Buildings.Examples.VAVReheat.Controls.State State Block that outputs the mode if the state is active, or zero otherwise
Buildings.Examples.VAVReheat.Controls.Examples Examples Example models to test the components

Types and constants

  type OperationModes = enumeration(
    occupied   "Occupied",
    unoccupiedOff   "Unoccupied off",
    unoccupiedNightSetBack   "Unoccupied, night set back",
    unoccupiedWarmUp   "Unoccupied, warm-up",
    unoccupiedPreCool   "Unoccupied, pre-cool",
    safety   "Safety (smoke, fire, etc.)") "Enumeration for modes of operation";

Buildings.Examples.VAVReheat.Controls.ControlBus Buildings.Examples.VAVReheat.Controls.ControlBus

Empty control bus that is adapted to the signals connected to it

Buildings.Examples.VAVReheat.Controls.ControlBus

Information

This connector defines the expandable connector ControlBus that is used to connect control signals. Note, this connector is empty. When using it, the actual content is constructed by the signals connected to this bus.

Extends from Modelica.Icons.SignalBus (Icon for signal bus).

Modelica definition

expandable connector ControlBus "Empty control bus that is adapted to the signals connected to it" extends Modelica.Icons.SignalBus; end ControlBus;

Buildings.Examples.VAVReheat.Controls.CoolingCoilTemperatureSetpoint Buildings.Examples.VAVReheat.Controls.CoolingCoilTemperatureSetpoint

Set point scheduler for cooling coil

Buildings.Examples.VAVReheat.Controls.CoolingCoilTemperatureSetpoint

Information

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

Parameters

TypeNameDefaultDescription
TemperatureTCooOn273.15 + 12Cooling setpoint during on [K]
TemperatureTCooOff273.15 + 30Cooling setpoint during off [K]

Connectors

TypeNameDescription
input RealInputTSetHeaSet point for heating coil [K]
ControlBuscontrolBus 
output RealOutputTSetTemperature set point [K]

Modelica definition

block CoolingCoilTemperatureSetpoint "Set point scheduler for cooling coil" extends Modelica.Blocks.Icons.Block; import Buildings.Examples.VAVReheat.Controls.OperationModes; parameter Modelica.SIunits.Temperature TCooOn=273.15+12 "Cooling setpoint during on"; parameter Modelica.SIunits.Temperature TCooOff=273.15+30 "Cooling setpoint during off"; Modelica.Blocks.Sources.RealExpression TSupSetCoo( y=if (mode.y == Integer(OperationModes.occupied) or mode.y == Integer(OperationModes.unoccupiedPreCool) or mode.y == Integer(OperationModes.safety)) then TCooOn else TCooOff) "Supply air temperature setpoint for cooling"; Modelica.Blocks.Interfaces.RealInput TSetHea( unit="K", displayUnit="degC") "Set point for heating coil"; Modelica.Blocks.Math.Add add; Modelica.Blocks.Sources.Constant dTMin(k=1) "Minimum offset for cooling coil setpoint"; Modelica.Blocks.Math.Max max1; ControlBus controlBus; Modelica.Blocks.Routing.IntegerPassThrough mode; Modelica.Blocks.Interfaces.RealOutput TSet( unit="K", displayUnit="degC") "Temperature set point"; equation connect(dTMin.y, add.u1); connect(add.y, max1.u1); connect(TSupSetCoo.y, max1.u2); connect(controlBus.controlMode, mode.u); connect(max1.y, TSet); connect(TSetHea, add.u2); end CoolingCoilTemperatureSetpoint;

Buildings.Examples.VAVReheat.Controls.DuctStaticPressureSetpoint Buildings.Examples.VAVReheat.Controls.DuctStaticPressureSetpoint

Computes the duct static pressure setpoint

Buildings.Examples.VAVReheat.Controls.DuctStaticPressureSetpoint

Information

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

Parameters

TypeNameDefaultDescription
Integernin1Number of inputs
AbsolutePressurepMin100Minimum duct static pressure setpoint [Pa]
AbsolutePressurepMax410Maximum duct static pressure setpoint [Pa]
Realk0.1Gain of controller
TimeTi60Time constant of integrator block [s]
TimeTd60Time constant of derivative block [s]
SimpleControllercontrollerTypeModelica.Blocks.Types.Simple...Type of controller

Connectors

TypeNameDescription
input RealInputu[nin]Connector of Real input signals
output RealOutputyConnector of Real output signal
input RealInputTOutOutside air temperature

Modelica definition

model DuctStaticPressureSetpoint "Computes the duct static pressure setpoint" extends Modelica.Blocks.Interfaces.MISO; parameter Modelica.SIunits.AbsolutePressure pMin(displayUnit="Pa") = 100 "Minimum duct static pressure setpoint"; parameter Modelica.SIunits.AbsolutePressure pMax(displayUnit="Pa") = 410 "Maximum duct static pressure setpoint"; parameter Real k=0.1 "Gain of controller"; parameter Modelica.SIunits.Time Ti=60 "Time constant of integrator block"; parameter Modelica.SIunits.Time Td=60 "Time constant of derivative block"; parameter Modelica.Blocks.Types.SimpleController controllerType=Modelica.Blocks.Types.SimpleController.PID "Type of controller"; Buildings.Controls.Continuous.LimPID limPID( controllerType=controllerType, k=k, Ti=Ti, Td=Td, initType=Modelica.Blocks.Types.InitPID.InitialState); protected Buildings.Utilities.Math.Max max(final nin=nin); Modelica.Blocks.Sources.Constant ySet(k=0.9) "Setpoint for maximum damper position"; Modelica.Blocks.Math.Add dp(final k2=-1) "Pressure difference"; Modelica.Blocks.Sources.Constant pMaxSig(k=pMax); Modelica.Blocks.Sources.Constant pMinSig(k=pMin); Modelica.Blocks.Math.Add pSet "Pressure setpoint"; Modelica.Blocks.Math.Product product; public Modelica.Blocks.Logical.Hysteresis hysteresis(uLow=283.15, uHigh=284.15) "Hysteresis to put fan on minimum revolution"; Modelica.Blocks.Interfaces.RealInput TOut "Outside air temperature"; protected Modelica.Blocks.Sources.Constant zero(k=0) "Zero output signal"; public Modelica.Blocks.Logical.Switch switch1; equation connect(max.u, u); connect(ySet.y, limPID.u_s); connect(max.y, limPID.u_m); connect(limPID.y, product.u1); connect(pMaxSig.y, dp.u1); connect(pMinSig.y, dp.u2); connect(dp.y, product.u2); connect(pMinSig.y, pSet.u2); connect(pSet.y, y); connect(hysteresis.u, TOut); connect(product.y, switch1.u1); connect(zero.y, switch1.u3); connect(switch1.y, pSet.u1); connect(hysteresis.y, switch1.u2); end DuctStaticPressureSetpoint;

Buildings.Examples.VAVReheat.Controls.Economizer Buildings.Examples.VAVReheat.Controls.Economizer

Controller for economizer

Buildings.Examples.VAVReheat.Controls.Economizer

Information

This is a controller for an economizer with that adjust the outside air dampers to meet the set point for the mixing air, taking into account the minimum outside air requirement and an override for freeze protection.

Parameters

TypeNameDefaultDescription
TemperatureTFreSet277.15Lower limit for mixed air temperature for freeze protection [K]
TemperatureDifferencedT1Temperture offset to activate economizer [K]
VolumeFlowRateVOut_flow_minVOut_flow_min( ...Minimum outside air volume flow rate [m3/s]
Realk1Gain of controller
TimeTi Time constant of integrator block [s]

Connectors

TypeNameDescription
input RealInputTSupHeaSetSupply temperature setpoint for heating
input RealInputTSupCooSetSupply temperature setpoint for cooling
input RealInputTMixMeasured mixed air temperature
ControlBuscontrolBus 
input RealInputVOut_flowMeasured outside air flow rate
input RealInputTRetReturn air temperature
output RealOutputyOAControl signal for outside air damper
output RealOutputyRetControl signal for return air damper

Modelica definition

block Economizer "Controller for economizer" import Buildings.Examples.VAVReheat.Controls.OperationModes; parameter Modelica.SIunits.Temperature TFreSet=277.15 "Lower limit for mixed air temperature for freeze protection"; parameter Modelica.SIunits.TemperatureDifference dT(min=0.1) = 1 "Temperture offset to activate economizer"; parameter Modelica.SIunits.VolumeFlowRate VOut_flow_min(min=0) "Minimum outside air volume flow rate"; Modelica.Blocks.Interfaces.RealInput TSupHeaSet "Supply temperature setpoint for heating"; Modelica.Blocks.Interfaces.RealInput TSupCooSet "Supply temperature setpoint for cooling"; Modelica.Blocks.Interfaces.RealInput TMix "Measured mixed air temperature"; ControlBus controlBus; Modelica.Blocks.Interfaces.RealInput VOut_flow "Measured outside air flow rate"; Modelica.Blocks.Interfaces.RealInput TRet "Return air temperature"; Modelica.Blocks.Math.Gain gain(k=1/VOut_flow_min) "Normalize mass flow rate"; Buildings.Controls.Continuous.LimPID conV_flow( controllerType=Modelica.Blocks.Types.SimpleController.PI, k=k, Ti=Ti, yMax=0.995, yMin=0.005, Td=60) "Controller for outside air flow rate"; Modelica.Blocks.Sources.Constant uni(k=1) "Unity signal"; parameter Real k=1 "Gain of controller"; parameter Modelica.SIunits.Time Ti "Time constant of integrator block"; Modelica.Blocks.Interfaces.RealOutput yOA "Control signal for outside air damper"; Modelica.Blocks.Routing.Extractor extractor(nin=6, index(start=1, fixed=true)) "Extractor for control signal"; Modelica.Blocks.Sources.Constant closed(k=0) "Signal to close OA damper"; Modelica.Blocks.Math.Max max "Takes bigger signal (OA damper opens for temp. control or for minimum outside air)"; MixedAirTemperatureSetpoint TSetMix "Mixed air temperature setpoint"; EconomizerTemperatureControl yOATMix(Ti=Ti, k=k) "Control signal for outdoor damper to track mixed air temperature setpoint"; Buildings.Controls.Continuous.LimPID yOATFre( k=k, Ti=Ti, Td=60, controllerType=Modelica.Blocks.Types.SimpleController.PI, yMax=1, yMin=0) "Control signal for outdoor damper to track freeze temperature setpoint"; Modelica.Blocks.Math.Min min "Takes bigger signal (OA damper opens for temp. control or for minimum outside air)"; Modelica.Blocks.Sources.Constant TFre(k=TFreSet) "Setpoint for freeze protection"; Modelica.Blocks.Interfaces.RealOutput yRet "Control signal for return air damper"; Buildings.Controls.OBC.CDL.Continuous.AddParameter invSig(p=1, k=-1) "Invert control signal for interlocked damper"; equation connect(VOut_flow, gain.u); connect(gain.y, conV_flow.u_m); connect(uni.y, conV_flow.u_s); connect(controlBus.controlMode, extractor.index); connect(max.y, extractor.u[Integer(OperationModes.occupied)]); connect(closed.y, extractor.u[Integer(OperationModes.unoccupiedOff)]); connect(closed.y, extractor.u[Integer(OperationModes.unoccupiedNightSetBack)]); connect(max.y, extractor.u[Integer(OperationModes.unoccupiedWarmUp)]); connect(max.y, extractor.u[Integer(OperationModes.unoccupiedPreCool)]); connect(closed.y, extractor.u[Integer(OperationModes.safety)]); connect(TSupHeaSet, TSetMix.TSupHeaSet); connect(TSupCooSet, TSetMix.TSupCooSet); connect(controlBus, TSetMix.controlBus); connect(yOATMix.TRet, TRet); connect(controlBus.TOut, yOATMix.TOut); connect(yOATMix.TMix, TMix); connect(yOATMix.TMixSet, TSetMix.TSet); connect(yOATMix.yOA, max.u1); connect(min.u2, conV_flow.y); connect(min.y, max.u2); connect(yOATFre.u_s, TMix); connect(TFre.y, yOATFre.u_m); connect(yOATFre.y, min.u1); connect(yRet, invSig.y); connect(extractor.y, invSig.u); connect(extractor.y, yOA); end Economizer;

Buildings.Examples.VAVReheat.Controls.EconomizerTemperatureControl Buildings.Examples.VAVReheat.Controls.EconomizerTemperatureControl

Controller for economizer mixed air temperature

Buildings.Examples.VAVReheat.Controls.EconomizerTemperatureControl

Information

This controller outputs the control signal for the outside air damper in order to regulate the mixed air temperature TMix.

Implementation

If the control error Tmix,set - Tmix < 0, then more outside air is needed provided that Tout < Tret, where Tout is the outside air temperature and Tret is the return air temperature. However, if Tout ≥ Tret, then less outside air is needed. Hence, the control gain need to switch sign depending on this difference. This is accomplished by taking the difference between these signals, and then switching the input of the controller. A hysteresis is used to avoid chattering, for example if TRet has numerical noise in the simulation, or measurement error in a real application.

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

Parameters

TypeNameDefaultDescription
Realk1Gain of controller
TimeTi Time constant of integrator block [s]

Connectors

TypeNameDescription
output RealOutputyOAControl signal for outside air damper
input RealInputTRetReturn air temperature
input RealInputTOutOutside air temperature
input RealInputTMixMixed air temperature
input RealInputTMixSetSetpoint for mixed air temperature

Modelica definition

block EconomizerTemperatureControl "Controller for economizer mixed air temperature" extends Modelica.Blocks.Icons.Block; import Buildings.Examples.VAVReheat.Controls.OperationModes; Buildings.Controls.Continuous.LimPID con( k=k, Ti=Ti, yMax=0.995, yMin=0.005, Td=60, controllerType=Modelica.Blocks.Types.SimpleController.PI) "Controller for mixed air temperature"; parameter Real k=1 "Gain of controller"; parameter Modelica.SIunits.Time Ti "Time constant of integrator block"; Modelica.Blocks.Logical.Switch swi1; Modelica.Blocks.Logical.Switch swi2; Modelica.Blocks.Interfaces.RealOutput yOA "Control signal for outside air damper"; Modelica.Blocks.Interfaces.RealInput TRet "Return air temperature"; Modelica.Blocks.Interfaces.RealInput TOut "Outside air temperature"; Modelica.Blocks.Interfaces.RealInput TMix "Mixed air temperature"; Modelica.Blocks.Interfaces.RealInput TMixSet "Setpoint for mixed air temperature"; Modelica.Blocks.Logical.Hysteresis hysConGai(uLow=-0.1, uHigh=0.1) "Hysteresis for control gain"; Modelica.Blocks.Math.Feedback feedback; equation connect(swi1.y, con.u_s); connect(swi2.y, con.u_m); connect(con.y, yOA); connect(swi1.u1, TMix); connect(swi2.u3, TMix); connect(swi1.u3, TMixSet); connect(swi2.u1, TMixSet); connect(feedback.u1, TRet); connect(TOut, feedback.u2); connect(feedback.y, hysConGai.u); connect(hysConGai.y, swi2.u2); connect(hysConGai.y, swi1.u2); end EconomizerTemperatureControl;

Buildings.Examples.VAVReheat.Controls.FanVFD Buildings.Examples.VAVReheat.Controls.FanVFD

Controller for fan revolution

Buildings.Examples.VAVReheat.Controls.FanVFD

Information

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

Parameters

TypeNameDefaultDescription
RealxSet_nominal Nominal setpoint (used for normalization)
Realr_N_min0.01Minimum normalized fan speed
InitinitTypeModelica.Blocks.Types.Init.N...Type of initialization (1: no init, 2: steady state, 3/4: initial output)
Realy_start0Initial or guess value of output (= state)
Setpoint tracking
SimpleControllercontrollerType.Modelica.Blocks.Types.Simpl...Type of controller
Realk0.5Gain of controller
TimeTi15Time constant of integrator block [s]

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputyConnector of Real output signal
input RealInputu_mConnector of measurement input signal
input BooleanInputuFanSet to true to enable the fan on

Modelica definition

block FanVFD "Controller for fan revolution" extends Modelica.Blocks.Interfaces.SISO; import Buildings.Examples.VAVReheat.Controls.OperationModes; Buildings.Controls.Continuous.LimPID con( yMax=1, Td=60, yMin=r_N_min, k=k, Ti=Ti, controllerType=controllerType, reset=Buildings.Types.Reset.Disabled) "Controller"; Modelica.Blocks.Math.Gain gaiMea(k=1/xSet_nominal) "Gain to normalize measurement signal"; parameter Real xSet_nominal "Nominal setpoint (used for normalization)"; Modelica.Blocks.Sources.Constant off(k=0) "Off signal"; Modelica.Blocks.Math.Gain gaiSet(k=1/xSet_nominal) "Gain to normalize setpoint signal"; Modelica.Blocks.Interfaces.RealInput u_m "Connector of measurement input signal"; parameter Real r_N_min=0.01 "Minimum normalized fan speed"; parameter Modelica.Blocks.Types.Init initType=Modelica.Blocks.Types.Init.NoInit "Type of initialization (1: no init, 2: steady state, 3/4: initial output)"; parameter Real y_start=0 "Initial or guess value of output (= state)"; parameter Modelica.Blocks.Types.SimpleController controllerType=.Modelica.Blocks.Types.SimpleController.PI "Type of controller"; parameter Real k=0.5 "Gain of controller"; parameter Modelica.SIunits.Time Ti=15 "Time constant of integrator block"; Buildings.Controls.OBC.CDL.Logical.Switch swi; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput uFan "Set to true to enable the fan on"; equation connect(gaiMea.y, con.u_m); connect(gaiSet.y, con.u_s); connect(u_m, gaiMea.u); connect(gaiSet.u, u); connect(con.y, swi.u1); connect(off.y, swi.u3); connect(swi.u2, uFan); connect(swi.y, y); end FanVFD;

Buildings.Examples.VAVReheat.Controls.MixedAirTemperatureSetpoint Buildings.Examples.VAVReheat.Controls.MixedAirTemperatureSetpoint

Mixed air temperature setpoint for economizer

Buildings.Examples.VAVReheat.Controls.MixedAirTemperatureSetpoint

Information

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

Connectors

TypeNameDescription
input RealInputTSupHeaSetSupply temperature setpoint for heating
input RealInputTSupCooSetSupply temperature setpoint for cooling
ControlBuscontrolBus 
output RealOutputTSetMixed air temperature setpoint

Modelica definition

model MixedAirTemperatureSetpoint "Mixed air temperature setpoint for economizer" extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Routing.Extractor TSetMix( nin=6, index(start=2, fixed=true)) "Mixed air setpoint temperature extractor"; Modelica.Blocks.Sources.Constant off(k=273.15 + 13) "Setpoint temperature to close damper"; Buildings.Utilities.Math.Average ave(nin=2); Modelica.Blocks.Interfaces.RealInput TSupHeaSet "Supply temperature setpoint for heating"; Modelica.Blocks.Interfaces.RealInput TSupCooSet "Supply temperature setpoint for cooling"; Modelica.Blocks.Sources.Constant TPreCoo(k=273.15 + 13) "Setpoint during pre-cooling"; ControlBus controlBus; Modelica.Blocks.Interfaces.RealOutput TSet "Mixed air temperature setpoint"; Modelica.Blocks.Routing.Multiplex2 multiplex2_1; equation connect(TSetMix.u[1], ave.y); connect(ave.y, TSetMix.u[1]); connect(off.y, TSetMix.u[2]); connect(off.y, TSetMix.u[3]); connect(off.y, TSetMix.u[4]); connect(TPreCoo.y, TSetMix.u[5]); connect(off.y, TSetMix.u[6]); connect(controlBus.controlMode, TSetMix.index); connect(TSetMix.y, TSet); connect(multiplex2_1.y, ave.u); connect(TSupCooSet, multiplex2_1.u2[1]); connect(TSupHeaSet, multiplex2_1.u1[1]); end MixedAirTemperatureSetpoint;

Buildings.Examples.VAVReheat.Controls.ModeSelector Buildings.Examples.VAVReheat.Controls.ModeSelector

Finite State Machine for the operational modes

Buildings.Examples.VAVReheat.Controls.ModeSelector

Parameters

TypeNameDefaultDescription
TemperatureDifferencedelTRooOnOff1Deadband in room temperature between occupied on and occupied off [K]
TemperatureTRooSetHeaOcc293.15Set point for room air temperature during heating mode [K]
TemperatureTRooSetCooOcc299.15Set point for room air temperature during cooling mode [K]
TemperatureTSetHeaCoiOut303.15Set point for air outlet temperature at central heating coil [K]

Connectors

TypeNameDescription
ControlBuscb 
output BooleanOutputyFanTrue if the fans are to be switched on

Modelica definition

model ModeSelector "Finite State Machine for the operational modes" Modelica.StateGraph.InitialStep initialStep; Modelica.StateGraph.Transition start "Starts the system"; State unOccOff( mode=Buildings.Examples.VAVReheat.Controls.OperationModes.unoccupiedOff, nIn=3, nOut=4) "Unoccupied off mode, no coil protection"; State unOccNigSetBac( nOut=2, mode=Buildings.Examples.VAVReheat.Controls.OperationModes.unoccupiedNightSetBack, nIn=1) "Unoccupied night set back"; Modelica.StateGraph.Transition t2( enableTimer=true, waitTime=60, condition=TRooMinErrHea.y > delTRooOnOff/2); parameter Modelica.SIunits.TemperatureDifference delTRooOnOff(min=0.1)=1 "Deadband in room temperature between occupied on and occupied off"; parameter Modelica.SIunits.Temperature TRooSetHeaOcc=293.15 "Set point for room air temperature during heating mode"; parameter Modelica.SIunits.Temperature TRooSetCooOcc=299.15 "Set point for room air temperature during cooling mode"; parameter Modelica.SIunits.Temperature TSetHeaCoiOut=303.15 "Set point for air outlet temperature at central heating coil"; Modelica.StateGraph.Transition t1(condition=delTRooOnOff/2 < -TRooMinErrHea.y, enableTimer=true, waitTime=30*60); inner Modelica.StateGraph.StateGraphRoot stateGraphRoot; ControlBus cb; Modelica.Blocks.Routing.RealPassThrough TRooSetHea "Current heating setpoint temperature"; State morWarUp(mode=Buildings.Examples.VAVReheat.Controls.OperationModes.unoccupiedWarmUp, nIn=2, nOut=1) "Morning warm up"; Modelica.StateGraph.TransitionWithSignal t6(enableTimer=true, waitTime=60); Modelica.Blocks.Logical.LessEqualThreshold occThrSho(threshold=1800) "Signal to allow transition into morning warmup"; Modelica.StateGraph.TransitionWithSignal t5; State occ( mode=Buildings.Examples.VAVReheat.Controls.OperationModes.occupied, nIn=3) "Occupied mode"; Modelica.Blocks.Routing.RealPassThrough TRooMin; Modelica.Blocks.Math.Feedback TRooMinErrHea "Room control error for heating"; Modelica.StateGraph.Transition t3(condition=TRooMin.y + delTRooOnOff/2 > TRooSetHeaOcc or occupied.y); Modelica.Blocks.Routing.BooleanPassThrough occupied "outputs true if building is occupied"; Modelica.StateGraph.TransitionWithSignal t4(enableTimer=false); State morPreCoo( nIn=2, mode=Buildings.Examples.VAVReheat.Controls.OperationModes.unoccupiedPreCool, nOut=1) "Pre-cooling mode"; Modelica.StateGraph.Transition t7(condition=TRooMin.y - delTRooOnOff/2 < TRooSetCooOcc or occupied.y); Modelica.Blocks.Logical.And and1; Modelica.Blocks.Routing.RealPassThrough TRooAve "Average room temperature"; Modelica.Blocks.Sources.BooleanExpression booleanExpression(y=TRooAve.y < TRooSetCooOcc); PreCoolingStarter preCooSta(TRooSetCooOcc=TRooSetCooOcc) "Model to start pre-cooling"; Modelica.StateGraph.TransitionWithSignal t9; Modelica.Blocks.Logical.Not not1; Modelica.Blocks.Logical.And and2; Modelica.Blocks.Logical.Not not2; Modelica.StateGraph.TransitionWithSignal t8 "changes to occupied in case precooling is deactivated"; Modelica.Blocks.MathInteger.Sum sum(nu=5); Modelica.Blocks.Interfaces.BooleanOutput yFan "True if the fans are to be switched on"; Modelica.Blocks.MathBoolean.Or or1(nu=4); equation connect(start.outPort, unOccOff.inPort[1]); connect(initialStep.outPort[1], start.inPort); connect(unOccOff.outPort[1], t2.inPort); connect(t2.outPort, unOccNigSetBac.inPort[1]); connect(unOccNigSetBac.outPort[1], t1.inPort); connect(t1.outPort, unOccOff.inPort[2]); connect(cb.dTNexOcc, occThrSho.u); connect(t6.outPort, morWarUp.inPort[1]); connect(t5.outPort, morWarUp.inPort[2]); connect(unOccNigSetBac.outPort[2], t5.inPort); connect(cb.TRooMin, TRooMin.u); connect(TRooSetHea.y, TRooMinErrHea.u1); connect(TRooMin.y, TRooMinErrHea.u2); connect(unOccOff.outPort[2], t6.inPort); connect(morWarUp.outPort[1], t3.inPort); connect(cb.occupied, occupied.u); connect(occ.outPort[1], t4.inPort); connect(t4.outPort, unOccOff.inPort[3]); connect(occThrSho.y, and1.u1); connect(and1.y, t6.condition); connect(and1.y, t5.condition); connect(cb.TRooAve, TRooAve.u); connect(booleanExpression.y, and1.u2); connect(preCooSta.y, t9.condition); connect(t9.outPort, morPreCoo.inPort[1]); connect(unOccOff.outPort[3], t9.inPort); connect(cb, preCooSta.controlBus); connect(morPreCoo.outPort[1], t7.inPort); connect(t7.outPort, occ.inPort[2]); connect(t3.outPort, occ.inPort[1]); connect(occThrSho.y, not1.u); connect(not1.y, and2.u2); connect(and2.y, t4.condition); connect(occupied.y, not2.u); connect(not2.y, and2.u1); connect(cb.TRooSetHea, TRooSetHea.u); connect(t8.outPort, occ.inPort[3]); connect(unOccOff.outPort[4], t8.inPort); connect(occupied.y, t8.condition); connect(morPreCoo.y, sum.u[1]); connect(morWarUp.y, sum.u[2]); connect(occ.y, sum.u[3]); connect(unOccOff.y, sum.u[4]); connect(unOccNigSetBac.y, sum.u[5]); connect(sum.y, cb.controlMode); connect(yFan, or1.y); connect(unOccNigSetBac.active, or1.u[1]); connect(occ.active, or1.u[2]); connect(morWarUp.active, or1.u[3]); connect(morPreCoo.active, or1.u[4]); end ModeSelector;

Buildings.Examples.VAVReheat.Controls.PreCoolingStarter Buildings.Examples.VAVReheat.Controls.PreCoolingStarter

Outputs true when precooling should start

Buildings.Examples.VAVReheat.Controls.PreCoolingStarter

Information

Extends from Modelica.Blocks.Interfaces.BooleanSignalSource (Base class for Boolean signal sources).

Parameters

TypeNameDefaultDescription
TemperatureTOutLim286.15Limit for activating precooling [K]
TemperatureTRooSetCooOcc Set point for room air temperature during cooling mode [K]

Connectors

TypeNameDescription
output BooleanOutputyConnector of Boolean output signal
ControlBuscontrolBus 

Modelica definition

block PreCoolingStarter "Outputs true when precooling should start" extends Modelica.Blocks.Interfaces.BooleanSignalSource; parameter Modelica.SIunits.Temperature TOutLim = 286.15 "Limit for activating precooling"; parameter Modelica.SIunits.Temperature TRooSetCooOcc "Set point for room air temperature during cooling mode"; ControlBus controlBus; Modelica.Blocks.Logical.GreaterThreshold greater(threshold=TRooSetCooOcc); Modelica.Blocks.Logical.LessThreshold greater2(threshold=1800); Modelica.Blocks.Logical.LessThreshold greater1(threshold=TOutLim); Modelica.Blocks.MathBoolean.And and3(nu=3); equation connect(controlBus.dTNexOcc, greater2.u); connect(controlBus.TRooAve, greater.u); connect(controlBus.TOut, greater1.u); connect(and3.y, y); connect(greater.y, and3.u[1]); connect(greater1.y, and3.u[2]); connect(greater2.y, and3.u[3]); end PreCoolingStarter;

Buildings.Examples.VAVReheat.Controls.RoomTemperatureSetpoint Buildings.Examples.VAVReheat.Controls.RoomTemperatureSetpoint

Set point scheduler for room temperature

Buildings.Examples.VAVReheat.Controls.RoomTemperatureSetpoint

Information

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

Parameters

TypeNameDefaultDescription
TemperatureTHeaOn293.15Heating setpoint during on [K]
TemperatureTHeaOff285.15Heating setpoint during off [K]
TemperatureTCooOn297.15Cooling setpoint during on [K]
TemperatureTCooOff303.15Cooling setpoint during off [K]

Connectors

TypeNameDescription
ControlBuscontrolBus 

Modelica definition

block RoomTemperatureSetpoint "Set point scheduler for room temperature" extends Modelica.Blocks.Icons.Block; import Buildings.Examples.VAVReheat.Controls.OperationModes; parameter Modelica.SIunits.Temperature THeaOn=293.15 "Heating setpoint during on"; parameter Modelica.SIunits.Temperature THeaOff=285.15 "Heating setpoint during off"; parameter Modelica.SIunits.Temperature TCooOn=297.15 "Cooling setpoint during on"; parameter Modelica.SIunits.Temperature TCooOff=303.15 "Cooling setpoint during off"; ControlBus controlBus; Modelica.Blocks.Routing.IntegerPassThrough mode; Modelica.Blocks.Sources.RealExpression setPoiHea( y=if (mode.y == Integer(OperationModes.occupied) or mode.y == Integer(OperationModes.unoccupiedWarmUp) or mode.y == Integer(OperationModes.safety)) then THeaOn else THeaOff); Modelica.Blocks.Sources.RealExpression setPoiCoo( y=if (mode.y == Integer(OperationModes.occupied) or mode.y == Integer(OperationModes.unoccupiedPreCool) or mode.y == Integer(OperationModes.safety)) then TCooOn else TCooOff) "Cooling setpoint"; equation connect(controlBus.controlMode,mode. u); connect(setPoiHea.y, controlBus.TRooSetHea); connect(setPoiCoo.y, controlBus.TRooSetCoo); end RoomTemperatureSetpoint;

Buildings.Examples.VAVReheat.Controls.RoomVAV Buildings.Examples.VAVReheat.Controls.RoomVAV

Controller for room VAV box

Buildings.Examples.VAVReheat.Controls.RoomVAV

Information

Controller for terminal box of VAV system with reheat.

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

Connectors

TypeNameDescription
input RealInputTRooHeaSetSetpoint temperature for room for heating [K]
input RealInputTRooCooSetSetpoint temperature for room for cooling [K]
input RealInputTRooMeasured room temperature [K]
input RealInputTDisMeasured supply air temperature after heating coil [K]
output RealOutputyValSignal for heating coil valve
output RealOutputyDamSignal for VAV damper

Modelica definition

block RoomVAV "Controller for room VAV box" extends Modelica.Blocks.Icons.Block; Buildings.Controls.OBC.CDL.Interfaces.RealInput TRooHeaSet( final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) "Setpoint temperature for room for heating"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TRooCooSet( final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) "Setpoint temperature for room for cooling"; Modelica.Blocks.Interfaces.RealInput TRoo( final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) "Measured room temperature"; Modelica.Blocks.Interfaces.RealInput TDis( final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) "Measured supply air temperature after heating coil"; Modelica.Blocks.Interfaces.RealOutput yVal "Signal for heating coil valve"; Modelica.Blocks.Interfaces.RealOutput yDam "Signal for VAV damper"; Buildings.Controls.OBC.CDL.Continuous.LimPID conHea( yMax=1, xi_start=0.1, Td=60, yMin=0, k=0.1, Ti=120, controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI) "Controller for heating"; Buildings.Controls.Continuous.LimPID conCoo( yMax=1, Td=60, k=0.1, Ti=120, controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI, reverseAction=true) "Controller for cooling (acts on damper)"; protected parameter Real kDamHea = 0.5 "Gain for VAV damper controller in heating mode"; Buildings.Controls.OBC.CDL.Continuous.Max maxDam "Limitation of damper signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant one(k=1); Buildings.Controls.OBC.CDL.Continuous.Add add "Addition of cooling and heating signal (one of which being zero due to dual setpoint)"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant zero(k=0.1); Buildings.Controls.OBC.CDL.Continuous.Min minDam "Limitation of damper signal"; Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum( final k={1,kDamHea,-kDamHea}, nin=3); equation connect(conHea.u_m, TRoo); connect(conCoo.u_m, TRoo); connect(conCoo.y, add.u2); connect(conHea.y,yVal); connect(zero.y, maxDam.u1); connect(maxDam.y, add.u1); connect(add.y, minDam.u1); connect(one.y, minDam.u2); connect(minDam.y, yDam); connect(one.y, mulSum.u[1]); connect(TDis, mulSum.u[2]); connect(TRoo, mulSum.u[3]); connect(maxDam.u2, mulSum.y); connect(conHea.u_s, TRooHeaSet); connect(TRooCooSet, conCoo.u_s); end RoomVAV;

Buildings.Examples.VAVReheat.Controls.State Buildings.Examples.VAVReheat.Controls.State

Block that outputs the mode if the state is active, or zero otherwise

Buildings.Examples.VAVReheat.Controls.State

Information

Extends from Modelica.StateGraph.StepWithSignal (Ordinary step (= step that is not active when simulation starts). Connector 'active' is true when the step is active).

Parameters

TypeNameDefaultDescription
IntegernIn1Number of input connections
IntegernOut1Number of output connections
OperationModesmode Enter enumeration of mode

Connectors

TypeNameDescription
Step_ininPort[nIn]Vector of step input connectors
Step_outoutPort[nOut]Vector of step output connectors
output BooleanOutputactive 
output IntegerOutputyMode signal (=0 if not active)

Modelica definition

model State "Block that outputs the mode if the state is active, or zero otherwise" extends Modelica.StateGraph.StepWithSignal; parameter OperationModes mode "Enter enumeration of mode"; Modelica.Blocks.Interfaces.IntegerOutput y "Mode signal (=0 if not active)"; equation y = if localActive then Integer(mode) else 0; end State;