Skip to content

Commit

Permalink
Merge pull request #7679 from NREL/chillerElecEIRrefactor
Browse files Browse the repository at this point in the history
Chiller Electric EIR Plant Component Refactor
  • Loading branch information
Myoldmopar authored Jan 17, 2020
2 parents cfd6196 + bdd6800 commit 700637e
Show file tree
Hide file tree
Showing 8 changed files with 1,506 additions and 2,066 deletions.
3,197 changes: 1,361 additions & 1,836 deletions src/EnergyPlus/ChillerElectricEIR.cc

Large diffs are not rendered by default.

228 changes: 85 additions & 143 deletions src/EnergyPlus/ChillerElectricEIR.hh

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/EnergyPlus/FaultsManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,9 @@ namespace FaultsManager {

} else if (UtilityRoutines::SameString(SELECT_CASE_VAR, "Chiller:Electric:EIR")) {
// Read in chiller if not done yet
if (ChillerElectricEIR::GetInputEIR) {
if (ChillerElectricEIR::getInputFlag) {
ChillerElectricEIR::GetElectricEIRChillerInput();
ChillerElectricEIR::GetInputEIR = false;
ChillerElectricEIR::getInputFlag = false;
}

// Check whether the chiller name and chiller type match each other
Expand Down Expand Up @@ -1334,9 +1334,9 @@ namespace FaultsManager {

} else if (UtilityRoutines::SameString(SELECT_CASE_VAR, "Chiller:Electric:EIR")) {
// Read in chiller if not done yet
if (ChillerElectricEIR::GetInputEIR) {
if (ChillerElectricEIR::getInputFlag) {
ChillerElectricEIR::GetElectricEIRChillerInput();
ChillerElectricEIR::GetInputEIR = false;
ChillerElectricEIR::getInputFlag = false;
}
// Check whether the chiller name and chiller type match each other
ChillerNum = UtilityRoutines::FindItemInList(FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName,
Expand Down
3 changes: 1 addition & 2 deletions src/EnergyPlus/OutputReportTabular.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4790,7 +4790,6 @@ namespace OutputReportTabular {
using Boilers::Boiler;
using Boilers::NumBoilers;
using ChillerElectricEIR::ElectricEIRChiller;
using ChillerElectricEIR::ElectricEIRChillerReport;
using ChillerElectricEIR::NumElectricEIRChillers;
using ChillerReformulatedEIR::ElecReformEIRChiller;
using ChillerReformulatedEIR::ElecReformEIRChillerReport;
Expand Down Expand Up @@ -4908,7 +4907,7 @@ namespace OutputReportTabular {
}
for (iChiller = 1; iChiller <= NumElectricEIRChillers; ++iChiller) {
if (ElectricEIRChiller(iChiller).CondenserType != WaterCooled) {
SysTotalHVACRejectHeatLoss += ElectricEIRChillerReport(iChiller).CondEnergy;
SysTotalHVACRejectHeatLoss += ElectricEIRChiller(iChiller).CondEnergy;
}
}
for (iChiller = 1; iChiller <= NumElecReformEIRChillers; ++iChiller) {
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/Plant/PlantManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include <EnergyPlus/BranchInputManager.hh>
#include <EnergyPlus/ChillerIndirectAbsorption.hh>
#include <EnergyPlus/ChillerAbsorption.hh>
#include <EnergyPlus/ChillerElectricEIR.hh>
#include <EnergyPlus/CondenserLoopTowers.hh>
#include <EnergyPlus/CTElectricGenerator.hh>
#include <EnergyPlus/DataBranchAirLoopPlant.hh>
Expand Down Expand Up @@ -1069,6 +1070,7 @@ namespace EnergyPlus {
} else if (LoopSideNum == SupplySide) {
this_comp.CurOpSchemeType = UnknownStatusOpSchemeType;
}
this_comp.compPtr = ChillerElectricEIR::ElectricEIRChillerSpecs::factory(CompNames(CompNum));
} else if (UtilityRoutines::SameString(this_comp_type,
"Chiller:Electric:ReformulatedEIR")) {
this_comp.TypeOf_Num = TypeOf_Chiller_ElectricReformEIR;
Expand Down
29 changes: 1 addition & 28 deletions src/EnergyPlus/PlantLoopEquip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ namespace PlantLoopEquip {
// na

// Using/Aliasing
using ChillerElectricEIR::SimElectricEIRChiller;
using ChillerExhaustAbsorption::SimExhaustAbsorber;
using ChillerGasAbsorption::SimGasAbsorber;
using ChillerReformulatedEIR::SimReformulatedEIRChiller;
Expand Down Expand Up @@ -320,33 +319,7 @@ namespace PlantLoopEquip {
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

} else if (EquipTypeNum == TypeOf_Chiller_ElectricEIR) {
SimElectricEIRChiller(sim_component.TypeOf,
sim_component.Name,
EquipFlowCtrl,
EquipNum,
LoopNum,
RunFlag,
FirstHVACIteration,
InitLoopEquip,
CurLoad,
MaxLoad,
MinLoad,
OptLoad,
GetCompSizFac,
SizingFac,
TempCondInDesign,
TempEvapOutDesign);
if (InitLoopEquip) {
sim_component.MaxLoad = MaxLoad;
sim_component.MinLoad = MinLoad;
sim_component.OptLoad = OptLoad;
sim_component.CompNum = EquipNum;
sim_component.TempDesCondIn = TempCondInDesign;
sim_component.TempDesEvapOut = TempEvapOutDesign;
}
if (GetCompSizFac) {
sim_component.SizFac = SizingFac;
}
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

} else if (EquipTypeNum == TypeOf_Chiller_ElectricReformEIR) {
SimReformulatedEIRChiller(sim_component.TypeOf,
Expand Down
93 changes: 46 additions & 47 deletions tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,54 +64,52 @@ using namespace EnergyPlus;
using namespace EnergyPlus::ChillerElectricEIR;
using namespace EnergyPlus::DataLoopNode;

TEST_F(EnergyPlusFixture, ChillerElectricEIR_TestOutletNodeConditions)
class ChillerElecEIRFixture : public EnergyPlusFixture
{
};

int Num = 1;

ElectricEIRChiller.allocate(Num);
ElectricEIRChillerReport.allocate(Num);
TEST_F(ChillerElecEIRFixture, ChillerElectricEIR_TestOutletNodeConditions)
{
ElectricEIRChiller.allocate(1);
auto &thisEIR = ChillerElectricEIR::ElectricEIRChiller(1);

ElectricEIRChiller(Num).EvapInletNodeNum = 1;
ElectricEIRChiller(Num).EvapOutletNodeNum = 2;
ElectricEIRChiller(Num).CondInletNodeNum = 3;
ElectricEIRChiller(Num).CondOutletNodeNum = 4;
ElectricEIRChiller(Num).HeatRecInletNodeNum = 5;
ElectricEIRChiller(Num).HeatRecOutletNodeNum = 6;
thisEIR.EvapInletNodeNum = 1;
thisEIR.EvapOutletNodeNum = 2;
thisEIR.CondInletNodeNum = 3;
thisEIR.CondOutletNodeNum = 4;
thisEIR.HeatRecInletNodeNum = 5;
thisEIR.HeatRecOutletNodeNum = 6;

Node.allocate(6);
Node(ElectricEIRChiller(Num).EvapInletNodeNum).Temp = 18.0;
Node(ElectricEIRChiller(Num).CondInletNodeNum).Temp = 35.0;
Node(thisEIR.EvapInletNodeNum).Temp = 18.0;
Node(thisEIR.CondInletNodeNum).Temp = 35.0;

CondMassFlowRate = 0.0;
EvapMassFlowRate = 0.0;
thisEIR.update(-2000, true);

UpdateElectricEIRChillerRecords(-2000, true, 1);

EXPECT_EQ(18, ElectricEIRChillerReport(Num).EvapOutletTemp);
EXPECT_EQ(35, ElectricEIRChillerReport(Num).CondOutletTemp);
EXPECT_EQ(18, thisEIR.EvapOutletTemp);
EXPECT_EQ(35, thisEIR.CondOutletTemp);

Node.deallocate();
ElectricEIRChiller.deallocate();
ElectricEIRChillerReport.deallocate();
}

TEST_F(EnergyPlusFixture, ElectricEIRChiller_HeatRecoveryAutosizeTest)
TEST_F(ChillerElecEIRFixture, ElectricEIRChiller_HeatRecoveryAutosizeTest)
{
// unit test for autosizing heat recovery in Chiller:Electric:EIR
ChillerElectricEIR::ElectricEIRChiller.allocate(1);

ChillerElectricEIR::ElectricEIRChiller(1).SizFac = 1.0;
ChillerElectricEIR::ElectricEIRChiller(1).DesignHeatRecVolFlowRateWasAutoSized = true;
ChillerElectricEIR::ElectricEIRChiller(1).HeatRecCapacityFraction = 0.5;
ChillerElectricEIR::ElectricEIRChiller(1).HeatRecActive = true;
ChillerElectricEIR::ElectricEIRChiller(1).CondenserType = ChillerElectricEIR::WaterCooled;
ChillerElectricEIR::ElectricEIRChiller(1).CWLoopNum = 1;
ChillerElectricEIR::ElectricEIRChiller(1).CDLoopNum = 2;
ChillerElectricEIR::ElectricEIRChiller(1).EvapVolFlowRate = 1.0;
ChillerElectricEIR::ElectricEIRChiller(1).CondVolFlowRate = 1.0;
ChillerElectricEIR::ElectricEIRChiller(1).RefCap = 10000;
ChillerElectricEIR::ElectricEIRChiller(1).RefCOP = 3.0;
auto &thisEIR = ChillerElectricEIR::ElectricEIRChiller(1);

thisEIR.SizFac = 1.0;
thisEIR.DesignHeatRecVolFlowRateWasAutoSized = true;
thisEIR.HeatRecCapacityFraction = 0.5;
thisEIR.HeatRecActive = true;
thisEIR.CondenserType = ChillerElectricEIR::WaterCooled;
thisEIR.CWLoopNum = 1;
thisEIR.CDLoopNum = 2;
thisEIR.EvapVolFlowRate = 1.0;
thisEIR.CondVolFlowRate = 1.0;
thisEIR.RefCap = 10000;
thisEIR.RefCOP = 3.0;

DataPlant::PlantLoop.allocate(2);
DataSizing::PlantSizData.allocate(2);
Expand All @@ -131,16 +129,16 @@ TEST_F(EnergyPlusFixture, ElectricEIRChiller_HeatRecoveryAutosizeTest)
DataPlant::PlantFirstSizesOkayToFinalize = true;

// now call sizing routine
ChillerElectricEIR::SizeElectricEIRChiller(1);
thisEIR.size();
// see if heat recovery flow rate is as expected
EXPECT_NEAR(ChillerElectricEIR::ElectricEIRChiller(1).DesignHeatRecVolFlowRate, 0.5, 0.00001);
EXPECT_NEAR(thisEIR.DesignHeatRecVolFlowRate, 0.5, 0.00001);

ChillerElectricEIR::ElectricEIRChiller.deallocate();
DataSizing::PlantSizData.deallocate();
DataPlant::PlantLoop.deallocate();
}

TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller)
TEST_F(ChillerElecEIRFixture, ChillerElectricEIR_AirCooledChiller)
{

bool RunFlag(true);
Expand Down Expand Up @@ -213,16 +211,17 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller)
}

GetElectricEIRChillerInput();
auto &thisEIR = ChillerElectricEIR::ElectricEIRChiller(1);

DataPlant::PlantLoop(1).Name = "ChilledWaterLoop";
DataPlant::PlantLoop(1).FluidName = "ChilledWater";
DataPlant::PlantLoop(1).FluidIndex = 1;
DataPlant::PlantLoop(1).PlantSizNum = 1;
DataPlant::PlantLoop(1).FluidName = "WATER";
DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = ElectricEIRChiller(1).Name;
DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = thisEIR.Name;
DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_Chiller_ElectricEIR;
DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = ElectricEIRChiller(1).EvapInletNodeNum;
DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = ElectricEIRChiller(1).EvapOutletNodeNum;
DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = thisEIR.EvapInletNodeNum;
DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = thisEIR.EvapOutletNodeNum;

DataSizing::PlantSizData.allocate(1);
DataSizing::PlantSizData(1).DesVolFlowRate = 0.001;
Expand All @@ -232,19 +231,19 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller)
DataPlant::PlantFirstSizesOkayToReport = true;
DataPlant::PlantFinalSizesOkayToReport = true;

InitElectricEIRChiller(1, RunFlag, MyLoad);
SizeElectricEIRChiller(1);
thisEIR.initialize(RunFlag, MyLoad);
thisEIR.size();

// run through init again after sizing is complete to set mass flow rate
DataGlobals::BeginEnvrnFlag = true;
InitElectricEIRChiller(1, RunFlag, MyLoad);
thisEIR.initialize(RunFlag, MyLoad);

// check chiller water side evap flow rate is non-zero
EXPECT_NEAR(ElectricEIRChiller(1).EvapMassFlowRateMax, 0.999898, 0.0000001);
EXPECT_NEAR(thisEIR.EvapMassFlowRateMax, 0.999898, 0.0000001);

// check autocalculate for air-cooled or evap-cooled chiller condenser side fluid flow rate
Real64 CalcCondVolFlow = ElectricEIRChiller(1).RefCap * 0.000114;
EXPECT_EQ(CalcCondVolFlow, ElectricEIRChiller(1).CondVolFlowRate);
EXPECT_NEAR(ElectricEIRChiller(1).CondVolFlowRate, 2.3925760323498, 0.0000001);
EXPECT_NEAR(ElectricEIRChiller(1).CondMassFlowRateMax, 2.7918772761695, 0.0000001);
Real64 CalcCondVolFlow = thisEIR.RefCap * 0.000114;
EXPECT_EQ(CalcCondVolFlow, thisEIR.CondVolFlowRate);
EXPECT_NEAR(thisEIR.CondVolFlowRate, 2.3925760323498, 0.0000001);
EXPECT_NEAR(thisEIR.CondMassFlowRateMax, 2.7918772761695, 0.0000001);
}
12 changes: 6 additions & 6 deletions tst/EnergyPlus/unit/StandardRatings.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ TEST_F(EnergyPlusFixture, ChillerIPLVTest)
PerfCurve(CurveNum).Var1Max = 10;
PerfCurve(CurveNum).Var2Min = 23.89;
PerfCurve(CurveNum).Var2Max = 46.11;
ChillerElectricEIR::ElectricEIRChiller(1).ChillerCapFT = 1;
ChillerElectricEIR::ElectricEIRChiller(1).ChillerCapFTIndex = 1;

// EIR=f(T)
CurveNum = 2;
Expand All @@ -297,7 +297,7 @@ TEST_F(EnergyPlusFixture, ChillerIPLVTest)
PerfCurve(CurveNum).Var1Max = 10;
PerfCurve(CurveNum).Var2Min = 10;
PerfCurve(CurveNum).Var2Max = 46.11;
ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFT = 2;
ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFTIndex = 2;

// EIR=f(PLR)
CurveNum = 3;
Expand All @@ -312,17 +312,17 @@ TEST_F(EnergyPlusFixture, ChillerIPLVTest)
PerfCurve(CurveNum).Coeff4 = 0.412199944;
PerfCurve(CurveNum).Var1Min = 0;
PerfCurve(CurveNum).Var1Max = 1;
ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFPLR = 3;
ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFPLRIndex = 3;

Real64 IPLV;
CalcChillerIPLV(ChillerElectricEIR::ElectricEIRChiller(1).Name,
TypeOf_Chiller_ElectricEIR,
ChillerElectricEIR::ElectricEIRChiller(1).RefCap,
ChillerElectricEIR::ElectricEIRChiller(1).RefCOP,
ChillerElectricEIR::ElectricEIRChiller(1).CondenserType,
ChillerElectricEIR::ElectricEIRChiller(1).ChillerCapFT,
ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFT,
ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFPLR,
ChillerElectricEIR::ElectricEIRChiller(1).ChillerCapFTIndex,
ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFTIndex,
ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFPLRIndex,
ChillerElectricEIR::ElectricEIRChiller(1).MinUnloadRat,
IPLV);

Expand Down

14 comments on commit 700637e

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.4: OK (1960 of 1960 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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-custom_check: OK (11 of 11 tests passed, 0 test warnings)

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-UnitTestsCoverage-Debug: OK (1266 of 1266 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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-IntegrationCoverage-Debug: OK (676 of 677 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 676
  • Timeout: 1

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (1940 of 1940 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.

170771208_Issue7692 (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-custom_check: OK (11 of 11 tests passed, 0 test warnings)

Build Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

170771208_Issue7692 (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

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

170771208_Issue7692 (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.4: OK (2652 of 2652 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.

170771208_Issue7692 (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-UnitTestsCoverage-Debug: OK (1266 of 1266 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

170771208_Issue7692 (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-IntegrationCoverage-Debug: OK (676 of 677 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 676
  • Timeout: 1

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

170771208_Issue7692 (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2612 of 2612 tests passed, 0 test warnings)

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.

170771208_Issue7692 (Myoldmopar) - x86_64-MacOS-10.13-clang: OK (2612 of 2612 tests passed, 0 test warnings)

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.

develop (Myoldmopar) - x86_64-MacOS-10.13-clang: OK (1940 of 1940 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.