Skip to content

Commit

Permalink
Fix some unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Roth committed Jan 5, 2025
1 parent 149f568 commit afc8f3b
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tst/EnergyPlus/unit/EquipAndOperations.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class DistributeEquipOpTest : public EnergyPlusFixture
{
EnergyPlusFixture::SetUp(); // Sets up individual test cases.

state->dataFluidProps->init_state(*state);

// unit test for PlantEquipmentOperation:ChillerHeaterChangeover
state->dataHeatBal->Zone.allocate(4);
state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(4);
Expand Down Expand Up @@ -125,6 +127,8 @@ class DistributeEquipOpTest : public EnergyPlusFixture
thisPlantLoop.OperationScheme = "Heating Loop Operation Scheme List";
}

thisPlantLoop.FluidName = "WATER";
thisPlantLoop.glycol = FluidProperties::GetWater(*state);
thisPlantLoop.NumOpSchemes = 1;
thisPlantLoop.OpScheme.allocate(thisPlantLoop.NumOpSchemes);
auto &opSch1 = thisPlantLoop.OpScheme(1);
Expand Down
7 changes: 7 additions & 0 deletions tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ TEST_F(EnergyPlusFixture, EvapFluidCoolerSpecs_getDesignCapacitiesTest)
state->dataLoopNodes->Node(1).MassFlowRateMin = 0.0;
state->dataLoopNodes->Node(1).MassFlowRateMax = 0.05;
state->dataLoopNodes->Node(1).MassFlowRateMaxAvail = 0.05;

state->dataPlnt->PlantLoop.allocate(1);
state->dataPlnt->PlantLoop(1).FluidName = "WATER";
state->dataPlnt->PlantLoop(1).glycol = FluidProperties::GetWater(*state);
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Locked;
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1);
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1);
Expand Down Expand Up @@ -176,6 +179,8 @@ TEST_F(EnergyPlusFixture, ExerciseSingleSpeedEvapFluidCooler)

PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1};
state->dataPlnt->PlantLoop.allocate(1);
state->dataPlnt->PlantLoop(1).FluidName = "WATER";
state->dataPlnt->PlantLoop(1).glycol = FluidProperties::GetWater(*state);
state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1);
state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1);

Expand Down Expand Up @@ -260,6 +265,8 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedEvapFluidCooler)

PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1};
state->dataPlnt->PlantLoop.allocate(1);
state->dataPlnt->PlantLoop(1).FluidName = "WATER";
state->dataPlnt->PlantLoop(1).glycol = FluidProperties::GetWater(*state);
state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1);
state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1);

Expand Down
11 changes: 9 additions & 2 deletions tst/EnergyPlus/unit/FluidCoolers.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,13 @@ TEST_F(EnergyPlusFixture, SizeFunctionTestWhenPlantSizingIndexIsZero)

auto &thisFluidCooler = state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum);

state->dataPlnt->PlantLoop.allocate(FluidCoolerNum);
state->dataPlnt->PlantLoop.allocate(1);
state->dataPlnt->PlantLoop(1).FluidName = "WATER";
state->dataPlnt->PlantLoop(1).glycol = FluidProperties::GetWater(*state);

state->dataFluidCoolers->SimpleFluidCooler.allocate(FluidCoolerNum);
state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).plantLoc.loopNum = 1;
state->dataPlnt->PlantLoop(FluidCoolerNum).PlantSizNum = 0;
state->dataPlnt->PlantLoop(1).PlantSizNum = 0;

EXPECT_FALSE(thisFluidCooler.HighSpeedFanPowerWasAutoSized);
EXPECT_FALSE(thisFluidCooler.HighSpeedAirFlowRateWasAutoSized);
Expand Down Expand Up @@ -391,6 +394,8 @@ TEST_F(EnergyPlusFixture, ExerciseSingleSpeedFluidCooler)

PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1};
state->dataPlnt->PlantLoop.allocate(1);
state->dataPlnt->PlantLoop(1).FluidName = "WATER";
state->dataPlnt->PlantLoop(1).glycol = FluidProperties::GetWater(*state);
state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1);
state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1);

Expand Down Expand Up @@ -462,6 +467,8 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedFluidCooler)

PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1};
state->dataPlnt->PlantLoop.allocate(1);
state->dataPlnt->PlantLoop(1).FluidName = "WATER";
state->dataPlnt->PlantLoop(1).glycol = FluidProperties::GetWater(*state);
state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1);
state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1);

Expand Down
3 changes: 3 additions & 0 deletions tst/EnergyPlus/unit/HVACControllers.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType)
state->dataPlnt->PlantLoop.allocate(1);
state->dataPlnt->TotNumLoops = 1;

state->dataPlnt->PlantLoop(1).FluidName = "WATER";
state->dataPlnt->PlantLoop(1).glycol = FluidProperties::GetWater(*state);
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1;
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1);
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1;
Expand Down Expand Up @@ -967,6 +969,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero)
state->dataPlnt->PlantLoop(1).PlantSizNum = 1;
state->dataPlnt->PlantLoop(1).FluidIndex = 1;
state->dataPlnt->PlantLoop(1).FluidName = "WATER";
state->dataPlnt->PlantLoop(1).glycol = FluidProperties::GetWater(*state);

state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1;
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1);
Expand Down
2 changes: 2 additions & 0 deletions tst/EnergyPlus/unit/PlantComponentTemperatureSources.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ TEST_F(EnergyPlusFixture, TestPlantComponentTemperatureSource)
state->dataPlnt->TotNumLoops = 1;
state->dataPlnt->PlantLoop.allocate(1);

state->dataPlnt->PlantLoop(1).FluidName = "WATER";
state->dataPlnt->PlantLoop(1).glycol = FluidProperties::GetWater(*state);
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1;
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1);
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1;
Expand Down
Loading

3 comments on commit afc8f3b

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FluidAPI2 (Unknown) - x86_64-Linux-Ubuntu-24.04-gcc-13.3: OK (2919 of 2919 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FluidAPI2 (Unknown) - x86_64-Linux-Ubuntu-24.04-gcc-13.3-UnitTestsCoverage-RelWithDebInfo: OK (2101 of 2101 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FluidAPI2 (Unknown) - x86_64-Linux-Ubuntu-24.04-gcc-13.3-IntegrationCoverage-RelWithDebInfo: OK (801 of 801 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.