Skip to content

Commit

Permalink
Added test case for #2000
Browse files Browse the repository at this point in the history
  • Loading branch information
mwetter committed Jun 10, 2020
1 parent 3744db5 commit 45d9dc9
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
simulateModel("Buildings.ThermalZones.EnergyPlus.Validation.NonalignedSchedule", stopTime=172800, tolerance=1e-06, resultFile="NonalignedSchedule");
createPlot(id=4, position={166, 388, 592, 372}, y={"zonAli.TAir", "zonNonAli.TAir"}, range={0.0, 180000.0, 275.0, 295.0}, grid=true, colors={{28,108,200}, {238,46,47}});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
compareVars :=
{
"zonAli.TAir",
"zonNonAli.TAir"
};
84 changes: 84 additions & 0 deletions Buildings/ThermalZones/EnergyPlus/Validation/NonalignedSchedule.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
within Buildings.ThermalZones.EnergyPlus.Validation;
model NonalignedSchedule
"Validation model in which the schedule input is not aligned with the EnergyPlus time step"
extends Modelica.Icons.Example;


model Zone "Model of a thermal zone"
extends Buildings.ThermalZones.EnergyPlus.Validation.OneZoneEquipmentScheduleNonSampled(intLoaFra(
amplitude=amplitude,
width=width,
period(displayUnit="min") = 1200,
startTime(displayUnit="min") = startTime), schInt(useSamplePeriod=true,
samplePeriod=60));
extends Modelica.Blocks.Icons.Block;
Controls.OBC.CDL.Interfaces.RealOutput movMeaSch
"Moving mean of schedule value over past day" annotation (Placement(
transformation(extent={{100,20},{140,60}}), iconTransformation(extent={{100,22},
{140,62}})));
Controls.OBC.CDL.Continuous.MovingMean movMea(delta=1200)
"Moving mean of schedule value over past day"
annotation (Placement(transformation(extent={{-40,40},{-20,60}})));
Modelica.Blocks.Interfaces.RealOutput TAir(unit="K", displayUnit="degC") "Air temperature of the zone"
annotation (Placement(transformation(extent={{100,-10},{120,10}}),
iconTransformation(extent={{100,-10},{120,10}})));
parameter Real amplitude=1 "Amplitude of pulse";
parameter Modelica.SIunits.Time startTime(displayUnit="min") = 600
"Output = offset for time < startTime";
parameter Real width=0.5 "Width of pulse in fraction of period";
Controls.OBC.CDL.Discrete.Sampler sam(samplePeriod=120) "Time sampler"
annotation (Placement(transformation(extent={{0,40},{20,60}})));
equation
connect(zon.TAir, TAir) annotation (Line(points={{41,13.8},{80,13.8},{80,0},
{110,0}}, color={0,0,127}));
connect(movMea.u, intLoaFra.y) annotation (Line(points={{-42,50},{-50,50},{-50,
80},{-58,80}}, color={0,0,127}));
connect(movMea.y, sam.u)
annotation (Line(points={{-18,50},{-2,50}}, color={0,0,127}));
connect(sam.y, movMeaSch) annotation (Line(points={{22,50},{46,50},{46,40},{120,
40}}, color={0,0,127}));
end Zone;

Zone zonAli "Zone with schedule aligned with EnergyPlus time step"
annotation (Placement(transformation(extent={{-10,20},{10,40}})));

Zone zonNonAli(
amplitude=2,
startTime=660,
width=0.25) "Zone with schedule not aligned with EnergyPlus time step"
annotation (Placement(transformation(extent={{-10,-32},{10,-12}})));
annotation (Documentation(info="<html>
<p>
Model that validates that
schedule values need not be aligned with the EnergyPlus time step.
In this situation,
if it represents a continuous-valued schedule (such as for an internal gain),
EnergyPlus should time-average the schedule values over the EnergyPlus time step.
If it represents an instantaneous value such as a control state, then
EnergyPlus should use the instantaneuous value at the start of the EnergyPlus time
step.
This validation tests a continuous-valued schedule.
</p>
<p>
Both buildings are identical, but in one building, the schedule that
determines the internal heat gains switches
on and off every 10 minutes, while in the other one the schedule is on
from 3 minutes and off after 8 minutes, but the schedule values is twice as
large in order to add the same amount of internal heat to the zone over an EnergyPlus
time step. Because EnergyPlus uses a fixed time step, both models must result in the same air temperature.
</p>
</html>", revisions="<html>
<ul>
<li>
June 10, 2020, by Michael Wetter:<br/>
First implementation.
</li>
</ul>
</html>"),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/ThermalZones/EnergyPlus/Validation/NonalignedSchedule.mos"
"Simulate and plot"),
experiment(
StopTime=172800,
Tolerance=1e-06));

end NonalignedSchedule;
1 change: 1 addition & 0 deletions Buildings/ThermalZones/EnergyPlus/Validation/package.order
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
NonalignedSchedule
OneZone
OneZoneCompareZoneTemperatureOutput
OneZoneEquipmentScheduleNonSampled
Expand Down

0 comments on commit 45d9dc9

Please sign in to comment.