Skip to content
9 changes: 0 additions & 9 deletions src/EnergyPlus/DataHeatBalance.hh
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,6 @@ namespace DataHeatBalance {
Num
};

// System type, detailed refrigeration or refrigerated case rack
enum class RefrigSystemType
{
Invalid = -1,
Detailed,
Rack,
Num
};

// Refrigeration condenser type
enum class RefrigCondenserType
{
Expand Down
8 changes: 6 additions & 2 deletions src/EnergyPlus/DataZoneEquipment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ void GetZoneEquipmentData(EnergyPlusData &state)
state.dataZoneEquip->ReturnAirPath.allocate(state.dataZoneEquip->NumReturnAirPaths);
}

if (!state.dataHeatBal->ZoneIntGain.allocated()) {
DataHeatBalance::AllocateIntGains(state);
}

state.dataZoneEquip->ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); // Allocate the array containing the configuration data for each zone
if (state.dataHeatBal->doSpaceHeatBalanceSizing || state.dataHeatBal->doSpaceHeatBalanceSimulation) {
state.dataZoneEquip->spaceEquipConfig.allocate(
Expand Down Expand Up @@ -300,8 +304,8 @@ void GetZoneEquipmentData(EnergyPlusData &state)

// auto &Zone(state.dataHeatBal->Zone);

CurrentModuleObject = "ZoneHVAC:EquipmentConnections";
for (int controlledZoneLoop = 1; controlledZoneLoop <= numControlledZones; ++controlledZoneLoop) {
CurrentModuleObject = "ZoneHVAC:EquipmentConnections";
state.dataInputProcessing->inputProcessor->getObjectItem(state,
CurrentModuleObject,
controlledZoneLoop,
Expand Down Expand Up @@ -350,8 +354,8 @@ void GetZoneEquipmentData(EnergyPlusData &state)
NodeNums);
thisZone.SystemZoneNodeNumber = thisZoneEquipConfig.ZoneNode;
} // end loop over controlled zones
CurrentModuleObject = "SpaceHVAC:EquipmentConnections";
for (int controlledSpaceLoop = 1; controlledSpaceLoop <= numControlledSpaces; ++controlledSpaceLoop) {
CurrentModuleObject = "SpaceHVAC:EquipmentConnections";
if (!state.dataHeatBal->doSpaceHeatBalanceSimulation) {
ShowWarningError(
state,
Expand Down
50 changes: 2 additions & 48 deletions src/EnergyPlus/HeatingCoils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1039,58 +1039,12 @@ namespace HeatingCoils {
// (when zone equipment heating coils are included in the input, the air loop DX equipment has not yet been read in)
if (Util::SameString(Alphas(5), "Refrigeration:CompressorRack")) {
heatingCoil.ReclaimHeatingSource = HeatObjTypes::COMPRESSORRACK_REFRIGERATEDCASE;
RefrigeratedCase::GetRefrigeratedRackIndex(
state, Alphas(6), heatingCoil.ReclaimHeatingSourceIndexNum, DataHeatBalance::RefrigSystemType::Rack, DXCoilErrFlag, Alphas(5));
if (heatingCoil.ReclaimHeatingSourceIndexNum > 0) {
if (allocated(state.dataHeatBal->HeatReclaimRefrigeratedRack)) {
DataHeatBalance::HeatReclaimDataBase &HeatReclaim =
state.dataHeatBal->HeatReclaimRefrigeratedRack(heatingCoil.ReclaimHeatingSourceIndexNum);
if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) {
HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil);
std::fill(HeatReclaim.HVACDesuperheaterReclaimedHeat.begin(), HeatReclaim.HVACDesuperheaterReclaimedHeat.end(), 0.0);
}
HeatReclaim.ReclaimEfficiencyTotal += heatingCoil.Efficiency;
if (HeatReclaim.ReclaimEfficiencyTotal > 0.3) {
ShowSevereError(
state,
format("{}, \"{}\" sum of heat reclaim recovery efficiencies from the same source coil: \"{} \" cannot be over 0.3",
HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num),
heatingCoil.Name,
heatingCoil.ReclaimHeatingCoilName));
}
state.dataHeatingCoils->ValidSourceType(CoilNum) = true;
}
}
// Refrigeration equipment hasn't been loaded yet, so handle this in InitHeatingCoil
Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with this comment. However, all the coils will be gotten in getInput, but for this coil InitHeatingCoil will also be called. So if Refrigeration equipment hasn't been loaded yet then it also won't be loaded yet when InitHeatingCoil is called for this coil. If, say, coil 5 is the desuperheating coil, then by the time coil 5 is called then refrigeration equipment will likely be set up. But what if coil 1 is the desuperheating coil? Not sure how to delay this setup in InitHeatingCoils, or even if that section of code executes each iteration (I hope not) but these code execution timing issues pop up now and then and we need to be sure it works regardless of which coil (index) is called first (i.e., refrigeration equipment must be gotten before this setup in InitHeatingCoils can execute correctly). The code I am referencing is new line 1386 in this branch (old line 1482 in develop).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The timing issue I ran into wasn't with the coils, but the ZoneHVAC:EquipmentConnections objects. As long as those were all loaded before refrigeration (and coils) the order of the coils didn't seem to matter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, as long as this was thought about again so this doesn't pop up in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a larger, longer-term "fix" but you can use init_state to control the order in which objects get read from the IDF file and initialized. A few object types (mostly ones that don't reference other objects like Schedule, FluidProperties, Material, etc.) are already done this way.

} else if ((Util::SameString(Alphas(5), "Refrigeration:Condenser:AirCooled")) ||
(Util::SameString(Alphas(5), "Refrigeration:Condenser:EvaporativeCooled")) ||
(Util::SameString(Alphas(5), "Refrigeration:Condenser:WaterCooled"))) {
heatingCoil.ReclaimHeatingSource = HeatObjTypes::CONDENSER_REFRIGERATION;
RefrigeratedCase::GetRefrigeratedRackIndex(state,
Alphas(6),
heatingCoil.ReclaimHeatingSourceIndexNum,
DataHeatBalance::RefrigSystemType::Detailed,
DXCoilErrFlag,
Alphas(5));
if (heatingCoil.ReclaimHeatingSourceIndexNum > 0) {
if (allocated(state.dataHeatBal->HeatReclaimRefrigCondenser)) {
DataHeatBalance::HeatReclaimDataBase &HeatReclaim =
state.dataHeatBal->HeatReclaimRefrigCondenser(heatingCoil.ReclaimHeatingSourceIndexNum);
if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) {
HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil);
std::fill(HeatReclaim.HVACDesuperheaterReclaimedHeat.begin(), HeatReclaim.HVACDesuperheaterReclaimedHeat.end(), 0.0);
}
HeatReclaim.ReclaimEfficiencyTotal += heatingCoil.Efficiency;
if (HeatReclaim.ReclaimEfficiencyTotal > 0.9) {
ShowSevereError(
state,
format("{}, \"{}\" sum of heat reclaim recovery efficiencies from the same source coil: \"{} \" cannot be over 0.9",
HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num),
heatingCoil.Name,
heatingCoil.ReclaimHeatingCoilName));
}
state.dataHeatingCoils->ValidSourceType(CoilNum) = true;
}
}
// Refrigeration equipment hasn't been loaded yet, so handle this in InitHeatingCoil
} else if (Util::SameString(Alphas(5), "Coil:Cooling:DX:SingleSpeed")) {
heatingCoil.ReclaimHeatingSource = HeatObjTypes::COIL_DX_COOLING;
DXCoils::GetDXCoilIndex(state, Alphas(6), heatingCoil.ReclaimHeatingSourceIndexNum, DXCoilErrFlag, Alphas(5));
Expand Down
101 changes: 17 additions & 84 deletions src/EnergyPlus/RefrigeratedCase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
// ObjexxFCL Headers
#include <ObjexxFCL/Array.functions.hh>
#include <ObjexxFCL/Array2D.hh>
// #include <ObjexxFCL/Fmath.hh>

// EnergyPlus Headers
#include <EnergyPlus/BranchNodeConnections.hh>
Expand All @@ -62,7 +61,6 @@
#include <EnergyPlus/DataHVACGlobals.hh>
#include <EnergyPlus/DataHeatBalFanSys.hh>
#include <EnergyPlus/DataHeatBalance.hh>
#include <EnergyPlus/DataIPShortCuts.hh>
#include <EnergyPlus/DataLoopNode.hh>
#include <EnergyPlus/DataWater.hh>
#include <EnergyPlus/DataZoneEnergyDemands.hh>
Expand Down Expand Up @@ -142,7 +140,7 @@ namespace EnergyPlus::RefrigeratedCase {
// the calculated refrigerant mass flow through the compressors. The solution usually requires less than 5 iterations.
// The refrigerant state exiting the compressor group is known so the amount of heat available for
// desuperheat reclaim is explicitly known.
// The detailed refrigeration model allows the use of subcoolers,secondary loops, and cascade condensers
// The detailed refrigeration model allows the use of subcoolers, secondary loops, and cascade condensers
// to transfer load from one suction group to another. This introduces the need for further iterations among
// the systems. Three loops through the
// systems are adequate to model these interactions. The detailed model will also calculate a variable suction
Expand Down Expand Up @@ -561,6 +559,9 @@ void GetRefrigerationInput(EnergyPlusData &state)
state.dataRefrigCase->HaveChillers = false;
}

if (state.dataRefrigCase->HaveCasesOrWalkins && !state.dataHeatBal->RefrigCaseCredit.allocated()) {
state.dataHeatBal->RefrigCaseCredit.allocate(state.dataGlobal->NumOfZones);
}
if (state.dataRefrigCase->NumRefrigeratedRacks > 0) {
RefrigRack.allocate(state.dataRefrigCase->NumRefrigeratedRacks);
state.dataHeatBal->HeatReclaimRefrigeratedRack.allocate(state.dataRefrigCase->NumRefrigeratedRacks);
Expand Down Expand Up @@ -10628,18 +10629,17 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state)
// "Impact of ASHRAE Standard 62-1989 on Florida Supermarkets",
// Florida Solar Energy Center, FSEC-CR-910-96, Final Report, Oct. 1996

Real64 COPFTempOutput; // Curve value for COPFTemp curve object
Real64 CondenserFrac; // Fraction of condenser power as a function of outdoor temperature
Real64 TotalHeatRejectedToZone; // Total compressor and condenser fan heat rejected to zone (based on CaseRAFactor)
int HeatRejectZoneNum; // Index to zone where heat is rejected
int HeatRejectZoneNodeNum; // Index to zone where heat is rejected
Real64 OutWbTemp; // Outdoor wet bulb temp at condenser air inlet node [C]
Real64 OutDbTemp; // Outdoor dry bulb temp at condenser air inlet node [C]
Real64 EffectTemp; // Effective outdoor temp when using evap condenser cooling [C]
Real64 HumRatIn; // Humidity ratio of inlet air to condenser [kg/kg]
Real64 HumRatOut; // Humidity ratio of outlet air from condenser (assumed saturated) [kg/kg]
Real64 BPress; // Barometric pressure at condenser air inlet node [Pa]
bool EvapAvail; // Control for evap condenser availability
Real64 COPFTempOutput; // Curve value for COPFTemp curve object
Real64 OutWbTemp; // Outdoor wet bulb temp at condenser air inlet node [C]
Real64 OutDbTemp; // Outdoor dry bulb temp at condenser air inlet node [C]
Real64 EffectTemp; // Effective outdoor temp when using evap condenser cooling [C]
Real64 HumRatIn; // Humidity ratio of inlet air to condenser [kg/kg]
Real64 BPress; // Barometric pressure at condenser air inlet node [Pa]
Real64 TotalHeatRejectedToZone = 0.0; // Total compressor and condenser fan heat rejected to zone (based on CaseRAFactor)
Real64 CondenserFrac = 0.0; // Fraction of condenser power as a function of outdoor temperature
bool EvapAvail = true; // Control for evap condenser availability
int HeatRejectZoneNum = 0; // Index to zone where heat is rejected
int HeatRejectZoneNodeNum = 0; // Index to zone where heat is rejected

auto &RefrigCase = state.dataRefrigCase->RefrigCase;
auto &WalkIn = state.dataRefrigCase->WalkIn;
Expand All @@ -10653,14 +10653,9 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state)
state.dataRefrigCase->TotalCondenserPumpPower = 0.0;
state.dataRefrigCase->TotalBasinHeatPower = 0.0;
state.dataRefrigCase->TotalCondenserHeat = 0.0;
TotalHeatRejectedToZone = 0.0;
state.dataRefrigCase->TotalEvapWaterUseRate = 0.0;
state.dataRefrigCase->RackSenCreditToZone = 0.0;
state.dataRefrigCase->RackSenCreditToHVAC = 0.0;
CondenserFrac = 0.0;
EvapAvail = true;
HeatRejectZoneNum = 0;
HeatRejectZoneNodeNum = 0;

// Loads for chiller sets are set in call to zone equipment element "SimAirChillerSet"
// (all chiller coils within a set are located in the same zone)
Expand Down Expand Up @@ -10828,7 +10823,8 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state)
// assumes pump runs whenever evap cooling is available to minimize scaling
if (this->CondenserType == DataHeatBalance::RefrigCondenserType::Evap && EvapAvail) {
state.dataRefrigCase->TotalCondenserPumpPower = this->EvapPumpPower;
HumRatOut = Psychrometrics::PsyWFnTdbTwbPb(state, EffectTemp, OutWbTemp, BPress);
// Humidity ratio of outlet air from condenser (assumed saturated) [kg/kg]
const Real64 HumRatOut = Psychrometrics::PsyWFnTdbTwbPb(state, EffectTemp, OutWbTemp, BPress);
state.dataRefrigCase->TotalEvapWaterUseRate = this->CondenserAirFlowRate * CondenserFrac *
Psychrometrics::PsyRhoAirFnPbTdbW(state, BPress, OutDbTemp, HumRatIn) * (HumRatOut - HumRatIn) /
Psychrometrics::RhoH2O(EffectTemp);
Expand Down Expand Up @@ -14009,69 +14005,6 @@ void RefrigSystemData::CalculateSubcoolers(EnergyPlusData &state)
}
}

void GetRefrigeratedRackIndex(EnergyPlusData &state,
std::string const &Name,
int &IndexPtr,
DataHeatBalance::RefrigSystemType const SysType,
bool &ErrorsFound,
std::string_view const ThisObjectType,
bool const SuppressWarning)
{

// SUBROUTINE INFORMATION:
// AUTHOR Richard Raustad
// DATE WRITTEN June 2007
// MODIFIED Therese Stovall May 2008
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// This subroutine sets an index for a given refrigerated rack or refrigeration condenser
// -- issues error message if the rack or condenser is not found.

auto &RefrigRack = state.dataRefrigCase->RefrigRack;
auto &Condenser = state.dataRefrigCase->Condenser;

CheckRefrigerationInput(state);

switch (SysType) {
case DataHeatBalance::RefrigSystemType::Rack: {
IndexPtr = Util::FindItemInList(Name, RefrigRack);
if (IndexPtr == 0) {
if (SuppressWarning) {
// No warning printed if only searching for the existence of a refrigerated rack
} else {
if (!ThisObjectType.empty()) {
ShowSevereError(state, fmt::format("{}, GetRefrigeratedRackIndex: Rack not found={}", ThisObjectType, Name));
} else {
if (!ThisObjectType.empty()) {
ShowSevereError(state, fmt::format("{}, GetRefrigeratedRackIndex: Rack not found={}", ThisObjectType, Name));
} else {
ShowSevereError(state, format("GetRefrigeratedRackIndex: Rack not found={}", Name));
}
}
}
ErrorsFound = true;
}
} break;
case DataHeatBalance::RefrigSystemType::Detailed: {
IndexPtr = Util::FindItemInList(Name, Condenser);
if (IndexPtr == 0) {
if (SuppressWarning) {
// No warning printed if only searching for the existence of a refrigeration Condenser
} else {
if (!ThisObjectType.empty()) {
ShowSevereError(state, fmt::format("{}, GetRefrigeratedRackIndex: Condenser not found={}", ThisObjectType, Name));
} else {
ShowSevereError(state, format("GetRefrigeratedRackIndex: Condenser not found={}", Name));
}
}
}
ErrorsFound = true;
} break;
default:
break;
}
}

void ReportRefrigerationComponents(EnergyPlusData &state)
{

Expand Down
8 changes: 0 additions & 8 deletions src/EnergyPlus/RefrigeratedCase.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1494,14 +1494,6 @@ namespace RefrigeratedCase {

void SimulateDetailedTransRefrigSystems(EnergyPlusData &state);

void GetRefrigeratedRackIndex(EnergyPlusData &state,
std::string const &Name,
int &IndexPtr,
DataHeatBalance::RefrigSystemType SysType,
bool &ErrorsFound,
std::string_view const ThisObjectType = {},
bool const SuppressWarning = false);

void ReportRefrigerationComponents(EnergyPlusData &state);

void SumZoneImpacts(EnergyPlusData &state);
Expand Down
Loading