Collection of validation models
Information
This package contains validation models for blocks in
Buildings.Controls.OBC.Utilities.
Package Content
Name |
Description |
OptimalStartCoolingNegativeStartTime
|
Validation model for the block OptimalStart for cooling system with a negative start time |
OptimalStartCoolingPositiveStartTime
|
Validation model for the block OptimalStart for cooling system with a positive start time |
OptimalStartHeating
|
Validation model for the block OptimalStart for heating system |
OptimalStartHeatingCooling
|
Validation model for the block OptimalStart for both heating and cooling system |
OptimalStartNoHeatingNoCooling
|
Validation model for the block OptimalStart for the case with no preheating nor precooling |
PIDWithInputGains
|
Test model for PIDWithInputGains |
Validation model for the block OptimalStart for cooling system with a negative start time
Information
This model is to validate the block
Buildings.Controls.OBC.Utilities.OptimalStart for space cooling system with
a negative simulation start time.
The room is modeled as a simple differential equation with a time constant of
around 5.6 hours. The cooling power is relatively large compared to the heat gain from
the outdoor temperature. The outdoor temperature is repetitive each day;
the optimal start time converges to a small amount of time tOpt
after a few days.
Modelica definition
model OptimalStartCoolingNegativeStartTime
Buildings.Controls.OBC.Utilities.OptimalStart optStaCoo(
computeHeating=false,
computeCooling=true)
;
Modelica.Blocks.Continuous.Integrator TRoo(
k=0.0000005,
y_start=24+273.15)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant TSetCooOcc(
k=24+273.15)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Sin TOut(
amplitude=5,
freqHz=1/86400,
offset=28+273.15,
startTime(
displayUnit="s")=-691200)
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter UA(k=100)
;
Buildings.Controls.OBC.CDL.Reals.Subtract dT
;
Buildings.Controls.OBC.CDL.Reals.Add dTdt
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter QCoo(k=-2000)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea(
realTrue=-6)
;
Buildings.Controls.OBC.CDL.Reals.Add add
;
Buildings.Controls.OBC.CDL.Reals.PID conPID(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
Ti=1,
reverseActing=false)
;
Buildings.Controls.SetPoints.OccupancySchedule occSch(
occupancy=3600*{7,19},
period=24*3600)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal TSetCoo(
realTrue=273.15+24,
realFalse=273.15+30,
y(
final unit="K",
displayUnit="degC"))
;
equation
connect(dT.y,UA.u);
connect(dTdt.y,TRoo.u);
connect(QCoo.y,dTdt.u2);
connect(TRoo.y,optStaCoo.TZon);
connect(TSetCooOcc.y,optStaCoo.TSetZonCoo);
connect(UA.y,dTdt.u1);
connect(optStaCoo.optOn,booToRea.u);
connect(add.y,conPID.u_s);
connect(TRoo.y,conPID.u_m);
connect(occSch.tNexOcc,optStaCoo.tNexOcc);
connect(conPID.y,QCoo.u);
connect(occSch.occupied,TSetCoo.u);
connect(TSetCoo.y,add.u2);
connect(booToRea.y,add.u1);
connect(TRoo.y, dT.u2);
connect(TOut.y, dT.u1);
end OptimalStartCoolingNegativeStartTime;
Validation model for the block OptimalStart for cooling system with a positive start time
Information
This model is to validate the block
Buildings.Controls.OBC.Utilities.OptimalStart for space cooling system
with a positive simulation start time.
The room is modeled as a simple differential equation with a time constant of
around 5.6 hours. The cooling power is relatively large compared to the heat gain from
the outdoor temperature. The outdoor temperature is repetitive each day;
the optimal start time converges to a small amount of time tOpt
after a few days.
Modelica definition
model OptimalStartCoolingPositiveStartTime
Buildings.Controls.OBC.Utilities.OptimalStart optStaCoo(
computeHeating=false,
computeCooling=true)
;
Modelica.Blocks.Continuous.Integrator TRoo(
k=0.0000005,
y_start=24+273.15)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant TSetCooOcc(
k=24+273.15)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Sin TOut(
amplitude=5,
freqHz=1/86400,
offset=28+273.15,
startTime(
displayUnit="s")=0)
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter UA(k=100)
;
Buildings.Controls.OBC.CDL.Reals.Subtract dT
;
Buildings.Controls.OBC.CDL.Reals.Add dTdt
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter QCoo(k=-2000)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea(
realTrue=-6)
;
Buildings.Controls.OBC.CDL.Reals.Add add
;
Buildings.Controls.OBC.CDL.Reals.PID conPID(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
Ti=1,
reverseActing=false)
;
Buildings.Controls.SetPoints.OccupancySchedule occSch(
occupancy=3600*{7,19},
period=24*3600)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal TSetCoo(
realTrue=273.15+24,
realFalse=273.15+30,
y(
final unit="K",
displayUnit="degC"))
;
equation
connect(dT.y,UA.u);
connect(dTdt.y,TRoo.u);
connect(QCoo.y,dTdt.u2);
connect(TRoo.y,optStaCoo.TZon);
connect(TSetCooOcc.y,optStaCoo.TSetZonCoo);
connect(UA.y,dTdt.u1);
connect(optStaCoo.optOn,booToRea.u);
connect(add.y,conPID.u_s);
connect(TRoo.y,conPID.u_m);
connect(occSch.tNexOcc,optStaCoo.tNexOcc);
connect(conPID.y,QCoo.u);
connect(occSch.occupied,TSetCoo.u);
connect(TSetCoo.y,add.u2);
connect(booToRea.y,add.u1);
connect(TRoo.y, dT.u2);
connect(TOut.y, dT.u1);
end OptimalStartCoolingPositiveStartTime;
Validation model for the block OptimalStart for heating system
Information
This model is to validate the block
Buildings.Controls.OBC.Utilities.OptimalStart for space heating system.
The room is modeled as a simple differential equation with a time constant of
around 5.6 hours.
The outdoor temperature is also repetitive each day;
the optimal start time converges to a small amount of time tOpt
after a few days.
Modelica definition
model OptimalStartHeating
Buildings.Controls.OBC.Utilities.OptimalStart optStaHea(
computeHeating=true,
computeCooling=false)
;
Modelica.Blocks.Continuous.Integrator TRoo(
k=0.000005,
y_start=21+273.15)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant TSetHeaOcc(
k=21+273.15)
;
Buildings.Controls.SetPoints.OccupancySchedule occSch(
occupancy=3600*{7,19},
period=24*3600)
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter UA(k=10)
;
Buildings.Controls.OBC.CDL.Reals.Subtract dT
;
Buildings.Controls.OBC.CDL.Reals.Add dTdt
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter QHea(k=500)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea(
realTrue=6)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Sin TOut(
amplitude=10,
freqHz=1/86400,
phase=3.1415926535898,
offset=10+273.15,
startTime(
displayUnit="d")=-172800)
;
Buildings.Controls.OBC.CDL.Reals.PID conPID(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
Ti=1.5)
;
Buildings.Controls.OBC.CDL.Reals.Add add
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal TSetHea(
realTrue=273.15+21,
realFalse=273.15+15,
y(
final unit="K",
displayUnit="degC"))
;
equation
connect(dT.y,UA.u);
connect(dTdt.y,TRoo.u);
connect(QHea.y,dTdt.u2);
connect(TRoo.y,optStaHea.TZon);
connect(occSch.tNexOcc,optStaHea.tNexOcc);
connect(TSetHeaOcc.y,optStaHea.TSetZonHea);
connect(UA.y,dTdt.u1);
connect(add.y,conPID.u_s);
connect(conPID.y,QHea.u);
connect(TRoo.y,conPID.u_m);
connect(optStaHea.optOn,booToRea.u);
connect(TSetHea.u,occSch.occupied);
connect(TSetHea.y,add.u2);
connect(booToRea.y,add.u1);
connect(TOut.y, dT.u1);
connect(TRoo.y, dT.u2);
end OptimalStartHeating;
Validation model for the block OptimalStart for both heating and cooling system
Information
This models validates both space heating and cooling for the block
Buildings.Controls.OBC.Utilities.OptimalStart.
The first ten days is to test the heating case with a lower outdoor temperature.
The next ten days has a higher outdoor temprature, which is to test the cooling case.
The zone model has a time constant of 27.8 hours. The optimal start block converges separately
to an optimal start time for heating and cooling. Note that during the three transition
days, the zone temperature is in the deadband, so there is no need to optimally start
the heating or cooling system in advance.
Modelica definition
model OptimalStartHeatingCooling
Buildings.Controls.OBC.Utilities.OptimalStart optSta(
computeHeating=true,
computeCooling=true)
;
Modelica.Blocks.Continuous.Integrator TRoo(
k=0.0000004,
y_start=19+273.15)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant TSetCooOcc(
k=24+273.15)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Sin TOutBase(
amplitude=5,
freqHz=1/86400,
offset=15+273.15,
startTime(
displayUnit="h")=0)
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter UA(k=25)
;
Buildings.Controls.OBC.CDL.Reals.Subtract dT
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter QCoo(k=-4000)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea1(
realTrue=-6)
;
Buildings.Controls.OBC.CDL.Reals.Add add1
;
Buildings.Controls.OBC.CDL.Reals.PID conPID1(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
Ti=3,
reverseActing=false)
;
Buildings.Controls.SetPoints.OccupancySchedule occSch(
occupancy=3600*{7,19},
period=24*3600)
;
Buildings.Controls.OBC.CDL.Reals.MultiSum mulSum(
nin=3)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant TSetHeaOcc(
k=21+273.15)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea2(
realTrue=6)
;
Buildings.Controls.OBC.CDL.Reals.Add add2
;
Buildings.Controls.OBC.CDL.Reals.PID conPID(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
Ti=3)
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter QHea(k=2000)
;
Buildings.Controls.OBC.CDL.Reals.Add TOut
;
Buildings.Controls.OBC.CDL.Reals.Sources.Pulse pul(
shift(
displayUnit="d")=604800,
amplitude=15,
period(
displayUnit="d")=1209600)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal TSetHea(
realTrue=273.15+21,
realFalse=273.15+15,
y(
final unit="K",
displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal TSetCoo(
realTrue=273.15+24,
realFalse=273.15+30,
y(
final unit="K",
displayUnit="degC"))
;
equation
connect(dT.y,UA.u);
connect(TRoo.y,optSta.TZon);
connect(TSetCooOcc.y,optSta.TSetZonCoo);
connect(optSta.optOn,booToRea1.u);
connect(add1.y,conPID1.u_s);
connect(TRoo.y,conPID1.u_m);
connect(occSch.tNexOcc,optSta.tNexOcc);
connect(UA.y,mulSum.u[1]);
connect(TRoo.u,mulSum.y);
connect(TSetHeaOcc.y,optSta.TSetZonHea);
connect(optSta.optOn,booToRea2.u);
connect(add2.y,conPID.u_s);
connect(conPID1.y,QCoo.u);
connect(conPID.y,QHea.u);
connect(QCoo.y,mulSum.u[2]);
connect(QHea.y,mulSum.u[3]);
connect(TOutBase.y,TOut.u1);
connect(pul.y,TOut.u2);
connect(TSetCoo.y,add1.u2);
connect(occSch.occupied,TSetCoo.u);
connect(TSetHea.u,occSch.occupied);
connect(booToRea1.y,add1.u1);
connect(booToRea2.y,add2.u1);
connect(TSetHea.y,add2.u2);
connect(TRoo.y, conPID.u_m);
connect(TOut.y, dT.u1);
connect(TRoo.y, dT.u2);
end OptimalStartHeatingCooling;
Validation model for the block OptimalStart for the case with no preheating nor precooling
Information
This models validates the block
Buildings.Controls.OBC.Utilities.OptimalStart for the case when the optimal start
is not turned on for preheating or precooling before the scheduled occupancy.
The results shows that the optimal start time tOpt
remains zero and
the optimal start on signal optOn
remains false during the simulation.
Modelica definition
model OptimalStartNoHeatingNoCooling
Buildings.Controls.OBC.Utilities.OptimalStart optSta(
computeHeating=false,
computeCooling=false)
;
Modelica.Blocks.Continuous.Integrator TRoo(
k=0.0000004,
y_start=19+273.15)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Sin TOutBase(
amplitude=5,
freqHz=1/86400,
offset=15+273.15,
startTime(
displayUnit="h")=0)
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter UA(k=25)
;
Buildings.Controls.OBC.CDL.Reals.Subtract dT
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter QCoo(k=-4000)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea1(
realTrue=-6)
;
Buildings.Controls.OBC.CDL.Reals.Add add1
;
Buildings.Controls.OBC.CDL.Reals.PID conPID1(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
Ti=3,
reverseActing=false)
;
Buildings.Controls.SetPoints.OccupancySchedule occSch(
occupancy=3600*{7,19},
period=24*3600)
;
Buildings.Controls.OBC.CDL.Reals.MultiSum mulSum(
nin=3)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea2(
realTrue=6)
;
Buildings.Controls.OBC.CDL.Reals.Add add2
;
Buildings.Controls.OBC.CDL.Reals.PID conPID(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
Ti=3)
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter QHea(k=2000)
;
Buildings.Controls.OBC.CDL.Reals.Add TOut
;
Buildings.Controls.OBC.CDL.Reals.Sources.Pulse pul(
shift(
displayUnit="d")=604800,
amplitude=15,
period(
displayUnit="d")=1209600)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal TSetHea(
realTrue=273.15+21,
realFalse=273.15+15,
y(
final unit="K",
displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal TSetCoo(
realTrue=273.15+24,
realFalse=273.15+30,
y(
final unit="K",
displayUnit="degC"))
;
equation
connect(dT.y,UA.u);
connect(TRoo.y,optSta.TZon);
connect(optSta.optOn,booToRea1.u);
connect(add1.y,conPID1.u_s);
connect(TRoo.y,conPID1.u_m);
connect(occSch.tNexOcc,optSta.tNexOcc);
connect(UA.y,mulSum.u[1]);
connect(TRoo.u,mulSum.y);
connect(optSta.optOn,booToRea2.u);
connect(add2.y,conPID.u_s);
connect(conPID1.y,QCoo.u);
connect(conPID.y,QHea.u);
connect(QCoo.y,mulSum.u[2]);
connect(QHea.y,mulSum.u[3]);
connect(TOutBase.y,TOut.u1);
connect(pul.y,TOut.u2);
connect(TSetCoo.y,add1.u2);
connect(occSch.occupied,TSetCoo.u);
connect(TSetHea.u,occSch.occupied);
connect(TSetHea.y,add2.u2);
connect(booToRea2.y,add2.u1);
connect(booToRea1.y,add1.u1);
connect(TRoo.y, conPID.u_m);
connect(TOut.y, dT.u1);
connect(TRoo.y, dT.u2);
end OptimalStartNoHeatingNoCooling;
Test model for PIDWithInputGains
Information
Validation test for the block
Buildings.Controls.OBC.Utilities.PIDWithInputGains.
For t ∈ [0, 0.6] both PID controllers have the same gains.
During this time, they generate the same output.
Afterwards, the gains, and hence also their outputs, differ.
Buildings.Controls.OBC.CDL.Reals.PIDWithReset.
Modelica definition
model PIDWithInputGains
Buildings.Controls.OBC.CDL.Reals.Sources.Pulse pulse(
period=0.25)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant const(
k=0.5)
;
Buildings.Controls.OBC.Utilities.PIDWithInputGains PIDWitInpGai(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID)
;
Buildings.Controls.OBC.CDL.Reals.PIDWithReset PID(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID,
k=1,
Ti=0.5,
Td=0.1)
;
Buildings.Controls.OBC.CDL.Logical.Sources.Pulse resSig(period=1)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Pulse k(
amplitude=0.2,
width=0.4,
period=1,
shift=0.6,
offset=1)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Pulse Ti(
amplitude=0.2,
width=0.4,
period=1,
shift=0.6,
offset=0.5)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Pulse Td(
amplitude=0.1,
width=0.4,
period=1,
shift=0.6,
offset=0.1)
;
CDL.Reals.Abs abs1 ;
CDL.Reals.Subtract sub ;
CDL.Reals.LessThreshold lesThr(t=1E-5, h=1E-4)
;
CDL.Utilities.Assert assMes(message="Control outputs differ more than expected")
;
CDL.Reals.Sources.ModelTime modTim
;
CDL.Reals.GreaterThreshold greThr(t=0.59)
;
CDL.Logical.Or or2
;
equation
connect(resSig.y, PID.trigger);
connect(PIDWitInpGai.trigger, PID.trigger);
connect(pulse.y, PID.u_s);
connect(PIDWitInpGai.u_s, PID.u_s);
connect(const.y, PID.u_m);
connect(PIDWitInpGai.u_m, PID.u_m);
connect(k.y, PIDWitInpGai.k);
connect(PIDWitInpGai.Ti, Ti.y);
connect(PIDWitInpGai.Td, Td.y);
connect(PID.y, sub.u1);
connect(PIDWitInpGai.y, sub.u2);
connect(sub.y, abs1.u);
connect(abs1.y, lesThr.u);
connect(modTim.y, greThr.u);
connect(greThr.y, or2.u1);
connect(lesThr.y, or2.u2);
connect(or2.y, assMes.u);
end PIDWithInputGains;