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

Global EcoRoofManager, RoomAirModelManager, InternalHeatGains, HVACDXHeatPumpSystem, and HVACUnitaryBypassVAV #8585

Merged
merged 16 commits into from
Mar 5, 2021
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
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 @@ -973,22 +973,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 @@ -631,6 +600,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 @@ -1295,16 +1266,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 @@ -1324,16 +1295,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