Skip to content

Commit

Permalink
partial using plantCompPtr. large table diffs, but no math diffs, on …
Browse files Browse the repository at this point in the history
…one file
  • Loading branch information
mitchute committed Nov 19, 2019
1 parent 16c393a commit ba73eeb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 195 deletions.
15 changes: 2 additions & 13 deletions src/EnergyPlus/IntegratedHeatPump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2244,19 +2244,8 @@ namespace IntegratedHeatPump {
auto &tank = WaterThermalTanks::WaterThermalTank(tankIDX);
tank.callerLoopNum = IntegratedHeatPumps(DXCoilNum).LoopNum;

// PlantLocation A(0, 0, 0, 0);
// tank.simulate(A, true, MyLoad, true);

WaterThermalTanks::SimWaterThermalTank_WaterTank(tankType,
IntegratedHeatPumps(DXCoilNum).WHtankName,
IntegratedHeatPumps(DXCoilNum).WHtankID,
false,
false,
MyLoad,
MaxCap,
MinCap,
OptCap,
true);
PlantLocation A(0, 0, 0, 0);
tank.simulate(A, true, MyLoad, true);

tank.callerLoopNum = 0;

Expand Down
8 changes: 4 additions & 4 deletions src/EnergyPlus/Plant/PlantManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ namespace EnergyPlus {
} else if (LoopSideNum == SupplySide) {
this_comp.CurOpSchemeType = UnknownStatusOpSchemeType;
}
// this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(CompNames(CompNum));
this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(CompNames(CompNum));
} else if (UtilityRoutines::SameString(this_comp_type, "WaterHeater:Stratified")) {
this_comp.TypeOf_Num = TypeOf_WtrHeaterStratified;
this_comp.GeneralEquipType = GenEquipTypes_WaterThermalTank;
Expand All @@ -948,7 +948,7 @@ namespace EnergyPlus {
} else if (LoopSideNum == SupplySide) {
this_comp.CurOpSchemeType = UnknownStatusOpSchemeType;
}
// this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(CompNames(CompNum));
this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(CompNames(CompNum));
} else if (UtilityRoutines::SameString(this_comp_type,
"ChillerHeater:Absorption:Directfired")) {
this_comp.TypeOf_Num = TypeOf_Chiller_DFAbsorption;
Expand All @@ -966,7 +966,7 @@ namespace EnergyPlus {
} else if (LoopSideNum == SupplySide) {
this_comp.CurOpSchemeType = UnknownStatusOpSchemeType;
}
// this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(CompNames(CompNum));
this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(CompNames(CompNum));
} else if (UtilityRoutines::SameString(this_comp_type,
"ThermalStorage:ChilledWater:Stratified")) {
this_comp.TypeOf_Num = TypeOf_ChilledWaterTankStratified;
Expand All @@ -976,7 +976,7 @@ namespace EnergyPlus {
} else if (LoopSideNum == SupplySide) {
this_comp.CurOpSchemeType = UnknownStatusOpSchemeType;
}
// this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(CompNames(CompNum));
this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(CompNames(CompNum));
} else if (UtilityRoutines::SameString(this_comp_type, "WaterUse:Connections")) {
this_comp.TypeOf_Num = TypeOf_WaterUseConnection;
this_comp.GeneralEquipType = GenEquipTypes_WaterUse;
Expand Down
57 changes: 18 additions & 39 deletions src/EnergyPlus/PlantLoopEquip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ namespace PlantLoopEquip {
using ChillerReformulatedEIR::SimReformulatedEIRChiller;
using PlantChillers::SimChiller;
using Pumps::SimPumps;
using WaterThermalTanks::SimWaterThermalTank_WaterTank;
using WaterThermalTanks::SimWaterThermalTank_HeatPump;
using FuelCellElectricGenerator::SimFuelCellPlantHeatRecovery;
using PlantHeatExchangerFluidToFluid::SimFluidHeatExchanger;
Expand Down Expand Up @@ -639,27 +638,7 @@ namespace PlantLoopEquip {
auto &tank = WaterThermalTanks::WaterThermalTank(tankIDX);
tank.callerLoopNum = LoopNum;

// sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

SimWaterThermalTank_WaterTank(EquipTypeNum,
sim_component.Name,
EquipNum,
RunFlag,
InitLoopEquip,
CurLoad,
MaxLoad,
MinLoad,
OptLoad,
FirstHVACIteration); // DSU

tank.callerLoopNum = 0;

if (InitLoopEquip) {
sim_component.MaxLoad = MaxLoad;
sim_component.MinLoad = MinLoad;
sim_component.OptLoad = OptLoad;
sim_component.CompNum = EquipNum;
}
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

// HEAT PUMP WATER HEATER
} else if (EquipTypeNum == TypeOf_HeatPumpWtrHeaterPumped || EquipTypeNum == TypeOf_HeatPumpWtrHeaterWrapped) {
Expand Down Expand Up @@ -787,27 +766,27 @@ namespace PlantLoopEquip {
auto &tank = WaterThermalTanks::WaterThermalTank(tankIDX);
tank.callerLoopNum = LoopNum;

// sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

SimWaterThermalTank_WaterTank(EquipTypeNum,
sim_component.Name,
EquipNum,
RunFlag,
InitLoopEquip,
CurLoad,
MaxLoad,
MinLoad,
OptLoad,
FirstHVACIteration); // DSU
// SimWaterThermalTank_WaterTank(EquipTypeNum,
// sim_component.Name,
// EquipNum,
// RunFlag,
// InitLoopEquip,
// CurLoad,
// MaxLoad,
// MinLoad,
// OptLoad,
// FirstHVACIteration); // DSU

WaterThermalTanks::WaterThermalTank(tankIDX).callerLoopNum = 0;

if (InitLoopEquip) {
sim_component.MaxLoad = MaxLoad;
sim_component.MinLoad = MinLoad;
sim_component.OptLoad = OptLoad;
sim_component.CompNum = EquipNum;
}
// if (InitLoopEquip) {
// sim_component.MaxLoad = MaxLoad;
// sim_component.MinLoad = MinLoad;
// sim_component.OptLoad = OptLoad;
// sim_component.CompNum = EquipNum;
// }

} else {
ShowSevereError("SimPlantEquip: Invalid Chilled/Ice Thermal Storage Type=" + sim_component.TypeOf);
Expand Down
133 changes: 5 additions & 128 deletions src/EnergyPlus/WaterThermalTanks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,15 @@ namespace WaterThermalTanks {
return nullptr; // LCOV_EXCL_LINE
}

void WaterThermalTankData::onInitLoopEquip(const PlantLocation &EP_UNUSED(calledFromLocation))
void WaterThermalTankData::onInitLoopEquip(const PlantLocation &calledFromLocation)
{
this->InitWaterThermalTank(true);
this->MinePlantStructForInfo();
if (this->callerLoopNum > 0) {
if ((this->SrcSide.loopNum == this->callerLoopNum) || (this->UseSide.loopNum == this->callerLoopNum)) {
if (calledFromLocation.loopNum > 0) {
if ((this->SrcSide.loopNum == calledFromLocation.loopNum) || (this->UseSide.loopNum == calledFromLocation.loopNum)) {
this->SizeTankForDemandSide();
this->SizeDemandSidePlantConnections();
this->SizeSupplySidePlantConnections(this->callerLoopNum);
this->SizeSupplySidePlantConnections(calledFromLocation.loopNum);
this->SizeTankForSupplySide();
} else {
return;
Expand Down Expand Up @@ -329,8 +330,6 @@ namespace WaterThermalTanks {
this->myOneTimeInitFlag = false;
}

this->InitWaterThermalTank(FirstHVACIteration);

if (this->MyOneTimeFlagWH) {
this->MyOneTimeFlagWH = false;
} else {
Expand Down Expand Up @@ -361,95 +360,6 @@ namespace WaterThermalTanks {
this->ReportWaterThermalTank();
}

void SimWaterThermalTank_WaterTank(int const EP_UNUSED(CompType),
std::string const &CompName,
int &CompIndex,
bool const EP_UNUSED(RunFlag), // unused1208
bool const InitLoopEquip,
Real64 &MyLoad,
Real64 &MaxCap,
Real64 &MinCap,
Real64 &OptCap,
bool const FirstHVACIteration)
{
// SUBROUTINE INFORMATION:
// AUTHOR Brandon Anderson
// DATE WRITTEN May 2000
// MODIFIED FSEC, July 2005
// RE-ENGINEERED na

int CompNum = getTankIDX(CompName, CompIndex);

auto Tank = &WaterThermalTank(CompNum);

if (Tank->myOneTimeInitFlag) {
Tank->setupOutputVars();
Tank->myOneTimeInitFlag = false;
}

if (InitLoopEquip) {
Tank->InitWaterThermalTank(FirstHVACIteration);
Tank->MinePlantStructForInfo();
if (Tank->callerLoopNum > 0) {
if ((Tank->SrcSide.loopNum == Tank->callerLoopNum) || (Tank->UseSide.loopNum == Tank->callerLoopNum)) {
Tank->SizeTankForDemandSide();
Tank->SizeDemandSidePlantConnections();
Tank->SizeSupplySidePlantConnections(Tank->callerLoopNum);
Tank->SizeTankForSupplySide();
} else {
return;
}
} else {
Tank->SizeTankForDemandSide();
Tank->SizeDemandSidePlantConnections();
Tank->SizeSupplySidePlantConnections();
Tank->SizeTankForSupplySide();
}

if (DataPlant::PlantFirstSizesOkayToFinalize) {
if (!Tank->IsChilledWaterTank) {
Tank->CalcStandardRatings();
} else {
Tank->ReportCWTankInits();
}
}
MinCap = 0.0;
MaxCap = Tank->MaxCapacity;
OptCap = Tank->MaxCapacity;
return;
}

if (Tank->MyOneTimeFlagWH) {
Tank->MyOneTimeFlagWH = false;
} else {
if (Tank->MyTwoTimeFlagWH) {
Tank->MinePlantStructForInfo(); // call it again to get control types filled out
Tank->MyTwoTimeFlagWH = false;
}
}
Tank->UseSideLoadRequested = std::abs(MyLoad);
if (Tank->UseSide.loopNum > 0 && Tank->UseSide.loopSideNum > 0 && !DataGlobals::KickOffSimulation) {
Tank->UseCurrentFlowLock = DataPlant::PlantLoop(Tank->UseSide.loopNum).LoopSide(Tank->UseSide.loopSideNum).FlowLock;
} else {
Tank->UseCurrentFlowLock = 1;
}
Tank->InitWaterThermalTank(FirstHVACIteration);
// Plant connected water heaters may have a desuperheater heating coil attached
if (Tank->DesuperheaterNum == 0) {
if ((Tank->TypeNum == DataPlant::TypeOf_WtrHeaterMixed) || (Tank->TypeNum == DataPlant::TypeOf_ChilledWaterTankMixed)) {
Tank->CalcWaterThermalTankMixed();
} else if ((Tank->TypeNum == DataPlant::TypeOf_WtrHeaterStratified) ||
(Tank->TypeNum == DataPlant::TypeOf_ChilledWaterTankStratified)) {
Tank->CalcWaterThermalTankStratified();
}
} else if (Tank->DesuperheaterNum > 0) {
Tank->CalcDesuperheaterWaterHeater(FirstHVACIteration);
}
Tank->UpdateWaterThermalTank();
Tank->ReportWaterThermalTank();

}

void SimWaterThermalTank_HeatPump(int const CompType,
std::string const &CompName,
int &CompIndex,
Expand Down Expand Up @@ -611,23 +521,6 @@ namespace WaterThermalTanks {
PlantLocation A(0, 0, 0, 0);
Tank->simulate(A, FirstHVACIteration, MyLoad, localRunFlag);

// SimWaterThermalTank_WaterTank(Tank->TypeNum,
// Tank->Name,
// TestNum,
// LocalRunFlag,
// LocalInitLoopEquip,
// MyLoad,
// MinCap,
// MaxCap,
// OptCap,
// FirstHVACIteration);

// if (testNum != WaterHeaterNum) {
// ShowFatalError("SimulateWaterHeaterStandAlone: Input WaterHeater Num [" + General::TrimSigDigits(WaterHeaterNum) +
// "] does not match returned WaterHeater Num[" + General::TrimSigDigits(testNum) + "] Name=\"" +
// Tank->Name + "\".");
// }

// HPWHs with inlet air from a zone and not connected to a plant loop are simulated through a CALL from ZoneEquipmentManager.
// HPWHs that are plant connected are always simulated through a CALL from PlantLoopEquipments directly to SimWaterThermalTank.

Expand Down Expand Up @@ -661,22 +554,6 @@ namespace WaterThermalTanks {
bool localRunFlag = true;
PlantLocation A(0, 0, 0, 0);
Tank->simulate(A, FirstHVACIteration, MyLoad, localRunFlag);

// SimWaterThermalTank_WaterTank(Tank->TypeNum,
// Tank->Name,
// TestNum,
// LocalRunFlag,
// LocalInitLoopEquip,
// MyLoad,
// MinCap,
// MaxCap,
// OptCap,
// FirstHVACIteration);
// if (testNum != WaterHeaterNum) {
// ShowFatalError("SimulateWaterHeaterStandAlone: Input WaterHeater Num [" + General::TrimSigDigits(WaterHeaterNum) +
// "] does not match returned WaterHeater Num[" + General::TrimSigDigits(testNum) + "] Name=\"" +
// Tank->Name + "\".");
// }
}
}
}
Expand Down
11 changes: 0 additions & 11 deletions src/EnergyPlus/WaterThermalTanks.hh
Original file line number Diff line number Diff line change
Expand Up @@ -874,17 +874,6 @@ namespace WaterThermalTanks {

// Functions

void SimWaterThermalTank_WaterTank(int CompType,
std::string const &CompName,
int &CompIndex,
bool RunFlag, // unused1208
bool InitLoopEquip,
Real64 &MyLoad,
Real64 &MaxCap,
Real64 &MinCap,
Real64 &OptCap,
bool FirstHVACIteration);

void SimWaterThermalTank_HeatPump(int CompType,
std::string const &CompName,
int &CompIndex,
Expand Down

6 comments on commit ba73eeb

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

waterHeaterMixedRefactor (mitchute) - x86_64-MacOS-10.13-clang: OK (2572 of 2581 tests passed, 5 test warnings)

Messages:\n

  • 13 tests had: MTD diffs.
  • 14 tests had: RDD diffs.
  • 9 tests had: EIO diffs.
  • 9 tests had: BND diffs.
  • 9 tests had: MDD diffs.
  • 4 tests had: MTR small diffs.
  • 9 tests had: Table big diffs.

Failures:\n

regression Test Summary

  • Passed: 660
  • Failed: 9

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-cppcheck: OK (0 of 0 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.

waterHeaterMixedRefactor (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.4: OK (2612 of 2621 tests passed, 5 test warnings)

Messages:\n

  • 9 tests had: EIO diffs.
  • 13 tests had: MTD diffs.
  • 14 tests had: RDD diffs.
  • 9 tests had: BND diffs.
  • 9 tests had: MDD diffs.
  • 9 tests had: Table big diffs.
  • 2 tests had: MTR small diffs.

Failures:\n

regression Test Summary

  • Passed: 680
  • Failed: 9

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-UnitTestsCoverage-Debug: OK (1241 of 1241 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.

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

@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 (2572 of 2581 tests passed, 5 test warnings)

Messages:\n

  • 13 tests had: MTD diffs.
  • 14 tests had: RDD diffs.
  • 9 tests had: EIO diffs.
  • 9 tests had: BND diffs.
  • 9 tests had: MDD diffs.
  • 9 tests had: Table big diffs.
  • 2 tests had: MTR small diffs.

Failures:\n

regression Test Summary

  • Passed: 660
  • Failed: 9

Build Badge Test Badge

Please sign in to comment.