Skip to content

Commit

Permalink
move SetupOutputVars to member method
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Jan 28, 2021
1 parent 30f1d89 commit aee166c
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 96 deletions.
157 changes: 62 additions & 95 deletions src/EnergyPlus/GroundHeatExchangers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ namespace EnergyPlus::GroundHeatExchangers {
this->props = GetVertProps(state, UtilityRoutines::MakeUPPERCase(j["ghe_vertical_properties_object_name"]));
this->xLoc = j["x_location"];
this->yLoc = j["y_location"];
this->dl_i = 0.0;
this->dl_ii = 0.0;
this->dl_j = 0.0;
}

//******************************************************************************
Expand Down Expand Up @@ -649,6 +652,11 @@ namespace EnergyPlus::GroundHeatExchangers {
[[maybe_unused]] bool const RunFlag)
{

if (this->needToSetupOutputVars) {
this->setupOutput(state);
this->needToSetupOutputVars = false;
}

if (state.dataGlobal->KickOffSimulation) {
this->initGLHESimVars(state);
} else {
Expand Down Expand Up @@ -2468,59 +2476,6 @@ namespace EnergyPlus::GroundHeatExchangers {
inputProcessor->markObjectAsUsed(currObj, objName);
state.dataGroundHeatExchanger->verticalGLHE.emplace_back(state, objNameUC, instance);
}

// Set up report variables
for (int GLHENum = 0; GLHENum < state.dataGroundHeatExchanger->numVerticalGLHEs; ++GLHENum) {
auto &thisGLHE(state.dataGroundHeatExchanger->verticalGLHE[GLHENum]);
SetupOutputVariable(state,
"Ground Heat Exchanger Average Borehole Temperature",
OutputProcessor::Unit::C,
thisGLHE.bhTemp,
"System",
"Average",
thisGLHE.name);
SetupOutputVariable(state,
"Ground Heat Exchanger Heat Transfer Rate",
OutputProcessor::Unit::W,
thisGLHE.QGLHE, "System",
"Average",
thisGLHE.name);
SetupOutputVariable(state,
"Ground Heat Exchanger Inlet Temperature",
OutputProcessor::Unit::C,
thisGLHE.inletTemp,
"System",
"Average",
thisGLHE.name);
SetupOutputVariable(state,
"Ground Heat Exchanger Outlet Temperature",
OutputProcessor::Unit::C,
thisGLHE.outletTemp,
"System",
"Average",
thisGLHE.name);
SetupOutputVariable(state,
"Ground Heat Exchanger Mass Flow Rate",
OutputProcessor::Unit::kg_s,
thisGLHE.massFlowRate,
"System",
"Average",
thisGLHE.name);
SetupOutputVariable(state,
"Ground Heat Exchanger Average Fluid Temperature",
OutputProcessor::Unit::C,
thisGLHE.aveFluidTemp,
"System",
"Average",
thisGLHE.name);
SetupOutputVariable(state,
"Ground Heat Exchanger Farfield Ground Temperature",
OutputProcessor::Unit::C,
thisGLHE.tempGround,
"System",
"Average",
thisGLHE.name);
}
}

// SLINKY GLHE
Expand Down Expand Up @@ -2694,53 +2649,65 @@ namespace EnergyPlus::GroundHeatExchangers {

state.dataGroundHeatExchanger->slinkyGLHE.push_back(thisGLHE);
}

// Set up report variables
for (int GLHENum = 0; GLHENum < state.dataGroundHeatExchanger->numSlinkyGLHEs; ++GLHENum) {
auto &thisGLHE(state.dataGroundHeatExchanger->slinkyGLHE[GLHENum]);
SetupOutputVariable(state,
"Ground Heat Exchanger Average Borehole Temperature",
OutputProcessor::Unit::C,
thisGLHE.bhTemp,
"System",
"Average",
thisGLHE.name);
SetupOutputVariable(
state, "Ground Heat Exchanger Heat Transfer Rate", OutputProcessor::Unit::W, thisGLHE.QGLHE, "System", "Average", thisGLHE.name);
SetupOutputVariable(state,
"Ground Heat Exchanger Inlet Temperature",
OutputProcessor::Unit::C,
thisGLHE.inletTemp,
"System",
"Average",
thisGLHE.name);
SetupOutputVariable(state,
"Ground Heat Exchanger Outlet Temperature",
OutputProcessor::Unit::C,
thisGLHE.outletTemp,
"System",
"Average",
thisGLHE.name);
SetupOutputVariable(state,
"Ground Heat Exchanger Mass Flow Rate",
OutputProcessor::Unit::kg_s,
thisGLHE.massFlowRate,
"System",
"Average",
thisGLHE.name);
SetupOutputVariable(state,
"Ground Heat Exchanger Average Fluid Temperature",
OutputProcessor::Unit::C,
thisGLHE.aveFluidTemp,
"System",
"Average",
thisGLHE.name);
}
}
}

//******************************************************************************

void GLHEBase::setupOutput(EnergyPlusData &state)
{
SetupOutputVariable(state,
"Ground Heat Exchanger Average Borehole Temperature",
OutputProcessor::Unit::C,
this->bhTemp,
"System",
"Average",
this->name);
SetupOutputVariable(state,
"Ground Heat Exchanger Heat Transfer Rate",
OutputProcessor::Unit::W,
this->QGLHE, "System",
"Average",
this->name);
SetupOutputVariable(state,
"Ground Heat Exchanger Inlet Temperature",
OutputProcessor::Unit::C,
this->inletTemp,
"System",
"Average",
this->name);
SetupOutputVariable(state,
"Ground Heat Exchanger Outlet Temperature",
OutputProcessor::Unit::C,
this->outletTemp,
"System",
"Average",
this->name);
SetupOutputVariable(state,
"Ground Heat Exchanger Mass Flow Rate",
OutputProcessor::Unit::kg_s,
this->massFlowRate,
"System",
"Average",
this->name);
SetupOutputVariable(state,
"Ground Heat Exchanger Average Fluid Temperature",
OutputProcessor::Unit::C,
this->aveFluidTemp,
"System",
"Average",
this->name);
SetupOutputVariable(state,
"Ground Heat Exchanger Farfield Ground Temperature",
OutputProcessor::Unit::C,
this->tempGround,
"System",
"Average",
this->name);
}

//******************************************************************************

Real64 GLHEVert::calcBHAverageResistance(EnergyPlusData &state)
{
// Calculates the average thermal resistance of the borehole using the first-order multipole method.
Expand Down
5 changes: 4 additions & 1 deletion src/EnergyPlus/GroundHeatExchangers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,14 @@ namespace GroundHeatExchangers {
int PrevN; // The saved value of N at previous time step
bool updateCurSimTime; // Used to reset the CurSimTime to reset after WarmupFlag
bool triggerDesignDayReset;
bool needToSetupOutputVars;

GLHEBase()
: available(false), on(false), loopNum(0), loopSideNum(0), branchNum(0), compNum(0), inletNodeNum(0), outletNodeNum(0), designFlow(0.0),
designMassFlow(0.0), tempGround(0.0), prevHour(1), AGG(0), SubAGG(0), bhTemp(0.0), massFlowRate(0.0), outletTemp(0.0), inletTemp(0.0),
aveFluidTemp(0.0), QGLHE(0.0), myFlag(true), myEnvrnFlag(true), gFunctionsExist(false), lastQnSubHr(0.0), HXResistance(0.0),
totalTubeLength(0.0), timeSS(0.0), timeSSFactor(0.0), firstTime(true), numErrorCalls(0), ToutNew(19.375), PrevN(1),
updateCurSimTime(true), triggerDesignDayReset(false)
updateCurSimTime(true), triggerDesignDayReset(false), needToSetupOutputVars(true)
{
}

Expand Down Expand Up @@ -311,6 +312,8 @@ namespace GroundHeatExchangers {
virtual void getAnnualTimeConstant() = 0;

virtual void initEnvironment(EnergyPlusData &state, Real64 const &CurTime) = 0;

void setupOutput(EnergyPlusData &state);
};

struct GLHEVert : GLHEBase
Expand Down

0 comments on commit aee166c

Please sign in to comment.