Skip to content

Commit 0be1cd6

Browse files
committed
10638 Unit Test
Addition of a unit test for the new subroutine that was added as part of the defect fix.
1 parent ffc0ff6 commit 0be1cd6

File tree

1 file changed

+200
-0
lines changed

1 file changed

+200
-0
lines changed

tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25525,4 +25525,204 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_HeatRecoveryCheck)
2552525525
EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(vrf3).HeatRecoveryUsed);
2552625526
}
2552725527

25528+
TEST_F(EnergyPlusFixture, VRFTest_initCapSizingVars)
25529+
{
25530+
// Test for #10638
25531+
using namespace DataSizing;
25532+
using HVAC::AutoCalculateSizing;
25533+
using HVAC::CoolingCapacitySizing;
25534+
using HVAC::HeatingCapacitySizing;
25535+
25536+
int testSizingMethod;
25537+
int testCapSizingMethod;
25538+
int testEqSizingMethod;
25539+
Real64 testScaledCapacity;
25540+
bool testModeCapacity;
25541+
Real64 testDesignLoad;
25542+
bool testScalableCapSizingOn;
25543+
Real64 testFracOfAutosizedCapacity;
25544+
Real64 allowedTolerance = 0.0001;
25545+
int expectedEqSizingMethod;
25546+
Real64 expectedScaledCapacity;
25547+
Real64 expectedDesignLoad;
25548+
Real64 expectedFracOfAutosizedCapacity;
25549+
25550+
state->dataSize->DataZoneNumber = 1;
25551+
state->dataHeatBal->Zone.allocate(1);
25552+
state->dataHeatBal->Zone(1).FloorArea = 2.0;
25553+
25554+
// Test 1: no valid sizing chosen--nothing changes from what things are previously set to
25555+
testSizingMethod = AutoCalculateSizing;
25556+
testCapSizingMethod = None;
25557+
testEqSizingMethod = -1;
25558+
testScaledCapacity = 12.0;
25559+
testModeCapacity = false;
25560+
testDesignLoad = 123.0;
25561+
testScalableCapSizingOn = false;
25562+
testFracOfAutosizedCapacity = 1234.0;
25563+
expectedScaledCapacity = 12.0;
25564+
expectedDesignLoad = 123.0;
25565+
expectedFracOfAutosizedCapacity = 1234.0;
25566+
initCapSizingVars(*state,
25567+
testSizingMethod,
25568+
testCapSizingMethod,
25569+
testEqSizingMethod,
25570+
testScaledCapacity,
25571+
testModeCapacity,
25572+
testDesignLoad,
25573+
testScalableCapSizingOn,
25574+
testFracOfAutosizedCapacity);
25575+
EXPECT_FALSE(testModeCapacity);
25576+
EXPECT_FALSE(testScalableCapSizingOn);
25577+
EXPECT_EQ(testEqSizingMethod, None);
25578+
EXPECT_NEAR(testScaledCapacity, expectedScaledCapacity, allowedTolerance);
25579+
EXPECT_NEAR(testDesignLoad, expectedDesignLoad, allowedTolerance);
25580+
EXPECT_NEAR(testFracOfAutosizedCapacity, expectedFracOfAutosizedCapacity, allowedTolerance);
25581+
25582+
// Test 2a: CoolingCapacitySizing with CoolingDesignCapacity--set ModeCapacity to true and DesignLoad to ScaledCapacity
25583+
testSizingMethod = CoolingCapacitySizing;
25584+
testCapSizingMethod = CoolingDesignCapacity;
25585+
testEqSizingMethod = -1;
25586+
testScaledCapacity = 12.0;
25587+
testModeCapacity = false;
25588+
testDesignLoad = 123.0;
25589+
testScalableCapSizingOn = false;
25590+
testFracOfAutosizedCapacity = 1234.0;
25591+
expectedScaledCapacity = 12.0;
25592+
expectedDesignLoad = 12.0;
25593+
expectedFracOfAutosizedCapacity = 1234.0;
25594+
expectedEqSizingMethod = CoolingDesignCapacity;
25595+
initCapSizingVars(*state,
25596+
testSizingMethod,
25597+
testCapSizingMethod,
25598+
testEqSizingMethod,
25599+
testScaledCapacity,
25600+
testModeCapacity,
25601+
testDesignLoad,
25602+
testScalableCapSizingOn,
25603+
testFracOfAutosizedCapacity);
25604+
EXPECT_TRUE(testModeCapacity);
25605+
EXPECT_FALSE(testScalableCapSizingOn);
25606+
EXPECT_EQ(testEqSizingMethod, expectedEqSizingMethod);
25607+
EXPECT_NEAR(testScaledCapacity, expectedScaledCapacity, allowedTolerance);
25608+
EXPECT_NEAR(testDesignLoad, expectedDesignLoad, allowedTolerance);
25609+
EXPECT_NEAR(testFracOfAutosizedCapacity, expectedFracOfAutosizedCapacity, allowedTolerance);
25610+
25611+
// Test 2b: HeatingCapacitySizing with HeatingDesignCapacity--set ModeCapacity to true and DesignLoad to ScaledCapacity
25612+
testSizingMethod = HeatingCapacitySizing;
25613+
testCapSizingMethod = HeatingDesignCapacity;
25614+
testEqSizingMethod = -1;
25615+
testScaledCapacity = 12.0;
25616+
testModeCapacity = false;
25617+
testDesignLoad = 123.0;
25618+
testScalableCapSizingOn = false;
25619+
testFracOfAutosizedCapacity = 1234.0;
25620+
expectedScaledCapacity = 12.0;
25621+
expectedDesignLoad = 12.0;
25622+
expectedFracOfAutosizedCapacity = 1234.0;
25623+
expectedEqSizingMethod = HeatingDesignCapacity;
25624+
initCapSizingVars(*state,
25625+
testSizingMethod,
25626+
testCapSizingMethod,
25627+
testEqSizingMethod,
25628+
testScaledCapacity,
25629+
testModeCapacity,
25630+
testDesignLoad,
25631+
testScalableCapSizingOn,
25632+
testFracOfAutosizedCapacity);
25633+
EXPECT_TRUE(testModeCapacity);
25634+
EXPECT_FALSE(testScalableCapSizingOn);
25635+
EXPECT_EQ(testEqSizingMethod, expectedEqSizingMethod);
25636+
EXPECT_NEAR(testScaledCapacity, expectedScaledCapacity, allowedTolerance);
25637+
EXPECT_NEAR(testDesignLoad, expectedDesignLoad, allowedTolerance);
25638+
EXPECT_NEAR(testFracOfAutosizedCapacity, expectedFracOfAutosizedCapacity, allowedTolerance);
25639+
25640+
// Test 3: CapacityPerFloorArea (both heating and cooling are the same)--set ModeCapacity and scalable to true and DesignLoad to ScaledCapacity
25641+
testSizingMethod = HeatingCapacitySizing;
25642+
testCapSizingMethod = CapacityPerFloorArea;
25643+
testEqSizingMethod = -1;
25644+
testScaledCapacity = 12.0;
25645+
testModeCapacity = false;
25646+
testDesignLoad = 123.0;
25647+
testScalableCapSizingOn = false;
25648+
testFracOfAutosizedCapacity = 1234.0;
25649+
expectedScaledCapacity = 12.0;
25650+
expectedDesignLoad = 24.0;
25651+
expectedFracOfAutosizedCapacity = 1234.0;
25652+
expectedEqSizingMethod = CapacityPerFloorArea;
25653+
initCapSizingVars(*state,
25654+
testSizingMethod,
25655+
testCapSizingMethod,
25656+
testEqSizingMethod,
25657+
testScaledCapacity,
25658+
testModeCapacity,
25659+
testDesignLoad,
25660+
testScalableCapSizingOn,
25661+
testFracOfAutosizedCapacity);
25662+
EXPECT_TRUE(testModeCapacity);
25663+
EXPECT_TRUE(testScalableCapSizingOn);
25664+
EXPECT_EQ(testEqSizingMethod, expectedEqSizingMethod);
25665+
EXPECT_NEAR(testScaledCapacity, expectedScaledCapacity, allowedTolerance);
25666+
EXPECT_NEAR(testDesignLoad, expectedDesignLoad, allowedTolerance);
25667+
EXPECT_NEAR(testFracOfAutosizedCapacity, expectedFracOfAutosizedCapacity, allowedTolerance);
25668+
25669+
// Test 4a: CoolingCapacitySizing with FractionOfAutosizedCoolingCapacity--set ModeCapacity to true and DesignLoad to ScaledCapacity
25670+
testSizingMethod = CoolingCapacitySizing;
25671+
testCapSizingMethod = FractionOfAutosizedCoolingCapacity;
25672+
testEqSizingMethod = -1;
25673+
testScaledCapacity = 12.0;
25674+
testModeCapacity = false;
25675+
testDesignLoad = 123.0;
25676+
testScalableCapSizingOn = false;
25677+
testFracOfAutosizedCapacity = 1234.0;
25678+
expectedScaledCapacity = 12.0;
25679+
expectedDesignLoad = 123.0;
25680+
expectedFracOfAutosizedCapacity = 12.0;
25681+
expectedEqSizingMethod = FractionOfAutosizedCoolingCapacity;
25682+
initCapSizingVars(*state,
25683+
testSizingMethod,
25684+
testCapSizingMethod,
25685+
testEqSizingMethod,
25686+
testScaledCapacity,
25687+
testModeCapacity,
25688+
testDesignLoad,
25689+
testScalableCapSizingOn,
25690+
testFracOfAutosizedCapacity);
25691+
EXPECT_FALSE(testModeCapacity);
25692+
EXPECT_TRUE(testScalableCapSizingOn);
25693+
EXPECT_EQ(testEqSizingMethod, expectedEqSizingMethod);
25694+
EXPECT_NEAR(testScaledCapacity, expectedScaledCapacity, allowedTolerance);
25695+
EXPECT_NEAR(testDesignLoad, expectedDesignLoad, allowedTolerance);
25696+
EXPECT_NEAR(testFracOfAutosizedCapacity, expectedFracOfAutosizedCapacity, allowedTolerance);
25697+
25698+
// Test 4b: HeatingCapacitySizing with FractionOfAutosizedHeatingCapacity--set ModeCapacity to true and DesignLoad to ScaledCapacity
25699+
testSizingMethod = HeatingCapacitySizing;
25700+
testCapSizingMethod = FractionOfAutosizedHeatingCapacity;
25701+
testEqSizingMethod = -1;
25702+
testScaledCapacity = 12.0;
25703+
testModeCapacity = false;
25704+
testDesignLoad = 123.0;
25705+
testScalableCapSizingOn = false;
25706+
testFracOfAutosizedCapacity = 1234.0;
25707+
expectedScaledCapacity = 12.0;
25708+
expectedDesignLoad = 123.0;
25709+
expectedFracOfAutosizedCapacity = 12.0;
25710+
expectedEqSizingMethod = FractionOfAutosizedHeatingCapacity;
25711+
initCapSizingVars(*state,
25712+
testSizingMethod,
25713+
testCapSizingMethod,
25714+
testEqSizingMethod,
25715+
testScaledCapacity,
25716+
testModeCapacity,
25717+
testDesignLoad,
25718+
testScalableCapSizingOn,
25719+
testFracOfAutosizedCapacity);
25720+
EXPECT_FALSE(testModeCapacity);
25721+
EXPECT_TRUE(testScalableCapSizingOn);
25722+
EXPECT_EQ(testEqSizingMethod, expectedEqSizingMethod);
25723+
EXPECT_NEAR(testScaledCapacity, expectedScaledCapacity, allowedTolerance);
25724+
EXPECT_NEAR(testDesignLoad, expectedDesignLoad, allowedTolerance);
25725+
EXPECT_NEAR(testFracOfAutosizedCapacity, expectedFracOfAutosizedCapacity, allowedTolerance);
25726+
}
25727+
2552825728
} // end of namespace EnergyPlus

0 commit comments

Comments
 (0)