Skip to content

Commit

Permalink
Update to address diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
rraustad committed Dec 5, 2024
1 parent 567d1d5 commit c96ab29
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
26 changes: 25 additions & 1 deletion src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7738,6 +7738,14 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum)
}
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] =
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir;
} else {
auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex));
assert(fanSystem != nullptr);
if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] == 0.0 && !fanSystem->massFlowAtSpeed.empty()) {
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] =
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] / state.dataEnvrn->StdRhoAir;
}
}
}
}
Expand Down Expand Up @@ -7816,6 +7824,14 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum)
}
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] =
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir;
} else {
auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex));
assert(fanSystem != nullptr);
if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] == 0.0 && !fanSystem->massFlowAtSpeed.empty()) {
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] =
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] / state.dataEnvrn->StdRhoAir;
}
}
}
}
Expand Down Expand Up @@ -7972,6 +7988,14 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum)
}
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] =
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir;
} else {
auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex));
assert(fanSystem != nullptr);
if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] == 0.0 && !fanSystem->massFlowAtSpeed.empty()) {
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] =
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] / state.dataEnvrn->StdRhoAir;
}
}
}
}
Expand Down Expand Up @@ -8006,7 +8030,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum)
} else {
auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex));
assert(fanSystem != nullptr);
if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] == 0.0) {
if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] == 0.0 && !fanSystem->massFlowAtSpeed.empty()) {
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] =
state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] / state.dataEnvrn->StdRhoAir;
Expand Down
26 changes: 13 additions & 13 deletions tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24377,11 +24377,10 @@ TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test)
InitVRF(*state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq);
EXPECT_EQ(QZnReq, -3000.0);
SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq);
EXPECT_NEAR(
state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU[0].VRFTUOutletNodeNum).MassFlowRate, 0.300008959, 0.0001); // was 0.29937661
EXPECT_NEAR(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU[0].VRFTUOutletNodeNum).MassFlowRate, 0.29937661, 0.0001);
EXPECT_LT(abs(QZnReq - SysOutputProvided), 1.0);
EXPECT_EQ(state->dataHVACVarRefFlow->VRFTU[0].SpeedNum, 2);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.7288976, 0.00001); // was 0.7252535
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.7252535, 0.00001);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 1.0, 0.00001);

// test low speed fan operation with cooling
Expand All @@ -24392,11 +24391,11 @@ TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test)
InitVRF(*state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq);
EXPECT_EQ(QZnReq, -1500.0);
SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq);
EXPECT_NEAR(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU[0].VRFTUOutletNodeNum).MassFlowRate, 0.1376580, 0.0001); // was 0.1735261
EXPECT_NEAR(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU[0].VRFTUOutletNodeNum).MassFlowRate, 0.1735261, 0.0001);
EXPECT_LT(abs(QZnReq - SysOutputProvided), 1.0);
EXPECT_EQ(state->dataHVACVarRefFlow->VRFTU[0].SpeedNum, 1);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.0, 0.00001);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 0.793298411, 0.00001); // was 0.626862007
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 0.626862007, 0.00001);

// set to heating mode
state->dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
Expand All @@ -24417,7 +24416,7 @@ TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test)
EXPECT_NEAR(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU[0].VRFTUOutletNodeNum).MassFlowRate, 0.346284919, 0.0001);
EXPECT_LT(abs(QZnReq - SysOutputProvided), 1.0);
EXPECT_EQ(state->dataHVACVarRefFlow->VRFTU[0].SpeedNum, 2);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.995546681, 0.00001); // was 0.995577651
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.995577651, 0.00001);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 1.0, 0.00001);

// test low speed fan operation with heating
Expand All @@ -24432,7 +24431,7 @@ TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test)
EXPECT_LT(abs(QZnReq - SysOutputProvided), 1.0);
EXPECT_EQ(state->dataHVACVarRefFlow->VRFTU[0].SpeedNum, 1);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.0, 0.00001);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 0.713204045, 0.00001); // was 0.713222413
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 0.713222413, 0.00001);
}

TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test_HardSized)
Expand Down Expand Up @@ -25692,10 +25691,11 @@ TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test_HardSized)
InitVRF(*state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq);
EXPECT_EQ(QZnReq, -3000.0);
SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq);
EXPECT_NEAR(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU[0].VRFTUOutletNodeNum).MassFlowRate, 0.299903, 0.0001); // was 0.29937661
EXPECT_NEAR(
state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU[0].VRFTUOutletNodeNum).MassFlowRate, 0.29929035, 0.0001); // was 0.29937661
EXPECT_LT(abs(QZnReq - SysOutputProvided), 1.0);
EXPECT_EQ(state->dataHVACVarRefFlow->VRFTU[0].SpeedNum, 2);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.728287, 0.00001); // was 0.7252535
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.72475641, 0.00001); // was 0.7252535
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 1.0, 0.00001);

// test low speed fan operation with cooling
Expand All @@ -25706,11 +25706,11 @@ TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test_HardSized)
InitVRF(*state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq);
EXPECT_EQ(QZnReq, -1500.0);
SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq);
EXPECT_NEAR(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU[0].VRFTUOutletNodeNum).MassFlowRate, 0.1375835, 0.0001); // was 0.1735261
EXPECT_NEAR(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU[0].VRFTUOutletNodeNum).MassFlowRate, 0.1735261, 0.0001);
EXPECT_LT(abs(QZnReq - SysOutputProvided), 1.0);
EXPECT_EQ(state->dataHVACVarRefFlow->VRFTU[0].SpeedNum, 1);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.0, 0.00001);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 0.7928689, 0.00001); // was 0.626862007
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 0.626128377, 0.00001); // was 0.626862007

// set to heating mode
state->dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
Expand All @@ -25732,7 +25732,7 @@ TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test_HardSized)
state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU[0].VRFTUOutletNodeNum).MassFlowRate, 0.3465238, 0.0001); // was 0.346284919
EXPECT_LT(abs(QZnReq - SysOutputProvided), 1.0);
EXPECT_EQ(state->dataHVACVarRefFlow->VRFTU[0].SpeedNum, 2);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.9969546, 0.00001); // was 0.995577651
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.996999648, 0.00001); // was 0.995577651
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 1.0, 0.00001);

// test low speed fan operation with heating
Expand All @@ -25747,7 +25747,7 @@ TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test_HardSized)
EXPECT_LT(abs(QZnReq - SysOutputProvided), 1.0);
EXPECT_EQ(state->dataHVACVarRefFlow->VRFTU[0].SpeedNum, 1);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].SpeedRatio, 0.0, 0.00001);
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 0.7139121, 0.00001); // was 0.713222413
EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 0.713941198, 0.00001); // was 0.713222413
}

TEST_F(EnergyPlusFixture, VRFTest_TU_HeatRecoveryCheck)
Expand Down

3 comments on commit c96ab29

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

10845-VRF-crash-with-discrete-system-fan (rraustad) - x86_64-Linux-Ubuntu-24.04-gcc-13.2: OK (2918 of 2918 tests passed, 0 test warnings)

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.

10845-VRF-crash-with-discrete-system-fan (rraustad) - x86_64-Linux-Ubuntu-24.04-gcc-13.2-UnitTestsCoverage-RelWithDebInfo: OK (2100 of 2100 tests passed, 0 test warnings)

Build Badge Test Badge Coverage 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.

10845-VRF-crash-with-discrete-system-fan (rraustad) - x86_64-Linux-Ubuntu-24.04-gcc-13.2-IntegrationCoverage-RelWithDebInfo: OK (801 of 801 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.