Skip to content

Commit

Permalink
fixed unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmythms committed Feb 10, 2021
1 parent 7fbaa76 commit f67fbc8
Showing 1 changed file with 43 additions and 17 deletions.
60 changes: 43 additions & 17 deletions tst/EnergyPlus/unit/PurchasedAirManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include <EnergyPlus/DataZoneEquipment.hh>
#include <EnergyPlus/EMSManager.hh>
#include <EnergyPlus/HeatBalanceManager.hh>
#include <EnergyPlus/Psychrometrics.hh>
#include <EnergyPlus/PurchasedAirManager.hh>
#include <EnergyPlus/RuntimeLanguageProcessor.hh>
#include <EnergyPlus/ScheduleManager.hh>
Expand Down Expand Up @@ -562,7 +563,7 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_IntermediateOutputVarsTest)
" , !- Outdoor Air Inlet Node Name",
" , !- Demand Controlled Ventilation Type",
" NoEconomizer, !- Outdoor Air Economizer Type",
" Enthalpy, !- Heat Recovery Type",
" Sensible, !- Heat Recovery Type",
" 0.7, !- Sensible Heat Recovery Effectiveness{ dimensionless }",
" 0.65; !- Latent Heat Recovery Effectiveness{ dimensionless }",

Expand Down Expand Up @@ -642,25 +643,50 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_IntermediateOutputVarsTest)


EXPECT_EQ(PurchAir(1).Name, "ZONE 1 IDEAL LOADS");
// Ideal loads air system found the plenum it is attached to

// Is this the best condition to check/test SupplyTemp and SupplyHumRat? It should be always equal to Zone Supply Node conditions, but is that a sufficient condition?
// Expecting SupplyTemp to be the same as Zone supply temp
EXPECT_EQ(PurchAir(1).SupplyTemp, Node(PurchAir(1).ZoneSupplyAirNodeNum).Temp);
EXPECT_EQ(PurchAir(1).SupplyHumRat, Node(PurchAir(1).ZoneSupplyAirNodeNum).HumRat);

//Can't figure out what would be a good test for MixedAirTemp/MixedAirHumRat. I wanted to implement a test with outdoor
// air as well, since MixedAirTemp/MixedAirHumRat would be the conditions after mixing OA with the incoming stream.
// But I cannot seem to hold the temperature at IdealLoadsSystem inlet (same conditions as ZoneExhaustAirNodeNum) which
// keeps falling to zero.
Node(PurchAir(1).ZoneExhaustAirNodeNum).Temp = 35;
Node(PurchAir(1).OutdoorAirNodeNum).Temp = 10;
ManageZoneEquipment(*state,
FirstHVACIteration,
SimZone,
SimAir); // read zone equipment configuration and list objects and simulate ideal loads air system
EXPECT_EQ(0, Node(PurchAir(1).ZoneExhaustAirNodeNum).Temp);
EXPECT_EQ(PurchAir(1).MixedAirTemp, Node(PurchAir(1).ZoneExhaustAirNodeNum).Temp);
EXPECT_EQ(PurchAir(1).MixedAirHumRat, Node(PurchAir(1).ZoneExhaustAirNodeNum).HumRat);
// Test for intermediate variables, MixedAirTemp, MixedAirHumRat
Node(PurchAir(1).ZoneRecircAirNodeNum).Temp = 24;
Node(PurchAir(1).ZoneRecircAirNodeNum).HumRat = 0.00929;
Node(PurchAir(1).ZoneRecircAirNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(
Node(PurchAir(1).ZoneRecircAirNodeNum).Temp,
Node(PurchAir(1).ZoneRecircAirNodeNum).HumRat
);
Node(PurchAir(1).OutdoorAirNodeNum).Temp = 3;
Node(PurchAir(1).OutdoorAirNodeNum).HumRat = 0.004586;
Node(PurchAir(1).OutdoorAirNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(
Node(PurchAir(1).OutdoorAirNodeNum).Temp,
Node(PurchAir(1).OutdoorAirNodeNum).HumRat
);
PurchAir(1).MixedAirTemp = 0;
PurchAir(1).MixedAirHumRat = 0;
Real64 MixedAirEnthalpy = 0;
Real64 OAMassFlowRate = 10;
Real64 SupplyMassFlowRate = 11;
CalcPurchAirMixedAir(*state,
1, // index to ideal loads unit
OAMassFlowRate, // outside air mass flow rate [kg/s]
SupplyMassFlowRate, // supply air mass flow rate [kg/s]
PurchAir(1).MixedAirTemp, // Mixed air dry bulb temperature [C]
PurchAir(1).MixedAirHumRat, // Mixed air humidity ratio [kgWater/kgDryAir]
MixedAirEnthalpy, // Mixed air enthalpy [J/kg]
OpMode::Cool // current operating mode, Off, Heating, Cooling, or DeadBand
);
// Calculations:
// Stream 1: Recirc stream: T1: 24 C; W1: 0.00929 kg/kg; h1: 47764.36 J/kg; m_dot1: 11 kg/s
// Stream 2: Outdoor Air stream: T2: 3 C; W2:0.004586 kg/kg; h2: 14509.40 J/kg; m_dot2: 10 kg/s

// Mixed stream:
// When SupplyMassFlowRate > OAMassFlowRate
// RecircMassFlowRate = SupplyMassFlowRate - OAMassFlowRate = 1 kg/s
// h_mix_stream = (RecircMassFlowRate X h_Recirc + m_dotOA X h_OA)/SupplyFlowRate = 17532.58 J/kg
// W_mix_stream = (RecircMassFlowRate X W_Recirc + m_dotOA X W_OA)/SupplyFlowRate = 0.005013 kg/kg
// T_mix_stream = T as fn (h_mix_stream,W_mix_stream) = 4.924 C

EXPECT_EQ(PurchAir(1).MixedAirTemp,4.9240554165264818);
EXPECT_EQ(PurchAir(1).MixedAirHumRat,0.0050136363636363633);
}

TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest)
Expand Down

4 comments on commit f67fbc8

@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.

Add-New-Zone-Ideal-Loads-Output-Variables (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3035 of 3037 tests passed, 74 test warnings)

Messages:\n

  • 76 tests had: AUD diffs.
  • 73 tests had: RDD diffs.
  • 1 test had: EIO diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: MTR small diffs.
  • 2 tests had: Table big diffs.
  • 1 test had: MTD diffs.

Failures:\n

regression Test Summary

  • Passed: 735
  • Failed: 2

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

Add-New-Zone-Ideal-Loads-Output-Variables (jmythms) - x86_64-MacOS-10.15-clang-11.0.0: OK (2996 of 2997 tests passed, 73 test warnings)

Messages:\n

  • 74 tests had: AUD diffs.
  • 71 tests had: RDD diffs.
  • 1 test had: MTD diffs.
  • 1 test had: Table big diffs.

Failures:\n

regression Test Summary

  • Passed: 716
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

Add-New-Zone-Ideal-Loads-Output-Variables (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1561 of 1561 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.

Add-New-Zone-Ideal-Loads-Output-Variables (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (721 of 722 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 721
  • Timeout: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.