Skip to content

Commit

Permalink
Merge branch 'develop' into Global-DataSysVars
Browse files Browse the repository at this point in the history
  • Loading branch information
jmythms committed Mar 5, 2021
2 parents 3b4b381 + acf6f6a commit 5aa35b1
Show file tree
Hide file tree
Showing 16 changed files with 419 additions and 474 deletions.
175 changes: 98 additions & 77 deletions src/EnergyPlus/EcoRoofManager.cc

Large diffs are not rendered by default.

30 changes: 16 additions & 14 deletions src/EnergyPlus/EcoRoofManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,6 @@ struct EnergyPlusData;

namespace EcoRoofManager {

extern Real64 CumRunoff; // Cumulative runoff, updated each time step (m) mult by roof area to get volume
extern Real64 CumET; // Cumulative evapotranspiration from soil and plants (m)
extern Real64 CumPrecip;
extern Real64 CumIrrigation; // Cumulative irrigation, updated each time step (m) mult by roof area to get volume
extern Real64 CurrentRunoff;
extern Real64 CurrentET;
extern Real64 CurrentPrecipitation; // units of (m) per timestep
extern Real64 CurrentIrrigation; // units of (m) per timestep

extern Real64 Tfold; // leaf temperature from the previous time step
extern Real64 Tgold; // ground temperature from the previous time step
extern bool EcoRoofbeginFlag;

// Functions

void CalcEcoRoof(EnergyPlusData &state,
Expand Down Expand Up @@ -101,9 +88,24 @@ namespace EcoRoofManager {

struct EcoRoofManagerData : BaseGlobalStruct {

Real64 CumRunoff; // Cumulative runoff, updated each time step (m) mult by roof area to get volume
Real64 CumET; // Cumulative evapotranspiration from soil and plants (m)
Real64 CumPrecip;
Real64 CumIrrigation; // Cumulative irrigation, updated each time step (m) mult by roof area to get volume
Real64 CurrentRunoff;
Real64 CurrentET;
Real64 CurrentPrecipitation; // units of (m) per timestep
Real64 CurrentIrrigation; // units of (m) per timestep

Real64 Tfold; // leaf temperature from the previous time step
Real64 Tgold; // ground temperature from the previous time step
bool EcoRoofbeginFlag = true;
bool CalcEcoRoofMyEnvrnFlag = true;

void clear_state() override
{

this->EcoRoofbeginFlag = true;
this->CalcEcoRoofMyEnvrnFlag = true;
}
};

Expand Down
10 changes: 5 additions & 5 deletions src/EnergyPlus/FaultsManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -930,22 +930,22 @@ namespace FaultsManager {
}
} else if (UtilityRoutines::SameString(SELECT_CASE_VAR, "CoilSystem:Heating:DX")) {
// Read in DXCoolingSystem input if not done yet
if (HVACDXHeatPumpSystem::GetInputFlag) {
if (state.dataHVACDXHeatPumpSys->GetInputFlag) {
HVACDXHeatPumpSystem::GetDXHeatPumpSystemInput(state);
HVACDXHeatPumpSystem::GetInputFlag = false;
state.dataHVACDXHeatPumpSys->GetInputFlag = false;
}

// Check the coil name and coil type
int CoilSysNum =
UtilityRoutines::FindItemInList(FaultsCoilSATSensor(jFault_CoilSAT).CoilName, HVACDXHeatPumpSystem::DXHeatPumpSystem);
UtilityRoutines::FindItemInList(FaultsCoilSATSensor(jFault_CoilSAT).CoilName, state.dataHVACDXHeatPumpSys->DXHeatPumpSystem);
if (CoilSysNum <= 0) {
ShowSevereError(state, cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
cAlphaArgs(5) + "\" not found.");
ErrorsFound = true;
} else {
// Link the coil system with the fault model
HVACDXHeatPumpSystem::DXHeatPumpSystem(CoilSysNum).FaultyCoilSATFlag = true;
HVACDXHeatPumpSystem::DXHeatPumpSystem(CoilSysNum).FaultyCoilSATIndex = jFault_CoilSAT;
state.dataHVACDXHeatPumpSys->DXHeatPumpSystem(CoilSysNum).FaultyCoilSATFlag = true;
state.dataHVACDXHeatPumpSys->DXHeatPumpSystem(CoilSysNum).FaultyCoilSATIndex = jFault_CoilSAT;
}
} else if (UtilityRoutines::SameString(SELECT_CASE_VAR, "AirLoopHVAC:UnitarySystem")) {
// UnitarySystem model connects to FaultManager via function call to FaultsManager::SetFaultyCoilSATSensor
Expand Down
85 changes: 28 additions & 57 deletions src/EnergyPlus/HVACDXHeatPumpSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,45 +98,6 @@ namespace HVACDXHeatPumpSystem {
using namespace DataHVACGlobals;
using namespace ScheduleManager;

// Data
// MODULE PARAMETER DEFINITIONS
Real64 const MinAirMassFlow(0.001);

bool GetInputFlag(true); // Flag to get input only once

// DERIVED TYPE DEFINITIONS

// MODULE VARIABLE DECLARATIONS:
int NumDXHeatPumpSystems(0); // The Number of DXHeatPumpSystems found in the Input
bool EconomizerFlag(false); // holds air loop economizer status

// Make this type allocatable
Array1D_bool CheckEquipName;

// Subroutine Specifications for the Module
// Driver/Manager Routines

// Get Input routines for module

// Update routine to check convergence and update nodes

// Object Data
Array1D<DXHeatPumpSystemStruct> DXHeatPumpSystem;

// MODULE SUBROUTINES:
//*************************************************************************

// Functions

void clear_state()
{
GetInputFlag = true;
NumDXHeatPumpSystems = 0;
EconomizerFlag = false;
CheckEquipName.deallocate();
DXHeatPumpSystem.deallocate();
}

void SimDXHeatPumpSystem(EnergyPlusData &state, std::string const &DXHeatPumpSystemName, // Name of DXSystem:Airloop object
bool const FirstHVACIteration, // True when first HVAC iteration
int const AirLoopNum, // Primary air loop number
Expand Down Expand Up @@ -177,11 +138,14 @@ namespace HVACDXHeatPumpSystem {
static Real64 FanDelayTime(0.0); // Fan delay time, time delay for the HP's fan to
static Real64 OnOffAirFlowRatio(1.0); // ratio of compressor on flow to average flow over time step

auto &NumDXHeatPumpSystems(state.dataHVACDXHeatPumpSys->NumDXHeatPumpSystems);
auto &DXHeatPumpSystem(state.dataHVACDXHeatPumpSys->DXHeatPumpSystem);

// Obtains and Allocates DX Cooling System related parameters from input file
if (GetInputFlag) { // First time subroutine has been entered
if (state.dataHVACDXHeatPumpSys->GetInputFlag) { // First time subroutine has been entered
// Get the DXCoolingSystem input
GetDXHeatPumpSystemInput(state);
GetInputFlag = false;
state.dataHVACDXHeatPumpSys->GetInputFlag = false;
}

// Find the correct DXSystemNumber
Expand All @@ -200,15 +164,15 @@ namespace HVACDXHeatPumpSystem {
NumDXHeatPumpSystems,
DXHeatPumpSystemName));
}
if (CheckEquipName(DXSystemNum)) {
if (state.dataHVACDXHeatPumpSys->CheckEquipName(DXSystemNum)) {
if (DXHeatPumpSystemName != DXHeatPumpSystem(DXSystemNum).Name) {
ShowFatalError(state,
format("SimDXHeatPumpSystem: Invalid CompIndex passed={}, DX Unit name={}, stored DX Unit Name for that index={}",
DXSystemNum,
DXHeatPumpSystemName,
DXHeatPumpSystem(DXSystemNum).Name));
}
CheckEquipName(DXSystemNum) = false;
state.dataHVACDXHeatPumpSys->CheckEquipName(DXSystemNum) = false;
}
}

Expand Down Expand Up @@ -323,11 +287,14 @@ namespace HVACDXHeatPumpSystem {
static int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a
// certain object in the input file

auto &NumDXHeatPumpSystems(state.dataHVACDXHeatPumpSys->NumDXHeatPumpSystems);
auto &DXHeatPumpSystem(state.dataHVACDXHeatPumpSys->DXHeatPumpSystem);

CurrentModuleObject = "CoilSystem:Heating:DX";
NumDXHeatPumpSystems = inputProcessor->getNumObjectsFound(state, CurrentModuleObject);

DXHeatPumpSystem.allocate(NumDXHeatPumpSystems);
CheckEquipName.dimension(NumDXHeatPumpSystems, true);
state.dataHVACDXHeatPumpSys->CheckEquipName.dimension(NumDXHeatPumpSystems, true);

inputProcessor->getObjectDefMaxArgs(state, "CoilSystem:Heating:DX", TotalArgs, NumAlphas, NumNums);

Expand Down Expand Up @@ -505,6 +472,8 @@ namespace HVACDXHeatPumpSystem {
int OutdoorAirUnitNum; // "ONLY" for ZoneHVAC:OutdoorAirUnit
Real64 OAUCoilOutletTemp; // "ONLY" for zoneHVAC:OutdoorAirUnit

auto &NumDXHeatPumpSystems(state.dataHVACDXHeatPumpSys->NumDXHeatPumpSystems);
auto &DXHeatPumpSystem(state.dataHVACDXHeatPumpSys->DXHeatPumpSystem);

// IF (MyOneTimeFlag) THEN
// MyOneTimeFlag = .FALSE.
Expand Down Expand Up @@ -551,7 +520,7 @@ namespace HVACDXHeatPumpSystem {

} else if (AirLoopNum != -1) { // Not Outdoor Air Unit
ControlNode = DXHeatPumpSystem(DXSystemNum).DXSystemControlNodeNum;
EconomizerFlag = state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive;
state.dataHVACDXHeatPumpSys->EconomizerFlag = state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive;
DXHeatPumpSystem(DXSystemNum).DesiredOutletTemp = Node(ControlNode).TempSetPoint;
}
}
Expand Down Expand Up @@ -630,6 +599,8 @@ namespace HVACDXHeatPumpSystem {
int I; // interation increment
Real64 SpeedRatio; // speed ratio between two neighboring speeds

auto &DXHeatPumpSystem(state.dataHVACDXHeatPumpSys->DXHeatPumpSystem);

// Set local variables
// Retrieve the load on the controlled zone
OutletNode = DXHeatPumpSystem(DXSystemNum).DXHeatPumpCoilOutletNodeNum;
Expand Down Expand Up @@ -1294,16 +1265,16 @@ namespace HVACDXHeatPumpSystem {
int NodeNum;
int DXHeatSysNum;

if (GetInputFlag) { // First time subroutine has been entered
if (state.dataHVACDXHeatPumpSys->GetInputFlag) { // First time subroutine has been entered
GetDXHeatPumpSystemInput(state);
GetInputFlag = false;
state.dataHVACDXHeatPumpSys->GetInputFlag = false;
}

NodeNum = 0;
if (NumDXHeatPumpSystems > 0) {
DXHeatSysNum = UtilityRoutines::FindItemInList(DXHeatCoilSysName, DXHeatPumpSystem);
if (DXHeatSysNum > 0 && DXHeatSysNum <= NumDXHeatPumpSystems) {
NodeNum = DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilInletNodeNum;
if (state.dataHVACDXHeatPumpSys->NumDXHeatPumpSystems > 0) {
DXHeatSysNum = UtilityRoutines::FindItemInList(DXHeatCoilSysName, state.dataHVACDXHeatPumpSys->DXHeatPumpSystem);
if (DXHeatSysNum > 0 && DXHeatSysNum <= state.dataHVACDXHeatPumpSys->NumDXHeatPumpSystems) {
NodeNum = state.dataHVACDXHeatPumpSys->DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilInletNodeNum;
}
}
if (NodeNum == 0) InletNodeErrFlag = true;
Expand All @@ -1323,16 +1294,16 @@ namespace HVACDXHeatPumpSystem {
int NodeNum;
int DXHeatSysNum;

if (GetInputFlag) { // First time subroutine has been entered
if (state.dataHVACDXHeatPumpSys->GetInputFlag) { // First time subroutine has been entered
GetDXHeatPumpSystemInput(state);
GetInputFlag = false;
state.dataHVACDXHeatPumpSys->GetInputFlag = false;
}

NodeNum = 0;
if (NumDXHeatPumpSystems > 0) {
DXHeatSysNum = UtilityRoutines::FindItemInList(DXHeatCoilSysName, DXHeatPumpSystem);
if (DXHeatSysNum > 0 && DXHeatSysNum <= NumDXHeatPumpSystems) {
NodeNum = DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilOutletNodeNum;
if (state.dataHVACDXHeatPumpSys->NumDXHeatPumpSystems > 0) {
DXHeatSysNum = UtilityRoutines::FindItemInList(DXHeatCoilSysName, state.dataHVACDXHeatPumpSys->DXHeatPumpSystem);
if (DXHeatSysNum > 0 && DXHeatSysNum <= state.dataHVACDXHeatPumpSys->NumDXHeatPumpSystems) {
NodeNum = state.dataHVACDXHeatPumpSys->DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilOutletNodeNum;
}
}
if (NodeNum == 0) OutletNodeErrFlag = true;
Expand Down
42 changes: 12 additions & 30 deletions src/EnergyPlus/HVACDXHeatPumpSystem.hh
Original file line number Diff line number Diff line change
Expand Up @@ -64,35 +64,14 @@ struct EnergyPlusData;

namespace HVACDXHeatPumpSystem {

// Using/Aliasing

// Data
// MODULE PARAMETER DEFINITIONS
extern Real64 const MinAirMassFlow;
constexpr Real64 MinAirMassFlow(0.001);

// Compressor operation
constexpr int On(1); // normal compressor operation
constexpr int Off(0); // signal DXCoil that compressor shouldn't run

// DERIVED TYPE DEFINITIONS

// MODULE VARIABLE DECLARATIONS:
extern int NumDXHeatPumpSystems; // The Number of DXHeatPumpSystems found in the Input
extern bool EconomizerFlag; // holds air loop economizer status
extern bool GetInputFlag; // Flag to get input only once

// Make this type allocatable
extern Array1D_bool CheckEquipName;

// Subroutine Specifications for the Module
// Driver/Manager Routines

// Get Input routines for module

// Update routine to check convergence and update nodes

// Types

struct DXHeatPumpSystemStruct
{
// Members
Expand Down Expand Up @@ -136,13 +115,6 @@ namespace HVACDXHeatPumpSystem {
}
};

// Object Data
extern Array1D<DXHeatPumpSystemStruct> DXHeatPumpSystem;

// Functions

void clear_state();

void SimDXHeatPumpSystem(EnergyPlusData &state, std::string const &DXHeatPumpSystemName, // Name of DXSystem:Airloop object
bool const FirstHVACIteration, // True when first HVAC iteration
int const AirLoopNum, // Primary air loop number
Expand Down Expand Up @@ -206,10 +178,20 @@ namespace HVACDXHeatPumpSystem {
} // namespace HVACDXHeatPumpSystem

struct HVACDXHeatPumpSystemData : BaseGlobalStruct {

int NumDXHeatPumpSystems = 0; // The Number of DXHeatPumpSystems found in the Input
bool EconomizerFlag = false; // holds air loop economizer status
bool GetInputFlag = true; // Flag to get input only once
Array1D_bool CheckEquipName;
Array1D<HVACDXHeatPumpSystem::DXHeatPumpSystemStruct> DXHeatPumpSystem;

void clear_state() override
{

this->GetInputFlag = true;
this->NumDXHeatPumpSystems = 0;
this->EconomizerFlag = false;
this->CheckEquipName.deallocate();
this->DXHeatPumpSystem.deallocate();
}
};

Expand Down
Loading

5 comments on commit 5aa35b1

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

Global-DataSysVars (jmythms) - x86_64-MacOS-10.15-clang-11.0.0: OK (3041 of 3059 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1118
  • Failed: 1
  • SEGFAULT: 5

integration Test Summary

  • Passed: 712
  • Failed: 12

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.

Global-DataSysVars (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1608 of 1613 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1119
  • Child aborted: 5

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.

Global-DataSysVars (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3082 of 3099 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1119
  • SEGFAULT: 5

integration Test Summary

  • Passed: 715
  • Failed: 12

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.

Global-DataSysVars (jmythms) - Win64-Windows-10-VisualStudio-16: OK (2291 of 2308 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1118
  • Failed: 5

integration Test Summary

  • Passed: 712
  • Failed: 12

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.

Global-DataSysVars (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (714 of 727 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 714
  • Failed: 12
  • Timeout: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.