Skip to content

Commit

Permalink
#10857 - Existing unit test is broken for SingleHeating/SingleCooling…
Browse files Browse the repository at this point in the history
…: schedule reported the opposite

#10857 (comment)
  • Loading branch information
jmarrec committed Dec 17, 2024
1 parent acda84e commit cf934f5
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1792,6 +1792,17 @@ TEST_F(EnergyPlusFixture, FillPredefinedTableOnThermostatSchedules_Test)
using namespace EnergyPlus::OutputReportPredefined;

state->dataScheduleMgr->Schedule.allocate(5);
constexpr int SingleHeatingSchIndex = 1;
constexpr int SingleCoolingSchIndex = 2;
constexpr int SingleHeatCoolSchIndex = 3;
constexpr int DualSetPointWDeadBandHeatSchIndex = 4;
constexpr int DualSetPointWDeadBandCoolSchIndex = 5;
state->dataScheduleMgr->Schedule(SingleHeatingSchIndex).Name = "SINGLEHEATINGSCH";
state->dataScheduleMgr->Schedule(SingleCoolingSchIndex).Name = "SINGLECOOLINGSCH";
state->dataScheduleMgr->Schedule(SingleHeatCoolSchIndex).Name = "SINGLEHEATCOOLSCH";
state->dataScheduleMgr->Schedule(DualSetPointWDeadBandHeatSchIndex).Name = "DUALSETPOINTWDEADBANDHEATSCH";
state->dataScheduleMgr->Schedule(DualSetPointWDeadBandCoolSchIndex).Name = "DUALSETPOINTWDEADBANDCOOLSCH";

state->dataScheduleMgr->ScheduleInputProcessed = true;

auto &orp = *state->dataOutRptPredefined;
Expand All @@ -1810,8 +1821,7 @@ TEST_F(EnergyPlusFixture, FillPredefinedTableOnThermostatSchedules_Test)
dzc.TempControlledZone(1).ControlTypeName.allocate(dzc.TempControlledZone(1).NumControlTypes);
dzc.TempControlledZone(1).ControlTypeEnum(1) = HVAC::ThermostatType::SingleHeating;
dzc.TempControlledZone(1).ControlTypeName(1) = "control A";
dzc.TempControlledZone(1).SchIndx_SingleHeatSetPoint = 1;
state->dataScheduleMgr->Schedule(1).Name = "schA";
dzc.TempControlledZone(1).SchIndx_SingleHeatSetPoint = SingleHeatingSchIndex;

dzc.TempControlledZone(2).ZoneName = "zoneB";
dzc.TempControlledZone(2).Name = "stat B";
Expand All @@ -1821,8 +1831,7 @@ TEST_F(EnergyPlusFixture, FillPredefinedTableOnThermostatSchedules_Test)
dzc.TempControlledZone(2).ControlTypeName.allocate(dzc.TempControlledZone(1).NumControlTypes);
dzc.TempControlledZone(2).ControlTypeEnum(1) = HVAC::ThermostatType::SingleCooling;
dzc.TempControlledZone(2).ControlTypeName(1) = "control B";
dzc.TempControlledZone(2).SchIndx_SingleCoolSetPoint = 2;
state->dataScheduleMgr->Schedule(2).Name = "schB";
dzc.TempControlledZone(2).SchIndx_SingleCoolSetPoint = SingleCoolingSchIndex;

dzc.TempControlledZone(3).ZoneName = "zoneC";
dzc.TempControlledZone(3).Name = "stat C";
Expand All @@ -1832,8 +1841,7 @@ TEST_F(EnergyPlusFixture, FillPredefinedTableOnThermostatSchedules_Test)
dzc.TempControlledZone(3).ControlTypeName.allocate(dzc.TempControlledZone(1).NumControlTypes);
dzc.TempControlledZone(3).ControlTypeEnum(1) = HVAC::ThermostatType::SingleHeatCool;
dzc.TempControlledZone(3).ControlTypeName(1) = "control C";
dzc.TempControlledZone(3).SchIndx_SingleHeatCoolSetPoint = 3;
state->dataScheduleMgr->Schedule(3).Name = "schC";
dzc.TempControlledZone(3).SchIndx_SingleHeatCoolSetPoint = SingleHeatCoolSchIndex;

dzc.TempControlledZone(4).ZoneName = "zoneD";
dzc.TempControlledZone(4).Name = "stat D";
Expand All @@ -1843,38 +1851,36 @@ TEST_F(EnergyPlusFixture, FillPredefinedTableOnThermostatSchedules_Test)
dzc.TempControlledZone(4).ControlTypeName.allocate(dzc.TempControlledZone(1).NumControlTypes);
dzc.TempControlledZone(4).ControlTypeEnum(1) = HVAC::ThermostatType::DualSetPointWithDeadBand;
dzc.TempControlledZone(4).ControlTypeName(1) = "control D";
dzc.TempControlledZone(4).SchIndx_DualSetPointWDeadBandHeat = 4;
dzc.TempControlledZone(4).SchIndx_DualSetPointWDeadBandCool = 5;
state->dataScheduleMgr->Schedule(4).Name = "schD";
state->dataScheduleMgr->Schedule(5).Name = "schE";
dzc.TempControlledZone(4).SchIndx_DualSetPointWDeadBandHeat = DualSetPointWDeadBandHeatSchIndex;
dzc.TempControlledZone(4).SchIndx_DualSetPointWDeadBandCool = DualSetPointWDeadBandCoolSchIndex;

FillPredefinedTableOnThermostatSchedules(*state);

EXPECT_EQ("stat A", RetrievePreDefTableEntry(*state, orp.pdchStatName, "zoneA"));
EXPECT_EQ("control schedule A", RetrievePreDefTableEntry(*state, orp.pdchStatCtrlTypeSchd, "zoneA"));
EXPECT_EQ("SingleHeating", RetrievePreDefTableEntry(*state, orp.pdchStatSchdType1, "zoneA"));
EXPECT_EQ("control A", RetrievePreDefTableEntry(*state, orp.pdchStatSchdTypeName1, "zoneA"));
EXPECT_EQ("schA", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneA"));
EXPECT_EQ("NOT FOUND", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneA"));
EXPECT_EQ("SINGLEHEATINGSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneA"));
EXPECT_EQ("NOT FOUND", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneA"));

EXPECT_EQ("stat B", RetrievePreDefTableEntry(*state, orp.pdchStatName, "zoneB"));
EXPECT_EQ("control schedule B", RetrievePreDefTableEntry(*state, orp.pdchStatCtrlTypeSchd, "zoneB"));
EXPECT_EQ("SingleCooling", RetrievePreDefTableEntry(*state, orp.pdchStatSchdType1, "zoneB"));
EXPECT_EQ("control B", RetrievePreDefTableEntry(*state, orp.pdchStatSchdTypeName1, "zoneB"));
EXPECT_EQ("NOT FOUND", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneB"));
EXPECT_EQ("schB", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneB"));
EXPECT_EQ("NOT FOUND", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneB"));
EXPECT_EQ("SINGLECOOLINGSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneB"));

EXPECT_EQ("stat C", RetrievePreDefTableEntry(*state, orp.pdchStatName, "zoneC"));
EXPECT_EQ("control schedule C", RetrievePreDefTableEntry(*state, orp.pdchStatCtrlTypeSchd, "zoneC"));
EXPECT_EQ("SingleHeatCool", RetrievePreDefTableEntry(*state, orp.pdchStatSchdType1, "zoneC"));
EXPECT_EQ("control C", RetrievePreDefTableEntry(*state, orp.pdchStatSchdTypeName1, "zoneC"));
EXPECT_EQ("schC", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneC"));
EXPECT_EQ("schC", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneC"));
EXPECT_EQ("SINGLEHEATCOOLSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneC"));
EXPECT_EQ("SINGLEHEATCOOLSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneC"));

EXPECT_EQ("stat D", RetrievePreDefTableEntry(*state, orp.pdchStatName, "zoneD"));
EXPECT_EQ("control schedule D", RetrievePreDefTableEntry(*state, orp.pdchStatCtrlTypeSchd, "zoneD"));
EXPECT_EQ("DualSetPointWithDeadBand", RetrievePreDefTableEntry(*state, orp.pdchStatSchdType1, "zoneD"));
EXPECT_EQ("control D", RetrievePreDefTableEntry(*state, orp.pdchStatSchdTypeName1, "zoneD"));
EXPECT_EQ("schE", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneD"));
EXPECT_EQ("schD", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneD"));
EXPECT_EQ("DUALSETPOINTWDEADBANDHEATSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneD"));
EXPECT_EQ("DUALSETPOINTWDEADBANDCOOLSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneD"));
}

0 comments on commit cf934f5

Please sign in to comment.