Skip to content

Commit

Permalink
Correcting errors causing regression diffs.
Browse files Browse the repository at this point in the history
QGLHE is still not initialized at the beginning of each environment.
  • Loading branch information
Matt Mitchell committed Jan 23, 2015
1 parent 1875158 commit 3caafe1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 43 deletions.
35 changes: 11 additions & 24 deletions src/EnergyPlus/GroundHeatExchangers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ namespace GroundHeatExchangers {
Real64 GLHEInletTemp( 0.0 ); // Inlet temperature of the fluid [°C]
Real64 GLHEMassFlowRate( 0.0 ); // Mass flowrate of the fluid [Kg/s]
Real64 QGLHE( 0.0 ); // The normalized heat transfer rate[W/m]
Real64 GLHERB( 0.0 ); // [K per W/m] Just for Analyis will be removed later
//Real64 GLHERB( 0.0 ); // [K per W/m] Just for Analyis will be removed later
Real64 GLHEAveFluidTemp( 0.0 ); // The average fluid temperature [°C]
Real64 GLHEBoreholeTemp( 0.0 ); // The average borehole tempreature [°C]
int LocHourOfDay( 0 );
int LocDayOfSim( 0 );
FArray1D< Real64 > LastQnSubHr; // Previous time step Qn subhourly value
//FArray1D< Real64 > LastQnSubHr; // Previous time step Qn subhourly value
Real64 MDotActual;

FArray1D< Real64 > PrevTimeSteps; // This is used to store only the Last Few time step's time
Expand Down Expand Up @@ -373,7 +373,7 @@ namespace GroundHeatExchangers {
if ( N != PrevN ) {
PrevN = N;
for ( I = 1; I <= NumVerticalGLHEs; ++I ) {
VerticalGLHE( I ).QnSubHr = eoshift( VerticalGLHE( I ).QnSubHr, -1, LastQnSubHr( I ) );
VerticalGLHE( I ).QnSubHr = eoshift( VerticalGLHE( I ).QnSubHr, -1, this->LastQnSubHr );
}
}

Expand Down Expand Up @@ -570,7 +570,7 @@ namespace GroundHeatExchangers {
//Load the QnSubHourly Array with a new value at end of every timestep

//Load the report vars
//this->LastQnSubHr = tmpQnSubHourly;
this->LastQnSubHr = tmpQnSubHourly;
this->GLHEOutletTemp = ToutNew;
this->QGLHE = tmpQnSubHourly;
this->GLHEAveFluidTemp = FluidAveTemp;
Expand Down Expand Up @@ -1156,42 +1156,29 @@ namespace GroundHeatExchangers {
// na

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
static bool MyEnvironFlag( true );
Real64 FluidDensity;
static FArray1D_bool MyFlag;
static bool MyOneTimeFlag( true );
static FArray1D_bool MyEnvrnFlag;
bool errFlag;
static int GLHENum( 0 );

if ( MyOneTimeFlag ) {
MyEnvrnFlag.allocate( NumVerticalGLHEs );
MyFlag.allocate( NumVerticalGLHEs );
MyOneTimeFlag = false;
MyEnvrnFlag = true;
MyFlag = true;
}

// Init more variables
if ( MyFlag( GLHENum ) ) {
if ( this->MyFlag ) {
// Locate the hx on the plant loops for later usage
errFlag = false;
ScanPlantLoopsForObject( this->Name, TypeOf_GrndHtExchgVertical, this->LoopNum, this->LoopSideNum, this->BranchNum, this->CompNum, _, _, _, _, _, errFlag );
if ( errFlag ) {
ShowFatalError( "InitGLHESimVars: Program terminated due to previous condition(s)." );
}
MyFlag( GLHENum ) = false;
this->MyFlag = false;
}

if ( MyEnvrnFlag( GLHENum ) && BeginEnvrnFlag ) {
MyEnvrnFlag( GLHENum ) = false;
if ( this->MyEnvrnFlag && BeginEnvrnFlag ) {
this->MyEnvrnFlag = false;

if ( ! allocated( LastQnSubHr ) ) LastQnSubHr.allocate( NumVerticalGLHEs );
//if ( ! allocated( LastQnSubHr ) ) LastQnSubHr.allocate( NumVerticalGLHEs );
FluidDensity = GetDensityGlycol( PlantLoop( this->LoopNum ).FluidName, 20.0, PlantLoop( this->LoopNum ).FluidIndex, RoutineName );
this->DesignMassFlow = this->DesignFlow * FluidDensity;
InitComponentNodes( 0.0, this->DesignMassFlow, this->GLHEInletNodeNum, this->GLHEOutletNodeNum, this->LoopNum, this->LoopSideNum, this->BranchNum, this->CompNum );

LastQnSubHr = 0.0;
this->LastQnSubHr = 0.0;
Node( this->GLHEInletNodeNum ).Temp = this->TempGround;
Node( this->GLHEOutletNodeNum ).Temp = this->TempGround;

Expand Down Expand Up @@ -1275,7 +1262,7 @@ namespace GroundHeatExchangers {
this->GLHEBoreholeTemp = GLHEBoreholeTemp;
this->GLHEOutletTemp = GLHEOutletTemp;
// calc load from load per unit length.
this->QGLHE = QGLHE * this->BoreholeLength * this->NumBoreholes;
this->QGLHE = this->QGLHE * this->BoreholeLength * this->NumBoreholes;
this->GLHEInletTemp = GLHEInletTemp;
this->GLHEMassFlowRate = GLHEMassFlowRate;
this->GLHEAveFluidTemp = GLHEAveFluidTemp;
Expand Down
44 changes: 25 additions & 19 deletions src/EnergyPlus/GroundHeatExchangers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ namespace GroundHeatExchangers {
extern int const MaxTSinHr; // Max number of time step in a hour

// MODULE VARIABLE DECLARATIONS:
extern int NumVerticalGLHEs;
extern int N; // COUNTER OF TIME STEP
extern Real64 CurrentSimTime; // Current simulation time in hours
extern Real64 GLHEOutletTemp; // Outlet temperature of the fluid [°C]
extern Real64 GLHEInletTemp; // Inlet temperature of the fluid [°C]
extern Real64 GLHEMassFlowRate; // Mass flowrate of the fluid [Kg/s]
extern Real64 QGLHE; // The normalized heat transfer rate[W/m]
extern Real64 GLHERB; // [K per W/m] Just for Analyis will be removed later
extern Real64 GLHEAveFluidTemp; // The average fluid temperature [°C]
extern Real64 GLHEBoreholeTemp; // The average borehole tempreature [°C]
extern int LocHourOfDay;
extern int LocDayOfSim;
extern FArray1D< Real64 > LastQnSubHr; // Previous time step Qn subhourly value
extern Real64 MDotActual;

extern FArray1D< Real64 > PrevTimeSteps; // This is used to store only the Last Few time step's time
//extern int NumVerticalGLHEs;
//extern int N; // COUNTER OF TIME STEP
//extern Real64 CurrentSimTime; // Current simulation time in hours
//extern Real64 GLHEOutletTemp; // Outlet temperature of the fluid [°C]
//extern Real64 GLHEInletTemp; // Inlet temperature of the fluid [°C]
//extern Real64 GLHEMassFlowRate; // Mass flowrate of the fluid [Kg/s]
//extern Real64 QGLHE; // The normalized heat transfer rate[W/m]
////extern Real64 GLHERB; // [K per W/m] Just for Analyis will be removed later
//extern Real64 GLHEAveFluidTemp; // The average fluid temperature [°C]
//extern Real64 GLHEBoreholeTemp; // The average borehole tempreature [°C]
//extern int LocHourOfDay;
//extern int LocDayOfSim;
//extern FArray1D< Real64 > LastQnSubHr; // Previous time step Qn subhourly value
//extern Real64 MDotActual;

//extern FArray1D< Real64 > PrevTimeSteps; // This is used to store only the Last Few time step's time
// to enable the calculation of the subhouly contribution..
// Recommended size, the product of Minimum subhourly history required and
// the maximum no of system time steps in an hour

extern FArray1D_bool CheckEquipName;
//extern FArray1D_bool CheckEquipName;

// SUBROUTINE SPECIFICATIONS FOR MODULE CondenserTowers

Expand Down Expand Up @@ -91,6 +91,8 @@ namespace GroundHeatExchangers {
Real64 GLHEInletTemp; // [°C]
Real64 GLHEAveFluidTemp; // [°C]
Real64 QGLHE; // [W] heat transfer rate
bool MyFlag;
bool MyEnvrnFlag;

// Default Constructor
GLHEBase() :
Expand Down Expand Up @@ -122,7 +124,9 @@ namespace GroundHeatExchangers {
GLHEOutletTemp( 0.0 ),
GLHEInletTemp( 0.0 ),
GLHEAveFluidTemp( 0.0 ),
QGLHE( 0.0 )
QGLHE( 0.0 ),
MyFlag( true ),
MyEnvrnFlag( true )

{}

Expand Down Expand Up @@ -155,6 +159,7 @@ namespace GroundHeatExchangers {
Real64 UtubeDist; // Distance between the legs of the Utube [m]
Real64 ResistanceBhole; // The thermal resistance of the borehole, (K per W/m)
bool RunFlag;
Real64 LastQnSubHr;


// Default Constructor
Expand All @@ -167,7 +172,8 @@ namespace GroundHeatExchangers {
KGrout( 0.0 ),
UtubeDist( 0.0 ),
ResistanceBhole( 0.0 ),
RunFlag( false )
RunFlag( false ),
LastQnSubHr( 0.0 )

{}

Expand Down

7 comments on commit 3caafe1

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1540218-SlinkyGroundHX (mmatts) - x86_64-MacOS-10.9-clang: Build Failed

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

1540218-SlinkyGroundHX (mmatts) - x86_64-Linux-Ubuntu-14.04-gcc-4.8: Build Failed

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

1540218-SlinkyGroundHX (mmatts) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed)

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

1540218-SlinkyGroundHX (mmatts) - x86_64-Linux-Ubuntu-14.04-gcc-4.8-UnitTestsCoverage-Debug: Build Failed

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.

1540218-SlinkyGroundHX (mmatts) - x86_64-Linux-Ubuntu-14.04-gcc-4.8-IntegrationCoverage-Debug: Build Failed

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.

1540218-SlinkyGroundHX (mmatts) - i386-Windows-7-VisualStudio-12: OK (1580 of 1591 tests passed)

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

1540218-SlinkyGroundHX (mmatts) - Win64-Windows-7-VisualStudio-12: OK (1580 of 1591 tests passed)

Build Badge Test Badge

Please sign in to comment.