Buildings.Examples.VAVReheat.BaseClasses.Controls

Package with controller models

Information

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

Package Content

Name Description
Buildings.Examples.VAVReheat.BaseClasses.Controls.ControlBus ControlBus Empty control bus that is adapted to the signals connected to it
Buildings.Examples.VAVReheat.BaseClasses.Controls.DuctStaticPressureSetpoint DuctStaticPressureSetpoint Computes the duct static pressure setpoint
Buildings.Examples.VAVReheat.BaseClasses.Controls.Economizer Economizer Controller for economizer
Buildings.Examples.VAVReheat.BaseClasses.Controls.FanVFD FanVFD Controller for fan revolution
Buildings.Examples.VAVReheat.BaseClasses.Controls.FreezeStat FreezeStat Freeze thermostat with timed lockout
Buildings.Examples.VAVReheat.BaseClasses.Controls.ModeSelector ModeSelector Finite State Machine for the operational modes
Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes OperationModes Enumeration for modes of operation
Buildings.Examples.VAVReheat.BaseClasses.Controls.PreCoolingStarter PreCoolingStarter Outputs true when precooling should start
Buildings.Examples.VAVReheat.BaseClasses.Controls.RoomTemperatureSetpoint RoomTemperatureSetpoint Set point scheduler for room temperature
Buildings.Examples.VAVReheat.BaseClasses.Controls.RoomVAV RoomVAV Controller for room VAV box
Buildings.Examples.VAVReheat.BaseClasses.Controls.State State Block that outputs the mode if the state is active, or zero otherwise
Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperature SupplyAirTemperature Control block for tracking the supply air temperature set point
Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperatureSetpoint SupplyAirTemperatureSetpoint Block computing the supply air temperature set point based on the operation mode
Buildings.Examples.VAVReheat.BaseClasses.Controls.SystemHysteresis SystemHysteresis Block that applies hysteresis and a minimum on timer to a control signal
Buildings.Examples.VAVReheat.BaseClasses.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.BaseClasses.Controls.ControlBus Buildings.Examples.VAVReheat.BaseClasses.Controls.ControlBus

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

Buildings.Examples.VAVReheat.BaseClasses.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.BaseClasses.Controls.DuctStaticPressureSetpoint Buildings.Examples.VAVReheat.BaseClasses.Controls.DuctStaticPressureSetpoint

Computes the duct static pressure setpoint

Buildings.Examples.VAVReheat.BaseClasses.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

Modelica definition

model DuctStaticPressureSetpoint "Computes the duct static pressure setpoint" extends Modelica.Blocks.Interfaces.MISO; parameter Modelica.Units.SI.AbsolutePressure pMin(displayUnit="Pa") = 100 "Minimum duct static pressure setpoint"; parameter Modelica.Units.SI.AbsolutePressure pMax(displayUnit="Pa") = 410 "Maximum duct static pressure setpoint"; parameter Real k=0.1 "Gain of controller"; parameter Modelica.Units.SI.Time Ti=60 "Time constant of integrator block"; parameter Modelica.Units.SI.Time Td=60 "Time constant of derivative block"; parameter Modelica.Blocks.Types.SimpleController controllerType=Modelica.Blocks.Types.SimpleController.PI "Type of controller"; Buildings.Controls.Continuous.LimPID limPID( controllerType=controllerType, k=k, Ti=Ti, Td=Td, initType=Modelica.Blocks.Types.Init.InitialState, reverseActing=false); 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; 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(product.y, pSet.u1); end DuctStaticPressureSetpoint;

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

Controller for economizer

Buildings.Examples.VAVReheat.BaseClasses.Controls.Economizer

Information

This is a controller for an economizer, that adjusts the mixed air dampers to fulfill three control functions.

  1. Freeze protection, based on the mixed air temperature measurement
  2. Minimum outside air requirement, based on the outdoor air flow rate measurement
  3. Supply air cooling, based on the logic implemented in Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperature, with the additional condition that when the outside air dry bulb is greater than the return air dry bulb, economizer cooling is disabled.

Parameters

TypeNameDefaultDescription
Booleanhave_resetfalseSet to true to reset the outdoor air damper controllers with the enable signal
Booleanhave_freProfalseSet to true to enable freeze protection (mixed air low temperature control)
TemperatureTFreSet277.15Lower limit of mixed air temperature for freeze protection [K]
TemperatureDifferencedTLock1Temperature difference between return and outdoor air for economizer lockout [K]
VolumeFlowRateVOut_flow_min Minimum outside air volume flow rate [m3/s]
SimpleControllercontrollerTypeModelica.Blocks.Types.Simple...Type of controller
Realk0.05Gain of controller
TimeTi120Time constant of integrator block [s]

Connectors

TypeNameDescription
input BooleanInputuEnaEnable signal for economizer
ControlBuscontrolBusControl bus
input RealInputuOATSupControl signal for outdoor air damper from supply temperature controller
input RealInputTMixMeasured mixed air temperature
input RealInputVOut_flowMeasured outside air flow rate
input RealInputTRetReturn air temperature
output RealOutputyRetControl signal for return air damper
output RealOutputyOAControl signal for outside air damper

Modelica definition

block Economizer "Controller for economizer" import Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes; parameter Boolean have_reset = false "Set to true to reset the outdoor air damper controllers with the enable signal"; parameter Boolean have_frePro = false "Set to true to enable freeze protection (mixed air low temperature control)"; parameter Modelica.Units.SI.Temperature TFreSet=277.15 "Lower limit of mixed air temperature for freeze protection"; parameter Modelica.Units.SI.TemperatureDifference dTLock(final min=0.1) = 1 "Temperature difference between return and outdoor air for economizer lockout"; parameter Modelica.Units.SI.VolumeFlowRate VOut_flow_min(min=0) "Minimum outside air volume flow rate"; parameter Modelica.Blocks.Types.SimpleController controllerType=Modelica.Blocks.Types.SimpleController.PI "Type of controller"; parameter Real k = 0.05 "Gain of controller"; parameter Modelica.Units.SI.Time Ti=120 "Time constant of integrator block"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput uEna "Enable signal for economizer"; ControlBus controlBus "Control bus"; Modelica.Blocks.Interfaces.RealInput uOATSup "Control signal for outdoor air damper from supply temperature controller"; Modelica.Blocks.Interfaces.RealInput TMix if have_frePro "Measured mixed air temperature"; Modelica.Blocks.Interfaces.RealInput VOut_flow "Measured outside air flow rate"; Modelica.Blocks.Interfaces.RealInput TRet "Return air temperature"; Modelica.Blocks.Interfaces.RealOutput yRet "Control signal for return air damper"; Modelica.Blocks.Interfaces.RealOutput yOA "Control signal for outside air damper"; Modelica.Blocks.Math.Gain gain(k=1/VOut_flow_min) "Normalize mass flow rate"; Buildings.Controls.OBC.CDL.Continuous.PID conV_flow( controllerType=controllerType, k=k, Ti=Ti, yMax=1, yMin=0, Td=60) "Controller for outside air flow rate"; Modelica.Blocks.Sources.Constant uni(k=1) "Unity signal"; Modelica.Blocks.Sources.Constant closed(k=0) "Signal to close OA damper"; Buildings.Controls.OBC.CDL.Continuous.PID yOATFre( controllerType=controllerType, k=k, Ti=Ti, Td=60, yMax=1, yMin=0, reverseActing=false) if have_frePro "Controller of outdoor damper to track freeze temperature setpoint"; Buildings.Controls.OBC.CDL.Continuous.Min minFrePro "Takes lower signal (limits damper opening for freeze protection)"; Modelica.Blocks.Sources.Constant TFre(k=TFreSet) "Setpoint for freeze protection"; Buildings.Controls.OBC.CDL.Continuous.Subtract invSig "Invert control signal for interlocked damper"; Modelica.Blocks.Logical.Hysteresis hysLoc(final uLow=0, final uHigh=dTLock) "Hysteresis for economizer lockout"; Modelica.Blocks.Math.Feedback feedback; Buildings.Controls.OBC.CDL.Continuous.Switch swiOA "Switch to close outdoor air damper"; Modelica.Blocks.Sources.Constant one(k=1) if not have_frePro "Fill value in case freeze protection is disabled"; Buildings.Controls.OBC.CDL.Continuous.Switch swiModClo "Switch between modulating or closing outdoor air damper"; Buildings.Controls.OBC.CDL.Continuous.Max maxOutDam "Select larger of the outdoor damper signals"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conOne( final k=1) "Constant 1"; equation connect(VOut_flow, gain.u); connect(gain.y, conV_flow.u_m); connect(uni.y, conV_flow.u_s); connect(yOATFre.y, minFrePro.u1); connect(yRet, invSig.y); connect(feedback.y, hysLoc.u); connect(TRet, feedback.u1); connect(controlBus.TOut, feedback.u2); connect(closed.y, swiOA.u3); connect(hysLoc.y, swiOA.u2); connect(uOATSup, swiOA.u1); connect(one.y, minFrePro.u1); connect(yOATFre.u_s, TFre.y); connect(TMix, yOATFre.u_m); connect(swiModClo.y, yOA); connect(uEna, swiModClo.u2); connect(closed.y, swiModClo.u3); connect(maxOutDam.u1, swiOA.y); connect(conV_flow.y, maxOutDam.u2); connect(minFrePro.y, swiModClo.u1); connect(maxOutDam.y, minFrePro.u2); connect(swiModClo.y, invSig.u2); connect(conOne.y, invSig.u1); end Economizer;

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

Controller for fan revolution

Buildings.Examples.VAVReheat.BaseClasses.Controls.FanVFD

Information

PI controller for the fan speed. The controller outputs y = 0 if the fan control signal is off, e.g., if uFan = false.

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
SimpleControllercontrollerTypeModelica.Blocks.Types.Simple...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.BaseClasses.Controls.OperationModes; Buildings.Controls.OBC.CDL.Continuous.PIDWithReset con( r=xSet_nominal, yMax=1, Td=60, yMin=r_N_min, k=k, Ti=Ti, controllerType=controllerType) "Controller"; parameter Real xSet_nominal "Nominal setpoint (used for normalization)"; Modelica.Blocks.Sources.Constant off(k=0) "Off 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.Units.SI.Time Ti=15 "Time constant of integrator block"; Buildings.Controls.OBC.CDL.Continuous.Switch swi; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput uFan "Set to true to enable the fan on"; equation connect(con.y, swi.u1); connect(off.y, swi.u3); connect(swi.u2, uFan); connect(swi.y, y); connect(con.trigger, uFan); connect(con.u_s, u); connect(u_m, con.u_m); end FanVFD;

Buildings.Examples.VAVReheat.BaseClasses.Controls.FreezeStat Buildings.Examples.VAVReheat.BaseClasses.Controls.FreezeStat

Freeze thermostat with timed lockout

Buildings.Examples.VAVReheat.BaseClasses.Controls.FreezeStat

Information

Freeze stat that outputs true if freeze protection should be engaged.

The freeze stat regulates around a set point. When it triggers freeze protection, then the freeze protection stays engaged for at least delayTime. It only becomes disengaged after this time period if the measured temperature is above the set point.

Parameters

TypeNameDefaultDescription
ReallockoutTime900Delay time [s]
RealTSet276.15Temperature below which the freeze protection starts [K]

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal used as measurement signal [K]
output BooleanOutputyConnector of Real output signal used as actuator signal

Modelica definition

model FreezeStat "Freeze thermostat with timed lockout" parameter Real lockoutTime( final quantity="Time", final unit="s", displayUnit="min", min=60) = 900 "Delay time"; parameter Real TSet( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") = 276.15 "Temperature below which the freeze protection starts"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") "Connector of Real input signal used as measurement signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Connector of Real output signal used as actuator signal"; Buildings.Controls.OBC.CDL.Logical.TrueDelay locOut(final delayTime= lockoutTime) "If freeze stat triggers, keep it on for specified time"; Buildings.Controls.OBC.CDL.Logical.Not freStaSig "Signal for freeze stat"; Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greThr( final t=TSet, final h=0.5) "Greater comparison"; equation connect(locOut.y, freStaSig.u); connect(freStaSig.y, y); connect(greThr.y, locOut.u); connect(greThr.u, u); end FreezeStat;

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

Finite State Machine for the operational modes

Buildings.Examples.VAVReheat.BaseClasses.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]

Connectors

TypeNameDescription
ControlBuscb 
output BooleanOutputyFanTrue if the fans are to be switched on
output BooleanOutputyEcoTrue if the economizer is enabled

Modelica definition

model ModeSelector "Finite State Machine for the operational modes" Modelica.StateGraph.InitialStepWithSignal initialStepWithSignal(nIn=0, nOut=1); Modelica.StateGraph.Transition start "Starts the system"; State unOccOff( mode=Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes.unoccupiedOff, nIn=3, nOut=4) "Unoccupied off mode, no coil protection"; State unOccNigSetBac( nOut=2, mode=Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes.unoccupiedNightSetBack, nIn=1) "Unoccupied night set back"; Modelica.StateGraph.Transition t2( enableTimer=true, waitTime=60, condition=TRooMinErrHea.y > delTRooOnOff/2); parameter Modelica.Units.SI.TemperatureDifference delTRooOnOff(min=0.1) = 1 "Deadband in room temperature between occupied on and occupied off"; parameter Modelica.Units.SI.Temperature TRooSetHeaOcc=293.15 "Set point for room air temperature during heating mode"; parameter Modelica.Units.SI.Temperature TRooSetCooOcc=299.15 "Set point for room air temperature during cooling mode"; 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.BaseClasses.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.BaseClasses.Controls.OperationModes.occupied, nIn=3, nOut=1) "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=1, mode=Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes.unoccupiedPreCool, nOut=1) "Pre-cooling mode"; Modelica.StateGraph.Transition t7(condition=TRooMin.y - delTRooOnOff/2 < TRooSetCooOcc or occupied.y); Modelica.Blocks.Routing.RealPassThrough TRooAve "Average room temperature"; Modelica.Blocks.Sources.BooleanExpression booleanExpression( y=occThrSho.y and (TRooAve.y < TRooSetHeaOcc)) "Test that outputs true if room temperature is below occupied heating and system should be switched on soon"; 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=6); Modelica.Blocks.Interfaces.BooleanOutput yFan "True if the fans are to be switched on"; Modelica.Blocks.MathBoolean.Or or1(nu=4); Modelica.Blocks.Interfaces.BooleanOutput yEco "True if the economizer is enabled"; Modelica.Blocks.MathBoolean.Or or2(nu=2) "Occupied or pre-cool mode"; Buildings.Controls.OBC.CDL.Logical.And and3 "(Occupied or pre-cool mode) and fan on"; Modelica.Blocks.Math.BooleanToInteger modIni(integerTrue=Integer(Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes.unoccupiedOff)) "Initial operation mode"; equation connect(start.outPort, unOccOff.inPort[1]); connect(initialStepWithSignal.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(cb.TRooAve, TRooAve.u); 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(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]); connect(yEco, and3.y); connect(or1.y, and3.u1); connect(or2.y, and3.u2); connect(occ.active, or2.u[1]); connect(morPreCoo.active, or2.u[2]); connect(initialStepWithSignal.active, modIni.u); connect(sum.y, cb.controlMode); connect(modIni.y, sum.u[6]); connect(t6.condition, booleanExpression.y); connect(t5.condition, booleanExpression.y); end ModeSelector;

Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes

Enumeration for modes of operation

Modelica definition

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.BaseClasses.Controls.PreCoolingStarter Buildings.Examples.VAVReheat.BaseClasses.Controls.PreCoolingStarter

Outputs true when precooling should start

Buildings.Examples.VAVReheat.BaseClasses.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.Units.SI.Temperature TOutLim=286.15 "Limit for activating precooling"; parameter Modelica.Units.SI.Temperature TRooSetCooOcc "Set point for room air temperature during cooling mode"; BaseClasses.Controls.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.BaseClasses.Controls.RoomTemperatureSetpoint Buildings.Examples.VAVReheat.BaseClasses.Controls.RoomTemperatureSetpoint

Set point scheduler for room temperature

Buildings.Examples.VAVReheat.BaseClasses.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.BaseClasses.Controls.OperationModes; parameter Modelica.Units.SI.Temperature THeaOn=293.15 "Heating setpoint during on"; parameter Modelica.Units.SI.Temperature THeaOff=285.15 "Heating setpoint during off"; parameter Modelica.Units.SI.Temperature TCooOn=297.15 "Cooling setpoint during on"; parameter Modelica.Units.SI.Temperature TCooOff=303.15 "Cooling setpoint during off"; BaseClasses.Controls.ControlBus controlBus; Modelica.Blocks.Routing.IntegerPassThrough mode; Modelica.Blocks.Sources.RealExpression setPoiHea( y(final unit="K", displayUnit="degC")=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(final unit="K", displayUnit="degC")=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.BaseClasses.Controls.RoomVAV Buildings.Examples.VAVReheat.BaseClasses.Controls.RoomVAV

Controller for room VAV box

Buildings.Examples.VAVReheat.BaseClasses.Controls.RoomVAV

Information

Controller for terminal VAV box with hot water reheat and pressure independent damper. It is based on the control logic "dual maximum with constant volume heating" as described in the Advanced VAV System Design Guide (EDR 2007).

Two separate control loops, the cooling loop and the heating loop, are implemented to maintain space temperature within a temperature dead band (with a required minimum width of 0.5 K). The damper control signal yDam corresponds to the discharge air flow rate set point, normalized to the nominal value. The control signal for the reheat coil valve yVal corresponds to the fractional opening (1 corresponding to the valve fully open).

Note that a single maximum control logic can be represented by simply setting ratVFloHea equal to ratVFloMin (default setting).

image

References

EDR (Energy Design Resources). Advanced Variable Air Volume System Design Guide. Pacific Gas and Electric Company, 2007.


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

Parameters

TypeNameDefaultDescription
RealratVFloMin0.3Minimum airflow set point (ratio to nominal) [1]
RealratVFloHearatVFloMinHeating airflow set point (ratio to nominal) [1]
Cooling controller
SimpleControllercooControllerBuildings.Controls.OBC.CDL.T...Type of controller
RealkCoo0.1Gain of controller
TimeTiCoo120Time constant of integrator block [s]
TimeTdCoo60Time constant of derivative block [s]
Heating controller
SimpleControllerheaControllerBuildings.Controls.OBC.CDL.T...Type of controller
RealkHea0.1Gain of controller
TimeTiHea120Time constant of integrator block [s]
TimeTdHea60Time constant of derivative block [s]

Connectors

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

Modelica definition

block RoomVAV "Controller for room VAV box" extends Modelica.Blocks.Icons.Block; parameter Real ratVFloMin(final unit="1") = 0.3 "Minimum airflow set point (ratio to nominal)"; parameter Real ratVFloHea(final unit="1") = ratVFloMin "Heating airflow set point (ratio to nominal)"; parameter Buildings.Controls.OBC.CDL.Types.SimpleController cooController= Buildings.Controls.OBC.CDL.Types.SimpleController.PI "Type of controller"; parameter Real kCoo=0.1 "Gain of controller"; parameter Modelica.Units.SI.Time TiCoo=120 "Time constant of integrator block"; parameter Modelica.Units.SI.Time TdCoo=60 "Time constant of derivative block"; parameter Buildings.Controls.OBC.CDL.Types.SimpleController heaController= Buildings.Controls.OBC.CDL.Types.SimpleController.PI "Type of controller"; parameter Real kHea=0.1 "Gain of controller"; parameter Modelica.Units.SI.Time TiHea=120 "Time constant of integrator block"; parameter Modelica.Units.SI.Time TdHea=60 "Time constant of derivative block"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TRooHeaSet( final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC") "Setpoint temperature for room for heating"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TRooCooSet( final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC") "Setpoint temperature for room for cooling"; Modelica.Blocks.Interfaces.RealInput TRoo( final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC") "Measured room temperature"; Modelica.Blocks.Interfaces.RealOutput yDam "Signal for VAV damper"; Modelica.Blocks.Interfaces.RealOutput yVal "Signal for heating coil valve"; Buildings.Controls.OBC.CDL.Continuous.PID conHea( yMax=yMax, Td=TdHea, yMin=yMin, k=kHea, Ti=TiHea, controllerType=heaController, Ni=10) "Controller for heating"; Buildings.Controls.OBC.CDL.Continuous.PID conCoo( yMax=yMax, Td=TdCoo, k=kCoo, Ti=TiCoo, controllerType=cooController, yMin=yMin, reverseActing=false) "Controller for cooling (acts on damper)"; Buildings.Controls.OBC.CDL.Continuous.Line reqFlo "Required flow rate"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant cooMax(k=1) "Cooling maximum flow"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant minFloCoo( final k=ratVFloMin) "Minimum air flow set point"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conOne(k=1) "Constant 1"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conZer(k=0) "Constant 0"; Buildings.Controls.OBC.CDL.Continuous.Hysteresis hysWitHol( final uLow=-dTHys, final uHigh=0) "Output true if room temperature below heating set point"; Buildings.Controls.OBC.CDL.Continuous.Subtract dTHea "Heating loop control error"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant minFloHea( final k=ratVFloHea) "Minimum air flow set point in heating mode"; Buildings.Controls.OBC.CDL.Continuous.Switch swi "Switch between heating and deadband air flow rate"; Buildings.Controls.OBC.CDL.Utilities.Assert assMes(message= "The difference between cooling and heating set points must be greater than dTHys") "Assert message"; Buildings.Controls.OBC.CDL.Continuous.Subtract dTSet "Difference between cooling and heating set points"; Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greThr(t=dTHys) "Test for overlap of heating and cooling set points "; protected parameter Real yMax=1 "Upper limit of PID control output"; parameter Real yMin=0 "Lower limit of PID control output"; parameter Modelica.Units.SI.TemperatureDifference dTHys(final min=0) = 0.5 "Hysteresis width for switching minimum air flow rate"; equation connect(TRooCooSet, conCoo.u_s); connect(TRoo, conHea.u_m); connect(TRooHeaSet, conHea.u_s); connect(conHea.y, yVal); connect(conZer.y, reqFlo.x1); connect(cooMax.y, reqFlo.f2); connect(conOne.y, reqFlo.x2); connect(conCoo.y, reqFlo.u); connect(TRoo, conCoo.u_m); connect(reqFlo.y, yDam); connect(TRooHeaSet, dTHea.u1); connect(dTHea.y, hysWitHol.u); connect(TRoo, dTHea.u2); connect(minFloCoo.y, swi.u3); connect(minFloHea.y, swi.u1); connect(hysWitHol.y, swi.u2); connect(swi.y, reqFlo.f1); connect(TRooCooSet, dTSet.u1); connect(TRooHeaSet, dTSet.u2); connect(dTSet.y, greThr.u); connect(greThr.y, assMes.u); end RoomVAV;

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

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

Buildings.Examples.VAVReheat.BaseClasses.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
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(nIn=1, nOut=1); 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;

Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperature Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperature

Control block for tracking the supply air temperature set point

Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperature

Information

This block implements the control logic for the supply air temperature, as described in the control sequence VAV 2A2-21232 of the Sequences of Operation for Common HVAC Systems (ASHRAE, 2006).

The heating coil valve, outdoor air damper, and cooling coil valve are modulated in sequence to maintain the supply air temperature set point. A deadband between heating and economizer cooling is also modeled.

Note that the economizer lockout when the outdoor air temperature is higher than the return air temperature is implemented in Buildings.Examples.VAVReheat.BaseClasses.Controls.Economizer.

References

ASHRAE. Sequences of Operation for Common HVAC Systems. ASHRAE, Atlanta, GA, 2006.

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

Parameters

TypeNameDefaultDescription
Booleanhave_heatingtrueSet to true for heating and cooling functions (false for cooling only)
SimpleControllercontrollerTypeBuildings.Controls.OBC.CDL.T...Type of controller
Realk0.01Gain of controller
TimeTi120Time constant of integrator block [s]
TimeTd0.1Time constant of derivative block [s]

Connectors

TypeNameDescription
input BooleanInputuEnaSignal enabling set point tracking
input RealInputTSupSupply air temperature measurement [K]
input RealInputTSupSetSupply air temperature set point [K]
output RealOutputyHeaControl signal for heating coil valve [1]
output RealOutputyOAControl signal for outdoor air damper [1]
output RealOutputyCooControl signal for cooling coil valve [1]

Modelica definition

block SupplyAirTemperature "Control block for tracking the supply air temperature set point" extends Modelica.Blocks.Icons.Block; parameter Boolean have_heating = true "Set to true for heating and cooling functions (false for cooling only)"; parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType= Buildings.Controls.OBC.CDL.Types.SimpleController.PI "Type of controller"; parameter Real k(min=0) = 0.01 "Gain of controller"; parameter Modelica.Units.SI.Time Ti(min=Buildings.Controls.OBC.CDL.Constants.small) = 120 "Time constant of integrator block"; parameter Modelica.Units.SI.Time Td(min=0) = 0.1 "Time constant of derivative block"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput uEna "Signal enabling set point tracking"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TSup( final unit="K", displayUnit="degC") "Supply air temperature measurement"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TSupSet( final unit="K", displayUnit="degC") "Supply air temperature set point"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yHea( final unit="1") if have_heating "Control signal for heating coil valve"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yOA(final unit="1") "Control signal for outdoor air damper"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yCoo(final unit="1") "Control signal for cooling coil valve"; Buildings.Controls.OBC.CDL.Continuous.PIDWithReset con( final controllerType=controllerType, final k=k, final Ti=Ti, final Td=Td, final yMax=1, final yMin=if have_heating then -1 else 0, y_reset=if have_heating then limSupHea.k else limInfOA.k, u_s( final unit="K", displayUnit="degC"), u_m( final unit="K", displayUnit="degC")) "Supply temperature controller"; Buildings.Controls.OBC.CDL.Continuous.Line mapHea if have_heating "Mapping function for actuating the heating coil valve "; Buildings.Controls.OBC.CDL.Continuous.Line mapOA "Mapping function for actuating the outdoor air damper"; Buildings.Controls.OBC.CDL.Continuous.Line mapCoo "Mapping function for actuating the cooling coil valve"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant limInfHea(k=-1) "Inferior limit of the control signal for heating coil control "; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant limSupHea(k=-0.5) "Superior limit of the control signal for heating coil control "; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant limInfOA(k=0) "Inferior limit of the control signal for outdoor air damper control "; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant limSupOA(k=0.5) "Superior limit of the control signal for outdoor air damper control "; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant limSupCoo(k=1) "Superior limit of the control signal for cooling coil control "; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant zero(k=0) "Zero"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant one(k=1) "one"; Buildings.Controls.OBC.CDL.Continuous.Switch swiHea if have_heating "Switch to close heating coil valve"; Buildings.Controls.OBC.CDL.Continuous.Switch swiCoo "Switch to close cooling coil valve"; Buildings.Controls.OBC.CDL.Continuous.Switch swiOA "Switch to close outdoor air damper"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant limInfCoo( k=limSupOA.k) "Inferior limit of the control signal for cooling coil control "; equation connect(TSup, con.u_s); connect(TSupSet, con.u_m); connect(con.y, mapOA.u); connect(con.y, mapCoo.u); connect(con.y, mapHea.u); connect(limInfHea.y, mapHea.x1); connect(limSupHea.y, mapHea.x2); connect(limInfOA.y, mapOA.x1); connect(limSupOA.y, mapOA.x2); connect(limSupCoo.y, mapCoo.x2); connect(one.y, mapCoo.f2); connect(zero.y, mapHea.f2); connect(one.y, mapOA.f2); connect(zero.y, mapOA.f1); connect(one.y, mapHea.f1); connect(zero.y, mapCoo.f1); connect(swiHea.y, yHea); connect(mapHea.y, swiHea.u1); connect(mapCoo.y, swiCoo.u1); connect(zero.y, swiHea.u3); connect(zero.y, swiCoo.u3); connect(swiOA.y, yOA); connect(mapOA.y, swiOA.u1); connect(zero.y, swiOA.u3); connect(uEna, swiCoo.u2); connect(uEna, swiOA.u2); connect(uEna, swiHea.u2); connect(swiCoo.y, yCoo); connect(limInfCoo.y, mapCoo.x1); connect(uEna, con.trigger); end SupplyAirTemperature;

Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperatureSetpoint Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperatureSetpoint

Block computing the supply air temperature set point based on the operation mode

Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperatureSetpoint

Information

This block computes the supply air temperature set point based on the actual operating mode. The default set point values are taken from the control sequence VAV 2A2-21232 of the Sequences of Operation for Common HVAC Systems (ASHRAE, 2006).

Operating modeSet point value [C]
Occupied12
Unoccupied off12
Unoccupied, night set back35
Unoccupied, warm-up35
Unoccupied, pre-cool12
Safety7

References

ASHRAE. Sequences of Operation for Common HVAC Systems. ASHRAE, Atlanta, GA, 2006.

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

Connectors

TypeNameDescription
ControlBuscontrolBus 
output RealOutputTSetSupply air temperature set point [K]

Modelica definition

block SupplyAirTemperatureSetpoint "Block computing the supply air temperature set point based on the operation mode" extends Modelica.Blocks.Icons.Block; BaseClasses.Controls.ControlBus controlBus; Buildings.Controls.OBC.CDL.Interfaces.RealOutput TSet( final unit="K", displayUnit="degC") "Supply air temperature set point"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant TSetVal[6](k={12,12,35, 35,12,7} .+ 273.15) "Set point values for each operating mode"; Modelica.Blocks.Routing.IntegerPassThrough mode; Modelica.Blocks.Sources.RealExpression ext(y=TSetVal[mode.y].y) "Extract set point value corresponding to actual mode"; equation connect(TSet, controlBus.TAirSupSet); connect(controlBus.controlMode, mode.u); connect(ext.y, TSet); end SupplyAirTemperatureSetpoint;

Buildings.Examples.VAVReheat.BaseClasses.Controls.SystemHysteresis Buildings.Examples.VAVReheat.BaseClasses.Controls.SystemHysteresis

Block that applies hysteresis and a minimum on timer to a control signal

Buildings.Examples.VAVReheat.BaseClasses.Controls.SystemHysteresis

Information

Block that ensure that the system runs for a minimum time once it is switched on.

Connectors

TypeNameDescription
input RealInputuControl signal
output RealOutputyReal output signal
output RealOutputyPumControl signal for pump
input BooleanInputsysOnSystem on signal, set for example to true if fan is on

Modelica definition

model SystemHysteresis "Block that applies hysteresis and a minimum on timer to a control signal" Buildings.Controls.OBC.CDL.Interfaces.RealInput u "Control signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput y "Real output signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yPum "Control signal for pump"; Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greThr( t=0.1, h=0.09) "Threshold to switch on system"; Buildings.Controls.OBC.CDL.Continuous.Switch swi "Switch for control signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con(final k=0) "Zero output signal"; Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea "Switch for pump control signal"; Buildings.Controls.OBC.CDL.Logical.TrueFalseHold truFalHol1( trueHoldDuration(displayUnit="h") = 14400, final falseHoldDuration=0) "Keep pump running at least for trueHoldDuration"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput sysOn "System on signal, set for example to true if fan is on"; Buildings.Controls.OBC.CDL.Continuous.Switch swiSysOff "Switch to overide if system is off"; Buildings.Controls.OBC.CDL.Continuous.Switch swiSysOff1 "Switch to overide if system is off"; equation connect(greThr.u, u); connect(swi.u1, u); connect(con.y, swi.u3); connect(greThr.y, truFalHol1.u); connect(truFalHol1.y, swi.u2); connect(truFalHol1.y, booToRea.u); connect(sysOn, swiSysOff.u2); connect(swiSysOff.y, y); connect(swi.y, swiSysOff.u1); connect(con.y, swiSysOff.u3); connect(swiSysOff1.y, yPum); connect(booToRea.y, swiSysOff1.u1); connect(swiSysOff1.u3, con.y); connect(sysOn, swiSysOff1.u2); end SystemHysteresis;