Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sky…
Browse files Browse the repository at this point in the history
…-emissivity
  • Loading branch information
xuanluo113 committed Jan 19, 2020
2 parents 109065d + 2336dc5 commit 2b808b6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 56 deletions.
2 changes: 2 additions & 0 deletions src/EnergyPlus/ChillerIndirectAbsorption.cc
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,8 @@ namespace ChillerIndirectAbsorption {
this->MyOneTimeFlag = false;
}

this->EquipFlowCtrl = DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).Branch(this->CWBranchNum).Comp(this->CWCompNum).FlowCtrl;

// Initialize Supply Side Variables
if (this->MyEnvrnFlag && DataGlobals::BeginEnvrnFlag && (DataPlant::PlantFirstSizesOkayToFinalize)) {

Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/FuelCellElectricGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ namespace FuelCellElectricGenerator {
int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), FuelCell, &FCDataStruct::NameExhaustHX);

if (thisFuelCell > 0) {
FuelCell(thisFuelCell).TypeOf = DataPlant::TypeOf_Generator_FCExhaust;
FuelCell(thisFuelCell).ExhaustHX.Name = AlphArray(1);
FuelCell(thisFuelCell).ExhaustHX.WaterInNodeName = AlphArray(2);
FuelCell(thisFuelCell).ExhaustHX.WaterOutNodeName = AlphArray(3);
Expand Down Expand Up @@ -989,6 +990,7 @@ namespace FuelCellElectricGenerator {
int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), FuelCell, &FCDataStruct::NameStackCooler);

if (thisFuelCell > 0) {
FuelCell(thisFuelCell).TypeOf = DataPlant::TypeOf_Generator_FCStackCooler;
FuelCell(thisFuelCell).StackCooler.Name = AlphArray(1);
FuelCell(thisFuelCell).StackCooler.WaterInNodeName = AlphArray(2);

Expand Down
16 changes: 15 additions & 1 deletion src/EnergyPlus/IceThermalStorage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
#include <EnergyPlus/InputProcessing/InputProcessor.hh>
#include <EnergyPlus/NodeInputManager.hh>
#include <EnergyPlus/OutputProcessor.hh>
#include <EnergyPlus/Plant/PlantLocation.hh>
#include <EnergyPlus/PlantUtilities.hh>
#include <EnergyPlus/Psychrometrics.hh>
#include <EnergyPlus/ScheduleManager.hh>
Expand Down Expand Up @@ -178,13 +179,25 @@ namespace IceThermalStorage {
return nullptr; // LCOV_EXCL_LINE
}

void SimpleIceStorageData::simulate(const PlantLocation &EP_UNUSED(calledFromLocation),
void SimpleIceStorageData::simulate(const PlantLocation &calledFromLocation,
bool EP_UNUSED(FirstHVACIteration),
Real64 &EP_UNUSED(CurLoad),
bool RunFlag)
{
std::string const RoutineName("SimpleIceStorageData::simulate");

// this was happening in PlantLoopEquip before
auto &thisComp(DataPlant::PlantLoop(calledFromLocation.loopNum).LoopSide(calledFromLocation.loopSideNum).Branch(calledFromLocation.branchNum).Comp(calledFromLocation.compNum));

// If component setpoint based control is active for this equipment
// then reset CurLoad to original EquipDemand.
// Allow negative CurLoad. For cold storage this means the storage should
// charge, for hot storage, this means the storage should discharge.
if (thisComp.CurOpSchemeType == DataPlant::CompSetPtBasedSchemeType) {
Real64 localCurLoad = thisComp.EquipDemand;
if (localCurLoad != 0) RunFlag = true;
}

if (DataGlobals::BeginEnvrnFlag && this->MyEnvrnFlag) {
this->ResetXForITSFlag = true;
this->MyEnvrnFlag = false;
Expand Down Expand Up @@ -279,6 +292,7 @@ namespace IceThermalStorage {
Real64 &EP_UNUSED(CurLoad),
bool EP_UNUSED(RunFlag))
{

if (DataGlobals::BeginEnvrnFlag && this->MyEnvrnFlag) {
this->ResetXForITSFlag = true;
this->MyEnvrnFlag = false;
Expand Down
53 changes: 0 additions & 53 deletions src/EnergyPlus/PlantLoopEquip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ namespace PlantLoopEquip {
using namespace DataPlant;
using DataLoopNode::Node;

// Data
// SUBROUTINE SPECIFICATION

// MODULE SUBROUTINES

// Functions

void SimPlantEquip(int const LoopNum, // loop counter
int const LoopSideNum, // loop counter
int const BranchNum,
Expand Down Expand Up @@ -173,9 +166,6 @@ namespace PlantLoopEquip {
// as a time reduction measure. Specific ifs are set to catch those modules that don't.
// If you add a module or new equipment type, you must set up this structure.

// REFERENCES:
// na

// Using/Aliasing
using ChillerExhaustAbsorption::SimExhaustAbsorber;
using ChillerReformulatedEIR::SimReformulatedEIRChiller;
Expand Down Expand Up @@ -314,7 +304,6 @@ namespace PlantLoopEquip {
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

} else if (EquipTypeNum == TypeOf_Chiller_Indirect_Absorption) {
dynamic_cast<ChillerIndirectAbsorption::IndirectAbsorberSpecs*> (sim_component.compPtr)->EquipFlowCtrl = EquipFlowCtrl;
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

} else if (EquipTypeNum == TypeOf_Chiller_ElectricEIR) {
Expand Down Expand Up @@ -480,19 +469,10 @@ namespace PlantLoopEquip {
} else if (GeneralEquipType == GenEquipTypes_WaterThermalTank) {

if ((EquipTypeNum == TypeOf_WtrHeaterMixed) || (EquipTypeNum == TypeOf_WtrHeaterStratified)) {

dynamic_cast<WaterThermalTanks::WaterThermalTankData*> (sim_component.compPtr)->callerLoopNum = LoopNum;
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);
dynamic_cast<WaterThermalTanks::WaterThermalTankData*> (sim_component.compPtr)->callerLoopNum = 0;

// HEAT PUMP WATER HEATER
} else if (EquipTypeNum == TypeOf_HeatPumpWtrHeaterPumped || EquipTypeNum == TypeOf_HeatPumpWtrHeaterWrapped) {

int tankIdx = dynamic_cast<WaterThermalTanks::HeatPumpWaterHeaterData*> (sim_component.compPtr)->WaterHeaterTankNum;
auto &tank = WaterThermalTanks::WaterThermalTank(tankIdx);
tank.callerLoopNum = LoopNum;
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);
tank.callerLoopNum = 0;

} else {
ShowSevereError("SimPlantEquip: Invalid Water Heater Type=" + sim_component.TypeOf);
Expand Down Expand Up @@ -545,41 +525,21 @@ namespace PlantLoopEquip {
} else if (EquipTypeNum == TypeOf_GrndHtExchgHorizTrench) {
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

if (InitLoopEquip) {
sim_component.CompNum = EquipNum;
}

} else if (EquipTypeNum == TypeOf_GrndHtExchgSlinky) { // 'GROUND HEAT EXCHANGER:SLINKY'
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);
}
// THERMAL STORAGE
} else if (GeneralEquipType == GenEquipTypes_ThermalStorage) {

// If component setpoint based control is active for this equipment
// then reset CurLoad to original EquipDemand.
// Allow negative CurLoad. For cold storage this means the storage should
// charge, for hot storage, this means the storage should discharge.
if (sim_component.CurOpSchemeType == CompSetPtBasedSchemeType) {
CurLoad = sim_component.EquipDemand;
if (CurLoad != 0) RunFlag = true;
}

if (EquipTypeNum == TypeOf_TS_IceSimple) {
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

} else if (EquipTypeNum == TypeOf_TS_IceDetailed) {
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

} else if ((EquipTypeNum == TypeOf_ChilledWaterTankMixed) || (EquipTypeNum == TypeOf_ChilledWaterTankStratified)) {

int tankIDX = WaterThermalTanks::getTankIDX(sim_component.Name, EquipNum);
auto &tank = WaterThermalTanks::WaterThermalTank(tankIDX);
tank.callerLoopNum = LoopNum;

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

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

} else {
ShowSevereError("SimPlantEquip: Invalid Chilled/Ice Thermal Storage Type=" + sim_component.TypeOf);
ShowContinueError("Occurs in Plant Loop=" + PlantLoop(LoopNum).Name);
Expand All @@ -605,11 +565,9 @@ namespace PlantLoopEquip {
// for heat recovery plant interactions.

if (EquipTypeNum == TypeOf_Generator_FCExhaust) {
dynamic_cast<FuelCellElectricGenerator::FCDataStruct*> (sim_component.compPtr)->TypeOf = DataPlant::TypeOf_Generator_FCExhaust;
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

} else if (EquipTypeNum == TypeOf_Generator_FCStackCooler) {
dynamic_cast<FuelCellElectricGenerator::FCDataStruct*> (sim_component.compPtr)->TypeOf = DataPlant::TypeOf_Generator_FCStackCooler;
sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag);

} else if (EquipTypeNum == TypeOf_Generator_MicroCHP) {
Expand Down Expand Up @@ -640,9 +598,6 @@ namespace PlantLoopEquip {

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

} else {
ShowSevereError("SimPlantEquip: Invalid Load Profile Type=" + sim_component.TypeOf);
Expand Down Expand Up @@ -700,7 +655,6 @@ namespace PlantLoopEquip {
} else if (GeneralEquipType == GenEquipTypes_WaterUse) {

if (EquipTypeNum == TypeOf_WaterUseConnection) {

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

} else {
Expand All @@ -712,11 +666,9 @@ namespace PlantLoopEquip {
} else if (GeneralEquipType == GenEquipTypes_SolarCollector) {

if ((EquipTypeNum == TypeOf_SolarCollectorFlatPlate) || (EquipTypeNum == TypeOf_SolarCollectorICS)) {

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

} else if (EquipTypeNum == TypeOf_PVTSolarCollectorFlatPlate) {

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

} else {
Expand Down Expand Up @@ -788,13 +740,8 @@ namespace PlantLoopEquip {
} else if (GeneralEquipType == GenEquipTypes_CentralHeatPumpSystem) {

if (EquipTypeNum == TypeOf_CentralGroundSourceHeatPump) {

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

if (GetCompSizFac) {
sim_component.SizFac = SizingFac;
}

} else {
ShowSevereError("SimPlantEquip: Invalid Central Heat Pump System Type=" + sim_component.TypeOf);
ShowContinueError("Occurs in Plant Loop=" + PlantLoop(LoopNum).Name);
Expand Down
15 changes: 13 additions & 2 deletions src/EnergyPlus/WaterThermalTanks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
#include <EnergyPlus/OutAirNodeManager.hh>
#include <EnergyPlus/OutputProcessor.hh>
#include <EnergyPlus/OutputReportPredefined.hh>
#include <EnergyPlus/Plant/PlantLocation.hh>
#include <EnergyPlus/PlantUtilities.hh>
#include <EnergyPlus/Psychrometrics.hh>
#include <EnergyPlus/RefrigeratedCase.hh>
Expand Down Expand Up @@ -314,7 +315,7 @@ namespace WaterThermalTanks {
return CompNum;
}

void WaterThermalTankData::simulate(const PlantLocation &EP_UNUSED(calledFromLocation),
void WaterThermalTankData::simulate(const PlantLocation &calledFromLocation,
bool FirstHVACIteration,
Real64 &CurLoad,
bool EP_UNUSED(RunFlag))
Expand All @@ -325,6 +326,9 @@ namespace WaterThermalTanks {
// MODIFIED FSEC, July 2005
// RE-ENGINEERED na

// set the caller loop num to mimic what was happening in plant loop equip
this->callerLoopNum = calledFromLocation.loopNum;

if (this->myOneTimeInitFlag) {
this->setupOutputVars();
this->myOneTimeInitFlag = false;
Expand Down Expand Up @@ -357,6 +361,8 @@ namespace WaterThermalTanks {
}
this->UpdateWaterThermalTank();
this->ReportWaterThermalTank();
// reset the caller loop num to mimic what was happening in PlantLoopEquip
this->callerLoopNum = 0;
}

PlantComponent *HeatPumpWaterHeaterData::factory(std::string const &objectName)
Expand Down Expand Up @@ -395,7 +401,7 @@ namespace WaterThermalTanks {
OptLoad = this->Capacity;
}

void HeatPumpWaterHeaterData::simulate(const PlantLocation &EP_UNUSED(calledFromLocation),
void HeatPumpWaterHeaterData::simulate(const PlantLocation &calledFromLocation,
bool FirstHVACIteration,
Real64 &CurLoad,
bool EP_UNUSED(RunFlag))
Expand All @@ -408,6 +414,9 @@ namespace WaterThermalTanks {

auto &Tank = WaterThermalTank(this->WaterHeaterTankNum);

// set caller loop num to mimic what plantloopequip was doing
Tank.callerLoopNum = calledFromLocation.loopNum;

if (this->myOneTimeInitFlag) {
if (Tank.myOneTimeInitFlag) {
Tank.setupOutputVars();
Expand Down Expand Up @@ -478,6 +487,8 @@ namespace WaterThermalTanks {
this->FanNum = IHPFanIndexSav;
this->FanName = IHPFanNameSave;
this->FanPlacement = IHPFanplaceSav;
// reset caller loop num to 0 to mimic what plantloopequip was doing
Tank.callerLoopNum = 0;
}

void SimulateWaterHeaterStandAlone(int const WaterHeaterNum, bool const FirstHVACIteration)
Expand Down

7 comments on commit 2b808b6

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

sky-emissivity (xuanluo113) - 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.

sky-emissivity (xuanluo113) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

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

sky-emissivity (xuanluo113) - x86_64-MacOS-10.13-clang: OK (2616 of 2617 tests passed, 0 test warnings)

Failures:\n

SQLiteFixture Test Summary

  • Passed: 76
  • SEGFAULT: 1

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.

sky-emissivity (xuanluo113) - x86_64-Linux-Ubuntu-18.04-gcc-7.4: OK (2656 of 2657 tests passed, 0 test warnings)

Failures:\n

SQLiteFixture Test Summary

  • Passed: 76
  • SEGFAULT: 1

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.

sky-emissivity (xuanluo113) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-UnitTestsCoverage-Debug: OK (1268 of 1269 tests passed, 0 test warnings)

Failures:\n

SQLiteFixture Test Summary

  • Passed: 76
  • Child aborted: 1

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.

sky-emissivity (xuanluo113) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-IntegrationCoverage-Debug: OK (677 of 678 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 677
  • 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.

sky-emissivity (xuanluo113) - Win64-Windows-10-VisualStudio-16: OK (2616 of 2617 tests passed, 0 test warnings)

Failures:\n

SQLiteFixture Test Summary

  • Passed: 76
  • Failed: 1

Build Badge Test Badge

Please sign in to comment.