Skip to content

Commit

Permalink
Step 10 partial - functions to members
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Oct 9, 2019
1 parent 2730747 commit e0175ee
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
50 changes: 25 additions & 25 deletions src/EnergyPlus/WaterThermalTanks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ namespace WaterThermalTanks {
// Calculate and report water heater standard ratings to EIO file (now that sizing is done)
if (DataPlant::PlantFirstSizesOkayToFinalize) {
if (!WaterThermalTank(CompNum).IsChilledWaterTank) {
WaterThermalTank(CompNum).CalcStandardRatings(CompNum);
WaterThermalTank(CompNum).CalcStandardRatings();
} else {
WaterThermalTank(CompNum).ReportCWTankInits();
}
Expand Down Expand Up @@ -405,7 +405,7 @@ namespace WaterThermalTanks {
}

if (DataPlant::PlantFirstSizesOkayToFinalize) {
WaterThermalTank(TankNum).CalcStandardRatings(TankNum);
WaterThermalTank(TankNum).CalcStandardRatings();
DataSizing::DataNonZoneNonAirloopValue = 0.0;
}
MinCap = 0.0;
Expand Down Expand Up @@ -6482,7 +6482,7 @@ namespace WaterThermalTanks {
} else {
if (!DataGlobals::AnyPlantInModel || DataPlant::PlantFirstSizesOkayToReport || this->MaxCapacity > 0.0 ||
this->HeatPumpNum > 0) {
this->CalcStandardRatings(WaterThermalTankNum);
this->CalcStandardRatings();
}
}
}
Expand Down Expand Up @@ -8707,15 +8707,15 @@ namespace WaterThermalTanks {
} else {
Fans::SimulateFanComponents(HeatPump.FanName, FirstHVACIteration, HeatPump.FanNum);
}
SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
if (HeatPump.bIsIHP)
VariableSpeedCoils::SimVariableSpeedCoils(
"", VSCoilNum, DataHVACGlobals::CycFanCycCoil, EMP1, EMP2, EMP3, 1, modHPPartLoadRatio, SpeedNum, SpeedRatio, 0.0, 0.0, 1.0);
else
VariableSpeedCoils::SimVariableSpeedCoils(
HeatPump.DXCoilName, VSCoilNum, DataHVACGlobals::CycFanCycCoil, EMP1, EMP2, EMP3, 1, modHPPartLoadRatio, SpeedNum, SpeedRatio, 0.0, 0.0, 1.0);
} else {
SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
if (HeatPump.bIsIHP)
VariableSpeedCoils::SimVariableSpeedCoils(
"", VSCoilNum, DataHVACGlobals::CycFanCycCoil, EMP1, EMP2, EMP3, 1, modHPPartLoadRatio, SpeedNum, SpeedRatio, 0.0, 0.0, 1.0);
Expand All @@ -8741,11 +8741,11 @@ namespace WaterThermalTanks {
} else {
Fans::SimulateFanComponents(HeatPump.FanName, FirstHVACIteration, HeatPump.FanNum);
}
SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
VariableSpeedCoils::SimVariableSpeedCoils(
"", VSCoilNum, DataHVACGlobals::CycFanCycCoil, EMP1, EMP2, EMP3, 1, modHPPartLoadRatio, SpeedNum, SpeedRatio, 0.0, 0.0, 1.0);
} else {
SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
VariableSpeedCoils::SimVariableSpeedCoils(
"", VSCoilNum, DataHVACGlobals::CycFanCycCoil, EMP1, EMP2, EMP3, 1, modHPPartLoadRatio, SpeedNum, SpeedRatio, 0.0, 0.0, 1.0);
if (HeatPump.FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
Expand Down Expand Up @@ -9006,7 +9006,7 @@ namespace WaterThermalTanks {
modHPPartLoadRatio = 1.0;
bIterSpeed = true; // prepare for iterating between speed levels
SpeedNum = 1;
SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);

if (HeatPump.bIsIHP) {
bIterSpeed = false; // don't iterate speed unless match conditions below
Expand All @@ -9022,17 +9022,17 @@ namespace WaterThermalTanks {
IntegratedHeatPump::IntegratedHeatPumps(HeatPump.DXCoilNum).CurMode = IntegratedHeatPump::IHPOperationMode::SCWHMatchWHMode;
}

SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);

VariableSpeedCoils::SimVariableSpeedCoils(
"", VSCoilNum, DataHVACGlobals::CycFanCycCoil, EMP1, EMP2, EMP3, 1, modHPPartLoadRatio, SpeedNum, SpeedRatio, 0.0, 0.0, 1.0);

IntegratedHeatPump::IntegratedHeatPumps(HeatPump.DXCoilNum).CurMode = IHPMode;
SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
} else {
SpeedNum = IntegratedHeatPump::GetLowSpeedNumIHP(HeatPump.DXCoilNum);

SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
IntegratedHeatPump::SimIHP(HeatPump.DXCoilName,
HeatPump.DXCoilNum,
DataHVACGlobals::CycFanCycCoil,
Expand Down Expand Up @@ -9165,7 +9165,7 @@ namespace WaterThermalTanks {
SpeedRatio = 1.0;
SpeedNum = 1;

SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);

if (HeatPump.bIsIHP) {
if (bIterSpeed) {
Expand Down Expand Up @@ -9219,7 +9219,7 @@ namespace WaterThermalTanks {

for (int i = LowSpeedNum; i <= MaxSpeedNum; ++i) {
SpeedNum = i;
SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
if (HeatPump.bIsIHP) {
IntegratedHeatPump::SimIHP(HeatPump.DXCoilName,
HeatPump.DXCoilNum,
Expand Down Expand Up @@ -9349,7 +9349,7 @@ namespace WaterThermalTanks {
}

modHPPartLoadRatio = 1.0;
SetVSHPWHFlowRates(WaterThermalTankNum, Tank.HeatPumpNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);
SetVSHPWHFlowRates(Tank, HeatPump, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);

if (HeatPump.bIsIHP) {
IntegratedHeatPump::SimIHP(HeatPump.DXCoilName,
Expand Down Expand Up @@ -9775,8 +9775,8 @@ namespace WaterThermalTanks {
}
}

void SetVSHPWHFlowRates(int const WaterThermalTankNum, // Water Heater tank being simulated
int const HPNum, // index of heat pump coil
void SetVSHPWHFlowRates(WaterThermalTankData &Tank, // Water Heater tank being simulated
HeatPumpWaterHeaterData &HPWH, // heat pump coil
int const SpeedNum, // upper speed number
Real64 const SpeedRatio, // interpolation ration between upper and lower speed
Real64 const WaterDens, // tank water density
Expand All @@ -9796,9 +9796,6 @@ namespace WaterThermalTanks {
int SpeedLow = SpeedNum - 1;
if (SpeedLow < 1) SpeedLow = 1;

WaterThermalTankData &Tank(WaterThermalTank(WaterThermalTankNum));
HeatPumpWaterHeaterData &HPWH(HPWaterHeater(HPNum));

int HPWaterInletNode = HPWH.CondWaterInletNode;
int DXCoilAirInletNode = HPWH.DXCoilAirInletNode;
if (HPWH.bIsIHP) {
Expand Down Expand Up @@ -9889,7 +9886,11 @@ namespace WaterThermalTanks {

modHPPartLoadRatio = 1.0;
Real64 MdotWater = 0.0;
SetVSHPWHFlowRates(WaterThermalTankNum, HPNum, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);

auto &Tank = WaterThermalTank(WaterThermalTankNum);
auto &HPWH = HPWaterHeater(HPNum);

SetVSHPWHFlowRates(Tank, HPWH, SpeedNum, SpeedRatio, RhoWater, MdotWater, FirstHVACIteration);

if (HPWaterHeater(HPNum).bIsIHP) {
IntegratedHeatPump::SimIHP(HPWaterHeater(HPNum).DXCoilName,
Expand Down Expand Up @@ -9944,8 +9945,7 @@ namespace WaterThermalTanks {
}
}

Real64 PLRResidualIterSpeed = Par(7) - NewTankTemp;
return PLRResidualIterSpeed;
return Par(7) - NewTankTemp;
}

Real64 PLRResidualWaterThermalTank(Real64 const HPPartLoadRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
Expand Down Expand Up @@ -11748,7 +11748,7 @@ namespace WaterThermalTanks {
this->VolumeConsumed = this->VolFlowRate * SecInTimeStep;
}

void WaterThermalTankData::CalcStandardRatings(int const WaterThermalTankNum)
void WaterThermalTankData::CalcStandardRatings()
{

// SUBROUTINE INFORMATION:
Expand Down Expand Up @@ -11900,8 +11900,8 @@ namespace WaterThermalTanks {
}

Real64 RhoWater = Psychrometrics::RhoH2O(this->TankTemp);
SetVSHPWHFlowRates(
WaterThermalTankNum, HPNum, VariableSpeedCoils::VarSpeedCoil(HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, 1.0, RhoWater, MdotWater, true);
auto &HPWH = HPWaterHeater(HPNum);
SetVSHPWHFlowRates(*this, HPWH, VariableSpeedCoils::VarSpeedCoil(HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, 1.0, RhoWater, MdotWater, true);
// simulate the HPWH coil/fan to find heating capacity
Real64 EMP1 = 0.0;
Real64 EMP2 = 0.0;
Expand Down
6 changes: 3 additions & 3 deletions src/EnergyPlus/WaterThermalTanks.hh
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ namespace WaterThermalTanks {

void CalcWaterThermalTankMixed(); // Water Heater being simulated

void CalcStandardRatings(int WaterThermalTankNum);
void CalcStandardRatings();

void ReportCWTankInits();

Expand Down Expand Up @@ -871,8 +871,8 @@ namespace WaterThermalTanks {
Real64 DeadBandTemp,
Real64 SetPointTemp);

void SetVSHPWHFlowRates(int WaterThermalTankNum,
int HPNum,
void SetVSHPWHFlowRates(WaterThermalTankData &Tank,
HeatPumpWaterHeaterData &HPWH,
int SpeedNum,
Real64 SpeedRatio,
Real64 WaterDens,
Expand Down

6 comments on commit e0175ee

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

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

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

waterHeaterMixedRefactor (mitchute) - 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.

waterHeaterMixedRefactor (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.4: OK (2619 of 2619 tests passed, 0 test warnings)

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

waterHeaterMixedRefactor (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-UnitTestsCoverage-Debug: OK (1239 of 1239 tests passed, 0 test warnings)

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.

waterHeaterMixedRefactor (mitchute) - Win64-Windows-10-VisualStudio-16: OK (2579 of 2579 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.

waterHeaterMixedRefactor (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-IntegrationCoverage-Debug: OK (674 of 674 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.