Example models to test the components
Information
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Package Content
| Name | Description | 
|  OperationModes | Test model for operation modes | 
|  RoomVAV | Test model for the room VAV controller | 
|  SupplyAirTemperature | Validation of the supply air temperature control | 
|  SystemHysteresis | Test model for the system hysteresis | 
Test model for operation modes
 
Information
This model tests the transition between the different modes of operation of the HVAC system.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Connectors
Modelica definition
model OperationModes 
    
extends Modelica.Icons.Example;
  
Buildings.Examples.VAVReheat.BaseClasses.Controls.ModeSelector operationModes;
  
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaFlo;
  
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixTem(T=273.15);
  
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor cap(C=20000, T(fixed=
          true));
  
Modelica.Thermal.HeatTransfer.Components.ThermalConductor con(G=1);
  
Modelica.Blocks.Logical.Switch switch1;
  
Modelica.Blocks.Sources.Constant on(k=200);
  
Modelica.Blocks.Sources.Constant off(k=0);
  
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temperatureSensor;
  
Modelica.Blocks.Sources.RealExpression TRooSetHea(
    y=
if mode.y ==
 Integer(Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes.occupied)
      then 293.15
 else 287.15);
  
Modelica.Blocks.Sources.Constant TCoiHea(k=283.15)
    ;
  
Buildings.Examples.VAVReheat.BaseClasses.Controls.ControlBus controlBus;
  
Modelica.Blocks.Routing.IntegerPassThrough mode ;
  
Modelica.Blocks.Sources.BooleanExpression modSel(
    y=mode.y ==
 Integer(Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes.unoccupiedNightSetBack)
 or 
      mode.y ==
 Integer(Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes.unoccupiedWarmUp));
  
Modelica.Blocks.Sources.Constant TOut(k=283.15) ;
  
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temperatureSensor1;
  
Modelica.Blocks.Sources.BooleanExpression modSel1(
    y=mode.y ==
 Integer(Buildings.Examples.VAVReheat.BaseClasses.Controls.OperationModes.occupied));
  
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaFlo1;
  
Buildings.Controls.Continuous.LimPID PID(initType=Modelica.Blocks.Types.Init.InitialState);
  
Modelica.Blocks.Logical.Switch switch2;
  
Modelica.Blocks.Math.Gain gain(k=200);
  
Buildings.Controls.SetPoints.OccupancySchedule occSch ;
equation 
  connect(fixTem.port, con.port_a);
  
connect(preHeaFlo.port, cap.port);
  
connect(con.port_b, cap.port);
  
connect(switch1.y, preHeaFlo.Q_flow);
  
connect(on.y, switch1.u1);
  
connect(off.y, switch1.u3);
  
connect(cap.port, temperatureSensor.port);
  
connect(controlBus, operationModes.cb);
  
connect(temperatureSensor.T, controlBus.TRooMin);
  
connect(TCoiHea.y, controlBus.TCoiHeaOut);
  
connect(controlBus.controlMode, mode.u);
  
connect(modSel.y, switch1.u2);
  
connect(TOut.y, controlBus.TOut);
  
connect(cap.port, temperatureSensor1.port);
  
connect(temperatureSensor1.T, controlBus.TRooAve);
  
connect(TRooSetHea.y, PID.u_s);
  
connect(temperatureSensor.T, PID.u_m);
  
connect(modSel1.y, switch2.u2);
  
connect(off.y, switch2.u3);
  
connect(preHeaFlo1.port, cap.port);
  
connect(PID.y, switch2.u1);
  
connect(gain.y, preHeaFlo1.Q_flow);
  
connect(switch2.y, gain.u);
  
connect(occSch.tNexOcc, controlBus.dTNexOcc);
  
connect(TRooSetHea.y, controlBus.TRooSetHea);
  
connect(occSch.occupied, controlBus.occupied);
end OperationModes;
 
Test model for the room VAV controller
 
Information
This model tests the VAV box contoller of transition from heating control to cooling
control.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model RoomVAV 
  
extends Modelica.Icons.Example;
  
Buildings.Examples.VAVReheat.BaseClasses.Controls.RoomVAV vavBoxCon(ratVFloMin=0.15,
      ratVFloHea=0.3)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant heaSet(k=273.15 + 21)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant cooSet(k=273.15 + 22)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ram(
    height=4,
    duration=3600,
    offset=-4) ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Sine sin(
    amplitude=1,
    freqHz=1/3600,
    offset=273.15 + 23.5) ;
  
Buildings.Controls.OBC.CDL.Continuous.Add rooTem ;
equation 
  connect(rooTem.y, vavBoxCon.TRoo);
  
connect(cooSet.y, vavBoxCon.TRooCooSet);
  
connect(heaSet.y, vavBoxCon.TRooHeaSet);
  
connect(sin.y, rooTem.u2);
  
connect(ram.y, rooTem.u1);
end RoomVAV;
 
Validation of the supply air temperature control
 
Information
This model validates the supply air temperature control, as implemented in
Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperature
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model SupplyAirTemperature
  
  
extends Modelica.Icons.Example;
  
Buildings.Examples.VAVReheat.BaseClasses.Controls.SupplyAirTemperature conTSup(k=0.1, Ti=
        60)
    ;
  
Buildings.Controls.OBC.CDL.Logical.Sources.Pulse uEna(period=2800)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant TSupSet(
    y(
final unit="K", displayUnit="degC"),
    k=13 + 273.15)
    ;
  
Buildings.Controls.OBC.CDL.Continuous.Sources.Sine TSup(
    phase=3.1415926535898,
    y(
final unit="K", displayUnit="degC"),
    amplitude=5,
    freqHz=2/3600,
    offset=13 + 273.15) ;
equation 
  connect(TSupSet.y, conTSup.TSupSet);
  
connect(uEna.y, conTSup.uEna);
  
connect(TSup.y, conTSup.TSup);
end SupplyAirTemperature;
 
Test model for the system hysteresis
 
Information
This model tests
Buildings.Examples.VAVReheat.BaseClasses.Controls.SystemHysteresis.
In one test, there is repeated on/off, while in the other test, there is only one switch to on.
Note that sys1 has a high frequency input, but the pump signal stays on to avoid short cycling.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition