This model tests the transition between the different modes of operation of the HVAC system.
model OperationModes
"Test model for operation modes"
extends Modelica.Icons.Example;
import ModelicaVAV =
Buildings.Examples.VAVReheat;
ModelicaVAV.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);
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 == ModelicaVAV.Controls.OperationModes.occupied
then
293.15
else 287.15);
Modelica.Blocks.Sources.Constant TCoiHea(k=283.15)
"Temperature after heating coil";
ModelicaVAV.Controls.ControlBus controlBus;
Modelica.Blocks.Routing.IntegerPassThrough mode
"Outputs the control mode";
Modelica.Blocks.Sources.BooleanExpression modSel(y=mode.y == ModelicaVAV.Controls.OperationModes.unoccupiedNightSetBack
or mode.y == ModelicaVAV.Controls.OperationModes.unoccupiedWarmUp);
Modelica.Blocks.Sources.Constant TOut(k=283.15)
"Outside temperature";
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temperatureSensor1;
Modelica.Blocks.Sources.BooleanExpression modSel1(y=mode.y == ModelicaVAV.Controls.OperationModes.occupied);
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaFlo1;
Buildings.Controls.Continuous.LimPID PID;
Modelica.Blocks.Logical.Switch switch2;
Modelica.Blocks.Math.Gain gain(k=200);
Buildings.Controls.SetPoints.OccupancySchedule occSch
"Occupancy schedule";
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;