Skip to content

Commit

Permalink
Add state parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
tanaya-mankad committed Sep 5, 2024
1 parent 6ac136a commit aa9f04e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
40 changes: 20 additions & 20 deletions tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXAlternateModePerformance)
thisCoil.size(*state);

// for speed > 1 we use the mshp rated high speed flow...
state->dataHVACGlobal->MSHPMassFlowRateHigh = thisCoil.performance->RatedAirMassFlowRateMaxSpeed();
state->dataHVACGlobal->MSHPMassFlowRateHigh = thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state);

// we'll use this later
auto &evapOutletNode = state->dataLoopNodes->Node(thisCoil.evapOutletNodeIndex);

// set some values to run at rated conditions and call to run normal mode speed 1
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed(*state);
HVAC::CoilMode coilMode = HVAC::CoilMode::Normal;
Real64 PLR = 1.0;
int speedNum = 1;
Expand All @@ -183,7 +183,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXAlternateModePerformance)
EXPECT_NEAR(0.0114, evapOutletNode.HumRat, 0.001);

// alter values and run at rated conditions normal mode speed 2
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state);
speedNum = 2;
thisCoil.simulate(*state, coilMode, speedNum, speedRatio, fanOp, singleMode);
// std::cout << thisCoil.totalCoolingEnergyRate << ',' << evapOutletNode.Temp << ',' << evapOutletNode.HumRat << std::endl;
Expand Down Expand Up @@ -299,15 +299,15 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXAlternateModePerformanceHitsSaturation)
thisCoil.size(*state);

// for speed > 1 we use the mshp rated high speed flow...
state->dataHVACGlobal->MSHPMassFlowRateHigh = thisCoil.performance->RatedAirMassFlowRateMaxSpeed();
state->dataHVACGlobal->MSHPMassFlowRateHigh = thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state);

// we'll use this later
auto &evapOutletNode = state->dataLoopNodes->Node(thisCoil.evapOutletNodeIndex);

bool setExpectations = true;

// set some values to run at rated conditions and call to run normal mode speed 1
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed(*state);
HVAC::CoilMode coilMode = HVAC::CoilMode::Normal;
Real64 PLR = 1.0;
int speedNum = 1;
Expand All @@ -323,7 +323,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXAlternateModePerformanceHitsSaturation)
EXPECT_NEAR(0.007748, evapOutletNode.HumRat, 0.0001);
}
// alter values and run at rated conditions normal mode speed 2
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state);
speedNum = 2;
thisCoil.simulate(*state, coilMode, speedNum, speedRatio, fanOp, singleMode);
if (!setExpectations) {
Expand Down Expand Up @@ -684,7 +684,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_CycFanCycCoil)
thisCoil.size(*state);

// for speed > 1 we use the mshp rated high speed flow...
state->dataHVACGlobal->MSHPMassFlowRateHigh = thisCoil.performance->RatedAirMassFlowRateMaxSpeed();
state->dataHVACGlobal->MSHPMassFlowRateHigh = thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state);

// we'll use this later
auto &evapOutletNode = state->dataLoopNodes->Node(thisCoil.evapOutletNodeIndex);
Expand All @@ -694,7 +694,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_CycFanCycCoil)
evapInletNode.HumRat = 0.0055;
evapInletNode.Enthalpy = Psychrometrics::PsyHFnTdbW(evapInletNode.Temp, evapInletNode.HumRat);
// set some values to run at rated conditions and call to run normal mode speed 1
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed(*state);
HVAC::CoilMode coilMode = HVAC::CoilMode::Normal;
Real64 PLR = 1.0;
int speedNum = 1;
Expand All @@ -709,7 +709,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_CycFanCycCoil)
EXPECT_NEAR(MultiSpeedOutletHumRat1, evapOutletNode.HumRat, 0.001);
EXPECT_NEAR(MultiSpeedElecPower1, thisCoil.elecCoolingPower, 0.001);
// Test 2 - dry coil - run the coil at high speed
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state);
speedNum = 2;
speedRatio = 1.0;
thisCoil.simulate(*state, coilMode, speedNum, speedRatio, fanOp, singleMode);
Expand All @@ -724,7 +724,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_CycFanCycCoil)
speedNum = 2;
speedRatio = 0.75;
evapInletNode.MassFlowRate =
speedRatio * thisCoil.performance->RatedAirMassFlowRateMaxSpeed() + (1.0 - speedRatio) * thisCoil.performance->RatedAirMassFlowRateMinSpeed();
speedRatio * thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state) + (1.0 - speedRatio) * thisCoil.performance->RatedAirMassFlowRateMinSpeed(*state);
thisCoil.simulate(*state, coilMode, speedNum, speedRatio, fanOp, singleMode);
EXPECT_NEAR(MultiSpeedTotalCoolingRate3, thisCoil.totalCoolingEnergyRate, 0.1);
EXPECT_NEAR(MultiSpeedSensCoolingRate3, thisCoil.sensCoolingEnergyRate, 0.1);
Expand All @@ -737,7 +737,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_CycFanCycCoil)
evapInletNode.Temp = 24.0;
evapInletNode.HumRat = 0.0100;
evapInletNode.Enthalpy = Psychrometrics::PsyHFnTdbW(evapInletNode.Temp, evapInletNode.HumRat);
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed(*state);
coilMode = HVAC::CoilMode::Normal;
PLR = 1.0;
speedNum = 1;
Expand All @@ -753,7 +753,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_CycFanCycCoil)
EXPECT_NEAR(MultiSpeedElecPower4, thisCoil.elecCoolingPower, 0.001);

// Test 5 - wet coil - run the coil at high speed
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state);
speedNum = 2;
speedRatio = 1.0;
thisCoil.simulate(*state, coilMode, speedNum, speedRatio, fanOp, singleMode);
Expand All @@ -768,7 +768,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_CycFanCycCoil)
speedNum = 2;
speedRatio = 0.75;
evapInletNode.MassFlowRate =
speedRatio * thisCoil.performance->RatedAirMassFlowRateMaxSpeed() + (1.0 - speedRatio) * thisCoil.performance->RatedAirMassFlowRateMinSpeed();
speedRatio * thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state) + (1.0 - speedRatio) * thisCoil.performance->RatedAirMassFlowRateMinSpeed(*state);
thisCoil.simulate(*state, coilMode, speedNum, speedRatio, fanOp, singleMode);
EXPECT_NEAR(MultiSpeedTotalCoolingRate6, thisCoil.totalCoolingEnergyRate, 0.1);
EXPECT_NEAR(MultiSpeedSensCoolingRate6, thisCoil.sensCoolingEnergyRate, 0.1);
Expand Down Expand Up @@ -1101,7 +1101,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_ContFanCycCoil)
thisCoil.size(*state);

// for speed > 1 we use the mshp rated high speed flow...
state->dataHVACGlobal->MSHPMassFlowRateHigh = thisCoil.performance->RatedAirMassFlowRateMaxSpeed();
state->dataHVACGlobal->MSHPMassFlowRateHigh = thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state);

// we'll use this later
auto &evapOutletNode = state->dataLoopNodes->Node(thisCoil.evapOutletNodeIndex);
Expand All @@ -1111,7 +1111,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_ContFanCycCoil)
evapInletNode.HumRat = 0.0055;
evapInletNode.Enthalpy = Psychrometrics::PsyHFnTdbW(evapInletNode.Temp, evapInletNode.HumRat);
// set some values to run at rated conditions and call to run normal mode speed 1
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed(*state);
HVAC::CoilMode coilMode = HVAC::CoilMode::Normal;
Real64 PLR = 1.0;
int speedNum = 1;
Expand All @@ -1127,7 +1127,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_ContFanCycCoil)
EXPECT_NEAR(MultiSpeedElecPower1, thisCoil.elecCoolingPower, 0.001);

// Test 2 - dry coil - run the coil at high speed
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state);
speedNum = 2;
speedRatio = 1.0;
thisCoil.simulate(*state, coilMode, speedNum, speedRatio, fanOp, singleMode);
Expand All @@ -1142,7 +1142,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_ContFanCycCoil)
speedNum = 2;
speedRatio = 0.75;
evapInletNode.MassFlowRate =
speedRatio * thisCoil.performance->RatedAirMassFlowRateMaxSpeed() + (1.0 - speedRatio) * thisCoil.performance->RatedAirMassFlowRateMinSpeed();
speedRatio * thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state) + (1.0 - speedRatio) * thisCoil.performance->RatedAirMassFlowRateMinSpeed(*state);
thisCoil.simulate(*state, coilMode, speedNum, speedRatio, fanOp, singleMode);
EXPECT_NEAR(MultiSpeedTotalCoolingRate3, thisCoil.totalCoolingEnergyRate, 0.1);
EXPECT_NEAR(MultiSpeedSensCoolingRate3, thisCoil.sensCoolingEnergyRate, 0.1);
Expand All @@ -1155,7 +1155,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_ContFanCycCoil)
evapInletNode.Temp = 24.0;
evapInletNode.HumRat = 0.0100;
evapInletNode.Enthalpy = Psychrometrics::PsyHFnTdbW(evapInletNode.Temp, evapInletNode.HumRat);
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMinSpeed(*state);
coilMode = HVAC::CoilMode::Normal;
PLR = 1.0;
speedNum = 1;
Expand All @@ -1171,7 +1171,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_ContFanCycCoil)
EXPECT_NEAR(MultiSpeedElecPower4, thisCoil.elecCoolingPower, 0.001);

// Test 5 - wet coil - run the coil at high speed
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed();
evapInletNode.MassFlowRate = thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state);
speedNum = 2;
speedRatio = 1.0;
thisCoil.simulate(*state, coilMode, speedNum, speedRatio, fanOp, singleMode);
Expand All @@ -1186,7 +1186,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_ContFanCycCoil)
speedNum = 2;
speedRatio = 0.75;
evapInletNode.MassFlowRate =
speedRatio * thisCoil.performance->RatedAirMassFlowRateMaxSpeed() + (1.0 - speedRatio) * thisCoil.performance->RatedAirMassFlowRateMinSpeed();
speedRatio * thisCoil.performance->RatedAirMassFlowRateMaxSpeed(*state) + (1.0 - speedRatio) * thisCoil.performance->RatedAirMassFlowRateMinSpeed(*state);
thisCoil.simulate(*state, coilMode, speedNum, speedRatio, fanOp, singleMode);
EXPECT_NEAR(MultiSpeedTotalCoolingRate6, thisCoil.totalCoolingEnergyRate, 0.1);
EXPECT_NEAR(MultiSpeedSensCoolingRate6, thisCoil.sensCoolingEnergyRate, 0.1);
Expand Down
4 changes: 2 additions & 2 deletions tst/EnergyPlus/unit/StandardRatings.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11771,7 +11771,7 @@ TEST_F(EnergyPlusFixture, CurveFit_02_Speed_15000W_alternateMode_SEER2_2023_Valu
EXPECT_NEAR(15000, performance->RatedGrossTotalCap(), 0.01);

// Reated Air Vol Flow Rate | evap air flow rate and condenser air flow rate ??
EXPECT_NEAR(0.80, performance->RatedEvapAirFlowRate(), 0.01);
EXPECT_NEAR(0.80, performance->RatedEvapAirFlowRate(*state), 0.01);

EXPECT_NEAR(7500, speed1.rated_total_capacity, 0.01);
EXPECT_NEAR(15000, speed2.rated_total_capacity, 0.01);
Expand Down Expand Up @@ -12092,7 +12092,7 @@ TEST_F(EnergyPlusFixture, CurveFit_03_Speed_5000W_SEER2_2023_ValueTest)
EXPECT_NEAR(5000, performance->RatedGrossTotalCap(), 0.01);

// Reated Air Vol Flow Rate | evap air flow rate and condenser air flow rate ??
EXPECT_NEAR(0.25, performance->RatedEvapAirFlowRate(), 0.01);
EXPECT_NEAR(0.25, performance->RatedEvapAirFlowRate(*state), 0.01);

EXPECT_NEAR(1666.5, speed1.rated_total_capacity, 0.01);
EXPECT_NEAR(3333.5, speed2.rated_total_capacity, 0.01);
Expand Down

0 comments on commit aa9f04e

Please sign in to comment.