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

Lee vertical ghx #13

Merged
merged 2 commits into from
Feb 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
150 changes: 22 additions & 128 deletions src/EnergyPlus/GroundHeatExchangers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,145 +189,39 @@ namespace GroundHeatExchangers {
slinkyGLHE.deallocate();
}

void
SimGroundHeatExchangers(
int const typeNum,
std::string const & name,
int & compIndex,
bool const EP_UNUSED( runFlag ),
bool const EP_UNUSED( firstIteration ),
bool const initLoopEquip
)
{
// SUBROUTINE INFORMATION:
// AUTHOR: Dan Fisher
// DATE WRITTEN: August, 2000
// MODIFIED Arun Murugappan
// RE-ENGINEERED na

// PURPOSE OF THIS SUBROUTINE:
// mananges the simulation of the vertical closed-loop ground heat
// exchangers (GLHE) model

// METHODOLOGY EMPLOYED:

// REFERENCES:
// Eskilson, P. 'Thermal Analysis of Heat Extraction Boreholes' Ph.D. Thesis:
// Dept. of Mathematical Physics, University of Lund, Sweden, June 1987.
// Yavuzturk, C., J.D. Spitler. 1999. 'A Short Time Step Response Factor Model
// for Vertical Ground Loop Heat Exchangers. ASHRAE Transactions. 105(2): 475-485.

// USE STATEMENTS:

// Using/Aliasing
using InputProcessor::FindItemInList;

// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:

// SUBROUTINE PARAMETER DEFINITIONS:
// na

// INTERFACE BLOCK SPECIFICATIONS:
// na

// DERIVED TYPE DEFINITIONS:
// na

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
void GLHEBase::onInitLoopEquip( const PlantLocation & EP_UNUSED( calledFromLocation ) ) {
this->initGLHESimVars();
}

int GLHENum;
void GLHEBase::simulate( const PlantLocation & EP_UNUSED(calledFromLocation), bool const EP_UNUSED(FirstHVACIteration), Real64 & EP_UNUSED( CurLoad ) ) {
this->initGLHESimVars();
this->calcGroundHeatExchanger();
this->updateGHX();
}

//GET INPUT
PlantComponent * GLHEBase::factory( int const objectType, std::string objectName ) {
if ( GetInput ) {
GetGroundHeatExchangerInput();
GetInput = false;
}

if ( typeNum == DataPlant::TypeOf_GrndHtExchgVertical ) {

// Find the correct GLHE
if ( compIndex == 0 ) {
Array1D< std::string > tmpNames( numVerticalGLHEs );
for ( int i = 1; i <= numVerticalGLHEs; ++i ) {
tmpNames( i ) = verticalGLHE( i ).Name;
}
GLHENum = FindItemInList( name, tmpNames, numVerticalGLHEs );
if ( GLHENum == 0 ) {
ShowFatalError( "SimGroundHeatExchangers: Unit not found=" + name );
}
compIndex = GLHENum;
} else {
GLHENum = compIndex;
if ( GLHENum > numVerticalGLHEs || GLHENum < 1 ) {
ShowFatalError( "SimGroundHeatExchangers: Invalid compIndex passed=" + TrimSigDigits( GLHENum ) + ", Number of Units=" + TrimSigDigits( numVerticalGLHEs ) + ", Entered Unit name=" + name );
}
if ( checkEquipName( GLHENum ) ) {
if ( name != verticalGLHE( GLHENum ).Name ) {
ShowFatalError( "SimGroundHeatExchangers: Invalid compIndex passed=" + TrimSigDigits( numVerticalGLHEs ) + ", Unit name=" + name + ", stored Unit name for that index=" + verticalGLHE( GLHENum ).Name );
}
checkEquipName( GLHENum ) = false;
if ( objectType == DataPlant::TypeOf_GrndHtExchgVertical ) {
for ( auto & ghx : verticalGLHE ) {
if ( ghx.Name == objectName ) {
return &ghx;
}
}

auto & thisGLHE( verticalGLHE( GLHENum ) );

if ( initLoopEquip ) {
thisGLHE.initGLHESimVars();
return;
}

// Initialize HX
thisGLHE.initGLHESimVars();

// Simulat HX
thisGLHE.calcGroundHeatExchanger();

// Update HX Report Vars
thisGLHE.updateGHX();

} else if ( typeNum == DataPlant::TypeOf_GrndHtExchgSlinky ) {

// Find the correct GLHE
if ( compIndex == 0 ) {
Array1D< std::string > tmpNames( numSlinkyGLHEs );
for ( int i = 1; i <= numSlinkyGLHEs; ++i ) {
tmpNames( i ) = slinkyGLHE( i ).Name;
}
GLHENum = FindItemInList( name, tmpNames, numSlinkyGLHEs );
if ( GLHENum == 0 ) {
ShowFatalError( "SimGroundHeatExchangers: Unit not found=" + name );
}
compIndex = GLHENum;
} else {
GLHENum = compIndex;
if ( GLHENum > numSlinkyGLHEs || GLHENum < 1 ) {
ShowFatalError( "SimGroundHeatExchangers: Invalid compIndex passed=" + TrimSigDigits( GLHENum ) + ", Number of Units=" + TrimSigDigits( numSlinkyGLHEs ) + ", Entered Unit name=" + name );
} else if ( objectType == DataPlant::TypeOf_GrndHtExchgSlinky ) {
for ( auto & ghx : slinkyGLHE ) {
if ( ghx.Name == objectName ) {
return &ghx;
}
if ( checkEquipName( GLHENum ) ) {
if ( name != slinkyGLHE( GLHENum ).Name ) {
ShowFatalError( "SimGroundHeatExchangers: Invalid compIndex passed=" + TrimSigDigits( numSlinkyGLHEs ) + ", Unit name=" + name + ", stored Unit name for that index=" + slinkyGLHE( GLHENum ).Name );
}
checkEquipName( GLHENum ) = false;
}
}

auto & thisGLHE( slinkyGLHE( GLHENum ) );

if ( initLoopEquip ) {
thisGLHE.initGLHESimVars();
return;
}

// Initialize HX
thisGLHE.initGLHESimVars();

// Simulate HX
thisGLHE.calcGroundHeatExchanger();

// Update HX Report Vars
thisGLHE.updateGHX();
}
// If we didn't find it, fatal
ShowFatalError( "Ground Heat Exchanger Factory: Error getting inputs for GHX named: " + objectName );
// Shut up the compiler
return nullptr;
}

//******************************************************************************
Expand Down Expand Up @@ -2245,7 +2139,7 @@ namespace GroundHeatExchangers {
InitComponentNodes( 0.0, designMassFlow, inletNodeNum, outletNodeNum, loopNum, loopSideNum, branchNum, compNum );

lastQnSubHr = 0.0;
Node( inletNodeNum ).Temp = this->groundTempModel->getGroundTempAtTimeInSeconds( coilDepth, CurTime );
Node( inletNodeNum ).Temp = this->groundTempModel->getGroundTempAtTimeInSeconds( coilDepth, CurTime );
Node( outletNodeNum ).Temp = this->groundTempModel->getGroundTempAtTimeInSeconds( coilDepth, CurTime );

// zero out all history arrays
Expand Down
21 changes: 9 additions & 12 deletions src/EnergyPlus/GroundHeatExchangers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#include <EnergyPlus.hh>
#include <DataGlobals.hh>
#include <GroundTemperatureModeling/GroundTemperatureModelManager.hh>
#include <PlantComponent.hh>

namespace EnergyPlus {

Expand All @@ -87,10 +88,10 @@ namespace GroundHeatExchangers {

// Types

struct GLHEBase
struct GLHEBase : PlantComponent
{
// Destructor
virtual
virtual
~GLHEBase()
{}

Expand Down Expand Up @@ -210,6 +211,12 @@ namespace GroundHeatExchangers {
virtual void
getAnnualTimeConstant()=0;

void onInitLoopEquip( const PlantLocation & EP_UNUSED( calledFromLocation ) );

void simulate( const PlantLocation & calledFromLocation, bool const FirstHVACIteration, Real64 & CurLoad );

static PlantComponent * factory( int const objectType, std::string objectName );

};

struct GLHEVert:GLHEBase
Expand Down Expand Up @@ -403,16 +410,6 @@ namespace GroundHeatExchangers {
void
clear_state();

void
SimGroundHeatExchangers(
int const GLHETypeNum,
std::string const & name,
int & compIndex,
bool const runFlag,
bool const firstIteration,
bool const initLoopEquip
);

void
GetGroundHeatExchangerInput();

Expand Down
21 changes: 3 additions & 18 deletions src/EnergyPlus/PlantLoopEquip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ namespace PlantLoopEquip {
using ICEngineElectricGenerator::SimICEPlantHeatRecovery;
using CTElectricGenerator::SimCTPlantHeatRecovery;
using MicroturbineElectricGenerator::SimMTPlantHeatRecovery;
using SurfaceGroundHeatExchanger::SimSurfaceGroundHeatExchanger;
using PondGroundHeatExchanger::SimPondGroundHeatExchanger;

using PlantLoadProfile::SimulatePlantProfile;
Expand Down Expand Up @@ -793,19 +792,10 @@ namespace PlantLoopEquip {
} else if ( GeneralEquipType == GenEquipTypes_GroundHeatExchanger ) {

if ( EquipTypeNum == TypeOf_GrndHtExchgVertical ) { // 'GROUND HEAT EXCHANGER:VERTICAL'
//sim_component.compPtr->simulate( sim_component_location, FirstHVACIteration, CurLoad );
GroundHeatExchangers::SimGroundHeatExchangers( sim_component.TypeOf_Num, sim_component.Name, EquipNum, RunFlag, FirstHVACIteration, InitLoopEquip ); //DSU

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

} else if ( EquipTypeNum == TypeOf_GrndHtExchgSurface ) { // 'GROUND HEAT EXCHANGER:SURFACE'
SimSurfaceGroundHeatExchanger( sim_component.Name, EquipNum, FirstHVACIteration, RunFlag, InitLoopEquip ); //DSU

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

} else if ( EquipTypeNum == TypeOf_GrndHtExchgPond ) { // 'GROUND HEAT EXCHANGER:POND'
SimPondGroundHeatExchanger( sim_component.Name, EquipNum, FirstHVACIteration, RunFlag, InitLoopEquip, MaxLoad, MinLoad, OptLoad ); //DSU
Expand All @@ -826,12 +816,7 @@ namespace PlantLoopEquip {
}

} else if ( EquipTypeNum == TypeOf_GrndHtExchgSlinky ) { // 'GROUND HEAT EXCHANGER:SLINKY'
//sim_component.compPtr->simulate( sim_component_location, FirstHVACIteration, CurLoad );
GroundHeatExchangers::SimGroundHeatExchangers( sim_component.TypeOf_Num, sim_component.Name, EquipNum, RunFlag, FirstHVACIteration, InitLoopEquip );

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


}
Expand Down
6 changes: 4 additions & 2 deletions src/EnergyPlus/PlantManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
#include <ReportSizingManager.hh>
#include <ScheduleManager.hh>
#include <SetPointManager.hh>
#include <SurfaceGroundHeatExchanger.hh>
#include <SystemAvailabilityManager.hh>
#include <UtilityRoutines.hh>

Expand Down Expand Up @@ -1020,11 +1021,12 @@ namespace PlantManager {
this_comp.TypeOf_Num = TypeOf_GrndHtExchgVertical;
this_comp.GeneralEquipType = GenEquipTypes_GroundHeatExchanger;
this_comp.CurOpSchemeType = UncontrolledOpSchemeType;
//this_comp.compPtr = GroundHeatExchangers::GLHEBase::factory( TypeOf_GrndHtExchgVertical, CompNames( CompNum ) );
this_comp.compPtr = GroundHeatExchangers::GLHEBase::factory( TypeOf_GrndHtExchgVertical, CompNames( CompNum ) );
} else if ( SameString( this_comp_type, "GroundHeatExchanger:Surface" ) ) {
this_comp.TypeOf_Num = TypeOf_GrndHtExchgSurface;
this_comp.GeneralEquipType = GenEquipTypes_GroundHeatExchanger;
this_comp.CurOpSchemeType = UncontrolledOpSchemeType;
this_comp.compPtr = SurfaceGroundHeatExchanger::SurfaceGroundHeatExchangerData::factory( TypeOf_GrndHtExchgSurface, CompNames( CompNum ) );
} else if ( SameString( this_comp_type, "GroundHeatExchanger:Pond" ) ) {
this_comp.TypeOf_Num = TypeOf_GrndHtExchgPond;
this_comp.GeneralEquipType = GenEquipTypes_GroundHeatExchanger;
Expand All @@ -1033,7 +1035,7 @@ namespace PlantManager {
this_comp.TypeOf_Num = TypeOf_GrndHtExchgSlinky;
this_comp.GeneralEquipType = GenEquipTypes_GroundHeatExchanger;
this_comp.CurOpSchemeType = UncontrolledOpSchemeType;
//this_comp.compPtr = GroundHeatExchangers::GLHEBase::factory( TypeOf_GrndHtExchgSlinky, CompNames( CompNum ) );
this_comp.compPtr = GroundHeatExchangers::GLHEBase::factory( TypeOf_GrndHtExchgSlinky, CompNames( CompNum ) );
} else if ( SameString( this_comp_type, "Chiller:Electric:EIR" ) ) {
this_comp.TypeOf_Num = TypeOf_Chiller_ElectricEIR;
this_comp.GeneralEquipType = GenEquipTypes_Chiller;
Expand Down