Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chiller Electric EIR Plant Component Refactor #7679

Merged
merged 32 commits into from
Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fe38d5c
step 0 - cleanup comments
mitchute Jan 13, 2020
cf6c603
step 1 - cleanup usings
mitchute Jan 13, 2020
f562766
step 2 - cleanup warnings
mitchute Jan 13, 2020
6e84888
step 3 - cleanup statics
mitchute Jan 13, 2020
2b24e39
steps 4-7 - partial cleanup/move/remove mod vars, remove extra structs
mitchute Jan 14, 2020
fbbbd66
steps 4-7 - partial cleanup/move/remove mod vars, remove extra structs
mitchute Jan 14, 2020
8217e4a
Merge branch 'develop' into chillerElecEIRrefactor
mitchute Jan 14, 2020
4f955df
steps 4-7 - partial cleanup/move/remove mod vars, remove extra structs
mitchute Jan 14, 2020
9601a79
steps 4-7 - partial cleanup/move/remove mod vars, remove extra structs
mitchute Jan 14, 2020
ccbf421
steps 4-7 - partial cleanup/move/remove mod vars, remove extra structs
mitchute Jan 14, 2020
79fc81a
steps 4-7 - partial cleanup/move/remove mod vars, remove extra structs
mitchute Jan 14, 2020
2b8b8d0
steps 4-7 - partial cleanup/move/remove mod vars, remove extra structs
mitchute Jan 14, 2020
15d0544
steps 4-7 - partial cleanup/move/remove mod vars, remove extra structs
mitchute Jan 14, 2020
715b5b7
fix diffs
mitchute Jan 15, 2020
1ff7f7f
step 7 - partial remove extra struct
mitchute Jan 15, 2020
31f58df
step 7 - remove extra structs
mitchute Jan 15, 2020
4fb43e4
step 6 - cleanup remaining mod-level vars
mitchute Jan 15, 2020
d443673
step 9 - partial cleanup local vars
mitchute Jan 15, 2020
3787006
Merge branch 'develop' into chillerElecEIRrefactor
mitchute Jan 15, 2020
e7b545b
step 9 - partial cleanup local vars
mitchute Jan 15, 2020
9b490de
step 9 - partial cleanup local vars
mitchute Jan 15, 2020
ec730c0
step 9 - partial cleanup local vars
mitchute Jan 15, 2020
3858c34
step 9 - partial functions to members
mitchute Jan 15, 2020
17cb530
step 9 - partial functions to members
mitchute Jan 15, 2020
533c5c3
step 9 - functions to members and unit test cleanup
mitchute Jan 15, 2020
932a176
steps 11-12 - inherit PlantComponent and move over to PlantComp calli…
mitchute Jan 15, 2020
027063a
step 10 - move setupOutputVars to member function
mitchute Jan 15, 2020
30e2c11
add getDesignTemperatures from PlantComponent
mitchute Jan 15, 2020
7863112
Merge branch 'develop' into chillerElecEIRrefactor
mitchute Jan 16, 2020
adf7ba0
apply style
mitchute Jan 16, 2020
2ff63bd
Merge branch 'develop' into chillerElecEIRrefactor
mitchute Jan 16, 2020
bdd6800
pull setting EquipFlowCtrl out of PlantLoopEquip
mitchute Jan 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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