Sequences for VAV reheat terminal unit
Information
This package contains sequences for VAV reheat terminal unit. They are created
according to ASHRAE Guideline 36, Part 5.E.
Extends from Modelica.Icons.Package (Icon for standard packages).
Package Content
| Name | Description | 
|  DamperValves | Output signals for controlling VAV reheat box damper and valve position | 
|  SystemRequests | Output system requests for VAV reheat terminal unit control | 
|  SetPoints | Output setpoints for terminal unit control | 
|  Validation | Collection of validation models | 
Output signals for controlling VAV reheat box damper and valve position
 
Information
This sequence sets the damper and valve position for VAV reheat terminal unit.
The implementation is according to ASHRAE Guideline 36 (G36), PART5.E.6. The
calculation is done following the steps below.
- 
When the zone state is cooling (uCoo>0), then the cooling loop outputuCooshall be mapped to the airflow
setpoint from the cooling minimumVActCooMinto the cooling maximumVActCooMaxairflow setpoints. The hot water valve is closed (yHeaVal=0)
unless the discharge air temperatureTDisis below the minimum
setpoint (10 °C).
 
- 
If supply air temperature TSupfrom the AHU is greater than
room temperatureTRoo, cooling supply airflow setpoint shall be
no higher than the minimum.
 
- 
When the zone state is Deadband (uCoo=0anduHea=0), then
the active airflow setpoint shall be the minimum airflow setpointVActMin.
Hot water valve is closed unless the discharge air temperature is below the minimum
setpoint (10 °C).
 
- 
When the zone state is Heating (uHea>0), then
the heating loop shall maintain space temperature at the heating setpoint
as follows:
 
- From 0-50%, the heating loop output uHeashall reset the
discharge temperature setpoint from current AHU SAT setpointTSupto a maximum ofdTDisMaxabove space temperature setpoint. The airflow
setpoint shall be the heating minimumVActHeaMin.
- From 50-100%, if the discharge air temperature TDisis
greater than room temperature plus 2.8 Kelvin, the heating loop outputuHeashall reset the airflow setpoint from the heating minimum airflow setpointVActHeaMinto the heating maximum airflow setpointVActHeaMax.
 
- 
The hot water valve (or modulating electric heating coil) shall be modulated
to maintain the discharge temperature at setpoint.
 
- 
The VAV damper shall be modulated by a control loop to maintain the measured
airflow at the active setpoint.
 
The sequences of controlling damper and valve position for VAV reheat terminal
unit are described in the following figure below.
 
Parameters
| Type | Name | Default | Description | 
|---|
| TemperatureDifference | dTDisMax | 11 | Zone maximum discharge air temperature above heating setpoint [K] | 
| Temperature | TDisMin | 283.15 | Lowest discharge air temperature [K] | 
| Valve | 
| SimpleController | controllerTypeVal | Buildings.Controls.OBC.CDL.T... | Type of controller | 
| Real | kVal | 0.5 | Gain of controller for valve control [1/K] | 
| Time | TiVal | 300 | Time constant of integrator block for valve control [s] | 
| Time | TdVal | 0.1 | Time constant of derivative block for valve control [s] | 
| Damper | 
| SimpleController | controllerTypeDam | Buildings.Controls.OBC.CDL.T... | Type of controller | 
| Real | kDam | 0.5 | Gain of controller for damper control [1] | 
| Time | TiDam | 300 | Time constant of integrator block for damper control [s] | 
| Time | TdDam | 0.1 | Time constant of derivative block for damper control [s] | 
| VolumeFlowRate | V_flow_nominal |  | Nominal volume flow rate, used to normalize control error [m3/s] | 
Connectors
| Type | Name | Description | 
|---|
| input RealInput | uHea | Heating control signal [1] | 
| input RealInput | uCoo | Cooling control signal [1] | 
| input RealInput | VActCooMax | Active cooling maximum airflow rate [m3/s] | 
| input RealInput | VActCooMin | Active cooling minimum airflow rate [m3/s] | 
| input RealInput | VActMin | Active minimum airflow rate [m3/s] | 
| input RealInput | VActHeaMin | Active heating minimum airflow rate [m3/s] | 
| input RealInput | VActHeaMax | Active heating maximum airflow rate [m3/s] | 
| input RealInput | VDis | Measured discharge airflow rate airflow rate [m3/s] | 
| input RealInput | TSup | Supply air temperature from central air handler [K] | 
| input RealInput | THeaSet | Zone heating setpoint temperature [K] | 
| input RealInput | TRoo | Measured zone temperature [K] | 
| input RealInput | TDis | Measured discharge air temperature [K] | 
| input IntegerInput | uOpeMod | Zone operation mode | 
| output RealOutput | yDam | Damper position [1] | 
| output RealOutput | yHeaVal | Reheater valve position [1] | 
| output RealOutput | VDisSet | Discharge airflow setpoint [m3/s] | 
| output RealOutput | TDisSet | Discharge airflow setpoint temperature for heating [K] | 
Modelica definition
block DamperValves 
  
parameter Modelica.SIunits.TemperatureDifference dTDisMax=11 ;
  
parameter Modelica.SIunits.Temperature TDisMin=283.15 ;
  
parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerTypeVal
    =Buildings.Controls.OBC.CDL.Types.SimpleController.PI ;
  
parameter Real kVal(
final unit="1/K") = 0.5 ;
  
parameter Modelica.SIunits.Time TiVal=300 ;
  
parameter Modelica.SIunits.Time TdVal=0.1 ;
  
parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerTypeDam
    =Buildings.Controls.OBC.CDL.Types.SimpleController.PI ;
  
parameter Real kDam(
final unit="1") = 0.5 ;
  
parameter Modelica.SIunits.Time TiDam=300 ;
  
parameter Modelica.SIunits.Time TdDam=0.1 ;
  
parameter Modelica.SIunits.VolumeFlowRate V_flow_nominal(min=1E-10) ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput uHea(
    min=0,
    max=1,
    
final unit="1") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput uCoo(
    min=0,
    max=1,
    
final unit="1") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput VActCooMax(
    min=0,
    
final unit="m3/s",
    quantity="VolumeFlowRate") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput VActCooMin(
    min=0,
    
final unit="m3/s",
    quantity="VolumeFlowRate") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput VActMin(
    min=0,
    
final unit="m3/s",
    quantity="VolumeFlowRate") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput VActHeaMin(
    min=0,
    
final unit="m3/s",
    quantity="VolumeFlowRate") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput VActHeaMax(
    min=0,
    
final unit="m3/s",
    quantity="VolumeFlowRate") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput VDis(
    min=0,
    
final unit="m3/s",
    quantity="VolumeFlowRate") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput TSup(
final unit="K", quantity
      ="ThermodynamicTemperature") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput THeaSet(
final unit="K",
      quantity="ThermodynamicTemperature") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput TRoo(
final unit="K", quantity
      ="ThermodynamicTemperature") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput TDis(
final unit="K", quantity
      ="ThermodynamicTemperature") ;
  
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uOpeMod ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealOutput yDam(
    min=0,
    max=1,
    
final unit="1") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealOutput yHeaVal(
    min=0,
    max=1,
    
final unit="1") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealOutput VDisSet(
    min=0,
    
final unit="m3/s",
    quantity="VolumeFlowRate") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealOutput TDisSet(
final unit="K",
      quantity="ThermodynamicTemperature") ;
  
Buildings.Controls.OBC.CDL.Logical.Not not1 ;
  
Buildings.Controls.OBC.CDL.Logical.Not not2 ;
  
Buildings.Controls.OBC.CDL.Logical.Not not4 ;
  
Buildings.Controls.OBC.CDL.Logical.And and2 ;
  
Buildings.Controls.OBC.CDL.Logical.And and4 ;
  
Buildings.Controls.OBC.CDL.Continuous.Line lin ;
  
Buildings.Controls.OBC.CDL.Continuous.Line conTDisSet ;
  
Buildings.Controls.OBC.CDL.Continuous.Line lin3 ;
  
Buildings.Controls.OBC.CDL.Continuous.LimPID conVal(
    
final controllerType=controllerTypeVal,
    
final k=kVal,
    
final Ti=TiVal,
    
final Td=TdVal,
    
final yMax=1,
    
final yMin=0,
    u_s(
final unit="K", displayUnit="degC"),
    u_m(
final unit="K", displayUnit="degC"),
    reset=Buildings.Controls.OBC.CDL.Types.Reset.Parameter) ;
  
Buildings.Controls.OBC.CDL.Continuous.LimPID conDam(
    
final controllerType=controllerTypeDam,
    
final k=kDam,
    
final Ti=TiDam,
    
final Td=TdDam,
    
final yMax=1,
    
final yMin=0,
    
final reset=Buildings.Controls.OBC.CDL.Types.Reset.Parameter,
    
final y_reset=0) ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi1 ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi2 ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi4 ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi5 ;
  
Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum(nin=3) ;
protected 
  Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conZer(
final k=0) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conZer1(
final k=0) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conZer2(
final k=0) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conZer3(
final k=0) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conZer6(
final k=0) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conOne(
final k=1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conOne2(
final k=1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conHal(
final k=0.5) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conHal1(
final k=0.5) ;
  
Buildings.Controls.OBC.CDL.Continuous.AddParameter addPar(
final p=dTDisMax, 
      final k=1) ;
  
Buildings.Controls.OBC.CDL.Continuous.AddParameter addPar1(
final k=1, 
final p
      =2.8) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys2(
final uHigh=0.05, 
      final uLow=0.01) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys3(
final uHigh=0.05, 
      final uLow=0.01) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys4(
final uLow=TDisMin - 0.1,
      
final uHigh=TDisMin + 0.1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys6(
final uLow=-0.1, 
final 
      uHigh=0.1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys7(
final uLow=-0.1, 
final 
      uHigh=0.1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Add add1(
final k2=-1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Add add2(
final k2=-1) ;
  
CDL.Logical.TrueHoldWithReset truHol2(duration=600) ;
  
Buildings.Controls.OBC.CDL.Logical.TrueDelay truDel3(delayTime=600) ;
  
Buildings.Controls.OBC.CDL.Logical.TrueDelay truDel4(delayTime=600) ;
  
CDL.Integers.Equal isUno ;
  
CDL.Integers.Sources.Constant unOcc(k=Buildings.Controls.OBC.ASHRAE.G36_PR1.Types.OperationModes.unoccupied)
    ;
  
CDL.Logical.Switch watValPosUno ;
  
CDL.Logical.Switch damPosUno ;
  
CDL.Logical.Not not5 ;
  
CDL.Continuous.Gain VDisSetNor(
final k=1/V_flow_nominal) ;
  
CDL.Continuous.Gain VDisNor(
final k=1/V_flow_nominal) ;
  
CDL.Continuous.Sources.Constant lowDisAirTem(
final k=TDisMin) ;
  
CDL.Logical.Switch swi6 ;
  
CDL.Logical.Or or2;
  
CDL.Logical.Not not3 ;
  
CDL.Logical.Switch swi3 ;
  
CDL.Logical.Not not6 ;
  
CDL.Logical.And and1;
equation 
  connect(uCoo, lin.u);
  
connect(conZer.y, lin.x1);
  
connect(VActCooMin, lin.f1);
  
connect(conOne.y, lin.x2);
  
connect(VActCooMax, lin.f2);
  
connect(uCoo, hys2.u);
  
connect(conZer1.y, swi.u3);
  
connect(VActMin, swi1.u1);
  
connect(and2.y, swi1.u2);
  
connect(conZer2.y, swi1.u3);
  
connect(uHea, hys3.u);
  
connect(conZer3.y, conTDisSet.x1);
  
connect(TSup, conTDisSet.f1);
  
connect(uHea, conTDisSet.u);
  
connect(conHal.y, conTDisSet.x2);
  
connect(addPar.y, conTDisSet.f2);
  
connect(THeaSet, addPar.u);
  
connect(uHea, lin3.u);
  
connect(conHal1.y, lin3.x1);
  
connect(conOne2.y, lin3.x2);
  
connect(VActHeaMax, lin3.f2);
  
connect(VActHeaMin, lin3.f1);
  
connect(TRoo, addPar1.u);
  
connect(lin3.y, swi2.u1);
  
connect(VActHeaMin, swi2.u3);
  
connect(TDis, hys4.u);
  
connect(swi2.y, swi4.u1);
  
connect(conZer6.y, swi4.u3);
  
connect(swi.y, mulSum.u[1]);
  
connect(swi1.y, mulSum.u[2]);
  
connect(swi4.y, mulSum.u[3]);
  
connect(VActMin, swi5.u1);
  
connect(and4.y, swi5.u2);
  
connect(lin.y, swi5.u3);
  
connect(swi5.y, swi.u1);
  
connect(hys4.y, not4.u);
  
connect(TSup, add2.u1);
  
connect(TRoo, add2.u2);
  
connect(add2.y, hys6.u);
  
connect(hys6.y, and4.u2);
  
connect(conTDisSet.y, add1.u1);
  
connect(addPar1.y, add1.u2);
  
connect(add1.y, hys7.u);
  
connect(mulSum.y, VDisSet);
  
connect(conTDisSet.y, TDisSet);
  
connect(hys3.y, truHol2.u);
  
connect(truHol2.y, swi4.u2);
  
connect(hys2.y, truDel4.u);
  
connect(truDel4.y, and4.u1);
  
connect(truDel4.y, swi.u2);
  
connect(truHol2.y, not2.u);
  
connect(truDel4.y, not1.u);
  
connect(not1.y, and2.u1);
  
connect(not2.y, and2.u2);
  
connect(conVal.u_m, TDis);
  
connect(hys7.y, swi2.u2);
  
connect(unOcc.y, isUno.u1);
  
connect(isUno.u2, uOpeMod);
  
connect(isUno.y, watValPosUno.u2);
  
connect(conZer2.y, watValPosUno.u1);
  
connect(watValPosUno.y, yHeaVal);
  
connect(conZer2.y, damPosUno.u1);
  
connect(conDam.y, damPosUno.u3);
  
connect(damPosUno.y, yDam);
  
connect(isUno.y, damPosUno.u2);
  
connect(isUno.y, not5.u);
  
connect(not5.y, conDam.trigger);
  
connect(mulSum.y, VDisSetNor.u);
  
connect(VDisSetNor.y, conDam.u_s);
  
connect(VDis, VDisNor.u);
  
connect(VDisNor.y, conDam.u_m);
  
connect(truHol2.y, or2.u2);
  
connect(truDel3.y, not3.u);
  
connect(not3.y, or2.u1);
  
connect(or2.y, swi6.u2);
  
connect(conTDisSet.y, swi6.u1);
  
connect(swi6.u3, lowDisAirTem.y);
  
connect(swi3.y, watValPosUno.u3);
  
connect(truHol2.y, not6.u);
  
connect(not6.y, and1.u2);
  
connect(and1.y, swi3.u2);
  
connect(conVal.y, swi3.u3);
  
connect(swi3.u1, conZer2.y);
  
connect(not3.y, and1.u1);
  
connect(not4.y, truDel3.u);
  
connect(not5.y, conVal.trigger);
  
connect(swi6.y, conVal.u_s);
end DamperValves;
 
Output system requests for VAV reheat terminal unit control
 
Information
This sequence outputs the system reset requests, i.e.,
- 
the cooling supply air temperature
reset requests yZonTemResReq,
- 
the static pressure reset requests
yZonPreResReq,
- 
the hot water reset requests yHeaValResReq, and
- 
the boiler plant reset requests yHeaPlaReq.
The calculations are according to ASHRAE
Guideline 36 (G36), PART5.E.9, in the steps shown below.
a. Cooling SAT reset requests yZonTemResReq
- 
If the zone temperature TRooexceeds the zone cooling setpointTCooSetby 2.8 °C (5 °F)) for 2 minutes and after suppression
period due to setpoint change per G36 Part 5.A.20, send 3 requests
(yZonTemResReq=3).
- 
Else if the zone temperature TRooexceeds the zone cooling setpointTCooSetby 1.7 °C (3 °F) for 2 minutes and after suppression
period due to setpoint change per G36 Part 5.A.20, send 2 requests
(yZonTemResReq=3).
- 
Else if the cooling loop uCoois greater than 95%, send 1 request
(yZonTemResReq=1) untiluCoois less than 85%.
- 
Else if uCoois less than 95%, send 0 request (yZonTemResReq=0).
b. Static pressure reset requests yZonPreResReq
- 
If the measured airflow VDisis less than 50% of setpointVDisSetwhile it is greater than zero for 1 minute, send 3 requests
(yZonPreResReq=3).
- 
Else if the measured airflow VDisis less than 70% of setpointVDisSetwhile it is greater than zero for 1 minute, send 2 requests
(yZonPreResReq=2).
- 
Else if the damper position uDamis greater than 95%, send 1 request
(yZonPreResReq=1) untiluDamis less than 85%.
- 
Else if uDamis less than 95%, send 0 request (yZonPreResReq=0).
c. If there is a hot water coil (have_heaWatCoi=true),
hot water reset requests yHeaValResReq
- 
If the discharge air temperature TDisis 17 °C (30 °F)
less than the setpointTDisSetfor 5 minutes, send 3 requests
(yHeaValResReq=3).
- 
Else if the discharge air temperature TDisis 8.3 °C (15 °F)
less than the setpointTDisSetfor 5 minutes, send 2 requests
(yHeaValResReq=2).
- 
Else if the hot water valve position uHeaValis greater than 95%, send 1 request
(yHeaValResReq=1) untiluHeaValis less than 85%.
- 
Else if uHeaValis less than 95%, send 0 request (yHeaValResReq=0).
d. If there is hot water coil (have_heaWatCoi=true) and a boiler plant
(have_boiPla=true), send the boiler plant that serves the zone a boiler
plant requests yHeaPlaReq as follows:
- 
If the hot water valve position uHeaValis greater than 95%, send 1 request
(yHeaPlaReq=1) untiluHeaValis less than 10%.
- 
Else if uHeaValis less than 95%, send 0 request (yHeaPlaReq=0).
Implementation
Some input signals are time sampled, because the output that is generated
from these inputs are used in the trim and respond logic, which
is also time sampled. However, signals that use a delay are not
sampled, as sampling were to change the dynamic response.
Parameters
| Type | Name | Default | Description | 
|---|
| Time | samplePeriod | 120 | Sample period of component, set to the same value as the trim and respond that process yPreSetReq [s] | 
| Boolean | have_heaWatCoi |  | Flag, true if there is a hot water coil | 
| Boolean | have_heaPla |  | Flag, true if there is a boiler plant | 
| TemperatureDifference | cooSetDif_1 | 2.8 | Limit value of difference between zone temperature and cooling setpoint
    for generating 3 cooling SAT reset requests [K] | 
| TemperatureDifference | cooSetDif_2 | 1.7 | Limit value of difference between zone temperature and cooling setpoint
    for generating 2 cooling SAT reset requests [K] | 
| TemperatureDifference | disAirSetDif_1 | 17 | Limit value of difference between discharge air temperature and its setpoint
    for generating 3 hot water reset requests [K] | 
| TemperatureDifference | disAirSetDif_2 | 8.3 | Limit value of difference between discharge air temperature and its setpoint
    for generating 2 hot water reset requests [K] | 
| Duration times | 
| Time | durTimTem | 120 | Duration time of zone temperature exceeds setpoint [s] | 
| Time | durTimFlo | 60 | Duration time of airflow rate less than setpoint [s] | 
| Time | durTimDisAir | 300 | Duration time of discharge air temperature is less than setpoint [s] | 
Connectors
| Type | Name | Description | 
|---|
| input RealInput | TRoo | Zone temperature [K] | 
| input RealInput | TCooSet | Zone cooling setpoint temperature [K] | 
| input RealInput | uCoo | Cooling loop signal [1] | 
| input RealInput | VDis | Measured discharge airflow rate [m3/s] | 
| input RealInput | VDisSet | Discharge airflow rate setpoint [m3/s] | 
| input RealInput | uDam | Damper position [1] | 
| input RealInput | TDisSet | Discharge airflow setpoint temperature for heating [K] | 
| input RealInput | TDis | Measured discharge airflow temperature [K] | 
| input RealInput | uHeaVal | Heating valve position [1] | 
| output IntegerOutput | yZonPreResReq | Zone static pressure reset requests | 
| output IntegerOutput | yZonTemResReq | Zone cooling supply air temperature reset request | 
| output IntegerOutput | yHeaValResReq | Hot water reset requests | 
| output IntegerOutput | yHeaPlaReq | Heating plant request | 
Modelica definition
block SystemRequests 
  
parameter Modelica.SIunits.Time samplePeriod=120 ;
  
parameter Boolean have_heaWatCoi ;
  
parameter Boolean have_heaPla ;
  
parameter Modelica.SIunits.TemperatureDifference cooSetDif_1=2.8 ;
  
parameter Modelica.SIunits.TemperatureDifference cooSetDif_2=1.7 ;
  
parameter Modelica.SIunits.TemperatureDifference disAirSetDif_1=17 ;
  
parameter Modelica.SIunits.TemperatureDifference disAirSetDif_2=8.3 ;
  
parameter Modelica.SIunits.Time durTimTem=120 ;
  
parameter Modelica.SIunits.Time durTimFlo=60 ;
  
parameter Modelica.SIunits.Time durTimDisAir=300 ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput TRoo(
final unit="K", quantity
      ="ThermodynamicTemperature") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput TCooSet(
final unit="K",
      quantity="ThermodynamicTemperature") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput uCoo(
    min=0,
    max=1,
    
final unit="1") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput VDis(
    min=0,
    
final unit="m3/s",
    quantity="VolumeFlowRate") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput VDisSet(
    min=0,
    
final unit="m3/s",
    quantity="VolumeFlowRate") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput uDam(
    min=0,
    max=1,
    
final unit="1") ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput TDisSet(
final unit="K",
      quantity="ThermodynamicTemperature") 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput TDis(
final unit="K", quantity
      ="ThermodynamicTemperature") 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Interfaces.RealInput uHeaVal(
    min=0,
    max=1,
    
final unit="1") 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput yZonPreResReq ;
  
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput yZonTemResReq ;
  
CDL.Interfaces.IntegerOutput yHeaValResReq 
if have_heaWatCoi ;
  
CDL.Interfaces.IntegerOutput yHeaPlaReq 
if (have_heaWatCoi
 and have_heaPla) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys(
final uLow=cooSetDif_1 -
        0.1, 
final uHigh=cooSetDif_1 + 0.1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys3(
final uLow=cooSetDif_2 -
        0.1, 
final uHigh=cooSetDif_2 + 0.1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys4(
final uLow=0.85, 
final 
      uHigh=0.95) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys5(
final uLow=0.85, 
final 
      uHigh=0.95) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys7(
final uHigh=0.01, 
      final uLow=0.005) ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys8(
final uLow=-0.1, 
final 
      uHigh=0.1) 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys9(
final uLow=-0.1, 
final 
      uHigh=0.1) 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys10(
final uLow=0.85, 
      final uHigh=0.95) 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys11(
final uHigh=0.95, 
      final uLow=0.1) 
if (have_heaWatCoi
 and have_heaPla) ;
protected 
  Buildings.Controls.OBC.CDL.Discrete.Sampler samTCooSet(
final samplePeriod=
        samplePeriod) ;
  
Buildings.Controls.OBC.CDL.Discrete.UnitDelay uniDel(
final samplePeriod=
        samplePeriod) ;
  
Buildings.Controls.OBC.CDL.Continuous.Abs abs ;
  
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler triSam ;
  
Buildings.Controls.OBC.CDL.Logical.Edge edg ;
  
Buildings.Controls.OBC.CDL.Logical.Latch lat ;
  
Buildings.Controls.OBC.CDL.Logical.Latch lat1 ;
  
Buildings.Controls.OBC.CDL.Logical.Timer tim ;
  
Buildings.Controls.OBC.CDL.Continuous.GreaterEqual gre ;
  
Buildings.Controls.OBC.CDL.Continuous.GreaterEqual gre1 ;
  
Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys2(
final uLow=0.05, 
final 
      uHigh=0.15) ;
  
Buildings.Controls.OBC.CDL.Continuous.Min supTim ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.ModelTime modTim ;
  
Buildings.Controls.OBC.CDL.Continuous.Gain gai(k=(9/5)*(5*60)) ;
  
Buildings.Controls.OBC.CDL.Continuous.Gain gai1(
final k=0.5) ;
  
Buildings.Controls.OBC.CDL.Continuous.Gain gai2(
final k=0.7) ;
  
Buildings.Controls.OBC.CDL.Continuous.Add add1(
final k1=-1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Add add2(
final k1=-1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Add add3(
final k1=-1) ;
  
Buildings.Controls.OBC.CDL.Continuous.Add add6(
final k2=-1) 
if have_heaWatCoi
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Add add7(
final k2=-1) 
if have_heaWatCoi
    ;
  
Buildings.Controls.OBC.CDL.Continuous.AddParameter addPar(
final k=1, 
final p=
        disAirSetDif_1) 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Continuous.AddParameter addPar1(
final k=1, 
final p
      =disAirSetDif_2) 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt ;
  
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 ;
  
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt2 
if 
    have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt3 
if (
    have_heaWatCoi
 and have_heaPla) ;
  
Buildings.Controls.OBC.CDL.Logical.And and1 ;
  
Buildings.Controls.OBC.CDL.Logical.And and2 ;
  
Buildings.Controls.OBC.CDL.Logical.And and3 ;
  
Buildings.Controls.OBC.CDL.Logical.And and4 ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con(
final k=
        samplePeriod) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conZer(
final k=0) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant thrCooResReq(
final k=3)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant twoCooResReq(
final k=2)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant oneCooResReq(
final k=1)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant zerCooReq(
final k=0) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant thrPreResReq(
final k=3)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant twoPreResReq(
final k=2)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant zerPreResReq(
final k=0)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant onePreResReq(
final k=1)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant thrHeaResReq(
final k=3)
    
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant twoHeaResReq(
final k=2)
    
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant oneHeaResReq(
final k=1)
    
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant zerHeaResReq(
final k=0)
    
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant zerBoiPlaReq(
final k=0)
    
if (have_heaWatCoi
 and have_heaPla) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant oneBoiPlaReq(
final k=1)
    
if (have_heaWatCoi
 and have_heaPla) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant maxSupTim(k=1800) ;
  
Buildings.Controls.OBC.CDL.Logical.Sources.Constant con5(k=true) ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi1 ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi2 ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi3 ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi4 ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi5 ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi6 ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi7 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi8 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi9 
if have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Logical.Switch swi10 
if (have_heaWatCoi
 and 
    have_heaPla) ;
  
Buildings.Controls.OBC.CDL.Logical.TrueHoldWithReset truHol(duration=
        samplePeriod);
  
Buildings.Controls.OBC.CDL.Logical.LogicalSwitch logSwi ;
  
Buildings.Controls.OBC.CDL.Logical.TrueDelay tim1(delayTime=durTimTem) ;
  
Buildings.Controls.OBC.CDL.Logical.TrueDelay tim2(delayTime=durTimTem) ;
  
Buildings.Controls.OBC.CDL.Logical.TrueDelay tim3(delayTime=durTimFlo) ;
  
Buildings.Controls.OBC.CDL.Logical.TrueDelay tim4(delayTime=durTimDisAir) 
if 
    have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Logical.TrueDelay tim5(delayTime=durTimDisAir) 
if 
    have_heaWatCoi ;
  
Buildings.Controls.OBC.CDL.Discrete.Sampler sampler(
final samplePeriod=
        samplePeriod) ;
  
Buildings.Controls.OBC.CDL.Discrete.Sampler sampler1(
final samplePeriod=
        samplePeriod) ;
  
Buildings.Controls.OBC.CDL.Discrete.Sampler sampler2(
final samplePeriod=
        samplePeriod) ;
  
Buildings.Controls.OBC.CDL.Discrete.Sampler sampler4(
final samplePeriod=
        samplePeriod) ;
  
Buildings.Controls.OBC.CDL.Continuous.GreaterEqual greEqu ;
  
Buildings.Controls.OBC.CDL.Continuous.GreaterEqual greEqu1 ;
equation 
  connect(add2.y, hys.u);
  
connect(TCooSet, samTCooSet.u);
  
connect(samTCooSet.y, uniDel.u);
  
connect(triSam.y, gai.u);
  
connect(hys2.y, lat.u);
  
connect(lat.y, tim.u);
  
connect(tim.y, gre.u1);
  
connect(edg.y, triSam.trigger);
  
connect(lat.y, edg.u);
  
connect(edg.y, lat1.u0);
  
connect(modTim.y, gre1.u1);
  
connect(con.y, gre1.u2);
  
connect(uniDel.y, add1.u1);
  
connect(samTCooSet.y, add1.u2);
  
connect(gre1.y, swi.u2);
  
connect(add1.y, swi.u1);
  
connect(conZer.y, swi.u3);
  
connect(swi.y, abs.u);
  
connect(abs.y, triSam.u);
  
connect(abs.y, hys2.u);
  
connect(and2.y, swi1.u2);
  
connect(thrCooResReq.y, swi1.u1);
  
connect(add3.y, hys3.u);
  
connect(twoCooResReq.y, swi2.u1);
  
connect(swi2.y, swi1.u3);
  
connect(and1.y, swi2.u2);
  
connect(hys5.y, swi3.u2);
  
connect(oneCooResReq.y, swi3.u1);
  
connect(swi3.y, swi2.u3);
  
connect(zerCooReq.y, swi3.u3);
  
connect(swi1.y, reaToInt.u);
  
connect(reaToInt.y, yZonTemResReq);
  
connect(and3.y, swi4.u2);
  
connect(thrPreResReq.y, swi4.u1);
  
connect(and4.y, swi5.u2);
  
connect(twoPreResReq.y, swi5.u1);
  
connect(swi5.y, swi4.u3);
  
connect(hys4.y, swi6.u2);
  
connect(onePreResReq.y, swi6.u1);
  
connect(zerPreResReq.y, swi6.u3);
  
connect(swi6.y, swi5.u3);
  
connect(swi4.y, reaToInt1.u);
  
connect(reaToInt1.y, yZonPreResReq);
  
connect(TDis, addPar.u);
  
connect(addPar.y, add6.u2);
  
connect(TDisSet, add6.u1);
  
connect(add6.y, hys8.u);
  
connect(addPar1.y, add7.u2);
  
connect(add7.y, hys9.u);
  
connect(hys9.y, tim5.u);
  
connect(thrHeaResReq.y, swi7.u1);
  
connect(twoHeaResReq.y, swi8.u1);
  
connect(swi8.y, swi7.u3);
  
connect(TDis, addPar1.u);
  
connect(TDisSet, add7.u1);
  
connect(uHeaVal, hys10.u);
  
connect(hys10.y, swi9.u2);
  
connect(oneHeaResReq.y, swi9.u1);
  
connect(zerHeaResReq.y, swi9.u3);
  
connect(swi9.y, swi8.u3);
  
connect(swi7.y, reaToInt2.u);
  
connect(reaToInt2.y, yHeaValResReq);
  
connect(uHeaVal, hys11.u);
  
connect(hys11.y, swi10.u2);
  
connect(oneBoiPlaReq.y, swi10.u1);
  
connect(zerBoiPlaReq.y, swi10.u3);
  
connect(swi10.y, reaToInt3.u);
  
connect(reaToInt3.y, yHeaPlaReq);
  
connect(gre.y, truHol.u);
  
connect(truHol.y, lat.u0);
  
connect(gre.y, lat1.u);
  
connect(lat.y, logSwi.u2);
  
connect(con5.y, logSwi.u3);
  
connect(lat1.y, logSwi.u1);
  
connect(logSwi.y, and2.u1);
  
connect(logSwi.y, and1.u1);
  
connect(gai.y, supTim.u1);
  
connect(maxSupTim.y, supTim.u2);
  
connect(supTim.y, gre.u2);
  
connect(tim5.y, swi8.u2);
  
connect(hys8.y, tim4.u);
  
connect(tim4.y, swi7.u2);
  
connect(hys7.y, tim3.u);
  
connect(tim3.y, and3.u1);
  
connect(tim3.y, and4.u1);
  
connect(hys3.y, tim2.u);
  
connect(tim2.y, and1.u2);
  
connect(hys.y, tim1.u);
  
connect(tim1.y, and2.u2);
  
connect(sampler.u, VDisSet);
  
connect(sampler.y, gai1.u);
  
connect(sampler.y, gai2.u);
  
connect(sampler1.u, VDis);
  
connect(uDam, sampler2.u);
  
connect(sampler2.y, hys4.u);
  
connect(uCoo, sampler4.u);
  
connect(sampler4.y, hys5.u);
  
connect(samTCooSet.y, add2.u1);
  
connect(samTCooSet.y, add3.u1);
  
connect(hys7.u, VDisSet);
  
connect(add2.u2, TRoo);
  
connect(add3.u2, TRoo);
  
connect(greEqu.u1, gai1.y);
  
connect(greEqu.u2, sampler1.y);
  
connect(greEqu.y, and3.u2);
  
connect(gai2.y, greEqu1.u1);
  
connect(sampler1.y, greEqu1.u2);
  
connect(greEqu1.y, and4.u2);
end SystemRequests;